From 5b6c4c659710814ea5f59dcab8ac64ddd8acfe6f Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期四, 03 七月 2025 14:08:44 +0800
Subject: [PATCH] 模板导入
---
src/views/build/conpanyFunctionConsult/companyInfo/policy/components/policyDialog.vue | 75 +++++++++++++++++++++++++++++++++++--
1 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/src/views/build/conpanyFunctionConsult/companyInfo/policy/components/policyDialog.vue b/src/views/build/conpanyFunctionConsult/companyInfo/policy/components/policyDialog.vue
index 310c34e..95a53d2 100644
--- a/src/views/build/conpanyFunctionConsult/companyInfo/policy/components/policyDialog.vue
+++ b/src/views/build/conpanyFunctionConsult/companyInfo/policy/components/policyDialog.vue
@@ -7,6 +7,27 @@
:before-close="handleClose"
>
<el-form :model="state.noticeForm" size="default" ref="noticeRef" :rules="title === '新增' || title === '编辑' ? state.formRules : {}" label-width="110px" >
+ <el-form-item label="企业名称:" prop="companyName" v-if="state.isAdmin">
+ <el-select
+ v-model="state.noticeForm.companyName"
+ filterable
+ remote
+ :disabled="title == '查看' || title == '编辑' ||!state.isAdmin"
+ @change="selectValue"
+ reserve-keyword
+ placeholder="请输入企业名称"
+ remote-show-suffix
+ :remote-method="getCompanyList"
+ style="width: 100%"
+ >
+ <el-option
+ v-for="item in state.companyList"
+ :key="item.id"
+ :label="item.name"
+ :value="item.name"
+ />
+ </el-select>
+ </el-form-item>
<el-form-item label="质量方针:" v-if="showEditor" required>
<t-editor style="width: 800px" ref="myEditor" :value="state.noticeForm.policy" ></t-editor>
</el-form-item>
@@ -40,6 +61,7 @@
import {addCom, editCom} from "@/api/companyInfo/overview";
import Cookies from "js-cookie";
import {addPolicy, editPolicy} from "@/api/companyInfo/policy";
+import {getCompany} from "@/api/onlineEducation/company";
const emit = defineEmits(["getList"]);
@@ -59,8 +81,11 @@
companyName: ''
},
formRules:{
+ companyName: [{ required: true, message: '请选择企业', trigger: 'blur' }],
policy: [{ required: true, message: '质量方针', trigger: 'blur' }],
},
+ isAdmin: false,
+ companyList: []
})
@@ -68,13 +93,21 @@
});
const openDialog = async (type, value) => {
-
+ const userInfo = JSON.parse(Cookies.get('userInfo'))
+ state.isAdmin = userInfo.userType === 0;
+ if(state.isAdmin){
+ await getCompanyList()
+ }
isReview.value = false;
showEditor.value = false
title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ;
if(type === 'edit' || type === 'review') {
state.noticeForm.policy = value.policy
state.noticeForm.id = value.id
+ if(state.isAdmin){
+ state.noticeForm.companyId = value.companyId
+ state.noticeForm.companyName = value.companyName
+ }
}
if(type === 'review') {
showEditor.value = false
@@ -128,10 +161,12 @@
}
const onSubmit = async () => {
+
state.noticeForm.policy = tinyMCE.activeEditor.getContent();
- const userInfo = JSON.parse(Cookies.get('userInfo'))
- state.noticeForm.companyId = userInfo.companyId
- state.noticeForm.companyName = userInfo.companyName
+ if(!state.isAdmin){
+ const userInfo = JSON.parse(Cookies.get('userInfo'))
+ state.noticeForm.companyId = userInfo.companyId
+ }
// // myEditor.value.submit();
const valid = await noticeRef.value.validate();
if(valid){
@@ -198,6 +233,38 @@
companyName: ''
}
}
+const selectValue = (val) => {
+ state.companyList.forEach(item => {
+ if(item.name === val){
+ state.noticeForm.companyId = item.id
+ }
+ })
+}
+const getCompanyList = async (val)=>{
+ if(val){
+ const queryParams = {
+ name: val
+ }
+ const res = await getCompany(queryParams)
+ if (res.code == 200) {
+ state.companyList = res.data.list
+
+ } else {
+ ElMessage.warning(res.message)
+ }
+ }else {
+ const queryParams = {
+ pageSize: 10,
+ pageNum: 1,
+ }
+ const res = await getCompany(queryParams)
+ if (res.code == 200) {
+ state.companyList = res.data.list
+ } else {
+ ElMessage.warning(res.message)
+ }
+ }
+}
defineExpose({
openDialog
--
Gitblit v1.9.2