2023-07-17 17:00:11 +08:00
|
|
|
<!--
|
|
|
|
* @Author: zhp
|
|
|
|
* @Date: 2023-07-14 13:44:46
|
2023-07-19 09:23:37 +08:00
|
|
|
* @LastEditTime: 2023-07-18 16:53:36
|
2023-07-17 17:00:11 +08:00
|
|
|
* @LastEditors: zhp
|
|
|
|
* @Description:
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<div>
|
2023-07-19 09:23:37 +08:00
|
|
|
<el-drawer close-on-press-escape :title="$t('add')" :append-to-body="true" :before-close="handleClose"
|
2023-07-17 17:00:11 +08:00
|
|
|
:visible.sync="innerDrawer">
|
|
|
|
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" @keyup.enter.native="dataFormSubmitHandle()"
|
|
|
|
label-width="120px">
|
2023-07-19 09:23:37 +08:00
|
|
|
<el-form-item prop="knowledgeBaseFileId" :label="$t('customerquality.knowledgeBaseFileId')">
|
|
|
|
<el-select clearable v-model="dataForm.knowledgeBaseFileId"
|
|
|
|
:placeholder="$t('customerquality.knowledgeBaseFileId')">
|
|
|
|
<el-option v-for="item in categoryList" :key="item.id" :label="item.dataDictionaryDetailName"
|
2023-07-17 17:00:11 +08:00
|
|
|
:value="item.id">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
2023-07-19 09:23:37 +08:00
|
|
|
<el-form-item prop="title" :label="$t('customerquality.title')">
|
|
|
|
<el-input clearable v-model="dataForm.title" :placeholder="$t('customerquality.title')">
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="accessPath" :label="$t('customerquality.accessPath')">
|
|
|
|
<el-input clearable v-model="dataForm.accessPath" :placeholder="$t('customerquality.accessPath')">
|
|
|
|
</el-input>
|
2023-07-17 17:00:11 +08:00
|
|
|
</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"
|
2023-07-19 09:23:37 +08:00
|
|
|
|
2023-07-17 17:00:11 +08:00
|
|
|
export default {
|
|
|
|
mixins: [basicAdd],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
urlOptions: {
|
2023-07-19 09:23:37 +08:00
|
|
|
submitURL: "/customerquality/knowledgeBaseRequirementListData",
|
|
|
|
getDictDataDetail: '/mutual/qmsDataDictionaryDetail/page'
|
2023-07-17 17:00:11 +08:00
|
|
|
},
|
|
|
|
dataForm: {
|
2023-07-19 09:23:37 +08:00
|
|
|
accessPath:null,
|
|
|
|
id: null,
|
|
|
|
knowledgeBaseFileId: null,
|
|
|
|
knowledgeBaseRequirementListId: null,
|
|
|
|
title: null,
|
2023-07-17 17:00:11 +08:00
|
|
|
},
|
|
|
|
innerDrawer: false,
|
|
|
|
listQuery: {
|
|
|
|
limit: 10,
|
|
|
|
page:1,
|
|
|
|
},
|
2023-07-19 09:23:37 +08:00
|
|
|
categoryList:[],
|
2023-07-17 17:00:11 +08:00
|
|
|
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",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
this.getDict()
|
2023-07-19 09:23:37 +08:00
|
|
|
this.getAccessPath()
|
2023-07-17 17:00:11 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2023-07-19 09:23:37 +08:00
|
|
|
init(obj) {
|
|
|
|
this.dataForm.knowledgeBaseRequirementListId = obj.knowledgeBaseRequirementListId || ''
|
|
|
|
this.dataForm.knowledgeBaseRequirementListId = obj.knowledgeBaseRequirementListId || ''
|
|
|
|
|
|
|
|
this.dataForm.id = obj.id || ''
|
2023-07-17 17:00:11 +08:00
|
|
|
this.innerDrawer = true
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs["dataForm"].resetFields()
|
|
|
|
if (this.dataForm.id) {
|
|
|
|
this.getInfo()
|
|
|
|
} else {
|
|
|
|
// this.getCode()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
2023-07-19 09:23:37 +08:00
|
|
|
getDict() {
|
|
|
|
this.$http
|
|
|
|
.get(this.urlOptions.getDictDataDetail, {
|
|
|
|
params: {
|
|
|
|
limit: 999,
|
|
|
|
page: 1,
|
|
|
|
dataDictionaryId: '1679670942635122690',
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(({ data: res }) => {
|
|
|
|
// this.dataListLoading = false;
|
|
|
|
if (res.code === 0) {
|
|
|
|
this.categoryList = res.data.list
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getAccessPath() {
|
|
|
|
const now = new Date();
|
|
|
|
const year = now.getFullYear();
|
|
|
|
const month = ('0' + (now.getMonth() + 1)).slice(-2);
|
|
|
|
const day = ('0' + now.getDate()).slice(-2);
|
|
|
|
const hours = ('0' + now.getHours()).slice(-2);
|
|
|
|
const minutes = ('0' + now.getMinutes()).slice(-2);
|
|
|
|
const formattedTime = year + month + day + hours + minutes
|
|
|
|
console.log(formattedTime)
|
|
|
|
|
|
|
|
var str = Math.random().toString(36).slice(-5)
|
|
|
|
// console.log(str)
|
|
|
|
this.dataForm.accessPath = formattedTime+ str
|
|
|
|
},
|
2023-07-17 17:00:11 +08:00
|
|
|
handleClose() {
|
|
|
|
this.innerDrawer = true
|
|
|
|
this.$refs.dataForm.resetFields()
|
|
|
|
},
|
|
|
|
getInfo() {
|
|
|
|
this.$http
|
2023-07-19 09:23:37 +08:00
|
|
|
.get(`/customerquality/knowledgeBaseRequirementListData/${this.dataForm.id}`)
|
2023-07-17 17:00:11 +08:00
|
|
|
.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>
|