index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--目录数据-->
  5. <el-col :span="5" :xs="24">
  6. <div class="head-container">
  7. <el-input
  8. v-model="menuName"
  9. :placeholder="$t('请输入目录名称')"
  10. clearable
  11. size="small"
  12. prefix-icon="el-icon-search"
  13. style="margin-bottom: 20px"
  14. />
  15. </div>
  16. <div class="head-container">
  17. <el-table
  18. ref="menuTable"
  19. v-loading="loading"
  20. :data="menuOptions"
  21. style="margin-bottom: 20px"
  22. border
  23. class="menuTable"
  24. :show-header="status"
  25. @row-click="handleNodeClick"
  26. :height="menuHeight">
  27. <el-table-column align="center" prop="serialNum" width="50" :show-overflow-tooltip="true"/>
  28. <el-table-column align="center" prop="nameCn"/>
  29. </el-table>
  30. </div>
  31. </el-col>
  32. <!--RC审计数据-->
  33. <el-col :span="19" :xs="24">
  34. <el-row :gutter="10" class="mb8">
  35. <el-col :span="1.5">
  36. <el-button
  37. type="success"
  38. icon="el-icon-edit"
  39. size="mini"
  40. @click="menuUpdate"
  41. v-hasPermi="['document:publicdoc:edit']"
  42. >{{ $t('左侧目录修改') }}</el-button>
  43. </el-col>
  44. <el-col :span="1.5">
  45. <el-button
  46. type="primary"
  47. icon="el-icon-plus"
  48. size="mini"
  49. @click="handleAdd"
  50. v-hasPermi="['ehs:rcaudit:add']"
  51. >{{ $t('新增') }}</el-button>
  52. </el-col>
  53. <el-col :span="1.5">
  54. <el-button
  55. type="danger"
  56. icon="el-icon-delete"
  57. size="mini"
  58. :disabled="multiple"
  59. @click="handleDelete"
  60. v-hasPermi="['ehs:rcaudit:remove']"
  61. >{{ $t('删除') }}</el-button>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-button
  65. type="info"
  66. icon="el-icon-upload2"
  67. size="mini"
  68. @click="handleImport"
  69. v-hasPermi="['ehs:rcaudit:edit']"
  70. >{{ $t('导入') }}</el-button>
  71. </el-col>
  72. <el-col :span="1.5">
  73. <el-button
  74. type="warning"
  75. icon="el-icon-download"
  76. size="mini"
  77. @click="handleExport"
  78. v-hasPermi="['ehs:rcaudit:export']"
  79. >{{ $t('导出') }}</el-button>
  80. </el-col>
  81. <el-col :span="1.5">
  82. <el-button
  83. type="primary"
  84. icon="el-icon-s-data"
  85. size="mini"
  86. @click="handleData"
  87. >{{ $t('数据分析') }}</el-button>
  88. </el-col>
  89. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  90. </el-row>
  91. <el-table v-loading="loading" :data="rcauditList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  92. <el-table-column type="selection" width="55" align="center" />
  93. <el-table-column :label="$t('目录')" align="center" width="100" prop="menuName" />
  94. <el-table-column :label="$t('序号')" align="center" width="50" prop="rcCode" :show-overflow-tooltip="true"/>
  95. <el-table-column :label="$t('名称')" align="center" width="400" prop="nameCn"/>
  96. <el-table-column label="YES" align="center" prop="yes" :formatter="yesFormat" />
  97. <el-table-column label="NO" align="center" prop="no" :formatter="noFormat" />
  98. <el-table-column label="NA" align="center" prop="na" :formatter="naFormat"/>
  99. <el-table-column :label="$t('链接')" align="center" prop="link">
  100. <template slot-scope="scope">
  101. <a :href="scope.row.link" v-if="scope.row.link !== null">
  102. <svg-icon icon-class="roundGreen"></svg-icon>
  103. </a>
  104. <svg-icon icon-class="roundRed" v-if="scope.row.link === null"></svg-icon>
  105. </template>
  106. </el-table-column>
  107. <el-table-column :label="$t('操作')" align="center" fixed="right" width="190" class-name="small-padding fixed-width">
  108. <template slot-scope="scope">
  109. <el-button
  110. size="mini"
  111. type="text"
  112. icon="el-icon-edit"
  113. @click="handleUpdate(scope.row)"
  114. v-hasPermi="['ehs:rcaudit:edit']"
  115. >{{ $t('修改') }}</el-button>
  116. <el-button
  117. size="mini"
  118. type="text"
  119. icon="el-icon-delete"
  120. @click="handleDelete(scope.row)"
  121. v-hasPermi="['ehs:rcaudit:remove']"
  122. >{{ $t('删除') }}</el-button>
  123. <el-button
  124. size="mini"
  125. type="text"
  126. icon="el-icon-document"
  127. @click="handleDoc(scope.row)"
  128. v-hasPermi="['ehs:rcaudit:edit']"
  129. >{{ $t('附件') }}
  130. <span v-if="scope.row.fileNum !== 0">({{ scope.row.fileNum }})</span></el-button>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. <pagination
  135. v-show="total>0"
  136. :total="total"
  137. :page.sync="queryParams.pageNum"
  138. :limit.sync="queryParams.pageSize"
  139. @pagination="getList"
  140. />
  141. <!-- 添加或修改RC审计助手对话框 -->
  142. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
  143. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  144. <el-form-item :label="$t('装置名称')" prop="plantCode">
  145. <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
  146. <el-option
  147. v-for="dict in plantCodeOptions"
  148. :key="dict.dictValue"
  149. :label="dict.dictLabel"
  150. :value="dict.dictValue"
  151. ></el-option>
  152. </el-select>
  153. </el-form-item>
  154. <el-form-item :label="$t('序号')" prop="rcCode">
  155. <el-input v-model="form.rcCode" :placeholder="$t('请输入') + $t('序号')" />
  156. </el-form-item>
  157. <el-form-item :label="$t('目录')" prop="menuName">
  158. <el-select v-model="form.menuid" filterable :placeholder="$t('请选择') + $t('目录')">
  159. <el-option
  160. v-for="dict in menuOptions"
  161. :key="dict.serialNum"
  162. :label="dict.nameCn"
  163. :value="dict.serialNum">
  164. <span style="float: left">{{ dict.nameCn }}</span>
  165. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.serialNum }}</span>
  166. </el-option>
  167. </el-select>
  168. </el-form-item>
  169. <el-form-item :label="$t('名称')" prop="nameCn">
  170. <el-input v-model="form.nameCn" type="textarea" autosize :placeholder="$t('请输入') + $t('名称')" />
  171. </el-form-item>
  172. <el-form-item :label="$t('英文名称')" prop="nameEn">
  173. <el-input v-model="form.nameEn" :placeholder="$t('请输入') + $t('英文名称')" />
  174. </el-form-item>
  175. <el-form-item label="YES/NO/NA" prop="yesnona">
  176. <el-select v-model="yesnonaChoose" :placeholder="$t('请选择') + 'YES/NO/NA'" @change="yesnona($event)">
  177. <el-option
  178. v-for="item in yesnonaOptions"
  179. :key="item.value"
  180. :label="item.label"
  181. :value="item.value">
  182. </el-option>
  183. </el-select>
  184. </el-form-item>
  185. <el-form-item :label="$t('链接')" prop="link">
  186. <el-input v-model="form.link" :placeholder="$t('请输入') + $t('链接')" />
  187. </el-form-item>
  188. <el-form-item :label="$t('备注')" prop="remarks">
  189. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  190. </el-form-item>
  191. <el-form-item :label="$t('归属部门')" prop="deptId">
  192. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  193. </el-form-item>
  194. </el-form>
  195. <div slot="footer" class="dialog-footer">
  196. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  197. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  198. </div>
  199. </el-dialog>
  200. <!-- 用户导入对话框 -->
  201. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  202. <el-upload
  203. ref="upload"
  204. :limit="1"
  205. accept=".xlsx, .xls"
  206. :headers="upload.headers"
  207. :action="upload.url"
  208. :disabled="upload.isUploading"
  209. :on-progress="handleFileUploadProgress"
  210. :on-success="handleFileSuccess"
  211. :auto-upload="false"
  212. drag
  213. >
  214. <i class="el-icon-upload"></i>
  215. <div class="el-upload__text">
  216. {{ $t('将文件拖到此处,或') }}
  217. <em>{{ $t('点击上传') }}</em>
  218. </div>
  219. <div class="el-upload__tip" slot="tip">
  220. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  221. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  222. </div>
  223. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  224. <input name="type" :value="upload.type" hidden />
  225. </form>
  226. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  227. </el-upload>
  228. <div slot="footer" class="dialog-footer">
  229. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  230. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  231. </div>
  232. </el-dialog>
  233. <!-- 报告附件对话框 -->
  234. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
  235. <el-upload
  236. ref="doc"
  237. :limit="50"
  238. :headers="doc.headers"
  239. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  240. :disabled="doc.isUploading"
  241. :on-progress="handleFileDocProgress"
  242. :on-success="handleFileDocSuccess"
  243. :auto-upload="true"
  244. drag
  245. >
  246. <i class="el-icon-upload"></i>
  247. <div class="el-upload__text">
  248. {{ $t('将文件拖到此处,或') }}
  249. <em>{{ $t('点击上传') }}</em>
  250. </div>
  251. </el-upload>
  252. <el-table :data="doc.commonfileList" border>
  253. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  254. <template slot-scope="scope">
  255. <a class="link-type" @click="handleDownload(scope.row)">
  256. <span>{{ scope.row.fileName }}</span>
  257. </a>
  258. </template>
  259. </el-table-column>
  260. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  261. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  262. <el-table-column :label="$t('操作')" align="center" width="150" class-name="small-padding fixed-width">
  263. <template slot-scope="scope">
  264. <el-button
  265. v-if="scope.row.fileName.endsWith('pdf')"
  266. size="mini"
  267. type="text"
  268. icon="el-icon-view"
  269. @click="handleSee(scope.row)"
  270. >{{ $t('预览') }}</el-button>
  271. <el-button
  272. size="mini"
  273. type="text"
  274. icon="el-icon-download"
  275. @click="handleDownload(scope.row)"
  276. >{{ $t('下载') }}</el-button>
  277. <el-button
  278. size="mini"
  279. type="text"
  280. icon="el-icon-delete"
  281. @click="handleDeleteDoc(scope.row)"
  282. >{{ $t('删除') }}</el-button>
  283. </template>
  284. </el-table-column>
  285. </el-table>
  286. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1700px" append-to-body>
  287. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  288. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  289. <div style="margin-top: -30px">
  290. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  291. </div>
  292. </el-dialog>
  293. <div slot="footer" class="dialog-footer">
  294. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  295. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  296. </div>
  297. </el-dialog>
  298. </el-col>
  299. </el-row>
  300. <el-drawer
  301. :title="$t('数据分析')"
  302. size="600px"
  303. :visible.sync="drawer"
  304. :direction="direction">
  305. <el-row>
  306. <el-col>
  307. <el-card class="box-card" shadow="hover">
  308. <div slot="header" class="clearfix">
  309. <span>YES/NA/NO统计</span>
  310. </div>
  311. <div class="text item">
  312. <na-data></na-data>
  313. </div>
  314. </el-card>
  315. </el-col>
  316. </el-row>
  317. </el-drawer>
  318. </div>
  319. </template>
  320. <script>
  321. import { listRcaudit, getRcaudit, delRcaudit, addRcaudit, updateRcaudit, exportRcaudit, addFile, reduceFile } from "@/api/ehs/rcaudit";
  322. import { treeselect } from "@/api/system/dept";
  323. import { getToken } from "@/utils/auth";
  324. import Treeselect from "@riophae/vue-treeselect";
  325. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  326. import {listMenu} from "../../../api/ehs/rcauditmenu";
  327. import { allFileList, delCommonfile } from "@/api/common/commonfile";
  328. import NaData from "./naData";
  329. import pdf from "vue-pdf";
  330. export default {
  331. name: "Rcaudit",
  332. components: { Treeselect,NaData ,pdf },
  333. data() {
  334. return {
  335. drawer: false,
  336. direction: 'rtl',
  337. // 遮罩层
  338. loading: true,
  339. // 选中数组
  340. ids: [],
  341. // 非单个禁用
  342. single: true,
  343. // 非多个禁用
  344. multiple: true,
  345. // 显示搜索条件
  346. showSearch: false,
  347. // 总条数
  348. total: 0,
  349. // RC审计助手表格数据
  350. rcauditList: [],
  351. // 弹出层标题
  352. title: "",
  353. //表头是否显示
  354. status: false,
  355. // 目录名称
  356. menuName: undefined,
  357. // 部门树选项
  358. deptOptions: undefined,
  359. //目录菜单
  360. menuOptions: undefined,
  361. clientHeight:300,
  362. menuHeight: 300,
  363. // 是否显示弹出层
  364. open: false,
  365. // 装置名称字典
  366. plantCodeOptions: [],
  367. // YES字典
  368. yesOptions: [],
  369. // NO字典
  370. noOptions: [],
  371. // NA字典
  372. naOptions: [],
  373. // 用户导入参数
  374. upload: {
  375. //下载模板请求地址
  376. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  377. //下载模板类型
  378. type: "rcaudit",
  379. // 是否显示弹出层(用户导入)
  380. open: false,
  381. // 弹出层标题(用户导入)
  382. title: "",
  383. // 是否禁用上传
  384. isUploading: false,
  385. // 是否更新已经存在的用户数据
  386. updateSupport: 0,
  387. // 设置上传的请求头部
  388. headers: { Authorization: "Bearer " + getToken() },
  389. // 上传的地址
  390. url: process.env.VUE_APP_BASE_API + "/ehs/rcaudit/importData"
  391. },
  392. // 报告附件参数
  393. doc: {
  394. file: "",
  395. // 是否显示弹出层(报告附件)
  396. open: false,
  397. // 弹出层标题(报告附件)
  398. title: "",
  399. // 是否禁用上传
  400. isUploading: false,
  401. // 是否更新已经存在的用户数据
  402. updateSupport: 0,
  403. // 报告附件上传位置编号
  404. ids: 0,
  405. // 设置上传的请求头部
  406. headers: { Authorization: "Bearer " + getToken() },
  407. // 上传的地址
  408. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  409. commonfileList: null,
  410. queryParams: {
  411. pId: null,
  412. pType: 'rcaudit'
  413. },
  414. pType: 'rcaudit',
  415. pId: null
  416. },
  417. pdf : {
  418. title: '',
  419. pdfUrl: '',
  420. numPages: null,
  421. open: false,
  422. pageNum: 1,
  423. pageTotalNum: 1,
  424. loadedRatio: 0,
  425. },
  426. // 查询参数
  427. queryParams: {
  428. pageNum: 1,
  429. pageSize: 20,
  430. menuid: null,
  431. },
  432. //查询目录参数
  433. menuQueryParams: {
  434. parentId: null,
  435. nameCn: null
  436. },
  437. //YES/NO/NA
  438. yesnonaOptions: [{
  439. value: '1',
  440. label: 'YES'
  441. }, {
  442. value: '2',
  443. label: 'NO'
  444. }, {
  445. value: '3',
  446. label: 'NA'
  447. }],
  448. yesnonaChoose: '',
  449. // 表单参数
  450. form: {},
  451. // 表单校验
  452. rules: {
  453. plantCode: [
  454. { required: true, message: this.$t('装置名称') + this.$t('不能为空'), trigger: "change" }
  455. ],
  456. rcCode: [
  457. { required: true, message: this.$t('序号') + this.$t('不能为空'), trigger: "blur" }
  458. ],
  459. menuid: [
  460. { required: true, message: this.$t('目录') + "ID" + this.$t('不能为空'), trigger: "blur" }
  461. ],
  462. nameCn: [
  463. { required: true, message: this.$t('名称') + this.$t('不能为空'), trigger: "blur" }
  464. ],
  465. deptId: [
  466. { required: true, message: this.$t('部门编号') + this.$t('不能为空'), trigger: "blur" }
  467. ]
  468. }
  469. };
  470. },
  471. watch: {
  472. // 根据名称筛选部门树
  473. deptName(val) {
  474. this.$refs.tree.filter(val);
  475. },
  476. menuName(val) {
  477. this.menuQueryParams.nameCn = val
  478. this.getMenuList();
  479. }
  480. },
  481. activated() {
  482. this.$nextTick(()=> {
  483. setTimeout(() => {
  484. const scrollTop = this.$route.meta.scrollTop;
  485. console.log('++++++++' + scrollTop)
  486. this.$refs.menuTable.bodyWrapper.scrollTop = scrollTop
  487. console.log('------' + this.$refs.menuTable.bodyWrapper.scrollTop)
  488. }, 13)
  489. })
  490. },
  491. created() {
  492. //设置表格高度对应屏幕高度
  493. this.$nextTick(() => {
  494. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  495. this.menuHeight = document.body.clientHeight -200
  496. })
  497. this.getList();
  498. this.getTreeselect();
  499. this.getMenuList();
  500. this.getDicts("PLANT_DIVIDE").then(response => {
  501. this.plantCodeOptions = response.data;
  502. });
  503. this.getDicts("TICK_CROSS").then(response => {
  504. this.yesOptions = response.data;
  505. });
  506. this.getDicts("TICK_CROSS").then(response => {
  507. this.noOptions = response.data;
  508. });
  509. this.getDicts("TICK_CROSS").then(response => {
  510. this.naOptions = response.data;
  511. });
  512. },
  513. methods: {
  514. linkfile (){
  515. window.open('file:///D:\\cpmsfile\\')
  516. },
  517. /** 查询RC审计助手列表 */
  518. getList() {
  519. this.loading = true;
  520. listRcaudit(this.queryParams).then(response => {
  521. this.rcauditList = response.rows;
  522. this.total = response.total;
  523. this.loading = false;
  524. });
  525. },
  526. /** 查询部门下拉树结构 */
  527. getTreeselect() {
  528. treeselect().then(response => {
  529. this.deptOptions = response.data;
  530. });
  531. },
  532. /** 查询目录菜单 */
  533. getMenuList() {
  534. listMenu(this.menuQueryParams).then(response => {
  535. this.menuOptions = response;
  536. });
  537. },
  538. // 装置名称字典翻译
  539. plantCodeFormat(row, column) {
  540. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  541. },
  542. // YES字典翻译
  543. yesFormat(row, column) {
  544. return this.selectDictLabel(this.yesOptions, row.yes);
  545. },
  546. // NO字典翻译
  547. noFormat(row, column) {
  548. return this.selectDictLabel(this.noOptions, row.no);
  549. },
  550. // NA字典翻译
  551. naFormat(row, column) {
  552. return this.selectDictLabel(this.naOptions, row.na);
  553. },
  554. // 取消按钮
  555. cancel() {
  556. this.open = false;
  557. this.reset();
  558. },
  559. // 表单重置
  560. reset() {
  561. this.form = {
  562. id: null,
  563. plantCode: null,
  564. rcCode: null,
  565. menuid: null,
  566. nameCn: null,
  567. nameEn: null,
  568. yes: null,
  569. no: null,
  570. na: null,
  571. link: null,
  572. delFlag: null,
  573. createrCode: null,
  574. createdate: null,
  575. updaterCode: null,
  576. updatedate: null,
  577. remarks: null,
  578. deptId: null,
  579. fileNum: null
  580. };
  581. this.resetForm("form");
  582. },
  583. /** 搜索按钮操作 */
  584. handleQuery() {
  585. this.queryParams.pageNum = 1;
  586. this.getList();
  587. },
  588. // 节点单击事件
  589. handleNodeClick(data) {
  590. this.queryParams.menuid = data.serialNum;
  591. this.getList();
  592. },
  593. /** 重置按钮操作 */
  594. resetQuery() {
  595. this.resetForm("queryForm");
  596. this.handleQuery();
  597. },
  598. // 多选框选中数据
  599. handleSelectionChange(selection) {
  600. this.ids = selection.map(item => item.id)
  601. this.single = selection.length!==1
  602. this.multiple = !selection.length
  603. },
  604. //YES/NO/NA
  605. yesnona(val) {
  606. if (val == 1) {
  607. this.form.yes = 10,
  608. this.form.no = null,
  609. this.form.na = null
  610. }else if (val == 2) {
  611. this.form.yes = null,
  612. this.form.no = 10,
  613. this.form.na = null
  614. }else if (val == 3) {
  615. this.form.yes = null,
  616. this.form.no = null,
  617. this.form.na = 10
  618. }
  619. },
  620. /** 新增按钮操作 */
  621. handleAdd() {
  622. this.reset();
  623. this.open = true;
  624. this.title = this.$t('新增') + " " + this.$t('RC审计助手');
  625. },
  626. /** 修改按钮操作 */
  627. handleUpdate(row) {
  628. this.reset();
  629. const id = row.id || this.ids
  630. if (row.yes == 10) {
  631. this.yesnonaChoose = "YES"
  632. }else if (row.no == 10) {
  633. this.yesnonaChoose = "NO"
  634. }else if (row.na == 10) {
  635. this.yesnonaChoose = "NA"
  636. }else {
  637. this.yesnonaChoose = null
  638. }
  639. getRcaudit(id).then(response => {
  640. this.form = response.data;
  641. this.open = true;
  642. this.title = this.$t('修改') + this.$t('RC审计助手');
  643. });
  644. },
  645. /** 修改左侧目录操作 */
  646. menuUpdate() {
  647. this.$router.push("/ehs/rcauditmenu");
  648. },
  649. /** 提交按钮 */
  650. submitForm() {
  651. this.$refs["form"].validate(valid => {
  652. if (valid) {
  653. if (this.form.id != null) {
  654. updateRcaudit(this.form).then(response => {
  655. this.msgSuccess(this.$t('修改成功'));
  656. this.open = false;
  657. this.getList();
  658. });
  659. } else {
  660. addRcaudit(this.form).then(response => {
  661. this.msgSuccess(this.$t('新增成功'));
  662. this.open = false;
  663. this.getList();
  664. });
  665. }
  666. }
  667. });
  668. },
  669. /** 删除按钮操作 */
  670. handleDelete(row) {
  671. const ids = row.id || this.ids;
  672. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  673. confirmButtonText: this.$t('确定'),
  674. cancelButtonText: this.$t('取消'),
  675. type: "warning"
  676. }).then(function() {
  677. return delRcaudit(ids);
  678. }).then(() => {
  679. this.getList();
  680. this.msgSuccess(this.$t('删除成功'));
  681. })
  682. },
  683. /** 导出按钮操作 */
  684. handleExport() {
  685. const queryParams = this.queryParams;
  686. this.$confirm(this.$t('是否确认导出所有RC审计助手数据项?'), this.$t('警告'), {
  687. confirmButtonText: this.$t('确定'),
  688. cancelButtonText: this.$t('取消'),
  689. type: "warning"
  690. }).then(function() {
  691. return exportRcaudit(queryParams);
  692. }).then(response => {
  693. this.download(response.msg);
  694. })
  695. },
  696. /** 导入按钮操作 */
  697. handleImport() {
  698. this.upload.title = this.$t('用户导入');
  699. this.upload.open = true;
  700. },
  701. /** 下载模板操作 */
  702. importTemplate() {
  703. this.$refs['downloadFileForm'].submit()
  704. },
  705. // 文件上传中处理
  706. handleFileUploadProgress(event, file, fileList) {
  707. this.upload.isUploading = true;
  708. },
  709. // 文件上传成功处理
  710. handleFileSuccess(response, file, fileList) {
  711. this.upload.open = false;
  712. this.upload.isUploading = false;
  713. this.$refs.upload.clearFiles();
  714. if (response.data[0] != null) {
  715. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  716. }else {
  717. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  718. }
  719. this.getList();
  720. },
  721. // 提交上传文件
  722. submitFileForm() {
  723. this.$refs.upload.submit();
  724. },
  725. /** 报告附件按钮操作 */
  726. handleDoc(row) {
  727. this.doc.id = row.id;
  728. this.doc.title = row.filename;
  729. this.doc.open = true;
  730. this.doc.queryParams.pId = row.id
  731. this.doc.pId = row.id
  732. this.getFileList()
  733. this.$nextTick(() => {
  734. this.$refs.doc.clearFiles()
  735. })
  736. },
  737. getFileList (){
  738. allFileList(this.doc.queryParams).then(response => {
  739. this.doc.commonfileList = response;
  740. });
  741. },
  742. //附件上传中处理
  743. handleFileDocProgress(event, file, fileList) {
  744. this.doc.file = file;
  745. this.doc.isUploading = true;
  746. },
  747. //附件上传成功处理
  748. handleFileDocSuccess(response, file, fileList) {
  749. this.doc.isUploading = false;
  750. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  751. this.form.id = this.doc.pId;
  752. addFile(this.form)
  753. this.getFileList()
  754. },
  755. /** 删除按钮操作 */
  756. handleDeleteDoc(row) {
  757. const ids = row.id || this.ids;
  758. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  759. confirmButtonText: this.$t('确定'),
  760. cancelButtonText: this.$t('取消'),
  761. type: "warning"
  762. }).then(function() {
  763. return delCommonfile(ids);
  764. }).then(() => {
  765. this.getFileList()
  766. this.msgSuccess(this.$t('删除成功'));
  767. this.form.id = this.doc.pId;
  768. reduceFile(this.form);
  769. })
  770. },
  771. // 文件下载处理
  772. handleDownload(row) {
  773. var name = row.fileName;
  774. var url = row.fileUrl;
  775. var suffix = url.substring(url.lastIndexOf("."), url.length);
  776. const a = document.createElement('a')
  777. a.setAttribute('download', name)
  778. a.setAttribute('target', '_blank')
  779. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  780. a.click()
  781. },
  782. //链接下载文件处理
  783. linkDownload(row) {
  784. try{
  785. var obj=new ActiveXObject("wscript.shell");
  786. if(obj){
  787. obj.Run("file:///D:\\workFile\\SSY-CPMS\\MeetingSummary\\others\\20210325.docx");
  788. //obj.run("osk");/*打开屏幕键盘*/
  789. //obj.Run('"'+filename+'"');
  790. obj=null;
  791. }
  792. }catch(e){
  793. alert(this.$t('请确定是否存在该盘符或文件'));
  794. }
  795. },
  796. //数据分析
  797. handleData(){
  798. this.drawer = true
  799. },
  800. //pdf预览
  801. openPdf(){
  802. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  803. },
  804. handleSee (row){
  805. this.pdf.open =true
  806. this.pdf.pageNum = 1
  807. this.pdf.loadedRatio = 0
  808. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + row.fileUrl
  809. this.pdf.title = row.fileName
  810. let loadingTask = null
  811. loadingTask = pdf.createLoadingTask(this.pdf.pdfUrl)
  812. loadingTask.promise.then(pdf => {
  813. this.pdf.numPages = pdf.numPages
  814. }).catch(err => {
  815. this.msgError(this.$t('pdf加载失败'))
  816. })
  817. },
  818. // pdf上一页
  819. prePage() {
  820. let page = this.pdf.pageNum
  821. page = page > 1 ? page - 1 : this.pdf.pageTotalNum
  822. this.pdf.pageNum = page
  823. },
  824. // pdf下一页
  825. nextPage() {
  826. let page = this.pdf.pageNum
  827. page = page < this.pdf.pageTotalNum ? page + 1 : 1
  828. this.pdf.pageNum = page
  829. },
  830. }
  831. };
  832. </script>
  833. <style>
  834. #tradeLeft{
  835. width: 23%;
  836. padding: 20px;
  837. }
  838. /*chrome滚动条颜色设置*/
  839. *::-webkit-scrollbar {width:7px; height:10px; background-color:transparent;} /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
  840. *::-webkit-scrollbar-track {background-color:#f0f6ff; } /*定义滚动条轨道 内阴影+圆角*/
  841. *::-webkit-scrollbar-thumb {background-color:#d6d6d6; border-radius:6px;} /*定义滑块 内阴影+圆角*/
  842. .scrollbarHide::-webkit-scrollbar{display: none}
  843. .scrollbarShow::-webkit-scrollbar{display: block}
  844. .menuTable {
  845. cursor: pointer; /*鼠标悬停变小手*/
  846. }
  847. .text {
  848. font-size: 14px;
  849. }
  850. .item {
  851. margin-bottom: 18px;
  852. }
  853. .clearfix {
  854. color: #1e1e1e;
  855. }
  856. .clearfix:before,
  857. .clearfix:after {
  858. display: table;
  859. content: "";
  860. }
  861. .clearfix:after {
  862. clear: both
  863. }
  864. .box-card {
  865. width: 100%;
  866. }
  867. .el-drawer__body {
  868. overflow: auto;
  869. }
  870. .el-drawer__container ::-webkit-scrollbar {
  871. display: none;
  872. }
  873. .el-table .cell {
  874. white-space: pre-line;
  875. }
  876. </style>