todo.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="business-publish-todo-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <ProTable
  5. ref="proTableRef"
  6. :columns="columns"
  7. :data="state.tableData"
  8. @updateTable="queryList"
  9. :loading="state.loading"
  10. :total="state.total"
  11. v-model:page-index="state.queryParams.PageIndex"
  12. v-model:page-size="state.queryParams.PageSize"
  13. >
  14. <template #table-search>
  15. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
  16. <el-form-item label="数据范围" prop="QuerySelf" v-auth="'business:publish:todo:querySelf'">
  17. <el-segmented
  18. :options="[
  19. { label: '我的', value: 'true' },
  20. { label: '全部', value: 'false' },
  21. ]"
  22. v-model="state.queryParams.QuerySelf"
  23. @change="handleQuery"
  24. />
  25. </el-form-item>
  26. <el-form-item label="工单标题" prop="Keyword">
  27. <el-input v-model="state.queryParams.Keyword" placeholder="工单标题" clearable @keyup.enter="handleQuery" class="keyword-input"/>
  28. </el-form-item>
  29. <el-form-item label="工单编码" prop="No">
  30. <el-input v-model="state.queryParams.No" placeholder="工单编码" clearable @keyup.enter="handleQuery" class="keyword-input"/>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  34. <el-button @click="drawer = true" class="default-button"> <SvgIcon name="ele-Search" class="mr5" />更多查询</el-button>
  35. </el-form-item>
  36. </el-form>
  37. </template>
  38. <template #tableHeader="scope">
  39. <el-button type="primary" @click="publishMultiple" v-auth="'business:publish:todo:multiple'" :disabled="!scope.isSelected">
  40. <SvgIcon name="iconfont icon-tianjiawenjian" class="mr5" />批量发布
  41. </el-button>
  42. <el-button type="primary" @click="onMigration" v-auth="'business:publish:todo:migration'" :disabled="!scope.isSelected">
  43. <SvgIcon name="ele-Rank" class="mr5" />平级移动
  44. </el-button>
  45. </template>
  46. <template #title="{ row }">
  47. <order-detail :order="row" @updateList="queryList">{{ row.title }}</order-detail>
  48. </template>
  49. <!-- 表格操作 -->
  50. <template #operation="{ row }">
  51. <el-button link type="primary" @click="publish(row)" title="发布工单" v-auth="'business:publish:todo:publish'"> 发布 </el-button>
  52. </template>
  53. </ProTable>
  54. </div>
  55. <!-- 工单发布详情 -->
  56. <order-publish ref="orderPublishRef" @updateList="queryList" />
  57. <!-- 工单平移 -->
  58. <order-migration ref="orderMigrationRef" @updateList="queryList" />
  59. <!-- 更多查询 -->
  60. <el-drawer v-model="drawer" title="更多查询" size="500px">
  61. <el-form :model="state.queryParams" ref="drawerRuleFormRef" @submit.native.prevent label-width="100px">
  62. <el-form-item label="归档类型" prop="FiledType">
  63. <el-select v-model="state.queryParams.FiledType" placeholder="请选择归档类型" @change="handleQuery" clearable>
  64. <el-option label="中心归档" value="10" />
  65. <el-option label="部门归档" value="20" />
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item label="是否会签" prop="IsCountersign">
  69. <el-select v-model="state.queryParams.IsCountersign" placeholder="请选择是否会签" @change="handleQuery" clearable>
  70. <el-option label="是" value="true" />
  71. <el-option label="否" value="false" />
  72. </el-select>
  73. </el-form-item>
  74. </el-form>
  75. <template #footer>
  76. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  77. <el-button @click="resetQuery(drawerRuleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  78. </template>
  79. </el-drawer>
  80. </div>
  81. </template>
  82. <script setup lang="tsx" name="businessPublishTodo">
  83. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  84. import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
  85. import { formatDate } from '@/utils/formatTime';
  86. import { batchPublishOrder, publishList } from '@/api/todo/publish';
  87. // 引入组件
  88. const OrderPublish = defineAsyncComponent(() => import('@/views/business/publish/component/Order-publish.vue')); // 发布
  89. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  90. const OrderMigration = defineAsyncComponent(() => import('@/views/todo/center/Order-migration.vue')); // 工单平移
  91. // 定义变量内容
  92. const state = reactive({
  93. queryParams: {
  94. // 查询条件
  95. PageIndex: 1,
  96. PageSize: 20,
  97. OrderTitle: null, // 关键词
  98. No: null,
  99. FiledType: null, // 归档类型
  100. IsCountersign: null, // 是否会签
  101. Keyword: null, // 标题
  102. QuerySelf: 'true', // 是否只查询自己的待发布工单
  103. },
  104. tableData: [], //表单
  105. loading: false, // 加载
  106. total: 0, // 总数
  107. });
  108. const proTableRef = ref<RefType>(); // 表格ref
  109. // 表格配置项
  110. const columns = ref<any[]>([
  111. { type: 'selection', fixed: 'left', minWidth: 40, align: 'center' },
  112. { prop: 'no', label: '工单编码', minWidth: 140 },
  113. { prop: 'isProvinceText', label: '省/市工单', minWidth: 90 },
  114. { prop: 'statusText', label: '工单状态', minWidth: 100 },
  115. { prop: 'title', label: '工单标题', minWidth: 200 },
  116. { prop: 'sourceChannel', label: '来源渠道', minWidth: 100 },
  117. { prop: 'acceptType', label: '受理类型', minWidth: 100 },
  118. { prop: 'counterSignTypeText', label: '是否会签', minWidth: 90 },
  119. { prop: 'currentHandleOrgName', label: '接办部门', minWidth: 140 },
  120. { prop: 'acceptorName', label: '受理人', minWidth: 120 },
  121. {
  122. prop: 'actualHandleTime',
  123. label: '接办时间',
  124. minWidth: 160,
  125. render: (scope) => {
  126. return <span>{formatDate(scope.row.actualHandleTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  127. },
  128. },
  129. {
  130. prop: 'startTime',
  131. label: '受理时间',
  132. minWidth: 160,
  133. render: (scope) => {
  134. return <span>{formatDate(scope.row.startTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  135. },
  136. },
  137. {
  138. prop: 'filedTime',
  139. label: '办结时间',
  140. minWidth: 160,
  141. render: (scope) => {
  142. return <span>{formatDate(scope.row.filedTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  143. },
  144. },
  145. { prop: 'operation', label: '操作', fixed: 'right', width: 80, align: 'center' },
  146. ]);
  147. // 手动查询,将页码设置为1
  148. const handleQuery = () => {
  149. state.queryParams.PageIndex = 1;
  150. queryList();
  151. };
  152. /** 获取列表 */
  153. const queryList = () => {
  154. state.loading = true;
  155. publishList(state.queryParams)
  156. .then((res: any) => {
  157. state.tableData = res.result?.items ?? [];
  158. state.total = res.result?.total ?? 0;
  159. state.loading = false;
  160. })
  161. .catch(() => {
  162. state.loading = false;
  163. });
  164. };
  165. /** 重置按钮操作 */
  166. const drawerRuleFormRef = ref();
  167. const ruleFormRef = ref<RefType>(); // 表单ref
  168. const drawer = ref(false);
  169. const resetQuery = (formEl: FormInstance | undefined) => {
  170. if (!formEl) return;
  171. formEl.resetFields();
  172. state.queryParams.QuerySelf = 'true';
  173. ruleFormRef.value?.resetFields();
  174. queryList();
  175. };
  176. // 批量发布
  177. const publishMultiple = () => {
  178. const ids = proTableRef.value.selectedList.map((item: any) => item.id);
  179. ElMessageBox.confirm(`您确定要发布选择的${proTableRef.value.selectedList.length}个工单吗,是否继续?`, '提示', {
  180. confirmButtonText: '确认',
  181. cancelButtonText: '取消',
  182. type: 'warning',
  183. draggable: true,
  184. cancelButtonClass: 'default-button',
  185. autofocus: false,
  186. })
  187. .then(() => {
  188. batchPublishOrder({ ids }).then(() => {
  189. ElMessage.success('操作成功');
  190. queryList();
  191. });
  192. })
  193. .catch(() => {});
  194. };
  195. // 发布
  196. const orderPublishRef = ref<RefType>(); // 工单发布详情ref
  197. const publish = (row: any) => {
  198. orderPublishRef.value.openDialog(row);
  199. };
  200. // 平移功能
  201. const orderMigrationRef = ref<RefType>();
  202. const onMigration = () => {
  203. const ids = proTableRef.value.selectedList.map((item: any) => item.id);
  204. orderMigrationRef.value.openDialog('publishTodo', ids);
  205. };
  206. onMounted(() => {
  207. queryList();
  208. });
  209. </script>