index.vue 23 KB

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