Parcourir la source

信息发布申请

lizhouming il y a 7 mois
Parent
commit
b9db975077

+ 10 - 1
src/api/informationissue/informationissue.ts

@@ -46,4 +46,13 @@ export function getSentList(params) {
     method: 'get',
     params: params
   });
-}
+}
+
+//获取用户列表
+export function getUser(params) {
+  return request({
+    url: '/system/user/list',
+    method: 'get',
+    params: params
+  });
+}

+ 0 - 5
src/types/components.d.ts

@@ -23,7 +23,6 @@ declare module 'vue' {
     ElBadge: typeof import('element-plus/es')['ElBadge']
     ElButton: typeof import('element-plus/es')['ElButton']
     ElCard: typeof import('element-plus/es')['ElCard']
-    ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElCol: typeof import('element-plus/es')['ElCol']
     ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
@@ -39,8 +38,6 @@ declare module 'vue' {
     ElFormItem: typeof import('element-plus/es')['ElFormItem']
     ElIcon: typeof import('element-plus/es')['ElIcon']
     ElInput: typeof import('element-plus/es')['ElInput']
-    ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
-    ElLink: typeof import('element-plus/es')['ElLink']
     ElMenu: typeof import('element-plus/es')['ElMenu']
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElOption: typeof import('element-plus/es')['ElOption']
@@ -61,7 +58,6 @@ declare module 'vue' {
     ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
     ElTree: typeof import('element-plus/es')['ElTree']
-    ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
     FooterSection: typeof import('./../components/FooterSection/index.vue')['default']
@@ -72,7 +68,6 @@ declare module 'vue' {
     HikvisionPlayer: typeof import('./../components/HKVideo/hikvision-player.vue')['default']
     HKVideo: typeof import('./../components/HKVideo/index.vue')['default']
     IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
-    IEpUploadFilled: typeof import('~icons/ep/upload-filled')['default']
     IFrame: typeof import('./../components/iFrame/index.vue')['default']
     ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
     ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']

+ 75 - 33
src/views/informationissue/informationApplication.vue

@@ -23,7 +23,12 @@
               </el-radio-group>
             </el-form-item>
             <el-form-item v-if="formData.template_type === '0'" label="预设模板:" prop="template_type">
-              <el-select v-model="formData.template_id" placeholder="请选择预设模板" style="width: 300px !important" @change="handleTemplateIdChanged">
+              <el-select
+                v-model="formData.template_id"
+                placeholder="请选择预设模板"
+                style="width: 300px !important"
+                @change="handleTemplateIdChanged"
+              >
                 <el-option v-for="option in presetTemplates" :key="option.value" :label="option.label" :value="option.value"></el-option>
               </el-select>
               <el-text class="common-btn-text-primary" @click="showTemplateExample">样例</el-text>
@@ -52,7 +57,7 @@
                     <el-radio :value="'0'" @change="publishNow">立即发布</el-radio>
                     <el-radio :value="'1'">定时发布</el-radio>
                   </el-radio-group>
-                  <div v-if="formData.publish_type === '0'" style="min-width:240px;">发布时间:{{ formattedCurrentTime }}</div>
+                  <div v-if="formData.publish_type === '0'" style="min-width: 240px">发布时间:{{ formattedCurrentTime }}</div>
                   <el-date-picker v-else v-model="formData.publish_time" type="datetime" placeholder="选择发布时间" style="width: 250px !important" />
                 </el-form-item>
               </el-col>
@@ -69,7 +74,20 @@
               <file-upload v-model="formData.examine_attachs" :limit="4" :file-type="['pdf', 'doc', 'docx', 'jpg', 'png']" />
             </el-form-item>
             <el-form-item label="审核人:" prop="auditor">
-              <el-input v-model="formData.examine_by" placeholder="请输入审核人姓名" style="width: 368px !important" />
+              <el-autocomplete
+                v-model="formData.examine_by"
+                :fetch-suggestions="querySearch"
+                placeholder="请输入审核人姓名"
+                style="width: 368px !important"
+                @select="handleSelect"
+              >
+                <template #suffix>
+                  <i class="el-icon-search"></i>
+                </template>
+                <template #prepend>
+                  <el-button icon="el-icon-search" @click="openUserSelect"></el-button>
+                </template>
+              </el-autocomplete>
             </el-form-item>
           </div>
         </el-form>
@@ -80,13 +98,18 @@
       </div>
     </div>
   </div>
-  <ContactSelect v-model="contactSelectState.show" :tree-data="treeContactSelectData" :default-check-data="selectContactSelectData" @confirm="handleContactSelectData" />
+  <ContactSelect
+    v-model="contactSelectState.show"
+    :tree-data="treeContactSelectData"
+    :default-check-data="selectContactSelectData"
+    @confirm="handleContactSelectData"
+  />
 </template>
 
 <script setup lang="ts">
 import { ref, onMounted } from 'vue';
 import { ElMessage } from 'element-plus';
-import { addInformation, getTemplateList } from '@/api/informationissue/informationissue';
+import { addInformation, getTemplateList, getUser } from '@/api/informationissue/informationissue';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
 const formRef = ref(null);
@@ -107,7 +130,7 @@ const formData = ref({
   examine_attachs: [],
   user_count: 0,
   users: [],
-  publish_channel: "粤政易" // 默认
+  publish_channel: '粤政易' // 默认
 });
 
 const formatTime = (isoString) => {
@@ -125,6 +148,18 @@ const publishNow = () => {
 };
 const formattedCurrentTime = ref(formatTime(new Date().toISOString()));
 
+// 审核人模糊查询
+const users = ref([]);
+
+const querySearch = (queryString, cb) => {
+  const results = queryString ? users.value.filter(this.createFilter(queryString)) : users.value;
+  // 调用 callback 返回建议列表的数据
+  cb(results);
+};
+const handleSelect = (item) => {
+  formData.value.examine_by = item.username;
+};
+
 const rules = {
   title: [{ required: true, message: '请填写标题', trigger: 'blur' }],
   content: [{ required: true, message: '请填写信息内容', trigger: 'blur' }],
@@ -132,26 +167,30 @@ const rules = {
   publish_time: [{ required: true, message: '请选择发布时间', trigger: 'change' }],
   response_type: [{ required: true, message: '请选择消息反馈方式', trigger: 'change' }],
   examine_by: [{ required: true, message: '请填写审核人', trigger: 'blur' }],
-  attachs: [{
-    validator: (rule, value, callback) => {
-      if (value.length == 0) {
-        return callback(new Error('请上传附件'))
-      } else {
-        callback();
-      }     
-    },
-    trigger: 'change'
-  }],
-  examine_attachs: [{
-    validator: (rule, value, callback) => {
-      if (value.length == 0) {
-        return callback(new Error('请上传审批附件'))
-      } else {
-        callback();
-      }     
-    },
-    trigger: 'change'
-  }]
+  attachs: [
+    {
+      validator: (rule, value, callback) => {
+        if (value.length == 0) {
+          return callback(new Error('请上传附件'));
+        } else {
+          callback();
+        }
+      },
+      trigger: 'change'
+    }
+  ],
+  examine_attachs: [
+    {
+      validator: (rule, value, callback) => {
+        if (value.length == 0) {
+          return callback(new Error('请上传审批附件'));
+        } else {
+          callback();
+        }
+      },
+      trigger: 'change'
+    }
+  ]
 };
 
 const feedbackOptions = [
@@ -165,7 +204,7 @@ const presetTemplates = ref([]);
 const submitForm = () => {
   formRef.value?.validate(async (valid) => {
     if (valid) {
-      if(formData.value.user_count <= 0) {
+      if (formData.value.user_count <= 0) {
         proxy?.$modal.msgError('请选择发布名单');
         return;
       }
@@ -185,10 +224,10 @@ const showTemplateExample = () => {
   ElMessage.info('点击了查看模板样例');
 };
 
-const handleTemplateIdChanged = async(value: any) => {
-  const n = presetTemplates.value.find(i => i.value === value );
+const handleTemplateIdChanged = async (value: any) => {
+  const n = presetTemplates.value.find((i) => i.value === value);
   formData.value.content = n.content;
-}
+};
 
 // 通讯录(用玉波做的接口改成动态获取)
 const treeContactSelectData = reactive([
@@ -256,11 +295,14 @@ const toggleReleaseList = () => {
 
 onMounted(() => {
   formData.value.publish_time = formattedCurrentTime.value;
-  getTemplateList({}).then((res)=>{
+  getTemplateList({}).then((res) => {
     res.data.forEach((item, index) => {
-      presetTemplates.value.push({value:item.name, label: item.name, content: item.content});
+      presetTemplates.value.push({ value: item.name, label: item.name, content: item.content });
+    });
+    getUser({}).then((res) => {
+      users.value = res.data.map((user) => ({ value: user.username, username: user.username }));
     });
-  })
+  });
 });
 </script>