Files
qms/src/views/modules/customerquality/components/change-add.vue
‘937886381’ ab30435246 客户质量新增
2023-07-19 17:02:32 +08:00

147 lines
4.3 KiB
Vue

<!--
* @Author: zhp
* @Date: 2023-07-14 13:44:46
* @LastEditTime: 2023-07-19 14:48:19
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<el-drawer close-on-press-escape :title="!dataForm.id ? $t('add') : $t('edit')" size="40%" :append-to-body="true"
:closed="handleClose" :visible.sync="innerDrawer">
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" @keyup.enter.native="dataFormSubmitHandle()"
label-width="140px">
<el-form-item prop="changeHistory" label="Change History of this PPAP record">
<el-input clearable v-model="dataForm.changeHistory" placeholder="Change History of this PPAP record">
</el-input>
</el-form-item>
<el-form-item prop="name" label=" name">
<el-input clearable v-model="dataForm.name" placeholder="name">
</el-input>
</el-form-item>
<el-form-item prop="date" label="date">
<el-date-picker v-model="dataForm.date" type="datetime" format='yyyy-MM-dd HH:mm:ss'
valueFormat='yyyy-MM-ddTHH:mm:ss' placeholder="date">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button @click="innerDrawer = false">{{ $t('cancel') }} </el-button>
<el-button type="primary" @click="dataFormSubmit"> {{ $t('confirm') }}</el-button>
</el-form-item>
</el-form>
</el-drawer>
</div>
</template>
<script>
import i18n from "@/i18n"
import basicAdd from "@/mixins/basic-add"
import debounce from "lodash/debounce"
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
submitURL: "/customerquality/qmsCustomerQualityProjectListChangeRecord",
},
dataForm: {
date:null,
name: null,
id: null,
changeHistory: null,
},
innerDrawer: false,
listQuery: {
limit: 10,
page:1,
},
requirementList: [],
knowledgeBaseList:[],
}
},
computed: {
dataRule() {
return {
knowledgeBaseId: [
{
required: true,
message: this.$t("validate.required"),
trigger: "change",
},
],
requirementListId: [
{
required: true,
message: this.$t("validate.required"),
trigger: "change",
},
]
};
},
},
methods: {
init(obj) {
// this.dataForm.knowledgeBaseId = obj.knowledgeBaseId || ''
// this.dataForm.requirementListId = obj.requirementListId || ''
this.dataForm.id = obj.id? obj.id :null
this.dataForm.customerQualityProjectListId = obj.customerQualityProjectListId ? obj.customerQualityProjectListId :null
this.innerDrawer = true
this.$nextTick(() => {
this.$refs["dataForm"].resetFields()
if (this.dataForm.id) {
this.getInfo()
} else {
// this.getCode()
}
})
},
handleClose() {
this.innerDrawer = true
this.$refs.dataForm.resetFields()
},
getInfo() {
this.$http
.get(`/customerquality/qmsCustomerQualityProjectListChangeRecord/${this.dataForm.id}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.dataForm = {
...this.dataForm,
...res.data,
};
})
.catch(() => { });
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
this.$http[!this.dataForm.id ? "post" : "put"](this.urlOptions.submitURL, this.dataForm)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.innerDrawer = false;
this.$emit("refreshDataList");
},
});
})
.catch(() => { });
});
},
},
}
</script>
<style lang="scss" scoped>
</style>