TaskList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="任务名称">
  9. <j-input placeholder="请输入任务名称" v-model="queryParam.taskName"></j-input>
  10. <j-input style="display: none" placeholder="请输入任务名称" v-model="queryParam.type = 4"></j-input>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  14. <a-form-item label="任务状态">
  15. <j-dict-select-tag placeholder="请选择任务状态" v-model="queryParam.taskState" dictCode="sms_check_task_state"/>
  16. </a-form-item>
  17. </a-col>
  18. <template v-if="toggleSearchStatus">
  19. <a-col :xl="10" :lg="11" :md="12" :sm="24">
  20. <a-form-item label="开始时间">
  21. <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间"
  22. class="query-group-cust" v-model="queryParam.taskStartTime_begin"></j-date>
  23. <span class="query-group-split-cust"></span>
  24. <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间"
  25. class="query-group-cust" v-model="queryParam.taskStartTime_end"></j-date>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :xl="10" :lg="11" :md="12" :sm="24">
  29. <a-form-item label="结束时间">
  30. <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间"
  31. class="query-group-cust" v-model="queryParam.taskEndTime_begin"></j-date>
  32. <span class="query-group-split-cust"></span>
  33. <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间"
  34. class="query-group-cust" v-model="queryParam.taskEndTime_end"></j-date>
  35. </a-form-item>
  36. </a-col>
  37. </template>
  38. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  39. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  40. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  41. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  42. <a @click="handleToggleSearch" style="margin-left: 8px">
  43. {{ toggleSearchStatus ? '收起' : '展开' }}
  44. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  45. </a>
  46. </span>
  47. </a-col>
  48. </a-row>
  49. </a-form>
  50. </div>
  51. <!-- 查询区域-END -->
  52. <!-- 操作按钮区域 -->
  53. <div class="table-operator">
  54. <a-button @click="handleAdd" v-has="'task:list:add'" type="primary" icon="plus">新增</a-button>
  55. <a-button @click="showImport" v-has="'task:list:import'" type="primary" icon="import">导入客户</a-button>
  56. <a-button type="primary" v-has="'task:list:export'" icon="download" @click="handleExportXls('稽核任务')">导出任务
  57. </a-button>
  58. <!-- 高级查询区域 -->
  59. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
  60. <a-dropdown v-if="selectedRowKeys.length > 0">
  61. <a-menu slot="overlay">
  62. <a-menu-item key="1" @click="batchDel" v-has="'task:list:delete'">
  63. <a-icon type="delete"/>
  64. 删除
  65. </a-menu-item>
  66. </a-menu>
  67. <a-button style="margin-left: 8px"> 批量操作
  68. <a-icon type="down"/>
  69. </a-button>
  70. </a-dropdown>
  71. </div>
  72. <!-- table区域 begin -->
  73. <div>
  74. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  75. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
  76. style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  77. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  78. </div>
  79. <a-table
  80. ref="table"
  81. size="middle"
  82. :scroll="{x:true}"
  83. bordered
  84. rowKey="id"
  85. :columns="columns"
  86. :dataSource="dataSource"
  87. :pagination="ipagination"
  88. :loading="loading"
  89. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  90. class="j-table-force-nowrap"
  91. @change="handleTableChange">
  92. <span slot="action" slot-scope="text, record">
  93. <span v-has="'task:list:edit'">
  94. <a @click="handleEdit(record)">编辑</a>
  95. <a-divider type="vertical"/>
  96. </span>
  97. <span v-has="'task:list:detail'">
  98. <a @click="handleDetail(record)">详情</a>
  99. <a-divider type="vertical"/>
  100. </span>
  101. <span v-has="'task:list:detail'">
  102. <a @click="showCheckList(record)">稽核详情</a>
  103. <a-divider type="vertical"/>
  104. </span>
  105. <a-dropdown v-has="'task:list:more'">
  106. <a class="ant-dropdown-link">更多<a-icon type="down"/></a>
  107. <a-menu slot="overlay">
  108. <a-menu-item v-has="'task:list:start'" v-if="record.taskState == 0">
  109. <a-popconfirm title="确定开始稽核吗?" @confirm="() => checkStart(record)">
  110. <a>开始稽核</a>
  111. </a-popconfirm>
  112. </a-menu-item>
  113. <a-menu-item v-has="'task:list:end'" v-if="record.taskState == 1">
  114. <a-popconfirm title="确定结束稽核吗?" @confirm="() => checkEnd(record)">
  115. <a>结束稽核</a>
  116. </a-popconfirm>
  117. </a-menu-item>
  118. <a-menu-item v-has="'task:list:delete'">
  119. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  120. <a>删除</a>
  121. </a-popconfirm>
  122. </a-menu-item>
  123. </a-menu>
  124. </a-dropdown>
  125. </span>
  126. <!-- 任务名称可点击 -->
  127. <template v-slot:taskName="text, record">
  128. <a @click="showCheckList(record)">{{ text }}</a>
  129. </template>
  130. </a-table>
  131. </div>
  132. <!-- table区域 end -->
  133. <!-- 任务添加 -->
  134. <task-add ref="modalForm" @ok="modalFormOk"></task-add>
  135. <task-detail ref="modalDetail" @ok="modalFormOk"></task-detail>
  136. </a-card>
  137. </template>
  138. <script>
  139. import {putAction} from '@api/manage'
  140. import '@/assets/less/TableExpand.less'
  141. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  142. import TaskAdd from './TaskAdd'
  143. import TaskDetail from '../../smscheck/modules/TaskDetail'
  144. export default {
  145. name: 'TaskList',
  146. mixins: [JeecgListMixin],
  147. inject: ['closeCurrent'],
  148. components: {
  149. TaskAdd,
  150. TaskDetail,
  151. },
  152. data() {
  153. return {
  154. description: '中继线稽核任务列表',
  155. disableSubmit: false,
  156. columns: [
  157. {
  158. title: '#',
  159. dataIndex: '',
  160. key: 'rowIndex',
  161. width: 60,
  162. align: "center",
  163. customRender: function (t, r, index) {
  164. return parseInt(index) + 1;
  165. }
  166. },
  167. {
  168. title: '任务名称',
  169. align: "center",
  170. sorter: true,
  171. dataIndex: 'taskName',
  172. scopedSlots: {customRender: 'taskName'}
  173. },
  174. {
  175. title: '任务状态',
  176. align: "center",
  177. sorter: true,
  178. dataIndex: 'taskState_dictText'
  179. },
  180. {
  181. title: '任务开始时间',
  182. align: "center",
  183. sorter: true,
  184. dataIndex: 'taskStartTime'
  185. },
  186. {
  187. title: '任务结束时间',
  188. align: "center",
  189. sorter: true,
  190. dataIndex: 'taskEndTime'
  191. },
  192. // {
  193. // title:'描述',
  194. // align:"center",
  195. // dataIndex: 'description'
  196. // },
  197. {
  198. title: '客户总数',
  199. align: "center",
  200. dataIndex: 'customerCount'
  201. },
  202. // {
  203. // title:'待稽核数',
  204. // align:"center",
  205. // dataIndex: 'uncheckCount'
  206. // },
  207. {
  208. title: '操作',
  209. dataIndex: 'action',
  210. align: "center",
  211. fixed: "right",
  212. width: 147,
  213. scopedSlots: {customRender: 'action'}
  214. }
  215. ],
  216. url: {
  217. list: "/smsCheck/task/list",
  218. delete: "/smsCheck/task/delete",
  219. edit: "/smsCheck/task/edit",
  220. deleteBatch: "/smsCheck/task/deleteBatch",
  221. exportXlsUrl: "/smsCheck/task/exportXls",
  222. importExcelUrl: "smsCheck/task/importExcel",
  223. },
  224. dictOptions: {},
  225. superFieldList: [],
  226. currentTaskState: 0,
  227. autoSearch: false,
  228. }
  229. },
  230. created() {
  231. this.queryParam.taskState = this.$route.query.state;
  232. //直接加载url.list接口数据
  233. let queryParam = {
  234. "type":4,
  235. "column": "createTime",
  236. 'order': "desc"
  237. }
  238. this.loadData(null,queryParam);
  239. this.getSuperFieldList();
  240. },
  241. computed: {
  242. importExcelUrl: function () {
  243. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  244. },
  245. },
  246. methods: {
  247. // 显示添加页面
  248. showAdd() {
  249. this.$emit('goAdd');
  250. },
  251. // 显示导入页面
  252. showImport() {
  253. // 选择一条
  254. if (this.selectedRowKeys.length !== 1) {
  255. this.$message.warning('请选择一条记录!');
  256. return;
  257. }
  258. let taskInfo = this.buildTaskInfo(this.selectionRows[0]);
  259. this.$router.push({path: '/smscheck/modules/TaskImportTruck', query: {id: taskInfo.id}});
  260. },
  261. // 显示导入页面
  262. showCheckList(record) {
  263. this.$router.push({path: '/truck/check/task/check', query: {id: record.id}});
  264. },
  265. /**
  266. * 构建 任务信息对象
  267. * @param record 任务信息
  268. * @returns {*} 任务信息对象
  269. */
  270. buildTaskInfo(record) {
  271. return {
  272. id: record.id,
  273. name: record.taskName,
  274. startTime: record.taskStartTime,
  275. endTime: record.taskEndTime,
  276. state: record.taskState,
  277. stateText: record.taskState_dictText,
  278. description: record.description,
  279. count: record.customerCount,
  280. uncheckCount: record.uncheckCount,
  281. checkCount: record.checkCount,
  282. };
  283. },
  284. initDictConfig() {
  285. },
  286. getSuperFieldList() {
  287. let fieldList = [];
  288. fieldList.push({type: 'string', value: 'taskName', text: '任务名称', dictCode: ''})
  289. fieldList.push({type: 'string', value: 'taskState', text: '任务状态', dictCode: 'sms_check_task_state'})
  290. fieldList.push({type: 'datetime', value: 'taskStartTime', text: '任务开始时间'})
  291. fieldList.push({type: 'datetime', value: 'taskEndTime', text: '任务结束时间'})
  292. this.superFieldList = fieldList
  293. },
  294. handleDetail(record) {
  295. this.$refs.modalDetail.detail(record);
  296. this.$refs.modalDetail.title = "详情";
  297. },
  298. checkStart(record) {
  299. record.taskState = 1;
  300. let that = this;
  301. let httpUrl = this.url.edit;
  302. let param = record;
  303. // 发送请求
  304. putAction(httpUrl, param)
  305. .then((res) => {
  306. if (res.success) {
  307. that.$message.success("稽核任务已开始!");
  308. } else {
  309. that.$message.warning(res.message);
  310. }
  311. }).finally(() => {
  312. that.loadData();
  313. })
  314. },
  315. checkEnd(record) {
  316. record.taskState = 2;
  317. let that = this;
  318. let httpUrl = this.url.edit;
  319. let param = record;
  320. // 发送请求
  321. putAction(httpUrl, param)
  322. .then((res) => {
  323. if (res.success) {
  324. that.$message.success("稽核任务已结束!");
  325. } else {
  326. that.$message.warning(res.message);
  327. }
  328. }).finally(() => {
  329. that.loadData();
  330. })
  331. },
  332. }
  333. }
  334. </script>
  335. <style scoped>
  336. </style>