index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  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="plants">
  5. <el-select v-model="plantIds" size="small" @change="handleCommand" multiple collapse-tags :placeholder="$t('请选择') + $t('装置')">
  6. <el-checkbox v-model="checked" @change="selectAll"> ALL</el-checkbox>
  7. <el-option
  8. v-for="item in plantOptions"
  9. :key="item.name"
  10. :label="item.name"
  11. :value="item.name">
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="周排查日期" prop="checkDate">
  16. <el-date-picker
  17. v-model="chooseDate"
  18. @change="handleQuery"
  19. type="daterange"
  20. style="width: 508px"
  21. align="right"
  22. unlink-panels
  23. :range-separator="$t('至')"
  24. :start-placeholder="$t('开始日期')"
  25. :end-placeholder="$t('结束日期')"
  26. value-format="yyyy-MM-dd"
  27. :picker-options="pickerOptions">
  28. </el-date-picker>
  29. </el-form-item>
  30. <!-- <el-form-item label="人员" prop="cPerson">-->
  31. <!-- <el-select v-model="queryParams.cPerson" placeholder="请选择人员" clearable size="small">-->
  32. <!-- <el-option label="请选择字典生成" value=""/>-->
  33. <!-- </el-select>-->
  34. <!-- </el-form-item>-->
  35. <!-- <el-form-item label="设备本体" prop="cDevice">-->
  36. <!-- <el-select v-model="queryParams.cDevice" placeholder="请选择设备本体" clearable size="small">-->
  37. <!-- <el-option label="√" value="√"/>-->
  38. <!-- <el-option label="×" value="×"/>-->
  39. <!-- </el-select>-->
  40. <!-- </el-form-item>-->
  41. <el-form-item>
  42. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  43. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  44. </el-form-item>
  45. </el-form>
  46. <el-row :gutter="10" class="mb8">
  47. <el-col :span="1.5">
  48. <el-button
  49. type="primary"
  50. icon="el-icon-plus"
  51. size="mini"
  52. @click="handleAdd"
  53. v-hasPermi="['safecheck:dailycheck:add']"
  54. >新增
  55. </el-button>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button
  59. type="success"
  60. icon="el-icon-edit"
  61. size="mini"
  62. :disabled="single"
  63. @click="handleUpdate"
  64. v-hasPermi="['safecheck:dailycheck:edit']"
  65. >修改
  66. </el-button>
  67. </el-col>
  68. <el-col :span="1.5">
  69. <el-button
  70. type="danger"
  71. icon="el-icon-delete"
  72. size="mini"
  73. :disabled="multiple"
  74. @click="handleDelete"
  75. v-hasPermi="['safecheck:dailycheck:remove']"
  76. >删除
  77. </el-button>
  78. </el-col>
  79. <el-col :span="1.5">
  80. <el-button
  81. type="warning"
  82. icon="el-icon-download"
  83. size="mini"
  84. @click="handleExport"
  85. >导出</el-button>
  86. </el-col>
  87. <el-col :span="1.5">
  88. <el-button
  89. type="primary"
  90. icon="el-icon-download"
  91. size="mini"
  92. :disabled="multiple"
  93. @click="handleDownload"
  94. >批量下载Word
  95. </el-button>
  96. </el-col>
  97. <el-col :span="1.5">
  98. <el-button
  99. type="primary"
  100. icon="el-icon-download"
  101. size="mini"
  102. :disabled="multiple"
  103. @click="handleDownloadPdf"
  104. >批量下载PDF
  105. </el-button>
  106. </el-col>
  107. <el-col :span="1.5">
  108. <el-button
  109. type="success"
  110. icon="el-icon-edit"
  111. size="mini"
  112. :disabled="multiple"
  113. @click="handleBatchConfirm"
  114. v-hasPermi="['safecheck:weekcheck:edit']"
  115. >批量锁定</el-button>
  116. </el-col>
  117. <el-col :span="1.5">
  118. <el-button
  119. type="danger"
  120. icon="el-icon-edit"
  121. size="mini"
  122. :disabled="multiple"
  123. @click="handleBatchCancel"
  124. v-hasPermi="['safecheck:weekcheck:edit']"
  125. >取消锁定</el-button>
  126. </el-col>
  127. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  128. </el-row>
  129. <u-table v-loading="loading" :data="dailycheckList"
  130. use-virtual
  131. showBodyOverflow="title"
  132. :row-height="60"
  133. @selection-change="handleSelectionChange"
  134. :height="clientHeight" border>
  135. <u-table-column type="selection" width="55" align="center"/>
  136. <u-table-column label="装置名称" align="center" prop="plantCode" :show-overflow-tooltip="true"/>
  137. <u-table-column label="检查日期" align="center" prop="checkDate" width="100">
  138. <template slot-scope="scope">
  139. <span>{{ parseTime(scope.row.checkDate, '{y}-{m}-{d}') }}</span>
  140. </template>
  141. </u-table-column>
  142. <!-- <u-table-column label="状态" align="center" prop="isConfirm" :show-overflow-tooltip="true" :formatter="isConfirmFormat"/>-->
  143. <u-table-column label="安全员" align="center" prop="checkerName" width="120">
  144. <template slot-scope="scope">
  145. <span v-if="scope.row.agentId">{{ scope.row.checkerName}} 代 {{ scope.row.agentName}}</span>
  146. <span v-else>{{ scope.row.checkerName}}</span>
  147. </template>
  148. </u-table-column>
  149. <u-table-column label="人员" align="center" prop="cPerson" :show-overflow-tooltip="true" :formatter="itemFormat"/>
  150. <u-table-column label="设备本体" align="center" prop="cDevice" :show-overflow-tooltip="true" :formatter="itemFormat"/>
  151. <u-table-column label="安全附件或安全保护装置" align="center" prop="cSafety" :show-overflow-tooltip="true" :formatter="itemFormat"/>
  152. <u-table-column label="政府监督、通报、预警" align="center" prop="cGov" :show-overflow-tooltip="true" :formatter="itemFormat"/>
  153. <u-table-column label="投诉举报" align="center" prop="cComplaint" :show-overflow-tooltip="true" :formatter="itemFormat"/>
  154. <u-table-column label="舆情信息" align="center" prop="cOpinion" :show-overflow-tooltip="true" :formatter="itemFormat"/>
  155. <u-table-column label="其他" align="center" prop="cOther" :show-overflow-tooltip="true" :formatter="itemFormat"/>
  156. <u-table-column label="说明" align="center" prop="explain" :show-overflow-tooltip="true" />
  157. <u-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  158. <template slot-scope="scope">
  159. <el-button
  160. v-if="scope.row.isConfirm == 0"
  161. size="mini"
  162. type="text"
  163. icon="el-icon-edit"
  164. @click="handleUpdate(scope.row)"
  165. v-hasPermi="['safecheck:dailycheck:edit']"
  166. >修改
  167. </el-button>
  168. <el-button
  169. v-if="scope.row.isConfirm == 0"
  170. size="mini"
  171. type="text"
  172. icon="el-icon-delete"
  173. @click="handleDelete(scope.row)"
  174. v-hasPermi="['safecheck:dailycheck:remove']"
  175. >删除
  176. </el-button>
  177. <el-button
  178. size="mini"
  179. type="text"
  180. icon="el-icon-document"
  181. @click="wordView(scope.row)"
  182. >预览
  183. </el-button>
  184. <el-button
  185. size="mini"
  186. type="text"
  187. icon="el-icon-document"
  188. @click="handleDoc(scope.row)"
  189. >附件
  190. </el-button>
  191. </template>
  192. </u-table-column>
  193. </u-table>
  194. <pagination
  195. v-show="total>0"
  196. :total="total"
  197. :page.sync="queryParams.pageNum"
  198. :page-sizes="[20,100,300,500]"
  199. :limit.sync="queryParams.pageSize"
  200. @pagination="getList"
  201. />
  202. <!-- 添加或修改每日安全检查对话框 -->
  203. <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
  204. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  205. <el-form-item :label="$t('装置')" prop="plantCode">
  206. <el-select v-model="form.plantCode" :placeholder="$t('请选择')+ $t('装置')" filterable clearable size="small"
  207. >
  208. <el-option
  209. v-for="dict in plantOptions"
  210. :key="dict.name"
  211. :label="dict.name"
  212. :value="dict.name"
  213. />
  214. </el-select>
  215. </el-form-item>
  216. <el-form-item label="检查日期" prop="checkDate">
  217. <el-date-picker clearable size="small" style="width: 200px"
  218. v-model="form.checkDate"
  219. type="date"
  220. value-format="yyyy-MM-dd"
  221. placeholder="选择检查日期">
  222. </el-date-picker>
  223. </el-form-item>
  224. <div class="checklist-table">
  225. <table cellpadding="10" cellspacing="0" border="1" style="width:100%">
  226. <tr>
  227. <th>序号</th>
  228. <th>检查项目</th>
  229. <th>检查内容</th>
  230. <th>检查结果</th>
  231. </tr>
  232. <tr>
  233. <td>1</td>
  234. <td>人员</td>
  235. <td>按检查项目细化,如:人员配备、违章作业、安全教育等</td>
  236. <td>
  237. <el-radio-group v-model="form.cPerson">
  238. <el-radio label="√">√</el-radio>
  239. <el-radio label="×">X</el-radio>
  240. </el-radio-group>
  241. </td>
  242. </tr>
  243. <tr>
  244. <td>2</td>
  245. <td>设备本体</td>
  246. <td>设备定期检验、自行检查、设备本体有无事故隐患等</td>
  247. <td style="width: 150px;">
  248. <div class="radio-group-horizontal">
  249. <el-radio-group v-model="form.cDevice">
  250. <el-radio label="√">√</el-radio>
  251. <el-radio label="×">X</el-radio>
  252. </el-radio-group>
  253. </div>
  254. </td>
  255. </tr>
  256. <tr>
  257. <td>3</td>
  258. <td>安全附件或安全保护装置</td>
  259. <td>安全阀、爆破片等</td>
  260. <td>
  261. <el-radio-group v-model="form.cSafety">
  262. <el-radio label="√">√</el-radio>
  263. <el-radio label="×">X</el-radio>
  264. </el-radio-group>
  265. </td>
  266. </tr>
  267. <tr>
  268. <td>5</td>
  269. <td>政府监督、通报、预警</td>
  270. <td>发现不合格项</td>
  271. <td>
  272. <el-radio-group v-model="form.cGov">
  273. <el-radio label="√">√</el-radio>
  274. <el-radio label="×">X</el-radio>
  275. </el-radio-group>
  276. </td>
  277. </tr>
  278. <tr>
  279. <td>6</td>
  280. <td>投诉举报</td>
  281. <td>发现不合格项</td>
  282. <td>
  283. <el-radio-group v-model="form.cComplaint">
  284. <el-radio label="√">√</el-radio>
  285. <el-radio label="×">X</el-radio>
  286. </el-radio-group>
  287. </td>
  288. </tr>
  289. <tr>
  290. <td>7</td>
  291. <td>舆情信息</td>
  292. <td>发现不合格项</td>
  293. <td>
  294. <el-radio-group v-model="form.cOpinion">
  295. <el-radio label="√">√</el-radio>
  296. <el-radio label="×">X</el-radio>
  297. </el-radio-group>
  298. </td>
  299. </tr>
  300. <tr>
  301. <td>8</td>
  302. <td>其它</td>
  303. <td>锅炉、压力容器、压力管道、电梯、起重机械场车六大类特种设备可能危及安全的其它情况</td>
  304. <td>
  305. <el-radio-group v-model="form.cOther">
  306. <el-radio label="√">√</el-radio>
  307. <el-radio label="×">X</el-radio>
  308. </el-radio-group>
  309. </td>
  310. </tr>
  311. <tr>
  312. <!-- <td colspan="4">-->
  313. <!-- 不合格情况说明及采取的防范措施:-->
  314. <!-- <el-form-item label="不合格情况说明及采取的防范措施:" prop="explain">-->
  315. <!-- <el-input v-model="form.explain" type="textarea" placeholder="请输入内容" />-->
  316. <!-- </el-form-item>-->
  317. <!-- </td>-->
  318. </tr>
  319. </table>
  320. </div>
  321. <el-form-item label="不合格情况说明及采取的防范措施" prop="explain">
  322. <el-input v-model="form.explain" :rows="5" type="textarea" placeholder="请输入内容"/>
  323. </el-form-item>
  324. </el-form>
  325. <div slot="footer" class="dialog-footer">
  326. <el-button type="primary" @click="submitForm">确 定</el-button>
  327. <el-button @click="cancel">取 消</el-button>
  328. </div>
  329. </el-dialog>
  330. <!-- 用户导入对话框 -->
  331. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  332. <el-upload
  333. ref="upload"
  334. :limit="1"
  335. accept=".xlsx, .xls"
  336. :headers="upload.headers"
  337. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  338. :disabled="upload.isUploading"
  339. :on-progress="handleFileUploadProgress"
  340. :on-success="handleFileSuccess"
  341. :auto-upload="false"
  342. drag
  343. >
  344. <i class="el-icon-upload"></i>
  345. <div class="el-upload__text">
  346. 将文件拖到此处,或
  347. <em>点击上传</em>
  348. </div>
  349. <div class="el-upload__tip" slot="tip">
  350. <el-checkbox v-model="upload.updateSupport"/>
  351. 是否更新已经存在的用户数据
  352. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  353. </div>
  354. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  355. </el-upload>
  356. <div slot="footer" class="dialog-footer">
  357. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  358. <el-button @click="upload.open = false">取 消</el-button>
  359. </div>
  360. </el-dialog>
  361. <el-dialog :close-on-click-modal="false" v-loading="loadingFlash" element-loading-background="rgba(0,0,0,0.2)"
  362. v-dialogDrag :title="pdf.title"
  363. :visible.sync="pdf.open" width="1300px" :center="true" append-to-body>
  364. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  365. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  366. </div>
  367. <div style="margin-top: -30px">
  368. <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"
  369. v-if="ppt"></iframe>
  370. </div>
  371. <div style="padding: 30px; width: 100%; height: 100%;">
  372. <el-carousel class="" ref="carousel" arrow="always" v-if="pptView"
  373. height="700px" trigger="click" :autoplay="false" indicator-position="outside">
  374. <el-carousel-item class="lun_img" v-for="item in imgs" v-bind:key="item">
  375. <img :src="item" width="100%" height="100%" object-fit="cover"/>
  376. </el-carousel-item>
  377. </el-carousel>
  378. </div>
  379. </el-dialog>
  380. <form ref="downloadForm2" :action="downloadWordAction" target="FORMSUBMIT">
  381. <input name="id" v-model="downloadForm2.id" hidden/>
  382. </form>
  383. <form ref="downloadFormPdf" :action="downloadWordActionPdf" target="FORMSUBMIT">
  384. <input name="id" v-model="downloadFormPdf.id" hidden/>
  385. </form>
  386. <Attachment ref="childRef"></Attachment>
  387. </div>
  388. </template>
  389. <script>
  390. import {
  391. wordView,
  392. batchConfirm,
  393. listDailycheck,
  394. getDailycheck,
  395. delDailycheck,
  396. addDailycheck,
  397. updateDailycheck,
  398. exportDailycheck,
  399. importTemplate, batchCancel
  400. } from "@/api/sems/safecheck/dailycheck";
  401. import {treeselect} from "@/api/system/dept";
  402. import {getToken} from "@/utils/auth";
  403. import Treeselect from "@riophae/vue-treeselect";
  404. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  405. import {mylistPlant} from "@/api/system/plant";
  406. import Attachment from '@/views/components/file/attachment.vue'
  407. export default {
  408. name: "Dailycheck",
  409. components: {Treeselect,Attachment},
  410. data() {
  411. return {
  412. // 遮罩层
  413. loading: true,
  414. // 选中数组
  415. ids: [],
  416. dataListSelections: [],
  417. // 非单个禁用
  418. single: true,
  419. // 非多个禁用
  420. multiple: true,
  421. // 显示搜索条件
  422. showSearch: false,
  423. // 总条数
  424. total: 0,
  425. // 每日安全检查表格数据
  426. dailycheckList: [],
  427. // 弹出层标题
  428. title: "",
  429. pptView: false,
  430. ppt: false,
  431. loadingFlash: false,
  432. // 部门树选项
  433. deptOptions: undefined,
  434. plantOptions: [],
  435. plantIds: [],
  436. clientHeight: 300,
  437. // 是否显示弹出层
  438. open: false,
  439. // 用户导入参数
  440. upload: {
  441. // 是否显示弹出层(用户导入)
  442. open: false,
  443. // 弹出层标题(用户导入)
  444. title: "",
  445. // 是否禁用上传
  446. isUploading: false,
  447. // 是否更新已经存在的用户数据
  448. updateSupport: 0,
  449. // 设置上传的请求头部
  450. headers: {Authorization: "Bearer " + getToken()},
  451. // 上传的地址
  452. url: process.env.VUE_APP_BASE_API + "/safecheck/dailycheck/importData"
  453. },
  454. pdf: {
  455. title: '',
  456. pdfUrl: '',
  457. numPages: null,
  458. open: false,
  459. pageNum: 1,
  460. pageTotalNum: 1,
  461. loadedRatio: 0,
  462. },
  463. // 查询参数
  464. queryParams: {
  465. pageNum: 1,
  466. pageSize: 500,
  467. plantCode: null,
  468. checkDate: null,
  469. cPerson: null,
  470. cDevice: null,
  471. cSafety: null,
  472. cEnv: null,
  473. cGov: null,
  474. cComplaint: null,
  475. cOpinion: null,
  476. cOther: null,
  477. explain: null
  478. },
  479. //日期快速选择
  480. pickerOptions: {
  481. shortcuts: [{
  482. text: this.$t('最近一周'),
  483. onClick(picker) {
  484. const end = new Date();
  485. const start = new Date();
  486. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  487. picker.$emit('pick', [start, end]);
  488. }
  489. }, {
  490. text: this.$t('最近一个月'),
  491. onClick(picker) {
  492. const end = new Date();
  493. const start = new Date();
  494. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  495. picker.$emit('pick', [start, end]);
  496. }
  497. }, {
  498. text: this.$t('最近三个月'),
  499. onClick(picker) {
  500. const end = new Date();
  501. const start = new Date();
  502. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  503. picker.$emit('pick', [start, end]);
  504. }
  505. }]
  506. },
  507. //日期选择器
  508. chooseDate: [],
  509. // 表单参数
  510. form: {},
  511. downloadForm2: {
  512. id: '',
  513. },
  514. downloadWordAction: process.env.VUE_APP_BASE_API + '/safecheck/dailycheck/downloadDailycheck',
  515. downloadFormPdf: {
  516. id: '',
  517. },
  518. downloadWordActionPdf: process.env.VUE_APP_BASE_API + '/safecheck/dailycheck/downloadDailycheckPdf',
  519. // 表单校验
  520. rules: {
  521. plantCode: [
  522. {required: true, message: "装置名称不能为空", trigger: "blur"}
  523. ],
  524. }
  525. };
  526. },
  527. watch: {
  528. // 根据名称筛选部门树
  529. deptName(val) {
  530. this.$refs.tree.filter(val);
  531. }
  532. },
  533. created() {
  534. //设置表格高度对应屏幕高度
  535. this.$nextTick(() => {
  536. this.clientHeight = document.body.clientHeight - 250
  537. })
  538. this.getList();
  539. this.getTreeselect();
  540. let plantParams = {
  541. pType: 1
  542. }
  543. mylistPlant(plantParams).then(response => {
  544. this.plantOptions = response.data;
  545. });
  546. },
  547. methods: {
  548. /** 查询每日安全检查列表 */
  549. getList() {
  550. this.loading = true;
  551. listDailycheck(this.queryParams).then(response => {
  552. this.dailycheckList = response.rows;
  553. this.total = response.total;
  554. this.loading = false;
  555. });
  556. },
  557. /** 查询部门下拉树结构 */
  558. getTreeselect() {
  559. treeselect().then(response => {
  560. this.deptOptions = response.data;
  561. });
  562. },
  563. // 字典翻译
  564. isConfirmFormat(row, column) {
  565. let type = 'info';
  566. if (row.isConfirm == 0) {
  567. let s = '未锁定'
  568. return <el-tag type={type}>{s}</el-tag>;
  569. }
  570. if (row.isConfirm == 1) {
  571. let s = '已锁定'
  572. type = 'success';
  573. return <el-tag type={type}>{s}</el-tag>;
  574. }
  575. },
  576. itemFormat(row, column, cellValue, index) {
  577. let type = 'danger';
  578. if (cellValue == '×') {
  579. return <el-tag type={type}>{cellValue}</el-tag>;
  580. }
  581. return cellValue;
  582. },
  583. // 取
  584. // 取消按钮
  585. cancel() {
  586. this.open = false;
  587. this.reset();
  588. },
  589. // 表单重置
  590. reset() {
  591. this.form = {
  592. id: null,
  593. plantCode: null,
  594. delFlag: null,
  595. createrCode: null,
  596. createdate: null,
  597. updaterCode: null,
  598. updatedate: null,
  599. checkDate: null,
  600. checkerId: null,
  601. cPerson: "0",
  602. cDevice: "0",
  603. cSafety: "0",
  604. cEnv: "0",
  605. cGov: "0",
  606. cComplaint: "0",
  607. cOpinion: "0",
  608. cOther: "0",
  609. explain: null
  610. };
  611. this.resetForm("form");
  612. },
  613. /** 搜索按钮操作 */
  614. handleQuery() {
  615. this.queryParams.pageNum = 1;
  616. if (this.chooseDate == null) {
  617. this.chooseDate = []
  618. }
  619. this.queryParams.startDate = this.chooseDate[0]
  620. this.queryParams.endDate = this.chooseDate[1]
  621. this.queryParams.plants = this.plantIds.join(',')
  622. this.getList();
  623. },
  624. /** 重置按钮操作 */
  625. resetQuery() {
  626. this.resetForm("queryForm");
  627. this.chooseDate = "";
  628. this.plantIds = [];
  629. this.handleQuery();
  630. },
  631. // 多选框选中数据
  632. handleSelectionChange(selection) {
  633. this.ids = selection.map(item => item.id)
  634. this.single = selection.length !== 1
  635. this.multiple = !selection.length
  636. this.dataListSelections = selection
  637. },
  638. /** 新增按钮操作 */
  639. handleAdd() {
  640. this.reset();
  641. this.open = true;
  642. this.title = "添加每日安全检查";
  643. },
  644. /** 修改按钮操作 */
  645. handleUpdate(row) {
  646. this.reset();
  647. const id = row.id || this.ids
  648. var rows = this.dataListSelections.map(item => {
  649. return item
  650. })
  651. for (let i = 0; i < rows.length; i++) {
  652. if (rows[i].isConfirm != 0) {
  653. this.$alert("已锁定,无法修改", this.$t('提示'), {
  654. type: 'warning'
  655. })
  656. return
  657. }
  658. }
  659. getDailycheck(id).then(response => {
  660. this.form = response.data;
  661. this.open = true;
  662. this.title = "修改每日安全检查";
  663. });
  664. },
  665. /** 提交按钮 */
  666. submitForm() {
  667. this.$refs["form"].validate(valid => {
  668. if (valid) {
  669. if (this.form.id != null) {
  670. updateDailycheck(this.form).then(response => {
  671. this.msgSuccess("修改成功");
  672. this.open = false;
  673. this.getList();
  674. });
  675. } else {
  676. addDailycheck(this.form).then(response => {
  677. this.msgSuccess("新增成功");
  678. this.open = false;
  679. this.getList();
  680. });
  681. }
  682. }
  683. });
  684. },
  685. /** 删除按钮操作 */
  686. handleDelete(row) {
  687. const ids = row.id || this.ids;
  688. var rows = this.dataListSelections.map(item => {
  689. return item
  690. })
  691. for (let i = 0; i < rows.length; i++) {
  692. if (rows[i].isConfirm != 0) {
  693. this.$alert("已锁定,无法删除", this.$t('提示'), {
  694. type: 'warning'
  695. })
  696. return
  697. }
  698. }
  699. this.$confirm('是否确认删除?', "警告", {
  700. confirmButtonText: "确定",
  701. cancelButtonText: "取消",
  702. type: "warning"
  703. }).then(function () {
  704. return delDailycheck(ids);
  705. }).then(() => {
  706. this.getList();
  707. this.msgSuccess("删除成功");
  708. })
  709. },
  710. handleDownload() {
  711. const ids = this.ids;
  712. this.downloadForm2.id = ids.join(',')
  713. this.$nextTick(() => {
  714. this.$refs['downloadForm2'].submit()
  715. })
  716. },
  717. handleDownloadPdf() {
  718. const ids = this.ids;
  719. this.downloadFormPdf.id = ids.join(',')
  720. this.$nextTick(() => {
  721. this.$refs['downloadFormPdf'].submit()
  722. })
  723. },
  724. /** 导出按钮操作 */
  725. handleExport() {
  726. const queryParams = this.queryParams;
  727. this.$confirm('是否确认导出所有每日安全检查数据项?', "警告", {
  728. confirmButtonText: "确定",
  729. cancelButtonText: "取消",
  730. type: "warning"
  731. }).then(function () {
  732. return exportDailycheck(queryParams);
  733. }).then(response => {
  734. this.download(response.msg);
  735. })
  736. },
  737. /** 导入按钮操作 */
  738. handleImport() {
  739. this.upload.title = "用户导入";
  740. this.upload.open = true;
  741. },
  742. /** 下载模板操作 */
  743. importTemplate() {
  744. importTemplate().then(response => {
  745. this.download(response.msg);
  746. });
  747. },
  748. // 文件上传中处理
  749. handleFileUploadProgress(event, file, fileList) {
  750. this.upload.isUploading = true;
  751. },
  752. // 文件上传成功处理
  753. handleFileSuccess(response, file, fileList) {
  754. this.upload.open = false;
  755. this.upload.isUploading = false;
  756. this.$refs.upload.clearFiles();
  757. this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
  758. this.getList();
  759. },
  760. // 提交上传文件
  761. submitFileForm() {
  762. this.$refs.upload.submit();
  763. },
  764. wordView(row) {
  765. wordView(row.id).then(response => {
  766. console.log(response.msg)
  767. this.handleSee("每日检查记录", response.msg)
  768. });
  769. },
  770. handleSee(fileName, url) {
  771. //office预览
  772. this.loadingFlash = true
  773. this.pdf.open = true
  774. this.pdf.title = fileName
  775. this.pdf.pdfUrl = ""
  776. this.pptView = false
  777. this.ppt = true
  778. //如果是PDF等直接可以打开的就不调接口,否则调用接口
  779. if (fileName.endsWith('pdf')) {
  780. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + url
  781. this.loadingFlash = false
  782. } else {
  783. const formatDate = new FormData();
  784. formatDate.append("filepath", url)
  785. //调用文件预览api
  786. let res = this.officeConvert.bookConvertCommon(formatDate)
  787. //查看接受全局方法的返回结果 console.log(res)
  788. //利用.then方法接受Promise对象
  789. res.then((result) => {
  790. //关闭加载中
  791. this.loadingFlash = false
  792. if (result.msg.includes("csv")) {
  793. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + result.data
  794. this.$alert(result.msg, this.$t('检查乱码'), {dangerouslyUseHTMLString: true});
  795. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  796. } else if (result.msg.includes("不存在")) {
  797. //文件不存在时提示
  798. this.pdf.pdfUrl = ""
  799. this.$alert(result.msg, this.$t('预览失败'), {dangerouslyUseHTMLString: true});
  800. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  801. this.pdf.open = false
  802. } else if (result.msg.includes("不支持此格式")) {
  803. this.pdf.pdfUrl = ""
  804. this.$alert(result.msg, this.$t('预览失败'), {dangerouslyUseHTMLString: true});
  805. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  806. this.pdf.open = false
  807. } else {
  808. //成功时直接给地址
  809. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + result.data
  810. }
  811. }).catch(result => {
  812. //请求失败,关闭loading,pdf地址直接为为空,不显示
  813. this.pdf.pdfUrl = ""
  814. this.loadingFlash = false;
  815. })
  816. }
  817. },
  818. //文件预览
  819. openPdf() {
  820. //ppt就跳路由预览,office就直接打开文件新页面
  821. const didi = {imgs: this.imgs}
  822. if (this.pptView == true && this.ppt == false) {
  823. let routeUrl = this.$router.resolve({
  824. path: "/cpms/index.html#/pptyulan",
  825. query: didi
  826. });
  827. window.open("/cpms/index.html#/pptyulan?id=" + this.pdf.pdfUrl, '_blank')
  828. console.log(this.imgs)
  829. } else {
  830. window.open(this.pdf.pdfUrl)
  831. }
  832. },
  833. /** 报告附件按钮操作 */
  834. handleDoc(row) {
  835. // 通过ref引用子组件
  836. const child = this.$refs.childRef;
  837. // 调用子组件的方法并传递参数
  838. child.handleDoc(row , 'dailycheck');
  839. },
  840. /** 批量按钮操作 */
  841. handleBatchConfirm(row) {
  842. const ids = row.id || this.ids;
  843. this.$confirm('是否锁定?', "警告", {
  844. confirmButtonText: "确定",
  845. cancelButtonText: "取消",
  846. type: "warning"
  847. }).then(function() {
  848. return batchConfirm(ids);
  849. }).then(() => {
  850. this.getList();
  851. this.msgSuccess("操作成功");
  852. })
  853. },
  854. /** 批量按钮操作 */
  855. handleBatchCancel(row) {
  856. const ids = row.id || this.ids;
  857. this.$confirm('是否取消锁定?', "警告", {
  858. confirmButtonText: "确定",
  859. cancelButtonText: "取消",
  860. type: "warning"
  861. }).then(function() {
  862. return batchCancel(ids);
  863. }).then(() => {
  864. this.getList();
  865. this.msgSuccess("操作成功");
  866. })
  867. },
  868. selectAll() {
  869. this.plantIds = []
  870. if (this.checked) {
  871. this.plantOptions.map((item) => {
  872. this.plantIds.push(item.name)
  873. })
  874. } else {
  875. this.plantIds = []
  876. }
  877. if (this.plantIds.length == 0) {
  878. this.plantIds = ['']
  879. }
  880. },
  881. handleCommand(val) {
  882. if (this.plantIds.length == 0) {
  883. this.plantIds = ['']
  884. }
  885. val.forEach((item,index)=>{
  886. if(item===''){
  887. val.splice(index,1)
  888. }
  889. })
  890. if (val.length === this.plantOptions.length) {
  891. this.checked = true
  892. } else {
  893. this.checked = false
  894. }
  895. },
  896. }
  897. };
  898. </script>
  899. <style scoped>
  900. .checklist-table {
  901. margin-top: 20px;
  902. margin-bottom: 20px;
  903. }
  904. .checklist-table table {
  905. width: 100%;
  906. border-collapse: collapse;
  907. }
  908. .checklist-table th,
  909. .checklist-table td {
  910. padding: 10px;
  911. border: 1px solid #ccc;
  912. text-align: center;
  913. }
  914. .checklist-table th {
  915. background-color: #f5f5f5;
  916. }
  917. .radio-group-horizontal {
  918. display: flex;
  919. justify-content: space-around;
  920. align-items: center;
  921. }
  922. </style>