|
@@ -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>
|
|
@@ -82,13 +87,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="treeData"
|
|
|
+ :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, getPhoneList, getTemplateList} from '@/api/informationissue/informationissue';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
const formRef = ref(null);
|
|
@@ -109,7 +119,7 @@ const formData = ref({
|
|
|
examine_attachs: [],
|
|
|
user_count: 0,
|
|
|
users: [],
|
|
|
- publish_channel: "粤政易" // 默认
|
|
|
+ publish_channel: '粤政易' // 默认
|
|
|
});
|
|
|
|
|
|
const formatTime = (isoString) => {
|
|
@@ -134,26 +144,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 = [
|
|
@@ -167,7 +181,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;
|
|
|
}
|
|
@@ -187,63 +201,12 @@ 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([
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- label: '茂南区',
|
|
|
- deptType: true,
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- userId: 1,
|
|
|
- label: '李里丽'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- userId: 2,
|
|
|
- label: '何里'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- userId: 3,
|
|
|
- label: '张力'
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- id: 5,
|
|
|
- label: '电白区',
|
|
|
- deptType: true,
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: 6,
|
|
|
- userId: 4,
|
|
|
- label: '王五'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 7,
|
|
|
- userId: 5,
|
|
|
- label: '冯可'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 8,
|
|
|
- userId: 6,
|
|
|
- label: '刘森'
|
|
|
- },
|
|
|
- {
|
|
|
- id: 9,
|
|
|
- userId: 3,
|
|
|
- label: '张力'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
-]);
|
|
|
+let treeData = ref([]);
|
|
|
let contactSelectState = reactive({
|
|
|
show: false
|
|
|
});
|
|
@@ -255,14 +218,24 @@ const handleContactSelectData = (data) => {
|
|
|
const toggleReleaseList = () => {
|
|
|
contactSelectState.show = !contactSelectState.show;
|
|
|
};
|
|
|
-
|
|
|
+const fetchTreeData = async () => {
|
|
|
+ try {
|
|
|
+ const response = await getPhoneList();
|
|
|
+ if (response && response.data) {
|
|
|
+ treeData.value = response.data;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('Failed to fetch information:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
onMounted(() => {
|
|
|
+ fetchTreeData();
|
|
|
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 });
|
|
|
});
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
</script>
|
|
|
|