orderMark.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="snapshot-statistics-order-mark-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <vxe-grid v-bind="gridOptions" ref="gridRef" @checkbox-all="selectAllChangeEvent" @checkbox-change="selectChangeEvent">
  5. <template #form>
  6. <el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent :disabled="gridOptions.loading">
  7. <el-form-item label="标注状态" prop="Status">
  8. <el-radio-group v-model="state.queryParams.Status" @change="handleQuery">
  9. <el-radio :value="1">待标注</el-radio>
  10. <el-radio :value="2">已标注</el-radio>
  11. <el-radio :value="0">全部</el-radio>
  12. </el-radio-group>
  13. </el-form-item>
  14. <el-form-item label="工单编码" prop="No">
  15. <el-input v-model="state.queryParams.No" placeholder="请填写工单编码" clearable @keyup.enter="handleQuery" class="keyword-input" />
  16. </el-form-item>
  17. <el-form-item label="工单标题" prop="Title">
  18. <el-input v-model="state.queryParams.Title" placeholder="请填写工单标题" clearable @keyup.enter="handleQuery" class="keyword-input" />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  22. <el-button @click="resetQuery(ruleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
  23. </el-form-item>
  24. </el-form>
  25. </template>
  26. <template #toolbar_buttons>
  27. <el-button type="primary" @click="onAdd" v-auth="'snapshot:handle:orderMark:add'" :disabled="isChecked" :loading="state.loading"
  28. ><SvgIcon name="ele-Plus" class="mr5" />添加标注<span v-if="checkTable.length">({{ checkTable.length }})</span>
  29. </el-button>
  30. </template>
  31. <template #order_detail="{ row }">
  32. <order-detail :order="{id: row.orderId}" @updateList="queryList">{{ row.title }}</order-detail>
  33. </template>
  34. <template #pager>
  35. <pagination
  36. @pagination="queryList"
  37. :total="state.total"
  38. v-model:current-page="state.queryParams.PageIndex"
  39. v-model:page-size="state.queryParams.PageSize"
  40. :disabled="state.loading"
  41. />
  42. </template>
  43. </vxe-grid>
  44. </div>
  45. <!-- 添加标注 -->
  46. <order-mark-add ref="orderMarkAddRef" @updateList="queryList" />
  47. </div>
  48. </template>
  49. <script lang="tsx" setup name="snapshotHandleOrderMark">
  50. import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  51. import { FormInstance } from 'element-plus';
  52. import { getOrderMarkList } from '@/api/snapshot/handle';
  53. import Other from '@/utils/other';
  54. // 引入组件
  55. const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
  56. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  57. const OrderMarkAdd = defineAsyncComponent(() => import('@/views/snapshot/handle/components/Order-mark-add.vue')); // 添加标注
  58. // 定义变量内容
  59. const state = reactive<any>({
  60. loading: false,
  61. queryParams: {
  62. // 查询参数
  63. PageIndex: 1,
  64. PageSize: 20,
  65. Status: 1, // 默认待标注
  66. No: null, // 工单编码
  67. Title: null, // 工单标题
  68. },
  69. total: 0, // 总条数
  70. });
  71. const gridOptions = reactive<any>({
  72. loading: false,
  73. border: true,
  74. showOverflow: true,
  75. columnConfig: {
  76. resizable: true,
  77. },
  78. scrollY: {
  79. enabled: true,
  80. gt: 100,
  81. },
  82. toolbarConfig: {
  83. zoom: true,
  84. custom: true,
  85. refresh: {
  86. queryMethod: () => {
  87. handleQuery();
  88. },
  89. },
  90. slots: {
  91. buttons: 'toolbar_buttons',
  92. },
  93. },
  94. customConfig: {
  95. storage: true,
  96. },
  97. id: 'snapshotReSendList',
  98. rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
  99. height: 'auto',
  100. columns: [
  101. { type: 'checkbox', width: 50, align: 'center' },
  102. {
  103. field: 'no',
  104. title: '工单编码',
  105. width: 140,
  106. },
  107. {
  108. field: 'content',
  109. title: '受理内容',
  110. width: 300,
  111. },
  112. {
  113. field: 'title',
  114. title: '工单标题',
  115. slots: { default: 'order_detail' },
  116. minWidth: 300,
  117. },
  118. {
  119. field: 'creationTime',
  120. title: '受理时间',
  121. formatter: 'formatDate',
  122. width: 160,
  123. },
  124. {
  125. field: 'county',
  126. title: '区域',
  127. width: 150,
  128. },
  129. {
  130. field: 'isSafetyDepartment',
  131. title: '标注状态',
  132. width: 100,
  133. slots: {
  134. default: ({ row }) => {
  135. return row.isSafetyDepartment === null ? '' : row.isSafetyDepartment ? '是' : '否';
  136. },
  137. },
  138. },
  139. {
  140. field: 'networkRemark',
  141. title: '回复内容',
  142. minWidth: 200,
  143. },
  144. {
  145. field: 'replyDate',
  146. title: '回复时间',
  147. formatter: 'formatDate',
  148. width: 160,
  149. },
  150. {
  151. field: 'networkENumber',
  152. title: '编号',
  153. width: 180,
  154. },
  155. {
  156. field: 'signUserName',
  157. title: '标注人员',
  158. width: 120,
  159. },
  160. {
  161. field: 'signTime',
  162. title: '标注时间',
  163. formatter: 'formatDate',
  164. width: 160,
  165. },
  166. ],
  167. data: [],
  168. });
  169. /** 搜索按钮操作 节流操作 */
  170. const handleQuery = () => {
  171. state.queryParams.PageIndex = 1;
  172. queryList();
  173. };
  174. // 获取列表
  175. const requestParams = ref<EmptyObjectType>({});
  176. const queryList = () => {
  177. state.loading = true;
  178. gridOptions.loading = true;
  179. requestParams.value = Other.deepClone(state.queryParams);
  180. getOrderMarkList(requestParams.value)
  181. .then((res) => {
  182. state.loading = false;
  183. gridOptions.data = res.result.items ?? [];
  184. state.total = res.result.total ?? 0;
  185. gridRef.value.clearCheckboxRow();
  186. checkTable.value = [];
  187. gridOptions.loading = false;
  188. })
  189. .finally(() => {
  190. gridRef.value.clearCheckboxRow();
  191. checkTable.value = [];
  192. state.loading = false;
  193. gridOptions.loading = false;
  194. });
  195. };
  196. // 重置表单
  197. const ruleFormRef = ref<any>(null); // 表单ref
  198. const resetQuery = (formEl: FormInstance | undefined) => {
  199. if (!formEl) return;
  200. formEl.resetFields();
  201. ruleFormRef.value?.resetFields();
  202. queryList();
  203. };
  204. const checkTable = ref<EmptyArrayType>([]);
  205. const gridRef = ref<RefType>();
  206. const selectAllChangeEvent = ({ checked }) => {
  207. if (gridRef.value) {
  208. const records = gridRef.value.getCheckboxRecords();
  209. checkTable.value = records;
  210. console.log(checked ? '所有勾选事件' : '所有取消事件', records);
  211. }
  212. };
  213. const selectChangeEvent = ({ checked }) => {
  214. if (gridRef.value) {
  215. const records = gridRef.value.getCheckboxRecords();
  216. checkTable.value = records;
  217. console.log(checked ? '勾选事件' : '取消事件', records);
  218. }
  219. };
  220. const isChecked = computed(() => {
  221. return !Boolean(checkTable.value.length);
  222. });
  223. // 添加标注
  224. const orderMarkAddRef = ref<RefType>();
  225. const onAdd = () => {
  226. const ids = checkTable.value.map((item: any) => item.orderId);
  227. orderMarkAddRef.value.openDialog(ids);
  228. };
  229. // 页面加载时
  230. onMounted(() => {
  231. queryList();
  232. });
  233. </script>
  234. layout/routerView/parer