index.vue 53 KB

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