index.vue 9.3 KB

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