115 lines
2.7 KiB
Vue
115 lines
2.7 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2021-11-18 14:16:25
|
|
* @LastEditors: zwq
|
|
* @LastEditTime: 2024-09-05 15:34:49
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<el-form
|
|
:model="dataForm"
|
|
:rules="dataRule"
|
|
ref="dataForm"
|
|
@keyup.enter.native="dataFormSubmit()"
|
|
label-position="top"
|
|
label-width="80px">
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item label="能源类型" prop="energyTypeName">
|
|
<el-input
|
|
v-model="dataForm.energyTypeName"
|
|
disabled
|
|
placeholder="请输入能源类型" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="日期" prop="recTime">
|
|
<el-date-picker
|
|
v-model="dataForm.recTime"
|
|
type="date"
|
|
value-format="timestamp"
|
|
:style="{ width: '100%' }"
|
|
readonly
|
|
placeholder="选择日期"></el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="总价" prop="price">
|
|
<el-input-number
|
|
:min="0"
|
|
style="width: 80%"
|
|
v-model="dataForm.price"
|
|
clearable
|
|
placeholder="请输入总价" />
|
|
(元)
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="累计用量" prop="quantity">
|
|
<el-input-number
|
|
:min="0"
|
|
style="width: 100%"
|
|
v-model="dataForm.quantity"
|
|
clearable
|
|
placeholder="请输入累计用量" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
</template>
|
|
|
|
<script>
|
|
import basicAdd from '@/mixins/basic-add';
|
|
import { updateEnergyHis } from '@/api/cost/costEnergyDeep';
|
|
|
|
export default {
|
|
mixins: [basicAdd],
|
|
data() {
|
|
return {
|
|
urlOptions: {
|
|
updateURL: updateEnergyHis,
|
|
},
|
|
dataForm: {
|
|
id: undefined,
|
|
price: undefined,
|
|
quantity: undefined,
|
|
energyTypeName: undefined,
|
|
recTime: undefined,
|
|
},
|
|
dataRule: {
|
|
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
|
|
quantity: [
|
|
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
|
|
],
|
|
},
|
|
};
|
|
},
|
|
methods: {
|
|
init(val, statisticType) {
|
|
this.visible = true;
|
|
this.$nextTick(() => {
|
|
this.$refs['dataForm'].resetFields();
|
|
this.dataForm = JSON.parse(JSON.stringify(val));
|
|
this.dataForm.statisticType = statisticType;
|
|
});
|
|
},
|
|
// 表单提交
|
|
dataFormSubmit() {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
if (!valid) {
|
|
return false;
|
|
}
|
|
this.dataForm.modifyPrice = this.dataForm.price;
|
|
this.dataForm.modifyQuantity = this.dataForm.quantity;
|
|
// 修改的提交
|
|
this.urlOptions.updateURL(this.dataForm).then((response) => {
|
|
this.$modal.msgSuccess('修改成功');
|
|
this.visible = false;
|
|
this.$emit('refreshDataList');
|
|
});
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|