index.vue 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. <template>
  2. <div class="app-container-list">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item :label="$t('文件名称')" prop="filename">
  5. <el-input
  6. v-model="queryParams.filename"
  7. :placeholder="$t('请输入') + $t('文件名称')"
  8. clearable
  9. size="small"
  10. @input="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item :label="$t('更新负责人')" prop="filename">
  14. <el-input
  15. v-model="queryParams.responsibility"
  16. :placeholder="$t('请输入') + $t('更新负责人')"
  17. clearable
  18. size="small"
  19. @input="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button
  30. type="primary"
  31. icon="el-icon-plus"
  32. size="mini"
  33. @click="handleAdd"
  34. v-hasPermi="['document:plantproglist:add']"
  35. >{{ $t('新增') }}
  36. </el-button>
  37. </el-col>
  38. <el-col :span="1.5">
  39. <el-button
  40. type="success"
  41. icon="el-icon-edit"
  42. size="mini"
  43. :disabled="single"
  44. @click="handleUpdate"
  45. v-hasPermi="['document:plantproglist:edit']"
  46. >{{ $t('修改') }}
  47. </el-button>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-button
  51. type="danger"
  52. icon="el-icon-delete"
  53. size="mini"
  54. :disabled="multiple"
  55. @click="handleDelete"
  56. v-hasPermi="['document:plantproglist:remove']"
  57. >{{ $t('删除') }}
  58. </el-button>
  59. </el-col>
  60. <el-col :span="1.5">
  61. <el-button
  62. type="info"
  63. icon="el-icon-upload2"
  64. size="mini"
  65. @click="handleImport"
  66. v-hasPermi="['document:plantproglist:edit']"
  67. >{{ $t('导入') }}
  68. </el-button>
  69. </el-col>
  70. <!-- <el-col :span="1.5">-->
  71. <!-- <el-button-->
  72. <!-- type="warning"-->
  73. <!-- icon="el-icon-download"-->
  74. <!-- size="mini"-->
  75. <!-- @click="handleExport"-->
  76. <!-- v-hasPermi="['document:plantproglist:export']"-->
  77. <!-- >{{ $t('导出') }}</el-button>-->
  78. <!-- </el-col>-->
  79. <el-col :span="1.5">
  80. <el-button
  81. type="warning"
  82. icon="el-icon-download"
  83. size="mini"
  84. @click="handleExport"
  85. v-hasPermi="['document:plantproglist:export']"
  86. >{{ $t('导出') }}
  87. </el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button
  91. type="primary"
  92. icon="el-icon-s-data"
  93. size="mini"
  94. @click="handleData"
  95. >{{ $t('数据分析') }}
  96. </el-button>
  97. </el-col>
  98. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  99. </el-row>
  100. <form ref="downloadExportForm" :action="downloadExportAction" target="FORMSUBMIT">
  101. </form>
  102. <el-table v-loading="loading" class="table" :data="plantproglistList" @selection-change="handleSelectionChange"
  103. @sort-change="sortList"
  104. :cell-class-name="tableCellClassName" :height="clientHeight" border>
  105. <el-table-column type="selection" width="55" align="center"/>
  106. <el-table-column :label="$t('文件编号')" align="center" prop="fileno" width="150" :show-overflow-tooltip="true"/>
  107. <el-table-column :label="$t('文件名称')" align="center" width="220" prop="filename" :show-overflow-tooltip="true"/>
  108. <el-table-column :label="$t('版次')" align="center" prop="revision" :show-overflow-tooltip="true"/>
  109. <el-table-column :label="$t('RC代码')" align="center" prop="rccode" :show-overflow-tooltip="true"/>
  110. <el-table-column :label="$t('更新负责人')" align="center" prop="responsibility" :show-overflow-tooltip="true"/>
  111. <el-table-column :label="$t('修订日期')" align="center" prop="filedate" width="100">
  112. <template slot-scope="scope">
  113. <span>{{ parseTime(scope.row.filedate, '{y}-{m}-{d}') }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column :label="$t('下次修订日期')" align="center" sortable="custom" prop="nexteditdate" width="100">
  117. <template slot-scope="scope">
  118. <span v-if="scope.row.nexteditdate == null">按需</span>
  119. <span style="vertical-align:middle">{{ parseTime(scope.row.nexteditdate, '{y}-{m}-{d}') }}</span>
  120. <svg-icon :icon-class="changeColorPiont(scope.row.nexteditdate)"
  121. style="font-size: 8px"></svg-icon>
  122. </template>
  123. </el-table-column>
  124. <el-table-column :label="$t('回顾频率')" align="center" prop="reviewFrequency" :show-overflow-tooltip="true"
  125. v-if="this.itemNum !== '5'"/>
  126. <el-table-column :label="$t('回顾日期')" align="center" prop="reviewdate" width="100" v-if="this.itemNum !== '5'">
  127. <template slot-scope="scope">
  128. <span v-if="scope.row.reviewdate == null">NA</span>
  129. <span>{{ parseTime(scope.row.reviewdate, '{y}-{m}-{d}') }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column :label="$t('回顾结果')" align="center" prop="reviewResult" width="150" :show-overflow-tooltip="true"
  133. v-if="this.itemNum !== '5'"/>
  134. <el-table-column :label="$t('下次回顾日期')" align="center" sortable="custom" prop="nextreviewdate" width="100"
  135. >
  136. <template slot-scope="scope">
  137. <span style="vertical-align:middle">{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
  138. <svg-icon :icon-class="changeColorPiont(scope.row.nextreviewdate)"
  139. style="font-size: 8px"></svg-icon>
  140. </template>
  141. </el-table-column>
  142. <el-table-column :label="$t('密级分类')" align="center" prop="classify" width="100" v-if="this.itemNum !== '5'"
  143. :formatter="classifyFormat"/>
  144. <el-table-column :label="$t('文件更新状态(控制室)')" align="center" v-if="homeType==6">
  145. <template slot-scope="scope">
  146. <span v-if="scope.row.revision == scope.row.versionKzs"></span>
  147. <span v-else style="color: #ff6d6d">{{ $t('未更新') }}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column :label="$t('文件更新状态(公共盘)')" align="center" v-if="this.itemNum !== '5'">
  151. <template slot-scope="scope">
  152. <span v-if="scope.row.revision == scope.row.versionPan">{{ $t('已更新') }}</span>
  153. <span v-else style="color: #ff6d6d">{{ $t('未更新') }}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column :label="$t('附件编号')" align="center" prop="attachmentNo" v-if="this.itemNum === '5'"
  157. :show-overflow-tooltip="true"/>
  158. <el-table-column :label="$t('附件名称')" align="center" prop="attachmentName" v-if="this.itemNum === '5'"
  159. :show-overflow-tooltip="true"/>
  160. <el-table-column :label="$t('附件版次')" align="center" prop="attachmentRevision" v-if="this.itemNum === '5'"
  161. :show-overflow-tooltip="true"/>
  162. <el-table-column :label="$t('附件修改日期')" align="center" prop="revisionDate" v-if="this.itemNum === '5'" width="100">
  163. <template slot-scope="scope">
  164. <span>{{ parseTime(scope.row.revisionDate, '{y}-{m}-{d}') }}</span>
  165. </template>
  166. </el-table-column>
  167. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  168. <el-table-column :label="$t('操作')" align="center" fixed="right" width="190"
  169. class-name="small-padding fixed-width">
  170. <template slot-scope="scope">
  171. <el-button
  172. size="mini"
  173. type="text"
  174. icon="el-icon-edit"
  175. @click="handleUpdate(scope.row)"
  176. v-hasPermi="['document:plantproglist:edit']"
  177. >{{ $t('修改') }}
  178. </el-button>
  179. <el-button
  180. size="mini"
  181. type="text"
  182. icon="el-icon-delete"
  183. @click="handleDelete(scope.row)"
  184. v-hasPermi="['document:plantproglist:remove']"
  185. >{{ $t('删除') }}
  186. </el-button>
  187. <el-button v-if="scope.row.deptId == 103"
  188. size="mini"
  189. type="text"
  190. icon="el-icon-delete"
  191. @click="handleTraining(scope.row)"
  192. v-hasPermi="['document:plantproglist:remove']"
  193. >培训
  194. </el-button>
  195. <el-button
  196. size="mini"
  197. type="text"
  198. icon="el-icon-document"
  199. @click="handleDoc(scope.row)"
  200. v-hasPermi="['document:plantproglist:edit']"
  201. >{{ $t('报告附件') }}
  202. </el-button>
  203. </template>
  204. </el-table-column>
  205. </el-table>
  206. <pagination
  207. v-show="total>0"
  208. :total="total"
  209. :page.sync="queryParams.pageNum"
  210. :limit.sync="queryParams.pageSize"
  211. @pagination="getList"
  212. />
  213. <!-- 添加或修改装置程序清单对话框 -->
  214. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="title" :visible.sync="open" width="1200px" append-to-body>
  215. <el-form ref="form" :model="form" :rules="rules" label-width="150px">
  216. <el-form-item :label="$t('文件编号')" prop="fileno">
  217. <el-input v-model="form.fileno" :placeholder="$t('请输入') + $t('文件编号')"/>
  218. </el-form-item>
  219. <el-form-item :label="$t('文件名称')" prop="filename">
  220. <el-input v-model="form.filename" :placeholder="$t('请输入') + $t('文件名称')" @change="changeRevisionDate"/>
  221. </el-form-item>
  222. <el-row>
  223. <el-col :span="12">
  224. <el-form-item :label="$t('版次')" prop="revision">
  225. <el-input v-model="form.revision" :placeholder="$t('请输入') + $t('版次')"/>
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="12">
  229. <el-form-item :label="$t('RC代码')" prop="rccode">
  230. <el-input v-model="form.rccode" :placeholder="$t('请输入') + $t('RC代码')"/>
  231. </el-form-item>
  232. </el-col>
  233. </el-row>
  234. <el-row>
  235. <el-col :span="12">
  236. <el-form-item :label="$t('更新负责人')" prop="responsibility">
  237. <el-input v-model="form.responsibility" :placeholder="$t('请输入') + $t('更新负责人')"/>
  238. </el-form-item>
  239. </el-col>
  240. </el-row>
  241. <el-row>
  242. <el-col :span="12">
  243. <el-form-item :label="$t('修订日期')" prop="filedate">
  244. <el-date-picker clearable size="small" style="width: 200px"
  245. v-model="form.filedate"
  246. type="date"
  247. value-format="yyyy-MM-dd"
  248. :placeholder="$t('请选择') + $t('修订日期')"
  249. @change="changeRevisionDate">
  250. </el-date-picker>
  251. </el-form-item>
  252. </el-col>
  253. <el-col :span="12">
  254. <el-form-item :label="$t('下次修订日期')" prop="nexteditdate">
  255. <el-date-picker clearable size="small" style="width: 200px"
  256. v-model="form.nexteditdate"
  257. type="date"
  258. value-format="yyyy-MM-dd"
  259. :placeholder="$t('请选择') + $t('下次修订日期')">
  260. </el-date-picker>
  261. </el-form-item>
  262. </el-col>
  263. </el-row>
  264. <el-row>
  265. <el-col :span="12">
  266. <el-form-item :label="$t('回顾频率')" prop="reviewFrequency" v-if="this.itemNum !== '5'">
  267. <el-input v-model="form.reviewFrequency" :placeholder="$t('请输入') + $t('回顾频率')" @change="getNextDate()"/>
  268. </el-form-item>
  269. </el-col>
  270. <el-col :span="12">
  271. <el-form-item :label="$t('回顾日期')" prop="reviewdate" v-if="this.itemNum !== '5'">
  272. <el-date-picker clearable size="small" style="width: 200px"
  273. v-model="form.reviewdate"
  274. type="date"
  275. value-format="yyyy-MM-dd"
  276. @change="getNextDate()"
  277. :placeholder="$t('请选择') + $t('回顾日期')">
  278. </el-date-picker>
  279. </el-form-item>
  280. </el-col>
  281. </el-row>
  282. <el-row>
  283. <el-col :span="12">
  284. <el-form-item :label="$t('回顾结果')" prop="reviewResult" v-if="this.itemNum !== '5'">
  285. <el-input v-model="form.reviewResult" :placeholder="$t('请输入') + $t('回顾结果')"/>
  286. </el-form-item>
  287. </el-col>
  288. <el-col :span="12">
  289. <el-form-item :label="$t('下次回顾日期')" prop="nextreviewdate" >
  290. <el-date-picker clearable size="small" style="width: 200px"
  291. v-model="form.nextreviewdate"
  292. type="date"
  293. value-format="yyyy-MM-dd"
  294. :placeholder="$t('请选择') + $t('下次回顾日期')">
  295. </el-date-picker>
  296. </el-form-item>
  297. </el-col>
  298. </el-row>
  299. <el-row>
  300. <el-col :span="12">
  301. <el-form-item :label="$t('密级分类')" prop="classify" v-if="this.itemNum !== '5'">
  302. <el-select v-model="form.classify" :placeholder="$t('请选择') + $t('密级分类')">
  303. <el-option
  304. v-for="dict in classifyOptions"
  305. :key="dict.dictValue"
  306. :label="dict.dictLabel"
  307. :value="dict.dictValue"
  308. ></el-option>
  309. </el-select>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="12">
  313. <el-form-item :label="$t('公共盘文件版本')" prop="versionPan" v-if="this.itemNum !== '5'">
  314. <el-input v-model="form.versionPan" :placeholder="$t('请输入') + $t('公共盘文件版本')"/>
  315. </el-form-item>
  316. </el-col>
  317. </el-row>
  318. <el-row>
  319. <el-col :span="12">
  320. <el-form-item :label="$t('附件编号')" prop="attachmentNo" v-if="this.itemNum === '5'">
  321. <el-input v-model="form.attachmentNo" :placeholder="$t('请输入') + $t('附件编号')"/>
  322. </el-form-item>
  323. </el-col>
  324. <el-col :span="12">
  325. <el-form-item :label="$t('附件名称')" prop="attachmentName" v-if="this.itemNum === '5'">
  326. <el-input v-model="form.attachmentName" :placeholder="$t('请输入') + $t('附件名称')"/>
  327. </el-form-item>
  328. </el-col>
  329. </el-row>
  330. <el-row>
  331. <el-col :span="12">
  332. <el-form-item :label="$t('附件版次')" prop="attachmentRevision" v-if="this.itemNum === '5'">
  333. <el-input v-model="form.attachmentRevision" :placeholder="$t('请输入') + $t('附件版次')"/>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="12">
  337. <el-form-item :label="$t('附件修改日期')" prop="revisionDate" v-if="this.itemNum === '5'">
  338. <el-date-picker clearable size="small" style="width: 200px"
  339. v-model="form.revisionDate"
  340. type="date"
  341. value-format="yyyy-MM-dd"
  342. :placeholder="$t('请选择') + $t('附件修改日期')">
  343. </el-date-picker>
  344. </el-form-item>
  345. </el-col>
  346. </el-row>
  347. <el-row>
  348. <el-col :span="12">
  349. <el-form-item :label="$t('控制室文件版本')" prop="versionKzs" v-if="homeType==6">
  350. <el-input v-model="form.versionKzs" :placeholder="$t('请输入') + $t('控制室文件版本')"/>
  351. </el-form-item>
  352. </el-col>
  353. <el-col :span="12">
  354. <el-form-item :label="$t('归属部门')" prop="deptId">
  355. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true"
  356. :placeholder="$t('请选择') + $t('归属部门')"/>
  357. </el-form-item>
  358. </el-col>
  359. </el-row>
  360. <el-row>
  361. <el-col :span="24">
  362. <el-form-item :label="$t('备注')" prop="remarks">
  363. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')"/>
  364. </el-form-item>
  365. </el-col>
  366. </el-row>
  367. </el-form>
  368. <div slot="footer" class="dialog-footer">
  369. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  370. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  371. </div>
  372. </el-dialog>
  373. <!-- 用户导入对话框 -->
  374. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  375. <el-upload
  376. ref="upload"
  377. :limit="1"
  378. accept=".xlsx, .xls"
  379. :headers="upload.headers"
  380. :action="upload.url"
  381. :disabled="upload.isUploading"
  382. :on-progress="handleFileUploadProgress"
  383. :on-success="handleFileSuccess"
  384. :auto-upload="false"
  385. drag
  386. >
  387. <i class="el-icon-upload"></i>
  388. <div class="el-upload__text">
  389. {{ $t('将文件拖到此处,或') }}
  390. <em>{{ $t('点击上传') }}</em>
  391. </div>
  392. <div class="el-upload__tip" slot="tip">
  393. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  394. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  395. </div>
  396. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  397. <input name="type" :value="upload.type" hidden/>
  398. </form>
  399. <div class="el-upload__tip" style="color:#ff0000" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  400. </el-upload>
  401. <div slot="footer" class="dialog-footer">
  402. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  403. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  404. </div>
  405. </el-dialog>
  406. <!-- 报告附件对话框 -->
  407. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
  408. <el-upload
  409. ref="doc"
  410. :limit="500"
  411. :headers="doc.headers"
  412. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  413. :disabled="doc.isUploading"
  414. :on-progress="handleFileDocProgress"
  415. :on-success="handleFileDocSuccess"
  416. :auto-upload="true"
  417. drag
  418. >
  419. <i class="el-icon-upload"></i>
  420. <div class="el-upload__text">
  421. {{ $t('将文件拖到此处,或') }}
  422. <em>{{ $t('点击上传') }}</em>
  423. </div>
  424. </el-upload>
  425. <el-table :data="doc.commonfileList" border>
  426. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  427. <template slot-scope="scope">
  428. <a class="link-type" @click="handleDownload(scope.row)">
  429. <span>{{ scope.row.fileName }}</span>
  430. </a>
  431. </template>
  432. </el-table-column>
  433. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80"/>
  434. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  435. <el-table-column :label="$t('操作')" align="center" width="150" class-name="small-padding fixed-width">
  436. <template slot-scope="scope">
  437. <el-button
  438. v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
  439. ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
  440. ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
  441. ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
  442. ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
  443. ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
  444. size="mini"
  445. type="text"
  446. icon="el-icon-view"
  447. @click="handleSee(scope.row)"
  448. > {{ $t('预览') }}
  449. </el-button>
  450. <el-button
  451. v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
  452. size="mini"
  453. type="text"
  454. icon="el-icon-view"
  455. @click="handleSeePPT(scope.row)"
  456. > {{ $t('ppt预览') }}
  457. </el-button>
  458. <el-button
  459. size="mini"
  460. type="text"
  461. icon="el-icon-download"
  462. @click="handleDownload(scope.row)"
  463. >{{ $t('下载') }}
  464. </el-button>
  465. <el-button
  466. size="mini"
  467. type="text"
  468. icon="el-icon-delete"
  469. @click="handleDeleteDoc(scope.row)"
  470. >{{ $t('删除') }}
  471. </el-button>
  472. </template>
  473. </el-table-column>
  474. </el-table>
  475. <div slot="footer" class="dialog-footer">
  476. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  477. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  478. </div>
  479. </el-dialog>
  480. <el-dialog :close-on-click-modal="false" v-loading="loadingFlash" element-loading-background="rgba(0,0,0,0.2)" v-dialogDrag :title="pdf.title"
  481. :visible.sync="pdf.open" width="1300px" :center="true" append-to-body>
  482. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  483. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  484. </div>
  485. <div style="margin-top: -30px">
  486. <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"
  487. v-if="ppt"></iframe>
  488. </div>
  489. <div style="padding: 30px; width: 100%; height: 100%;">
  490. <el-carousel class="" ref="carousel" arrow="always" v-if="pptView"
  491. height="700px" trigger="click" :autoplay="false" indicator-position="outside">
  492. <el-carousel-item class="lun_img" v-for="item in imgs" v-bind:key="item">
  493. <img :src="item" width="100%" height="100%" object-fit="cover"/>
  494. </el-carousel-item>
  495. </el-carousel>
  496. </div>
  497. </el-dialog>
  498. <el-drawer
  499. :title="$t('数据分析')"
  500. size="600px"
  501. :visible.sync="drawer"
  502. :direction="direction">
  503. <el-row>
  504. <el-col>
  505. <el-card class="box-card" shadow="hover">
  506. <div slot="header" class="clearfix">
  507. <span>{{ $t('RC代码统计') }}</span>
  508. </div>
  509. <div class="text item">
  510. <rc-data :item=this.item v-if="sonRefresh"></rc-data>
  511. </div>
  512. </el-card>
  513. </el-col>
  514. </el-row>
  515. <el-row>
  516. <el-col>
  517. <el-card class="box-card" shadow="hover">
  518. <div slot="header" class="clearfix">
  519. <span>{{ $t('分级统计') }}</span>
  520. </div>
  521. <div class="text item">
  522. <classify-data :item=this.item v-if="sonRefresh"></classify-data>
  523. </div>
  524. </el-card>
  525. </el-col>
  526. </el-row>
  527. </el-drawer>
  528. </div>
  529. </template>
  530. <script>
  531. import {
  532. addPlantproglist,
  533. delPlantproglist,
  534. exportPlantproglist,
  535. getPlantproglist,
  536. listPlantproglist,
  537. updatePlantproglist,
  538. addProglistTraining,
  539. addProglistTrainingForce
  540. } from "@/api/document/plantproglist";
  541. import {allFileList, delCommonfile} from "@/api/common/commonfile";
  542. import {treeselect} from "@/api/system/dept";
  543. import {getToken} from "@/utils/auth";
  544. import Treeselect from "@riophae/vue-treeselect";
  545. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  546. import RcData from "./rcData";
  547. import ClassifyData from "./classifyData";
  548. import {formatDate} from "../../../utils";
  549. import dayjs from "dayjs";
  550. export default {
  551. name: "index",
  552. props: ['item', 'typename'],
  553. components: {ClassifyData, RcData, Treeselect},
  554. data() {
  555. return {
  556. imgs: [],
  557. homeType: null,
  558. jpgList: [],
  559. ppt: false,
  560. pptView: false,
  561. drawer: false,
  562. direction: 'rtl',
  563. sonRefresh: true,
  564. // 遮罩层
  565. loading: true,
  566. loadingFlash: false,
  567. // 选中数组
  568. ids: [],
  569. // 非单个禁用
  570. single: true,
  571. // 非多个禁用
  572. multiple: true,
  573. // 显示搜索条件
  574. showSearch: false,
  575. // 总条数
  576. total: 0,
  577. // 装置程序清单表格数据
  578. plantproglistList: [],
  579. // 弹出层标题
  580. title: "",
  581. // 部门树选项
  582. deptOptions: undefined,
  583. clientHeight: 300,
  584. // 是否显示弹出层
  585. open: false,
  586. // 分级字典
  587. classifyOptions: [],
  588. //分类
  589. itemNum: this.item,
  590. // 用户导入参数
  591. upload: {
  592. //下载模板请求地址
  593. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  594. //下载模板类型
  595. type: this.typename,
  596. // 是否显示弹出层(用户导入)
  597. open: false,
  598. // 弹出层标题(用户导入)
  599. title: "",
  600. // 是否禁用上传
  601. isUploading: false,
  602. // 是否更新已经存在的用户数据
  603. updateSupport: 0,
  604. // 设置上传的请求头部
  605. headers: {Authorization: "Bearer " + getToken()},
  606. // 上传的地址
  607. url: process.env.VUE_APP_BASE_API + "/document/plantproglist/importData"
  608. },
  609. downloadExportAction: process.env.VUE_APP_BASE_API + "/document/plantproglist/importData",
  610. // 报告附件参数
  611. doc: {
  612. file: "123",
  613. // 是否显示弹出层(报告附件)
  614. open: false,
  615. // 弹出层标题(报告附件)
  616. title: "",
  617. // 是否禁用上传
  618. isUploading: false,
  619. // 是否更新已经存在的用户数据
  620. updateSupport: 0,
  621. // 报告附件上传位置编号
  622. ids: 0,
  623. // 设置上传的请求头部
  624. headers: {Authorization: "Bearer " + getToken()},
  625. // 上传的地址
  626. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  627. commonfileList: null,
  628. queryParams: {
  629. pId: null,
  630. pType: 'plantproglist'
  631. },
  632. pType: 'plantproglist',
  633. pId: null
  634. },
  635. pdf: {
  636. title: '',
  637. pdfUrl: '',
  638. numPages: null,
  639. open: false,
  640. pageNum: 1,
  641. pageTotalNum: 1,
  642. loadedRatio: 0,
  643. },
  644. // 查询参数
  645. queryParams: {
  646. pageNum: 1,
  647. pageSize: 20,
  648. fileno: null,
  649. filename: null,
  650. revision: null,
  651. rccode: null,
  652. carrier: null,
  653. responsibility: null,
  654. filedate: null,
  655. reviewdate: null,
  656. nextreviewdate: null,
  657. nexteditdate: null,
  658. item: this.item,
  659. createrCode: null,
  660. createdate: null,
  661. updaterCode: null,
  662. updatedate: null,
  663. deptId: null,
  664. remarks: null,
  665. classify: null,
  666. reviewFrequency: null,
  667. reviewResult: null,
  668. attachmentNo: null,
  669. attachmentName: null,
  670. attachmentRevision: null,
  671. revisionDate: null,
  672. orderByColumn: null,
  673. isAsc: null,
  674. allNo: null
  675. },
  676. // 表单参数
  677. form: {},
  678. // 表单校验
  679. rules: {
  680. fileno: [
  681. {required: true, message: this.$t('文件编号') + this.$t('不能为空'), trigger: "blur"}
  682. ],
  683. filename: [
  684. {required: true, message: this.$t('文件名称') + this.$t('不能为空'), trigger: "blur"}
  685. ],
  686. revision: [
  687. {required: true, message: this.$t('版次') + this.$t('不能为空'), trigger: "blur"}
  688. ],
  689. rccode: [
  690. {required: true, message: this.$t('RC代码') + this.$t('不能为空'), trigger: "blur"}
  691. ],
  692. carrier: [
  693. {required: true, message: this.$t('载体') + this.$t('不能为空'), trigger: "blur"}
  694. ],
  695. responsibility: [
  696. {required: true, message: this.$t('更新负责人') + this.$t('不能为空'), trigger: "blur"}
  697. ],
  698. filedate: [
  699. {required: true, message: this.$t('修订日期') + this.$t('不能为空'), trigger: "blur"}
  700. ],
  701. classify: [
  702. {required: true, message: this.$t('密级分类') + this.$t('不能为空'), trigger: "change"}
  703. ],
  704. deptId: [
  705. {required: true, message: this.$t('归属部门') + this.$t('不能为空'), trigger: "blur"}
  706. ],
  707. }
  708. };
  709. },
  710. watch: {
  711. // 根据名称筛选部门树
  712. deptName(val) {
  713. this.$refs.tree.filter(val);
  714. }
  715. },
  716. mounted() {
  717. console.log(this.$store.state.user.homeType)
  718. this.homeType = this.$store.state.user.homeType
  719. },
  720. created() {
  721. //设置表格高度对应屏幕高度
  722. this.$nextTick(() => {
  723. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  724. })
  725. console.log('============================')
  726. let responsibility = this.$route.query.responsibility
  727. this.queryParams.responsibility = responsibility
  728. this.getList();
  729. this.getTreeselect();
  730. this.getDicts("CLASSIFY").then(response => {
  731. this.classifyOptions = response.data;
  732. });
  733. },
  734. methods: {
  735. getNextDate() {
  736. var reviewFrequency = this.form.reviewFrequency;
  737. if (this.form.reviewdate != null && reviewFrequency != null) {
  738. var s = reviewFrequency.substring(0, reviewFrequency.indexOf("/"));
  739. if (this.form.reviewdate.endsWith("02-29")) {
  740. this.form.nextreviewdate = dayjs(new Date(this.form.reviewdate)).add(1, 'year').format("YYYY-MM-DD");
  741. } else {
  742. this.form.nextreviewdate = dayjs(new Date(this.form.reviewdate)).add(1, 'year').subtract(1, 'day').format("YYYY-MM-DD");
  743. }
  744. }
  745. },
  746. /** 查询装置程序清单列表 */
  747. getList() {
  748. this.loading = true;
  749. listPlantproglist(this.queryParams).then(response => {
  750. this.plantproglistList = response.rows;
  751. this.total = response.total;
  752. this.loading = false;
  753. });
  754. },
  755. //element表格排序
  756. sortList(val) {
  757. var sort = "asc";
  758. let sortTip = val.order
  759. this.queryParams.orderByColumn = val.prop;
  760. if (sortTip === 'descending') {
  761. this.queryParams.isAsc = 'desc' // 降序
  762. } else if (sortTip === 'ascending') {
  763. this.queryParams.isAsc = 'asc' // 升序
  764. } else if (sortTip === null) {
  765. this.queryParams.isAsc = null;
  766. this.queryParams.orderByColumn = null;
  767. }
  768. this.getList();
  769. },
  770. //根据分数显示颜色提示
  771. tableCellClassName({row, column, rowIndex, columnIndex}) {
  772. // if (columnIndex == 7 && row.item !== 5) {
  773. // return this.changeColor(row.nexteditdate)
  774. // }else if (columnIndex == 11 && row.item !== 5) {
  775. // return this.changeColor(row.nextreviewdate)
  776. // }
  777. },
  778. changeColor(value) {
  779. var timeInterval = Date.parse(value) - Date.parse(new Date());
  780. if (timeInterval <= 15 * 24 * 3600 * 1000) {
  781. return 'cellUrgent'
  782. } else if (timeInterval <= 30 * 24 * 3600 * 1000) {
  783. return 'cellCare'
  784. }
  785. },
  786. changeColorPiont(value) {
  787. var timeInterval = Date.parse(value) - Date.parse(new Date());
  788. if (timeInterval <= 15 * 24 * 3600 * 1000) {
  789. return 'roundRed'
  790. } else if (timeInterval <= 30 * 24 * 3600 * 1000) {
  791. return 'roundYellow'
  792. }
  793. return ''
  794. },
  795. /** 查询部门下拉树结构 */
  796. getTreeselect() {
  797. treeselect().then(response => {
  798. this.deptOptions = response.data;
  799. });
  800. },
  801. // 分级字典翻译
  802. classifyFormat(row, column) {
  803. return this.selectDictLabel(this.classifyOptions, row.classify);
  804. },
  805. //根据修订日期生成其他日期
  806. changeRevisionDate() {
  807. const filename = this.form.filename;
  808. var nexteditdate = "";
  809. if (filename && filename.indexOf("应急响应") !== -1) {
  810. if (this.form.filedate.endsWith("02-29")) {
  811. nexteditdate = dayjs(new Date(this.form.filedate)).add(1, 'year').format("YYYY-MM-DD");
  812. } else {
  813. nexteditdate = dayjs(new Date(this.form.filedate)).add(1, 'year').subtract(1, 'day').format("YYYY-MM-DD");
  814. }
  815. } else {
  816. if (this.form.filedate.endsWith("02-29")) {
  817. nexteditdate = dayjs(new Date(this.form.filedate)).add(3, 'year').format("YYYY-MM-DD");
  818. } else {
  819. nexteditdate = dayjs(new Date(this.form.filedate)).add(3, 'year').subtract(1, 'day').format("YYYY-MM-DD");
  820. }
  821. }
  822. var nextedit = new Date(nexteditdate);
  823. this.form.nexteditdate = formatDate(nextedit, 'yyyy-MM-dd')
  824. // var reviewdate = Date.parse(this.form.filedate) + (1 * 365 * 24 * 3600 * 1000)
  825. // var review = new Date(reviewdate);
  826. // this.form.reviewdate = formatDate(review,'yyyy-MM-dd')
  827. // var nextreviewdate = Date.parse(this.form.filedate) + (2 * 365 * 24 * 3600 * 1000)
  828. // var nextreview = new Date(nextreviewdate);
  829. // this.form.nextreviewdate = formatDate(nextreview,'yyyy-MM-dd')
  830. },
  831. // 取消按钮
  832. cancel() {
  833. this.open = false;
  834. this.reset();
  835. },
  836. // 表单重置
  837. reset() {
  838. this.form = {
  839. id: null,
  840. fileno: null,
  841. filename: null,
  842. revision: null,
  843. rccode: null,
  844. carrier: null,
  845. responsibility: null,
  846. filedate: null,
  847. reviewdate: null,
  848. nextreviewdate: null,
  849. nexteditdate: null,
  850. item: this.item,
  851. createrCode: null,
  852. createdate: null,
  853. updaterCode: null,
  854. updatedate: null,
  855. deptId: null,
  856. remarks: null,
  857. classify: null,
  858. reviewFrequency: null,
  859. reviewResult: null,
  860. versionKzs: null,
  861. versionPan: null,
  862. attachmentNo: null,
  863. attachmentName: null,
  864. attachmentRevision: null,
  865. revisionDate: null
  866. };
  867. this.resetForm("form");
  868. },
  869. /** 搜索按钮操作 */
  870. handleQuery() {
  871. this.queryParams.pageNum = 1;
  872. this.getList();
  873. },
  874. /** 重置按钮操作 */
  875. resetQuery() {
  876. this.queryParams.responsibility = null
  877. this.resetForm("queryForm");
  878. this.handleQuery();
  879. },
  880. // 多选框选中数据
  881. handleSelectionChange(selection) {
  882. this.ids = selection.map(item => item.id)
  883. this.single = selection.length !== 1
  884. this.multiple = !selection.length
  885. },
  886. /** 新增按钮操作 */
  887. handleAdd() {
  888. this.reset();
  889. this.open = true;
  890. this.title = this.$t('新增') + " " + this.$t('装置程序清单');
  891. },
  892. /** 修改按钮操作 */
  893. handleUpdate(row) {
  894. this.reset();
  895. const id = row.id || this.ids
  896. getPlantproglist(id).then(response => {
  897. console.log(response)
  898. this.form = response.data;
  899. this.open = true;
  900. this.title = this.$t('修改') + this.$t('装置程序清单');
  901. });
  902. },
  903. /** 提交按钮 */
  904. submitForm() {
  905. this.$refs["form"].validate(valid => {
  906. if (valid) {
  907. if (this.form.id != null) {
  908. updatePlantproglist(this.form).then(response => {
  909. this.msgSuccess(this.$t('修改成功'));
  910. this.open = false;
  911. this.getList();
  912. });
  913. } else {
  914. addPlantproglist(this.form).then(response => {
  915. this.msgSuccess(this.$t('新增成功'));
  916. this.open = false;
  917. this.getList();
  918. });
  919. }
  920. }
  921. });
  922. },
  923. /** 删除按钮操作 */
  924. handleDelete(row) {
  925. const ids = row.id || this.ids;
  926. this.$confirm(this.$t('是否确认删除装置程序清单编号为"') + +ids + this.$t('"的数据项?'), this.$t('警告'), {
  927. confirmButtonText: this.$t('确定'),
  928. cancelButtonText: this.$t('取消'),
  929. type: "warning"
  930. }).then(function () {
  931. return delPlantproglist(ids);
  932. }).then(() => {
  933. this.getList();
  934. this.msgSuccess(this.$t('删除成功'));
  935. })
  936. },
  937. /** 培训按钮操作 */
  938. handleTraining(row) {
  939. const ids = row.id;
  940. this.$confirm('是否确认发起装置培训', {
  941. confirmButtonText: this.$t('确定'),
  942. cancelButtonText: this.$t('取消'),
  943. type: "warning"
  944. }).then(() => {
  945. return addProglistTraining(row.id);
  946. }).then(() => {
  947. this.getList();
  948. this.msgSuccess(this.$t('操作成功'));
  949. }).catch((error) => {
  950. // 如果是用户取消操作,直接返回
  951. if (error === 'cancel') {
  952. return;
  953. }
  954. // 判断是否是"未找到培训矩阵"的错误
  955. // axios 拦截器返回的 Error 对象,错误信息在 message 中
  956. const errorMsg = error.message || error.msg || '';
  957. if (errorMsg.includes('未找到培训矩阵')) {
  958. // 弹出二次确认框
  959. this.$confirm('未找到培训矩阵,是否仍要添加到培训?', '提示', {
  960. confirmButtonText: '确定',
  961. cancelButtonText: '取消',
  962. type: 'warning'
  963. }).then(() => {
  964. // 调用强制添加接口
  965. return addProglistTrainingForce(row.id);
  966. }).then(() => {
  967. this.getList();
  968. this.msgSuccess('已添加培训跟踪(注意:未找到培训矩阵,未自动关联参培人员,请手动添加)');
  969. }).catch(() => {
  970. // 用户取消或失败,不做处理
  971. });
  972. }
  973. });
  974. },
  975. /** 导出按钮操作 */
  976. handleExport() {
  977. const queryParams = this.queryParams;
  978. this.$confirm(this.$t('是否确认导出所有装置程序清单数据项?'), this.$t('警告'), {
  979. confirmButtonText: this.$t('确定'),
  980. cancelButtonText: this.$t('取消'),
  981. type: "warning"
  982. }).then(function () {
  983. return exportPlantproglist(queryParams);
  984. }).then(response => {
  985. this.download(response.msg);
  986. })
  987. },
  988. /** 导出按钮操作 */
  989. handleExport2() {
  990. this.$nextTick(() => {
  991. this.$refs['downloadExportForm'].submit()
  992. })
  993. },
  994. /** 导入按钮操作 */
  995. handleImport() {
  996. this.upload.title = this.$t('用户导入');
  997. this.upload.open = true;
  998. },
  999. /** 下载模板操作 */
  1000. importTemplate() {
  1001. this.$refs['downloadFileForm'].submit()
  1002. },
  1003. // 文件上传中处理
  1004. handleFileUploadProgress(event, file, fileList) {
  1005. this.upload.isUploading = true;
  1006. },
  1007. // 文件上传成功处理
  1008. handleFileSuccess(response, file, fileList) {
  1009. this.upload.open = false;
  1010. this.upload.isUploading = false;
  1011. this.$refs.upload.clearFiles();
  1012. if (response.data[0] != null) {
  1013. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败') + "。", this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  1014. } else {
  1015. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  1016. }
  1017. this.getList();
  1018. },
  1019. /** 报告附件按钮操作 */
  1020. handleDoc(row) {
  1021. this.doc.id = row.id;
  1022. this.doc.title = row.filename;
  1023. this.doc.open = true;
  1024. this.doc.queryParams.pId = row.id
  1025. this.doc.pId = row.id
  1026. this.getFileList()
  1027. this.$nextTick(() => {
  1028. this.$refs.doc.clearFiles()
  1029. })
  1030. },
  1031. getFileList() {
  1032. allFileList(this.doc.queryParams).then(response => {
  1033. this.doc.commonfileList = response;
  1034. });
  1035. },
  1036. //附件上传中处理
  1037. handleFileDocProgress(event, file, fileList) {
  1038. this.doc.file = file;
  1039. this.doc.isUploading = true;
  1040. },
  1041. //附件上传成功处理
  1042. handleFileDocSuccess(response, file, fileList) {
  1043. this.doc.isUploading = false;
  1044. this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  1045. this.getFileList()
  1046. },
  1047. /** 删除按钮操作 */
  1048. handleDeleteDoc(row) {
  1049. const ids = row.id || this.ids;
  1050. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1051. confirmButtonText: this.$t('确定'),
  1052. cancelButtonText: this.$t('取消'),
  1053. type: "warning"
  1054. }).then(function () {
  1055. return delCommonfile(ids);
  1056. }).then(() => {
  1057. this.getFileList()
  1058. this.msgSuccess(this.$t('删除成功'));
  1059. })
  1060. },
  1061. // 文件下载处理
  1062. handleDownload(row) {
  1063. var name = row.fileName;
  1064. var url = row.fileUrl;
  1065. var suffix = url.substring(url.lastIndexOf("."), url.length);
  1066. console.log(url)
  1067. const a = document.createElement('a')
  1068. a.setAttribute('download', name)
  1069. a.setAttribute('target', '_blank')
  1070. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  1071. a.click()
  1072. },
  1073. // 提交上传文件
  1074. submitFileForm() {
  1075. this.$refs.upload.submit();
  1076. },
  1077. //数据分析
  1078. handleData() {
  1079. this.sonRefresh = false;
  1080. this.$nextTick(() => {
  1081. this.sonRefresh = true;
  1082. });
  1083. this.drawer = true
  1084. },
  1085. //文件预览
  1086. openPdf() {
  1087. //ppt就跳路由预览,office就直接打开文件新页面
  1088. const didi = {imgs: this.imgs}
  1089. if (this.pptView == true && this.ppt == false) {
  1090. let routeUrl = this.$router.resolve({
  1091. path: "/cpms/index.html#/pptyulan",
  1092. query: didi
  1093. });
  1094. window.open("/cpms/index.html#/pptyulan?id=" + this.pdf.pdfUrl, '_blank')
  1095. console.log(this.imgs)
  1096. } else {
  1097. window.open(this.pdf.pdfUrl)
  1098. }
  1099. },
  1100. handleSeePPT(row) {
  1101. //ppt预览
  1102. this.loadingFlash = true
  1103. this.pdf.open = true
  1104. this.pdf.title = row.fileName
  1105. this.pdf.pdfUrl = row.fileUrl
  1106. this.pptView = true
  1107. this.ppt = false
  1108. const formatDate = new FormData();
  1109. formatDate.append("filepath", row.fileUrl)
  1110. //调用文件预览api
  1111. let res = this.officeConvert.pptConvertCommon(formatDate)
  1112. //查看接受的全局方法的返回结果 console.log(res)
  1113. //利用.then方法接受Promise对象
  1114. res.then((result) => {
  1115. //关闭加载中
  1116. this.loadingFlash = false
  1117. //成功时直接给地址
  1118. this.videoList = result.data.imagePathList
  1119. //将返回的地址集合遍历添加到绑定的数组中
  1120. this.imgs = []
  1121. for (var key = 0; key < this.videoList.length; key++) {
  1122. this.imgs.push(process.env.VUE_APP_BASE_API + this.videoList[key]);
  1123. }
  1124. }).catch(result => {
  1125. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1126. this.pdf.pdfUrl = ""
  1127. this.loadingFlash = false;
  1128. })
  1129. },
  1130. handleSee(row) {
  1131. //office预览
  1132. this.loadingFlash = true
  1133. this.pdf.open = true
  1134. this.pdf.title = row.fileName
  1135. this.pdf.pdfUrl = ""
  1136. this.pptView = false
  1137. this.ppt = true
  1138. //如果是PDF等直接可以打开的就不调接口,否则调用接口
  1139. if (row.fileName.endsWith('pdf')) {
  1140. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  1141. this.loadingFlash = false
  1142. } else {
  1143. const formatDate = new FormData();
  1144. formatDate.append("filepath", row.fileUrl)
  1145. //调用文件预览api
  1146. let res = this.officeConvert.officeConvertCommon(formatDate)
  1147. //查看接受的全局方法的返回结果 console.log(res)
  1148. //利用.then方法接受Promise对象
  1149. res.then((result) => {
  1150. //关闭加载中
  1151. this.loadingFlash = false
  1152. if (result.msg.includes("csv")) {
  1153. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + result.data
  1154. this.$alert(result.msg, this.$t('检查乱码'), {dangerouslyUseHTMLString: true});
  1155. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1156. } else if (result.msg.includes("不存在")) {
  1157. //文件不存在时提示
  1158. this.pdf.pdfUrl = ""
  1159. this.$alert(result.msg, this.$t('预览失败'), {dangerouslyUseHTMLString: true});
  1160. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1161. this.pdf.open = false
  1162. } else if (result.msg.includes("不支持此格式")) {
  1163. this.pdf.pdfUrl = ""
  1164. this.$alert(result.msg, this.$t('预览失败'), {dangerouslyUseHTMLString: true});
  1165. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1166. this.pdf.open = false
  1167. } else {
  1168. //成功时直接给地址
  1169. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + result.data
  1170. }
  1171. // this.$nextTick(() => {
  1172. // const iframe = window.frames['iFrame']
  1173. // const handleLoad = () => {
  1174. // setTimeout(() => {
  1175. // const Do = (iframe.contentWindow || iframe.contentDocument)
  1176. // console.log(Do.document.getElementsByTagName('table')[0])
  1177. // Do.document.getElementsByTagName('table')[0].style.width = "100%"
  1178. // Do.document.getElementsByTagName('table')[0].setAttribute("class","table")
  1179. // }, 500)
  1180. // }
  1181. // iframe.addEventListener('load', handleLoad, true)
  1182. // })
  1183. }).catch(result => {
  1184. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1185. this.pdf.pdfUrl = ""
  1186. this.loadingFlash = false;
  1187. })
  1188. }
  1189. },
  1190. }
  1191. }
  1192. </script>
  1193. <style lang="scss">
  1194. .table {
  1195. width: 100%;
  1196. max-width: 100%;
  1197. > thead,
  1198. > tbody,
  1199. > tfoot {
  1200. > tr {
  1201. > th,
  1202. > td {
  1203. vertical-align: top;
  1204. border-top: 1px solid;
  1205. }
  1206. }
  1207. }
  1208. > thead > tr > th {
  1209. vertical-align: bottom;
  1210. border-bottom: 2px solid;
  1211. }
  1212. > caption + thead,
  1213. > colgroup + thead,
  1214. > thead:first-child {
  1215. > tr:first-child {
  1216. > th,
  1217. > td {
  1218. border-top: 0;
  1219. }
  1220. }
  1221. }
  1222. > tbody + tbody {
  1223. border-top: 2px solid;
  1224. }
  1225. }
  1226. </style>