199 lines
6.0 KiB
Vue
199 lines
6.0 KiB
Vue
<!--
|
|
* @Author: zhp
|
|
* @Date: 2023-02-14 15:02:26
|
|
* @LastEditTime: 2023-07-14 10:28:15
|
|
* @LastEditors: zhp
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" @keyup.enter.native="dataFormSubmitHandle()"
|
|
label-width="120px">
|
|
<el-form-item prop="title" :label="$t('customerquality.title')">
|
|
<el-input :disabled="isDetail" v-model="dataForm.title" :placeholder="$t('customerquality.title')"></el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="accessPath" :label="$t('customerquality.accessPath')">
|
|
<el-input :disabled="isDetail" v-model="dataForm.accessPath" :placeholder="$t('customerquality.accessPath')">
|
|
</el-input>
|
|
</el-form-item>
|
|
<!-- <el-form-item prop="knowledgeBaseName" :label="$t('basic.status')">
|
|
<el-select v-model="dataForm.currentStage" :placeholder="$t('basic.status')">
|
|
<el-option v-for="item in currentStageList" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item prop="serialNumber" :label="$t('customerquality.serialNumber')">
|
|
<el-input v-model="dataForm.serialNumber" :placeholder="$t('customerquality.serialNumber')"></el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="description" :label="$t('customerquality.description')">
|
|
<el-input v-model="dataForm.description" :placeholder="$t('customerquality.description')"></el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="questionType" :label="$t('customerquality.questionType')">
|
|
<el-select v-model="dataForm.questionType" :placeholder="$t('customerquality.questionType')">
|
|
<el-option v-for="item in questionTypeList" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item> -->
|
|
<el-form-item prop="knowledgeBaseFileId" :label="$t('customerquality.knowledgeBaseFileId')">
|
|
<el-select :disabled="isDetail" v-model="dataForm.knowledgeBaseFileId"
|
|
:placeholder="$t('customerquality.knowledgeBaseFileId')">
|
|
<el-option v-for="item in categoryList" :key="item.id" :label="item.dataDictionaryDetailName" :value="item.id">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
</template>
|
|
|
|
<script>
|
|
import debounce from "lodash/debounce";
|
|
import basicAdd from "@/mixins/basic-add";
|
|
export default {
|
|
mixins: [basicAdd],
|
|
data() {
|
|
return {
|
|
urlOptions: {
|
|
submitURL: "/customerquality/qmsPublicDocuments",
|
|
infoURL: "/customerquality/qmsPublicDocuments//{id}",
|
|
getCodeURL: '/customerquality/qmsPublicDocuments/getCode',
|
|
getDictDataDetail: '/mutual/qmsDataDictionaryDetail/page'
|
|
},
|
|
categoryList:[],
|
|
visible: false,
|
|
isDetail:false,
|
|
listQuery: {
|
|
limit: 999,
|
|
page:1
|
|
},
|
|
dataForm: {
|
|
id: "",
|
|
title: null,
|
|
accessPath: null,
|
|
knowledgeBaseFileId: null
|
|
},
|
|
};
|
|
},
|
|
computed: {
|
|
dataRule() {
|
|
return {
|
|
title: [
|
|
{
|
|
required: true,
|
|
message: this.$t("validate.required"),
|
|
trigger: "blur",
|
|
},
|
|
],
|
|
accessPath: [
|
|
{
|
|
required: true,
|
|
message: this.$t("validate.required"),
|
|
trigger: "blur",
|
|
},
|
|
],
|
|
knowledgeBaseFileId: [
|
|
{
|
|
required: true,
|
|
message: this.$t("validate.required"),
|
|
trigger: "change",
|
|
},
|
|
]
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
this.getDict()
|
|
},
|
|
methods: {
|
|
init(obj) {
|
|
if (obj) {
|
|
this.dataForm.id = obj.id
|
|
this.isDetail = obj.detail
|
|
} else {
|
|
this.dataForm.id = null
|
|
this.isDetail = false
|
|
}
|
|
// this.dataForm.dictTypeId = dictTypeId || "";
|
|
this.visible = true;
|
|
this.$nextTick(() => {
|
|
this.$refs["dataForm"].resetFields()
|
|
if (this.dataForm.id) {
|
|
this.getInfo();
|
|
} else {
|
|
// this.getCode()
|
|
}
|
|
});
|
|
},
|
|
// getCode() {
|
|
// this.$http
|
|
// .post(this.urlOptions.getCodeURL)
|
|
// .then(({ data: res }) => {
|
|
// if (res.code === 0) {
|
|
// console.log(res);
|
|
// this.dataForm.code = res.data
|
|
// }
|
|
// })
|
|
// .catch(() => {
|
|
// })
|
|
// },
|
|
getDict() {
|
|
this.$http
|
|
.get(this.urlOptions.getDictDataDetail, {
|
|
params: {
|
|
limit: 999,
|
|
page: 1,
|
|
dataDictionaryId: '1679668845256630274',
|
|
}
|
|
})
|
|
.then(({ data: res }) => {
|
|
this.dataListLoading = false;
|
|
if (res.code === 0) {
|
|
this.categoryList = res.data.list
|
|
}
|
|
})
|
|
},
|
|
// 获取信息
|
|
getInfo() {
|
|
this.$http
|
|
.get(`/customerquality/qmsPublicDocuments/${this.dataForm.id}`)
|
|
.then(({ data: res }) => {
|
|
if (res.code !== 0) {
|
|
return this.$message.error(res.msg);
|
|
}
|
|
this.dataForm = {
|
|
...this.dataForm,
|
|
...res.data,
|
|
};
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
// 表单提交
|
|
dataFormSubmitHandle: debounce(
|
|
function () {
|
|
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: () => {
|
|
console.log(1111);
|
|
this.visible = false;
|
|
this.$emit("successSubmit");
|
|
},
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
});
|
|
},
|
|
1000,
|
|
{ leading: true, trailing: false }
|
|
),
|
|
},
|
|
};
|
|
</script>
|