informationView.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div>
  3. <div class="common-dialog">
  4. <div class="common-dialog-content">
  5. <el-row :gutter="24">
  6. <el-col :span="24">
  7. <div class="information-approval1">
  8. <el-row :gutter="24">
  9. <el-col :span="17">
  10. <div class="common-dialog-title-box">
  11. <h4 class="common-dialog-title">发送统计</h4>
  12. </div>
  13. </el-col>
  14. <el-col :span="6" style="text-align: right">
  15. <el-text class="common-btn-text-primary" @click="showSendDetails">发送明细</el-text>
  16. </el-col>
  17. </el-row>
  18. <!-- 添加分割线 -->
  19. <div style="border-top: 1px solid #dcdfe6; margin-top: -25px"></div>
  20. <div class="common-dialog-box">
  21. <div class="send-statistics">
  22. <el-row :gutter="24">
  23. <el-col :span="8">
  24. <p>选择人数 {{ formData.user_count }}</p>
  25. </el-col>
  26. <el-col :span="8">
  27. <p>成功 {{ formData.user_ok_count }} | 失败 {{ formData.user_err_count }} | 发送中 {{ formData.user_sending_count }}</p>
  28. </el-col>
  29. <el-col :span="8">
  30. <p>反馈 {{ formData.feedback_count }} | 未反馈 {{ formData.unresponsive_count }}</p>
  31. </el-col>
  32. </el-row>
  33. </div>
  34. </div>
  35. </div>
  36. </el-col>
  37. </el-row>
  38. <el-row :gutter="20">
  39. <el-col :span="12">
  40. <div class="information-approval">
  41. <div class="common-dialog-title-box">
  42. <h3 class="common-dialog-title">信息详情</h3>
  43. </div>
  44. <div class="common-dialog-box">
  45. <el-form ref="form" :model="formData" :rules="rules" label-width="120px">
  46. <h4>信息内容</h4>
  47. <div class="box1">
  48. <el-form-item label="标题:" prop="title">
  49. <el-input v-model="formData.title" disabled placeholder="请输入标题" style="width: 468px !important" />
  50. </el-form-item>
  51. <el-form-item label="发布单位:" prop="publish_group">
  52. <el-input v-model="formData.publish_group" disabled placeholder="请输入发布单位" style="width: 468px !important" />
  53. </el-form-item>
  54. <el-form-item label="信息模板:" prop="template_type">
  55. <el-radio-group v-model="formData.template_type" disabled>
  56. <el-radio value="0">预设模板</el-radio>
  57. <el-radio value="1">自定义模板</el-radio>
  58. </el-radio-group>
  59. </el-form-item>
  60. <el-form-item v-if="formData.template_type === '0'" label="预设模板:" prop="template_type">
  61. <el-select v-model="formData.template_id" disabled placeholder="请选择预设模板" style="width: 300px !important">
  62. <el-option v-for="option in presetTemplates" :key="option.value" :label="option.label" :value="option.value"></el-option>
  63. </el-select>
  64. <el-text class="common-btn-text-primary" @click="showTemplateExample">样例</el-text>
  65. </el-form-item>
  66. <el-form-item v-if="formData.template_type === '1'" prop="template_url">
  67. <el-input v-model="formData.template_url" placeholder="请输入自定义详情页面链接地址" style="width: 468px !important" />
  68. </el-form-item>
  69. <el-form-item label="信息内容:" prop="content">
  70. <el-input
  71. v-model="formData.content"
  72. :rows="6"
  73. type="textarea"
  74. disabled
  75. placeholder="请输入信息内容"
  76. style="width: 468px !important"
  77. ></el-input>
  78. </el-form-item>
  79. <el-form-item label="查看附件:">
  80. <div>
  81. <div v-for="(file, index) in formData.attachs" :key="index" @click="viewFile(file)" style="color: #2C81FF;text-decoration: underline;cursor:pointer">
  82. {{ index+1 }}、{{ file.name }}
  83. </div>
  84. </div>
  85. </el-form-item>
  86. </div>
  87. <h4>推送配置</h4>
  88. <div class="box1">
  89. <el-form-item label="发布名单:" prop="releaseList" style="width: 468px !important"
  90. ><span class="highlight-text">已选择{{ formData.user_count }}人</span>
  91. </el-form-item>
  92. <el-row :gutter="18">
  93. <el-col :span="8">
  94. <el-form-item label="发布时间:" prop="publish_time">
  95. <el-button disabled type="default" @click="publishNow">立即发布</el-button>
  96. </el-form-item>
  97. </el-col>
  98. <el-col :span="10">
  99. <el-form-item label="定时发布:" prop="publish_time">
  100. <el-date-picker v-model="formData.publish_time" type="datetime" disabled placeholder="选择发布时间" style="width: 400px;"></el-date-picker>
  101. </el-form-item>
  102. </el-col>
  103. </el-row>
  104. <el-form-item label="消息反馈方式:" prop="response_type" style="width: 468px !important">
  105. <el-select v-model="displayFeedbackText" disabled placeholder="请选择消息反馈方式"> </el-select>
  106. </el-form-item>
  107. </div>
  108. <h4 class="common-dialog-title">审核配置</h4>
  109. <div class="box1">
  110. <el-form-item label="审核材料:" prop="examine_attachs">
  111. <div>
  112. <div v-for="(file, index) in formData.examine_attachs" :key="index" @click="viewFile(file)" style="color: #2C81FF;text-decoration: underline;cursor:pointer">
  113. {{ index+1 }}、{{ file.name }}
  114. </div>
  115. </div>
  116. </el-form-item>
  117. <el-form-item label="审核人:" prop="examine_by">
  118. <el-input v-model="formData.examine_user" disabled placeholder="请输入审核人姓名" style="width: 368px !important" />
  119. </el-form-item>
  120. </div>
  121. </el-form>
  122. </div>
  123. </div>
  124. </el-col>
  125. <el-col :span="12">
  126. <div class="information-approval">
  127. <div class="common-dialog-title-box">
  128. <h3 class="common-dialog-title">信息审批</h3>
  129. </div>
  130. <div class="common-dialog-box">
  131. <div class="approval-process">
  132. <div class="box1">
  133. <h4>审批流程</h4>
  134. <div>
  135. <p v-if="processingTime">已用时:{{ processingTime }}</p>
  136. </div>
  137. <el-timeline style="width: 100%;">
  138. <template v-for="(item, index) in formData.examines" :key="index">
  139. <el-timeline-item placement="top">
  140. <el-card style="margin-top:-10px;">
  141. <h4>{{ item.examine_type }}</h4>
  142. <p v-if="item.nick_name">
  143. 处理人:<span>{{ item.nick_name }}</span
  144. >&nbsp;&nbsp;&nbsp;&nbsp;时间:{{ item.examine_time }}
  145. </p>
  146. <p v-if="item.examine_sub_type">处理结果:{{ item.examine_sub_type }}</p>
  147. <p v-if="item.content">具体意见:{{ item.content }}</p>
  148. </el-card>
  149. </el-timeline-item>
  150. </template>
  151. </el-timeline>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </el-col>
  157. </el-row>
  158. <div class="common-dialog-footer">
  159. <el-button type="primary" @click="$emit('close')">返回</el-button>
  160. <!--
  161. <el-button :disabled="true">编辑</el-button>
  162. <el-button :disabled="true">提交</el-button>
  163. -->
  164. </div>
  165. </div>
  166. </div>
  167. <SendDetail v-if="sendDetailState.show" :info_id="sendDetailState.info_id" @close="handleCancel" />
  168. </div>
  169. </template>
  170. <script setup lang="ts">
  171. import { reactive, ref } from 'vue';
  172. import { getInformationView, getTemplateList } from '@/api/informationissue/informationissue';
  173. import { ElMessage } from 'element-plus';
  174. import SendDetail from './sendDetail.vue';
  175. import { download2 } from '@/utils/request';
  176. const processingTime = '1小时 6分22秒';
  177. const props = defineProps({
  178. eventId: {
  179. type: String,
  180. required: true
  181. }
  182. });
  183. const formData = ref({
  184. title: '',
  185. publish_group: '',
  186. template_id: '',
  187. template_url: '',
  188. template_type: '',
  189. content: '',
  190. user_count: '',
  191. user_ok_count: '',
  192. user_err_count: '',
  193. user_sending_count: '',
  194. publish_type: '',
  195. response_type: '',
  196. examine_by: '',
  197. examine_user: '',
  198. publish_time: '',
  199. materials: '',
  200. add_time: '',
  201. examines: [],
  202. feedback_count: 0,
  203. unresponsive_count: 0,
  204. attachs: [],
  205. examine_attachs: []
  206. });
  207. const baseUrl = import.meta.env.VITE_APP_BASE_API;
  208. const downLoadApi = import.meta.env.VITE_APP_BASE_DOWNLOAD_API;
  209. const rules = ref({});
  210. const presetTemplates = ref([]);
  211. const feedbackTextMap = {
  212. 0: '仅需阅读',
  213. 1: '点击确认',
  214. 2: '签字确认'
  215. };
  216. // 创建一个计算属性,根据 formData 中的 response_type 返回对应的文本
  217. const displayFeedbackText = computed({
  218. get() {
  219. return feedbackTextMap[formData.value.response_type];
  220. },
  221. set(value) {
  222. formData.value.response_type = Object.keys(feedbackTextMap).find((key) => feedbackTextMap[key] === value);
  223. }
  224. });
  225. let sendDetailState = reactive({
  226. show: false,
  227. info_id: ''
  228. });
  229. const handleCancel = () => {
  230. sendDetailState.show = false;
  231. };
  232. const viewFile = (file: any) => {
  233. download2(baseUrl + downLoadApi + file.url, file.name);
  234. };
  235. const showSendDetails = () => {
  236. sendDetailState.info_id = props.eventId; // 假设eventId是id字段
  237. sendDetailState.show = true;
  238. };
  239. const publishNow = () => {
  240. };
  241. const showTemplateExample = () => {
  242. ElMessage.info('点击了查看模板样例');
  243. };
  244. const fetchInformation = async () => {
  245. try {
  246. const response = await getInformationView({ info_id: props.eventId });
  247. if (response && response.data) {
  248. formData.value = response.data;
  249. }
  250. } catch (error) {
  251. console.error('Failed to fetch information:', error);
  252. }
  253. };
  254. // 在组件挂载时调用 fetchInformation
  255. onMounted(() => {
  256. getTemplateList({}).then((res) => {
  257. res.data.forEach((item, index) => {
  258. presetTemplates.value.push({ value: item.id+"", label: item.name, content: item.content });
  259. });
  260. });
  261. fetchInformation();
  262. });
  263. </script>
  264. <style scoped>
  265. .common-dialog {
  266. display: flex;
  267. flex-direction: column;
  268. background-color: #ffffff;
  269. padding: 20px;
  270. border-radius: 8px;
  271. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  272. }
  273. .common-dialog-title-box {
  274. margin-bottom: 20px;
  275. }
  276. .common-dialog-title {
  277. font-size: 1.2rem;
  278. color: #333;
  279. }
  280. .box1 {
  281. border: 1px solid #dcdfe6; /* 浅灰色边框 */
  282. padding: 10px; /* 可选:为了美观,可以添加一些内边距 */
  283. margin-bottom: 10px;
  284. }
  285. .highlight-text {
  286. font-weight: bold; /* 加粗 */
  287. font-size: 1.2em; /* 放大字体大小 */
  288. }
  289. .information-approval {
  290. width: 100%;
  291. max-width: 800px;
  292. padding: 1rem;
  293. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  294. border-radius: 8px;
  295. }
  296. .information-approval1 {
  297. width: 100%;
  298. max-width: 100%;
  299. padding: 1rem;
  300. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  301. border-radius: 8px;
  302. }
  303. .approval-process {
  304. display: flex;
  305. flex-direction: column;
  306. gap: 1rem;
  307. width: 100%;
  308. }
  309. .common-dialog-footer {
  310. margin-top: 0.5rem;
  311. }
  312. .send-statistics {
  313. width: 100%;
  314. }
  315. .common-dialog-footer {
  316. display: flex;
  317. justify-content: center; /* 水平居中 */
  318. gap: 10px; /* 按钮之间的间距 */
  319. margin-top: 50px;
  320. }
  321. </style>