208 lines
5.8 KiB
Vue
208 lines
5.8 KiB
Vue
|
|
<template>
|
||
|
|
<div >
|
||
|
|
<el-row :gutter="0">
|
||
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||
|
|
<el-col :span="24">
|
||
|
|
<el-form-item label="取重方式" prop="carryType">
|
||
|
|
<el-select v-model="form.carryType" placeholder="请选择取重方式">
|
||
|
|
<el-option
|
||
|
|
v-for="dict in dict.type.emis_take_weight_method"
|
||
|
|
:key="dict.value"
|
||
|
|
:label="dict.label"
|
||
|
|
:value="dict.value"
|
||
|
|
></el-option>
|
||
|
|
</el-select>
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="24">
|
||
|
|
<el-form-item label="起始时间" prop="beginDate">
|
||
|
|
<el-date-picker clearable
|
||
|
|
v-model="form.beginDate"
|
||
|
|
type="date"
|
||
|
|
value-format="yyyy-MM-dd"
|
||
|
|
placeholder="请选择起始时间">
|
||
|
|
</el-date-picker>
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="24">
|
||
|
|
<el-form-item label="结束时间" prop="endDate">
|
||
|
|
<el-date-picker clearable
|
||
|
|
v-model="form.endDate"
|
||
|
|
type="date"
|
||
|
|
value-format="yyyy-MM-dd"
|
||
|
|
placeholder="请选择结束时间">
|
||
|
|
</el-date-picker>
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
<el-col :span="24">
|
||
|
|
<el-form-item label="备注" prop="remark">
|
||
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||
|
|
</el-form-item>
|
||
|
|
</el-col>
|
||
|
|
|
||
|
|
<el-form-item label="上级字典">
|
||
|
|
<treeselect
|
||
|
|
ref="tree"
|
||
|
|
v-model="form.parentId"
|
||
|
|
:options="emisSpecialCalcWeightOptions"
|
||
|
|
:normalizer="normalizer"
|
||
|
|
:default-expand-level="1"
|
||
|
|
:show-count="true"
|
||
|
|
placeholder="选择上级"
|
||
|
|
/>
|
||
|
|
</el-form-item>
|
||
|
|
|
||
|
|
|
||
|
|
</el-form>
|
||
|
|
</el-row>
|
||
|
|
<div style="text-align: center;margin-bottom: 10px;">
|
||
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||
|
|
<el-button @click="cancel">取 消</el-button>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import { listEmisSpecialCalcWeight, getEmisSpecialCalcWeight, delEmisSpecialCalcWeight, addEmisSpecialCalcWeight, updateEmisSpecialCalcWeight } from "@/api/emis/emisSpecialCalcWeight";
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: "emisSpecialCalcWeightForm",
|
||
|
|
props:{
|
||
|
|
id:undefined
|
||
|
|
},
|
||
|
|
components: { },
|
||
|
|
dicts: [
|
||
|
|
'sys_normal_disable',
|
||
|
|
'emis_take_weight_method',
|
||
|
|
],
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
emisSpecialCalcWeightOptions: [],
|
||
|
|
// 遮罩层
|
||
|
|
loading: true,
|
||
|
|
// 表单参数
|
||
|
|
form: {},
|
||
|
|
// 表单校验
|
||
|
|
rules: {
|
||
|
|
prodCode: [
|
||
|
|
{ required: true, message: "产品类型代码不能为空", trigger: "change" }
|
||
|
|
],
|
||
|
|
prodName: [
|
||
|
|
{ required: true, message: "产品类型名称不能为空", trigger: "change" }
|
||
|
|
],
|
||
|
|
status: [
|
||
|
|
{ required: true, message: "启用状态不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
carryType: [
|
||
|
|
{ required: true, message: "取重方式不能为空", trigger: "change" }
|
||
|
|
],
|
||
|
|
beginWeight: [
|
||
|
|
{ required: true, message: "起始重量不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
endWeight: [
|
||
|
|
{ required: true, message: "结束重量不能为空", trigger: "blur" }
|
||
|
|
],
|
||
|
|
}
|
||
|
|
};
|
||
|
|
},
|
||
|
|
watch: {
|
||
|
|
"id": {
|
||
|
|
handler (newValue, oldValue) {
|
||
|
|
this.id = newValue;
|
||
|
|
this.initData();
|
||
|
|
},
|
||
|
|
deep: true
|
||
|
|
}
|
||
|
|
},
|
||
|
|
created() {
|
||
|
|
this.initData();
|
||
|
|
},
|
||
|
|
|
||
|
|
methods: {
|
||
|
|
initData() {
|
||
|
|
this.reset();
|
||
|
|
if(this.id !=undefined) {
|
||
|
|
this.loading = true;
|
||
|
|
getEmisSpecialCalcWeight(this.id).then(response => {
|
||
|
|
this.form = response.data;
|
||
|
|
this.loading = false;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
this.getTreeselect();
|
||
|
|
},
|
||
|
|
// 取消按钮
|
||
|
|
cancel() {
|
||
|
|
this.reset();
|
||
|
|
this.$emit("on-cancel");
|
||
|
|
},
|
||
|
|
// 表单重置
|
||
|
|
reset() {
|
||
|
|
this.form = {
|
||
|
|
id: null,
|
||
|
|
prodCode: null,
|
||
|
|
prodName: null,
|
||
|
|
status: null,
|
||
|
|
carryType: null,
|
||
|
|
beginWeight: null,
|
||
|
|
endWeight: null,
|
||
|
|
beginDate: null,
|
||
|
|
endDate: null,
|
||
|
|
remark: null,
|
||
|
|
tenantId: null,
|
||
|
|
delFlag: null,
|
||
|
|
createBy: null,
|
||
|
|
createTime: null,
|
||
|
|
updateBy: null,
|
||
|
|
updateTime: null
|
||
|
|
};
|
||
|
|
this.resetForm("form");
|
||
|
|
},
|
||
|
|
/** 提交按钮 */
|
||
|
|
submitForm() {
|
||
|
|
this.$refs["form"].validate(valid => {
|
||
|
|
if (valid) {
|
||
|
|
if (this.form.id != null) {
|
||
|
|
updateEmisSpecialCalcWeight(this.form).then(response => {
|
||
|
|
this.$modal.msgSuccess("修改成功");
|
||
|
|
this.$emit("on-changed");
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
addEmisSpecialCalcWeight(this.form).then(response => {
|
||
|
|
this.$modal.msgSuccess("修改成功");
|
||
|
|
this.$emit("on-changed");
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},
|
||
|
|
/** 转换菜单数据结构 */
|
||
|
|
normalizer(node) {
|
||
|
|
if (node.children && !node.children.length) {
|
||
|
|
delete node.children;
|
||
|
|
}
|
||
|
|
return {
|
||
|
|
id: node.id,
|
||
|
|
label: node.idName,
|
||
|
|
children: node.children
|
||
|
|
};
|
||
|
|
},
|
||
|
|
/** 查询菜单下拉树结构 */
|
||
|
|
getTreeselect() {
|
||
|
|
const queryParams = {}
|
||
|
|
listEmisSpecialCalcWeight(queryParams).then(response => {
|
||
|
|
this.emisSpecialCalcWeightOptions = [];
|
||
|
|
const rootItem = { idId: 0, emisSpecialCalcWeightName: '-', children: [] };
|
||
|
|
rootItem.children = this.handleTree(response.data, "id");
|
||
|
|
this.emisSpecialCalcWeightOptions.push(rootItem);
|
||
|
|
|
||
|
|
if(this.parentId != undefined) {
|
||
|
|
this.form.parentId = this.parentId;
|
||
|
|
}
|
||
|
|
|
||
|
|
});
|
||
|
|
},
|
||
|
|
}
|
||
|
|
};
|
||
|
|
</script>
|