index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item :label="$t('年份')" prop="year">
  5. <el-date-picker clearable size="small" style="width: 200px"
  6. v-model="queryParams.year"
  7. type="year"
  8. value-format="yyyy"
  9. :placeholder="$t('请选择')+$t('年份')">
  10. </el-date-picker>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  14. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <el-row :gutter="10" class="mb8">
  18. <el-col :span="1.5">
  19. <el-button
  20. type="primary"
  21. icon="el-icon-plus"
  22. size="mini"
  23. @click="handleAdd"
  24. v-hasPermi="['plant:targetlist:add']"
  25. >{{ $t('新增') }}</el-button>
  26. </el-col>
  27. <el-col :span="1.5">
  28. <el-button
  29. type="info"
  30. icon="el-icon-upload2"
  31. size="mini"
  32. @click="handleImport"
  33. v-hasPermi="['plant:targetlist:edit']"
  34. >{{ $t('导入') }}</el-button>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button
  38. type="warning"
  39. icon="el-icon-download"
  40. size="mini"
  41. @click="handleExport"
  42. v-hasPermi="['plant:targetlist:export']"
  43. >{{ $t('导出') }}</el-button>
  44. <el-col :span="1.5">
  45. <el-button
  46. type="success"
  47. icon="el-icon-tickets"
  48. size="mini"
  49. @click="handleCompany"
  50. >{{ $t('公司目标') }}</el-button>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-button
  54. type="success"
  55. icon="el-icon-tickets"
  56. size="mini"
  57. @click="handleCB"
  58. >{{ $t('事业部目标') }}</el-button>
  59. </el-col>
  60. </el-col>
  61. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  62. </el-row>
  63. <el-table
  64. v-loading="loading"
  65. :data="targetlistList"
  66. row-key="id"
  67. default-expand-all
  68. :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
  69. >
  70. <el-table-column :label="$t('装置名称')" align="center" prop="plantCode" :formatter="plantCodeFormat" />
  71. <el-table-column label="ITEM" align="center" prop="item" />
  72. <el-table-column :label="$t('内容')" align="center" prop="description" />
  73. <el-table-column :label="$t('目标')" align="center" prop="targets" />
  74. <el-table-column :label="$t('年份')" align="center" prop="year" />
  75. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  76. <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
  77. <template slot-scope="scope">
  78. <el-button
  79. size="mini"
  80. type="text"
  81. icon="el-icon-edit"
  82. @click="handleUpdate(scope.row)"
  83. v-hasPermi="['plant:targetlist:edit']"
  84. >{{ $t('修改') }}</el-button>
  85. <el-button
  86. size="mini"
  87. type="text"
  88. icon="el-icon-delete"
  89. @click="handleDelete(scope.row)"
  90. v-hasPermi="['plant:targetlist:remove']"
  91. >{{ $t('删除') }}</el-button>
  92. <el-button
  93. size="mini"
  94. type="text"
  95. icon="el-icon-plus"
  96. @click="handleAddItem(scope.row)"
  97. v-hasPermi="['plant:targetlist:add']"
  98. v-if="scope.row.parentId === 0"
  99. >{{ $t('新增') }}</el-button>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. <!-- 添加或修改目标录入对话框 -->
  104. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
  105. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  106. <el-form-item :label="$t('装置名称')" prop="plantCode">
  107. <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
  108. <el-option
  109. v-for="dict in plantCodeOptions"
  110. :key="dict.dictValue"
  111. :label="dict.dictLabel"
  112. :value="dict.dictValue"
  113. ></el-option>
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item label="ITEM" prop="item">
  117. <el-input v-model="form.item" :placeholder="$t('请输入') + 'ITEM'" />
  118. </el-form-item>
  119. <el-form-item :label="$t('内容')" prop="description">
  120. <el-input v-model="form.description" :placeholder="$t('请输入') + $t('内容')" />
  121. </el-form-item>
  122. <el-form-item :label="$t('目标')" prop="targets">
  123. <el-input v-model="form.targets" :placeholder="$t('请输入') + $t('目标')" />
  124. </el-form-item>
  125. <el-form-item :label="$t('年份')" prop="year">
  126. <el-input v-model="form.year" :placeholder="$t('请输入') + $t('年份')" />
  127. </el-form-item>
  128. <el-form-item :label="$t('备注')" prop="remarks">
  129. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  130. </el-form-item>
  131. <el-form-item :label="$t('备注')" prop="yardstick" v-if="form.parentId !== 0">
  132. <el-input v-model="form.yardstick" :placeholder="$t('请输入') + $t('判断标准')" />
  133. </el-form-item>
  134. <el-form-item :label="$t('合作者')" prop="partners" v-if="form.parentId !== 0">
  135. <el-select v-model="form.partners" :placeholder="$t('请选择') + $t('合作者')" multiple>
  136. <el-option
  137. v-for="dict in partnersOptions"
  138. :key="dict.dictValue"
  139. :label="dict.dictLabel"
  140. :value="dict.dictValue"
  141. ></el-option>
  142. </el-select>
  143. </el-form-item>
  144. <el-form-item :label="$t('归属部门')" prop="deptId">
  145. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  146. </el-form-item>
  147. <el-form-item :label="$t('父级目录')" prop="parentId">
  148. <treeselect v-model="form.parentId" :options="targetlistOptions" :normalizer="normalizer" :placeholder="$t('请选择') + $t('父级目录')" />
  149. </el-form-item>
  150. </el-form>
  151. <div slot="footer" class="dialog-footer">
  152. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  153. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  154. </div>
  155. </el-dialog>
  156. <!-- 公司目标对话框 -->
  157. <el-dialog v-dialogDrag :title="target.title" :visible.sync="target.open" width="700px" append-to-body>
  158. <el-upload
  159. ref="target"
  160. :limit="50"
  161. :headers="target.headers"
  162. :action="target.url + '?pType=' + target.pType + '&pId=' + target.pId"
  163. :disabled="target.isUploading"
  164. :on-progress="handleFileDocProgress"
  165. :on-success="handleFileDocSuccess"
  166. :auto-upload="true"
  167. drag
  168. >
  169. <i class="el-icon-upload"></i>
  170. <div class="el-upload__text">
  171. {{ $t('将文件拖到此处,或') }}
  172. <em>{{ $t('点击上传') }}</em>
  173. </div>
  174. </el-upload>
  175. <el-table :data="target.commonfileList" border>
  176. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  177. <template slot-scope="scope">
  178. <a class="link-type" @click="handleDownload(scope.row)">
  179. <span>{{ scope.row.fileName }}</span>
  180. </a>
  181. </template>
  182. </el-table-column>
  183. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  184. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  185. <el-table-column :label="$t('操作')" align="center" width="150" class-name="small-padding fixed-width">
  186. <template slot-scope="scope">
  187. <el-button
  188. v-if="scope.row.fileName.endsWith('pdf')"
  189. size="mini"
  190. type="text"
  191. icon="el-icon-view"
  192. @click="handleSee(scope.row)"
  193. >{{ $t('预览') }}</el-button>
  194. <el-button
  195. size="mini"
  196. type="text"
  197. icon="el-icon-download"
  198. @click="handleDownload(scope.row)"
  199. >{{ $t('下载') }}</el-button>
  200. <el-button
  201. size="mini"
  202. type="text"
  203. icon="el-icon-delete"
  204. @click="handleDeleteDoc(scope.row)"
  205. >{{ $t('删除') }}</el-button>
  206. </template>
  207. </el-table-column>
  208. </el-table>
  209. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1700px" append-to-body>
  210. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  211. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  212. <div style="margin-top: -30px">
  213. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  214. </div>
  215. </el-dialog>
  216. <div slot="footer" class="dialog-footer">
  217. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  218. <el-button @click="target.open = false">{{ $t('返 回') }}</el-button>
  219. </div>
  220. </el-dialog>
  221. <!-- 用户导入对话框 -->
  222. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  223. <el-upload
  224. ref="upload"
  225. :limit="1"
  226. accept=".xlsx, .xls"
  227. :headers="upload.headers"
  228. :action="upload.url"
  229. :disabled="upload.isUploading"
  230. :on-progress="handleFileUploadProgress"
  231. :on-success="handleFileSuccess"
  232. :auto-upload="false"
  233. drag
  234. >
  235. <i class="el-icon-upload"></i>
  236. <div class="el-upload__text">
  237. {{ $t('将文件拖到此处,或') }}
  238. <em>{{ $t('点击上传') }}</em>
  239. </div>
  240. <div class="el-upload__tip" slot="tip">
  241. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  242. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  243. </div>
  244. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  245. <input name="type" :value="upload.type" hidden />
  246. </form>
  247. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  248. </el-upload>
  249. <div slot="footer" class="dialog-footer">
  250. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  251. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  252. </div>
  253. </el-dialog>
  254. </div>
  255. </template>
  256. <script>
  257. import { listTargetlist, getTargetlist, delTargetlist, addTargetlist, updateTargetlist, exportTargetlist } from "@/api/plant/targetlist";
  258. import { allFileList, listCommonfile, getCommonfile, delCommonfile, addCommonfile, updateCommonfile, exportCommonfile} from "@/api/common/commonfile";
  259. import Treeselect from "@riophae/vue-treeselect";
  260. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  261. import { getToken } from "@/utils/auth";
  262. import { treeselect } from "@/api/system/dept";
  263. export default {
  264. name: "Targetlist",
  265. components: {
  266. Treeselect
  267. },
  268. data() {
  269. return {
  270. // 遮罩层
  271. loading: true,
  272. // 显示搜索条件
  273. showSearch: false,
  274. // 目标录入表格数据
  275. targetlistList: [],
  276. // 目标录入树选项
  277. targetlistOptions: [],
  278. // 弹出层标题
  279. title: "",
  280. // 是否显示弹出层
  281. open: false,
  282. // 装置名称字典
  283. plantCodeOptions: [],
  284. // 合作者字典
  285. partnersOptions: [],
  286. // 用户导入参数
  287. upload: {
  288. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  289. //下载模板类型
  290. type: "targetlist",
  291. // 是否显示弹出层(用户导入)
  292. open: false,
  293. // 弹出层标题(用户导入)
  294. title: "",
  295. // 是否禁用上传
  296. isUploading: false,
  297. // 是否更新已经存在的用户数据
  298. updateSupport: 0,
  299. // 设置上传的请求头部
  300. headers: { Authorization: "Bearer " + getToken() },
  301. // 上传的地址
  302. url: process.env.VUE_APP_BASE_API + "/plant/targetlist/importData"
  303. },
  304. //公司目标导入参数
  305. target: {
  306. file: "",
  307. // 是否显示弹出层(公司目标)
  308. open: false,
  309. // 弹出层标题(公司目标)
  310. title: this.$t('公司目标'),
  311. // 是否禁用上传
  312. isUploading: false,
  313. // 是否更新已经存在的用户数据
  314. updateSupport: 0,
  315. // 设置上传的请求头部
  316. headers: { Authorization: "Bearer " + getToken() },
  317. // 上传的地址
  318. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  319. commonfileList: null,
  320. queryParams: {
  321. pId: 0,
  322. pType: 'targetCompany'
  323. },
  324. //上传类型
  325. pType: 'targetCompany',
  326. pId: 0
  327. },
  328. pdf : {
  329. title: '',
  330. pdfUrl: '',
  331. numPages: null,
  332. open: false,
  333. pageNum: 1,
  334. pageTotalNum: 1,
  335. loadedRatio: 0,
  336. },
  337. // 部门树选项
  338. deptOptions: undefined,
  339. clientHeight:300,
  340. // 查询参数
  341. queryParams: {
  342. item: null,
  343. description: null,
  344. targets: null,
  345. year: null,
  346. },
  347. // 表单参数
  348. form: {},
  349. // 表单校验
  350. rules: {
  351. id: [
  352. { required: true, message: this.$t('唯一标识id') + this.$t('不能为空'), trigger: "blur" }
  353. ],
  354. plantCode: [
  355. { required: true, message: this.$t('装置名称') + this.$t('不能为空'), trigger: "change" }
  356. ],
  357. item: [
  358. { required: true, message: this.$t('序号') + this.$t('不能为空'), trigger: "blur" }
  359. ],
  360. deptId: [
  361. { required: true, message: this.$t('部门编号') +this.$t('不能为空'), trigger: "blur" }
  362. ],
  363. }
  364. };
  365. },
  366. watch: {
  367. // 根据名称筛选部门树
  368. deptName(val) {
  369. this.$refs.tree.filter(val);
  370. }
  371. },
  372. created() {
  373. this.getList();
  374. this.getDeptTreeselect();
  375. this.getDicts("PLANT_DIVIDE").then(response => {
  376. this.plantCodeOptions = response.data;
  377. });
  378. this.getDicts("PARTNERS").then(response => {
  379. this.partnersOptions = response.data;
  380. });
  381. },
  382. methods: {
  383. /** 查询目标录入列表 */
  384. getList() {
  385. this.loading = true;
  386. listTargetlist(this.queryParams).then(response => {
  387. this.targetlistList = this.handleTree(response.data, "id", "parentId");
  388. this.loading = false;
  389. });
  390. },
  391. /** 查询部门下拉树结构 */
  392. getDeptTreeselect() {
  393. treeselect().then(response => {
  394. this.deptOptions = response.data;
  395. });
  396. },
  397. /** 转换目标录入数据结构 */
  398. normalizer(node) {
  399. if (node.children && !node.children.length) {
  400. delete node.children;
  401. }
  402. return {
  403. id: node.id,
  404. label: node.year + "-" + node.item,
  405. children: node.children
  406. };
  407. },
  408. /** 查询部门下拉树结构 */
  409. getTreeselect() {
  410. listTargetlist().then(response => {
  411. this.targetlistOptions = [];
  412. const data = { id: 0, item: this.$t('顶级节点'), children: [], year: "" };
  413. data.children = this.handleTree(response.data, "id", "parentId");
  414. this.targetlistOptions.push(data);
  415. });
  416. },
  417. // 装置名称字典翻译
  418. plantCodeFormat(row, column) {
  419. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  420. },
  421. // 取消按钮
  422. cancel() {
  423. this.open = false;
  424. this.reset();
  425. },
  426. // 表单重置
  427. reset() {
  428. this.form = {
  429. id: null,
  430. plantCode: null,
  431. item: null,
  432. description: null,
  433. targets: null,
  434. year: null,
  435. yardstick: null,
  436. partners: null,
  437. delFlag: null,
  438. createrCode: null,
  439. createdate: null,
  440. updaterCode: null,
  441. updatedate: null,
  442. deptId: null,
  443. remarks: null,
  444. parentId: null
  445. };
  446. this.resetForm("form");
  447. },
  448. /** 搜索按钮操作 */
  449. handleQuery() {
  450. this.getList();
  451. },
  452. /** 重置按钮操作 */
  453. resetQuery() {
  454. this.resetForm("queryForm");
  455. this.handleQuery();
  456. },
  457. /** 新增按钮操作 */
  458. handleAdd() {
  459. this.reset();
  460. this.getTreeselect();
  461. this.open = true;
  462. this.title = this.$t('新增') + " " + this.$t('目标录入');
  463. },
  464. /** 条目新增按钮操作 */
  465. handleAddItem(row) {
  466. this.reset();
  467. this.getTreeselect();
  468. this.form.parentId = row.id
  469. this.open = true;
  470. this.title = this.$t('新增') + " " + this.$t('目标录入');
  471. },
  472. /** 修改按钮操作 */
  473. handleUpdate(row) {
  474. this.reset();
  475. this.getTreeselect();
  476. if (row != null) {
  477. this.form.parentId = row.id;
  478. }
  479. getTargetlist(row.id).then(response => {
  480. this.form = response.data;
  481. let partners = null;
  482. if (this.form.partners != null) {
  483. partners = this.form.partners.split(",");
  484. }
  485. this.form.partners = partners;
  486. this.open = true;
  487. this.title = this.$t('修改') + this.$t('目标录入');
  488. });
  489. },
  490. /** 提交按钮 */
  491. submitForm() {
  492. this.$refs["form"].validate(valid => {
  493. if (valid) {
  494. if (this.form.parentId !== 0) {
  495. var partner = null;
  496. this.form.partners.forEach(function (value,key,arr) {
  497. if (key != 0) {
  498. partner = partner + "," + value;
  499. }else if (key == 0) {
  500. partner = value;
  501. }
  502. })
  503. this.form.partners = partner;
  504. }
  505. if (this.form.id != null) {
  506. updateTargetlist(this.form).then(response => {
  507. this.msgSuccess(this.$t('修改成功'));
  508. this.open = false;
  509. this.getList();
  510. });
  511. } else {
  512. addTargetlist(this.form).then(response => {
  513. this.msgSuccess(this.$t('新增成功'));
  514. this.open = false;
  515. this.getList();
  516. });
  517. }
  518. }
  519. });
  520. },
  521. /** 删除按钮操作 */
  522. handleDelete(row) {
  523. this.$confirm(this.$t('是否确认删除目标录入编号为"') + row.id + this.$t('"的数据项?'), this.$t('警告'), {
  524. confirmButtonText: this.$t('确定'),
  525. cancelButtonText: this.$t('取消'),
  526. type: "warning"
  527. }).then(function() {
  528. return delTargetlist(row.id);
  529. }).then(() => {
  530. this.getList();
  531. this.msgSuccess(this.$t('删除成功'));
  532. })
  533. },
  534. /** 导出按钮操作 */
  535. handleExport() {
  536. const queryParams = this.queryParams;
  537. this.$confirm(this.$t('是否确认导出所有目标录入数据项?'), this.$t('警告'), {
  538. confirmButtonText: this.$t('确定'),
  539. cancelButtonText: this.$t('取消'),
  540. type: "warning"
  541. }).then(function() {
  542. return exportTargetlist(queryParams);
  543. }).then(response => {
  544. this.download(response.msg);
  545. })
  546. },
  547. /** 导入按钮操作 */
  548. handleImport() {
  549. this.upload.title = this.$t('用户导入');
  550. this.upload.open = true;
  551. },
  552. /** 公司目标按钮操作 */
  553. handleCompany() {
  554. this.target.title = this.$t('公司目标');
  555. this.target.pType = "company";
  556. this.target.queryParams.pType = "company";
  557. this.target.pId = "0";
  558. this.target.queryParams.pId = "0";
  559. this.target.open = true;
  560. this.getFileList()
  561. this.$nextTick(() => {
  562. this.$refs.target.clearFiles()
  563. })
  564. },
  565. /** 事业部目标按钮操作 */
  566. handleCB() {
  567. this.target.title = this.$t('事业部目标');
  568. this.target.pType = "cb";
  569. this.target.queryParams.pType = "cb";
  570. this.target.pId = "0";
  571. this.target.queryParams.pId = "0";
  572. this.target.open = true;
  573. this.getFileList()
  574. this.$nextTick(() => {
  575. this.$refs.target.clearFiles()
  576. })
  577. },
  578. getFileList (){
  579. allFileList(this.target.queryParams).then(response => {
  580. this.target.commonfileList = response;
  581. });
  582. },
  583. //附件上传中处理
  584. handleFileDocProgress(event, file, fileList) {
  585. this.target.file = file;
  586. this.target.isUploading = true;
  587. },
  588. //附件上传成功处理
  589. handleFileDocSuccess(response, file, fileList) {
  590. this.target.isUploading = false;
  591. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  592. this.getFileList()
  593. },
  594. /** 删除按钮操作 */
  595. handleDeleteDoc(row) {
  596. const ids = row.id || this.ids;
  597. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  598. confirmButtonText: this.$t('确定'),
  599. cancelButtonText: this.$t('取消'),
  600. type: "warning"
  601. }).then(function() {
  602. return delCommonfile(ids);
  603. }).then(() => {
  604. this.getList()
  605. this.msgSuccess(this.$t('删除成功'));
  606. })
  607. },
  608. /** 下载模板操作 */
  609. importTemplate() {
  610. this.$refs['downloadFileForm'].submit()
  611. },
  612. // 文件上传中处理
  613. handleFileUploadProgress(event, file, fileList) {
  614. this.upload.isUploading = true;
  615. },
  616. // 文件上传成功处理
  617. handleFileSuccess(response, file, fileList) {
  618. this.upload.open = false;
  619. this.upload.isUploading = false;
  620. this.$refs.upload.clearFiles();
  621. if (response.data[0] != null) {
  622. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  623. }else {
  624. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  625. }
  626. this.getList();
  627. },
  628. // 提交上传文件
  629. submitFileForm() {
  630. this.$refs.upload.submit();
  631. },
  632. // 文件下载处理
  633. handleDownload(row) {
  634. var name = row.fileName;
  635. var url = row.fileUrl;
  636. var suffix = url.substring(url.lastIndexOf("."), url.length);
  637. const a = document.createElement('a')
  638. a.setAttribute('download', name)
  639. a.setAttribute('target', '_blank')
  640. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  641. a.click()
  642. },
  643. openPdf(){
  644. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  645. },
  646. handleSee (row){
  647. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  648. this.pdf.open =true
  649. this.pdf.title = row.fileName
  650. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  651. }
  652. }
  653. };
  654. </script>