index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953
  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. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button
  21. type="primary"
  22. icon="el-icon-plus"
  23. size="mini"
  24. @click="handleAdd"
  25. v-hasPermi="['document:plantproglist:add']"
  26. >{{ $t('新增') }}</el-button>
  27. </el-col>
  28. <el-col :span="1.5">
  29. <el-button
  30. type="success"
  31. icon="el-icon-edit"
  32. size="mini"
  33. :disabled="single"
  34. @click="handleUpdate"
  35. v-hasPermi="['document:plantproglist:edit']"
  36. >{{ $t('修改') }}</el-button>
  37. </el-col>
  38. <el-col :span="1.5">
  39. <el-button
  40. type="danger"
  41. icon="el-icon-delete"
  42. size="mini"
  43. :disabled="multiple"
  44. @click="handleDelete"
  45. v-hasPermi="['document:plantproglist:remove']"
  46. >{{ $t('删除') }}</el-button>
  47. </el-col>
  48. <el-col :span="1.5">
  49. <el-button
  50. type="info"
  51. icon="el-icon-upload2"
  52. size="mini"
  53. @click="handleImport"
  54. v-hasPermi="['document:plantproglist:edit']"
  55. >{{ $t('导入') }}</el-button>
  56. </el-col>
  57. <!-- <el-col :span="1.5">-->
  58. <!-- <el-button-->
  59. <!-- type="warning"-->
  60. <!-- icon="el-icon-download"-->
  61. <!-- size="mini"-->
  62. <!-- @click="handleExport"-->
  63. <!-- v-hasPermi="['document:plantproglist:export']"-->
  64. <!-- >{{ $t('导出') }}</el-button>-->
  65. <!-- </el-col>-->
  66. <el-col :span="1.5">
  67. <el-button
  68. type="warning"
  69. icon="el-icon-download"
  70. size="mini"
  71. @click="handleExport"
  72. v-hasPermi="['document:plantproglist:export']"
  73. >{{ $t('导出') }}</el-button>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-button
  77. type="primary"
  78. icon="el-icon-s-data"
  79. size="mini"
  80. @click="handleData"
  81. >{{ $t('数据分析') }}</el-button>
  82. </el-col>
  83. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  84. </el-row>
  85. <form ref="downloadExportForm" :action="downloadExportAction" target="FORMSUBMIT">
  86. </form>
  87. <el-table v-loading="loading" :data="plantproglistList" @selection-change="handleSelectionChange" :cell-class-name="tableCellClassName" :height="clientHeight" border>
  88. <el-table-column type="selection" width="55" align="center" />
  89. <el-table-column :label="$t('文件编号')" align="center" prop="fileno" width="150" :show-overflow-tooltip="true"/>
  90. <el-table-column :label="$t('文件名称')" align="center" width="220" prop="filename" :show-overflow-tooltip="true"/>
  91. <el-table-column :label="$t('版次')" align="center" prop="revision" :show-overflow-tooltip="true"/>
  92. <el-table-column :label="$t('RC代码')" align="center" prop="rccode" :show-overflow-tooltip="true"/>
  93. <el-table-column :label="$t('更新负责人')" align="center" prop="responsibility" :show-overflow-tooltip="true"/>
  94. <el-table-column :label="$t('修订日期')" align="center" prop="filedate" width="100">
  95. <template slot-scope="scope">
  96. <span>{{ parseTime(scope.row.filedate, '{y}-{m}-{d}') }}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column :label="$t('下次修订日期')" align="center" prop="nexteditdate" width="100">
  100. <template slot-scope="scope">
  101. <span>{{ parseTime(scope.row.nexteditdate, '{y}-{m}-{d}') }}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column :label="$t('回顾频率')" align="center" prop="reviewFrequency" :show-overflow-tooltip="true" v-if="this.itemNum !== '5'"/>
  105. <el-table-column :label="$t('回顾日期')" align="center" prop="reviewdate" width="100" v-if="this.itemNum !== '5'">
  106. <template slot-scope="scope">
  107. <span>{{ parseTime(scope.row.reviewdate, '{y}-{m}-{d}') }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column :label="$t('回顾结果')" align="center" prop="reviewResult" width="150" :show-overflow-tooltip="true" v-if="this.itemNum !== '5'"/>
  111. <el-table-column :label="$t('下次回顾日期')" align="center" prop="nextreviewdate" width="100" v-if="this.itemNum !== '5'">
  112. <template slot-scope="scope">
  113. <span>{{ parseTime(scope.row.nextreviewdate, '{y}-{m}-{d}') }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column :label="$t('密级分类')" align="center" prop="classify" width="100" v-if="this.itemNum !== '5'" :formatter="classifyFormat" />
  117. <el-table-column :label="$t('文件更新状态(控制室)')" align="center" v-if="[5,6].includes(this.itemNum)">
  118. <template slot-scope="scope">
  119. <span v-if="scope.row.revision == scope.row.versionKzs"></span>
  120. <span v-else style="color: #ff6d6d">{{$t('未更新')}}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column :label="$t('文件更新状态(公共盘)')" align="center" v-if="this.itemNum !== '5'">
  124. <template slot-scope="scope">
  125. <span v-if="scope.row.revision == scope.row.versionPan">{{$t('已更新')}}</span>
  126. <span v-else style="color: #ff6d6d">{{$t('未更新')}}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column :label="$t('附件编号')" align="center" prop="attachmentNo" v-if="this.itemNum === '5'" :show-overflow-tooltip="true" />
  130. <el-table-column :label="$t('附件名称')" align="center" prop="attachmentName" v-if="this.itemNum === '5'" :show-overflow-tooltip="true"/>
  131. <el-table-column :label="$t('附件版次')" align="center" prop="attachmentRevision" v-if="this.itemNum === '5'" :show-overflow-tooltip="true"/>
  132. <el-table-column :label="$t('附件修改日期')" align="center" prop="revisionDate" v-if="this.itemNum === '5'" width="100">
  133. <template slot-scope="scope">
  134. <span>{{ parseTime(scope.row.revisionDate, '{y}-{m}-{d}') }}</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  138. <el-table-column :label="$t('操作')" align="center" fixed="right" width="190" class-name="small-padding fixed-width">
  139. <template slot-scope="scope">
  140. <el-button
  141. size="mini"
  142. type="text"
  143. icon="el-icon-edit"
  144. @click="handleUpdate(scope.row)"
  145. v-hasPermi="['document:plantproglist:edit']"
  146. >{{ $t('修改') }}</el-button>
  147. <el-button
  148. size="mini"
  149. type="text"
  150. icon="el-icon-delete"
  151. @click="handleDelete(scope.row)"
  152. v-hasPermi="['document:plantproglist:remove']"
  153. >{{ $t('删除') }}</el-button>
  154. <el-button
  155. size="mini"
  156. type="text"
  157. icon="el-icon-document"
  158. @click="handleDoc(scope.row)"
  159. v-hasPermi="['document:plantproglist:edit']"
  160. >{{ $t('报告附件') }}</el-button>
  161. </template>
  162. </el-table-column>
  163. </el-table>
  164. <pagination
  165. v-show="total>0"
  166. :total="total"
  167. :page.sync="queryParams.pageNum"
  168. :limit.sync="queryParams.pageSize"
  169. @pagination="getList"
  170. />
  171. <!-- 添加或修改装置程序清单对话框 -->
  172. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="1200px" append-to-body>
  173. <el-form ref="form" :model="form" :rules="rules" label-width="150px">
  174. <el-form-item :label="$t('文件编号')" prop="fileno">
  175. <el-input v-model="form.fileno" :placeholder="$t('请输入') + $t('文件编号')" />
  176. </el-form-item>
  177. <el-form-item :label="$t('文件名称')" prop="filename">
  178. <el-input v-model="form.filename" :placeholder="$t('请输入') + $t('文件名称')" />
  179. </el-form-item>
  180. <el-row>
  181. <el-col :span="12">
  182. <el-form-item :label="$t('版次')" prop="revision">
  183. <el-input v-model="form.revision" :placeholder="$t('请输入') + $t('版次')" />
  184. </el-form-item>
  185. </el-col>
  186. <el-col :span="12">
  187. <el-form-item :label="$t('RC代码')" prop="rccode">
  188. <el-input v-model="form.rccode" :placeholder="$t('请输入') + $t('RC代码')" />
  189. </el-form-item>
  190. </el-col>
  191. </el-row>
  192. <el-row>
  193. <el-col :span="12">
  194. <el-form-item :label="$t('更新负责人')" prop="responsibility">
  195. <el-input v-model="form.responsibility" :placeholder="$t('请输入') + $t('更新负责人')" />
  196. </el-form-item>
  197. </el-col>
  198. </el-row>
  199. <el-row>
  200. <el-col :span="12">
  201. <el-form-item :label="$t('修订日期')" prop="filedate">
  202. <el-date-picker clearable size="small" style="width: 200px"
  203. v-model="form.filedate"
  204. type="date"
  205. value-format="yyyy-MM-dd"
  206. :placeholder="$t('请选择') + $t('修订日期')"
  207. @change="changeRevisionDate">
  208. </el-date-picker>
  209. </el-form-item>
  210. </el-col>
  211. <el-col :span="12">
  212. <el-form-item :label="$t('下次修订日期')" prop="nexteditdate">
  213. <el-date-picker clearable size="small" style="width: 200px"
  214. v-model="form.nexteditdate"
  215. type="date"
  216. value-format="yyyy-MM-dd"
  217. :placeholder="$t('请选择') + $t('下次修订日期')">
  218. </el-date-picker>
  219. </el-form-item>
  220. </el-col>
  221. </el-row>
  222. <el-row>
  223. <el-col :span="12">
  224. <el-form-item :label="$t('回顾频率')" prop="reviewFrequency" v-if="this.itemNum !== '5'">
  225. <el-input v-model="form.reviewFrequency" :placeholder="$t('请输入') + $t('回顾频率')" />
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="12">
  229. <el-form-item :label="$t('回顾日期')" prop="reviewdate" v-if="this.itemNum !== '5'">
  230. <el-date-picker clearable size="small" style="width: 200px"
  231. v-model="form.reviewdate"
  232. type="date"
  233. value-format="yyyy-MM-dd"
  234. :placeholder="$t('请选择') + $t('回顾日期')">
  235. </el-date-picker>
  236. </el-form-item>
  237. </el-col>
  238. </el-row>
  239. <el-row>
  240. <el-col :span="12">
  241. <el-form-item :label="$t('回顾结果')" prop="reviewResult" v-if="this.itemNum !== '5'">
  242. <el-input v-model="form.reviewResult" :placeholder="$t('请输入') + $t('回顾结果')" />
  243. </el-form-item>
  244. </el-col>
  245. <el-col :span="12">
  246. <el-form-item :label="$t('下次回顾日期')" prop="nextreviewdate" v-if="this.itemNum !== '5'">
  247. <el-date-picker clearable size="small" style="width: 200px"
  248. v-model="form.nextreviewdate"
  249. type="date"
  250. value-format="yyyy-MM-dd"
  251. :placeholder="$t('请选择') + $t('下次回顾日期')">
  252. </el-date-picker>
  253. </el-form-item>
  254. </el-col>
  255. </el-row>
  256. <el-row>
  257. <el-col :span="12">
  258. <el-form-item :label="$t('密级分类')" prop="classify" v-if="this.itemNum !== '5'">
  259. <el-select v-model="form.classify" :placeholder="$t('请选择') + $t('密级分类')">
  260. <el-option
  261. v-for="dict in classifyOptions"
  262. :key="dict.dictValue"
  263. :label="dict.dictLabel"
  264. :value="dict.dictValue"
  265. ></el-option>
  266. </el-select>
  267. </el-form-item>
  268. </el-col>
  269. <el-col :span="12">
  270. <el-form-item :label="$t('公共盘文件版本')" prop="versionPan" v-if="this.itemNum !== '5'">
  271. <el-input v-model="form.versionPan" :placeholder="$t('请输入') + $t('公共盘文件版本')" />
  272. </el-form-item>
  273. </el-col>
  274. </el-row>
  275. <el-row>
  276. <el-col :span="12">
  277. <el-form-item :label="$t('附件编号')" prop="attachmentNo" v-if="this.itemNum === '5'">
  278. <el-input v-model="form.attachmentNo" :placeholder="$t('请输入') + $t('附件编号')" />
  279. </el-form-item>
  280. </el-col>
  281. <el-col :span="12">
  282. <el-form-item :label="$t('附件名称')" prop="attachmentName" v-if="this.itemNum === '5'">
  283. <el-input v-model="form.attachmentName" :placeholder="$t('请输入') + $t('附件名称')" />
  284. </el-form-item>
  285. </el-col>
  286. </el-row>
  287. <el-row>
  288. <el-col :span="12">
  289. <el-form-item :label="$t('附件版次')" prop="attachmentRevision" v-if="this.itemNum === '5'">
  290. <el-input v-model="form.attachmentRevision" :placeholder="$t('请输入') + $t('附件版次')" />
  291. </el-form-item>
  292. </el-col>
  293. <el-col :span="12">
  294. <el-form-item :label="$t('附件修改日期')" prop="revisionDate" v-if="this.itemNum === '5'">
  295. <el-date-picker clearable size="small" style="width: 200px"
  296. v-model="form.revisionDate"
  297. type="date"
  298. value-format="yyyy-MM-dd"
  299. :placeholder="$t('请选择') + $t('附件修改日期')">
  300. </el-date-picker>
  301. </el-form-item>
  302. </el-col>
  303. </el-row>
  304. <el-row>
  305. <el-col :span="12">
  306. <el-form-item :label="$t('备注')" prop="remarks">
  307. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  308. </el-form-item>
  309. </el-col>
  310. <el-col :span="12">
  311. <el-form-item :label="$t('归属部门')" prop="deptId">
  312. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  313. </el-form-item>
  314. </el-col>
  315. </el-row>
  316. </el-form>
  317. <div slot="footer" class="dialog-footer">
  318. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  319. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  320. </div>
  321. </el-dialog>
  322. <!-- 用户导入对话框 -->
  323. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  324. <el-upload
  325. ref="upload"
  326. :limit="1"
  327. accept=".xlsx, .xls"
  328. :headers="upload.headers"
  329. :action="upload.url"
  330. :disabled="upload.isUploading"
  331. :on-progress="handleFileUploadProgress"
  332. :on-success="handleFileSuccess"
  333. :auto-upload="false"
  334. drag
  335. >
  336. <i class="el-icon-upload"></i>
  337. <div class="el-upload__text">
  338. {{ $t('将文件拖到此处,或') }}
  339. <em>{{ $t('点击上传') }}</em>
  340. </div>
  341. <div class="el-upload__tip" slot="tip">
  342. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  343. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  344. </div>
  345. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  346. <input name="type" :value="upload.type" hidden />
  347. </form>
  348. <div class="el-upload__tip" style="color:#ff0000" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  349. </el-upload>
  350. <div slot="footer" class="dialog-footer">
  351. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  352. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  353. </div>
  354. </el-dialog>
  355. <!-- 报告附件对话框 -->
  356. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
  357. <el-upload
  358. ref="doc"
  359. :limit="50"
  360. :headers="doc.headers"
  361. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  362. :disabled="doc.isUploading"
  363. :on-progress="handleFileDocProgress"
  364. :on-success="handleFileDocSuccess"
  365. :auto-upload="true"
  366. drag
  367. >
  368. <i class="el-icon-upload"></i>
  369. <div class="el-upload__text">
  370. {{ $t('将文件拖到此处,或') }}
  371. <em>{{ $t('点击上传') }}</em>
  372. </div>
  373. </el-upload>
  374. <el-table :data="doc.commonfileList" border>
  375. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  376. <template slot-scope="scope">
  377. <a class="link-type" @click="handleDownload(scope.row)">
  378. <span>{{ scope.row.fileName }}</span>
  379. </a>
  380. </template>
  381. </el-table-column>
  382. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  383. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  384. <el-table-column :label="$t('操作')" align="center" width="150" class-name="small-padding fixed-width">
  385. <template slot-scope="scope">
  386. <el-button
  387. v-if="scope.row.fileName.endsWith('pdf')"
  388. size="mini"
  389. type="text"
  390. icon="el-icon-view"
  391. @click="handleSee(scope.row)"
  392. >{{ $t('预览') }}</el-button>
  393. <el-button
  394. size="mini"
  395. type="text"
  396. icon="el-icon-download"
  397. @click="handleDownload(scope.row)"
  398. >{{ $t('下载') }}</el-button>
  399. <el-button
  400. size="mini"
  401. type="text"
  402. icon="el-icon-delete"
  403. @click="handleDeleteDoc(scope.row)"
  404. >{{ $t('删除') }}</el-button>
  405. </template>
  406. </el-table-column>
  407. </el-table>
  408. <div slot="footer" class="dialog-footer">
  409. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  410. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  411. </div>
  412. </el-dialog>
  413. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1700px" append-to-body>
  414. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  415. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  416. <div style="margin-top: -30px">
  417. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  418. </div>
  419. </el-dialog>
  420. <el-drawer
  421. :title="$t('数据分析')"
  422. size="600px"
  423. :visible.sync="drawer"
  424. :direction="direction">
  425. <el-row>
  426. <el-col>
  427. <el-card class="box-card" shadow="hover">
  428. <div slot="header" class="clearfix">
  429. <span>{{ $t('RC代码统计') }}</span>
  430. </div>
  431. <div class="text item">
  432. <rc-data :item = this.item v-if="sonRefresh"></rc-data>
  433. </div>
  434. </el-card>
  435. </el-col>
  436. </el-row>
  437. <el-row>
  438. <el-col>
  439. <el-card class="box-card" shadow="hover">
  440. <div slot="header" class="clearfix">
  441. <span>{{ $t('分级统计') }}</span>
  442. </div>
  443. <div class="text item">
  444. <classify-data :item = this.item v-if="sonRefresh"></classify-data>
  445. </div>
  446. </el-card>
  447. </el-col>
  448. </el-row>
  449. </el-drawer>
  450. </div>
  451. </template>
  452. <script>
  453. import {
  454. addPlantproglist,
  455. delPlantproglist,
  456. exportPlantproglist,
  457. getPlantproglist,
  458. listPlantproglist,
  459. updatePlantproglist
  460. } from "@/api/document/plantproglist";
  461. import {allFileList, delCommonfile} from "@/api/common/commonfile";
  462. import {treeselect} from "@/api/system/dept";
  463. import {getToken} from "@/utils/auth";
  464. import Treeselect from "@riophae/vue-treeselect";
  465. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  466. import RcData from "./rcData";
  467. import ClassifyData from "./classifyData";
  468. import {formatDate} from "../../../utils";
  469. export default {
  470. name: "index",
  471. props: ['item', 'typename'],
  472. components: {ClassifyData, RcData, Treeselect},
  473. data() {
  474. return {
  475. drawer: false,
  476. direction: 'rtl',
  477. sonRefresh: true,
  478. // 遮罩层
  479. loading: true,
  480. // 选中数组
  481. ids: [],
  482. // 非单个禁用
  483. single: true,
  484. // 非多个禁用
  485. multiple: true,
  486. // 显示搜索条件
  487. showSearch: false,
  488. // 总条数
  489. total: 0,
  490. // 装置程序清单表格数据
  491. plantproglistList: [],
  492. // 弹出层标题
  493. title: "",
  494. // 部门树选项
  495. deptOptions: undefined,
  496. clientHeight:300,
  497. // 是否显示弹出层
  498. open: false,
  499. // 分级字典
  500. classifyOptions: [],
  501. //分类
  502. itemNum: this.item,
  503. // 用户导入参数
  504. upload: {
  505. //下载模板请求地址
  506. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  507. //下载模板类型
  508. type: this.typename,
  509. // 是否显示弹出层(用户导入)
  510. open: false,
  511. // 弹出层标题(用户导入)
  512. title: "",
  513. // 是否禁用上传
  514. isUploading: false,
  515. // 是否更新已经存在的用户数据
  516. updateSupport: 0,
  517. // 设置上传的请求头部
  518. headers: { Authorization: "Bearer " + getToken() },
  519. // 上传的地址
  520. url: process.env.VUE_APP_BASE_API + "/document/plantproglist/importData"
  521. },
  522. downloadExportAction: process.env.VUE_APP_BASE_API + "/document/plantproglist/importData",
  523. // 报告附件参数
  524. doc: {
  525. file: "123",
  526. // 是否显示弹出层(报告附件)
  527. open: false,
  528. // 弹出层标题(报告附件)
  529. title: "",
  530. // 是否禁用上传
  531. isUploading: false,
  532. // 是否更新已经存在的用户数据
  533. updateSupport: 0,
  534. // 报告附件上传位置编号
  535. ids: 0,
  536. // 设置上传的请求头部
  537. headers: { Authorization: "Bearer " + getToken() },
  538. // 上传的地址
  539. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  540. commonfileList: null,
  541. queryParams: {
  542. pId: null,
  543. pType: 'plantproglist'
  544. },
  545. pType: 'plantproglist',
  546. pId: null
  547. },
  548. pdf : {
  549. title: '',
  550. pdfUrl: '',
  551. numPages: null,
  552. open: false,
  553. pageNum: 1,
  554. pageTotalNum: 1,
  555. loadedRatio: 0,
  556. },
  557. // 查询参数
  558. queryParams: {
  559. pageNum: 1,
  560. pageSize: 20,
  561. fileno: null,
  562. filename: null,
  563. revision: null,
  564. rccode: null,
  565. carrier: null,
  566. responsibility: null,
  567. filedate: null,
  568. reviewdate: null,
  569. nextreviewdate: null,
  570. nexteditdate: null,
  571. item: this.item,
  572. createrCode: null,
  573. createdate: null,
  574. updaterCode: null,
  575. updatedate: null,
  576. deptId: null,
  577. remarks: null,
  578. classify: null,
  579. reviewFrequency: null,
  580. reviewResult: null,
  581. attachmentNo: null,
  582. attachmentName: null,
  583. attachmentRevision: null,
  584. revisionDate: null
  585. },
  586. // 表单参数
  587. form: {},
  588. // 表单校验
  589. rules: {
  590. fileno: [
  591. { required: true, message: this.$t('文件编号') + this.$t('不能为空'), trigger: "blur" }
  592. ],
  593. filename: [
  594. { required: true, message: this.$t('文件名称') + this.$t('不能为空'), trigger: "blur" }
  595. ],
  596. revision: [
  597. { required: true, message: this.$t('版次') + this.$t('不能为空'), trigger: "blur" }
  598. ],
  599. rccode: [
  600. { required: true, message: this.$t('RC代码') + this.$t('不能为空'), trigger: "blur" }
  601. ],
  602. carrier: [
  603. { required: true, message: this.$t('载体') + this.$t('不能为空'), trigger: "blur" }
  604. ],
  605. responsibility: [
  606. { required: true, message: this.$t('更新负责人') + this.$t('不能为空'), trigger: "blur" }
  607. ],
  608. filedate: [
  609. { required: true, message: this.$t('修订日期') + this.$t('不能为空'), trigger: "blur" }
  610. ],
  611. reviewdate: [
  612. { required: true, message: this.$t('回顾日期') + this.$t('不能为空'), trigger: "blur" }
  613. ],
  614. nextreviewdate: [
  615. { required: true, message: this.$t('下次回顾日期') + this.$t('不能为空'), trigger: "blur" }
  616. ],
  617. nexteditdate: [
  618. { required: true, message: this.$t('下次修订日期') + this.$t('不能为空'), trigger: "blur" }
  619. ],
  620. classify: [
  621. { required: true, message: this.$t('密级分类') + this.$t('不能为空'), trigger: "change" }
  622. ],
  623. reviewFrequency: [
  624. { required: true, message: this.$t('回顾频率') + this.$t('不能为空'), trigger: "blur" }
  625. ],
  626. reviewResult: [
  627. { required: true, message: this.$t('回顾结果') + this.$t('不能为空'), trigger: "blur" }
  628. ],
  629. deptId: [
  630. { required: true, message: this.$t('归属部门') + this.$t('不能为空'), trigger: "blur" }
  631. ],
  632. }
  633. };
  634. },
  635. watch: {
  636. // 根据名称筛选部门树
  637. deptName(val) {
  638. this.$refs.tree.filter(val);
  639. }
  640. },
  641. created() {
  642. //设置表格高度对应屏幕高度
  643. this.$nextTick(() => {
  644. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  645. })
  646. this.getList();
  647. this.getTreeselect();
  648. this.getDicts("CLASSIFY").then(response => {
  649. this.classifyOptions = response.data;
  650. });
  651. },
  652. methods: {
  653. /** 查询装置程序清单列表 */
  654. getList() {
  655. this.loading = true;
  656. listPlantproglist(this.queryParams).then(response => {
  657. this.plantproglistList = response.rows;
  658. this.total = response.total;
  659. this.loading = false;
  660. });
  661. },
  662. //根据分数显示颜色提示
  663. tableCellClassName({ row, column, rowIndex, columnIndex }) {
  664. if (columnIndex == 7 && row.item !== 5) {
  665. return this.changeColor(row.nexteditdate)
  666. }else if (columnIndex == 11 && row.item !== 5) {
  667. return this.changeColor(row.nextreviewdate)
  668. }
  669. },
  670. changeColor (value) {
  671. var timeInterval = Date.parse(value) - Date.parse(new Date());
  672. if (timeInterval <= 15 * 24 * 3600 * 1000){
  673. return 'cellUrgent'
  674. }else if (timeInterval <= 30 * 24 * 3600 * 1000) {
  675. return 'cellCare'
  676. }
  677. },
  678. /** 查询部门下拉树结构 */
  679. getTreeselect() {
  680. treeselect().then(response => {
  681. this.deptOptions = response.data;
  682. });
  683. },
  684. // 分级字典翻译
  685. classifyFormat(row, column) {
  686. return this.selectDictLabel(this.classifyOptions, row.classify);
  687. },
  688. //根据修订日期生成其他日期
  689. changeRevisionDate() {
  690. var nexteditdate = Date.parse(this.form.filedate) + (3 * 365 * 24 * 3600 * 1000)
  691. var nextedit = new Date(nexteditdate);
  692. this.form.nexteditdate = formatDate(nextedit,'yyyy-MM-dd')
  693. var reviewdate = Date.parse(this.form.filedate) + (1 * 365 * 24 * 3600 * 1000)
  694. var review = new Date(reviewdate);
  695. this.form.reviewdate = formatDate(review,'yyyy-MM-dd')
  696. var nextreviewdate = Date.parse(this.form.filedate) + (2 * 365 * 24 * 3600 * 1000)
  697. var nextreview = new Date(nextreviewdate);
  698. this.form.nextreviewdate = formatDate(nextreview,'yyyy-MM-dd')
  699. },
  700. // 取消按钮
  701. cancel() {
  702. this.open = false;
  703. this.reset();
  704. },
  705. // 表单重置
  706. reset() {
  707. this.form = {
  708. id: null,
  709. fileno: null,
  710. filename: null,
  711. revision: null,
  712. rccode: null,
  713. carrier: null,
  714. responsibility: null,
  715. filedate: null,
  716. reviewdate: null,
  717. nextreviewdate: null,
  718. nexteditdate: null,
  719. item: this.item,
  720. createrCode: null,
  721. createdate: null,
  722. updaterCode: null,
  723. updatedate: null,
  724. deptId: null,
  725. remarks: null,
  726. classify: null,
  727. reviewFrequency: null,
  728. reviewResult: null,
  729. versionKzs: null,
  730. versionPan: null,
  731. attachmentNo: null,
  732. attachmentName: null,
  733. attachmentRevision: null,
  734. revisionDate: null
  735. };
  736. this.resetForm("form");
  737. },
  738. /** 搜索按钮操作 */
  739. handleQuery() {
  740. this.queryParams.pageNum = 1;
  741. this.getList();
  742. },
  743. /** 重置按钮操作 */
  744. resetQuery() {
  745. this.resetForm("queryForm");
  746. this.handleQuery();
  747. },
  748. // 多选框选中数据
  749. handleSelectionChange(selection) {
  750. this.ids = selection.map(item => item.id)
  751. this.single = selection.length!==1
  752. this.multiple = !selection.length
  753. },
  754. /** 新增按钮操作 */
  755. handleAdd() {
  756. this.reset();
  757. this.open = true;
  758. this.title = this.$t('新增') + " " + this.$t('装置程序清单');
  759. },
  760. /** 修改按钮操作 */
  761. handleUpdate(row) {
  762. this.reset();
  763. const id = row.id || this.ids
  764. getPlantproglist(id).then(response => {
  765. this.form = response.data;
  766. this.open = true;
  767. this.title = this.$t('修改') + this.$t('装置程序清单');
  768. });
  769. },
  770. /** 提交按钮 */
  771. submitForm() {
  772. this.$refs["form"].validate(valid => {
  773. if (valid) {
  774. if (this.form.id != null) {
  775. updatePlantproglist(this.form).then(response => {
  776. this.msgSuccess(this.$t('修改成功'));
  777. this.open = false;
  778. this.getList();
  779. });
  780. } else {
  781. addPlantproglist(this.form).then(response => {
  782. this.msgSuccess(this.$t('新增成功'));
  783. this.open = false;
  784. this.getList();
  785. });
  786. }
  787. }
  788. });
  789. },
  790. /** 删除按钮操作 */
  791. handleDelete(row) {
  792. const ids = row.id || this.ids;
  793. this.$confirm(this.$t('是否确认删除装置程序清单编号为"')+ + ids + this.$t('"的数据项?'), this.$t('警告'), {
  794. confirmButtonText: this.$t('确定'),
  795. cancelButtonText: this.$t('取消'),
  796. type: "warning"
  797. }).then(function() {
  798. return delPlantproglist(ids);
  799. }).then(() => {
  800. this.getList();
  801. this.msgSuccess(this.$t('删除成功'));
  802. })
  803. },
  804. /** 导出按钮操作 */
  805. handleExport() {
  806. const queryParams = this.queryParams;
  807. this.$confirm(this.$t('是否确认导出所有装置程序清单数据项?'), this.$t('警告'), {
  808. confirmButtonText: this.$t('确定'),
  809. cancelButtonText: this.$t('取消'),
  810. type: "warning"
  811. }).then(function() {
  812. return exportPlantproglist(queryParams);
  813. }).then(response => {
  814. this.download(response.msg);
  815. })
  816. },
  817. /** 导出按钮操作 */
  818. handleExport2() {
  819. this.$nextTick(() => {
  820. this.$refs['downloadExportForm'].submit()
  821. })
  822. },
  823. /** 导入按钮操作 */
  824. handleImport() {
  825. this.upload.title = this.$t('用户导入');
  826. this.upload.open = true;
  827. },
  828. /** 下载模板操作 */
  829. importTemplate() {
  830. this.$refs['downloadFileForm'].submit()
  831. },
  832. // 文件上传中处理
  833. handleFileUploadProgress(event, file, fileList) {
  834. this.upload.isUploading = true;
  835. },
  836. // 文件上传成功处理
  837. handleFileSuccess(response, file, fileList) {
  838. this.upload.open = false;
  839. this.upload.isUploading = false;
  840. this.$refs.upload.clearFiles();
  841. if (response.data[0] != null) {
  842. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  843. }else {
  844. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  845. }
  846. this.getList();
  847. },
  848. /** 报告附件按钮操作 */
  849. handleDoc(row) {
  850. this.doc.id = row.id;
  851. this.doc.title = row.filename;
  852. this.doc.open = true;
  853. this.doc.queryParams.pId = row.id
  854. this.doc.pId = row.id
  855. this.getFileList()
  856. this.$nextTick(() => {
  857. this.$refs.doc.clearFiles()
  858. })
  859. },
  860. getFileList (){
  861. allFileList(this.doc.queryParams).then(response => {
  862. this.doc.commonfileList = response;
  863. });
  864. },
  865. //附件上传中处理
  866. handleFileDocProgress(event, file, fileList) {
  867. this.doc.file = file;
  868. this.doc.isUploading = true;
  869. },
  870. //附件上传成功处理
  871. handleFileDocSuccess(response, file, fileList) {
  872. this.doc.isUploading = false;
  873. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  874. this.getFileList()
  875. },
  876. /** 删除按钮操作 */
  877. handleDeleteDoc(row) {
  878. const ids = row.id || this.ids;
  879. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  880. confirmButtonText: this.$t('确定'),
  881. cancelButtonText: this.$t('取消'),
  882. type: "warning"
  883. }).then(function() {
  884. return delCommonfile(ids);
  885. }).then(() => {
  886. this.getFileList()
  887. this.msgSuccess(this.$t('删除成功'));
  888. })
  889. },
  890. // 文件下载处理
  891. handleDownload(row) {
  892. var name = row.fileName;
  893. var url = row.fileUrl;
  894. var suffix = url.substring(url.lastIndexOf("."), url.length);
  895. console.log(url)
  896. const a = document.createElement('a')
  897. a.setAttribute('download', name)
  898. a.setAttribute('target', '_blank')
  899. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  900. a.click()
  901. },
  902. // 提交上传文件
  903. submitFileForm() {
  904. this.$refs.upload.submit();
  905. },
  906. //数据分析
  907. handleData(){
  908. this.sonRefresh= false;
  909. this.$nextTick(() => {
  910. this.sonRefresh= true;
  911. });
  912. this.drawer = true
  913. },
  914. //pdf预览
  915. openPdf(){
  916. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  917. },
  918. handleSee (row){
  919. this.pdf.open =true
  920. this.pdf.pageNum = 1
  921. this.pdf.loadedRatio = 0
  922. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + row.fileUrl
  923. this.pdf.title = row.fileName
  924. let loadingTask = null
  925. loadingTask = pdf.createLoadingTask(this.pdf.pdfUrl)
  926. loadingTask.promise.then(pdf => {
  927. this.pdf.numPages = pdf.numPages
  928. }).catch(err => {
  929. this.msgError(this.$t('pdf加载失败'))
  930. })
  931. },
  932. // pdf上一页
  933. prePage() {
  934. let page = this.pdf.pageNum
  935. page = page > 1 ? page - 1 : this.pdf.pageTotalNum
  936. this.pdf.pageNum = page
  937. },
  938. // pdf下一页
  939. nextPage() {
  940. let page = this.pdf.pageNum
  941. page = page < this.pdf.pageTotalNum ? page + 1 : 1
  942. this.pdf.pageNum = page
  943. },
  944. }
  945. }
  946. </script>