Parcourir la source

迭代七信息发布列表+详情界面30%

zhangyihao il y a 7 mois
Parent
commit
278b55b02d

+ 9 - 1
src/api/duty/eventing.ts

@@ -78,4 +78,12 @@ export function uploadEventCasualties(data) {
     method: 'post',
     data: data
   });
-}
+}
+// 获取信息发布列表
+export function getInformation(params) {
+  return request({
+    url: '/api/info_publish/back/list',
+    method: 'get',
+    params: params
+  });
+}

+ 2 - 2
src/assets/styles/index.scss

@@ -262,7 +262,7 @@ aside {
 
 .common-dialog {
   width: 100%;
-  height: 100vh;
+  height: 100%;
   position: absolute;
   top: 0;
   left: 0;
@@ -271,7 +271,6 @@ aside {
   justify-content: center;
   padding: 0 24px 24px;
   z-index: 99;
-  overflow-y: auto;
   .common-dialog-content {
     border-bottom: 1px solid #e6f2ff;
     border-left: 1px solid #e6f2ff;
@@ -280,6 +279,7 @@ aside {
     width: 100%;
     height: 100%;
     padding: 16px 24px;
+    overflow-y: auto;
     .common-dialog-title-box {
       font-size: 20px;
       margin-bottom: 23.5px;

+ 187 - 0
src/views/informationissue/informationDetail.vue

@@ -0,0 +1,187 @@
+<template>
+  <div class="common-dialog">
+    <div class="common-dialog-content">
+      <div class="common-dialog-title-box">
+        <h3 class="common-dialog-title">信息详情</h3>
+      </div>
+      <div class="common-dialog-box">
+        <el-form ref="form" :model="formData" :rules="rules" label-width="120px">
+          <h4 class="common-dialog-title">信息内容</h4>
+          <div class="box1">
+            <el-form-item label="标题:" prop="title">
+              <el-input v-model="formData.title" placeholder="请输入标题" style="width: 468px !important" />
+            </el-form-item>
+
+            <el-form-item label="发布单位:" prop="publishUnit">
+              <el-input v-model="formData.publishUnit" placeholder="请输入发布单位" style="width: 468px !important" />
+            </el-form-item>
+
+            <el-form-item label="信息模板:" prop="templateType">
+              <el-radio-group v-model="formData.templateType">
+                <el-radio label="预设模板">预设模板</el-radio>
+                <el-radio label="自定义模板">自定义模板</el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <el-form-item v-if="formData.templateType === '预设模板'" label="预设模板:" prop="presetTemplate">
+              <el-select v-model="selectedPresetTemplate" placeholder="请选择预设模板" style="width: 300px !important">
+                <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="showExample">样例</el-text>
+            </el-form-item>
+            <el-form-item v-if="formData.templateType === '自定义模板'" prop="customPageUrl">
+              <el-input v-model="formData.customPageUrl" placeholder="请输入自定义详情页面链接地址" style="width: 468px !important" />
+            </el-form-item>
+            <el-form-item label="信息内容:" prop="messageContent">
+              <el-input v-model="formData.messageContent" type="textarea" placeholder="请输入信息内容" style="width: 468px !important"></el-input>
+            </el-form-item>
+            <el-form-item label="查看附件:">
+              <ul>
+                <li v-for="(file, index) in files" :key="index" @click="viewFile(file)">
+                  {{ file.name }}
+                </li>
+              </ul>
+            </el-form-item>
+          </div>
+          <h4 class="common-dialog-title">推送配置</h4>
+          <div class="box1">
+            <el-form-item label="发布名单:" prop="releaseList" style="width: 468px !important"
+              ><span class="highlight-text">已选择{{ formData.releaseList }}人</span>
+              <el-text class="common-btn-text-primary" @click="showReleaseList">查看详情</el-text>
+            </el-form-item>
+            <el-row :gutter="18">
+              <el-col :span="6">
+                <el-form-item label="发布时间:" prop="releaseTime">
+                  <el-button type="text" @click="publishNow">立即发布</el-button>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="定时发布:" prop="timing">
+                  <el-date-picker v-model="formData.timing" type="datetime" placeholder="选择发布时间"></el-date-picker>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-form-item label="消息反馈方式:" prop="feedbackWay" style="width: 468px !important">
+              <el-select v-model="formData.feedbackWay" placeholder="请选择消息反馈方式">
+                <el-option v-for="option in feedbackOptions" :key="option.value" :label="option.label" :value="option.value"></el-option>
+              </el-select>
+            </el-form-item>
+          </div>
+          <h4 class="common-dialog-title">审核配置</h4>
+          <div class="box1">
+            <el-form-item label="审核材料:" prop="materials">
+              <ul>
+                <li v-for="(material, index) in auditMaterials" :key="index">
+                  {{ material }}
+                </li>
+              </ul>
+            </el-form-item>
+            <el-form-item label="审核人:" prop="auditor">
+              <el-input v-model="formData.auditor" placeholder="请输入审核人姓名" style="width: 368px !important" />
+            </el-form-item>
+          </div>
+        </el-form>
+        <div class="common-dialog-footer">
+          <el-button @click="cancel">返回</el-button>
+          <el-button @click="submitForm">编辑</el-button>
+          <el-button type="primary" @click="submitForm">提交</el-button>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue';
+import { ElMessage } from 'element-plus';
+
+const title = '信息详情';
+
+const formData = ref({
+  title: '',
+  publishUnit: '',
+  templateType: '',
+  messageContent: '',
+  releaseList: 0,
+  releaseTime: '',
+  feedbackWay: '',
+  auditor: '',
+  timing: '',
+  materials: ''
+});
+
+const auditMaterials = ['2023年4月29日广东省发布突发事件预警信息.pdf', '审核材料2'];
+
+const rules = {
+  title: [{ required: true, message: '请填写标题', trigger: 'blur' }],
+  publishUnit: [{ required: true, message: '请填写发布单位', trigger: 'blur' }],
+  releaseList: [{ required: true, message: '请选择发布名单', trigger: 'change' }],
+  timing: [{ required: true, message: '请选择发布时间', trigger: 'change' }],
+  feedbackWay: [{ required: true, message: '请选择消息反馈方式', trigger: 'change' }],
+  auditor: [{ required: true, message: '请填写审核人', trigger: 'blur' }]
+};
+// 假定这里有多个文件
+const files = ref([
+  { name: '2023年4月29日广东省发布突发事件预警信息.pdf', url: '/path/to/file1.pdf' },
+  { name: '2023年5月15日上海市发布突发事件预警信息.docx', url: '/path/to/file2.docx' }
+]);
+const feedbackOptions = [
+  { value: '仅需阅读', label: '仅需阅读' },
+  { value: '点击确认', label: '点击确认' },
+  { value: '签字确认', label: '签字确认' }
+];
+// 查看文件的方法
+const viewFile = (file) => {
+  window.open(file.url, '_blank'); // 打开新标签页
+};
+const presetTemplates = [
+  { value: 'template1', label: '模板一' },
+  { value: 'template2', label: '模板二' }
+];
+const selectedPresetTemplate = ref('');
+const selectedPresetTemplateExample = ref('');
+watch(selectedPresetTemplate, (newVal) => {
+  selectedPresetTemplateExample.value = presetTemplateExamples[newVal] || '';
+});
+
+const showReleaseList = () => {
+  ElMessage.info('点击了查看发布名单');
+};
+const publishNow = () => {
+  ElMessage.info('点击了立即发布');
+};
+const submitForm = () => {
+  if (validateFormData()) {
+    ElMessage.success('表单提交成功');
+  }
+};
+
+const validateFormData = (): boolean => {
+  let isValid = true;
+  for (const rule of Object.values(rules)) {
+    for (const r of rule) {
+      const value = formData.value[r.field];
+      if (r.required && (!value || value.length === 0)) {
+        ElMessage.error(r.message);
+        isValid = false;
+      }
+    }
+  }
+  return isValid;
+};
+
+const cancel = () => {
+  router.back();
+};
+</script>
+
+<style scoped>
+.box1 {
+  border: 1px solid #dcdfe6; /* 浅灰色边框 */
+  padding: 10px; /* 可选:为了美观,可以添加一些内边距 */
+  margin-bottom: 10px;
+}
+.highlight-text {
+  font-weight: bold; /* 加粗 */
+  font-size: 1.2em; /* 放大字体大小 */
+}
+</style>

+ 249 - 0
src/views/informationissue/informationList.vue

@@ -0,0 +1,249 @@
+<template>
+  <div class="app-container">
+    <div v-show="!informationDetailState.show">
+      <transition name="fade">
+        <div v-show="showSearch">
+          <el-form ref="queryFormRef" :model="queryParams" label-width="100px">
+            <el-row :gutter="20">
+              <el-col :span="5">
+                <el-form-item label="处理状态:">
+                  <el-select v-model="queryParams.disposeStatus" placeholder="全部" clearable>
+                    <el-option v-for="item in disposeStatusOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="5">
+                <el-form-item label="发布单位:">
+                  <el-input v-model="queryParams.publishUnit" placeholder="请输入内容" clearable></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="5">
+                <el-form-item label="发布状态:">
+                  <el-select v-model="queryParams.publishStatus" placeholder="请选择">
+                    <el-option v-for="item in publishStatusOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="5">
+                <el-form-item label="审批状态:">
+                  <el-select v-model="queryParams.approvalStatus" placeholder="请选择">
+                    <el-option v-for="item in approvalStatusOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="4">
+                <el-form-item>
+                  <el-button type="primary" @click="handleSearch">查询</el-button>
+                  <el-button @click="resetSearch">重置</el-button>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </div>
+      </transition>
+      <!-- 表格组件 -->
+      <el-table ref="multipleTable" v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
+        <el-table-column label="序号" align="center" prop="id" />
+        <el-table-column label="发布单位" align="center" prop="publishUnit" />
+        <el-table-column label="信息内容" align="center" prop="informationContent" />
+        <el-table-column label="发布时间" align="center" prop="publishTime" />
+        <el-table-column label="发布渠道" align="center" prop="publishChannel" />
+        <el-table-column label="发布申请人" align="center" prop="applyPerson" />
+        <el-table-column label="待处理人" align="center" prop="pendingPerson" />
+        <el-table-column label="发布状态" align="center" prop="publishStatus">
+          <template #default="scope">
+            <div class="common-flex">
+              <i :class="getStatusClass(scope.row.publishStatus)"></i>
+              <dict-tag :options="publishStatusOptions" :value="scope.row.publishStatus" />
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column label="审批状态" align="center" prop="approvalStatus">
+          <template #default="scope">
+            <div class="common-flex">
+              <i :class="getStatusClass2(scope.row.approvalStatus)"></i>
+              <dict-tag :options="approvalStatusOptions" :value="scope.row.approvalStatus" />
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column label="发布统计" align="center" prop="statistics">
+          <template #default="scope">
+            <div class="statistics-container">
+              <p>选择人数: {{ scope.row.userCount }}</p>
+              <p>成功: {{ scope.row.successCount }}</p>
+              <p>失败: {{ scope.row.errorCount }}</p>
+              <p>发送中: {{ scope.row.sendingCount }}</p>
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <template #default="scope">
+            <el-text class="common-btn-text-primary" @click="handleView(scope.row)">查看</el-text>
+            <el-text class="common-btn-text-primary" @click="handleUpdate(scope.row)">编辑</el-text>
+            <el-text class="common-btn-text-primary" @click="handleClose(scope.row)">审批</el-text>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination v-show="total > 0" v-model:page="queryParams.page" v-model:limit="queryParams.page_size" :total="total" @pagination="tableData" />
+    </div>
+    <InformationDetail v-if="informationDetailState.show" :event-id="informationDetailState.eventId" />
+  </div>
+</template>
+<script setup lang="ts">
+import { ref, reactive, toRefs, onMounted } from 'vue';
+import { getInformation } from '@/api/duty/eventing'; // 假设 getInformation 已经定义好
+import InformationDetail from './informationDetail.vue';
+const showSearch = ref(true);
+const queryFormRef = ref();
+const tableData = ref([]);
+const loading = ref(true);
+const ids = ref([]);
+const selectedRow = ref(null);
+const initFormData = reactive({
+  publishUnit: '',
+  publishStatus: '',
+  approvalStatus: '',
+  disposeStatus: '',
+  informationContent: '',
+  publishTime: '',
+  publishChannel: '',
+  applyPerson: '',
+  pendingPerson: '',
+  userCount: '',
+  successCount: '',
+  errorCount: '',
+  sendingCount: ''
+});
+// 表单数据
+const data = reactive({
+  form: { ...initFormData },
+  queryParams: {
+    page: 1,
+    page_size: 10,
+    publishUnit: '',
+    publishStatus: '',
+    approvalStatus: '',
+    disposeStatus: ''
+  }
+});
+const { queryParams, form } = toRefs(data);
+const total = ref(0);
+
+const publishStatusOptions = reactive([
+  { value: '发布中', label: '发布中' },
+  { value: '已发布', label: '已发布' },
+  { value: '未提交', label: '未提交' }
+]);
+
+const approvalStatusOptions = reactive([
+  { value: '审批通过', label: '审批通过' },
+  { value: '待审批', label: '待审批' },
+  { value: '审批中', label: '审批中' },
+  { value: '未提交', label: '未提交' }
+]);
+const disposeStatusOptions = reactive([
+  { value: '全部', label: '全部' },
+  { value: '待处理', label: '待处理' },
+  { value: '已处理', label: '已处理' }
+]);
+
+const getStatusClass = (value) => {
+  if (['发布中', '已发布'].includes(value)) {
+    return 'dot-green';
+  } else if (value === '未提交') {
+    return 'dot-orange';
+  } else if (value === '审批中') {
+    return 'dot-red';
+  }
+};
+
+const getStatusClass2 = (value) => {
+  if (['审批通过'].includes(value)) {
+    return 'dot-green';
+  } else if (value === '待审批') {
+    return 'dot-blue';
+  } else if (['审批中'].includes(value)) {
+    return 'dot-red';
+  } else if (['未提交'].includes(value)) {
+    return 'dot-grey';
+  }
+};
+const handleSearch = () => {
+  queryParams.value.page = 1;
+  getList();
+};
+
+const resetSearch = () => {
+  queryParams.value = { page: 1, page_size: 10, publishUnit: '', publishStatus: '', approvalStatus: '' };
+  handleSearch();
+};
+
+const handleSelectionChange = (selection) => {
+  ids.value = selection.map((item) => item.eventId);
+  selectedRow.value = selection.length === 1 ? selection[0] : null;
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+};
+
+const handleUpdate = (row) => {
+  // Implement update functionality
+};
+
+const handleClose = (row) => {
+  // Implement close functionality
+};
+
+let informationDetailState = reactive({
+  show: false,
+  eventId: ''
+});
+
+const handleView = (row) => {
+  if (row) {
+    informationDetailState.eventId = row.id; // 假设eventId是id字段
+    informationDetailState.show = true;
+  }
+};
+
+const getList = () => {
+  loading.value = true;
+  getInformation(queryParams.value) // 假设 getInformation 已经定义好
+    .then((res) => {
+      if (res.code === 200) {
+        // 映射返回的数据到 tableData
+        tableData.value = res.data.map((item) => ({
+          id: item.id,
+          publishUnit: item.publish_group || '未知',
+          informationContent: item.content || '未知',
+          publishTime: item.publish_time || '未知',
+          publishChannel: item.publish_channel || '未知',
+          applyPerson: item.nick_name || '未知',
+          pendingPerson: item.dept_name || '未知',
+          publishStatus: item.publish_status,
+          approvalStatus: item.examine_status,
+          userCount: item.user_count || 0,
+          successCount: item.user_ok_count || 0,
+          errorCount: item.user_err_count || 0,
+          sendingCount: item.user_sending_count || 0
+        }));
+        total.value = res.total;
+      } else {
+        console.error(res.msg);
+      }
+    })
+    .catch((error) => {
+      console.error('请求错误:', error);
+    })
+    .finally(() => {
+      loading.value = false;
+    });
+};
+
+onMounted(() => {
+  getList();
+});
+</script>
+
+<style scoped>
+/* Add your custom styles here */
+</style>