116 lines
2.7 KiB
Vue
116 lines
2.7 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2021-11-18 14:16:25
|
|
* @LastEditors: zwq
|
|
* @LastEditTime: 2024-12-27 09:18:43
|
|
* @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="materialName">
|
|
<el-input
|
|
v-model="dataForm.materialName"
|
|
disabled
|
|
placeholder="请输入原料名称" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<!-- <el-col :span="12">
|
|
<el-form-item label="单价" prop="matPrice">
|
|
<el-input
|
|
v-model="dataForm.matPrice"
|
|
disabled
|
|
style="width: 70%"
|
|
placeholder="请输入单价" />
|
|
(元/吨)
|
|
</el-form-item>
|
|
</el-col> -->
|
|
<el-col :span="12">
|
|
<el-form-item label="累计用量" prop="quantity">
|
|
<el-input-number
|
|
:min="0"
|
|
style="width: 80%"
|
|
v-model="dataForm.quantity"
|
|
clearable
|
|
placeholder="请输入累计用量" />
|
|
(吨)
|
|
</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-row>
|
|
</el-form>
|
|
</template>
|
|
|
|
<script>
|
|
import basicAdd from '@/mixins/basic-add';
|
|
import { updateMaterialHis } from '@/api/cost/costMaterial';
|
|
|
|
export default {
|
|
mixins: [basicAdd],
|
|
data() {
|
|
return {
|
|
urlOptions: {
|
|
updateURL: updateMaterialHis,
|
|
},
|
|
dataForm: {
|
|
id: undefined,
|
|
price: undefined,
|
|
quantity: undefined,
|
|
matPrice: undefined,
|
|
materialName: 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>
|