bd.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="区域" prop="area">
  5. <el-select v-model="queryParams.area" @change="handleQuery" placeholder="请选择区域" clearable>
  6. <el-option value="第一萃取精馏单元" laabel="第一萃取精馏单元"></el-option>
  7. <el-option value="第二萃取精馏单元" laabel="第二萃取精馏单元"></el-option>
  8. <el-option value="丁二烯精馏单元" laabel="丁二烯精馏单元"></el-option>
  9. <el-option value="溶剂精制单元" laabel="溶剂精制单元"></el-option>
  10. <el-option value="辅助单元" laabel="辅助单元"></el-option>
  11. <el-option value="公用工程单元" laabel="公用工程单元"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="提出日期" prop="identifiedDateStr">
  15. <el-date-picker clearable size="small" style="width: 200px"
  16. v-model="queryParams.identifiedDateStr"
  17. type="year"
  18. @change="handleQuery"
  19. value-format="yyyy"
  20. placeholder="选择提出日期">
  21. </el-date-picker>
  22. </el-form-item>
  23. <el-form-item label="当前状态" prop="currentStates">
  24. <el-select v-model="queryParams.currentStates" @change="handleQuery" placeholder="请选择当前状态" clearable>
  25. <el-option value="已完成" laabel="已完成"></el-option>
  26. <el-option value="未完成" laabel="未完成"></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="识别出的问题" prop="issueIdentified" label-width="120">
  30. <el-input
  31. v-model="queryParams.issueIdentified"
  32. placeholder="请输入识别出的问题"
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item label="负责部门" prop="responsibleUnit">
  37. <el-input
  38. v-model="queryParams.responsibleUnit"
  39. placeholder="请输入负责部门"
  40. @keyup.enter.native="handleQuery"
  41. />
  42. </el-form-item>
  43. <el-form-item>
  44. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  45. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  46. </el-form-item>
  47. </el-form>
  48. <el-row :gutter="10" class="mb8">
  49. <el-col :span="1.5">
  50. <el-button
  51. type="primary"
  52. icon="el-icon-plus"
  53. size="mini"
  54. @click="handleAdd"
  55. v-hasPermi="['issue:issuelist:add']"
  56. >新增
  57. </el-button>
  58. </el-col>
  59. <el-col :span="1.5">
  60. <el-button
  61. type="success"
  62. icon="el-icon-edit"
  63. size="mini"
  64. :disabled="single"
  65. @click="handleUpdate"
  66. v-hasPermi="['issue:issuelist:edit']"
  67. >修改
  68. </el-button>
  69. </el-col>
  70. <el-col :span="1.5">
  71. <el-button
  72. type="danger"
  73. icon="el-icon-delete"
  74. size="mini"
  75. :disabled="multiple"
  76. @click="handleDelete"
  77. v-hasPermi="['issue:issuelist:remove']"
  78. >删除
  79. </el-button>
  80. </el-col>
  81. <el-col :span="1.5">
  82. <el-button
  83. type="info"
  84. icon="el-icon-upload2"
  85. size="mini"
  86. @click="handleImport"
  87. v-hasPermi="['issue:issuelist:edit']"
  88. >导入
  89. </el-button>
  90. </el-col>
  91. <el-col :span="1.5">
  92. <el-button
  93. type="warning"
  94. icon="el-icon-download"
  95. size="mini"
  96. @click="handleExport"
  97. v-hasPermi="['issue:issuelist:export']"
  98. >导出
  99. </el-button>
  100. </el-col>
  101. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  102. </el-row>
  103. <el-table v-loading="loading" :data="issuelistList" @selection-change="handleSelectionChange" :height="clientHeight" :row-class-name="tableRowClassName"
  104. border >
  105. <el-table-column type="selection" width="55" align="center"/>
  106. <el-table-column type="index" label="序号" width="55" align="center" :index="indexMethod"/>
  107. <el-table-column label="区域" align="center" prop="area" :show-overflow-tooltip="true" width="150"/>
  108. <el-table-column label="提出日期" align="center" prop="identifiedDate" width="100">
  109. <template slot-scope="scope">
  110. <span>{{ parseTime(scope.row.identifiedDate, '{y}-{m}-{d}') }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="问题来源" align="center" prop="issueSource" :show-overflow-tooltip="true" width="150"/>
  114. <el-table-column label="识别出的问题" align="center" prop="issueIdentified" :show-overflow-tooltip="true"
  115. width="150"/>
  116. <el-table-column label="要采取的措施" align="center" prop="actionsTaken" :show-overflow-tooltip="true"
  117. width="150"/>
  118. <el-table-column label="问题类别" align="center" prop="issueClass" :show-overflow-tooltip="true" width="150"/>
  119. <el-table-column label="负责部门" align="center" prop="responsibleUnit" :show-overflow-tooltip="true"
  120. width="150"/>
  121. <el-table-column label="负责人员" align="center" prop="responsiblePerson" :show-overflow-tooltip="true"
  122. width="150"/>
  123. <el-table-column label="当前状态" align="center" prop="currentStates" :show-overflow-tooltip="true" width="150"/>
  124. <el-table-column label="预计完成日期" align="center" prop="expectedDate" :show-overflow-tooltip="true" width="100">
  125. <template slot-scope="scope">
  126. <span>{{ parseTime(scope.row.expectedDate, '{y}-{m}-{d}') }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="实际完成日期" align="center" prop="completionDate" :show-overflow-tooltip="true" width="100">
  130. <template slot-scope="scope">
  131. <span>{{ parseTime(scope.row.completionDate, '{y}-{m}-{d}') }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="150"/>
  135. <el-table-column label="操作" align="center" fixed="right" width="160" class-name="small-padding fixed-width">
  136. <template slot-scope="scope">
  137. <el-button
  138. size="mini"
  139. type="text"
  140. icon="el-icon-edit"
  141. @click="handleUpdate(scope.row)"
  142. v-hasPermi="['issue:issuelist:edit']"
  143. >修改
  144. </el-button>
  145. <el-button
  146. size="mini"
  147. type="text"
  148. icon="el-icon-delete"
  149. @click="handleDelete(scope.row)"
  150. v-hasPermi="['issue:issuelist:remove']"
  151. >删除
  152. </el-button>
  153. <el-button
  154. size="mini"
  155. type="text"
  156. icon="el-icon-document"
  157. @click="handleDoc(scope.row)"
  158. v-hasPermi="['issue:issuelist:edit']"
  159. >{{ $t('附件') }}</el-button>
  160. </template>
  161. </el-table-column>
  162. </el-table>
  163. <pagination
  164. v-show="total>0"
  165. :total="total"
  166. :page.sync="queryParams.pageNum"
  167. :limit.sync="queryParams.pageSize"
  168. @pagination="getList"
  169. />
  170. <!-- 添加或修改装置问题滚动清单对话框 -->
  171. <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body :close-on-click-modal="false">
  172. <el-form ref="form" :model="form" :rules="rules" label-width="180px">
  173. <el-form-item label="区域" prop="area">
  174. <el-select v-model="form.area" placeholder="请选择区域" clearable style="width: 100%">
  175. <el-option value="第一萃取精馏单元" laabel="第一萃取精馏单元"></el-option>
  176. <el-option value="第二萃取精馏单元" laabel="第二萃取精馏单元"></el-option>
  177. <el-option value="丁二烯精馏单元" laabel="丁二烯精馏单元"></el-option>
  178. <el-option value="溶剂精制单元" laabel="溶剂精制单元"></el-option>
  179. <el-option value="辅助单元" laabel="辅助单元"></el-option>
  180. <el-option value="公用工程单元" laabel="公用工程单元"></el-option>
  181. </el-select>
  182. </el-form-item>
  183. <el-form-item label="提出日期" prop="identifiedDate">
  184. <el-date-picker clearable size="small" style="width: 100%"
  185. v-model="form.identifiedDate"
  186. type="date"
  187. value-format="yyyy-MM-dd"
  188. placeholder="选择提出日期">
  189. </el-date-picker>
  190. </el-form-item>
  191. <el-form-item label="问题来源" prop="issueSource">
  192. <el-select v-model="form.issueSource" placeholder="请选择问题来源" clearable style="width: 100%">
  193. <el-option value="日常巡检" laabel="日常巡检"></el-option>
  194. <el-option value="政府检查" laabel="政府检查"></el-option>
  195. <el-option value="审计检查" laabel="审计检查"></el-option>
  196. <el-option value="运行故障" laabel="运行故障"></el-option>
  197. <el-option value="其他" laabel="其他"></el-option>
  198. </el-select></el-form-item>
  199. <el-form-item label="识别出的问题" prop="issueIdentified">
  200. <el-input type="textarea" v-model="form.issueIdentified" placeholder="请输入识别出的问题"/>
  201. </el-form-item>
  202. <el-form-item label="要采取的措施" prop="actionsTaken">
  203. <el-input type="textarea" v-model="form.actionsTaken" placeholder="请输入要采取的措施"/>
  204. </el-form-item>
  205. <el-form-item label="问题类别" prop="issueClass">
  206. <el-select v-model="form.issueClass" placeholder="请选择问题来源" clearable style="width: 100%">
  207. <el-option value="设备" laabel="设备"></el-option>
  208. <el-option value="电仪" laabel="电仪"></el-option>
  209. <el-option value="安全措施" laabel="安全措施"></el-option>
  210. <el-option value="其他" laabel="其他"></el-option>
  211. </el-select>
  212. </el-form-item>
  213. <el-form-item label="负责部门 " prop="responsibleUnit">
  214. <el-input v-model="form.responsibleUnit" placeholder="请输入负责人员"/>
  215. </el-form-item>
  216. <el-form-item label="负责人员" prop="responsiblePerson">
  217. <el-input v-model="form.responsiblePerson" placeholder="请输入负责人员"/>
  218. </el-form-item>
  219. <el-form-item label="当前状态" prop="currentStates">
  220. <el-select v-model="form.currentStates" placeholder="请选择当前状态" clearable style="width: 100%">
  221. <el-option value="已完成" laabel="已完成"></el-option>
  222. <el-option value="未完成" laabel="未完成"></el-option>
  223. </el-select>
  224. </el-form-item>
  225. <el-form-item label="预计完成日期" prop="expectedDate">
  226. <el-date-picker clearable size="small" style="width: 100%"
  227. v-model="form.expectedDate"
  228. type="date"
  229. value-format="yyyy-MM-dd"
  230. placeholder="选择预计完成日期">
  231. </el-date-picker>
  232. </el-form-item>
  233. <el-form-item label="实际完成日期" prop="completionDate">
  234. <el-date-picker clearable size="small" style="width: 100%"
  235. v-model="form.completionDate"
  236. type="date"
  237. value-format="yyyy-MM-dd"
  238. placeholder="选择实际完成日期">
  239. </el-date-picker>
  240. </el-form-item>
  241. <el-form-item label="备注" prop="remarks">
  242. <el-input v-model="form.remarks" placeholder="请输入备注"/>
  243. </el-form-item>
  244. </el-form>
  245. <div slot="footer" class="dialog-footer">
  246. <el-button type="primary" @click="submitForm">确 定</el-button>
  247. <el-button @click="cancel">取 消</el-button>
  248. </div>
  249. </el-dialog>
  250. <!-- 报告附件对话框 -->
  251. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px"
  252. append-to-body>
  253. <el-upload
  254. ref="doc"
  255. :limit="50"
  256. :headers="doc.headers"
  257. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  258. :disabled="doc.isUploading"
  259. :on-progress="handleFileDocProgress"
  260. :on-success="handleFileDocSuccess"
  261. :auto-upload="true"
  262. drag
  263. >
  264. <i class="el-icon-upload"></i>
  265. <div class="el-upload__text">
  266. {{ $t('将文件拖到此处,或') }}
  267. <em>{{ $t('点击上传') }}</em>
  268. </div>
  269. </el-upload>
  270. <el-table :data="doc.commonfileList" border>
  271. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  272. <template slot-scope="scope">
  273. <a class="link-type" @click="handleDownload(scope.row)">
  274. <span>{{ scope.row.fileName }}</span>
  275. </a>
  276. </template>
  277. </el-table-column>
  278. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true"
  279. width="80"/>
  280. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  281. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  282. <template slot-scope="scope">
  283. <el-button
  284. v-if="scope.row.fileName.endsWith('pdf')"
  285. size="mini"
  286. type="text"
  287. icon="el-icon-view"
  288. @click="handleSee(scope.row)"
  289. >{{ $t('预览') }}
  290. </el-button>
  291. <el-button
  292. size="mini"
  293. type="text"
  294. icon="el-icon-download"
  295. @click="handleDownload(scope.row)"
  296. >{{ $t('下载') }}
  297. </el-button>
  298. <el-button
  299. size="mini"
  300. type="text"
  301. icon="el-icon-delete"
  302. @click="handleDeleteDoc(scope.row)"
  303. >{{ $t('删除') }}
  304. </el-button>
  305. </template>
  306. </el-table-column>
  307. </el-table>
  308. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px"
  309. append-to-body>
  310. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  311. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  312. </div>
  313. <div style="margin-top: -30px">
  314. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  315. </div>
  316. </el-dialog>
  317. <div slot="footer" class="dialog-footer">
  318. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  319. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  320. </div>
  321. </el-dialog>
  322. <!-- 用户导入对话框 -->
  323. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="upload.title" :visible.sync="upload.open"
  324. width="400px" append-to-body>
  325. <el-upload
  326. ref="upload"
  327. :limit="1"
  328. accept=".xlsx, .xls"
  329. :headers="upload.headers"
  330. :action="upload.url"
  331. :disabled="upload.isUploading"
  332. :on-progress="handleFileUploadProgress"
  333. :on-success="handleFileSuccess"
  334. :auto-upload="false"
  335. drag
  336. >
  337. <i class="el-icon-upload"></i>
  338. <div class="el-upload__text">
  339. {{ $t('将文件拖到此处,或') }}
  340. <em>{{ $t('点击上传') }}</em>
  341. </div>
  342. <div class="el-upload__tip" slot="tip">
  343. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  344. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  345. </div>
  346. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  347. <input name="type" :value="upload.type" hidden/>
  348. </form>
  349. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  350. </el-upload>
  351. <div slot="footer" class="dialog-footer">
  352. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  353. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  354. </div>
  355. </el-dialog>
  356. </div>
  357. </template>
  358. <script>
  359. import {
  360. addIssuelist,
  361. delIssuelist,
  362. exportIssuelist,
  363. getIssuelist,
  364. listIssuelist,
  365. updateIssuelist
  366. } from "@/api/issue/issuelist";
  367. import {treeselect} from "@/api/system/dept";
  368. import {getToken} from "@/utils/auth";
  369. import Treeselect from "@riophae/vue-treeselect";
  370. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  371. import {allFileList, delCommonfile} from "@/api/common/commonfile";
  372. export default {
  373. name: "IssuelistBD",
  374. components: {Treeselect},
  375. data() {
  376. return {
  377. // 遮罩层
  378. loading: true,
  379. // 选中数组
  380. ids: [],
  381. // 非单个禁用
  382. single: true,
  383. // 非多个禁用
  384. multiple: true,
  385. // 显示搜索条件
  386. showSearch: false,
  387. // 总条数
  388. total: 0,
  389. // 装置问题滚动清单表格数据
  390. issuelistList: [],
  391. // 弹出层标题
  392. title: "",
  393. // 部门树选项
  394. deptOptions: undefined,
  395. clientHeight: 300,
  396. // 是否显示弹出层
  397. open: false,
  398. // 用户导入参数
  399. upload: {
  400. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  401. //下载模板类型
  402. type: "issuelist",
  403. // 是否显示弹出层(用户导入)
  404. open: false,
  405. // 弹出层标题(用户导入)
  406. title: "",
  407. // 是否禁用上传
  408. isUploading: false,
  409. // 是否更新已经存在的用户数据
  410. updateSupport: 0,
  411. // 设置上传的请求头部
  412. headers: {Authorization: "Bearer " + getToken()},
  413. // 上传的地址
  414. url: process.env.VUE_APP_BASE_API + "/issue/issuelist/importData"
  415. },
  416. // 报告附件参数
  417. doc: {
  418. file: "",
  419. // 是否显示弹出层(报告附件)
  420. open: false,
  421. // 弹出层标题(报告附件)
  422. title: "",
  423. // 是否禁用上传
  424. isUploading: false,
  425. // 是否更新已经存在的用户数据
  426. updateSupport: 0,
  427. // 报告附件上传位置编号
  428. ids: 0,
  429. // 设置上传的请求头部
  430. headers: {Authorization: "Bearer " + getToken()},
  431. // 上传的地址
  432. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  433. commonfileList: null,
  434. queryParams: {
  435. pId: null,
  436. pType: 'issuelist'
  437. },
  438. pType: 'issuelist',
  439. pId: null
  440. },
  441. pdf : {
  442. title: '',
  443. pdfUrl: '',
  444. numPages: null,
  445. open: false,
  446. pageNum: 1,
  447. pageTotalNum: 1,
  448. loadedRatio: 0,
  449. },
  450. // 查询参数
  451. queryParams: {
  452. pageNum: 1,
  453. pageSize: 20,
  454. plant: 'BD',
  455. area: null,
  456. identifiedDate: null,
  457. identifiedDateStr: new Date().getFullYear().toString(),
  458. issueSource: null,
  459. issueIdentified: null,
  460. actionsTaken: null,
  461. issueClass: null,
  462. responsiblePerson: null,
  463. responsibleUnit: null,
  464. currentStates: null,
  465. completionDate: null,
  466. additionalDeadline: null,
  467. createrCode: null,
  468. createdate: null,
  469. updaterCode: null,
  470. updatedate: null,
  471. deptId: null,
  472. remarks: null
  473. },
  474. // 表单参数
  475. form: {},
  476. // 表单校验
  477. rules: {
  478. area: [
  479. {required: true, message: "请选择区域", trigger: "blur"}
  480. ],
  481. identifiedDate: [
  482. {required: true, message: "请选择提出时间", trigger: "blur"}
  483. ],
  484. issueSource: [
  485. {required: true, message: "请选择问题来源", trigger: "blur"}
  486. ],
  487. issueIdentified: [
  488. {required: true, message: "识别出的问题不能为空", trigger: "blur"}
  489. ],
  490. actionsTaken: [
  491. {required: true, message: "要采取的措施不能为空", trigger: "blur"}
  492. ],
  493. issueClass: [
  494. {required: true, message: "请选择问题类别", trigger: "blur"}
  495. ],
  496. responsiblePerson: [
  497. {required: true, message: "负责人员不能为空", trigger: "blur"}
  498. ],
  499. responsibleUnit: [
  500. {required: true, message: "负责部门不能为空", trigger: "blur"}
  501. ],
  502. currentStates: [
  503. {required: true, message: "请选择当前状态", trigger: "blur"}
  504. ],
  505. expectedDate: [
  506. {required: true, message: "请选择预计完成日期", trigger: "blur"}
  507. ],
  508. }
  509. };
  510. },
  511. watch: {
  512. // 根据名称筛选部门树
  513. deptName(val) {
  514. this.$refs.tree.filter(val);
  515. }
  516. },
  517. created() {
  518. //设置表格高度对应屏幕高度
  519. this.$nextTick(() => {
  520. this.clientHeight = document.body.clientHeight - 330
  521. })
  522. this.getList();
  523. this.getTreeselect();
  524. },
  525. methods: {
  526. /** 查询装置问题滚动清单列表 */
  527. getList() {
  528. this.loading = true;
  529. listIssuelist(this.queryParams).then(response => {
  530. this.issuelistList = response.rows;
  531. this.total = response.total;
  532. this.loading = false;
  533. });
  534. },
  535. /** 查询部门下拉树结构 */
  536. getTreeselect() {
  537. treeselect().then(response => {
  538. this.deptOptions = response.data;
  539. });
  540. },
  541. // 取消按钮
  542. cancel() {
  543. this.open = false;
  544. this.reset();
  545. },
  546. // 表单重置
  547. reset() {
  548. this.form = {
  549. id: null,
  550. plant: 'BD',
  551. area: null,
  552. identifiedDate: null,
  553. issueSource: null,
  554. issueIdentified: null,
  555. actionsTaken: null,
  556. issueClass: null,
  557. responsiblePerson: null,
  558. responsibleUnit: null,
  559. currentStates: null,
  560. completionDate: null,
  561. expectedDate: null,
  562. additionalDeadline: null,
  563. delFlag: null,
  564. createrCode: null,
  565. createdate: null,
  566. updaterCode: null,
  567. updatedate: null,
  568. deptId: null,
  569. remarks: null
  570. };
  571. this.resetForm("form");
  572. },
  573. /** 搜索按钮操作 */
  574. handleQuery() {
  575. this.queryParams.pageNum = 1;
  576. this.getList();
  577. },
  578. /** 重置按钮操作 */
  579. resetQuery() {
  580. this.resetForm("queryForm");
  581. this.handleQuery();
  582. },
  583. // 多选框选中数据
  584. handleSelectionChange(selection) {
  585. this.ids = selection.map(item => item.id)
  586. this.single = selection.length !== 1
  587. this.multiple = !selection.length
  588. },
  589. /** 新增按钮操作 */
  590. handleAdd() {
  591. this.reset();
  592. this.open = true;
  593. this.title = "添加装置问题滚动清单";
  594. },
  595. /** 修改按钮操作 */
  596. handleUpdate(row) {
  597. this.reset();
  598. const id = row.id || this.ids
  599. getIssuelist(id).then(response => {
  600. this.form = response.data;
  601. this.open = true;
  602. this.title = "修改装置问题滚动清单";
  603. });
  604. },
  605. /** 提交按钮 */
  606. submitForm() {
  607. this.$refs["form"].validate(valid => {
  608. if (valid) {
  609. if (this.form.id != null) {
  610. updateIssuelist(this.form).then(response => {
  611. this.msgSuccess("修改成功");
  612. this.open = false;
  613. this.getList();
  614. });
  615. } else {
  616. addIssuelist(this.form).then(response => {
  617. this.msgSuccess("新增成功");
  618. this.open = false;
  619. this.getList();
  620. });
  621. }
  622. }
  623. });
  624. },
  625. /** 删除按钮操作 */
  626. handleDelete(row) {
  627. const ids = row.id || this.ids;
  628. this.$confirm('是否确认删除?', "警告", {
  629. confirmButtonText: "确定",
  630. cancelButtonText: "取消",
  631. type: "warning"
  632. }).then(function () {
  633. return delIssuelist(ids);
  634. }).then(() => {
  635. this.getList();
  636. this.msgSuccess("删除成功");
  637. })
  638. },
  639. /** 导出按钮操作 */
  640. handleExport() {
  641. const queryParams = this.queryParams;
  642. this.$confirm('是否确认导出所有装置问题滚动清单数据项?', "警告", {
  643. confirmButtonText: "确定",
  644. cancelButtonText: "取消",
  645. type: "warning"
  646. }).then(function () {
  647. return exportIssuelist(queryParams);
  648. }).then(response => {
  649. this.download(response.msg);
  650. })
  651. },
  652. /** 导入按钮操作 */
  653. handleImport() {
  654. this.upload.title = "用户导入";
  655. this.upload.open = true;
  656. },
  657. /** 下载模板操作 */
  658. importTemplate() {
  659. this.$refs['downloadFileForm'].submit()
  660. },
  661. // 文件上传中处理
  662. handleFileUploadProgress(event, file, fileList) {
  663. this.upload.isUploading = true;
  664. },
  665. // 文件上传成功处理
  666. handleFileSuccess(response, file, fileList) {
  667. this.upload.open = false;
  668. this.upload.isUploading = false;
  669. this.$refs.upload.clearFiles();
  670. if (response.data[0] != null) {
  671. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败') + "。", this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  672. } else {
  673. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  674. }
  675. this.getList();
  676. },
  677. // 提交上传文件
  678. submitFileForm() {
  679. this.$refs.upload.submit();
  680. },
  681. /** 报告附件按钮操作 */
  682. handleDoc(row) {
  683. this.doc.id = row.id;
  684. this.doc.title = this.$t('附件');
  685. this.doc.open = true;
  686. this.doc.queryParams.pId = row.id
  687. this.doc.pId = row.id
  688. this.getFileList()
  689. this.$nextTick(() => {
  690. this.$refs.doc.clearFiles()
  691. })
  692. },
  693. getFileList() {
  694. allFileList(this.doc.queryParams).then(response => {
  695. this.doc.commonfileList = response;
  696. });
  697. },
  698. //附件上传中处理
  699. handleFileDocProgress(event, file, fileList) {
  700. this.doc.file = file;
  701. this.doc.isUploading = true;
  702. },
  703. //附件上传成功处理
  704. handleFileDocSuccess(response, file, fileList) {
  705. this.doc.isUploading = false;
  706. this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  707. this.getFileList()
  708. },
  709. /** 删除按钮操作 */
  710. handleDeleteDoc(row) {
  711. const ids = row.id || this.ids;
  712. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  713. confirmButtonText: this.$t('确定'),
  714. cancelButtonText: this.$t('取消'),
  715. type: "warning"
  716. }).then(function () {
  717. return delCommonfile(ids);
  718. }).then(() => {
  719. this.getFileList()
  720. this.msgSuccess(this.$t('删除成功'));
  721. })
  722. },
  723. // 文件下载处理
  724. handleDownload(row) {
  725. var name = row.fileName;
  726. var url = row.fileUrl;
  727. var suffix = url.substring(url.lastIndexOf("."), url.length);
  728. const a = document.createElement('a')
  729. a.setAttribute('download', name)
  730. a.setAttribute('target', '_blank')
  731. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  732. a.click()
  733. },
  734. openPdf() {
  735. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  736. },
  737. handleSee(row) {
  738. this.pdf.open = true
  739. this.pdf.title = row.fileName
  740. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  741. },
  742. // 计算日期差(天数)
  743. getDateDiff(date) {
  744. const today = new Date();
  745. today.setHours(0, 0, 0, 0);
  746. const targetDate = new Date(date);
  747. targetDate.setHours(0, 0, 0, 0);
  748. const diffTime = targetDate.getTime() - today.getTime();
  749. return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
  750. },
  751. // 设置行样式
  752. tableRowClassName({ row,rowIndex }) {
  753. if (!row.expectedDate||row.currentStates!=='未完成'){
  754. return '';
  755. }
  756. const diffDays = this.getDateDiff(row.expectedDate);
  757. console.log(diffDays)
  758. if (diffDays <= 0) {
  759. return 'danger-row';
  760. } else if (diffDays < 15) {
  761. return 'warning-row';
  762. }
  763. return '';
  764. },
  765. //翻页后继续计算序列值
  766. indexMethod(index) {
  767. return (this.queryParams.pageNum-1)*this.queryParams.pageSize+index+1;
  768. }
  769. }
  770. };
  771. </script>
  772. <style>
  773. .el-table .warning-row {
  774. background: #ffff00 ;
  775. }
  776. .el-table .danger-row {
  777. background: #ff0000 ;
  778. }
  779. </style>