管理系统PC端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
1周前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
  5. <!--部门数据-->
  6. <pane size="16">
  7. <el-col>
  8. <div class="head-container">
  9. <el-input v-model="deptName" placeholder="请输入区划名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
  10. </div>
  11. <div class="head-container container_main">
  12. <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
  13. </div>
  14. </el-col>
  15. </pane>
  16. <!--用户数据-->
  17. <pane size="84">
  18. <el-col>
  19. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  20. <el-form-item label="文件格式" prop="fileType">
  21. <el-select v-model="queryParams.fileType" placeholder="请选择文件格式" clearable>
  22. <el-option v-for="dict in dict.type.file_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="坐标系" prop="coordinateSystem">
  26. <el-select v-model="queryParams.coordinateSystem" placeholder="请选择坐标系" clearable>
  27. <el-option v-for="dict in dict.type.coordinate_system" :key="dict.value" :label="dict.label" :value="dict.value"/>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="任务状态" prop="taskStatus">
  31. <el-select v-model="queryParams.taskStatus" placeholder="请选择任务状态" clearable>
  32. <el-option v-for="dict in dict.type.task_status" :key="dict.value" :label="dict.label" :value="dict.value"/>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  37. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  38. </el-form-item>
  39. </el-form>
  40. <el-row :gutter="10" class="mb8">
  41. <el-col :span="1.5">
  42. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['business:export:add']">新增</el-button>
  43. </el-col>
  44. <!--
  45. <el-col :span="1.5">
  46. <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['business:export:edit']">修改</el-button>
  47. </el-col>
  48. <el-col :span="1.5">
  49. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['business:export:remove']">删除</el-button>
  50. </el-col>
  51. <el-col :span="1.5">
  52. <el-button type="success" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['business:export:import']">导入</el-button>
  53. </el-col>
  54. <el-col :span="1.5">
  55. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['business:export:export']">导出</el-button>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button type="info" plain icon="el-icon-printer" size="mini" @click="handlePrint()" v-hasPermi="['business:export:print']">打印</el-button>
  59. </el-col>
  60. -->
  61. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  62. </el-row>
  63. <!-- 数据列表 列属性 min-width="60" show-overflow-tooltip @selection-change="handleSelectionChange" -->
  64. <el-table v-loading="loading" :data="exportList" border>
  65. <!--<el-table-column type="selection" width="55" align="center" />-->
  66. <el-table-column label="id" align="center" prop="id" min-width="60"/>
  67. <el-table-column label="行政区划名称" align="center" prop="deptName" min-width="120"/>
  68. <el-table-column label="行政区划代码" align="center" prop="orgCode" min-width="150"/>
  69. <el-table-column label="文件格式" align="center" prop="fileType">
  70. <template slot-scope="scope">
  71. <dict-tag :options="dict.type.file_type" :value="scope.row.fileType"/>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="坐标系" align="center" prop="coordinateSystem">
  75. <template slot-scope="scope">
  76. <dict-tag :options="dict.type.coordinate_system" :value="scope.row.coordinateSystem"/>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="文件路径" align="center" prop="fileUrl" min-width="100" show-overflow-tooltip/>
  80. <el-table-column label="任务状态" align="center" prop="taskStatus">
  81. <template slot-scope="scope">
  82. <dict-tag :options="dict.type.task_status" :value="scope.row.taskStatus"/>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="300">
  86. <template slot-scope="scope">
  87. <el-button size="mini" type="text" icon="el-icon-view" @click="handleLook(scope.row)" v-hasPermi="['business:export:query']">查看</el-button>
  88. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:export:edit']">修改</el-button>
  89. <el-button size="mini" type="text" icon="el-icon-video-play" @click="handleDo(scope.row)" v-hasPermi="['business:export:do']" v-if="scope.row.taskStatus == '0'">执行</el-button>
  90. <el-button size="mini" type="text" icon="el-icon-download" @click="handleDown(scope.row)" v-hasPermi="['business:export:down']" v-if="scope.row.taskStatus == '3'">下载</el-button>
  91. <el-button size="mini" type="text" icon="el-icon-tickets" @click="openLog(scope.row)" v-hasPermi="['business:export:do']">日志</el-button>
  92. <el-dropdown size="mini" v-hasPermi="['business:export:remove']">
  93. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  94. <el-dropdown-menu slot="dropdown" style="padding: 5px">
  95. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['business:export:remove']">删除 </el-button>
  96. </el-dropdown-menu>
  97. </el-dropdown>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <!-- 分页插件 -->
  102. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
  103. </el-col>
  104. </pane>
  105. </splitpanes>
  106. </el-row>
  107. <!-- 导入EXCEL组件 -->
  108. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  109. <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  110. <i class="el-icon-upload"></i>
  111. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  112. <div class="el-upload__tip text-left" slot="tip">
  113. <div class="el-upload__tip" slot="tip">
  114. <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的导出任务
  115. </div>
  116. <p style="color: red">1、仅允许导入xls、xlsx格式文件;</p>
  117. <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
  118. </div>
  119. </el-upload>
  120. <div slot="footer" class="dialog-footer">
  121. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  122. <el-button @click="upload.open = false">取 消</el-button>
  123. </div>
  124. </el-dialog>
  125. <!-- 查看导出任务对话框 -->
  126. <el-dialog :title="title" :visible.sync="viewOpen" width="800px" append-to-body>
  127. <el-descriptions id="printDetail" :column="descColumn" border :labelStyle="{width: `${descLabelWidth}%`}" :contentStyle="{width: `${(100 / descColumn) - descLabelWidth}%`}">
  128. <el-descriptions-item label="行政区划名称">{{ form.deptName }}</el-descriptions-item>
  129. <el-descriptions-item label="行政区划代码">{{ form.orgCode }}</el-descriptions-item>
  130. <el-descriptions-item label="文件格式">{{ form.fileType }}</el-descriptions-item>
  131. <el-descriptions-item label="坐标系">{{ form.coordinateSystem }}</el-descriptions-item>
  132. <el-descriptions-item label="文件路径">{{ form.fileUrl }}</el-descriptions-item>
  133. <el-descriptions-item label="任务状态">{{ form.taskStatus }}</el-descriptions-item>
  134. </el-descriptions>
  135. <!-- 弹框操作按钮 -->
  136. <div slot="footer" class="dialog-footer">
  137. <el-button @click="doPrint">打 印</el-button>
  138. <el-button @click="cancelDetail">关 闭</el-button>
  139. </div>
  140. </el-dialog>
  141. <!-- 添加或修改导出任务对话框 -->
  142. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  143. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  144. <el-form-item label="区划名称" prop="deptName">
  145. <el-input v-model="form.deptName" placeholder="请输入行政区划名称" show-word-limit :maxlength="30" readonly/>
  146. </el-form-item>
  147. <el-form-item label="文件格式" prop="fileType">
  148. <el-select v-model="form.fileType" placeholder="请选择文件格式">
  149. <el-option v-for="dict in dict.type.file_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  150. </el-select>
  151. </el-form-item>
  152. <el-form-item label="坐标系" prop="coordinateSystem">
  153. <el-select v-model="form.coordinateSystem" placeholder="请选择坐标系">
  154. <el-option v-for="dict in dict.type.coordinate_system" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  155. </el-select>
  156. </el-form-item>
  157. </el-form>
  158. <div slot="footer" class="dialog-footer">
  159. <el-button type="primary" @click="submitForm">确 定</el-button>
  160. <el-button @click="cancel">取 消</el-button>
  161. </div>
  162. </el-dialog>
  163. <el-dialog title="任务日志" :visible.sync="log.logOpen" width="800px" append-to-body>
  164. <div v-html="log.logText">
  165. </div>
  166. <!-- 弹框操作按钮 -->
  167. <div slot="footer" class="dialog-footer">
  168. <el-button @click="downloadLog">下 载</el-button>
  169. <el-button @click="closeLog">关 闭</el-button>
  170. </div>
  171. </el-dialog>
  172. </div>
  173. </template>
  174. <script>
  175. import {
  176. listExport,
  177. getExport,
  178. getExportDetail,
  179. delExport,
  180. addExport,
  181. updateExport,
  182. printExport,
  183. startExport, exportLog, downloadLog, downloadFile
  184. } from "@/api/business/export"
  185. import { getToken } from "@/utils/auth"
  186. import Treeselect from "@riophae/vue-treeselect";
  187. import { Splitpanes, Pane } from "splitpanes"
  188. import "@riophae/vue-treeselect/dist/vue-treeselect.css"
  189. import "splitpanes/dist/splitpanes.css"
  190. import { deptTreeSelect } from "@/api/system/user"
  191. import {save} from "@/utils";
  192. export default {
  193. name: "Export",
  194. dicts: ['task_status', 'file_type', 'coordinate_system'],
  195. components: { Treeselect, Splitpanes, Pane },
  196. data() {
  197. return {
  198. // 遮罩层
  199. loading: true,
  200. // 导出遮罩层
  201. exportLoading: false,
  202. // 选中数组
  203. ids: [],
  204. // 非单个禁用
  205. single: true,
  206. // 非多个禁用
  207. multiple: true,
  208. // 显示搜索条件
  209. showSearch: true,
  210. // 总条数
  211. total: 0,
  212. // 导出任务表格数据
  213. exportList: [],
  214. // 弹出层标题
  215. title: "",
  216. // 是否显示弹出层
  217. open: false,
  218. // 详情组件列数
  219. descColumn: 2,
  220. // 详情组件Label所占百分比, 最大={100 / descColumn}. 内容所占百分比={100 / descColumn - descLabelWidth}
  221. descLabelWidth: 15,
  222. // 对话框显示只读的详情
  223. viewOpen: false,
  224. // 项目路径
  225. baseRoutingUrl: process.env.VUE_APP_BASE_API,
  226. // 所有部门树选项
  227. deptOptions: undefined,
  228. // 过滤掉已禁用部门树选项
  229. enabledDeptOptions: undefined,
  230. // 筛选部门名称
  231. deptName: undefined,
  232. // 选中的部门
  233. selectDeptName: null,
  234. defaultProps: {
  235. children: "children",
  236. label: "label"
  237. },
  238. // 查询参数
  239. queryParams: {
  240. pageNum: 1,
  241. pageSize: 10,
  242. // 查询排序
  243. //orderByColumn: "id",
  244. //isAsc: "desc",
  245. // 翻译字典
  246. //toTranslateDict: "1",
  247. deptId: null,
  248. deptName: null,
  249. orgCode: null,
  250. fileType: null,
  251. coordinateSystem: null,
  252. fileUrl: null,
  253. taskStatus: null,
  254. },
  255. // 表单参数
  256. form: {},
  257. // 表单校验
  258. rules: {
  259. deptName: [
  260. { required: true, message: "行政区划名称不能为空", trigger: "blur" }
  261. ],
  262. fileType: [
  263. { required: true, message: "文件格式不能为空", trigger: "change" }
  264. ],
  265. coordinateSystem: [
  266. { required: true, message: "坐标系不能为空", trigger: "change" }
  267. ],
  268. taskStatus: [
  269. { required: true, message: "任务状态不能为空", trigger: "change" }
  270. ],
  271. },
  272. // EXCEL导入
  273. upload: {
  274. // 是否显示弹出层(用户导入)
  275. open: false,
  276. // 弹出层标题(用户导入)
  277. title: "",
  278. // 是否禁用上传
  279. isUploading: false,
  280. // 是否更新已经存在的用户数据
  281. updateSupport: 0,
  282. // 设置上传的请求头部
  283. headers: { Authorization: "Bearer " + getToken() },
  284. // 上传的地址
  285. url: process.env.VUE_APP_BASE_API + "/business/export/importData"
  286. },
  287. log: {
  288. taskId: null,
  289. logOpen: false,
  290. logText: '',
  291. },
  292. }
  293. },
  294. watch: {
  295. // 根据名称筛选部门树
  296. deptName(val) {
  297. this.$refs.tree.filter(val)
  298. }
  299. },
  300. created() {
  301. this.getDeptTree()
  302. this.getList()
  303. },
  304. methods: {
  305. /** 查询导出任务列表 */
  306. getList() {
  307. this.loading = true
  308. listExport(this.queryParams).then(response => {
  309. this.exportList = response.rows
  310. this.total = response.total
  311. this.loading = false
  312. })
  313. },
  314. // 取消按钮
  315. cancel() {
  316. this.open = false
  317. this.reset()
  318. },
  319. cancelDetail() {
  320. this.viewOpen = false
  321. },
  322. // 表单重置
  323. reset() {
  324. this.form = {
  325. id: null,
  326. deptId: null,
  327. deptName: null,
  328. orgCode: null,
  329. fileType: '1',
  330. coordinateSystem: '2',
  331. fileUrl: null,
  332. taskStatus: '1',
  333. }
  334. this.resetForm("form")
  335. },
  336. /** 搜索按钮操作 */
  337. handleQuery() {
  338. this.queryParams.pageNum = 1
  339. this.getList()
  340. },
  341. /** 重置按钮操作 */
  342. resetQuery() {
  343. this.resetForm("queryForm")
  344. this.handleQuery()
  345. },
  346. // 多选框选中数据
  347. handleSelectionChange(selection) {
  348. this.ids = selection.map(item => item.id)
  349. this.single = selection.length!==1
  350. this.multiple = !selection.length
  351. },
  352. /** 新增按钮操作 */
  353. handleAdd() {
  354. if(this.selectDeptName == null || this.selectDeptName == ''){
  355. this.$modal.msgWarning("请先选择县级及以下行政区划!")
  356. return
  357. }
  358. this.reset()
  359. this.form.deptId = this.queryParams.deptId;
  360. this.form.deptName = this.selectDeptName;
  361. this.open = true
  362. this.title = "添加导出任务"
  363. },
  364. /** 修改按钮操作 */
  365. handleUpdate(row) {
  366. this.reset()
  367. const id = row.id || this.ids
  368. getExport(id).then(response => {
  369. this.form = response.data
  370. this.open = true
  371. this.title = "修改导出任务"
  372. })
  373. },
  374. /** 查看按钮操作 */
  375. handleLook(row) {
  376. const id = row.id || this.ids
  377. getExportDetail(id).then(response => {
  378. this.form = response.data;
  379. this.viewOpen = true;
  380. this.title = "查看导出任务";
  381. });
  382. },
  383. /** 提交按钮 */
  384. submitForm() {
  385. this.$refs["form"].validate(valid => {
  386. if (valid) {
  387. if (this.form.id != null) {
  388. updateExport(this.form).then(response => {
  389. this.$modal.msgSuccess("修改成功")
  390. this.open = false
  391. this.getList()
  392. })
  393. } else {
  394. addExport(this.form).then(response => {
  395. this.$modal.msgSuccess("新增成功")
  396. this.open = false
  397. this.getList()
  398. })
  399. }
  400. }
  401. })
  402. },
  403. /** 删除按钮操作 */
  404. handleDelete(row) {
  405. const ids = row.id || this.ids
  406. this.$modal.confirm('是否确认删除导出任务编号为"' + ids + '"的数据项?').then(function() {
  407. return delExport(ids)
  408. }).then(() => {
  409. this.getList()
  410. this.$modal.msgSuccess("删除成功")
  411. }).catch(() => {})
  412. },
  413. /** 导出按钮操作 */
  414. handleExport() {
  415. this.download('business/export/export', {
  416. ...this.queryParams
  417. }, `导出任务_${new Date().getTime()}.xlsx`)
  418. },
  419. /** 打印表单 */
  420. doPrint() {
  421. const originalTitle = document.title;
  422. try {
  423. document.title = this.title || '打印详情';
  424. const printElement = document.getElementById('printDetail');
  425. const printFrame = document.createElement('iframe');
  426. printFrame.style.position = 'absolute';
  427. printFrame.style.width = '0';
  428. printFrame.style.height = '0';
  429. printFrame.style.border = 'none';
  430. printFrame.style.left = '-9999px';
  431. printFrame.onload = function() {
  432. try {
  433. const frameDoc = printFrame.contentDocument || printFrame.contentWindow.document;
  434. const contentClone = printElement.cloneNode(true);
  435. const style = document.createElement('style');
  436. style.innerHTML = `
  437. @page {
  438. size: auto;
  439. margin: 10mm;
  440. }
  441. body {
  442. font-family: Arial, sans-serif;
  443. line-height: 1.5;
  444. margin: 0;
  445. padding: 0;
  446. }
  447. .el-descriptions {
  448. width: 100% !important;
  449. }
  450. .el-descriptions-item__label {
  451. width: ${this.descLabelWidth}% !important;
  452. }
  453. .el-descriptions-item__content {
  454. width: ${(100 / this.descColumn) - this.descLabelWidth}% !important;
  455. }
  456. /* 确保图片在打印时显示完整 */
  457. img, .el-image {
  458. max-width: 100% !important;
  459. height: auto !important;
  460. }
  461. `;
  462. frameDoc.head.appendChild(style);
  463. frameDoc.body.appendChild(contentClone);
  464. setTimeout(() => {
  465. printFrame.contentWindow.focus();
  466. printFrame.contentWindow.print();
  467. setTimeout(() => {
  468. document.body.removeChild(printFrame);
  469. document.title = originalTitle;
  470. }, 1000);
  471. }, 500);
  472. } catch (e) {
  473. document.body.removeChild(printFrame);
  474. document.title = originalTitle;
  475. this.$message.error('打印过程中发生错误');
  476. }
  477. };
  478. document.body.appendChild(printFrame);
  479. } catch (e) {
  480. document.title = originalTitle;
  481. this.$message.error('打印过程中发生错误');
  482. }
  483. },
  484. /** 打印按钮操作 */
  485. handlePrint() {
  486. printExport(this.queryParams).then(response => {})
  487. },
  488. /* 导入EXCEL组件 */
  489. handleImport() {
  490. this.upload.title = "导出任务导入"
  491. this.upload.open = true
  492. },
  493. /** 下载模板操作 */
  494. importTemplate() {
  495. this.download('business/export/importTemplate', {
  496. }, `export_template.xlsx`)
  497. },
  498. // 文件上传中处理
  499. handleFileUploadProgress(event, file, fileList) {
  500. this.upload.isUploading = true
  501. },
  502. // 文件上传成功处理
  503. handleFileSuccess(response, file, fileList) {
  504. this.upload.open = false
  505. this.upload.isUploading = false
  506. this.$refs.upload.clearFiles()
  507. this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
  508. this.getList()
  509. },
  510. // 提交上传文件
  511. submitFileForm() {
  512. this.$refs.upload.submit()
  513. },
  514. /** 查询部门下拉树结构 */
  515. getDeptTree() {
  516. deptTreeSelect().then(response => {
  517. this.deptOptions = response.data
  518. this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
  519. })
  520. },
  521. // 过滤禁用的部门
  522. filterDisabledDept(deptList) {
  523. return deptList.filter(dept => {
  524. if (dept.disabled) {
  525. return false
  526. }
  527. if (dept.children && dept.children.length) {
  528. dept.children = this.filterDisabledDept(dept.children)
  529. }
  530. return true
  531. })
  532. },
  533. // 筛选节点
  534. filterNode(value, data) {
  535. if (!value) return true
  536. return data.label.indexOf(value) !== -1
  537. },
  538. // 节点单击事件
  539. handleNodeClick(data) {
  540. this.queryParams.deptId = data.id
  541. this.selectDeptName = data.label
  542. this.handleQuery()
  543. },
  544. /** 开始 */
  545. handleDo(row) {
  546. const ids = row.id || this.ids
  547. this.$modal.confirm('是否确认开始编号为"' + ids + '"的导出任务?').then(function() {
  548. return startExport(ids)
  549. }).then((resp) => {
  550. this.getList()
  551. this.$modal.msgSuccess(resp.data == 2 ? '正在执行' : '已加入队列, 等待执行')
  552. }).catch(() => {})
  553. },
  554. /** 日志 */
  555. handleLog(row, offset = 0) {
  556. if(!this.log.logOpen)
  557. return;
  558. exportLog(row.id, offset).then(({data}) => {
  559. if(null == data.text)
  560. {
  561. this.log.logText = '';
  562. return;
  563. }
  564. this.log.logText += data.text
  565. .replaceAll('<', '&lt;')
  566. .replaceAll('>', '&gt;')
  567. .replaceAll('\r\n', '<br/>')
  568. .replaceAll('\r', '<br/>')
  569. .replaceAll('\n', '<br/>')
  570. ;
  571. if(!data.eof && this.log.logOpen && (data.taskStatus === '1' || data.taskStatus === '2'))
  572. {
  573. setTimeout(() => {
  574. this.handleLog(row, data.length);
  575. }, data.nextPollDelay > 0 ? data.nextPollDelay : 2000);
  576. }
  577. });
  578. },
  579. /** 日志 */
  580. downloadLog() {
  581. if(!this.log.taskId)
  582. return;
  583. downloadLog(this.log.taskId).then((resp) => {
  584. this.$message.success('开始下载......');
  585. save(`导出任务_${this.log.taskId}.log`, resp);
  586. });
  587. },
  588. openLog(row) {
  589. this.log.logText = '';
  590. this.log.logOpen = true;
  591. this.log.taskId = row.id;
  592. this.handleLog(row);
  593. },
  594. closeLog() {
  595. this.log.logOpen = false;
  596. this.log.taskId = null;
  597. this.log.logText = '';
  598. },
  599. /** 下载 */
  600. handleDown(row) {
  601. downloadFile(row.id).then((resp) => {
  602. this.$message.success('开始下载......');
  603. save(`导出任务_${row.id}.zip`, resp);
  604. });
  605. },
  606. }
  607. }
  608. </script>
  609. <style scoped type="scss">
  610. .container_main{
  611. height: 75vh;
  612. overflow-y: scroll;
  613. }
  614. </style>