index.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索条件 -->
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item label="登记人部门" prop="applicantDept">
  6. <el-form-item prop="applicantDept">
  7. <el-select
  8. clearable
  9. v-model="queryParams.applicantDept"
  10. placeholder="请选择部门">
  11. <el-option
  12. v-for="dict in applicantDeptOptions"
  13. :key="dict.dictValue"
  14. :label="dict.dictLabel"
  15. :value="dict.dictValue"
  16. ></el-option>
  17. </el-select>
  18. </el-form-item>
  19. </el-form-item>
  20. <el-form-item label="登记人班组" prop="applicantTeam">
  21. <el-form-item prop="applicantTeam">
  22. <el-select
  23. clearable
  24. v-model="queryParams.applicantTeam"
  25. placeholder="请选择班组">
  26. <el-option
  27. v-for="dict in applicantTeamOptions"
  28. :key="dict.dictValue"
  29. :label="dict.dictLabel"
  30. :value="dict.dictValue"
  31. ></el-option>
  32. </el-select>
  33. </el-form-item>
  34. </el-form-item>
  35. <el-form-item label="不安全状态" prop="unsafeStatus">
  36. <el-select v-model="queryParams.unsafeStatus" placeholder="请选择不安全状态" clearable>
  37. <el-option
  38. v-for="dict in unsafeStatusOptions"
  39. :key="dict.dictValue"
  40. :label="dict.dictLabel"
  41. :value="dict.dictValue"
  42. ></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="不安全行为" prop="unsafeAction">
  46. <el-select v-model="queryParams.unsafeAction" placeholder="请选择不安全行为" clearable>
  47. <el-option
  48. v-for="dict in unsafeActionOptions"
  49. :key="dict.dictValue"
  50. :label="dict.dictLabel"
  51. :value="dict.dictValue"
  52. ></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item label="申请状态" prop="applyStatus">
  56. <el-select v-model="queryParams.applyStatus" placeholder="请选择申请状态">
  57. <el-option
  58. v-for="dict in applyStatusOptions"
  59. :key="dict.dictValue"
  60. :label="dict.dictLabel"
  61. :value="dict.dictValue"
  62. ></el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item label="问题描述" prop="description">
  66. <el-input
  67. v-model="queryParams.description"
  68. placeholder="请输入问题描述"
  69. clearable
  70. size="small"
  71. />
  72. </el-form-item>
  73. <el-form-item label="登记时间" prop="applyDate">
  74. <el-date-picker
  75. size="small"
  76. style="width: 200px"
  77. v-model="queryParams.applyDate"
  78. type="date"
  79. value-format="yyyy-MM-dd"
  80. placeholder="选择登记时间">
  81. </el-date-picker>
  82. </el-form-item>
  83. <el-form-item label="预计完成时间" prop="estimateFinishDate">
  84. <el-date-picker
  85. size="small"
  86. style="width: 200px"
  87. v-model="queryParams.estimateFinishDate"
  88. type="date"
  89. value-format="yyyy-MM-dd"
  90. placeholder="选择预计完成时间">
  91. </el-date-picker>
  92. </el-form-item>
  93. <el-form-item>
  94. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  95. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  96. </el-form-item>
  97. </el-form>
  98. <!-- 操作按钮 -->
  99. <el-row :gutter="10" class="mb8">
  100. <el-col :span="1.5">
  101. <el-button
  102. type="primary"
  103. icon="el-icon-plus"
  104. size="mini"
  105. @click="handleAdd"
  106. v-hasPermi="['production:apply:add']"
  107. >新增申请单</el-button>
  108. </el-col>
  109. <el-col :span="1.5">
  110. <el-button
  111. type="info"
  112. icon="el-icon-upload2"
  113. size="mini"
  114. @click="handleImport"
  115. v-hasPermi="['production:apply:edit']"
  116. >导入</el-button>
  117. </el-col>
  118. <el-col :span="1.5">
  119. <el-button
  120. type="warning"
  121. icon="el-icon-download"
  122. size="mini"
  123. @click="handleExport"
  124. v-hasPermi="['production:apply:export']"
  125. >导出</el-button>
  126. </el-col>
  127. <el-col :span="1.5">
  128. <el-button
  129. size="mini"
  130. @click="handleAddSai"
  131. v-hasPermi="['production:sai:add']"
  132. >统计至SAI检查台账</el-button>
  133. </el-col>
  134. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  135. </el-row>
  136. <!-- 总表 -->
  137. <el-table v-loading="loading" :data="applyList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  138. <el-table-column type="selection" width="55" align="center" />
  139. <el-table-column label="问题描述" align="center" prop="description" :show-overflow-tooltip="true" width="200"/>
  140. <el-table-column label="申请状态" align="center" prop="applyStatus" :show-overflow-tooltip="true" :formatter="applyStatusFormat"/>
  141. <el-table-column label="登记人部门" align="center" prop="applicantDeptName" :show-overflow-tooltip="true"/>
  142. <el-table-column label="登记人班组" align="center" prop="applicantTeam" :show-overflow-tooltip="true" :formatter="teamFormat"/>
  143. <el-table-column label="登记人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
  144. <el-table-column label="当前处理人" align="center" prop="handlerName" :show-overflow-tooltip="true"/>
  145. <el-table-column label="整改负责人" align="center" prop="executorName" :show-overflow-tooltip="true"/>
  146. <el-table-column label="登记时间" align="center" prop="applyDate" width="100" sortable>
  147. <template slot-scope="scope">
  148. <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100" sortable>
  152. <template slot-scope="scope">
  153. <span>{{ parseTime(scope.row.estimateFinishDate, '{y}-{m}-{d}') }}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="实际完成时间" align="center" prop="actualFinishDate" width="100">
  157. <template slot-scope="scope">
  158. <span>{{ parseTime(scope.row.actualFinishDate, '{y}-{m}-{d}') }}</span>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="是否录入开项系统" align="center" prop="isRecorded" :show-overflow-tooltip="true">
  162. <template slot-scope="scope">
  163. <span>{{ scope.row.isRecorded == 1 ? "是" : "否" }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="开项编号" align="center" prop="recordNo" :show-overflow-tooltip="true"/>
  167. <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  168. <template slot-scope="scope">
  169. <!-- 申请已提交操作 -->
  170. <!-- 申请状态为进行中/待验收 -->
  171. <!-- 当前登录用户为张力飞 -->
  172. <el-button
  173. size="mini"
  174. type="text"
  175. @click="handleDelay(scope.row)"
  176. v-if="(scope.row.applyStatus == 2 || scope.row.applyStatus == 3)
  177. && loginStaffInfo.userId == '20276'"
  178. >延期</el-button>
  179. <!-- 申请状态为待评估/进行中/待验收 -->
  180. <!-- 当前登录用户为处理人(之一)或张力飞 -->
  181. <el-button
  182. size="mini"
  183. type="text"
  184. @click="handleDetail(scope.row)"
  185. icon="el-icon-edit-outline"
  186. v-if="(scope.row.applyStatus == 1 || scope.row.applyStatus == 2 || scope.row.applyStatus == 3)
  187. && ((scope.row.handler.indexOf(loginStaffInfo.userId) != -1) || loginStaffInfo.userId == '20276')"
  188. >处理</el-button>
  189. <!-- 申请状态为已完成/已中止-->
  190. <el-button
  191. size="mini"
  192. type="text"
  193. icon="el-icon-view"
  194. @click="handleDetail(scope.row)"
  195. v-if="scope.row.applyStatus == 4 || scope.row.applyStatus == 5"
  196. >详情</el-button>
  197. <el-button
  198. size="mini"
  199. type="text"
  200. @click="processImg(scope.row.processId)"
  201. v-if="scope.row.applyStatus != 0"
  202. >{{ $t('流程图') }}</el-button>
  203. <!-- 申请未提交操作 -->
  204. <!-- 申请状态为未提交 -->
  205. <!-- 当前登录用户为处理人(之一) -->
  206. <span v-if="scope.row.applyStatus == 0 && scope.row.handler.indexOf(loginStaffInfo.userId) != -1">
  207. <el-button
  208. size="mini"
  209. type="text"
  210. @click="handleSubmit(scope.row)"
  211. v-hasPermi="['production:apply:edit']"
  212. icon="el-icon-s-claim"
  213. >提交申请</el-button>
  214. <!--<el-button-->
  215. <!--size="mini"-->
  216. <!--type="text"-->
  217. <!--icon="el-icon-document"-->
  218. <!--@click="handleDoc(scope.row)"-->
  219. <!--&gt;上传附件</el-button>-->
  220. <el-button
  221. size="mini"
  222. type="text"
  223. icon="el-icon-edit"
  224. @click="handleUpdate(scope.row)"
  225. v-hasPermi="['production:apply:edit']"
  226. >修改</el-button>
  227. <el-button
  228. size="mini"
  229. type="text"
  230. icon="el-icon-delete"
  231. @click="handleDelete(scope.row)"
  232. v-hasPermi="['production:apply:remove']"
  233. >删除</el-button>
  234. </span>
  235. </template>
  236. </el-table-column>
  237. </el-table>
  238. <!-- 分页 -->
  239. <pagination
  240. v-show="total>0"
  241. :total="total"
  242. :page.sync="queryParams.pageNum"
  243. :limit.sync="queryParams.pageSize"
  244. @pagination="getList"
  245. />
  246. <!-- 添加或修改SAI开项管理对话框 -->
  247. <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
  248. <el-form ref="form" :model="form" :rules="rules" label-width="0px">
  249. <el-descriptions title="" :column="3" border>
  250. <el-descriptions-item label="登记人部门">
  251. <el-form-item prop="applicantDept">
  252. <el-select
  253. filterable
  254. clearable
  255. v-model="form.applicantDept"
  256. @change="handleDeptOrTeamChange"
  257. placeholder="请选择部门">
  258. <el-option
  259. v-for="dict in applicantDeptOptions"
  260. :key="dict.dictValue"
  261. :label="dict.dictLabel"
  262. :value="dict.dictValue"
  263. ></el-option>
  264. </el-select>
  265. </el-form-item>
  266. </el-descriptions-item>
  267. <el-descriptions-item label="登记人班组">
  268. <el-form-item prop="applicantTeam">
  269. <el-select
  270. filterable
  271. clearable
  272. v-model="form.applicantTeam"
  273. @change="handleDeptOrTeamChange"
  274. :disabled="applicantTeamDisabled"
  275. placeholder="请选择班组">
  276. <el-option
  277. v-for="dict in applicantTeamOptions"
  278. :key="dict.dictValue"
  279. :label="dict.dictLabel"
  280. :value="dict.dictValue"
  281. ></el-option>
  282. </el-select>
  283. </el-form-item>
  284. </el-descriptions-item>
  285. <el-descriptions-item label="登记人">
  286. <el-form-item prop="applicant">
  287. <el-select
  288. filterable
  289. clearable
  290. v-model="form.applicant"
  291. placeholder="请选择登记人">
  292. <el-option
  293. v-for="dict in applicantOptions"
  294. :key="dict.dictValue"
  295. :label="dict.dictLabel"
  296. :value="dict.dictValue"
  297. ></el-option>
  298. </el-select>
  299. </el-form-item>
  300. </el-descriptions-item>
  301. <el-descriptions-item label="问题描述" :span="3">
  302. <el-form-item prop="description">
  303. <el-input v-model="form.description" placeholder="请输入问题描述" type="textarea" :rows="3" />
  304. </el-form-item>
  305. </el-descriptions-item>
  306. <el-descriptions-item label="SAI级别" :span="1">
  307. <el-form-item prop="saiLevel">
  308. <el-select v-model="form.saiLevel" placeholder="请选择SAI级别">
  309. <el-option key="1" label="1" value="1"></el-option>
  310. <el-option key="2" label="2" value="2"></el-option>
  311. <el-option key="3" label="3" value="3"></el-option>
  312. </el-select>
  313. </el-form-item>
  314. </el-descriptions-item>
  315. <el-descriptions-item label="SAI类别" :span="2">
  316. <el-form-item prop="category">
  317. <el-input v-model="form.category" placeholder="请输入SAI类别" />
  318. </el-form-item>
  319. </el-descriptions-item>
  320. <el-descriptions-item label="隐患" :span="3">
  321. <el-radio v-model="unsafeChoice" label="1" @change="handleUnsafeChoiceChange" style="margin-right: 10px;">不安全状态</el-radio>
  322. <el-form-item prop="unsafeStatus" style="display: inline-block;">
  323. <el-select v-model="form.unsafeStatus" filterable placeholder="请选择不安全状态" :disabled="unsafeStatusDisabled" style="margin-right: 20px;" clearable>
  324. <el-option
  325. v-for="dict in unsafeStatusOptions"
  326. :key="dict.dictValue"
  327. :label="dict.dictLabel"
  328. :value="dict.dictValue"
  329. ></el-option>
  330. </el-select>
  331. </el-form-item>
  332. <el-radio v-model="unsafeChoice" label="2" @change="handleUnsafeChoiceChange" style="margin-right: 10px;">不安全行为</el-radio>
  333. <el-form-item prop="unsafeAction" style="display: inline-block;">
  334. <el-select v-model="form.unsafeAction" filterable placeholder="请选择不安全行为" :disabled="unsafeActionDisabled" clearable>
  335. <el-option
  336. v-for="dict in unsafeActionOptions"
  337. :key="dict.dictValue"
  338. :label="dict.dictLabel"
  339. :value="dict.dictValue"
  340. ></el-option>
  341. </el-select>
  342. </el-form-item>
  343. </el-descriptions-item>
  344. <el-descriptions-item label="附件" :span="3">
  345. <el-form-item label="" prop="fileUrl">
  346. <el-upload
  347. ref="doc"
  348. :limit="5"
  349. :headers="doc.headers"
  350. :action="doc.url"
  351. :disabled="doc.isUploading"
  352. :on-progress="handleFileDocProgress"
  353. :on-success="handleFileDocSuccess"
  354. :on-remove="handleRemove"
  355. :auto-upload="true"
  356. :file-list="fileList"
  357. drag
  358. >
  359. <i class="el-icon-upload"></i>
  360. <div class="el-upload__text">
  361. {{ $t('将文件拖到此处,或') }}
  362. <em>{{ $t('点击上传') }}</em>
  363. </div>
  364. </el-upload>
  365. </el-form-item>
  366. </el-descriptions-item>
  367. <el-descriptions-item label="登记时间">
  368. <el-form-item prop="applyDate">
  369. <el-date-picker
  370. size="small"
  371. style="width: 200px"
  372. v-model="form.applyDate"
  373. type="date"
  374. value-format="yyyy-MM-dd"
  375. placeholder="选择登记时间">
  376. </el-date-picker>
  377. </el-form-item>
  378. </el-descriptions-item>
  379. </el-descriptions>
  380. </el-form>
  381. <div slot="footer" class="dialog-footer">
  382. <el-button type="primary" @click="handleSaveAndSubmit">提 交</el-button>
  383. <el-button @click="submitForm">保 存</el-button>
  384. <el-button @click="cancel">取 消</el-button>
  385. </div>
  386. </el-dialog>
  387. <!-- 延期对话框 -->
  388. <el-dialog :title="title" :visible.sync="delayOpen" width="25%" append-to-body>
  389. <el-form ref="delayForm" :model="delayForm" :rules="delayRules" label-width="136px">
  390. <el-form-item prop="estimateFinishDate" label="预计完成时间">
  391. <el-date-picker
  392. clearable
  393. size="small"
  394. style="width: 200px"
  395. v-model="delayForm.estimateFinishDate"
  396. type="date"
  397. value-format="yyyy-MM-dd"
  398. placeholder="选择预计完成时间">
  399. </el-date-picker>
  400. </el-form-item>
  401. <el-form-item prop="isRecorded" label="是否录入开项系统">
  402. <el-radio v-model="delayForm.isRecorded" label="1" @change="handleIsRecordedChange">是</el-radio>
  403. <el-radio v-model="delayForm.isRecorded" label="0" @change="handleIsRecordedChange">否</el-radio>
  404. </el-form-item>
  405. <el-form-item prop="recordNo" label="开项编号">
  406. <el-input v-model="delayForm.recordNo" placeholder="请输入开项编号" :disabled="recordNoDisabled"/>
  407. </el-form-item>
  408. </el-form>
  409. <div slot="footer" class="dialog-footer">
  410. <el-button type="primary" @click="submitDelayForm">确 定</el-button>
  411. <el-button @click="cancel">取 消</el-button>
  412. </div>
  413. </el-dialog>
  414. <!-- 用户导入对话框 -->
  415. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  416. <el-upload
  417. ref="upload"
  418. :limit="1"
  419. accept=".xlsx, .xls"
  420. :headers="upload.headers"
  421. :action="upload.url"
  422. :disabled="upload.isUploading"
  423. :on-progress="handleFileUploadProgress"
  424. :on-success="handleFileSuccess"
  425. :auto-upload="false"
  426. drag
  427. >
  428. <i class="el-icon-upload"></i>
  429. <div class="el-upload__text">
  430. 将文件拖到此处,或
  431. <em>点击上传</em>
  432. </div>
  433. <div class="el-upload__tip" slot="tip">
  434. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  435. </div>
  436. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  437. <input name="type" :value="upload.type" hidden />
  438. </form>
  439. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  440. </el-upload>
  441. <div slot="footer" class="dialog-footer">
  442. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  443. <el-button @click="upload.open = false">取 消</el-button>
  444. </div>
  445. </el-dialog>
  446. <!-- SAI开项管理流转详情对话框 -->
  447. <sai-apply-detail v-if="saiApplyVisible" ref="saiApplyDetail" @refreshDataList="getList"></sai-apply-detail>
  448. <!-- 流程图对话框 -->
  449. <process-img v-if="processImgVisible" ref="processImg" @refreshDataList="getList"></process-img>
  450. <!-- 附件对话框 -->
  451. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
  452. <el-upload
  453. ref="doc"
  454. :limit="50"
  455. :headers="doc.headers"
  456. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  457. :disabled="doc.isUploading"
  458. :on-progress="handleFileDocProgress"
  459. :on-success="handleFileDocSuccess"
  460. :auto-upload="true"
  461. drag
  462. >
  463. <i class="el-icon-upload"></i>
  464. <div class="el-upload__text">
  465. {{ $t('将文件拖到此处,或') }}
  466. <em>{{ $t('点击上传') }}</em>
  467. </div>
  468. </el-upload>
  469. <el-table :data="doc.commonfileList" border>
  470. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  471. <template slot-scope="scope">
  472. <a class="link-type" @click="handleDownload(scope.row)">
  473. <span>{{ scope.row.fileName }}</span>
  474. </a>
  475. </template>
  476. </el-table-column>
  477. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  478. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  479. <el-table-column :label="$t('上传时间')" align="center" prop="createdate" :show-overflow-tooltip="true" width="120"/>
  480. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  481. <template slot-scope="scope">
  482. <el-button
  483. v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
  484. ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
  485. ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
  486. ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
  487. ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
  488. ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
  489. size="mini"
  490. type="text"
  491. icon="el-icon-view"
  492. @click="handleSee(scope.row)"
  493. > {{ $t('预览') }}</el-button>
  494. <el-button
  495. v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
  496. size="mini"
  497. type="text"
  498. icon="el-icon-view"
  499. @click="handleSeePPT(scope.row)"
  500. > {{ $t('ppt预览') }}</el-button>
  501. <el-button
  502. size="mini"
  503. type="text"
  504. icon="el-icon-download"
  505. @click="handleDownload(scope.row)"
  506. >{{ $t('下载') }}</el-button>
  507. <el-button
  508. size="mini"
  509. type="text"
  510. icon="el-icon-delete"
  511. @click="handleDeleteDoc(scope.row)"
  512. >{{ $t('删除') }}</el-button>
  513. </template>
  514. </el-table-column>
  515. </el-table>
  516. <div slot="footer" class="dialog-footer">
  517. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  518. </div>
  519. </el-dialog>
  520. <!-- 统计至SAI检查台账对话框 -->
  521. <el-dialog title="统计至SAI检查台账" :visible.sync="saiOpen" width="80%" append-to-body>
  522. <el-table v-loading="loading" :data="saiList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  523. <el-table-column type="selection" width="55" align="center" />
  524. <el-table-column label="检查的装置/设施" align="center" prop="plantId" :show-overflow-tooltip="true"/>
  525. <el-table-column label="检查日期/时间" align="center" prop="inspectionDate">
  526. <template slot-scope="scope">
  527. <span>{{ parseTime(scope.row.inspectionDate, '{y}-{m}-{d}') }}</span>
  528. </template>
  529. </el-table-column>
  530. <el-table-column label="识别出的安全问题" align="center" prop="dificiency" :show-overflow-tooltip="true"/>
  531. <el-table-column label="SAI级别" align="center" prop="saiLevel" :show-overflow-tooltip="true" width="100">
  532. <template slot-scope="scope">
  533. <el-select v-model="scope.row.saiLevel" placeholder="请选择">
  534. <el-option key="1" label="1" value="1"></el-option>
  535. <el-option key="2" label="2" value="2"></el-option>
  536. <el-option key="3" label="3" value="3"></el-option>
  537. </el-select>
  538. </template>
  539. </el-table-column>
  540. <el-table-column label="SAI类别" align="center" prop="category" :show-overflow-tooltip="true">
  541. <template slot-scope="scope">
  542. <el-input v-model="scope.row.category" placeholder="请输入" />
  543. </template>
  544. </el-table-column>
  545. <el-table-column label="采取或要采取的措施" align="center" prop="actions" :show-overflow-tooltip="true"/>
  546. <el-table-column label="用户" align="center" prop="userDeptId" :show-overflow-tooltip="true"/>
  547. <el-table-column label="数据来源" align="center" prop="source" :show-overflow-tooltip="true"/>
  548. <el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
  549. </el-table>
  550. <div slot="footer" class="dialog-footer">
  551. <el-button type="primary" @click="submitSaiForm">确 定</el-button>
  552. <el-button @click="cancel">取 消</el-button>
  553. </div>
  554. </el-dialog>
  555. <!-- 预览对话框 -->
  556. <el-dialog v-loading="loadingFlash" element-loading-background="rgba(0,0,0,0.2)" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" :center="true" append-to-body>
  557. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  558. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  559. <div style="margin-top: -30px" >
  560. <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px" v-if="ppt"></iframe>
  561. </div>
  562. <div style="padding: 30px; width: 100%; height: 100%;" >
  563. <el-carousel class="" ref="carousel" arrow="always" v-if="pptView"
  564. height="700px" trigger="click" :autoplay="false" indicator-position="outside">
  565. <el-carousel-item class="lun_img" v-for="item in imgs" v-bind:key="item" >
  566. <img :src="item" width="100%" height="100%" object-fit="cover" />
  567. </el-carousel-item>
  568. </el-carousel>
  569. </div>
  570. </el-dialog>
  571. </div>
  572. </template>
  573. <script>
  574. import { saveAndSubmitApply, submitApply, listApply, getApply, delApply, addApply, updateApply, exportApply, importTemplate} from "@/api/production/apply";
  575. import { addSai } from "@/api/production/sai";
  576. import { treeselect, listDept } from "@/api/system/dept";
  577. import { getToken } from "@/utils/auth";
  578. import Treeselect from "@riophae/vue-treeselect";
  579. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  580. import SaiApplyDetail from "@/views/approve/approveDetail/sai-apply-detail";
  581. import ProcessImg from '@/views/approve/processImg/index';
  582. import { listStaffmgrByDeptAndTeam, getLoginStaffInfo } from "@/api/plant/staffmgr";
  583. import { allFileList, delCommonfile } from "@/api/common/commonfile";
  584. export default {
  585. name: "Apply",
  586. components: { Treeselect, SaiApplyDetail, ProcessImg },
  587. data() {
  588. var validateRecordNo = (rule, value, callback) => {
  589. if (this.delayForm.isRecorded == '1') {
  590. if (this.delayForm.recordNo == null) {
  591. return callback(new Error('开项编号不能为空'));
  592. } else {
  593. return callback();
  594. }
  595. } else {
  596. return callback();
  597. }
  598. };
  599. var validateApplicantTeam = (rule, value, callback) => {
  600. if (this.form.applicantDept == '103') {
  601. if (this.form.applicantTeam == null) {
  602. return callback(new Error('登记人班组不能为空'));
  603. } else {
  604. return callback();
  605. }
  606. } else {
  607. return callback();
  608. }
  609. };
  610. var validateUnsafeStatus = (rule, value, callback) => {
  611. if (this.unsafeChoice == '1') {
  612. if (this.form.unsafeStatus == null) {
  613. return callback(new Error('不安全状态不能为空'));
  614. } else {
  615. return callback();
  616. }
  617. } else {
  618. return callback();
  619. }
  620. };
  621. var validateUnsafeAction = (rule, value, callback) => {
  622. if (this.unsafeChoice == '2') {
  623. if (this.form.unsafeAction == null) {
  624. return callback(new Error('不安全行为不能为空'));
  625. } else {
  626. return callback();
  627. }
  628. } else {
  629. return callback();
  630. }
  631. };
  632. return {
  633. fileList: [],
  634. // 统计至SAI检查台账的数据
  635. saiList: [],
  636. // 是显示用统计至SAI检查台账对话框
  637. saiOpen: false,
  638. // 是否禁用开项编号输入框
  639. recordNoDisabled: true,
  640. // 当前登录员工
  641. loginStaffInfo: {},
  642. //图片集合 打开关闭按钮 等等
  643. imgs:[],
  644. jpgList:[],
  645. ppt:false,
  646. pptView:false,
  647. loadingFlash:false,
  648. doc: {
  649. file: "",
  650. // 是否显示弹出层(报告附件)
  651. open: false,
  652. // 弹出层标题(报告附件)
  653. title: "",
  654. // 是否禁用上传
  655. isUploading: false,
  656. // 是否更新已经存在的用户数据
  657. updateSupport: 0,
  658. // 报告附件上传位置编号
  659. ids: 0,
  660. // 设置上传的请求头部
  661. headers: { Authorization: "Bearer " + getToken() },
  662. // 上传的地址
  663. url: process.env.VUE_APP_BASE_API + "/production/saiFile/uploadFile",
  664. commonfileList: null,
  665. queryParams: {
  666. pId: null,
  667. pType: 'saiApply'
  668. },
  669. pType: 'saiApply',
  670. pId: null
  671. },
  672. // pdf文件参数
  673. pdf : {
  674. title: '',
  675. pdfUrl: '',
  676. numPages: null,
  677. open: false,
  678. pageNum: 1,
  679. pageTotalNum: 1,
  680. loadedRatio: 0,
  681. },
  682. // 遮罩层
  683. loading: true,
  684. // 选中数组
  685. ids: [],
  686. // 非单个禁用
  687. single: true,
  688. // 非多个禁用
  689. multiple: true,
  690. // 显示搜索条件
  691. showSearch: false,
  692. // 总条数
  693. total: 0,
  694. // SAI开项管理表格数据
  695. applyList: [],
  696. // 弹出层标题
  697. title: "",
  698. // 部门树选项
  699. deptOptions: undefined,
  700. clientHeight:300,
  701. // 是否显示弹出层
  702. open: false,
  703. // 是否显示延期弹出层
  704. delayOpen: false,
  705. // 用户导入参数
  706. upload: {
  707. //下载模板请求地址
  708. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  709. //下载模板类型
  710. type: 'saiApply',
  711. // 是否显示弹出层(用户导入)
  712. open: false,
  713. // 弹出层标题(用户导入)
  714. title: "",
  715. // 是否禁用上传
  716. isUploading: false,
  717. // 是否更新已经存在的用户数据
  718. updateSupport: 0,
  719. // 设置上传的请求头部
  720. headers: { Authorization: "Bearer " + getToken() },
  721. // 上传的地址
  722. url: process.env.VUE_APP_BASE_API + "/production/apply/importData"
  723. },
  724. // 查询参数
  725. queryParams: {
  726. pageNum: 1,
  727. pageSize: 20,
  728. saiApplyId: null,
  729. deptId: null,
  730. applyStatus: null,
  731. apNo: null,
  732. processId: null,
  733. applicant: null,
  734. assessor: null,
  735. executor: null,
  736. inspectors: null,
  737. applicantDept: null,
  738. applicantTeam: null,
  739. description: null,
  740. unsafeStatus: null,
  741. unsafeAction: null,
  742. applyDate: null,
  743. taskId: null,
  744. handler: null,
  745. taskName: null,
  746. estimateFinishDate: null,
  747. actualFinishDate: null,
  748. isRecorded: null,
  749. recordNo: null,
  750. reaction: null,
  751. needVe: null,
  752. veItems: null,
  753. veResult: null,
  754. veItemOther: null,
  755. },
  756. // 表单参数
  757. form: {},
  758. // 延期表单参数
  759. delayForm: {},
  760. // 延期表单校验
  761. delayRules: {
  762. estimateFinishDate: [
  763. { required: true, message: this.$t('预计完成时间') + this.$t('不能为空'), trigger: "change" }
  764. ],
  765. isRecorded: [
  766. { required: true, message: this.$t('是否录入开项系统') + this.$t('不能为空'), trigger: "change" }
  767. ],
  768. recordNo: [
  769. { validator: validateRecordNo, trigger: 'change' }
  770. ],
  771. },
  772. // 新增/修改表单校验
  773. rules: {
  774. description: [
  775. { required: true, message: this.$t('问题描述') + this.$t('不能为空'), trigger: "change" }
  776. ],
  777. applicantDept: [
  778. { required: true, message: this.$t('登记人部门') + this.$t('不能为空'), trigger: "change" }
  779. ],
  780. applicantTeam: [
  781. { validator: validateApplicantTeam, trigger: 'change' }
  782. ],
  783. applicant: [
  784. { required: true, message: this.$t('登记人') + this.$t('不能为空'), trigger: "change" }
  785. ],
  786. applyDate: [
  787. { required: true, message: this.$t('记录日期') + this.$t('不能为空'), trigger: "change" }
  788. ],
  789. unsafeStatus: [
  790. { validator: validateUnsafeStatus, trigger: 'change' }
  791. ],
  792. unsafeAction: [
  793. { validator: validateUnsafeAction, trigger: 'change' }
  794. ],
  795. },
  796. // 申请状态字典
  797. applyStatusOptions: [],
  798. // 登记人班组字典
  799. applicantTeamOptions: [],
  800. // 登记人部门列表
  801. applicantDeptOptions: [],
  802. // 登记人列表
  803. applicantOptions: [],
  804. // 不安全状态字典
  805. unsafeStatusOptions: [],
  806. // 不安全行为字典
  807. unsafeActionOptions: [],
  808. // 是否显示SAI开项申请详情对话框
  809. saiApplyVisible: false,
  810. // 是否显示流程图对话框
  811. processImgVisible: null,
  812. // 不安全状态/行为选项
  813. unsafeChoice: '1',
  814. // 是否禁用不安全状态下拉框
  815. unsafeStatusDisabled: false,
  816. // 是否禁用不安全行为下拉框
  817. unsafeActionDisabled: true,
  818. // 是否禁用班组下拉框
  819. applicantTeamDisabled: false,
  820. };
  821. },
  822. watch: {
  823. // 根据名称筛选部门树
  824. deptName(val) {
  825. this.$refs.tree.filter(val);
  826. }
  827. },
  828. created() {
  829. //设置表格高度对应屏幕高度
  830. this.$nextTick(() => {
  831. this.clientHeight = document.body.clientHeight -250
  832. })
  833. this.getList();
  834. this.getTreeselect();
  835. // 加载申请状态字典
  836. this.getDicts("SAI_APPLY_STATUS").then(response => {
  837. this.applyStatusOptions = response.data;
  838. });
  839. // 加载登记人班组字典
  840. this.getDicts("TEAM_DIVIDE").then(response => {
  841. this.applicantTeamOptions = response.data;
  842. });
  843. // 加载登记人部门列表
  844. this.getApplicantDeptOptions();
  845. // 加载登记人列表
  846. this.listStaffmgrByDeptAndTeam(null, null);
  847. // 加载不安全状态字典
  848. this.getDicts("SAI_UNSAFE_STATUS").then(response => {
  849. this.unsafeStatusOptions = response.data;
  850. });
  851. // 加载不安全行为字典
  852. this.getDicts("SAI_UNSAFE_ACTION").then(response => {
  853. this.unsafeActionOptions = response.data;
  854. });
  855. // 加载当前登录员工信息
  856. this.getLoginStaffInfo();
  857. },
  858. methods: {
  859. /** 是否录入开项系统单选按钮值改变事件 */
  860. handleIsRecordedChange() {
  861. if (this.delayForm.isRecorded == '1') {
  862. this.recordNoDisabled = false;
  863. } else if (this.delayForm.isRecorded == '0') {
  864. this.recordNoDisabled = true;
  865. this.delayForm.recordNo = null;
  866. }
  867. },
  868. /** 文件下载处理 */
  869. handleDownload(row) {
  870. var name = row.fileName;
  871. var url = row.fileUrl;
  872. var suffix = url.substring(url.lastIndexOf("."), url.length);
  873. const a = document.createElement('a')
  874. a.setAttribute('download', name)
  875. a.setAttribute('target', '_blank')
  876. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  877. a.click()
  878. },
  879. /** 报告附件按钮操作 */
  880. handleDoc(row) {
  881. this.doc.id = row.saiApplyId;
  882. this.doc.title = "附件";
  883. this.doc.open = true;
  884. this.doc.queryParams.pId = row.saiApplyId
  885. this.doc.pId = row.saiApplyId
  886. this.getFileList()
  887. this.$nextTick(() => {
  888. this.$refs.doc.clearFiles()
  889. })
  890. },
  891. getFileList() {
  892. allFileList(this.doc.queryParams).then(response => {
  893. this.doc.commonfileList = response;
  894. });
  895. },
  896. /** 附件上传中处理 */
  897. handleFileDocProgress(event, file, fileList) {
  898. this.doc.file = file;
  899. this.doc.isUploading = true;
  900. },
  901. // /** 附件上传成功处理 */
  902. // handleFileDocSuccess(response, file, fileList) {
  903. // this.doc.isUploading = false;
  904. // this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  905. // this.getFileList()
  906. // },
  907. //附件上传成功处理
  908. handleFileDocSuccess(response, file, fileList) {
  909. this.doc.isUploading = false;
  910. this.fileList = fileList
  911. if (response.code == 200){
  912. this.$alert(this.$t('导入成功'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  913. }else {
  914. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  915. }
  916. },
  917. handleRemove (file, fileList) {
  918. this.fileList = fileList
  919. },
  920. /** 删除按钮操作 */
  921. handleDeleteDoc(row) {
  922. const ids = row.id || this.ids;
  923. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  924. confirmButtonText: this.$t('确定'),
  925. cancelButtonText: this.$t('取消'),
  926. type: "warning"
  927. }).then(function() {
  928. return delCommonfile(ids);
  929. }).then(() => {
  930. this.getFileList();
  931. this.msgSuccess(this.$t('删除成功'));
  932. })
  933. },
  934. //文件预览
  935. openPdf(){
  936. //ppt就跳路由预览,office就直接打开文件新页面
  937. const didi={ imgs:this.imgs}
  938. if( this.pptView==true&&this.ppt==false){
  939. let routeUrl = this.$router.resolve({
  940. path: "/cpms/index.html#/pptyulan",
  941. query:didi
  942. });
  943. window.open("/cpms/index.html#/pptyulan?id=" + this.pdf.pdfUrl, '_blank')
  944. console.log(this.imgs)
  945. }else {
  946. window.open(this.pdf.pdfUrl)
  947. }
  948. },
  949. handleSeePPT (row){
  950. //ppt预览
  951. this.loadingFlash=true
  952. this.pdf.open =true
  953. this.pdf.title = row.fileName
  954. this.pdf.pdfUrl = row.fileUrl
  955. this.pptView=true
  956. this.ppt=false
  957. const formatDate =new FormData();
  958. formatDate.append("filepath",row.fileUrl)
  959. //调用文件预览api
  960. let res= this.officeConvert.pptConvertCommon(formatDate)
  961. //查看接受的全局方法的返回结果 console.log(res)
  962. //利用.then方法接受Promise对象
  963. res.then((result)=>{
  964. //关闭加载中
  965. this.loadingFlash=false
  966. //成功时直接给地址
  967. this.videoList = result.data.imagePathList
  968. //将返回的地址集合遍历添加到绑定的数组中
  969. this.imgs=[]
  970. for (var key=0;key<this.videoList.length;key++) {
  971. this.imgs.push( process.env.VUE_APP_BASE_API+ this.videoList[key] );
  972. }
  973. }).catch(result => {
  974. //请求失败,关闭loading,pdf地址直接为为空,不显示
  975. this.pdf.pdfUrl =""
  976. this.loadingFlash = false;
  977. })
  978. },
  979. handleSee (row){
  980. //office预览
  981. this.loadingFlash=true
  982. this.pdf.open =true
  983. this.pdf.title = row.fileName
  984. this.pdf.pdfUrl =""
  985. this.pptView=false
  986. this.ppt=true
  987. //如果是PDF等直接可以打开的就不调接口,否则调用接口
  988. if(row.fileName.endsWith('pdf')){
  989. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  990. this.loadingFlash=false
  991. }
  992. else{
  993. const formatDate =new FormData();
  994. formatDate.append("filepath",row.fileUrl)
  995. //调用文件预览api
  996. let res= this.officeConvert.officeConvertCommon(formatDate)
  997. //查看接受的全局方法的返回结果 console.log(res)
  998. //利用.then方法接受Promise对象
  999. res.then((result)=>{
  1000. //关闭加载中
  1001. this.loadingFlash=false
  1002. if(result.msg.includes("csv")){
  1003. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1004. this.$alert(result.msg, this.$t('检查乱码'), { dangerouslyUseHTMLString: true });
  1005. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1006. }else if(result.msg.includes("不存在")){
  1007. //文件不存在时提示
  1008. this.pdf.pdfUrl =""
  1009. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1010. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1011. this.pdf.open =false
  1012. }else if(result.msg.includes("不支持此格式")){
  1013. this.pdf.pdfUrl =""
  1014. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1015. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1016. this.pdf.open =false
  1017. } else{
  1018. //成功时直接给地址
  1019. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1020. }
  1021. // this.$nextTick(() => {
  1022. // const iframe = window.frames['iFrame']
  1023. // const handleLoad = () => {
  1024. // setTimeout(() => {
  1025. // const Do = (iframe.contentWindow || iframe.contentDocument)
  1026. // console.log(Do.document.getElementsByTagName('table')[0])
  1027. // Do.document.getElementsByTagName('table')[0].style.width = "100%"
  1028. // Do.document.getElementsByTagName('table')[0].setAttribute("class","table")
  1029. // }, 500)
  1030. // }
  1031. // iframe.addEventListener('load', handleLoad, true)
  1032. // })
  1033. }).catch(result => {
  1034. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1035. this.pdf.pdfUrl =""
  1036. this.loadingFlash = false;
  1037. })
  1038. }
  1039. },
  1040. /** 加载当前登录员工信息 */
  1041. getLoginStaffInfo() {
  1042. getLoginStaffInfo().then(response => {
  1043. let staff = response.data;
  1044. if (staff != null) {
  1045. this.loginStaffInfo = response.data;
  1046. this.form.applicantDept = staff.unit;
  1047. if (staff.unit == '10') {
  1048. this.form.applicantTeam = staff.team;
  1049. }
  1050. this.form.applicant = staff.userId;
  1051. }
  1052. });
  1053. },
  1054. /** 加载登记人部门列表 */
  1055. getApplicantDeptOptions() {
  1056. // listDept(null).then(response => {
  1057. // let deptList = response.data;
  1058. // this.applicantDeptOptions = [];
  1059. // for (let i = 0; i < deptList.length; i++) {
  1060. // if (deptList[i].deptId == 103 || deptList[i].deptId == 10058 || deptList[i].deptId == 10042) {
  1061. // this.applicantDeptOptions.push({
  1062. // dictLabel: deptList[i].deptName,
  1063. // dictValue: deptList[i].deptId
  1064. // });
  1065. // }
  1066. // }
  1067. // });
  1068. this.applicantDeptOptions.push({ dictLabel: "CBP/C", dictValue: '10' });
  1069. this.applicantDeptOptions.push({ dictLabel: "CTA/B", dictValue: '12' });
  1070. this.applicantDeptOptions.push({ dictLabel: "CTM/B", dictValue: '14' });
  1071. },
  1072. /** 部门/班组值改变事件 */
  1073. handleDeptOrTeamChange() {
  1074. this.applicantOptions = [];
  1075. this.form.applicant = null;
  1076. let applicantDept = this.form.applicantDept;
  1077. if (applicantDept != '10') {
  1078. this.applicantTeamDisabled = true;
  1079. this.form.applicantTeam = null;
  1080. } else {
  1081. this.applicantTeamDisabled = false;
  1082. }
  1083. let applicantTeam = this.form.applicantTeam;
  1084. // 加载登记人列表
  1085. this.listStaffmgrByDeptAndTeam(applicantDept, applicantTeam);
  1086. },
  1087. /** 加载登记人列表 */
  1088. listStaffmgrByDeptAndTeam(applicantDept, applicantTeam) {
  1089. listStaffmgrByDeptAndTeam({
  1090. deptId: applicantDept,
  1091. team: applicantTeam
  1092. }).then(response => {
  1093. let staffList = response.rows;
  1094. this.applicantOptions = [];
  1095. for (let i = 0; i < staffList.length; i++) {
  1096. let staffOption = {
  1097. dictLabel: staffList[i].name,
  1098. dictValue: staffList[i].userId
  1099. }
  1100. this.applicantOptions.push(staffOption);
  1101. }
  1102. });
  1103. },
  1104. /** 不安全行为/状态单选按钮值改变事件 */
  1105. handleUnsafeChoiceChange() {
  1106. if (this.unsafeChoice == '1') {
  1107. this.form.unsafeAction = null;
  1108. this.unsafeStatusDisabled = false;
  1109. this.unsafeActionDisabled = true;
  1110. } else if (this.unsafeChoice == '2') {
  1111. this.form.unsafeStatus = null;
  1112. this.unsafeStatusDisabled = true;
  1113. this.unsafeActionDisabled = false;
  1114. }
  1115. },
  1116. /** 流程图 */
  1117. processImg (processId) {
  1118. this.processImgVisible = true;
  1119. this.$nextTick(() => {
  1120. this.$refs.processImg.init(processId);
  1121. })
  1122. },
  1123. /** 处理延期操作 */
  1124. handleDelay(row) {
  1125. this.reset();
  1126. const saiApplyId = row.saiApplyId || this.ids
  1127. getApply(saiApplyId).then(response => {
  1128. this.delayForm = response.data;
  1129. if (this.delayForm.isRecorded != null) {
  1130. this.delayForm.isRecorded = this.delayForm.isRecorded.toString();
  1131. }
  1132. this.delayOpen = true;
  1133. this.title = "SAI开项申请延期";
  1134. });
  1135. },
  1136. /** 处理/详情操作 */
  1137. handleDetail(row) {
  1138. this.saiApplyVisible = true;
  1139. this.$nextTick(() => {
  1140. this.$refs.saiApplyDetail.init(row.saiApplyId, row.taskId, row.processId, row.taskName);
  1141. });
  1142. },
  1143. /** 提交申请操作 */
  1144. handleSubmit(row) {
  1145. this.$confirm('是否确认提交申请?', "警告", {
  1146. confirmButtonText: "确定",
  1147. cancelButtonText: "取消",
  1148. type: "warning"
  1149. }).then(function() {
  1150. return submitApply(row.saiApplyId);
  1151. }).then(() => {
  1152. this.getList();
  1153. this.msgSuccess("提交申请成功");
  1154. })
  1155. },
  1156. // 申请状态字典翻译
  1157. applyStatusFormat(row, column) {
  1158. return this.selectDictLabel(this.applyStatusOptions, row.applyStatus);
  1159. },
  1160. // 班组字典翻译
  1161. teamFormat(row, column) {
  1162. return this.selectDictLabel(this.applicantTeamOptions, row.applicantTeam);
  1163. },
  1164. /** 查询SAI开项管理列表 */
  1165. getList() {
  1166. this.loading = true;
  1167. getLoginStaffInfo().then(response => {
  1168. let staff = response.data;
  1169. if (staff != null) {
  1170. this.loginStaffInfo = response.data;
  1171. }
  1172. listApply(this.queryParams).then(response => {
  1173. let rows = response.rows;
  1174. this.applyList = [];
  1175. for (let i = 0; i < rows.length; i++) {
  1176. // 当前用户为登记人、评估人、整改负责人或验证人(之一)
  1177. if ((rows[i].applicant != null && rows[i].applicant.indexOf(this.loginStaffInfo.userId) != -1)
  1178. || (rows[i].assessor != null && rows[i].assessor.indexOf(this.loginStaffInfo.userId) != -1)
  1179. || (rows[i].executor != null && rows[i].executor.indexOf(this.loginStaffInfo.userId) != -1)
  1180. || (rows[i].inspectors != null && rows[i].inspectors.indexOf(this.loginStaffInfo.userId) != -1)) {
  1181. this.applyList.push(rows[i]);
  1182. }
  1183. }
  1184. this.total = response.total;
  1185. this.loading = false;
  1186. });
  1187. });
  1188. },
  1189. /** 查询部门下拉树结构 */
  1190. getTreeselect() {
  1191. treeselect().then(response => {
  1192. this.deptOptions = response.data;
  1193. });
  1194. },
  1195. // 取消按钮
  1196. cancel() {
  1197. this.delayOpen = false;
  1198. this.saiOpen = false;
  1199. this.open = false;
  1200. this.reset();
  1201. },
  1202. // 表单重置
  1203. reset() {
  1204. this.form = {
  1205. saiApplyId: null,
  1206. delFlag: null,
  1207. createBy: null,
  1208. createTime: null,
  1209. updateBy: null,
  1210. updateTime: null,
  1211. deptId: null,
  1212. applyStatus: null,
  1213. apNo: null,
  1214. processId: null,
  1215. applicant: null,
  1216. assessor: null,
  1217. executor: null,
  1218. inspectors: null,
  1219. applicantDept: null,
  1220. applicantTeam: null,
  1221. description: null,
  1222. unsafeStatus: null,
  1223. unsafeAction: null,
  1224. applyDate: new Date(),
  1225. taskId: null,
  1226. handler: null,
  1227. taskName: null,
  1228. estimateFinishDate: null,
  1229. actualFinishDate: null,
  1230. isRecorded: null,
  1231. recordNo: null,
  1232. reaction: null,
  1233. needVe: null,
  1234. veItems: null,
  1235. veResult: null,
  1236. veItemOther: null,
  1237. };
  1238. this.resetForm("form");
  1239. },
  1240. /** 搜索按钮操作 */
  1241. handleQuery() {
  1242. this.queryParams.pageNum = 1;
  1243. this.getList();
  1244. },
  1245. /** 重置按钮操作 */
  1246. resetQuery() {
  1247. this.resetForm("queryForm");
  1248. this.handleQuery();
  1249. },
  1250. // 多选框选中数据
  1251. handleSelectionChange(selection) {
  1252. this.ids = selection.map(item => item.saiApplyId)
  1253. this.single = selection.length!==1
  1254. this.multiple = !selection.length
  1255. },
  1256. /** 新增按钮操作 */
  1257. handleAdd() {
  1258. this.reset();
  1259. this.fileList = [];
  1260. this.open = true;
  1261. this.title = "添加SAI开项申请";
  1262. // 加载当前登录员工信息
  1263. this.getLoginStaffInfo();
  1264. this.applicantTeamDisabled = false;
  1265. },
  1266. /** 修改按钮操作 */
  1267. handleUpdate(row) {
  1268. this.reset();
  1269. const saiApplyId = row.saiApplyId || this.ids
  1270. getApply(saiApplyId).then(response => {
  1271. this.form = response.data;
  1272. if (this.form.unsafeStatus != null && this.form.unsafeStatus != "") {
  1273. this.form.unsafeStatus = this.form.unsafeStatus.toString();
  1274. }
  1275. if (this.form.unsafeAction != null && this.form.unsafeAction != "") {
  1276. this.form.unsafeAction = this.form.unsafeAction.toString();
  1277. }
  1278. this.fileList = [];
  1279. if (this.form.files.length > 0) {
  1280. console.log(this.form.files);
  1281. for (let i = 0; i < this.form.files.length; i++) {
  1282. let obj = {}
  1283. obj.name = this.form.files[i].fileName
  1284. obj.response = {};
  1285. obj.response.msg = this.form.files[i].fileUrl
  1286. this.fileList.push(obj)
  1287. }
  1288. }
  1289. this.open = true;
  1290. this.title = "修改SAI开项申请";
  1291. });
  1292. },
  1293. /** 新增/修改保存按钮 */
  1294. submitForm() {
  1295. this.form.files = []
  1296. if (this.fileList.length > 0) {
  1297. for (let i = 0; i < this.fileList.length; i++) {
  1298. let obj = {}
  1299. obj.fileName = this.fileList[i].name
  1300. obj.fileUrl = this.fileList[i].response.msg
  1301. this.form.files.push(obj)
  1302. }
  1303. }
  1304. this.$refs["form"].validate(valid => {
  1305. if (valid) {
  1306. if (this.form.saiApplyId != null) {
  1307. updateApply(this.form).then(response => {
  1308. this.msgSuccess("修改成功");
  1309. this.open = false;
  1310. this.getList();
  1311. });
  1312. } else {
  1313. addApply(this.form).then(response => {
  1314. this.msgSuccess("新增成功");
  1315. this.open = false;
  1316. this.getList();
  1317. });
  1318. }
  1319. }
  1320. });
  1321. },
  1322. /** 新增/修改提交按钮 */
  1323. handleSaveAndSubmit() {
  1324. this.form.files = []
  1325. if (this.fileList.length > 0) {
  1326. for (let i = 0; i < this.fileList.length; i++) {
  1327. let obj = {}
  1328. obj.fileName = this.fileList[i].name
  1329. obj.fileUrl = this.fileList[i].response.msg
  1330. this.form.files.push(obj)
  1331. }
  1332. }
  1333. this.$refs["form"].validate(valid => {
  1334. if (valid) {
  1335. saveAndSubmitApply(this.form).then(response => {
  1336. this.msgSuccess("提交成功");
  1337. this.open = false;
  1338. this.getList();
  1339. });
  1340. }
  1341. });
  1342. },
  1343. /** 统计至SAI检查台账提交按钮 */
  1344. submitSaiForm() {
  1345. for (let i = 0; i < this.saiList.length; i++) {
  1346. this.saiList[i].plantId = 103;
  1347. this.saiList[i].userDept = 103;
  1348. addSai(this.saiList[i]);
  1349. }
  1350. this.msgSuccess("提交成功");
  1351. this.saiOpen = false;
  1352. },
  1353. /** 延期提交按钮 */
  1354. submitDelayForm() {
  1355. this.$refs["delayForm"].validate(valid => {
  1356. if (valid) {
  1357. updateApply(this.delayForm).then(response => {
  1358. this.msgSuccess("延期成功");
  1359. this.delayOpen = false;
  1360. this.getList();
  1361. });
  1362. }
  1363. });
  1364. },
  1365. /** 统计至SAI检查台账按钮操作 */
  1366. handleAddSai(row) {
  1367. const saiApplyIds = row.saiApplyId || this.ids;
  1368. if(saiApplyIds.length != 0) {
  1369. this.saiList = [];
  1370. for (let i = 0; i < saiApplyIds.length; i ++) {
  1371. getApply(saiApplyIds[i]).then(response => {
  1372. let apply = response.data;
  1373. let sai = {};
  1374. sai.saiApplyId = apply.saiApplyId;
  1375. sai.plantId = "CBP/C";
  1376. sai.userDeptId = "CBP/C";
  1377. sai.inspectionDate = apply.applyDate;
  1378. sai.dificiency = apply.description;
  1379. sai.actions = apply.reaction;
  1380. sai.source = "装置";
  1381. sai.deptId = 103;
  1382. sai.saiLevel = apply.saiLevel;
  1383. sai.category = apply.category;
  1384. sai.applicant = apply.applicant;
  1385. sai.applicantName = apply.applicantName;
  1386. this.saiList.push(sai);
  1387. });
  1388. }
  1389. this.saiOpen = true;
  1390. }
  1391. },
  1392. /** 删除按钮操作 */
  1393. handleDelete(row) {
  1394. const saiApplyIds = row.saiApplyId || this.ids;
  1395. this.$confirm('是否确认删除?', "警告", {
  1396. confirmButtonText: "确定",
  1397. cancelButtonText: "取消",
  1398. type: "warning"
  1399. }).then(function() {
  1400. return delApply(saiApplyIds);
  1401. }).then(() => {
  1402. this.getList();
  1403. this.msgSuccess("删除成功");
  1404. })
  1405. },
  1406. /** 导出按钮操作 */
  1407. handleExport() {
  1408. const queryParams = this.queryParams;
  1409. this.$confirm('是否确认导出所有SAI开项管理数据项?', "警告", {
  1410. confirmButtonText: "确定",
  1411. cancelButtonText: "取消",
  1412. type: "warning"
  1413. }).then(function() {
  1414. return exportApply(queryParams);
  1415. }).then(response => {
  1416. this.download(response.msg);
  1417. })
  1418. },
  1419. /** 导入按钮操作 */
  1420. handleImport() {
  1421. this.upload.title = "用户导入";
  1422. this.upload.open = true;
  1423. },
  1424. /** 下载模板操作 */
  1425. importTemplate() {
  1426. this.$refs['downloadFileForm'].submit()
  1427. },
  1428. // 文件上传中处理
  1429. handleFileUploadProgress(event, file, fileList) {
  1430. this.upload.isUploading = true;
  1431. },
  1432. // 文件上传成功处理
  1433. handleFileSuccess(response, file, fileList) {
  1434. this.upload.open = false;
  1435. this.upload.isUploading = false;
  1436. this.$refs.upload.clearFiles();
  1437. if (response.data[0] != null) {
  1438. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1439. }else {
  1440. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1441. }
  1442. this.getList();
  1443. },
  1444. // 提交上传文件
  1445. submitFileForm() {
  1446. this.$refs.upload.submit();
  1447. }
  1448. }
  1449. };
  1450. </script>