Forráskód Böngészése

预览知识调整

zhangchong 2 éve
szülő
commit
a9d9d5ce63

+ 8 - 2
src/views/knowledge/apply/component/ApplyHandle.vue

@@ -22,12 +22,12 @@
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
 						<el-form-item label="申请部门"> {{ state.ruleForm.creationBMName }} </el-form-item>
 					</el-col>
-					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
+					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" v-if="state.ruleForm.expiredTime">
 						<el-form-item label="截止时间">
 							{{ formatDate(state.ruleForm.expiredTime, 'YYYY-mm-dd HH:MM:SS') }}
 						</el-form-item>
 					</el-col>
-					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
+					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" v-if="state.ruleForm.kbTitle">
 						<el-form-item label="关联知识">
 							<span style="color: var(--el-color-primary)">
 								{{ state.ruleForm.kbTitle }}
@@ -64,6 +64,7 @@
 								:options="state.knowledgeOptions"
 								placeholder="请选择关联知识"
 								style="width: 85%"
+								@change="changeKonwledge"
 							/>
 							<el-button type="primary" link class="ml10" @click="createKnowledge">创建知识</el-button>
 						</el-form-item>
@@ -137,6 +138,11 @@ const closeDialog = () => {
 const onCancel = () => {
 	closeDialog();
 };
+// 选择关联知识
+const changeKonwledge = (val: any) => {
+	const item = state.knowledgeOptions.find((v: any) => v.id === val);
+	if(item) state.ruleForm.code = item.code;
+};
 // 创建知识
 const createKnowledge = () => {
 	state.isShowDialog = false;

+ 5 - 2
src/views/knowledge/apply/my/component/MyApplyAdd.vue

@@ -138,8 +138,11 @@ const getselKnowledgeList = () => {
 // 选择关联知识
 const changeKonwledge = (val: any) => {
 	const item = state.knowledgeOptions.find((v: any) => v.id === val);
-	state.ruleForm.department = item.department;
-	state.ruleForm.departmentId = item.departmentId;
+	if (item) {
+		state.ruleForm.department = item.department;
+		state.ruleForm.departmentId = item.departmentId;
+		state.ruleForm.code = item.code;
+	}
 };
 // 新增
 const onSubmit = async (formEl: FormInstance | undefined) => {

+ 5 - 2
src/views/knowledge/apply/my/component/MyApplyEdit.vue

@@ -145,8 +145,11 @@ const getselKnowledgeList = () => {
 // 选择关联知识
 const changeKonwledge = (val: any) => {
 	const item = state.knowledgeOptions.find((v: any) => v.id === val);
-	state.ruleForm.department = item.department;
-	state.ruleForm.departmentId = item.departmentId;
+	if (item) {
+		state.ruleForm.department = item.department;
+		state.ruleForm.departmentId = item.departmentId;
+		state.ruleForm.code = item.code;
+	}
 };
 // 新增
 const onSubmit = async (formEl: FormInstance | undefined) => {