index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--机构数据-->
  5. <!-- <el-col :span="4" :xs="24">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultKey="getDefaultKey"
  9. @defaultOrg="getDefaultOrg"
  10. @checkChange="checkChange"
  11. @click="clickTreeNode"
  12. ></org-tree>
  13. </el-col> -->
  14. <el-col :span="24" :xs="24">
  15. <div class="main-right-box">
  16. <div class="main-search-box">
  17. <el-form
  18. :model="queryParams"
  19. ref="queryForm"
  20. size="small"
  21. :inline="true"
  22. v-show="showSearch"
  23. >
  24. <el-form-item label="调阅机构">
  25. <org-tree
  26. v-model="queryParams.orgId"
  27. @defaultKey="getDefaultKey"
  28. @defaultOrg="getDefaultOrg"
  29. @checkChange="checkChange"
  30. @click="clickTreeNode"
  31. ></org-tree>
  32. </el-form-item>
  33. <el-form-item label="任务名称" prop="taskName">
  34. <el-input
  35. v-model="queryParams.taskName"
  36. placeholder="请输入任务名称"
  37. clearable
  38. @keyup.enter.native="handleQuery"
  39. maxlength="50"
  40. />
  41. </el-form-item>
  42. <el-form-item label="调阅人员" prop="roleId">
  43. <el-select
  44. v-model="queryParams.roleId"
  45. placeholder="请选择调阅人员"
  46. clearable
  47. >
  48. <el-option
  49. v-for="item in roleList"
  50. :key="item.id"
  51. :label="item.name"
  52. :value="item.id"
  53. ></el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item label="任务进度" prop="status">
  57. <el-select
  58. v-model="queryParams.status"
  59. placeholder="请选择进度"
  60. clearable
  61. >
  62. <el-option
  63. v-for="dict in dict.type.retrieval_task_status"
  64. :key="dict.value"
  65. :label="dict.label"
  66. :value="dict.value"
  67. />
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="任务时间" prop="planStartTime">
  71. <DataRangePicker
  72. type="daterange"
  73. value-format="yyyy-MM-dd HH:mm:ss"
  74. :default-time="['00:00:00', '23:59:59']"
  75. start-placeholder="开始日期"
  76. end-placeholder="结束日期"
  77. v-model="queryParams.dateRange"
  78. :picker-options="pickerOptions"
  79. >
  80. </DataRangePicker>
  81. </el-form-item>
  82. </el-form>
  83. <el-row :gutter="10" class="mb8">
  84. <el-col :span="1.5">
  85. <el-button
  86. type="primary"
  87. icon="el-icon-search"
  88. size="mini"
  89. @click="handleQuery"
  90. >搜索
  91. </el-button>
  92. </el-col>
  93. <el-col :span="1.5">
  94. <el-button
  95. type="primary"
  96. icon="el-icon-refresh"
  97. size="mini"
  98. @click="resetQuery"
  99. >重置
  100. </el-button>
  101. </el-col>
  102. <el-col :span="1.5">
  103. <el-button
  104. type="primary"
  105. icon="el-icon-download"
  106. size="mini"
  107. @click="handleExport"
  108. v-hasPermi="['core:task:export']"
  109. >导出</el-button
  110. >
  111. </el-col>
  112. <right-toolbar
  113. :showSearch.sync="showSearch"
  114. @queryTable="getList"
  115. ></right-toolbar>
  116. </el-row>
  117. </div>
  118. <el-table
  119. v-loading="loading"
  120. :data="taskList"
  121. border
  122. height="600"
  123. size="small"
  124. >
  125. <el-table-column
  126. label="序号"
  127. type="index"
  128. align="center"
  129. width="100"
  130. >
  131. <template slot-scope="scope">
  132. <span>{{
  133. (queryParams.pageNum - 1) * queryParams.pageSize +
  134. scope.$index +
  135. 1
  136. }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column
  140. label="任务名称"
  141. align="center"
  142. prop="taskName"
  143. width="220"
  144. show-overflow-tooltip="true"
  145. />
  146. <el-table-column
  147. label="调阅机构"
  148. align="center"
  149. prop="orgName"
  150. width="220"
  151. />
  152. <el-table-column
  153. label="调阅人员"
  154. align="center"
  155. prop="roleName"
  156. width="160"
  157. />
  158. <el-table-column label="任务进度" align="center" prop="status">
  159. <template slot-scope="scope">
  160. <span :style="statusColor(scope.row.status)">
  161. <dict-tag
  162. :options="dict.type.retrieval_task_status"
  163. :value="scope.row.status"
  164. />
  165. </span>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="任务时间" align="center" width="300">
  169. <template slot-scope="scope">
  170. {{ scope.row.planStartTime }}~{{ scope.row.planEndTime }}
  171. </template>
  172. </el-table-column>
  173. <el-table-column
  174. label="异常数量"
  175. align="center"
  176. prop="exceptionCount"
  177. />
  178. <el-table-column
  179. label="操作"
  180. fixed="right"
  181. style="width: 100px"
  182. align="center"
  183. class-name="small-padding fixed-width"
  184. >
  185. <template slot-scope="scope">
  186. <el-button
  187. size="mini"
  188. type="text"
  189. icon="el-icon-view"
  190. @click="lookView(scope.row)"
  191. v-hasPermi="['core:task:query']"
  192. >详情</el-button
  193. >
  194. </template>
  195. </el-table-column>
  196. </el-table>
  197. <dialog-info ref="infoDialog" @success="refresh(true)"></dialog-info>
  198. <pagination
  199. v-show="total > 0"
  200. :total="total"
  201. :page.sync="queryParams.pageNum"
  202. :limit.sync="queryParams.pageSize"
  203. @pagination="getList"
  204. />
  205. </div>
  206. </el-col>
  207. </el-row>
  208. </div>
  209. </template>
  210. <script>
  211. import {
  212. listTask,
  213. getTask,
  214. delTask,
  215. addTask,
  216. updateTask,
  217. roleList,
  218. exportExcel,
  219. } from "@/api/core/task";
  220. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  221. import DialogInfo from "./dialog.info";
  222. import { listPlanRole } from "@/api/core/edu/plan";
  223. import { formatTime } from "@/utils/ruoyi";
  224. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  225. import dayjs from "dayjs";
  226. export default {
  227. components: { OrgTree, DialogInfo, DataRangePicker },
  228. name: "Task",
  229. dicts: ["sys_access_cycle", "retrieval_task_status"],
  230. data() {
  231. return {
  232. // 遮罩层
  233. loading: true,
  234. // 选中数组
  235. ids: [],
  236. // 非单个停用
  237. single: true,
  238. // 非多个停用
  239. multiple: true,
  240. // 显示搜索条件
  241. showSearch: true,
  242. // 总条数
  243. total: 0,
  244. // 监控调阅任务表格数据
  245. taskList: [],
  246. // 弹出层标题
  247. title: "",
  248. // 是否显示弹出层
  249. open: false,
  250. // 查询参数
  251. queryParams: {
  252. pageNum: 1,
  253. pageSize: 10,
  254. taskName: null,
  255. cycle: null,
  256. dateRange: [],
  257. status: null,
  258. roleId: null,
  259. checkSub: true,
  260. },
  261. selectedOrgName: "",
  262. // 表单参数
  263. form: {},
  264. // 表单校验
  265. rules: {},
  266. roleList: [],
  267. orgName: "",
  268. };
  269. },
  270. created() {
  271. this.queryParams.orgId = this.$store.getters.orgId;
  272. this.getList();
  273. this.initRoleList();
  274. },
  275. methods: {
  276. /** 查询监控调阅任务列表 */
  277. getList() {
  278. this.loading = true;
  279. listTask(this.queryParams).then((response) => {
  280. this.taskList = response.rows;
  281. this.total = response.total;
  282. this.loading = false;
  283. });
  284. },
  285. /* handleExport() {
  286. console.log(this,'this')
  287. this.$http()
  288. .post('/core/task/export',this.queryParams)
  289. /!* exportExcel(this.queryParams).then(res => {
  290. let file = new File([res],res.getHeader())
  291. console.log(res,'res111')
  292. });*!/
  293. },*/
  294. getDefaultOrg(org) {
  295. this.orgName = org.name;
  296. this.selectedOrgName = org.shortName;
  297. },
  298. initRoleList() {
  299. roleList({}).then((response) => {
  300. this.roleList = response.data;
  301. });
  302. },
  303. getDefaultKey(key) {
  304. this.queryParams.orgId = key;
  305. this.getList();
  306. },
  307. checkChange(state) {
  308. this.queryParams.checkSub = state;
  309. this.handleQuery();
  310. },
  311. // 节点单击事件
  312. clickTreeNode(data) {
  313. this.queryParams.orgId = data.id;
  314. this.orgName = data.name;
  315. this.selectedOrgName = data.shortName;
  316. this.handleQuery();
  317. },
  318. /** 下穿状态改变*/
  319. changeCheckBox() {
  320. this.getList();
  321. },
  322. // 取消按钮
  323. cancel() {
  324. this.open = false;
  325. this.reset();
  326. },
  327. // 表单重置
  328. reset() {
  329. this.form = {
  330. id: null,
  331. planId: null,
  332. taskName: null,
  333. orgId: null,
  334. orgPath: null,
  335. orgName: null,
  336. ymdDate: null,
  337. ymdYear: null,
  338. ymdHalfyear: null,
  339. ymdQuarter: null,
  340. ymdMonth: null,
  341. ymdWeek: null,
  342. ymdDay: null,
  343. cycle: null,
  344. planStartTime: null,
  345. planEndTime: null,
  346. startTime: null,
  347. endTime: null,
  348. status: null,
  349. roleId: null,
  350. retrievalUser: null,
  351. orderNum: null,
  352. batchNum: null,
  353. submitTime: null,
  354. exceptionCount: null,
  355. };
  356. this.resetForm("form");
  357. },
  358. /** 搜索按钮操作 */
  359. handleQuery() {
  360. this.queryParams.pageNum = 1;
  361. //this.queryParams.dateRange = [];
  362. this.getList();
  363. },
  364. /** 重置按钮操作 */
  365. resetQuery() {
  366. this.resetForm("queryForm");
  367. this.queryParams.dateRange = [];
  368. this.handleQuery();
  369. },
  370. // 多选框选中数据
  371. handleSelectionChange(selection) {
  372. this.ids = selection.map((item) => item.id);
  373. this.single = selection.length !== 1;
  374. this.multiple = !selection.length;
  375. },
  376. /** 新增按钮操作 */
  377. handleAdd() {
  378. this.reset();
  379. this.open = true;
  380. this.title = "添加监控调阅任务";
  381. },
  382. /** 修改按钮操作 */
  383. lookView(row) {
  384. this.$refs["infoDialog"].show(row.id, {});
  385. },
  386. /** 导出按钮操作 */
  387. handleExport() {
  388. console.log(this);
  389. this.download(
  390. "core/retrievalTask/export",
  391. {
  392. ...this.queryParams,
  393. },
  394. `${
  395. this.selectedOrgName
  396. }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
  397. );
  398. },
  399. statusColor(status) {
  400. let color = "";
  401. switch (status) {
  402. case "0":
  403. color = "#00B0F0";
  404. break;
  405. case "1":
  406. color = "#FFC000";
  407. break;
  408. case "2":
  409. color = "#00B050";
  410. break;
  411. case "3":
  412. color = "#FF0000";
  413. break;
  414. }
  415. return "color:" + color;
  416. },
  417. },
  418. };
  419. </script>