index.vue 57 KB

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