index.vue 58 KB

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