|
@@ -8,6 +8,17 @@
|
|
|
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
|
|
<h4 class="common-dialog-title">信息内容</h4>
|
|
|
<div class="box1">
|
|
|
+
|
|
|
+ <el-form-item label="信息类型:" prop="info_type">
|
|
|
+ <el-radio-group v-model="formData.info_type">
|
|
|
+ <el-radio value="0">预警信息</el-radio>
|
|
|
+ <el-radio value="1">灾害事件</el-radio>
|
|
|
+ <el-radio value="2">灾情信息</el-radio>
|
|
|
+ <el-radio value="3">灾害资讯</el-radio>
|
|
|
+ <el-radio value="4">应急救援总结报告</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item label="标题:" prop="title">
|
|
|
<el-input v-model="formData.title" placeholder="请输入标题" style="width: 468px !important" />
|
|
|
</el-form-item>
|
|
@@ -16,7 +27,7 @@
|
|
|
<el-input v-model="formData.publish_group" placeholder="请输入发布单位" style="width: 468px !important" />
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="信息模板:" prop="templateType">
|
|
|
+ <el-form-item label="信息模板:" prop="template_type">
|
|
|
<el-radio-group v-model="formData.template_type">
|
|
|
<el-radio value="0">预设模板</el-radio>
|
|
|
<el-radio value="1">自定义模板</el-radio>
|
|
@@ -75,27 +86,29 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="审核人:" prop="auditor">
|
|
|
<el-autocomplete
|
|
|
- v-model="formData.examine_by"
|
|
|
+ v-model="formData.examine_user"
|
|
|
:fetch-suggestions="querySearch"
|
|
|
placeholder="请输入审核人姓名"
|
|
|
style="width: 368px !important"
|
|
|
@select="handleSelect"
|
|
|
>
|
|
|
+ <template #default="{ item }">
|
|
|
+ <div class="item_row">
|
|
|
+ <div class="item_row_user_name">账号:<span v-html="highlightKeyword(item)"></span></div>
|
|
|
+ <div class="item_row_nick_name">姓名:{{ item.nickName }}</div>
|
|
|
+ <div class="item_row_dept_name">单位:{{ item.deptName || "(空)" }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
<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>
|
|
|
<div class="common-dialog-footer">
|
|
|
- <!--
|
|
|
- <el-button @click="$emit('close')">返回</el-button>
|
|
|
- -->
|
|
|
- <el-button :loading="buttonLoading" type="primary" @click="submitForm">提交</el-button>
|
|
|
+ <el-button :loading="buttonLoading" type="primary" @click="submitForm" :disabled="buttonDisabled">提交</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -117,9 +130,11 @@ import debounce from 'lodash/debounce';
|
|
|
|
|
|
const formRef = ref(null);
|
|
|
const buttonLoading = ref(false);
|
|
|
+const buttonDisabled = ref(false);
|
|
|
|
|
|
const formData = ref({
|
|
|
title: '',
|
|
|
+ info_type: '',
|
|
|
publish_group: '',
|
|
|
template_type: '0',
|
|
|
template_id: '',
|
|
@@ -129,6 +144,7 @@ const formData = ref({
|
|
|
publish_time: '', // 存储定时发布的时间
|
|
|
response_type: '',
|
|
|
examine_by: '',
|
|
|
+ examine_user: '', // 显示
|
|
|
attachs: [],
|
|
|
examine_attachs: [],
|
|
|
user_count: 0,
|
|
@@ -159,7 +175,8 @@ const querySearch = debounce((queryString, cb) => {
|
|
|
if (queryString) {
|
|
|
getUser({ userName: queryString })
|
|
|
.then((res) => {
|
|
|
- users.value = res.rows.map((user) => ({ value: user.username, username: user.username }));
|
|
|
+ users.value = res.rows.map((user) => ({ value: user.userName, userName: user.userName, nickName: user.nickName, deptName: user.deptName }));
|
|
|
+ console.log('users: ', users.value)
|
|
|
cb(users.value);
|
|
|
})
|
|
|
.catch((error) => {
|
|
@@ -169,10 +186,20 @@ const querySearch = debounce((queryString, cb) => {
|
|
|
} else {
|
|
|
cb([]);
|
|
|
}
|
|
|
-}, 6000);
|
|
|
+}, 3000);
|
|
|
+
|
|
|
+function highlightKeyword(item) {
|
|
|
+ const keyword = formData.value.examine_user;
|
|
|
+ if (!keyword) {
|
|
|
+ return item.userName;
|
|
|
+ }
|
|
|
+ const regex = new RegExp(keyword, 'gi');
|
|
|
+ let val = item.userName.replace(regex, match => `<span class="highlight">${match}</span>`);
|
|
|
+ return val;
|
|
|
+}
|
|
|
|
|
|
const handleSelect = (item) => {
|
|
|
- formData.value.examine_by = item.username;
|
|
|
+ formData.value.examine_by = item.userName;
|
|
|
};
|
|
|
|
|
|
const rules = {
|
|
@@ -223,10 +250,11 @@ const submitForm = () => {
|
|
|
proxy?.$modal.msgError('请选择发布名单');
|
|
|
return;
|
|
|
}
|
|
|
- formData.value.users = selectContactSelectData.value.map((u) => ({ user_id: u.userId, nick_name: u.label }));
|
|
|
+ formData.value.users = selectContactSelectData.value.map((u) => ({ user_id: u.id, nick_name: u.label }));
|
|
|
try {
|
|
|
buttonLoading.value = true;
|
|
|
await addInformation(formData.value);
|
|
|
+ buttonDisabled.value = true;
|
|
|
proxy?.$modal.msgSuccess('信息发布申请已提交');
|
|
|
} finally {
|
|
|
buttonLoading.value = false;
|
|
@@ -250,6 +278,7 @@ let contactSelectState = reactive({
|
|
|
});
|
|
|
const selectContactSelectData = ref([]);
|
|
|
const handleContactSelectData = (data) => {
|
|
|
+ console.log('handleContactSelectData:', data);
|
|
|
selectContactSelectData.value = data;
|
|
|
formData.value.user_count = data.length;
|
|
|
};
|
|
@@ -258,7 +287,7 @@ const toggleReleaseList = () => {
|
|
|
};
|
|
|
const fetchTreeData = async () => {
|
|
|
try {
|
|
|
- const response = await getPhoneList();
|
|
|
+ const response = await getPhoneList({});
|
|
|
if (response && response.data) {
|
|
|
treeData.value = response.data;
|
|
|
}
|
|
@@ -271,16 +300,18 @@ const openUserSelect = async() => {
|
|
|
|
|
|
};
|
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
fetchTreeData();
|
|
|
formData.value.publish_time = formattedCurrentTime.value;
|
|
|
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.id, label: item.name, content: item.content });
|
|
|
});
|
|
|
getUser({}).then((res) => {
|
|
|
- // console.log('res:', res);
|
|
|
- users.value = res.rows.map((user) => ({ value: user.username, username: user.username }));
|
|
|
+ // console.log('getUser res:', res);
|
|
|
+ users.value = res.rows.map((user) => ({ value: user.userName, userName: user.userName, nickName: user.nickName, deptName: user.deptName }));
|
|
|
+ console.log('users.value:', users.value);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -296,4 +327,30 @@ onMounted(() => {
|
|
|
font-weight: bold; /* 加粗 */
|
|
|
font-size: 1.2em; /* 放大字体大小 */
|
|
|
}
|
|
|
+.el-icon-search {
|
|
|
+ height:20px;
|
|
|
+ width:20px;
|
|
|
+ background: url("@/assets/images/search.png") no-repeat;
|
|
|
+ background-size:20px;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep .highlight {
|
|
|
+ color: #fd0f0f;
|
|
|
+}
|
|
|
+
|
|
|
+.item_row {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ .item_row_user_name {
|
|
|
+ margin-left:0px;
|
|
|
+ }
|
|
|
+ .item_row_nick_name {
|
|
|
+ margin-left:10px;
|
|
|
+ }
|
|
|
+ .item_row_dept_name {
|
|
|
+ margin-left:10px;
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|