audit.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="business-special-audit-container layout-pd">
  3. <!-- 搜索 -->
  4. <el-card shadow="never">
  5. <el-tabs v-model="state.queryParams.AuditState" @tab-change="handleQuery">
  6. <el-tab-pane name="1" label="退回待审批"></el-tab-pane>
  7. <el-tab-pane name="2" label="退回已审批"></el-tab-pane>
  8. </el-tabs>
  9. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
  10. <el-form-item label="关键词" prop="Keyword">
  11. <el-input v-model="state.queryParams.Keyword" placeholder="工单编码/标题" clearable @keyup.enter="handleQuery" class="keyword-input" />
  12. </el-form-item>
  13. <el-form-item label="时间段" prop="crTime">
  14. <el-date-picker
  15. v-model="state.queryParams.crTime"
  16. type="datetimerange"
  17. unlink-panels
  18. range-separator="至"
  19. start-placeholder="开始时间"
  20. end-placeholder="结束时间"
  21. :shortcuts="shortcuts"
  22. @change="handleQuery"
  23. value-format="YYYY-MM-DD[T]HH:mm:ss"
  24. />
  25. </el-form-item>
  26. <el-form-item label="审批状态" prop="State" v-if="state.queryParams.AuditState === '2'">
  27. <el-select v-model="state.queryParams.State" placeholder="请选择审批状态" @change="handleQuery">
  28. <el-option value="1" label="审批通过" />
  29. <el-option value="2" label="审批拒绝" />
  30. </el-select>
  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="resetQuery(ruleFormRef)" v-waves class="default-button" :loading="state.loading">
  35. <SvgIcon name="ele-Refresh" class="mr5" />重置
  36. </el-button>
  37. </el-form-item>
  38. </el-form>
  39. <ProTable
  40. ref="proTableRef"
  41. :columns="columns"
  42. :data="state.tableData"
  43. @updateTable="queryList"
  44. :loading="state.loading"
  45. :total="state.total"
  46. v-model:page-index="state.queryParams.PageIndex"
  47. v-model:page-size="state.queryParams.PageSize"
  48. >
  49. <template #isProvince="{ row }">
  50. <span>{{ row.order?.isProvince ? '省工单' : '市工单' }}</span>
  51. </template>
  52. <template #title="{ row }">
  53. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  54. </template>
  55. <template #employeeName="{ row }">
  56. <span
  57. >{{ row.order?.acceptorName }} <span v-if="row.order?.acceptorStaffNo">[{{ row.order?.acceptorStaffNo }}]</span>
  58. </span>
  59. </template>
  60. <!-- 表格操作 -->
  61. <template #operation="{ row }">
  62. <el-button link type="primary" @click="onAudit(row)" title="退回特提" v-auth="'business:return:audit'" v-if="[0].includes(row.state)">
  63. 审批
  64. </el-button>
  65. <el-button link type="primary" @click="onAuditDetail(row)" title="查看审批详情" v-if="[1, 2].includes(row.state)"> 审批详情 </el-button>
  66. <order-detail :order="row.order" @updateList="queryList" />
  67. </template>
  68. </ProTable>
  69. </el-card>
  70. <!-- 退回审批 -->
  71. <return-audit ref="returnAuditRef" @updateList="queryList" />
  72. <!-- 审批详情 -->
  73. <return-audit-detail ref="returnAuditDetailRef" />
  74. </div>
  75. </template>
  76. <script setup lang="tsx" name="businessReturnAudit">
  77. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  78. import { ElButton, FormInstance } from 'element-plus';
  79. import { useRouter } from 'vue-router';
  80. import { returnAuditList } from '@/api/business/return';
  81. import { shortcuts } from '@/utils/constants';
  82. // 引入组件
  83. const ReturnAudit = defineAsyncComponent(() => import('@/views/business/return/components/Return-audit.vue')); // 审批
  84. const ReturnAuditDetail = defineAsyncComponent(() => import('@/views/business/return/components/Return-audit-detail.vue')); // 审批详情
  85. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  86. // 定义变量内容
  87. const ruleFormRef = ref<RefType>(); // 表单ref
  88. const router = useRouter(); // 路由
  89. const proTableRef = ref<RefType>(); // 表格ref
  90. // 表格配置项
  91. const columns = ref<any[]>([
  92. { prop: 'order.no', label: '工单编码', width: 150 },
  93. { prop: 'isProvince', label: '省/市工单', width: 100 },
  94. { prop: 'title', label: '工单标题', width: 300 },
  95. { prop: 'order.sourceChannel', label: '来源方式' },
  96. { prop: 'order.acceptType', label: '受理类型', width: 150 },
  97. { prop: 'order.hotspotName', label: '热点分类', width: 200 },
  98. { prop: 'order.acceptorName', label: '受理人', width: 170 },
  99. { prop: 'order.orgLevelOneName', label: '一级部门', width: 170 },
  100. { prop: 'stateText', label: '退回审批状态', width: 120 },
  101. { prop: 'creatorName', label: '申请人', width: 120 },
  102. { prop: 'creatorOrgName', label: '申请部门', width: 150 },
  103. { prop: 'content', label: '申请理由', width: 200 },
  104. { prop: 'operation', label: '操作', fixed: 'right', width: 170, align: 'center' },
  105. ]);
  106. const state = reactive({
  107. queryParams: {
  108. // 查询条件
  109. PageIndex: 1,
  110. PageSize: 10,
  111. Keyword: null, // 关键字
  112. State: null, // 审批状态
  113. AuditState: '1', // 是否已处理 1 待审批 2已审批
  114. },
  115. tableData: [], //表单
  116. loading: false, // 加载
  117. total: 0, // 总数
  118. });
  119. // 手动查询,将页码设置为1
  120. const handleQuery = () => {
  121. state.queryParams.PageIndex = 1;
  122. queryList();
  123. };
  124. /** 获取列表 */
  125. const queryList = () => {
  126. state.loading = true;
  127. let CreationTimeStart = null;
  128. let CreationTimeEnd = null;
  129. if (state.queryParams?.crTime) {
  130. CreationTimeStart = state.queryParams?.crTime[0];
  131. CreationTimeEnd = state.queryParams?.crTime[1];
  132. }
  133. const request = {
  134. CreationTimeStart,
  135. CreationTimeEnd,
  136. State: state.queryParams.AuditState === '2' ? state.queryParams.State : null,
  137. PageIndex: state.queryParams.PageIndex,
  138. PageSize: state.queryParams.PageSize,
  139. Keyword: state.queryParams.Keyword,
  140. AuditState: state.queryParams.AuditState,
  141. };
  142. returnAuditList(request)
  143. .then((res) => {
  144. state.tableData = res.result?.items ?? [];
  145. state.total = res.result?.total ?? 0;
  146. state.loading = false;
  147. })
  148. .catch((err) => {
  149. console.log(err);
  150. state.loading = false;
  151. });
  152. };
  153. /** 重置按钮操作 */
  154. const resetQuery = (formEl: FormInstance | undefined) => {
  155. if (!formEl) return;
  156. formEl.resetFields();
  157. queryList();
  158. };
  159. // 导出
  160. const onExport = () => {
  161. console.log('导出');
  162. };
  163. // 审批
  164. const returnAuditRef = ref<RefType>();
  165. const onAudit = (row: any) => {
  166. returnAuditRef.value.openDialog(row);
  167. };
  168. // 审批详情
  169. const returnAuditDetailRef = ref<RefType>();
  170. const onAuditDetail = (row: any) => {
  171. returnAuditDetailRef.value.openDialog(row);
  172. };
  173. onMounted(() => {
  174. queryList();
  175. });
  176. </script>