115 lines
4.4 KiB
Vue
115 lines
4.4 KiB
Vue
<template>
|
|
<el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
|
|
<el-container v-loading="loading">
|
|
<el-main>
|
|
<el-form ref="dialogForm" :model="form" :rules="rules" label-width="120px">
|
|
<el-row>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="产品系列" prop="product">
|
|
<el-input v-model="form.product" placeholder="AVG" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="操作日期" prop="handle_date">
|
|
<el-date-picker v-model="form.handle_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">
|
|
<el-form-item label="生产数">
|
|
<el-input-number v-model="form.count_real" :min="0" style="width:100%"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="合格数">
|
|
<el-input-number v-model="form.count_ok" :min="0" style="width:100%"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="交付数">
|
|
<el-input-number v-model="form.count_delivered" :min="0"
|
|
style="width:100%"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
</el-main>
|
|
<el-footer>
|
|
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
|
<el-button @click="visible = false">取消</el-button>
|
|
</el-footer>
|
|
</el-container>
|
|
</el-dialog>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
emits: ["success", "closed"],
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
mode: "add",
|
|
titleMap: {
|
|
add: "新增",
|
|
edit: "编辑",
|
|
show: "查看",
|
|
},
|
|
form: {
|
|
product: '18AVG',
|
|
count_real: 0,
|
|
count_ok: 0,
|
|
count_delivered: 0
|
|
},
|
|
rules: {
|
|
handle_date: [{ required: true, message: "请选择日期", trigger: "blur" }]
|
|
},
|
|
visible: false,
|
|
isSaveing: false,
|
|
options: [],
|
|
};
|
|
},
|
|
mounted() {
|
|
},
|
|
methods: {
|
|
//显示
|
|
open(mode = "add") {
|
|
this.mode = mode;
|
|
this.visible = true;
|
|
if(this.mode == "add"){
|
|
let date = new Date();
|
|
this.form.work_start_time = this.$TOOL.dateFormat1(date);
|
|
}
|
|
return this;
|
|
},
|
|
//提交
|
|
submit() {
|
|
this.$refs.dialogForm.validate(async (valid) => {
|
|
if (valid) {
|
|
this.isSaveing = true;
|
|
try {
|
|
var res;
|
|
if (this.mode == "add") {
|
|
res = await this.$API.wpm.otherlog.create.req(this.form);
|
|
} else if (this.mode == "edit") {
|
|
res = await this.$API.pum.otherlog.update.req(this.form.id, this.form);
|
|
}
|
|
this.isSaveing = false;
|
|
this.$emit("success", this.form, this.mode);
|
|
this.visible = false;
|
|
this.$message.success("操作成功");
|
|
} catch (err) {
|
|
//可以处理校验错误
|
|
this.isSaveing = false;
|
|
return err;
|
|
}
|
|
}
|
|
});
|
|
},
|
|
//表单注入数据
|
|
setData(data) {
|
|
Object.assign(this.form, data);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style></style>
|
|
|