index.vue 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016
  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="applyStatusString" placeholder="请选择申请状态" multiple>
  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. v-model="applyDateRange"
  76. type="daterange"
  77. align="right"
  78. unlink-panels
  79. :range-separator="$t('至')"
  80. :start-placeholder="$t('开始日期')"
  81. :end-placeholder="$t('结束日期')"
  82. value-format="yyyy-MM-dd">
  83. </el-date-picker>
  84. </el-form-item>
  85. <el-form-item label="预计完成时间" prop="estimateFinishDate">
  86. <el-date-picker
  87. v-model="estimateFinishDateRange"
  88. type="daterange"
  89. align="right"
  90. unlink-panels
  91. :range-separator="$t('至')"
  92. :start-placeholder="$t('开始日期')"
  93. :end-placeholder="$t('结束日期')"
  94. value-format="yyyy-MM-dd">
  95. </el-date-picker>
  96. </el-form-item>
  97. <el-form-item label="片区" prop="workArea">
  98. <el-select
  99. clearable
  100. multiple
  101. v-model="queryParams.workArea"
  102. placeholder="请选择片区">
  103. <el-option
  104. v-for="dict in workAreaList"
  105. :key="dict"
  106. :label="dict"
  107. :value="dict"
  108. ></el-option>
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item>
  112. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  113. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  114. </el-form-item>
  115. </el-form>
  116. <!-- 操作按钮 -->
  117. <el-row :gutter="10" class="mb8">
  118. <el-col :span="1.5">
  119. <el-button
  120. type="primary"
  121. icon="el-icon-plus"
  122. size="mini"
  123. @click="handleAdd"
  124. v-hasPermi="['production:apply:add']"
  125. >新增申请单</el-button>
  126. </el-col>
  127. <!--<el-col :span="1.5">-->
  128. <!--<el-button-->
  129. <!--type="info"-->
  130. <!--icon="el-icon-upload2"-->
  131. <!--size="mini"-->
  132. <!--@click="handleImport"-->
  133. <!--v-hasPermi="['production:apply:edit']"-->
  134. <!--&gt;导入</el-button>-->
  135. <!--</el-col>-->
  136. <el-col :span="1.5">
  137. <el-button
  138. type="warning"
  139. icon="el-icon-download"
  140. size="mini"
  141. @click="handleExport"
  142. v-hasPermi="['production:apply:export']"
  143. >导出全部</el-button>
  144. </el-col>
  145. <el-col :span="1.5">
  146. <el-button
  147. type="warning"
  148. icon="el-icon-download"
  149. size="mini"
  150. @click="handleExportSelected"
  151. v-hasPermi="['production:apply:export']"
  152. >导出选中数据</el-button>
  153. </el-col>
  154. <el-col :span="1.5">
  155. <el-button
  156. size="mini"
  157. @click="handleAddSai"
  158. v-hasPermi="['production:sai:add']"
  159. >统计至SAI检查台账</el-button>
  160. </el-col>
  161. <el-col :span="1.5">
  162. <el-button
  163. size="mini"
  164. @click="handleAnalysis"
  165. v-hasPermi="['production:sai:list']"
  166. >趋势分析</el-button>
  167. </el-col>
  168. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  169. </el-row>
  170. <!-- 总表 -->
  171. <el-table v-loading="loading" :data="applyList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  172. <el-table-column type="selection" width="55" align="center" />
  173. <el-table-column label="问题描述" align="center" prop="description" :show-overflow-tooltip="true" width="200"/>
  174. <el-table-column label="片区" align="center" prop="workArea" :show-overflow-tooltip="true"/>
  175. <el-table-column label="申请状态" align="center" prop="applyStatus" :show-overflow-tooltip="true">
  176. <template slot-scope="scope">
  177. <span v-if="scope.row.applyStatus == 0"><el-tag type="info">未提交</el-tag></span>
  178. <span v-if="scope.row.applyStatus == 1"><el-tag type="warning">待评估</el-tag></span>
  179. <span v-if="scope.row.applyStatus == 2"><el-tag type="warning">进行中</el-tag></span>
  180. <span v-if="scope.row.applyStatus == 3"><el-tag type="warning">待验收</el-tag></span>
  181. <span v-if="scope.row.applyStatus == 4"><el-tag type="success">已完成</el-tag></span>
  182. <span v-if="scope.row.applyStatus == 5"><el-tag type="info">已取消</el-tag></span>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="登记人部门" align="center" prop="applicantDeptName" :show-overflow-tooltip="true"/>
  186. <el-table-column label="登记人班组" align="center" prop="applicantTeam" :show-overflow-tooltip="true" :formatter="teamFormat"/>
  187. <el-table-column label="登记人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
  188. <el-table-column label="当前处理人" align="center" prop="handlerName" :show-overflow-tooltip="true"/>
  189. <el-table-column label="整改负责人" align="center" prop="executorName" :show-overflow-tooltip="true"/>
  190. <el-table-column label="登记时间" align="center" prop="applyDate" width="100" sortable>
  191. <template slot-scope="scope">
  192. <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="预计完成时间" align="center" prop="estimateFinishDate" width="100" sortable>
  196. <template slot-scope="scope">
  197. <span>{{ parseTime(scope.row.estimateFinishDate, '{y}-{m}-{d}') }}</span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="实际完成时间" align="center" prop="actualFinishDate" width="100">
  201. <template slot-scope="scope">
  202. <span>{{ parseTime(scope.row.actualFinishDate, '{y}-{m}-{d}') }}</span>
  203. </template>
  204. </el-table-column>
  205. <el-table-column label="是否录入开项系统" align="center" prop="isRecorded" :show-overflow-tooltip="true">
  206. <template slot-scope="scope">
  207. <span>{{ scope.row.isRecorded == 1 ? "是" : "否" }}</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="开项编号" align="center" prop="recordNo" :show-overflow-tooltip="true"/>
  211. <el-table-column label="SAI级别" align="center" prop="saiLevel" :show-overflow-tooltip="true"/>
  212. <el-table-column label="SAI类别" align="center" prop="category" :show-overflow-tooltip="true" :formatter="saiCategoryFormat"/>
  213. <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  214. <template slot-scope="scope">
  215. <!-- 申请已提交操作 -->
  216. <!-- 申请状态为进行中/待验收 -->
  217. <!-- 当前登录用户为张力飞 -->
  218. <el-button
  219. size="mini"
  220. type="text"
  221. @click="handleDelay(scope.row)"
  222. v-if="(scope.row.applyStatus == 2 || scope.row.applyStatus == 3)
  223. && loginStaffInfo.userId == '20276'"
  224. >延期</el-button>
  225. <!-- 申请状态为待评估/进行中/待验收 -->
  226. <!-- 当前登录用户为处理人(之一)或张力飞 -->
  227. <el-button
  228. size="mini"
  229. type="text"
  230. @click="handleDetail(scope.row)"
  231. icon="el-icon-edit-outline"
  232. v-if="(scope.row.applyStatus == 1 || scope.row.applyStatus == 2 || scope.row.applyStatus == 3)
  233. && ((scope.row.handler.indexOf(loginStaffInfo.userId) != -1) || loginStaffInfo.userId == '20276')"
  234. >处理</el-button>
  235. <!-- 申请状态为已完成/已中止-->
  236. <el-button
  237. size="mini"
  238. type="text"
  239. icon="el-icon-view"
  240. @click="handleDetail(scope.row)"
  241. v-if="scope.row.applyStatus == 4 || scope.row.applyStatus == 5"
  242. >详情</el-button>
  243. <el-button
  244. size="mini"
  245. type="text"
  246. @click="processImg(scope.row.processId)"
  247. v-if="scope.row.applyStatus != 0"
  248. >{{ $t('流程图') }}</el-button>
  249. <!-- 申请未提交操作 -->
  250. <!-- 申请状态为未提交 -->
  251. <!-- 当前登录用户为处理人(之一) -->
  252. <span v-if="scope.row.applyStatus == 0 && scope.row.handler.indexOf(loginStaffInfo.userId) != -1">
  253. <el-button
  254. size="mini"
  255. type="text"
  256. @click="handleSubmit(scope.row)"
  257. v-hasPermi="['production:apply:edit']"
  258. icon="el-icon-s-claim"
  259. >提交申请</el-button>
  260. <!--<el-button-->
  261. <!--size="mini"-->
  262. <!--type="text"-->
  263. <!--icon="el-icon-document"-->
  264. <!--@click="handleDoc(scope.row)"-->
  265. <!--&gt;上传附件</el-button>-->
  266. <el-button
  267. size="mini"
  268. type="text"
  269. icon="el-icon-edit"
  270. @click="handleUpdate(scope.row)"
  271. v-hasPermi="['production:apply:edit']"
  272. >修改</el-button>
  273. <el-button
  274. size="mini"
  275. type="text"
  276. icon="el-icon-delete"
  277. @click="handleDelete(scope.row)"
  278. v-hasPermi="['production:apply:remove']"
  279. >删除</el-button>
  280. </span>
  281. <span v-if="(scope.row.applyStatus == 1
  282. || scope.row.applyStatus == 2
  283. || scope.row.applyStatus == 3
  284. || scope.row.applyStatus == 4)
  285. && (loginStaffInfo.isMonitor || loginStaffInfo.userId == '20276')">
  286. <el-button
  287. size="mini"
  288. type="text"
  289. icon="el-icon-edit"
  290. @click="handleUpdate2(scope.row)"
  291. v-hasPermi="['production:apply:edit']"
  292. >修改</el-button>
  293. </span>
  294. </template>
  295. </el-table-column>
  296. </el-table>
  297. <!-- 分页 -->
  298. <pagination
  299. v-show="total>0"
  300. :total="total"
  301. :page.sync="queryParams.pageNum"
  302. :limit.sync="queryParams.pageSize"
  303. @pagination="getList"
  304. />
  305. <!-- 添加或修改SAI开项管理对话框 -->
  306. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="60%" append-to-body>
  307. <el-form ref="form" :model="form" :rules="rules" label-width="0px">
  308. <el-descriptions title="" :column="3" border>
  309. <el-descriptions-item label="登记人部门">
  310. <el-form-item prop="applicantDept">
  311. <el-select
  312. filterable
  313. clearable
  314. v-model="form.applicantDept"
  315. @change="handleDeptOrTeamChange"
  316. placeholder="请选择部门">
  317. <el-option
  318. v-for="dict in applicantDeptOptions"
  319. :key="dict.dictValue"
  320. :label="dict.dictLabel"
  321. :value="dict.dictValue"
  322. ></el-option>
  323. </el-select>
  324. </el-form-item>
  325. </el-descriptions-item>
  326. <el-descriptions-item label="登记人班组">
  327. <el-form-item prop="applicantTeam">
  328. <el-select
  329. filterable
  330. clearable
  331. v-model="form.applicantTeam"
  332. @change="handleDeptOrTeamChange"
  333. :disabled="applicantTeamDisabled"
  334. placeholder="请选择班组">
  335. <el-option
  336. v-for="dict in applicantTeamOptions"
  337. :key="dict.dictValue"
  338. :label="dict.dictLabel"
  339. :value="dict.dictValue"
  340. ></el-option>
  341. </el-select>
  342. </el-form-item>
  343. </el-descriptions-item>
  344. <el-descriptions-item label="登记人">
  345. <el-form-item prop="applicant">
  346. <el-select
  347. filterable
  348. clearable
  349. v-model="form.applicant"
  350. placeholder="请选择登记人">
  351. <el-option
  352. v-for="dict in applicantOptions"
  353. :key="dict.dictValue"
  354. :label="dict.dictLabel"
  355. :value="dict.dictValue"
  356. ></el-option>
  357. </el-select>
  358. </el-form-item>
  359. </el-descriptions-item>
  360. <el-descriptions-item label="问题描述" :span="3">
  361. <el-form-item prop="description">
  362. <el-input v-model="form.description" placeholder="请输入问题描述" type="textarea" :rows="3" />
  363. </el-form-item>
  364. </el-descriptions-item>
  365. <el-descriptions-item label="SAI级别" :span="1">
  366. <el-form-item prop="saiLevel">
  367. <el-select v-model="form.saiLevel" placeholder="请选择SAI级别" @change="handleSaiLevelChange">
  368. <el-option key="1" label="1" value="1"></el-option>
  369. <el-option key="2" label="2" value="2"></el-option>
  370. <el-option key="3" label="3" value="3"></el-option>
  371. </el-select>
  372. </el-form-item>
  373. </el-descriptions-item>
  374. <el-descriptions-item label="SAI类别" :span="1">
  375. <el-form-item prop="category">
  376. <el-select
  377. @change="handleSaiCategoryChange"
  378. filterable
  379. clearable
  380. v-model="form.category"
  381. placeholder="请选择SAI类别">
  382. <el-option
  383. v-for="dict in saiCategoryOptions2"
  384. :key="dict.dictValue"
  385. :label="dict.dictLabel"
  386. :value="dict.dictValue"
  387. ></el-option>
  388. </el-select>
  389. </el-form-item>
  390. </el-descriptions-item>
  391. <el-descriptions-item label="片区" :span="1">
  392. <el-form-item prop="workArea">
  393. <el-select
  394. @change="handleSaiCategoryChange"
  395. filterable
  396. clearable
  397. v-model="form.workArea"
  398. placeholder="请选择片区">
  399. <el-option
  400. v-for="dict in workAreaList"
  401. :key="dict"
  402. :label="dict"
  403. :value="dict"
  404. ></el-option>
  405. </el-select>
  406. </el-form-item>
  407. </el-descriptions-item>
  408. <el-descriptions-item label="隐患" :span="3">
  409. <el-radio v-model="unsafeChoice" label="1" @change="handleUnsafeChoiceChange" style="margin-right: 10px;">不安全状态</el-radio>
  410. <el-form-item prop="unsafeStatus" style="display: inline-block;">
  411. <el-select v-model="form.unsafeStatus" filterable placeholder="请选择不安全状态" :disabled="unsafeStatusDisabled" style="margin-right: 20px;" clearable>
  412. <el-option
  413. v-for="dict in unsafeStatusOptions"
  414. :key="dict.dictValue"
  415. :label="dict.dictLabel"
  416. :value="dict.dictValue"
  417. ></el-option>
  418. </el-select>
  419. </el-form-item>
  420. <el-radio v-model="unsafeChoice" label="2" @change="handleUnsafeChoiceChange" style="margin-right: 10px;">不安全行为</el-radio>
  421. <el-form-item prop="unsafeAction" style="display: inline-block;">
  422. <el-select v-model="form.unsafeAction" filterable placeholder="请选择不安全行为" :disabled="unsafeActionDisabled" clearable>
  423. <el-option
  424. v-for="dict in unsafeActionOptions"
  425. :key="dict.dictValue"
  426. :label="dict.dictLabel"
  427. :value="dict.dictValue"
  428. ></el-option>
  429. </el-select>
  430. </el-form-item>
  431. </el-descriptions-item>
  432. <el-descriptions-item label="附件" :span="3">
  433. <el-form-item label="" prop="fileUrl">
  434. <el-upload
  435. ref="doc"
  436. :limit="5"
  437. :headers="doc.headers"
  438. :action="doc.url"
  439. :disabled="doc.isUploading"
  440. :on-progress="handleFileDocProgress"
  441. :on-success="handleFileDocSuccess"
  442. :on-remove="handleRemove"
  443. :auto-upload="true"
  444. :file-list="fileList"
  445. drag
  446. >
  447. <i class="el-icon-upload"></i>
  448. <div class="el-upload__text">
  449. {{ $t('将文件拖到此处,或') }}
  450. <em>{{ $t('点击上传') }}</em>
  451. </div>
  452. </el-upload>
  453. </el-form-item>
  454. <el-table :data="doc.commonfileListApply" border v-if="form.saiApplyId">
  455. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  456. <template slot-scope="scope">
  457. <a class="link-type" @click="handleDownload(scope.row)">
  458. <span>{{ scope.row.fileName }}</span>
  459. </a>
  460. </template>
  461. </el-table-column>
  462. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  463. <template slot-scope="scope">
  464. <el-button
  465. v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
  466. ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
  467. ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
  468. ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
  469. ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
  470. ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
  471. size="mini"
  472. type="text"
  473. icon="el-icon-view"
  474. @click="handleSee(scope.row)"
  475. > {{ $t('预览') }}</el-button>
  476. <el-button
  477. v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
  478. size="mini"
  479. type="text"
  480. icon="el-icon-view"
  481. @click="handleSeePPT(scope.row)"
  482. > {{ $t('ppt预览') }}</el-button>
  483. <el-button
  484. size="mini"
  485. type="text"
  486. icon="el-icon-download"
  487. @click="handleDownload(scope.row)"
  488. >{{ $t('下载') }}</el-button>
  489. </template>
  490. </el-table-column>
  491. </el-table>
  492. </el-descriptions-item>
  493. <el-descriptions-item label="登记时间">
  494. <el-form-item prop="applyDate">
  495. <el-date-picker
  496. size="small"
  497. style="width: 200px"
  498. v-model="form.applyDate"
  499. type="date"
  500. value-format="yyyy-MM-dd"
  501. placeholder="选择登记时间">
  502. </el-date-picker>
  503. </el-form-item>
  504. </el-descriptions-item>
  505. </el-descriptions>
  506. </el-form>
  507. <div slot="footer" class="dialog-footer">
  508. <el-button type="primary" @click="handleSaveAndSubmit" :disabled="submitDisabled">提 交</el-button>
  509. <el-button @click="submitForm" :disabled="submitDisabled">保 存</el-button>
  510. <el-button @click="cancel">取 消</el-button>
  511. </div>
  512. </el-dialog>
  513. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open2" width="60%" append-to-body>
  514. <el-form ref="form" :model="form" :rules="rules" label-width="0px">
  515. <el-descriptions title="" :column="3" border>
  516. <el-descriptions-item label="SAI级别" :span="1">
  517. <el-form-item prop="saiLevel">
  518. <el-select v-model="form.saiLevel" placeholder="请选择SAI级别" @change="handleSaiLevelChange">
  519. <el-option key="1" label="1" value="1"></el-option>
  520. <el-option key="2" label="2" value="2"></el-option>
  521. <el-option key="3" label="3" value="3"></el-option>
  522. </el-select>
  523. </el-form-item>
  524. </el-descriptions-item>
  525. <el-descriptions-item label="SAI类别" :span="1">
  526. <el-form-item prop="category">
  527. <el-select
  528. @change="handleSaiCategoryChange"
  529. filterable
  530. clearable
  531. v-model="form.category"
  532. placeholder="请选择SAI类别">
  533. <el-option
  534. v-for="dict in saiCategoryOptions2"
  535. :key="dict.dictValue"
  536. :label="dict.dictLabel"
  537. :value="dict.dictValue"
  538. ></el-option>
  539. </el-select>
  540. </el-form-item>
  541. </el-descriptions-item>
  542. </el-descriptions>
  543. </el-form>
  544. <div slot="footer" class="dialog-footer">
  545. <el-button @click="submitForm">保 存</el-button>
  546. <el-button @click="cancel">取 消</el-button>
  547. </div>
  548. </el-dialog>
  549. <!-- 延期对话框 -->
  550. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="delayOpen" width="25%" append-to-body>
  551. <el-form ref="delayForm" :model="delayForm" :rules="delayRules" label-width="136px">
  552. <el-form-item prop="estimateFinishDate" label="预计完成时间">
  553. <el-date-picker
  554. clearable
  555. size="small"
  556. style="width: 200px"
  557. v-model="delayForm.estimateFinishDate"
  558. type="date"
  559. value-format="yyyy-MM-dd"
  560. placeholder="选择预计完成时间">
  561. </el-date-picker>
  562. </el-form-item>
  563. <el-form-item prop="isRecorded" label="是否录入开项系统">
  564. <el-radio v-model="delayForm.isRecorded" label="1" @change="handleIsRecordedChange">是</el-radio>
  565. <el-radio v-model="delayForm.isRecorded" label="0" @change="handleIsRecordedChange">否</el-radio>
  566. </el-form-item>
  567. <el-form-item prop="recordNo" label="开项编号">
  568. <el-input v-model="delayForm.recordNo" placeholder="请输入开项编号" :disabled="recordNoDisabled"/>
  569. </el-form-item>
  570. </el-form>
  571. <div slot="footer" class="dialog-footer">
  572. <el-button type="primary" @click="submitDelayForm">确 定</el-button>
  573. <el-button @click="cancel">取 消</el-button>
  574. </div>
  575. </el-dialog>
  576. <!-- 用户导入对话框 -->
  577. <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  578. <el-upload
  579. ref="upload"
  580. :limit="1"
  581. accept=".xlsx, .xls"
  582. :headers="upload.headers"
  583. :action="upload.url"
  584. :disabled="upload.isUploading"
  585. :on-progress="handleFileUploadProgress"
  586. :on-success="handleFileSuccess"
  587. :auto-upload="false"
  588. drag
  589. >
  590. <i class="el-icon-upload"></i>
  591. <div class="el-upload__text">
  592. 将文件拖到此处,或
  593. <em>点击上传</em>
  594. </div>
  595. <div class="el-upload__tip" slot="tip">
  596. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  597. </div>
  598. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  599. <input name="type" :value="upload.type" hidden />
  600. </form>
  601. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  602. </el-upload>
  603. <div slot="footer" class="dialog-footer">
  604. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  605. <el-button @click="upload.open = false">取 消</el-button>
  606. </div>
  607. </el-dialog>
  608. <!-- SAI开项管理流转详情对话框 -->
  609. <sai-apply-detail v-if="saiApplyVisible" ref="saiApplyDetail" @refreshDataList="getList"></sai-apply-detail>
  610. <!-- 流程图对话框 -->
  611. <process-img v-if="processImgVisible" ref="processImg" @refreshDataList="getList"></process-img>
  612. <!-- 附件对话框 -->
  613. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
  614. <el-upload
  615. ref="doc"
  616. :limit="50"
  617. :headers="doc.headers"
  618. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  619. :disabled="doc.isUploading"
  620. :on-progress="handleFileDocProgress"
  621. :on-success="handleFileDocSuccess"
  622. :auto-upload="true"
  623. drag
  624. >
  625. <i class="el-icon-upload"></i>
  626. <div class="el-upload__text">
  627. {{ $t('将文件拖到此处,或') }}
  628. <em>{{ $t('点击上传') }}</em>
  629. </div>
  630. </el-upload>
  631. <el-table :data="doc.commonfileList" border>
  632. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  633. <template slot-scope="scope">
  634. <a class="link-type" @click="handleDownload(scope.row)">
  635. <span>{{ scope.row.fileName }}</span>
  636. </a>
  637. </template>
  638. </el-table-column>
  639. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  640. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  641. <el-table-column :label="$t('上传时间')" align="center" prop="createdate" :show-overflow-tooltip="true" width="120"/>
  642. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  643. <template slot-scope="scope">
  644. <el-button
  645. v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
  646. ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
  647. ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
  648. ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
  649. ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
  650. ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
  651. size="mini"
  652. type="text"
  653. icon="el-icon-view"
  654. @click="handleSee(scope.row)"
  655. > {{ $t('预览') }}</el-button>
  656. <el-button
  657. v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
  658. size="mini"
  659. type="text"
  660. icon="el-icon-view"
  661. @click="handleSeePPT(scope.row)"
  662. > {{ $t('ppt预览') }}</el-button>
  663. <el-button
  664. size="mini"
  665. type="text"
  666. icon="el-icon-download"
  667. @click="handleDownload(scope.row)"
  668. >{{ $t('下载') }}</el-button>
  669. <el-button
  670. size="mini"
  671. type="text"
  672. icon="el-icon-delete"
  673. @click="handleDeleteDoc(scope.row)"
  674. >{{ $t('删除') }}</el-button>
  675. </template>
  676. </el-table-column>
  677. </el-table>
  678. <div slot="footer" class="dialog-footer">
  679. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  680. </div>
  681. </el-dialog>
  682. <!-- 统计至SAI检查台账对话框 -->
  683. <el-dialog :close-on-click-modal="false" title="统计至SAI检查台账" :visible.sync="saiOpen" width="80%" append-to-body>
  684. <el-table v-loading="loading" :data="saiList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  685. <el-table-column type="selection" width="55" align="center" />
  686. <el-table-column label="检查的装置/设施" align="center" prop="plantId" :show-overflow-tooltip="true"/>
  687. <el-table-column label="检查日期/时间" align="center" prop="inspectionDate">
  688. <template slot-scope="scope">
  689. <span>{{ parseTime(scope.row.inspectionDate, '{y}-{m}-{d}') }}</span>
  690. </template>
  691. </el-table-column>
  692. <el-table-column label="识别出的安全问题" align="center" prop="dificiency" :show-overflow-tooltip="true"/>
  693. <el-table-column label="SAI级别" align="center" prop="saiLevel" :show-overflow-tooltip="true" width="100">
  694. <template slot-scope="scope">
  695. <el-select v-model="scope.row.saiLevel" placeholder="请选择">
  696. <el-option key="1" label="1" value="1"></el-option>
  697. <el-option key="2" label="2" value="2"></el-option>
  698. <el-option key="3" label="3" value="3"></el-option>
  699. </el-select>
  700. </template>
  701. </el-table-column>
  702. <el-table-column label="SAI类别" align="center" prop="category" :show-overflow-tooltip="true">
  703. <template slot-scope="scope">
  704. <el-select
  705. filterable
  706. clearable
  707. v-model="scope.row.category"
  708. placeholder="请选择SAI类别">
  709. <el-option
  710. v-for="dict in saiCategoryOptions2"
  711. :key="dict.dictValue"
  712. :label="dict.dictLabel"
  713. :value="dict.dictValue"
  714. ></el-option>
  715. </el-select>
  716. </template>
  717. </el-table-column>
  718. <el-table-column label="采取或要采取的措施" align="center" prop="actions" :show-overflow-tooltip="true"/>
  719. <el-table-column label="用户" align="center" prop="userDeptId" :show-overflow-tooltip="true"/>
  720. <el-table-column label="数据来源" align="center" prop="source" :show-overflow-tooltip="true"/>
  721. <el-table-column label="检查人" align="center" prop="applicantName" :show-overflow-tooltip="true"/>
  722. </el-table>
  723. <div slot="footer" class="dialog-footer">
  724. <el-button type="primary" @click="submitSaiForm">确 定</el-button>
  725. <el-button @click="cancel">取 消</el-button>
  726. </div>
  727. </el-dialog>
  728. <!-- 预览对话框 -->
  729. <el-dialog :close-on-click-modal="false" 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>
  730. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  731. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  732. <div style="margin-top: -30px" >
  733. <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px" v-if="ppt"></iframe>
  734. </div>
  735. <div style="padding: 30px; width: 100%; height: 100%;" >
  736. <el-carousel class="" ref="carousel" arrow="always" v-if="pptView"
  737. height="700px" trigger="click" :autoplay="false" indicator-position="outside">
  738. <el-carousel-item class="lun_img" v-for="item in imgs" v-bind:key="item" >
  739. <img :src="item" width="100%" height="100%" object-fit="cover" />
  740. </el-carousel-item>
  741. </el-carousel>
  742. </div>
  743. </el-dialog>
  744. <!-- 趋势分析对话框 -->
  745. <el-dialog :close-on-click-modal="false" @close="disposeChart" title="趋势分析" :visible.sync="analysisOpen" width="80%" append-to-body>
  746. <el-row>
  747. <el-col :span="12">
  748. <h3 style="text-align: center; margin-bottom: 15px;">四个班组当年提交的SAI数量</h3>
  749. <div id="chart1" style="width:100%; height: 400px; display: inline-block;"></div>
  750. </el-col>
  751. <el-col :span="12">
  752. <h3 style="text-align: center; margin-bottom: 15px;">个人提交数量数据分析图</h3>
  753. <div id="chart2" style="width:100%; height: 400px; display: inline-block;"></div>
  754. </el-col>
  755. </el-row>
  756. <el-row>
  757. <el-col :span="12" style="padding-left: 20px; padding-right: 20px;">
  758. <h3 style="text-align: center; margin-bottom: 15px;">各班组当年至今的提交数量</h3>
  759. <el-table
  760. :data="tableList1"
  761. style="width: 100%"
  762. border>
  763. <el-table-column
  764. prop="name"
  765. label="班组">
  766. </el-table-column>
  767. <el-table-column
  768. prop="value"
  769. label="提交数量">
  770. </el-table-column>
  771. </el-table>
  772. </el-col>
  773. <el-col :span="12" style="padding-left: 20px; padding-right: 20px;">
  774. <h3 style="text-align: center; margin-bottom: 15px;">个人提交排名前六的人名和提交数</h3>
  775. <el-table
  776. :data="tableList2"
  777. style="width: 100%"
  778. border>
  779. <el-table-column
  780. prop="index"
  781. label="排名">
  782. </el-table-column>
  783. <el-table-column
  784. prop="name"
  785. label="人名">
  786. </el-table-column>
  787. <el-table-column
  788. prop="value"
  789. label="提交数">
  790. </el-table-column>
  791. </el-table>
  792. </el-col>
  793. </el-row>
  794. </el-dialog>
  795. </div>
  796. </template>
  797. <script>
  798. import { saveAndSubmitApply, submitApply, listApply, getApply, delApply, addApply, updateApply, exportApply, importTemplate, getTeamAnalysis, getPersonalAnalysis } from "@/api/production/apply";
  799. import { addSai } from "@/api/production/sai";
  800. import { treeselect, listDept } from "@/api/system/dept";
  801. import { getToken } from "@/utils/auth";
  802. import Treeselect from "@riophae/vue-treeselect";
  803. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  804. import SaiApplyDetail from "@/views/approve/approveDetail/sai-apply-detail";
  805. import ProcessImg from '@/views/approve/processImg/index';
  806. import { listStaffmgrByDeptAndTeam, getLoginStaffInfo } from "@/api/plant/staffmgr";
  807. import { allFileList, delCommonfile } from "@/api/common/commonfile";
  808. import { categoryList } from "@/api/production/category";
  809. import { listFile } from "@/api/production/saiApproveFile";
  810. import { selectDevice } from "@/api/invoice/device";
  811. export default {
  812. name: "Apply",
  813. components: { Treeselect, SaiApplyDetail, ProcessImg },
  814. data() {
  815. var validateRecordNo = (rule, value, callback) => {
  816. if (this.delayForm.isRecorded == '1') {
  817. if (this.delayForm.recordNo == null) {
  818. return callback(new Error('开项编号不能为空'));
  819. } else {
  820. return callback();
  821. }
  822. } else {
  823. return callback();
  824. }
  825. };
  826. var validateApplicantTeam = (rule, value, callback) => {
  827. if (!this.applicantTeamDisabled) {
  828. if (this.form.applicantTeam == null) {
  829. return callback(new Error('登记人班组不能为空'));
  830. } else {
  831. return callback();
  832. }
  833. } else {
  834. return callback();
  835. }
  836. };
  837. var validateUnsafeStatus = (rule, value, callback) => {
  838. if (this.unsafeChoice == '1') {
  839. if (this.form.unsafeStatus == null) {
  840. return callback(new Error('不安全状态不能为空'));
  841. } else {
  842. return callback();
  843. }
  844. } else {
  845. return callback();
  846. }
  847. };
  848. var validateUnsafeAction = (rule, value, callback) => {
  849. if (this.unsafeChoice == '2') {
  850. if (this.form.unsafeAction == null) {
  851. return callback(new Error('不安全行为不能为空'));
  852. } else {
  853. return callback();
  854. }
  855. } else {
  856. return callback();
  857. }
  858. };
  859. return {
  860. // 趋势图y轴数值
  861. valueList1: [],
  862. valueList2: [],
  863. // 趋势图x轴日期
  864. dateList1: [],
  865. dateList2: [],
  866. // 趋势图
  867. chart1: null,
  868. chart2: null,
  869. submitDisabled: false,
  870. applyDateRange: [],
  871. estimateFinishDateRange: [],
  872. // SAI类别列表
  873. saiCategoryOptions: [],
  874. saiCategoryOptions2: [],
  875. fileList: [],
  876. // 统计至SAI检查台账的数据
  877. saiList: [],
  878. // 是否显示用统计至SAI检查台账对话框
  879. saiOpen: false,
  880. // 是否显示趋势分析对话框
  881. analysisOpen: false,
  882. // 是否禁用开项编号输入框
  883. recordNoDisabled: true,
  884. // 当前登录员工
  885. loginStaffInfo: {
  886. userId: null,
  887. isMonitor: false
  888. },
  889. //图片集合 打开关闭按钮 等等
  890. imgs:[],
  891. jpgList:[],
  892. ppt:false,
  893. pptView:false,
  894. loadingFlash:false,
  895. doc: {
  896. file: "",
  897. // 是否显示弹出层(报告附件)
  898. open: false,
  899. // 弹出层标题(报告附件)
  900. title: "",
  901. // 是否禁用上传
  902. isUploading: false,
  903. // 是否更新已经存在的用户数据
  904. updateSupport: 0,
  905. // 报告附件上传位置编号
  906. ids: 0,
  907. // 设置上传的请求头部
  908. headers: { Authorization: "Bearer " + getToken() },
  909. // 上传的地址
  910. url: process.env.VUE_APP_BASE_API + "/production/saiFile/uploadFile",
  911. commonfileList: null,
  912. commonfileListApply: null,
  913. queryParams: {
  914. pId: null,
  915. pType: 'saiApply'
  916. },
  917. pType: 'saiApply',
  918. pId: null
  919. },
  920. // pdf文件参数
  921. pdf : {
  922. title: '',
  923. pdfUrl: '',
  924. numPages: null,
  925. open: false,
  926. pageNum: 1,
  927. pageTotalNum: 1,
  928. loadedRatio: 0,
  929. },
  930. // 遮罩层
  931. loading: true,
  932. // 选中数组
  933. ids: [],
  934. // 非单个禁用
  935. single: true,
  936. // 非多个禁用
  937. multiple: true,
  938. // 显示搜索条件
  939. showSearch: false,
  940. // 总条数
  941. total: 0,
  942. // SAI开项管理表格数据
  943. applyList: [],
  944. // 弹出层标题
  945. title: "",
  946. // 部门树选项
  947. deptOptions: undefined,
  948. clientHeight:300,
  949. // 是否显示弹出层
  950. open: false,
  951. open2: false,
  952. // 是否显示延期弹出层
  953. delayOpen: false,
  954. // 用户导入参数
  955. upload: {
  956. //下载模板请求地址
  957. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  958. //下载模板类型
  959. type: 'saiApply',
  960. // 是否显示弹出层(用户导入)
  961. open: false,
  962. // 弹出层标题(用户导入)
  963. title: "",
  964. // 是否禁用上传
  965. isUploading: false,
  966. // 是否更新已经存在的用户数据
  967. updateSupport: 0,
  968. // 设置上传的请求头部
  969. headers: { Authorization: "Bearer " + getToken() },
  970. // 上传的地址
  971. url: process.env.VUE_APP_BASE_API + "/production/apply/importData"
  972. },
  973. // 查询参数
  974. queryParams: {
  975. pageNum: 1,
  976. pageSize: 20,
  977. saiApplyId: null,
  978. deptId: null,
  979. applyStatus: null,
  980. apNo: null,
  981. processId: null,
  982. applicant: null,
  983. assessor: null,
  984. executor: null,
  985. inspectors: null,
  986. applicantDept: null,
  987. applicantTeam: null,
  988. description: null,
  989. unsafeStatus: null,
  990. unsafeAction: null,
  991. applyDate: null,
  992. taskId: null,
  993. handler: null,
  994. taskName: null,
  995. estimateFinishDate: null,
  996. actualFinishDate: null,
  997. isRecorded: null,
  998. recordNo: null,
  999. reaction: null,
  1000. needVe: null,
  1001. veItems: null,
  1002. veResult: null,
  1003. veItemOther: null,
  1004. applyDateStart: null,
  1005. applyDateEnd: null,
  1006. estimateFinishDateStart: null,
  1007. estimateFinishDateEnd: null,
  1008. applyStatusString: [],
  1009. },
  1010. // 表单参数
  1011. form: {},
  1012. // 延期表单参数
  1013. delayForm: {},
  1014. // 延期表单校验
  1015. delayRules: {
  1016. estimateFinishDate: [
  1017. { required: true, message: this.$t('预计完成时间') + this.$t('不能为空'), trigger: "change" }
  1018. ],
  1019. isRecorded: [
  1020. { required: true, message: this.$t('是否录入开项系统') + this.$t('不能为空'), trigger: "change" }
  1021. ],
  1022. recordNo: [
  1023. { validator: validateRecordNo, trigger: 'change' }
  1024. ],
  1025. },
  1026. // 新增/修改表单校验
  1027. rules: {
  1028. description: [
  1029. { required: true, message: this.$t('问题描述') + this.$t('不能为空'), trigger: "change" }
  1030. ],
  1031. applicantDept: [
  1032. { required: true, message: this.$t('登记人部门') + this.$t('不能为空'), trigger: "change" }
  1033. ],
  1034. applicantTeam: [
  1035. { validator: validateApplicantTeam, trigger: 'change' }
  1036. ],
  1037. applicant: [
  1038. { required: true, message: this.$t('登记人') + this.$t('不能为空'), trigger: "change" }
  1039. ],
  1040. applyDate: [
  1041. { required: true, message: this.$t('记录日期') + this.$t('不能为空'), trigger: "change" }
  1042. ],
  1043. workArea: [
  1044. { required: true, message: this.$t('片区') + this.$t('不能为空'), trigger: "change" }
  1045. ],
  1046. unsafeStatus: [
  1047. { validator: validateUnsafeStatus, trigger: 'change' }
  1048. ],
  1049. unsafeAction: [
  1050. { validator: validateUnsafeAction, trigger: 'change' }
  1051. ],
  1052. saiLevel: [
  1053. { required: true, message: this.$t('SAI级别') + this.$t('不能为空'), trigger: "change" }
  1054. ],
  1055. category: [
  1056. { required: true, message: this.$t('SAI类别') + this.$t('不能为空'), trigger: "change" }
  1057. ],
  1058. },
  1059. // 申请状态字典
  1060. applyStatusOptions: [],
  1061. // 登记人班组字典
  1062. applicantTeamOptions: [],
  1063. // 登记人部门列表
  1064. applicantDeptOptions: [],
  1065. // 登记人列表
  1066. applicantOptions: [],
  1067. // 不安全状态字典
  1068. unsafeStatusOptions: [],
  1069. // 不安全行为字典
  1070. unsafeActionOptions: [],
  1071. // 是否显示SAI开项申请详情对话框
  1072. saiApplyVisible: false,
  1073. // 是否显示流程图对话框
  1074. processImgVisible: null,
  1075. // 不安全状态/行为选项
  1076. unsafeChoice: '1',
  1077. // 是否禁用不安全状态下拉框
  1078. unsafeStatusDisabled: false,
  1079. // 是否禁用不安全行为下拉框
  1080. unsafeActionDisabled: true,
  1081. // 是否禁用班组下拉框
  1082. applicantTeamDisabled: false,
  1083. workAreaList: [],
  1084. applyStatusString: [],
  1085. tableList1: [],
  1086. tableList2: [],
  1087. };
  1088. },
  1089. watch: {
  1090. // 根据名称筛选部门树
  1091. deptName(val) {
  1092. this.$refs.tree.filter(val);
  1093. }
  1094. },
  1095. created() {
  1096. //设置表格高度对应屏幕高度
  1097. this.$nextTick(() => {
  1098. this.clientHeight = document.body.clientHeight -250
  1099. })
  1100. this.getList();
  1101. this.getTreeselect();
  1102. // 加载申请状态字典
  1103. this.getDicts("SAI_APPLY_STATUS").then(response => {
  1104. this.applyStatusOptions = response.data;
  1105. });
  1106. // 加载登记人班组字典
  1107. this.getDicts("TEAM_DIVIDE").then(response => {
  1108. this.applicantTeamOptions = response.data;
  1109. });
  1110. // 加载登记人部门列表
  1111. this.getApplicantDeptOptions();
  1112. // 加载登记人列表
  1113. this.listStaffmgrByDeptAndTeam(null, null);
  1114. // 加载不安全状态字典
  1115. this.getDicts("SAI_UNSAFE_STATUS").then(response => {
  1116. this.unsafeStatusOptions = response.data;
  1117. });
  1118. // 加载不安全行为字典
  1119. this.getDicts("SAI_UNSAFE_ACTION").then(response => {
  1120. this.unsafeActionOptions = response.data;
  1121. });
  1122. // 加载当前登录员工信息
  1123. this.getLoginStaffInfo();
  1124. this.getCategoryList();
  1125. this.getWorkAreaList();
  1126. },
  1127. methods: {
  1128. /** 绘制趋势图 */
  1129. draw() {
  1130. },
  1131. /** 销毁趋势图 */
  1132. disposeChart() {
  1133. this.echarts.dispose(this.chart1);
  1134. this.echarts.dispose(this.chart2);
  1135. },
  1136. handleAnalysis() {
  1137. this.analysisOpen = true;
  1138. let teamPieList = [];
  1139. let personalPieList = [];
  1140. this.tableList1 = [];
  1141. this.tableList2 = [];
  1142. getTeamAnalysis().then(response => {
  1143. let data = response.data;
  1144. for (let i = 0; i < data.length; i++) {
  1145. let applicantTeam = data[i].applicantTeam;
  1146. let teamCount = data[i].teamCount;
  1147. teamPieList.push({ value: teamCount, name: applicantTeam + '班'});
  1148. this.tableList1.push({ value: teamCount, name: applicantTeam + '班'});
  1149. }
  1150. this.chart1 = this.echarts.init(document.getElementById("chart1"));
  1151. let option1 = {
  1152. // title: {
  1153. // text: '四个班组当年提交的SAI数量',
  1154. // left: 'center',
  1155. // top: '10%'
  1156. // },
  1157. tooltip: {
  1158. trigger: 'item'
  1159. },
  1160. legend: {
  1161. show: false
  1162. },
  1163. series: [
  1164. {
  1165. type: 'pie',
  1166. radius: ['80%'],
  1167. data: teamPieList,
  1168. emphasis: {
  1169. itemStyle: {
  1170. shadowBlur: 10,
  1171. shadowOffsetX: 0,
  1172. shadowColor: 'rgba(0, 0, 0, 0.5)'
  1173. }
  1174. },
  1175. label: {
  1176. show: false
  1177. }
  1178. }
  1179. ]
  1180. };
  1181. this.chart1.setOption(option1);
  1182. });
  1183. getPersonalAnalysis().then(response => {
  1184. let data = response.data;
  1185. for (let i = 0; i < data.length; i++) {
  1186. let applicantName = data[i].applicantName;
  1187. let applicantCount = data[i].applicantCount;
  1188. personalPieList.push({ value: applicantCount, name: applicantName });
  1189. if (i < 6) {
  1190. this.tableList2.push({ index: i + 1, value: applicantCount, name: applicantName });
  1191. }
  1192. }
  1193. this.chart2 = this.echarts.init(document.getElementById("chart2"));
  1194. let option2 = {
  1195. // title: {
  1196. // text: '个人提交数量数据分析图',
  1197. // left: 'center',
  1198. // top: '10%'
  1199. // },
  1200. tooltip: {
  1201. trigger: 'item'
  1202. },
  1203. legend: {
  1204. show: false
  1205. },
  1206. series: [
  1207. {
  1208. type: 'pie',
  1209. radius: '80%',
  1210. data: personalPieList,
  1211. emphasis: {
  1212. itemStyle: {
  1213. shadowBlur: 10,
  1214. shadowOffsetX: 0,
  1215. shadowColor: 'rgba(0, 0, 0, 0.5)'
  1216. }
  1217. },
  1218. label: {
  1219. show: false
  1220. }
  1221. }
  1222. ]
  1223. };
  1224. this.chart2.setOption(option2);
  1225. });
  1226. },
  1227. getWorkAreaList() {
  1228. selectDevice().then(response => {
  1229. let data = response.data;
  1230. for (let i = 0; i < data.length; i++) {
  1231. this.workAreaList.push(data[i]);
  1232. }
  1233. });
  1234. },
  1235. // 处理SAI级别下拉框选中事件
  1236. handleSaiLevelChange() {
  1237. this.saiCategoryOptions2 = [];
  1238. let saiLevel = this.form.saiLevel;
  1239. let saiCategoryOptionsTemp = [];
  1240. for (let i = 0; i < this.saiCategoryOptions.length; i++) {
  1241. if (saiLevel == 1 && this.saiCategoryOptions[i].dictLabel.indexOf("-1-") != -1) {
  1242. let saiCategoryOption = {
  1243. dictValue: this.saiCategoryOptions[i].dictValue,
  1244. dictLabel: this.saiCategoryOptions[i].dictLabel,
  1245. };
  1246. saiCategoryOptionsTemp.push(saiCategoryOption);
  1247. }
  1248. if (saiLevel == 2 && this.saiCategoryOptions[i].dictLabel.indexOf("-2-") != -1) {
  1249. let saiCategoryOption = {
  1250. dictValue: this.saiCategoryOptions[i].dictValue,
  1251. dictLabel: this.saiCategoryOptions[i].dictLabel,
  1252. };
  1253. saiCategoryOptionsTemp.push(saiCategoryOption);
  1254. }
  1255. if (saiLevel == 3 && this.saiCategoryOptions[i].dictLabel.indexOf("-3-") != -1) {
  1256. let saiCategoryOption = {
  1257. dictValue: this.saiCategoryOptions[i].dictValue,
  1258. dictLabel: this.saiCategoryOptions[i].dictLabel,
  1259. };
  1260. saiCategoryOptionsTemp.push(saiCategoryOption);
  1261. }
  1262. }
  1263. this.saiCategoryOptions2 = saiCategoryOptionsTemp;
  1264. },
  1265. // 处理SAI类别下拉框选中事件
  1266. handleSaiCategoryChange() {
  1267. for (let i = 0; i < this.saiCategoryOptions.length; i++) {
  1268. if (this.form.category == this.saiCategoryOptions[i].dictValue) {
  1269. if (this.saiCategoryOptions[i].dictLabel.indexOf("-1-") != -1) {
  1270. this.form.saiLevel = 1;
  1271. }
  1272. if (this.saiCategoryOptions[i].dictLabel.indexOf("-2-") != -1) {
  1273. this.form.saiLevel = 2;
  1274. }
  1275. if (this.saiCategoryOptions[i].dictLabel.indexOf("-3-") != -1) {
  1276. this.form.saiLevel = 3;
  1277. }
  1278. }
  1279. }
  1280. },
  1281. // SAI类别字典翻译
  1282. saiCategoryFormat(row, column) {
  1283. return this.selectDictLabel(this.saiCategoryOptions, row.category);
  1284. },
  1285. /** 获取SAI类别列表数据 */
  1286. getCategoryList() {
  1287. categoryList().then(response => {
  1288. let data = response.data;
  1289. for (let i = 0; i < data.length; i++) {
  1290. if (data[i].saiCategoryName != null && data[i].saiCategoryName != "") {
  1291. this.saiCategoryOptions.push({
  1292. dictLabel: data[i].saiCategoryName,
  1293. dictValue: data[i].saiCategoryId
  1294. });
  1295. this.saiCategoryOptions2.push({
  1296. dictLabel: data[i].saiCategoryName,
  1297. dictValue: data[i].saiCategoryId
  1298. });
  1299. }
  1300. }
  1301. });
  1302. },
  1303. /** 是否录入开项系统单选按钮值改变事件 */
  1304. handleIsRecordedChange() {
  1305. if (this.delayForm.isRecorded == '1') {
  1306. this.recordNoDisabled = false;
  1307. } else if (this.delayForm.isRecorded == '0') {
  1308. this.recordNoDisabled = true;
  1309. this.delayForm.recordNo = null;
  1310. }
  1311. },
  1312. /** 文件下载处理 */
  1313. handleDownload(row) {
  1314. var name = row.fileName;
  1315. var url = row.fileUrl;
  1316. var suffix = url.substring(url.lastIndexOf("."), url.length);
  1317. const a = document.createElement('a')
  1318. a.setAttribute('download', name)
  1319. a.setAttribute('target', '_blank')
  1320. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  1321. a.click()
  1322. },
  1323. /** 报告附件按钮操作 */
  1324. handleDoc(row) {
  1325. this.doc.id = row.saiApplyId;
  1326. this.doc.title = "附件";
  1327. this.doc.open = true;
  1328. this.doc.queryParams.pId = row.saiApplyId
  1329. this.doc.pId = row.saiApplyId
  1330. this.getFileList()
  1331. this.$nextTick(() => {
  1332. this.$refs.doc.clearFiles()
  1333. })
  1334. },
  1335. getFileList() {
  1336. allFileList(this.doc.queryParams).then(response => {
  1337. this.doc.commonfileList = response;
  1338. });
  1339. },
  1340. /** 附件上传中处理 */
  1341. handleFileDocProgress(event, file, fileList) {
  1342. this.doc.file = file;
  1343. this.doc.isUploading = true;
  1344. },
  1345. // /** 附件上传成功处理 */
  1346. // handleFileDocSuccess(response, file, fileList) {
  1347. // this.doc.isUploading = false;
  1348. // this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1349. // this.getFileList()
  1350. // },
  1351. //附件上传成功处理
  1352. handleFileDocSuccess(response, file, fileList) {
  1353. this.doc.isUploading = false;
  1354. this.fileList = fileList
  1355. if (response.code == 200){
  1356. this.$alert(this.$t('导入成功'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1357. }else {
  1358. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1359. }
  1360. },
  1361. handleRemove (file, fileList) {
  1362. this.fileList = fileList
  1363. },
  1364. /** 删除按钮操作 */
  1365. handleDeleteDoc(row) {
  1366. const ids = row.id || this.ids;
  1367. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1368. confirmButtonText: this.$t('确定'),
  1369. cancelButtonText: this.$t('取消'),
  1370. type: "warning"
  1371. }).then(function() {
  1372. return delCommonfile(ids);
  1373. }).then(() => {
  1374. this.getFileList();
  1375. this.msgSuccess(this.$t('删除成功'));
  1376. })
  1377. },
  1378. //文件预览
  1379. openPdf(){
  1380. //ppt就跳路由预览,office就直接打开文件新页面
  1381. const didi={ imgs:this.imgs}
  1382. if( this.pptView==true&&this.ppt==false){
  1383. let routeUrl = this.$router.resolve({
  1384. path: "/cpms/index.html#/pptyulan",
  1385. query:didi
  1386. });
  1387. window.open("/cpms/index.html#/pptyulan?id=" + this.pdf.pdfUrl, '_blank')
  1388. console.log(this.imgs)
  1389. }else {
  1390. window.open(this.pdf.pdfUrl)
  1391. }
  1392. },
  1393. handleSeePPT (row){
  1394. //ppt预览
  1395. this.loadingFlash=true
  1396. this.pdf.open =true
  1397. this.pdf.title = row.fileName
  1398. this.pdf.pdfUrl = row.fileUrl
  1399. this.pptView=true
  1400. this.ppt=false
  1401. const formatDate =new FormData();
  1402. formatDate.append("filepath",row.fileUrl)
  1403. //调用文件预览api
  1404. let res= this.officeConvert.pptConvertCommon(formatDate)
  1405. //查看接受的全局方法的返回结果 console.log(res)
  1406. //利用.then方法接受Promise对象
  1407. res.then((result)=>{
  1408. //关闭加载中
  1409. this.loadingFlash=false
  1410. //成功时直接给地址
  1411. this.videoList = result.data.imagePathList
  1412. //将返回的地址集合遍历添加到绑定的数组中
  1413. this.imgs=[]
  1414. for (var key=0;key<this.videoList.length;key++) {
  1415. this.imgs.push( process.env.VUE_APP_BASE_API+ this.videoList[key] );
  1416. }
  1417. }).catch(result => {
  1418. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1419. this.pdf.pdfUrl =""
  1420. this.loadingFlash = false;
  1421. })
  1422. },
  1423. handleSee (row){
  1424. //office预览
  1425. this.loadingFlash=true
  1426. this.pdf.open =true
  1427. this.pdf.title = row.fileName
  1428. this.pdf.pdfUrl =""
  1429. this.pptView=false
  1430. this.ppt=true
  1431. //如果是PDF等直接可以打开的就不调接口,否则调用接口
  1432. if(row.fileName.endsWith('pdf')){
  1433. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  1434. this.loadingFlash=false
  1435. }
  1436. else{
  1437. const formatDate =new FormData();
  1438. formatDate.append("filepath",row.fileUrl)
  1439. //调用文件预览api
  1440. let res= this.officeConvert.officeConvertCommon(formatDate)
  1441. //查看接受的全局方法的返回结果 console.log(res)
  1442. //利用.then方法接受Promise对象
  1443. res.then((result)=>{
  1444. //关闭加载中
  1445. this.loadingFlash=false
  1446. if(result.msg.includes("csv")){
  1447. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1448. this.$alert(result.msg, this.$t('检查乱码'), { dangerouslyUseHTMLString: true });
  1449. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1450. }else if(result.msg.includes("不存在")){
  1451. //文件不存在时提示
  1452. this.pdf.pdfUrl =""
  1453. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1454. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1455. this.pdf.open =false
  1456. }else if(result.msg.includes("不支持此格式")){
  1457. this.pdf.pdfUrl =""
  1458. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1459. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1460. this.pdf.open =false
  1461. } else{
  1462. //成功时直接给地址
  1463. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1464. }
  1465. // this.$nextTick(() => {
  1466. // const iframe = window.frames['iFrame']
  1467. // const handleLoad = () => {
  1468. // setTimeout(() => {
  1469. // const Do = (iframe.contentWindow || iframe.contentDocument)
  1470. // console.log(Do.document.getElementsByTagName('table')[0])
  1471. // Do.document.getElementsByTagName('table')[0].style.width = "100%"
  1472. // Do.document.getElementsByTagName('table')[0].setAttribute("class","table")
  1473. // }, 500)
  1474. // }
  1475. // iframe.addEventListener('load', handleLoad, true)
  1476. // })
  1477. }).catch(result => {
  1478. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1479. this.pdf.pdfUrl =""
  1480. this.loadingFlash = false;
  1481. })
  1482. }
  1483. },
  1484. /** 加载当前登录员工信息 */
  1485. getLoginStaffInfo() {
  1486. getLoginStaffInfo().then(response => {
  1487. let staff = response.data;
  1488. if (staff != null) {
  1489. this.loginStaffInfo = response.data;
  1490. if (this.loginStaffInfo.actualpost == '12' || this.loginStaffInfo.actualpost == '34') {
  1491. this.loginStaffInfo.isMonitor = true;
  1492. }
  1493. this.form.applicantDept = staff.unit;
  1494. if (staff.unit == '10') {
  1495. this.form.applicantTeam = staff.team;
  1496. }
  1497. this.form.applicant = staff.userId;
  1498. }
  1499. });
  1500. },
  1501. /** 加载登记人部门列表 */
  1502. getApplicantDeptOptions() {
  1503. // listDept(null).then(response => {
  1504. // let deptList = response.data;
  1505. // this.applicantDeptOptions = [];
  1506. // for (let i = 0; i < deptList.length; i++) {
  1507. // if (deptList[i].deptId == 103 || deptList[i].deptId == 10058 || deptList[i].deptId == 10042) {
  1508. // this.applicantDeptOptions.push({
  1509. // dictLabel: deptList[i].deptName,
  1510. // dictValue: deptList[i].deptId
  1511. // });
  1512. // }
  1513. // }
  1514. // });
  1515. this.applicantDeptOptions.push({ dictLabel: "CBP/C", dictValue: '10' });
  1516. this.applicantDeptOptions.push({ dictLabel: "CTA/B", dictValue: '12' });
  1517. this.applicantDeptOptions.push({ dictLabel: "CTM/B", dictValue: '14' });
  1518. },
  1519. /** 部门/班组值改变事件 */
  1520. handleDeptOrTeamChange() {
  1521. this.applicantOptions = [];
  1522. this.form.applicant = null;
  1523. let applicantDept = this.form.applicantDept;
  1524. if (applicantDept != '10') {
  1525. this.applicantTeamDisabled = true;
  1526. this.form.applicantTeam = null;
  1527. } else {
  1528. this.applicantTeamDisabled = false;
  1529. }
  1530. let applicantTeam = this.form.applicantTeam;
  1531. // 加载登记人列表
  1532. this.listStaffmgrByDeptAndTeam(applicantDept, null);
  1533. },
  1534. /** 加载登记人列表 */
  1535. listStaffmgrByDeptAndTeam(applicantDept, applicantTeam) {
  1536. listStaffmgrByDeptAndTeam({
  1537. deptId: applicantDept,
  1538. team: applicantTeam
  1539. }).then(response => {
  1540. let staffList = response.rows;
  1541. this.applicantOptions = [];
  1542. for (let i = 0; i < staffList.length; i++) {
  1543. let staffOption = {
  1544. dictLabel: staffList[i].name,
  1545. dictValue: staffList[i].userId
  1546. }
  1547. this.applicantOptions.push(staffOption);
  1548. }
  1549. });
  1550. },
  1551. /** 不安全行为/状态单选按钮值改变事件 */
  1552. handleUnsafeChoiceChange() {
  1553. if (this.unsafeChoice == '1') {
  1554. this.form.unsafeAction = null;
  1555. this.unsafeStatusDisabled = false;
  1556. this.unsafeActionDisabled = true;
  1557. } else if (this.unsafeChoice == '2') {
  1558. this.form.unsafeStatus = null;
  1559. this.unsafeStatusDisabled = true;
  1560. this.unsafeActionDisabled = false;
  1561. }
  1562. },
  1563. /** 流程图 */
  1564. processImg (processId) {
  1565. this.processImgVisible = true;
  1566. this.$nextTick(() => {
  1567. this.$refs.processImg.init(processId);
  1568. })
  1569. },
  1570. /** 处理延期操作 */
  1571. handleDelay(row) {
  1572. this.reset();
  1573. const saiApplyId = row.saiApplyId || this.ids
  1574. getApply(saiApplyId).then(response => {
  1575. this.delayForm = response.data;
  1576. if (this.delayForm.isRecorded != null) {
  1577. this.delayForm.isRecorded = this.delayForm.isRecorded.toString();
  1578. }
  1579. this.delayOpen = true;
  1580. this.title = "SAI开项申请延期";
  1581. });
  1582. },
  1583. /** 处理/详情操作 */
  1584. handleDetail(row) {
  1585. this.saiApplyVisible = true;
  1586. this.$nextTick(() => {
  1587. this.$refs.saiApplyDetail.init(row.saiApplyId, row.taskId, row.processId, row.taskName);
  1588. });
  1589. },
  1590. /** 提交申请操作 */
  1591. handleSubmit(row) {
  1592. this.$confirm('是否确认提交申请?', "警告", {
  1593. confirmButtonText: "确定",
  1594. cancelButtonText: "取消",
  1595. type: "warning"
  1596. }).then(function() {
  1597. return submitApply(row.saiApplyId);
  1598. }).then(() => {
  1599. this.getList();
  1600. this.msgSuccess("提交申请成功");
  1601. })
  1602. },
  1603. // 申请状态字典翻译
  1604. applyStatusFormat(row, column) {
  1605. return this.selectDictLabel(this.applyStatusOptions, row.applyStatus);
  1606. },
  1607. // 班组字典翻译
  1608. teamFormat(row, column) {
  1609. return this.selectDictLabel(this.applicantTeamOptions, row.applicantTeam);
  1610. },
  1611. /** 查询SAI开项管理列表 */
  1612. getList() {
  1613. this.loading = true;
  1614. this.queryParams.tab = 3;
  1615. this.queryParams.applyStatusString = this.applyStatusString.join()
  1616. if (this.queryParams.workArea != null && this.queryParams.workArea != "") {
  1617. this.queryParams.workArea = this.queryParams.workArea.join();
  1618. } else {
  1619. this.queryParams.workArea = "";
  1620. }
  1621. listApply(this.queryParams).then(response => {
  1622. if (this.queryParams.workArea != null && this.queryParams.workArea != "") {
  1623. this.queryParams.workArea = this.queryParams.workArea.split(",");
  1624. }
  1625. this.applyList = response.rows;
  1626. this.total = response.total;
  1627. this.loading = false;
  1628. });
  1629. },
  1630. /** 查询部门下拉树结构 */
  1631. getTreeselect() {
  1632. treeselect().then(response => {
  1633. this.deptOptions = response.data;
  1634. });
  1635. },
  1636. // 取消按钮
  1637. cancel() {
  1638. this.delayOpen = false;
  1639. this.saiOpen = false;
  1640. this.open = false;
  1641. this.open2 = false;
  1642. this.analysisOpen = false;
  1643. this.reset();
  1644. },
  1645. // 表单重置
  1646. reset() {
  1647. this.form = {
  1648. saiApplyId: null,
  1649. delFlag: null,
  1650. createBy: null,
  1651. createTime: null,
  1652. updateBy: null,
  1653. updateTime: null,
  1654. deptId: null,
  1655. applyStatus: null,
  1656. apNo: null,
  1657. processId: null,
  1658. applicant: null,
  1659. assessor: null,
  1660. executor: null,
  1661. inspectors: null,
  1662. applicantDept: null,
  1663. applicantTeam: null,
  1664. description: null,
  1665. unsafeStatus: null,
  1666. unsafeAction: null,
  1667. applyDate: new Date(),
  1668. taskId: null,
  1669. handler: null,
  1670. taskName: null,
  1671. estimateFinishDate: null,
  1672. actualFinishDate: null,
  1673. isRecorded: null,
  1674. recordNo: null,
  1675. reaction: null,
  1676. needVe: null,
  1677. veItems: null,
  1678. veResult: null,
  1679. veItemOther: null,
  1680. applyDateStart: null,
  1681. applyDateEnd: null,
  1682. estimateFinishDateStart: null,
  1683. estimateFinishDateEnd: null,
  1684. };
  1685. this.resetForm("form");
  1686. },
  1687. /** 搜索按钮操作 */
  1688. handleQuery() {
  1689. this.queryParams.pageNum = 1;
  1690. if (this.applyDateRange != null) {
  1691. this.queryParams.applyDateStart = this.applyDateRange[0];
  1692. this.queryParams.applyDateEnd = this.applyDateRange[1];
  1693. } else {
  1694. this.queryParams.applyDateStart = null;
  1695. this.queryParams.applyDateEnd = null;
  1696. }
  1697. if (this.estimateFinishDateRange != null) {
  1698. this.queryParams.estimateFinishDateStart = this.estimateFinishDateRange[0];
  1699. this.queryParams.estimateFinishDateEnd = this.estimateFinishDateRange[1];
  1700. } else {
  1701. this.queryParams.estimateFinishDateStart = null;
  1702. this.queryParams.estimateFinishDateEnd = null;
  1703. }
  1704. this.getList();
  1705. },
  1706. /** 重置按钮操作 */
  1707. resetQuery() {
  1708. this.resetForm("queryForm");
  1709. this.applyStatusString = [];
  1710. this.handleQuery();
  1711. },
  1712. // 多选框选中数据
  1713. handleSelectionChange(selection) {
  1714. this.ids = selection.map(item => item.saiApplyId)
  1715. this.single = selection.length!==1
  1716. this.multiple = !selection.length
  1717. },
  1718. /** 新增按钮操作 */
  1719. handleAdd() {
  1720. this.reset();
  1721. this.fileList = [];
  1722. this.open = true;
  1723. this.title = "添加SAI开项申请";
  1724. // 加载当前登录员工信息
  1725. this.getLoginStaffInfo();
  1726. this.applicantTeamDisabled = false;
  1727. },
  1728. /** 修改按钮操作 */
  1729. handleUpdate(row) {
  1730. this.reset();
  1731. const saiApplyId = row.saiApplyId || this.ids
  1732. listFile({
  1733. approveId: saiApplyId
  1734. }).then(response => {
  1735. this.doc.commonfileListApply = response;
  1736. });
  1737. getApply(saiApplyId).then(response => {
  1738. this.form = response.data;
  1739. if (this.form.unsafeStatus != null && this.form.unsafeStatus != "") {
  1740. this.form.unsafeStatus = this.form.unsafeStatus.toString();
  1741. }
  1742. if (this.form.unsafeAction != null && this.form.unsafeAction != "") {
  1743. this.form.unsafeAction = this.form.unsafeAction.toString();
  1744. }
  1745. if (this.form.category != null && this.form.category != "") {
  1746. this.form.category = Number(this.form.category);
  1747. }
  1748. this.fileList = [];
  1749. if (this.form.files.length > 0) {
  1750. console.log(this.form.files);
  1751. for (let i = 0; i < this.form.files.length; i++) {
  1752. let obj = {}
  1753. obj.name = this.form.files[i].fileName
  1754. obj.response = {};
  1755. obj.response.msg = this.form.files[i].fileUrl
  1756. this.fileList.push(obj)
  1757. }
  1758. }
  1759. this.open = true;
  1760. this.title = "修改SAI开项申请";
  1761. });
  1762. },
  1763. handleUpdate2(row) {
  1764. this.reset();
  1765. const saiApplyId = row.saiApplyId || this.ids
  1766. listFile({
  1767. approveId: saiApplyId
  1768. }).then(response => {
  1769. this.doc.commonfileListApply = response;
  1770. });
  1771. getApply(saiApplyId).then(response => {
  1772. this.form = response.data;
  1773. if (this.form.unsafeStatus != null && this.form.unsafeStatus != "") {
  1774. this.form.unsafeStatus = this.form.unsafeStatus.toString();
  1775. }
  1776. if (this.form.unsafeAction != null && this.form.unsafeAction != "") {
  1777. this.form.unsafeAction = this.form.unsafeAction.toString();
  1778. }
  1779. if (this.form.category != null && this.form.category != "") {
  1780. this.form.category = Number(this.form.category);
  1781. }
  1782. this.fileList = [];
  1783. if (this.form.files.length > 0) {
  1784. console.log(this.form.files);
  1785. for (let i = 0; i < this.form.files.length; i++) {
  1786. let obj = {}
  1787. obj.name = this.form.files[i].fileName
  1788. obj.response = {};
  1789. obj.response.msg = this.form.files[i].fileUrl
  1790. this.fileList.push(obj)
  1791. }
  1792. }
  1793. this.open2 = true;
  1794. this.title = "修改SAI开项申请";
  1795. });
  1796. },
  1797. /** 新增/修改保存按钮 */
  1798. submitForm() {
  1799. this.submitDisabled = true;
  1800. this.form.files = []
  1801. if (this.fileList.length > 0) {
  1802. for (let i = 0; i < this.fileList.length; i++) {
  1803. let obj = {}
  1804. obj.fileName = this.fileList[i].name
  1805. obj.fileUrl = this.fileList[i].response.msg
  1806. this.form.files.push(obj)
  1807. }
  1808. }
  1809. this.$refs["form"].validate(valid => {
  1810. if (valid) {
  1811. if (this.form.saiApplyId != null) {
  1812. updateApply(this.form).then(response => {
  1813. this.msgSuccess("修改成功");
  1814. this.open = false;
  1815. this.open2 = false;
  1816. this.submitDisabled = false;
  1817. this.getList();
  1818. });
  1819. } else {
  1820. addApply(this.form).then(response => {
  1821. this.msgSuccess("新增成功");
  1822. this.open = false;
  1823. this.open2 = false;
  1824. this.submitDisabled = false;
  1825. this.getList();
  1826. });
  1827. }
  1828. } else {
  1829. this.submitDisabled = false;
  1830. }
  1831. });
  1832. },
  1833. /** 新增/修改提交按钮 */
  1834. handleSaveAndSubmit() {
  1835. this.submitDisabled = true;
  1836. this.form.files = []
  1837. if (this.fileList.length > 0) {
  1838. for (let i = 0; i < this.fileList.length; i++) {
  1839. let obj = {}
  1840. obj.fileName = this.fileList[i].name
  1841. obj.fileUrl = this.fileList[i].response.msg
  1842. this.form.files.push(obj)
  1843. }
  1844. }
  1845. this.$refs["form"].validate(valid => {
  1846. if (valid) {
  1847. saveAndSubmitApply(this.form).then(response => {
  1848. this.msgSuccess("提交成功");
  1849. this.submitDisabled = false;
  1850. this.open = false;
  1851. this.getList();
  1852. });
  1853. } else {
  1854. this.submitDisabled = false;
  1855. }
  1856. });
  1857. },
  1858. /** 统计至SAI检查台账提交按钮 */
  1859. submitSaiForm() {
  1860. for (let i = 0; i < this.saiList.length; i++) {
  1861. this.saiList[i].plantId = 103;
  1862. this.saiList[i].userDept = 103;
  1863. addSai(this.saiList[i]);
  1864. }
  1865. this.msgSuccess("提交成功");
  1866. this.saiOpen = false;
  1867. },
  1868. /** 延期提交按钮 */
  1869. submitDelayForm() {
  1870. this.$refs["delayForm"].validate(valid => {
  1871. if (valid) {
  1872. updateApply(this.delayForm).then(response => {
  1873. this.msgSuccess("延期成功");
  1874. this.delayOpen = false;
  1875. this.getList();
  1876. });
  1877. }
  1878. });
  1879. },
  1880. /** 统计至SAI检查台账按钮操作 */
  1881. handleAddSai(row) {
  1882. const saiApplyIds = row.saiApplyId || this.ids;
  1883. if(saiApplyIds.length != 0) {
  1884. this.saiList = [];
  1885. for (let i = 0; i < saiApplyIds.length; i ++) {
  1886. getApply(saiApplyIds[i]).then(response => {
  1887. let apply = response.data;
  1888. let sai = {};
  1889. sai.saiApplyId = apply.saiApplyId;
  1890. sai.plantId = "CBP/C";
  1891. sai.userDeptId = "CBP/C";
  1892. sai.inspectionDate = apply.applyDate;
  1893. sai.dificiency = apply.description;
  1894. sai.actions = apply.reaction;
  1895. sai.source = "装置";
  1896. sai.deptId = 103;
  1897. sai.saiLevel = apply.saiLevel;
  1898. sai.category = Number(apply.category);
  1899. sai.applicant = apply.applicant;
  1900. sai.applicantName = apply.applicantName;
  1901. this.saiList.push(sai);
  1902. });
  1903. }
  1904. this.saiOpen = true;
  1905. }
  1906. },
  1907. /** 删除按钮操作 */
  1908. handleDelete(row) {
  1909. const saiApplyIds = row.saiApplyId || this.ids;
  1910. this.$confirm('是否确认删除?', "警告", {
  1911. confirmButtonText: "确定",
  1912. cancelButtonText: "取消",
  1913. type: "warning"
  1914. }).then(function() {
  1915. return delApply(saiApplyIds);
  1916. }).then(() => {
  1917. this.getList();
  1918. this.msgSuccess("删除成功");
  1919. })
  1920. },
  1921. /** 导出全部按钮操作 */
  1922. handleExport() {
  1923. this.queryParams.ids = null;
  1924. if (this.queryParams.workArea != null && this.queryParams.workArea != "") {
  1925. this.queryParams.workArea = this.queryParams.workArea.join();
  1926. } else {
  1927. this.queryParams.workArea = "";
  1928. }
  1929. const queryParams = this.queryParams;
  1930. this.$confirm('是否确认导出所有SAI开项管理数据项?', "警告", {
  1931. confirmButtonText: "确定",
  1932. cancelButtonText: "取消",
  1933. type: "warning"
  1934. }).then(function() {
  1935. return exportApply(queryParams);
  1936. }).then(response => {
  1937. this.download(response.msg);
  1938. })
  1939. },
  1940. /** 导出选中数据按钮操作 */
  1941. handleExportSelected() {
  1942. if (this.ids.length==0){
  1943. return this.$alert('请选择要导出的数据项!', "警告", {
  1944. confirmButtonText: "确定",
  1945. type: "warning"
  1946. })
  1947. }
  1948. if (this.queryParams.workArea != null && this.queryParams.workArea != "") {
  1949. this.queryParams.workArea = this.queryParams.workArea.join();
  1950. } else {
  1951. this.queryParams.workArea = "";
  1952. }
  1953. const queryParams = this.queryParams;
  1954. queryParams.ids=this.ids;
  1955. console.log(queryParams)
  1956. this.$confirm('是否确认导出选中的SAI开项管理数据项?', "警告", {
  1957. confirmButtonText: "确定",
  1958. cancelButtonText: "取消",
  1959. type: "warning"
  1960. }).then(function () {
  1961. return exportApply(queryParams);
  1962. }).then(response => {
  1963. this.download(response.msg);
  1964. })
  1965. },
  1966. /** 导入按钮操作 */
  1967. handleImport() {
  1968. this.upload.title = "用户导入";
  1969. this.upload.open = true;
  1970. },
  1971. /** 下载模板操作 */
  1972. importTemplate() {
  1973. this.$refs['downloadFileForm'].submit()
  1974. },
  1975. // 文件上传中处理
  1976. handleFileUploadProgress(event, file, fileList) {
  1977. this.upload.isUploading = true;
  1978. },
  1979. // 文件上传成功处理
  1980. handleFileSuccess(response, file, fileList) {
  1981. this.upload.open = false;
  1982. this.upload.isUploading = false;
  1983. this.$refs.upload.clearFiles();
  1984. if (response.data[0] != null) {
  1985. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1986. }else {
  1987. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1988. }
  1989. this.getList();
  1990. },
  1991. // 提交上传文件
  1992. submitFileForm() {
  1993. this.$refs.upload.submit();
  1994. }
  1995. }
  1996. };
  1997. </script>