index.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097
  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="title">
  5. <el-input
  6. v-model="queryParams.title"
  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="['process:moc: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="['process:moc: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="['process:moc: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="['process:moc:edit']"-->
  55. <!--&gt;{{ $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="['process:moc:export']"-->
  64. <!--&gt;{{ $t('导出') }}</el-button>-->
  65. <!--</el-col>-->
  66. <!--<el-col :span="1.5">-->
  67. <!--<el-button-->
  68. <!--type="primary"-->
  69. <!--icon="el-icon-s-data"-->
  70. <!--size="mini"-->
  71. <!--@click="handleData"-->
  72. <!--&gt;{{ $t('数据分析') }}</el-button>-->
  73. <!--</el-col>-->
  74. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  75. </el-row>
  76. <el-row class="colorMark">
  77. <svg-icon icon-class="rectangleLightgreen" class="rectangleLightgreen" style="fill:#000000;"></svg-icon>{{ $t('已移除') }}
  78. <svg-icon icon-class="rectangleFlesh" class="rectangleFlesh"></svg-icon>{{ $t('7天内到期') }}
  79. <svg-icon icon-class="rectangleYellow" class="rectangleYellow"></svg-icon>{{ $t('7-14天内到期') }}
  80. </el-row>
  81. <el-table v-loading="loading"
  82. :data="mocList"
  83. @selection-change="handleSelectionChange"
  84. :cell-style="tableCellStyle"
  85. :cell-class-name="tableCellClassName"
  86. :height="clientHeight"
  87. border
  88. :default-sort = "{prop: 'mocNo', order: 'descending'}">
  89. <el-table-column type="selection" width="55" align="center" />
  90. <el-table-column :label="$t('MOC编号')" align="center" width="120" prop="mocNo" :show-overflow-tooltip="true" sortable/>
  91. <el-table-column :label="$t('公司MOC编号')" align="center" width="120" prop="companyMocNo" :show-overflow-tooltip="true"/>
  92. <el-table-column :label="$t('位置')" align="center" width="120" prop="location" :show-overflow-tooltip="true"/>
  93. <el-table-column :label="$t('标题')" align="center" width="320" prop="title" :show-overflow-tooltip="true"/>
  94. <el-table-column :label="$t('到期时间')" align="center" prop="expTime" :show-overflow-tooltip="true" width="100"/>
  95. <el-table-column :label="$t('临时MOC状态')" align="center" prop="tempState" :formatter="tempStateFormat">
  96. <template slot="header">
  97. <span
  98. @click="tempStateChart.open = true"
  99. id="tempState">
  100. 临时MOC状态
  101. <i class="el-icon-s-data"></i>
  102. </span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column :label="$t('移除时间')" align="center" prop="removeTime" :show-overflow-tooltip="true" width="100"/>
  106. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  107. <el-table-column :label="$t('操作')" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
  108. <template slot-scope="scope">
  109. <el-button
  110. size="mini"
  111. type="text"
  112. icon="el-icon-circle-close"
  113. @click="handleRemove(scope.row)"
  114. v-hasPermi="['process:moc:edit']"
  115. v-if="scope.row.tempState != 0 && scope.row.tempState != '' && scope.row.tempState != null"
  116. >{{ $t('移除') }}</el-button>
  117. <el-button
  118. size="mini"
  119. type="text"
  120. icon="el-icon-edit"
  121. @click="handleUpdate(scope.row)"
  122. v-hasPermi="['process:moc:edit']"
  123. >{{ $t('修改') }}</el-button>
  124. <el-button
  125. size="mini"
  126. type="text"
  127. icon="el-icon-delete"
  128. @click="handleDelete(scope.row)"
  129. v-hasPermi="['process:moc:remove']"
  130. >{{ $t('删除') }}</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. <!-- 添加或修改MOC管理对话框 -->
  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('MOC编号')" prop="mocNo">
  145. <el-input v-model="form.mocNo" :placeholder="$t('请输入') + $t('MOC编号')" />
  146. </el-form-item>
  147. <el-form-item :label="$t('公司MOC编号')" prop="companyMocNo">
  148. <el-input v-model="form.companyMocNo" :placeholder="$t('请输入') + $t('公司MOC编号')" />
  149. </el-form-item>
  150. <el-form-item :label="$t('位置')" prop="location">
  151. <el-input v-model="form.location" :placeholder="$t('请输入') + $t('位置')" />
  152. </el-form-item>
  153. <el-form-item :label="$t('标题')" prop="title">
  154. <el-input v-model="form.title" :placeholder="$t('请输入') + $t('标题')" />
  155. </el-form-item>
  156. <el-form-item :label="$t('到期时间')" prop="mcTime">
  157. <el-date-picker clearable size="small" style="width: 200px"
  158. v-model="form.expTime"
  159. type="date"
  160. value-format="yyyy-MM-dd"
  161. :placeholder="$t('请选择') + $t('到期时间')">
  162. </el-date-picker>
  163. </el-form-item>
  164. <el-form-item :label="$t('临时MOC状态')" prop="mocType">
  165. <el-select v-model="form.tempState" :placeholder="$t('请选择') + $t('临时MOC状态')">
  166. <el-option
  167. v-for="dict in tempStateOptions"
  168. :key="dict.dictValue"
  169. :label="dict.dictLabel"
  170. :value="dict.dictValue"
  171. ></el-option>
  172. </el-select>
  173. </el-form-item>
  174. <el-form-item :label="$t('备注')" prop="remarks">
  175. <el-input v-model="form.remarks" type="textarea" :placeholder="$t('请输入') + $t('备注')" />
  176. </el-form-item>
  177. <el-form-item :label="$t('归属部门')" prop="deptId">
  178. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  179. </el-form-item>
  180. </el-form>
  181. <div slot="footer" class="dialog-footer">
  182. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  183. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  184. </div>
  185. </el-dialog>
  186. <!-- 用户导入对话框 -->
  187. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  188. <el-upload
  189. ref="upload"
  190. :limit="1"
  191. accept=".xlsx, .xls"
  192. :headers="upload.headers"
  193. :action="upload.url"
  194. :disabled="upload.isUploading"
  195. :on-progress="handleFileUploadProgress"
  196. :on-success="handleFileSuccess"
  197. :auto-upload="false"
  198. drag
  199. >
  200. <i class="el-icon-upload"></i>
  201. <div class="el-upload__text">
  202. {{ $t('将文件拖到此处,或') }}
  203. <em>{{ $t('点击上传') }}</em>
  204. </div>
  205. <div class="el-upload__tip" slot="tip">
  206. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  207. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  208. </div>
  209. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  210. <input name="type" :value="upload.type" hidden />
  211. </form>
  212. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  213. </el-upload>
  214. <div slot="footer" class="dialog-footer">
  215. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  216. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  217. </div>
  218. </el-dialog>
  219. <!-- 报告附件对话框 -->
  220. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px" append-to-body >
  221. <el-upload v-hasPermi="['training:trainingrecords:file']"
  222. ref="doc"
  223. :limit="50"
  224. :headers="doc.headers"
  225. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  226. :disabled="doc.isUploading"
  227. :on-progress="handleFileDocProgress"
  228. :on-success="handleFileDocSuccess"
  229. :auto-upload="true"
  230. drag
  231. >
  232. <i class="el-icon-upload"></i>
  233. <div class="el-upload__text">
  234. {{ $t('将文件拖到此处,或') }}
  235. <em>{{ $t('点击上传') }}</em>
  236. </div>
  237. </el-upload>
  238. <el-table :data="doc.commonfileList" border>
  239. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  240. <template slot-scope="scope">
  241. <a class="link-type" @click="handleDownload(scope.row)">
  242. <span>{{ scope.row.fileName }}</span>
  243. </a>
  244. </template>
  245. </el-table-column>
  246. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  247. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  248. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  249. <template slot-scope="scope">
  250. <el-button
  251. v-if="scope.row.fileName.endsWith('pdf')"
  252. size="mini"
  253. type="text"
  254. icon="el-icon-view"
  255. @click="handleSee(scope.row)"
  256. >{{ $t('预览') }}</el-button>
  257. <el-button v-hasPermi="['training:trainingrecords:file']" type="text" size="small" v-if="scope.row.isEdit" @click="save(scope.row)">{{ $t('保存') }}</el-button>
  258. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">{{ $t('取消') }}</el-button>
  259. <!-- <el-button v-hasPermi="['training:trainingrecords:file']" v-if="!scope.row.isEdit" @click="edit(scope.row)" icon="el-icon-edit" type="text" size="mini">编辑</el-button>-->
  260. <el-button
  261. size="mini"
  262. type="text"
  263. icon="el-icon-download"
  264. @click="handleDownload(scope.row)"
  265. >{{ $t('下载') }}</el-button>
  266. <el-button
  267. size="mini"
  268. type="text"
  269. icon="el-icon-delete"
  270. @click="handleDeleteDoc(scope.row)"
  271. v-hasPermi="['training:trainingrecords:file']"
  272. >{{ $t('删除') }}</el-button>
  273. </template>
  274. </el-table-column>
  275. </el-table>
  276. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  277. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  278. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  279. <div style="margin-top: -30px">
  280. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  281. </div>
  282. </el-dialog>
  283. <div slot="footer" class="dialog-footer">
  284. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  285. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  286. </div>
  287. </el-dialog>
  288. <!-- MOC类型说明对话框 -->
  289. <el-dialog v-dialogDrag :title="mocTypeInfo.title" :visible.sync="mocTypeInfo.open" width="1000px" append-to-body>
  290. <el-image
  291. style="width: 947px; height: 394px"
  292. :src="require('@/assets/image/moc/mocTypeInfo.png')"
  293. fit="fill"></el-image>
  294. <div slot="footer" class="dialog-footer">
  295. <el-button type="primary" @click="mocTypeInfo.open = false">{{ $t('确 定') }}</el-button>
  296. </div>
  297. </el-dialog>
  298. </div>
  299. </template>
  300. <script>
  301. import { listPermanent, listTemporary, listAquifier, listFacility, listInterlock, getMoc, delMoc, addMoc, updateMoc, exportMoc } from "@/api/process/moc";
  302. import { treeselect } from "@/api/system/dept";
  303. import { getToken } from "@/utils/auth";
  304. import Treeselect from "@riophae/vue-treeselect";
  305. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  306. import {addCommonfile, allFileList, delCommonfile, updateCommonfile} from "@/api/common/commonfile";
  307. export default {
  308. name: "Facility",
  309. components: { Treeselect },
  310. data() {
  311. var validateDocUpdate = (rule, value, callback) => {
  312. if (value == 1) {
  313. if (this.form.pidMaster == 0 && this.form.sopUpdate == 0) {
  314. return callback(new Error('PID/SOP未更新'));
  315. } else {
  316. return callback();
  317. }
  318. } else {
  319. return callback();
  320. }
  321. };
  322. return {
  323. mocTypeInfo: {
  324. open: false,
  325. title: 'MOC类型说明'
  326. },
  327. drawer: false,
  328. direction: 'rtl',
  329. // 遮罩层
  330. loading: true,
  331. // 选中数组
  332. ids: [],
  333. // 非单个禁用
  334. single: true,
  335. // 非多个禁用
  336. multiple: true,
  337. // 显示搜索条件
  338. showSearch: false,
  339. // 总条数
  340. total: 0,
  341. // MOC管理表格数据
  342. mocList: [],
  343. // 弹出层标题
  344. title: "",
  345. // 部门树选项
  346. deptOptions: undefined,
  347. clientHeight:300,
  348. // 是否显示弹出层
  349. open: false,
  350. // 装置字典
  351. plantCodeOptions: [],
  352. // 类别字典
  353. categoryOptions: [],
  354. // 区域字典
  355. areaOptions: [],
  356. // PID MASTER更新字典
  357. pidMasterOptions: [],
  358. // 临时MOC状态字典
  359. temporaryStateOptions: [],
  360. // 临时MOC状态字典
  361. tempStateOptions: [],
  362. // SOP更新字典
  363. sopUpdateOptions: [],
  364. // 文件更新字典
  365. docUpdateOptions:[],
  366. // 实施情况字典
  367. trueStateOptions: [],
  368. // 变更性质字典
  369. changeNatureOptions: [],
  370. // 风险等级字典
  371. riskLevelOptions: [],
  372. // MOC类型字典
  373. mocTypeOptions: [],
  374. // MC情况字典
  375. mcDetailOptions: [],
  376. //时间选择限制
  377. ehsCheckDate: '',
  378. trainingDatePicker: this.pickerOptionsTraining(),
  379. pssrDatePicker: this.pickerOptionsPssr(),
  380. // 用户导入参数
  381. upload: {
  382. //下载模板请求地址
  383. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  384. //下载模板类型
  385. type: 'moc',
  386. // 是否显示弹出层(用户导入)
  387. open: false,
  388. // 弹出层标题(用户导入)
  389. title: "",
  390. // 是否禁用上传
  391. isUploading: false,
  392. // 是否更新已经存在的用户数据
  393. updateSupport: 0,
  394. // 设置上传的请求头部
  395. headers: { Authorization: "Bearer " + getToken() },
  396. // 上传的地址
  397. url: process.env.VUE_APP_BASE_API + "/process/moc/importData"
  398. },
  399. // 报告附件参数
  400. doc: {
  401. file: "",
  402. // 是否显示弹出层(报告附件)
  403. open: false,
  404. // 弹出层标题(报告附件)
  405. title: "附件",
  406. // 是否禁用上传
  407. isUploading: false,
  408. // 是否更新已经存在的用户数据
  409. updateSupport: 0,
  410. // 报告附件上传位置编号
  411. ids: 0,
  412. // 设置上传的请求头部
  413. headers: { Authorization: "Bearer " + getToken() },
  414. // 上传的地址
  415. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  416. commonfileList: null,
  417. queryParams: {
  418. pId: null,
  419. pType: 'moc'
  420. },
  421. pType: 'moc',
  422. pId: null,
  423. form: {}
  424. },
  425. pdf : {
  426. title: '',
  427. pdfUrl: '',
  428. numPages: null,
  429. open: false,
  430. pageNum: 1,
  431. pageTotalNum: 1,
  432. loadedRatio: 0,
  433. },
  434. // 查询参数
  435. queryParams: {
  436. pageNum: 1,
  437. pageSize: 20,
  438. plantCode: null,
  439. mocNo: null,
  440. plantNumber: null,
  441. noticeLetter: null,
  442. workLetter: null,
  443. cteNo: null,
  444. investCost: null,
  445. category: null,
  446. significance: null,
  447. classification: null,
  448. area: null,
  449. dashControl: null,
  450. title: null,
  451. owner: null,
  452. approveTime: null,
  453. estimateEndtime: null,
  454. endtime: null,
  455. trueState: null,
  456. changeNature: null,
  457. overTime: null,
  458. riskLevel: null,
  459. training: null,
  460. pssr: null,
  461. ehsCheck: null,
  462. ehsDb: null,
  463. pidMaster: null,
  464. pssrDb: null,
  465. capex: null,
  466. remarks: null,
  467. companyMocNo: null,
  468. projectNo: null,
  469. mocType: null,
  470. mcTime: null,
  471. mcDetail: null,
  472. docUpdate: null,
  473. pssrNo: null,
  474. timeliness: null,
  475. tempCategory: null,
  476. expTime: null,
  477. tempState: null,
  478. location: null,
  479. finishDate: null,
  480. },
  481. chartParams: {
  482. year : 2021
  483. },
  484. yearOption: [2020,2021],
  485. // 表单参数
  486. form: {},
  487. // 表单校验
  488. rules: {
  489. mocNo: [
  490. { required: true, message: this.$t('MOC编号') + this.$t('不能为空'), trigger: "change" }
  491. ],
  492. docUpdate: [
  493. // { required: true, message: this.$t('文档更新') + this.$t('不能为空'), trigger: "change" },
  494. { validator: validateDocUpdate, trigger: 'change' }
  495. ],
  496. deptId: [
  497. { required: true, message: this.$t('归属部门') + this.$t('不能为空'), trigger: "change" }
  498. ],
  499. },
  500. };
  501. },
  502. watch: {
  503. // 根据名称筛选部门树
  504. deptName(val) {
  505. this.$refs.tree.filter(val);
  506. }
  507. },
  508. created() {
  509. //设置表格高度对应屏幕高度
  510. this.$nextTick(() => {
  511. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  512. })
  513. this.getList();
  514. this.getTreeselect();
  515. this.getDicts("MC_DETAIL").then(response => {
  516. this.mcDetailOptions = response.data;
  517. });
  518. this.getDicts("MOC_TYPE").then(response => {
  519. this.mocTypeOptions = response.data;
  520. });
  521. this.getDicts("PLANT_DIVIDE").then(response => {
  522. this.plantCodeOptions = response.data;
  523. });
  524. this.getDicts("MOC_CATEGORY").then(response => {
  525. this.categoryOptions = response.data;
  526. });
  527. this.getDicts("MOC_AREA").then(response => {
  528. this.areaOptions = response.data;
  529. });
  530. this.getDicts("YES_NO_EN").then(response => {
  531. this.pidMasterOptions = response.data;
  532. this.sopUpdateOptions = response.data;
  533. this.docUpdateOptions = response.data;
  534. });
  535. this.getDicts("MOC_TEMPORARYSTATE").then(response => {
  536. this.temporaryStateOptions = response.data;
  537. });
  538. this.getDicts("TEMP_STATE").then(response => {
  539. this.tempStateOptions = response.data;
  540. });
  541. this.getDicts("MOC_STATE").then(response => {
  542. this.trueStateOptions = response.data;
  543. });
  544. this.getDicts("MOC_CHANGE").then(response => {
  545. this.changeNatureOptions = response.data;
  546. });
  547. this.getDicts("MOC_RISKLEVEL").then(response => {
  548. this.riskLevelOptions = response.data;
  549. });
  550. },
  551. methods: {
  552. /** 移除按钮操作 */
  553. handleRemove(row) {
  554. this.$confirm(this.$t('是否确认移除?'), this.$t('警告'), {
  555. confirmButtonText: this.$t('确定'),
  556. cancelButtonText: this.$t('取消'),
  557. type: "warning"
  558. }).then(function() {
  559. updateMoc({id: row.id, tempState: 0});
  560. }).then(() => {
  561. this.getList();
  562. this.msgSuccess(this.$t('移除成功'));
  563. })
  564. },
  565. /** 查询MOC管理列表 */
  566. getList() {
  567. this.loading = true;
  568. let _this = this
  569. listFacility(this.queryParams).then(response => {
  570. this.mocList = response.rows;
  571. this.mocList.forEach(function (value,key,arr) {
  572. if (value.overTime == null) {
  573. _this.mocList[key].overTime = "N.A."
  574. }
  575. });
  576. this.total = response.total;
  577. this.loading = false;
  578. });
  579. },
  580. // 单元格样式
  581. tableCellStyle( {row, column, rowIndex, columnIndex} ) {
  582. let today = new Date(); // 当前时间
  583. let expTime = new Date(row.expTime);
  584. if (row.tempState == 0) { // 移除的数据
  585. return "background-color: rgba(146, 208, 80, 1);";
  586. }
  587. if (today.getTime() < expTime.getTime()) {
  588. let difference = expTime.getTime() - today.getTime(); // 时间差
  589. if (row.expTime != null && row.expTime != '') {
  590. if (difference <= 7 * 24 * 60 * 60 * 1000) { // 到期时间 - 当前时间 <= 7
  591. return "background-color: rgba(250, 191, 143, 1);";
  592. } else if (difference >= 7 * 24 * 60 * 60 * 1000
  593. && difference <= 14 * 24 * 60 * 60 * 1000) { // 7 <= 到期时间 - 当前时间 <= 14
  594. return "background-color: rgba(255, 255, 0, 1);";
  595. }
  596. }
  597. }
  598. },
  599. //根据分数显示颜色提示
  600. // tableCellStyle({ row, column, rowIndex, columnIndex }) {
  601. // if (columnIndex == 3 && row.trueState == 10){
  602. // return "color: rgba(45, 58, 79, 0.98) "
  603. // }else if (columnIndex == 3 && row.trueState == 12){
  604. // return "color: rgba(255, 26, 26, 0.98) "
  605. // }else if (columnIndex == 3 && row.trueState == 14){
  606. // return "color: rgba(95, 153, 248, 0.98) "
  607. // }
  608. // },
  609. /** 查询部门下拉树结构 */
  610. getTreeselect() {
  611. treeselect().then(response => {
  612. this.deptOptions = response.data;
  613. });
  614. },
  615. // 装置字典翻译
  616. plantCodeFormat(row, column) {
  617. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  618. },
  619. // 类别字典翻译
  620. categoryFormat(row, column) {
  621. return this.selectDictLabel(this.categoryOptions, row.category);
  622. },
  623. // 实施情况字典翻译
  624. trueStateFormat(row, column) {
  625. return this.selectDictLabel(this.trueStateOptions, row.trueState);
  626. },
  627. // 变更性质字典翻译
  628. changeNatureFormat(row, column) {
  629. return this.selectDictLabel(this.changeNatureOptions, row.changeNature);
  630. },
  631. // 风险等级字典翻译
  632. riskLevelFormat(row, column) {
  633. return this.selectDictLabel(this.riskLevelOptions, row.riskLevel);
  634. },
  635. // 区域字典翻译
  636. areaFormat(row, column) {
  637. return this.selectDictLabel(this.areaOptions, row.area);
  638. },
  639. // PID MASTER更新字典翻译
  640. pidMasterFormat(row, column) {
  641. return this.selectDictLabel(this.pidMasterOptions, row.pidMaster);
  642. },
  643. // 临时MOC状态字典翻译
  644. temporaryStateFormat(row, column) {
  645. return this.selectDictLabel(this.temporaryStateOptions, row.temporaryState);
  646. },
  647. // SOP更新字典翻译
  648. sopUpdateFormat(row, column) {
  649. return this.selectDictLabel(this.sopUpdateOptions, row.sopUpdate);
  650. },
  651. // MC情况字典翻译
  652. mcDetailFormat(row, column) {
  653. return this.selectDictLabel(this.mcDetailOptions, row.mcDetail);
  654. },
  655. // 临时MOC状态字典翻译
  656. tempStateFormat(row, column) {
  657. return this.selectDictLabel(this.tempStateOptions, row.tempState);
  658. },
  659. // MOC类型字典翻译
  660. mocTypeFormat(row, column) {
  661. return this.selectDictLabel(this.mocTypeOptions, row.mocType);
  662. },
  663. // 文件更新字典翻译
  664. docUpdateFormat(row, column) {
  665. return this.selectDictLabel(this.docUpdateOptions, row.docUpdate);
  666. },
  667. // 取消按钮
  668. cancel() {
  669. this.open = false;
  670. this.reset();
  671. },
  672. // 表单重置
  673. reset() {
  674. this.form = {
  675. id: null,
  676. plantCode: null,
  677. mocNo: null,
  678. plantNumber: null,
  679. noticeLetter: null,
  680. workLetter: null,
  681. cteNo: null,
  682. investCost: null,
  683. category: null,
  684. significance: null,
  685. classification: null,
  686. area: null,
  687. dashControl: null,
  688. title: null,
  689. owner: null,
  690. approveTime: null,
  691. estimateEndtime: null,
  692. endtime: null,
  693. trueState: null,
  694. changeNature: null,
  695. overTime: null,
  696. riskLevel: null,
  697. training: null,
  698. pssr: null,
  699. ehsCheck: null,
  700. ehsDb: null,
  701. pidMaster: null,
  702. pssrDb: null,
  703. capex: null,
  704. delFlag: null,
  705. createrCode: null,
  706. createdate: null,
  707. updaterCode: null,
  708. updatedate: null,
  709. deptId: null,
  710. remarks: null,
  711. temporaryState: null,
  712. sopUpdate: null
  713. };
  714. this.resetForm("form");
  715. },
  716. // 限制时间范围
  717. pickerOptionsTraining() {
  718. const self = this
  719. return {
  720. disabledDate(time){
  721. return time.getTime() < new Date(self.form.ehsCheck).getTime()
  722. }
  723. }
  724. },
  725. pickerOptionsPssr() {
  726. const self = this
  727. return {
  728. disabledDate(time){
  729. // if (self.form.training != null) {
  730. // return time.getTime() < new Date(self.form.training).getTime()
  731. // }else {
  732. // return time.getTime() < new Date(self.form.ehsCheck).getTime()
  733. // }
  734. }
  735. }
  736. },
  737. /** 搜索按钮操作 */
  738. handleQuery() {
  739. this.queryParams.pageNum = 1;
  740. this.getList();
  741. },
  742. /** 重置按钮操作 */
  743. resetQuery() {
  744. this.resetForm("queryForm");
  745. this.handleQuery();
  746. },
  747. // 多选框选中数据
  748. handleSelectionChange(selection) {
  749. this.ids = selection.map(item => item.id)
  750. this.single = selection.length!==1
  751. this.multiple = !selection.length
  752. },
  753. /** 新增按钮操作 */
  754. handleAdd() {
  755. this.reset();
  756. this.open = true;
  757. this.title = this.$t('新增') + " " + this.$t('MOC管理');
  758. },
  759. //实施情况Finished变更
  760. changeTrueState(val) {
  761. if (val == 10) {
  762. }else {
  763. this.$refs['form'].clearValidate();
  764. }
  765. },
  766. changeChangeNature(val) {
  767. if (val == 10) {
  768. }else if (val = 12) {
  769. this.$refs['form'].clearValidate();
  770. this.form.temporaryState = "14";
  771. this.form.overTime = "";
  772. }
  773. },
  774. //根据分数显示颜色提示
  775. tableCellClassName({ row, column, rowIndex, columnIndex }) {
  776. if (columnIndex == 13){
  777. return this.changeColor(row.isEhsCheck, row.ehsCheck)
  778. }
  779. if (columnIndex == 14){
  780. return this.changeColor(row.isTraining, row.training)
  781. }
  782. if (columnIndex == 15){
  783. return this.changeColor(row.isPssr, row.pssr)
  784. }
  785. },
  786. changeColor (value, dateValue) {
  787. if (value !== "1" && dateValue !== null){
  788. return 'cellMoc'
  789. }
  790. },
  791. /** 修改按钮操作 */
  792. handleUpdate(row) {
  793. this.reset();
  794. const id = row.id || this.ids
  795. getMoc(id).then(response => {
  796. this.form = response.data;
  797. this.open = true;
  798. this.title = this.$t('修改') + this.$t('MOC管理');
  799. });
  800. },
  801. /** 移除按钮操作 */
  802. handleRemove(row) {
  803. this.$confirm(this.$t('是否确认移除?'), this.$t('警告'), {
  804. confirmButtonText: this.$t('确定'),
  805. cancelButtonText: this.$t('取消'),
  806. type: "warning"
  807. }).then(function() {
  808. updateMoc({id: row.id, tempState: 0});
  809. }).then(() => {
  810. this.getList();
  811. this.msgSuccess(this.$t('移除成功'));
  812. })
  813. },
  814. /** 提交按钮 */
  815. submitForm() {
  816. this.$refs["form"].validate(valid => {
  817. if (valid) {
  818. if (this.form.trueState == "10") {
  819. if (this.form.mocNo != null && this.form.plantNumber != null && this.form.category != null && this.form.significance != null && this.form.classification != null
  820. && this.form.area != null && this.form.title != null && this.form.owner != null && this.form.approveTime != null && this.form.estimateEndtime != null
  821. && this.form.endtime != null && this.form.changeNature != null && this.form.riskLevel != null && this.form.training != null && this.form.pssr != null) {
  822. if (this.form.id != null) {
  823. updateMoc(this.form).then(response => {
  824. this.msgSuccess(this.$t('修改成功'));
  825. this.open = false;
  826. this.getList();
  827. });
  828. } else {
  829. this.form.timeliness = 2;
  830. this.form.tempCategory = 2;
  831. addMoc(this.form).then(response => {
  832. this.msgSuccess(this.$t('新增成功'));
  833. this.open = false;
  834. this.getList();
  835. });
  836. }
  837. } else {
  838. this.msgError(this.$t('存在必填项未填,实施情况修改Finished失败'));
  839. }
  840. }else {
  841. if (this.form.id != null) {
  842. updateMoc(this.form).then(response => {
  843. this.msgSuccess(this.$t('修改成功'));
  844. this.open = false;
  845. this.getList();
  846. });
  847. } else {
  848. this.form.timeliness = 2;
  849. this.form.tempCategory = 2;
  850. addMoc(this.form).then(response => {
  851. this.msgSuccess(this.$t('新增成功'));
  852. this.open = false;
  853. this.getList();
  854. });
  855. }
  856. }
  857. }
  858. });
  859. },
  860. /** 删除按钮操作 */
  861. handleDelete(row) {
  862. const ids = row.id || this.ids;
  863. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  864. confirmButtonText: this.$t('确定'),
  865. cancelButtonText: this.$t('取消'),
  866. type: "warning"
  867. }).then(function() {
  868. return delMoc(ids);
  869. }).then(() => {
  870. this.getList();
  871. this.msgSuccess(this.$t('删除成功'));
  872. })
  873. },
  874. /** 导出按钮操作 */
  875. handleExport() {
  876. const queryParams = this.queryParams;
  877. this.$confirm(this.$t('是否确认导出所有MOC管理数据项?'), this.$t('警告'), {
  878. confirmButtonText: this.$t('确定'),
  879. cancelButtonText: this.$t('取消'),
  880. type: "warning"
  881. }).then(function() {
  882. return exportMoc(queryParams);
  883. }).then(response => {
  884. this.download(response.msg);
  885. })
  886. },
  887. /** 导入按钮操作 */
  888. handleImport() {
  889. this.upload.title = this.$t('用户导入');
  890. this.upload.open = true;
  891. },
  892. /** 下载模板操作 */
  893. importTemplate() {
  894. this.$refs['downloadFileForm'].submit()
  895. },
  896. // 文件上传中处理
  897. handleFileUploadProgress(event, file, fileList) {
  898. this.upload.isUploading = true;
  899. },
  900. // 文件上传成功处理
  901. handleFileSuccess(response, file, fileList) {
  902. this.upload.open = false;
  903. this.upload.isUploading = false;
  904. this.$refs.upload.clearFiles();
  905. if (response.data[0] != null) {
  906. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  907. }else {
  908. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  909. }
  910. this.getList();
  911. },
  912. // 提交上传文件
  913. submitFileForm() {
  914. this.$refs.upload.submit();
  915. },
  916. //数据分析
  917. handleData(){
  918. var now = new Date();
  919. var year = now.getFullYear(); //得到年份
  920. this.yearOption = [year-2 , year-1 ,year]
  921. this.drawer = true
  922. },
  923. /** 报告附件按钮操作 */
  924. handleDoc(row , fileType) {
  925. this.doc.pType = fileType
  926. this.doc.queryParams.pType = fileType
  927. this.doc.id = row.id;
  928. this.doc.title = row.title;
  929. this.doc.open = true;
  930. this.doc.queryParams.pId = row.id
  931. this.doc.pId = row.id
  932. this.getFileList()
  933. this.$nextTick(() => {
  934. this.$refs.doc.clearFiles()
  935. })
  936. },
  937. getFileList (){
  938. allFileList(this.doc.queryParams).then(response => {
  939. response.forEach(element => {
  940. element["isEdit"] = false
  941. });
  942. response.forEach(element => {
  943. element["isAdd"] = false
  944. });
  945. this.doc.commonfileList = response;
  946. });
  947. },
  948. //附件上传中处理
  949. handleFileDocProgress(event, file, fileList) {
  950. this.doc.file = file;
  951. this.doc.isUploading = true;
  952. },
  953. //附件上传成功处理
  954. handleFileDocSuccess(response, file, fileList) {
  955. this.doc.isUploading = false;
  956. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  957. this.getFileList()
  958. },
  959. // 文件下载处理
  960. handleDownload(row) {
  961. var name = row.fileName;
  962. var url = row.fileUrl;
  963. var suffix = url.substring(url.lastIndexOf("."), url.length);
  964. const a = document.createElement('a')
  965. a.setAttribute('download', name)
  966. a.setAttribute('target', '_blank')
  967. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  968. a.click()
  969. },
  970. //pdf预览
  971. openPdf(){
  972. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  973. },
  974. handleSee (row){
  975. this.pdf.open =true
  976. this.pdf.title = row.fileName
  977. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  978. },
  979. // 取消
  980. cancelFile(row, index) {
  981. // 如果是新增的数据
  982. if (row.isAdd) {
  983. this.doc.commonfileList.splice(index, 1)
  984. } else {
  985. // 不是新增的数据 还原数据
  986. for (const i in row.oldRow) {
  987. row[i] = row.oldRow[i]
  988. }
  989. row.isEdit = false
  990. }
  991. },
  992. edit(row) {
  993. // 备份原始数据
  994. row['oldRow'] = JSON.parse(JSON.stringify(row));
  995. this.$nextTick(() => {
  996. row.isEdit = true;
  997. })
  998. },
  999. save(row) {
  1000. row.isEdit = false;
  1001. var that = this;
  1002. that.loading = true;
  1003. this.form = row;
  1004. if (row.isAdd == true) {
  1005. addCommonfile(this.form).then(response => {
  1006. this.msgSuccess(this.$t('新增成功'));
  1007. this.open = false;
  1008. this.getList();
  1009. });
  1010. }else {
  1011. updateCommonfile(this.form).then(response => {
  1012. this.msgSuccess(this.$t('修改成功'));
  1013. this.open = false;
  1014. this.getList();
  1015. });
  1016. }
  1017. },
  1018. /** 删除按钮操作 */
  1019. handleDeleteDoc(row) {
  1020. const ids = row.id || this.ids;
  1021. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1022. confirmButtonText: this.$t('确定'),
  1023. cancelButtonText: this.$t('取消'),
  1024. type: "warning"
  1025. }).then(function() {
  1026. return delCommonfile(ids);
  1027. }).then(() => {
  1028. this.getFileList()
  1029. this.msgSuccess(this.$t('删除成功'));
  1030. })
  1031. },
  1032. }
  1033. };
  1034. </script>
  1035. <style>
  1036. .colorMark {
  1037. color: #6f6f6f;
  1038. text-align: right;
  1039. font-weight:bold;
  1040. font-size: 13px;
  1041. padding-bottom: 5px;
  1042. }
  1043. .rectangleLightgreen {
  1044. width: 40px !important;
  1045. height: 20px !important;
  1046. }
  1047. .rectangleFlesh {
  1048. width: 40px !important;
  1049. height: 20px !important;
  1050. }
  1051. .rectangleYellow {
  1052. width: 40px !important;
  1053. height: 20px !important;
  1054. }
  1055. #moc-type:hover{
  1056. cursor: pointer;
  1057. }
  1058. .text {
  1059. font-size: 14px;
  1060. }
  1061. .item {
  1062. margin-bottom: 18px;
  1063. }
  1064. .clearfix {
  1065. color: #1e1e1e;
  1066. }
  1067. .clearfix:before,
  1068. .clearfix:after {
  1069. display: table;
  1070. content: "";
  1071. }
  1072. .clearfix:after {
  1073. clear: both
  1074. }
  1075. .box-card {
  1076. width: 100%;
  1077. }
  1078. .el-drawer__body {
  1079. overflow: auto;
  1080. }
  1081. .el-drawer__container ::-webkit-scrollbar {
  1082. display: none;
  1083. }
  1084. </style>