riskdetails.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <!--任务详情页-->
  2. <template>
  3. <div class="app-container p-2">
  4. <el-row :gutter="20">
  5. <!-- 基础信息 -->
  6. <el-col :lg="30" :xs="24" style="">
  7. <el-form-item>
  8. <div class="back-btn" @click="goBack">
  9. <el-icon><Back /></el-icon>
  10. 返回上一级
  11. </div>
  12. </el-form-item>
  13. <el-row :span="24" :gutter="10">
  14. <el-col :span="20" label="预案名称">
  15. <h2 key="planName" style="font-weight: bolder">{{ detailData.planName }}</h2>
  16. </el-col>
  17. <el-col :span="1.5">
  18. <el-button type="primary" @click="planUpdate()"> 编辑 </el-button>
  19. </el-col>
  20. <el-col :span="1.5">
  21. <el-button type="primary" @click="handlefinal"> 完结任务 </el-button>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-button type="danger" @click="handleDelete"> 删除 </el-button>
  25. </el-col>
  26. </el-row>
  27. <div class="line" style="background: #e7e7e7; width: auto; height: 0.6px; position: relative"></div>
  28. <h3>基础信息</h3>
  29. <el-card style="margin-top: 10px" shadow="hover">
  30. <el-descriptions title="">
  31. <el-descriptions-item key="planId" label="任务编号:">{{ detailData.planId }}</el-descriptions-item>
  32. <el-descriptions-item key="planType" label="风险源类型:">
  33. <dict-tag :options="plan_type" :value="detailData.planType" style="display: inline-block" />
  34. </el-descriptions-item>
  35. <el-descriptions-item key="publishDate" label="创建时间:">{{ detailData.publishDate }}</el-descriptions-item>
  36. <el-descriptions-item key="organizingUnit" label="创建人:">{{ detailData.organizingUnit }}</el-descriptions-item>
  37. <el-descriptions-item key="publishDate" label="排查时间范围:">{{ detailData.publishDate }}</el-descriptions-item>
  38. <el-descriptions-item key="publishDate" label="排查周期:">{{ detailData.publishDate }}</el-descriptions-item>
  39. <el-descriptions-item key="publishDate" label="排查范围:">{{ detailData.publishDate }}</el-descriptions-item>
  40. <el-descriptions-item key="event_type" label="任务状态:">
  41. <dict-tag :options="mm_event_type" :value="detailData.event_type" style="display: inline-block" />
  42. </el-descriptions-item>
  43. </el-descriptions>
  44. </el-card>
  45. <h3>子任务记录</h3>
  46. <el-table :data="tableData" style="width: 100%; margin-top: 20px">
  47. <el-table-column prop="riskSourceType" label="风险源类型" width="150">
  48. <template #default="scope">
  49. <dict-tag :options="plan_type" :value="scope.row.riskSourceType" style="display: inline-block" />
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="requiredCheckTime" label="要求排查时间" width="150"></el-table-column>
  53. <el-table-column prop="checkCycle" label="排查周期" width="150"></el-table-column>
  54. <el-table-column prop="checkRange" label="排查范围" width="150"></el-table-column>
  55. <el-table-column prop="executionDate" label="执行日期" width="150"></el-table-column>
  56. <el-table-column prop="completed" label="已完成" width="100"></el-table-column>
  57. <template #default="scope">
  58. <span @click="handleClick(scope.row.completed, 'completed')">{{ scope.row.completed }}</span>
  59. </template>
  60. <el-table-column prop="uncompleted" label="未完成" width="100"></el-table-column>
  61. <template #default="scope">
  62. <span @click="handleClick(scope.row.uncompleted, 'uncompleted')">{{ scope.row.uncompleted }}</span>
  63. </template>
  64. <el-table-column label="操作" width="150">
  65. <template #default="scope">
  66. <el-button size="small" @click="handleresult(scope.$index, scope.row)">巡查结果</el-button>
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. </el-col>
  71. </el-row>
  72. <!-- 修改弹窗 -->
  73. <el-dialog v-model="visible" title="修改任务" width="500px" append-to-body>
  74. <el-form ref="demoFormRef" :model="form" :rules="rules" label-width="80px">
  75. <el-form-item label="风险源类型:" prop="planName">
  76. <el-input v-model="form.planName" placeholder="请选择风险源排查类型" />
  77. </el-form-item>
  78. <el-form-item label="排查时间范围:" prop="publishDate">
  79. <el-date-picker v-model="dateRange" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD"></el-date-picker>
  80. </el-form-item>
  81. <el-form-item label="排查周期:" prop="organizingUnit">
  82. <el-checkbox-group v-model="form.organizingUnit">
  83. <el-checkbox label="选项1">每年</el-checkbox>
  84. <el-checkbox label="选项2">每月</el-checkbox>
  85. <el-checkbox label="选项3">每周</el-checkbox>
  86. <el-checkbox label="选项4">每天</el-checkbox>
  87. <el-checkbox label="选项4">一次</el-checkbox>
  88. </el-checkbox-group>
  89. </el-form-item>
  90. <el-form-item label="排查范围:" prop="organizingUnit">
  91. <el-checkbox-group v-model="form.organizingUnit">
  92. <el-checkbox label="选项1">市级</el-checkbox>
  93. <el-checkbox label="选项2">区县级</el-checkbox>
  94. <el-checkbox label="选项3">镇街级</el-checkbox>
  95. <el-checkbox label="选项4">村居量</el-checkbox>
  96. </el-checkbox-group>
  97. </el-form-item>
  98. </el-form>
  99. <template #footer>
  100. <div class="dialog-footer">
  101. <el-button :loading="buttonLoading" type="primary" @click="submitForm">确定</el-button>
  102. <el-button @click="cancel">取消</el-button>
  103. </div>
  104. </template>
  105. </el-dialog>
  106. </div>
  107. </template>
  108. <script setup name="planList" lang="ts">
  109. import { to } from 'await-to-js';
  110. import { deletePlan, getPlanDetail, updateReport } from '@/api/riskPrevention/planManage';
  111. import { ElMessageBox } from 'element-plus';
  112. const router = useRouter();
  113. const goBack = () => {
  114. proxy?.$tab.closePage();
  115. };
  116. const route = useRoute();
  117. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  118. const { mm_event_type, plan_type } = toRefs<any>(proxy?.useDict('plan_type', 'mm_event_type'));
  119. //已完成/未完成的页面跳转
  120. const handleClick = (value: number, type: string) => {
  121. if (type === 'completed') {
  122. router.push({
  123. name: 'CompletedDetails', // 替换为实际的路由名称
  124. params: { value }
  125. });
  126. } else if (type === 'uncompleted') {
  127. router.push({
  128. name: 'UncompletedDetails', // 替换为实际的路由名称
  129. params: { value }
  130. });
  131. }
  132. };
  133. // 预案编辑
  134. let detailData = ref({
  135. planId: '',
  136. planName: '',
  137. planType: '',
  138. publishDate: '',
  139. organizingUnit: '',
  140. document: '',
  141. event_type: '',
  142. fileList: []
  143. });
  144. let planId = ref();
  145. let visible = ref(false);
  146. const demoFormRef = ref(null);
  147. const buttonLoading = ref(false);
  148. let form = ref({
  149. planId: '',
  150. planName: '',
  151. planType: '',
  152. document: '',
  153. organizingUnit: '',
  154. publishDate: '',
  155. event_type: '',
  156. fileList: []
  157. });
  158. const rules = reactive({
  159. planName: [{ required: true, message: '预案名称不能为空', trigger: 'blur' }],
  160. planType: [{ required: true, message: '预案类型不能为空', trigger: 'blur' }],
  161. document: [{ required: true, message: '发文字号不能为空', trigger: 'blur' }],
  162. event_type: [{ required: true, message: '对应事件类型不能为空', trigger: 'blur' }],
  163. organizingUnit: [{ required: true, message: '编制单位不能为空', trigger: 'blur' }],
  164. publishDate: [{ required: true, message: '发布日期不能为空', trigger: 'blur' }]
  165. });
  166. /** 修改按钮操作 */
  167. const planUpdate = async () => {
  168. resetForm();
  169. const res = await getPlanDetail(planId.value);
  170. form.value = res.data;
  171. visible.value = true;
  172. };
  173. const handlefinal = () => {
  174. ElMessageBox.confirm('确定要完结任务吗?', '提示', {
  175. confirmButtonText: '确定',
  176. cancelButtonText: '取消',
  177. type: 'warning'
  178. }).then(() => {
  179. // 用户点击“确定”时的逻辑
  180. console.log('任务已完结');
  181. // 可以在这里添加更多完结任务的逻辑
  182. }).catch(() => {
  183. // 用户点击“取消”时的逻辑
  184. console.log('任务未完结');
  185. });
  186. };
  187. const resetForm = () => {
  188. form.value = {
  189. planId: '',
  190. planName: '',
  191. planType: '',
  192. document: '',
  193. organizingUnit: '',
  194. publishDate: '',
  195. event_type: '',
  196. fileList: []
  197. };
  198. demoFormRef.value?.resetFields();
  199. };
  200. /** 删除按钮操作 */
  201. const handleDelete = async () => {
  202. const [err] = await to(proxy?.$modal.confirm('是否确认删除该条预案?') as any);
  203. if (!err) {
  204. await deletePlan([detailData.value.planId]);
  205. proxy?.$modal.msgSuccess('删除成功');
  206. router.go(-1);
  207. }
  208. };
  209. const cancel = () => {
  210. resetForm();
  211. visible.value = false;
  212. };
  213. /** 提交修改 */
  214. const submitForm = () => {
  215. demoFormRef.value?.validate(async (valid) => {
  216. if (valid) {
  217. try {
  218. buttonLoading.value = true;
  219. await updateReport(form.value);
  220. proxy?.$modal.msgSuccess('修改成功');
  221. visible.value = false;
  222. getPlanDetail(planId.value).then((res) => {
  223. detailData.value = res.data;
  224. });
  225. } finally {
  226. buttonLoading.value = false;
  227. }
  228. }
  229. });
  230. };
  231. const baseUrl = import.meta.env.VITE_APP_BASE_API;
  232. onMounted(() => {
  233. planId.value = route.query.planId;
  234. getPlanDetail(planId.value).then((res) => {
  235. detailData.value = res.data;
  236. });
  237. });
  238. </script>
  239. <style lang="scss" scoped></style>