index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  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="checkContent">
  5. <el-input
  6. v-model="queryParams.checkContent"
  7. placeholder="请输入检查内容"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button
  21. type="primary"
  22. icon="el-icon-plus"
  23. size="mini"
  24. @click="handleAdd"
  25. v-hasPermi="['pssr:lighting:add']"
  26. v-if="isApprove==0"
  27. >新增</el-button>
  28. </el-col>
  29. <el-col :span="1.5">
  30. <el-button
  31. type="success"
  32. icon="el-icon-edit"
  33. size="mini"
  34. :disabled="single"
  35. @click="handleUpdate"
  36. v-hasPermi="['pssr:lighting:edit']"
  37. v-if="isApprove==0"
  38. >修改</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button
  42. type="danger"
  43. icon="el-icon-delete"
  44. size="mini"
  45. :disabled="multiple"
  46. @click="handleDelete"
  47. v-hasPermi="['pssr:lighting:remove']"
  48. v-if="isApprove==0"
  49. >删除</el-button>
  50. </el-col>
  51. <el-col :span="1.5">
  52. <el-button
  53. type="info"
  54. icon="el-icon-upload2"
  55. size="mini"
  56. @click="handleImport"
  57. v-hasPermi="['pssr:lighting:edit']"
  58. v-if="isApprove==0"
  59. >导入</el-button>
  60. </el-col>
  61. <el-col :span="1.5">
  62. <el-button
  63. type="warning"
  64. icon="el-icon-download"
  65. size="mini"
  66. @click="handleExport"
  67. v-hasPermi="['pssr:lighting:export']"
  68. v-if="isApprove==0"
  69. >导出</el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="success"
  74. icon="el-icon-s-promotion"
  75. size="mini"
  76. @click="handleApprove"
  77. v-if="isApprove==0"
  78. v-hasPermi="['pssr:lighting:edit']"
  79. >发起审批
  80. </el-button>
  81. </el-col>
  82. <el-col :span="1.5">
  83. <el-button
  84. type="primary"
  85. icon="el-icon-check"
  86. size="mini"
  87. v-if="isApprove==4||isApprove==5"
  88. @click="handleConfirmApprove"
  89. v-hasPermi="['pssr:lighting:edit']"
  90. >确认
  91. </el-button>
  92. </el-col>
  93. <el-col :span="1.5">
  94. <el-button
  95. type="danger"
  96. icon="el-icon-refresh-left"
  97. size="mini"
  98. v-if="isApprove==2"
  99. :disabled="multiple"
  100. @click="handleTurnDown"
  101. v-hasPermi="['pssr:lighting:edit']"
  102. >驳回
  103. </el-button>
  104. </el-col>
  105. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  106. </el-row>
  107. <div style="width: 100%;text-align: center;margin-bottom: 15px">
  108. <H2 v-if="lightingType == 1">现场照明检查确认表</H2>
  109. <H2 v-if="lightingType == 2">现场电伴热检查确认表</H2>
  110. <span v-if="lightingType == 2">检查填写要求:检查现场各区域的电伴热,符合检查内容的要求在检查结果打“√”;不符合要求的打“×”,<br>
  111. 检查中不符合要求的,必须按照该条检查内容的要求立即整改。如不能立即整改的,请立即汇报相关负责人并采取临时应对措施。</span>
  112. <span v-if="lightingType == 1">检查填写要求:检查现场各区域的照明设备,符合检查内容的要求在检查结果打“√”;不符合要求的打“×”,<br>
  113. 检查中不符合要求的,必须按照该条检查内容的要求立即整改。如不能立即整改的,请立即汇报相关负责人并采取临时应对措施。</span>
  114. </div>
  115. <el-table v-loading="loading" :data="lightingList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  116. <el-table-column type="selection" width="55" align="center" />
  117. <el-table-column label="审批状态" align="center" prop="approveStatus" width="100">
  118. <template slot-scope="scope">
  119. <el-tag v-if="scope.row.approveStatus==0">未审批</el-tag>
  120. <el-tag v-if="scope.row.approveStatus==1" type="warning">待确认</el-tag>
  121. <el-tag v-if="scope.row.approveStatus==3" type="success">已确认1</el-tag>
  122. <el-tag v-if="scope.row.approveStatus==2" type="success">已确认2</el-tag>
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="检查内容" align="center" prop="checkContent" :show-overflow-tooltip="true"/>
  126. <el-table-column label="检查结果" align="center" prop="checkResult" :show-overflow-tooltip="true"/>
  127. <el-table-column label="确认人1" align="center" prop="confirm1" :show-overflow-tooltip="true"
  128. width="150">
  129. <template slot-scope="scope">
  130. <span>{{ userFormat(scope.row.confirm1) }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="确认人2" align="center" prop="confirm2" :show-overflow-tooltip="true"
  134. width="150">
  135. <template slot-scope="scope">
  136. <span>{{ userFormat(scope.row.confirm2) }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="确认时间" align="center" prop="confirmationDate" width="100">
  140. <template slot-scope="scope">
  141. <span>{{ parseTime(scope.row.confirmationDate, '{y}-{m}-{d}') }}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="驳回原因" align="center" prop="reason" :show-overflow-tooltip="true"/>
  145. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  146. <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width" v-if="isApprove==0">
  147. <template slot-scope="scope">
  148. <el-button
  149. size="mini"
  150. type="text"
  151. icon="el-icon-folder"
  152. v-if="scope.row.approveStatus!=2"
  153. @click="handleDoc(scope.row)"
  154. >附件
  155. </el-button>
  156. <el-button
  157. size="mini"
  158. type="text"
  159. icon="el-icon-edit"
  160. @click="handleUpdate(scope.row)"
  161. v-hasPermi="['pssr:lighting:edit']"
  162. >修改</el-button>
  163. <el-button
  164. size="mini"
  165. type="text"
  166. icon="el-icon-delete"
  167. @click="handleDelete(scope.row)"
  168. v-hasPermi="['pssr:lighting:remove']"
  169. >删除</el-button>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. <pagination
  174. v-show="total>0"
  175. :total="total"
  176. :page.sync="queryParams.pageNum"
  177. :limit.sync="queryParams.pageSize"
  178. @pagination="getList"
  179. />
  180. <!-- 添加或修改照明对话框 -->
  181. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
  182. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  183. <el-form-item label="检查内容">
  184. <el-input type="textarea" v-model="form.checkContent" :min-height="192"/>
  185. </el-form-item>
  186. <el-form-item label="检查结果" prop="checkResult">
  187. <el-radio-group v-model="form.checkResult">
  188. <el-radio label="✔">✔</el-radio>
  189. <el-radio label="✖">✖</el-radio>
  190. </el-radio-group>
  191. </el-form-item>
  192. <el-form-item label="确认人1" prop="confirm1">
  193. <el-select v-model="form.confirm1" clearable filterable style="width: 100%;"
  194. placeholder="请选择确认人1">
  195. <el-option v-for="user in userOptions"
  196. :label="user.nickName"
  197. :value="user.userId+''"
  198. :key="user.userId"/>
  199. </el-select>
  200. </el-form-item>
  201. <el-form-item label="确认人2" prop="confirm2">
  202. <el-select v-model="form.confirm2" clearable filterable style="width: 100%;"
  203. placeholder="请选择确认人2">
  204. <el-option v-for="user in userOptions"
  205. :label="user.nickName"
  206. :value="user.userId+''"
  207. :key="user.userId"/>
  208. </el-select>
  209. </el-form-item>
  210. <el-form-item label="确认时间" prop="confirmationDate">
  211. <el-date-picker clearable size="small" style="width: 200px"
  212. v-model="form.confirmationDate"
  213. type="date"
  214. value-format="yyyy-MM-dd"
  215. placeholder="选择确认时间">
  216. </el-date-picker>
  217. </el-form-item>
  218. <el-form-item label="备注" prop="remarks">
  219. <el-input v-model="form.remarks" placeholder="请输入备注" />
  220. </el-form-item>
  221. </el-form>
  222. <div slot="footer" class="dialog-footer">
  223. <el-button type="primary" @click="submitForm">确 定</el-button>
  224. <el-button @click="cancel">取 消</el-button>
  225. </div>
  226. </el-dialog>
  227. <!-- 用户导入对话框 -->
  228. <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  229. <el-upload
  230. ref="upload"
  231. :limit="1"
  232. accept=".xlsx, .xls"
  233. :headers="upload.headers"
  234. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  235. :disabled="upload.isUploading"
  236. :on-progress="handleFileUploadProgress"
  237. :on-success="handleFileSuccess"
  238. :auto-upload="false"
  239. drag
  240. >
  241. <i class="el-icon-upload"></i>
  242. <div class="el-upload__text">
  243. 将文件拖到此处,或
  244. <em>点击上传</em>
  245. </div>
  246. <div class="el-upload__tip" slot="tip">
  247. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  248. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  249. </div>
  250. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  251. </el-upload>
  252. <div slot="footer" class="dialog-footer">
  253. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  254. <el-button @click="upload.open = false">取 消</el-button>
  255. </div>
  256. </el-dialog>
  257. <!-- 附件对话框 -->
  258. <el-dialog v-dialogDrag :close-on-click-modal="false" :visible.sync="doc.open" append-to-body title="现场照片"
  259. width="1000px">
  260. <el-image v-for="file in doc.fileList" :key="file.id" :src="file.fileUrl" lazy></el-image>
  261. </el-dialog>
  262. <!-- 驳回原因对话框 -->
  263. <el-dialog v-dialogDrag :close-on-click-modal="false" :visible.sync="reason.open" append-to-body title="驳回"
  264. width="1000px">
  265. <el-table :data="items" border>
  266. <el-table-column label="检查内容" align="center" prop="checkContent" :show-overflow-tooltip="true"/>
  267. <el-table-column label="驳回原因" align="center" prop="reason" :show-overflow-tooltip="true">
  268. <template slot-scope="scope">
  269. <el-input v-model="scope.row.reason" placeholder="请输入驳回原因"/>
  270. </template>
  271. </el-table-column>
  272. </el-table>
  273. <div slot="footer" class="dialog-footer">
  274. <el-button type="primary" @click="submitReasonForm">确 定</el-button>
  275. <el-button @click="reasonCancel">取 消</el-button>
  276. </div>
  277. </el-dialog>
  278. </div>
  279. </template>
  280. <script>
  281. import {
  282. addLighting,
  283. delLighting,
  284. exportLighting,
  285. getLighting,
  286. handleConfirmLighting,
  287. handleTurnDownLighting,
  288. importTemplate,
  289. listLighting,
  290. updateLighting,
  291. updateLightingBatch,
  292. } from "@/api/pssr/lighting";
  293. import {treeselect} from "@/api/system/dept";
  294. import {getToken} from "@/utils/auth";
  295. import Treeselect from "@riophae/vue-treeselect";
  296. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  297. import {listUserNoPage} from "@/api/system/user";
  298. import {listFile} from "@/api/pssr/file";
  299. import {doApprove} from "@/api/pssr/approve";
  300. export default {
  301. dicts:['pssr_approve_status'],
  302. name: "Lighting",
  303. components: { Treeselect },
  304. // components: { Editor },
  305. props: {
  306. subId: {
  307. type: Number,
  308. default: 0
  309. },
  310. isApprove: {
  311. type: Number,
  312. default: 0
  313. },
  314. lightingType: {
  315. type: Number,
  316. default: 0
  317. },
  318. },
  319. data() {
  320. return {
  321. reason: {
  322. open: false
  323. },
  324. doc: {
  325. file: "",
  326. // 是否显示弹出层(报告附件)
  327. open: false,
  328. fileList: [],
  329. queryParams: {
  330. itemId: null,
  331. subId: this.subId,
  332. forShort: 'zmdbr'
  333. },
  334. },
  335. userOptions: [],
  336. // 遮罩层
  337. loading: true,
  338. // 选中数组
  339. ids: [],
  340. items: [],
  341. // 非单个禁用
  342. single: true,
  343. // 非多个禁用
  344. multiple: true,
  345. // 显示搜索条件
  346. showSearch: false,
  347. // 总条数
  348. total: 0,
  349. // 照明表格数据
  350. lightingList: [],
  351. // 弹出层标题
  352. title: "",
  353. // 部门树选项
  354. deptOptions: undefined,
  355. clientHeight:300,
  356. // 是否显示弹出层
  357. open: false,
  358. openBatch: false,
  359. // 用户导入参数
  360. upload: {
  361. // 是否显示弹出层(用户导入)
  362. open: false,
  363. // 弹出层标题(用户导入)
  364. title: "",
  365. // 是否禁用上传
  366. isUploading: false,
  367. // 是否更新已经存在的用户数据
  368. updateSupport: 0,
  369. // 设置上传的请求头部
  370. headers: { Authorization: "Bearer " + getToken() },
  371. // 上传的地址
  372. url: process.env.VUE_APP_BASE_API + "/pssr/lighting/importData"
  373. },
  374. // 查询参数
  375. queryParams: {
  376. pageNum: 1,
  377. pageSize: 20,
  378. subId: this.subId,
  379. approveId: null,
  380. checkContent: null,
  381. checkResult: null,
  382. checkDes: null,
  383. changeResult: null,
  384. confirm: null,
  385. confirmationDate: null,
  386. createrCode: null,
  387. createdate: null,
  388. updaterCode: null,
  389. updatedate: null,
  390. deptId: null,
  391. remarks: null,
  392. lightingType: this.lightingType,
  393. },
  394. // 表单参数
  395. form: {},
  396. // 表单校验
  397. rules: {
  398. confirm1: [{required: true, message: "人员不可为空", trigger: "blur"}],
  399. confirm2: [{required: true, message: "人员不可为空", trigger: "blur"}],
  400. }
  401. };
  402. },
  403. watch: {
  404. // 根据名称筛选部门树
  405. deptName(val) {
  406. this.$refs.tree.filter(val);
  407. }
  408. },
  409. created() {
  410. //设置表格高度对应屏幕高度
  411. this.$nextTick(() => {
  412. this.clientHeight = document.body.clientHeight - 350
  413. })
  414. this.getList();
  415. this.getTreeselect();
  416. listUserNoPage({}).then(res => {
  417. this.userOptions = res.data
  418. });
  419. },
  420. methods: {
  421. /** 查询照明列表 */
  422. getList() {
  423. this.loading = true;
  424. listLighting(this.queryParams).then(response => {
  425. this.lightingList = response.rows;
  426. this.total = response.total;
  427. this.loading = false;
  428. });
  429. },
  430. /** 查询部门下拉树结构 */
  431. getTreeselect() {
  432. treeselect().then(response => {
  433. this.deptOptions = response.data;
  434. });
  435. },
  436. // 取消按钮
  437. cancel() {
  438. this.open = false;
  439. this.reset();
  440. },
  441. // 表单重置
  442. reset() {
  443. this.form = {
  444. id: null,
  445. subId: this.subId,
  446. approveId: null,
  447. checkContent: null,
  448. checkResult: null,
  449. checkDes: null,
  450. changeResult: null,
  451. confirm: null,
  452. confirmationDate: null,
  453. delFlag: null,
  454. createrCode: null,
  455. createdate: null,
  456. updaterCode: null,
  457. updatedate: null,
  458. deptId: null,
  459. remarks: null,
  460. lightingType: this.lightingType,
  461. };
  462. this.resetForm("form");
  463. },
  464. /** 搜索按钮操作 */
  465. handleQuery() {
  466. this.queryParams.pageNum = 1;
  467. this.getList();
  468. },
  469. /** 重置按钮操作 */
  470. resetQuery() {
  471. this.resetForm("queryForm");
  472. this.handleQuery();
  473. },
  474. // 多选框选中数据
  475. handleSelectionChange(selection) {
  476. this.items=selection;
  477. this.ids = selection.map(item => item.id)
  478. this.single = selection.length!==1
  479. this.multiple = !selection.length
  480. },
  481. /** 新增按钮操作 */
  482. handleAdd() {
  483. this.reset();
  484. this.open = true;
  485. this.title = "添加照明";
  486. },
  487. /** 修改按钮操作 */
  488. handleUpdate(row) {
  489. this.reset();
  490. const id = row.id || this.ids
  491. getLighting(id).then(response => {
  492. this.form = response.data;
  493. this.open = true;
  494. this.title = "修改照明";
  495. });
  496. },
  497. /** 提交按钮 */
  498. submitForm() {
  499. this.$refs["form"].validate(valid => {
  500. if (valid) {
  501. if (this.form.id != null) {
  502. updateLighting(this.form).then(response => {
  503. this.msgSuccess("修改成功");
  504. this.open = false;
  505. this.getList();
  506. });
  507. } else {
  508. addLighting(this.form).then(response => {
  509. this.msgSuccess("新增成功");
  510. this.open = false;
  511. this.getList();
  512. });
  513. }
  514. }
  515. });
  516. },
  517. /** 删除按钮操作 */
  518. handleDelete(row) {
  519. const ids = row.id || this.ids;
  520. this.$confirm('是否确认删除?', "警告", {
  521. confirmButtonText: "确定",
  522. cancelButtonText: "取消",
  523. type: "warning"
  524. }).then(function() {
  525. return delLighting(ids);
  526. }).then(() => {
  527. this.getList();
  528. this.msgSuccess("删除成功");
  529. })
  530. },
  531. /** 导出按钮操作 */
  532. handleExport() {
  533. const queryParams = this.queryParams;
  534. this.$confirm('是否确认导出所有照明数据项?', "警告", {
  535. confirmButtonText: "确定",
  536. cancelButtonText: "取消",
  537. type: "warning"
  538. }).then(function() {
  539. return exportLighting(queryParams);
  540. }).then(response => {
  541. this.download(response.msg);
  542. })
  543. },
  544. /** 导入按钮操作 */
  545. handleImport() {
  546. this.upload.title = "用户导入";
  547. this.upload.open = true;
  548. },
  549. /** 下载模板操作 */
  550. importTemplate() {
  551. importTemplate().then(response => {
  552. this.download(response.msg);
  553. });
  554. },
  555. // 文件上传中处理
  556. handleFileUploadProgress(event, file, fileList) {
  557. this.upload.isUploading = true;
  558. },
  559. // 文件上传成功处理
  560. handleFileSuccess(response, file, fileList) {
  561. this.upload.open = false;
  562. this.upload.isUploading = false;
  563. this.$refs.upload.clearFiles();
  564. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  565. this.getList();
  566. },
  567. // 提交上传文件
  568. submitFileForm() {
  569. this.$refs.upload.submit();
  570. },
  571. /** 确认按钮操作*/
  572. handleApprove() {
  573. doApprove(this.subId).then(res => {
  574. this.msgSuccess("已发起确认流程");
  575. })
  576. },
  577. handleConfirmApprove() {
  578. let data = {
  579. ids: this.ids,
  580. subId: this.subId,
  581. taskType: this.isApprove,
  582. lightingType: this.lightingType,
  583. }
  584. handleConfirmLighting(data).then(res => {
  585. this.msgSuccess("确认成功");
  586. this.getList()
  587. this.$emit('refreshHisList');
  588. })
  589. },
  590. handleTurnDown(val) {
  591. this.reason.open=true;
  592. },
  593. userFormat(userId) {
  594. for (let item of this.userOptions) {
  595. if (item.userId == userId) {
  596. return item.nickName
  597. }
  598. }
  599. },
  600. /** 报告附件按钮操作 */
  601. handleDoc(row) {
  602. this.doc.fileList=[]
  603. this.doc.open = true;
  604. this.doc.queryParams.itemId = row.id
  605. this.getFileList()
  606. },
  607. getFileList() {
  608. listFile(this.doc.queryParams).then(response => {
  609. this.doc.fileList = response.rows;
  610. this.doc.fileList.forEach(item => {
  611. item.fileUrl = process.env.VUE_APP_BASE_API + item.fileUrl;
  612. });
  613. });
  614. },
  615. reasonCancel() {
  616. this.reason.open = false;
  617. },
  618. submitReasonForm(){
  619. handleTurnDownLighting(this.items).then(res => {
  620. this.msgSuccess("驳回成功");
  621. this.reason.open = false;
  622. this.$emit('refreshHisList');
  623. })
  624. }
  625. }
  626. };
  627. </script>