|
@@ -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>
|
|
|
|