fix:coding#656form表单
This commit is contained in:
parent
5b676f7c4b
commit
3e3c34e49f
|
@ -3,28 +3,44 @@
|
|||
@closed="$emit('closed')">
|
||||
<el-form ref="dialogForm" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="交接物料" prop="material">
|
||||
<el-select v-model="form.wm" placeholder="交接物料" clearable style="width:100%"
|
||||
@change="materialChange">
|
||||
<el-option v-for="item in materialOptions" :key="item.id" :label="item.batch"
|
||||
:value="item.id"></el-option>
|
||||
<el-col>
|
||||
<el-form-item label="交接物料" prop="wm">
|
||||
<el-select
|
||||
v-model="formWm"
|
||||
placeholder="交接物料"
|
||||
clearable
|
||||
value-key="id"
|
||||
style="width:100%"
|
||||
:disabled="mode == 'edit'"
|
||||
@change="materialChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in materialOptions"
|
||||
:key="item.id"
|
||||
:label="item.material_name + '---' + item.batch"
|
||||
:value="item"
|
||||
>
|
||||
<span style="float: left"
|
||||
>{{ item.material_name }}---{{
|
||||
item.batch
|
||||
}}</span
|
||||
>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>{{ item.count }}</span
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="交接数量" width="100">
|
||||
<el-input-number v-model="form.count" controls-position="right" :min="0" step="1"
|
||||
:step-strictly="true" style="width:100%" placeholder="交接数量">
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="送料部门" prop="send_dept">
|
||||
<el-select v-model="form.send_dept" placeholder="送料部门" clearable style="width:100%">
|
||||
<el-option v-for="item in deptOptions" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-form-item label="交送日期">
|
||||
<el-date-picker v-model="form.send_date" type="date" placeholder="选择时间" format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD" style="width:100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
|
@ -36,7 +52,7 @@
|
|||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="接收部门" prop="recive_dept">
|
||||
<el-select v-model="form.recive_dept" placeholder="接收部门" clearable style="width:100%">
|
||||
<el-select v-model="form.recive_dept" placeholder="接收部门" @change="reciveDeptChange" clearable style="width:100%">
|
||||
<el-option v-for="item in deptOptions" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
|
@ -50,9 +66,10 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="交送日期">
|
||||
<el-date-picker v-model="form.send_date" type="date" placeholder="选择时间" format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD" style="width:100%" />
|
||||
<el-form-item label="交接数量" width="100">
|
||||
<el-input-number v-model="form.count" controls-position="right" :min="0" step="1"
|
||||
:step-strictly="true" style="width:100%" placeholder="交接数量">
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -66,6 +83,11 @@
|
|||
<script>
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
props: {
|
||||
mgroup: { type: String, default: "" },
|
||||
type: { type: String, default: "" },
|
||||
dept: { type: String, default: "" }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
yseorno: ['是', '否'],
|
||||
|
@ -78,15 +100,19 @@ export default {
|
|||
},
|
||||
handle_user: [],
|
||||
form: {
|
||||
batch: '',
|
||||
count: 0,//送料数
|
||||
wm: '',
|
||||
batch: '',
|
||||
count: 0, //送料数
|
||||
send_user: '',
|
||||
send_dept: '',
|
||||
send_date: '',
|
||||
send_mgroup:'',
|
||||
recive_dept: '',
|
||||
recive_user: '',
|
||||
count_eweight : 0 ,//每桶重量
|
||||
// handoverb:[],
|
||||
},
|
||||
formWm:null,
|
||||
userList: [],
|
||||
userList2: [],
|
||||
deptOptions: [],
|
||||
|
@ -97,39 +123,42 @@ export default {
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
let materialObj = this.$TOOL.data.get('MATERIAL_OBJECT');
|
||||
this.materialObj = materialObj;
|
||||
this.getDeptOptions();
|
||||
this.getMaterial();
|
||||
this.getUserList();
|
||||
let that = this;
|
||||
let date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
this.form.handle_date = year + '-' + month + '-' + day;
|
||||
|
||||
that.form.handle_date = that.$TOOL.dateFormat2(date);
|
||||
let materialObj = that.$TOOL.data.get('MATERIAL_OBJECT');
|
||||
that.materialObj = materialObj;
|
||||
that.getDeptOptions();//获取车间部门
|
||||
that.getMaterial();//获取车间交接物料
|
||||
that.getUserList();//获取接收员
|
||||
that.form.send_dept = that.dept;
|
||||
},
|
||||
methods: {
|
||||
//获取6车间和8车间 的人员
|
||||
//交送人
|
||||
getUserList() {
|
||||
let that = this;
|
||||
this.$API.system.user.list.req({ belong_dept__name: '6车间', page: 0 }).then(res => {
|
||||
that.userList2 = res;
|
||||
});
|
||||
this.$API.system.user.list.req({ belong_dept__name: '8车间', page: 0 }).then(res => {
|
||||
that.$API.system.user.list.req({ belong_dept: that.dept, page: 0 }).then(res => {
|
||||
that.userList = res;
|
||||
});
|
||||
},
|
||||
//获取部门列表
|
||||
getDeptOptions() {
|
||||
this.$API.system.dept.list.req({ page: 0, type__in: 'dept' }).then((res) => {
|
||||
this.deptOptions = res;
|
||||
let that = this;
|
||||
that.$API.system.dept.list.req({ page: 0, type__in: 'dept' }).then((res) => {
|
||||
that.deptOptions = res;
|
||||
});
|
||||
},
|
||||
//获取车间物料
|
||||
getMaterial() {
|
||||
let that = this;
|
||||
this.$API.wpm.wmaterial.list.req({ belong_dept_name: '8车间', page: 0 }).then(res => {
|
||||
let obj = {};
|
||||
obj.belong_dept = that.dept;
|
||||
obj.page = 0;
|
||||
obj.count__gte = 1;
|
||||
that.$API.wpm.wmaterial.list.req(obj).then(res => {
|
||||
that.materialOptions = res;
|
||||
});
|
||||
},
|
||||
|
@ -149,36 +178,49 @@ export default {
|
|||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//接收人
|
||||
reciveDeptChange(){
|
||||
let that = this;
|
||||
that.$API.system.user.list.req({ belong_dept:that.form.recive_dept, page: 0 }).then(res => {
|
||||
that.userList2 = res;
|
||||
});
|
||||
},
|
||||
materialChange(val) {
|
||||
let data = this.materialOptions.filter(item => {
|
||||
return item.id == val;
|
||||
})
|
||||
this.form.batch = data[0].batch;
|
||||
// let obj = new Object();
|
||||
// obj.wm = val.id;
|
||||
// obj.count = val.count;
|
||||
// this.form.handoverb.push(obj);
|
||||
this.form.wm = val.id;
|
||||
this.form.count = val.count;
|
||||
this.form.batch = val.batch;
|
||||
this.form.material = val.material;
|
||||
// this.form.count_eweight = val.count_eweight;
|
||||
},
|
||||
//提交
|
||||
submit() {
|
||||
this.$refs.dialogForm.validate(async (valid) => {
|
||||
let that = this;
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (this.mode == "add") {
|
||||
this.$API.wpm.handover.create.req(this.form).then(res => {
|
||||
this.isSaveing = false;
|
||||
this.$emit("success", this.form, this.mode);
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功");
|
||||
if (that.mode == "add") {
|
||||
that.$API.wpm.handover.create.req(that.form).then(res => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
}).catch((err) => {
|
||||
//可以处理校验错误
|
||||
this.isSaveing = false;
|
||||
that.isSaveing = false;
|
||||
return err;
|
||||
})
|
||||
} else if (this.mode == "edit") {
|
||||
this.$API.wpm.handover.update.req(this.form.id, this.form).then(res => {
|
||||
this.isSaveing = false;
|
||||
this.$emit("success", this.form, this.mode);
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功");
|
||||
} else if (that.mode == "edit") {
|
||||
that.$API.wpm.handover.update.req(that.form.id, that.form).then(res => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
}).catch((err) => {
|
||||
//可以处理校验错误
|
||||
this.isSaveing = false;
|
||||
that.isSaveing = false;
|
||||
return err;
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue