index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <template>
  2. <div class="app-container scroll-auto">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="日期" prop="reportDate">
  5. <el-date-picker
  6. v-model="queryParams.reportDate"
  7. style="width: 240px; margin-right: 8px"
  8. type="daterange"
  9. range-separator="至"
  10. start-placeholder="开始日期"
  11. end-placeholder="结束日期"
  12. value-format="yyyyMMdd"
  13. :clearable="false"
  14. >
  15. </el-date-picker>
  16. </el-form-item>
  17. <el-form-item label="月计划编号" prop="planCode" label-width="120">
  18. <el-input
  19. v-model="queryParams.planCode"
  20. placeholder="请输入月计划编号"
  21. clearable
  22. />
  23. </el-form-item>
  24. <el-form-item label="周计划编号" prop="planCodeW" label-width="120">
  25. <el-input
  26. v-model="queryParams.planCodeW"
  27. placeholder="请输周计划编号"
  28. clearable
  29. />
  30. </el-form-item>
  31. </el-form-item>
  32. </el-form-item>
  33. <el-form-item label="区县单位" prop="county">
  34. <el-input
  35. v-model="queryParams.county"
  36. placeholder="请输入区县单位"
  37. clearable
  38. />
  39. </el-form-item>
  40. <el-form-item label="供电所" prop="station">
  41. <el-input
  42. v-model="queryParams.station"
  43. placeholder="请输入所属供电所"
  44. clearable
  45. />
  46. </el-form-item>
  47. <el-form-item label="线路名称" prop="lineName">
  48. <el-input
  49. v-model="queryParams.lineName"
  50. placeholder="请输入线路名称"
  51. clearable
  52. @keyup.enter.native="handleQuery"
  53. />
  54. </el-form-item>
  55. <el-form-item>
  56. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  57. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  58. <el-button type="primary" plain size="mini" @click="handleExport"
  59. >导出</el-button
  60. >
  61. </el-form-item>
  62. </el-form>
  63. <!--el-col :span="1.5">
  64. <el-button
  65. type="warning"
  66. plain
  67. icon="el-icon-upload"
  68. size="mini"
  69. :disabled="maintenancePalan"
  70. @click="uploadMaintenanceFile()"
  71. >上传检修方案</el-button>
  72. <el-button
  73. type="danger"
  74. plain
  75. icon="el-icon-upload"
  76. size="mini"
  77. :disabled="maintenancePalan"
  78. @click="uploadApproveFile"
  79. >上传审批单</el-button>
  80. </el-col-->
  81. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  82. </el-row>
  83. <el-table v-loading="loading" :data="processList" @selection-change="handleSelectionChange"
  84. :row-class-name="getRowClassName"
  85. >
  86. <el-table-column type="selection" width="55" align="center" />
  87. <el-table-column label="月计划编号" align="center" prop="planCode" width="150" fixed>
  88. <template slot-scope="scope">
  89. <a @click="table_show(scope.row, scope.$index)" style="color: #00afff;cursor: pointer">{{scope.row.planCode}}</a>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="周计划编号" align="center" prop="planCodeW" width="150" fixed>
  93. </el-table-column>
  94. <el-table-column label="停电设备数" align="center" prop="powerOutageDevices" fixed/>
  95. <el-table-column label="月计划停电时户数" align="center" prop="perHourHouseholdsM" fixed/>
  96. <el-table-column label="周计划停电时户数" align="center" prop="perHourHouseholdsW" fixed/>
  97. <el-table-column label="开始时间" align="center" prop="weekStartDt" fixed/>
  98. <el-table-column label="结束时间" align="center" prop="weekendDt" fixed/>
  99. <el-table-column label="市州单位" align="center" prop="city" width="150" />
  100. <el-table-column label="区县单位" align="center" prop="county" width="180"/>
  101. <el-table-column label="供电服务站/所" align="center" prop="station" width="120" :show-overflow-tooltip="true"/>
  102. <el-table-column label="线路编号" align="center" prop="lineCode" width="120"/>
  103. <el-table-column label="线路名称" align="center" prop="lineName" width="150" :show-overflow-tooltip="true"/>
  104. <el-table-column label="实际时户数" width="" align="center" prop="hourNum" />
  105. <el-table-column label="是否超目标" width="130"align="center">
  106. <template slot-scope="scope" >
  107. <el-tag type="danger" effect="dark" v-if="scope.row.hourNum>0 && scope.row.hourNum>scope.row.perHourHouseholdsW">超目标</el-tag>
  108. <el-tag type="success" effect="dark" v-else-if="scope.row.hourNum>0 && scope.row.hourNum<scope.row.perHourHouseholdsW">正常</el-tag>
  109. <el-tag type="info" v-else>未知</el-tag>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="申报单位" align="center" prop="declarAgency" width="150"/>
  113. <!--el-table-column label="检修计划" align="center">
  114. <el-table-column label="检修方案" align="center" prop="isMaintenance">
  115. <template slot-scope="scope">
  116. <span v-if="scope.row.isMaintenance=='1'">待上传</span>
  117. <span type="info" effect="dark" v-if="scope.row.isMaintenance=='0'">不需要</span>
  118. <span type="success" effect="dark" v-if="scope.row.isMaintenance=='2'">已上传</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="审批单" align="center" prop="isApprove">
  122. <template slot-scope="scope">
  123. <span v-if="scope.row.isApprove=='1'">待上传</span>
  124. <span type="info" effect="dark" v-if="scope.row.isApprove=='0'">不需要</span>
  125. <span type="success" effect="dark" v-if="scope.row.isApprove=='2'">已上传</span>
  126. </template>
  127. </el-table-column>
  128. </el-table-column-->
  129. <el-table-column label="考核金额" align="center">
  130. <el-table-column
  131. label="党政一把手"
  132. prop="examiAmount[0]"
  133. align="center"
  134. :show-overflow-tooltip="true"
  135. >
  136. </el-table-column>
  137. <el-table-column
  138. label="分管副经理"
  139. prop="examiAmount[1]"
  140. align="center"
  141. :show-overflow-tooltip="true"
  142. >
  143. </el-table-column>
  144. <el-table-column
  145. label="部室主任"
  146. prop="examiAmount[2]"
  147. align="center"
  148. :show-overflow-tooltip="true"
  149. />
  150. <el-table-column
  151. label="部室分管主任"
  152. prop="examiAmount[3]"
  153. align="center"
  154. :show-overflow-tooltip="true"
  155. >
  156. </el-table-column>
  157. <el-table-column
  158. label="部室责任专责"
  159. prop="examiAmount[4]"
  160. align="center"
  161. :show-overflow-tooltip="true"
  162. />
  163. <el-table-column
  164. label="总负责人"
  165. prop="examiAmount[5]"
  166. align="center"
  167. :show-overflow-tooltip="true"
  168. />
  169. <el-table-column
  170. label="工作负责人"
  171. prop="examiAmount[6]"
  172. align="center"
  173. />
  174. <el-table-column
  175. label="设备主人"
  176. prop="examiAmount[7]"
  177. align="center"
  178. :show-overflow-tooltip="true"
  179. >
  180. </el-table-column>
  181. </el-table-column>
  182. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  183. <template slot-scope="scope">
  184. <el-button
  185. size="mini"
  186. type="text"
  187. icon="el-icon-edit"
  188. @click="handleUpdate(scope.row)"
  189. v-hasPermi="['powerdistribution:process:edit']"
  190. >修改</el-button>
  191. </template>
  192. </el-table-column>
  193. </el-table>
  194. <pagination
  195. v-show="total>0"
  196. :total="total"
  197. :page.sync="queryParams.pageNum"
  198. :limit.sync="queryParams.pageSize"
  199. @pagination="getList"
  200. />
  201. <!-- 添加或修改检修计划全流程管理对话框 -->
  202. <el-dialog :title="title" :visible.sync="open" width="650px" append-to-body>
  203. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  204. <el-form-item label="月计划编号" prop="planCode">
  205. <el-input v-model="form.planCode" placeholder="请输入月计划编号" readonly/>
  206. </el-form-item>
  207. <el-row :gutter="24">
  208. <el-col :lg="12">
  209. <el-form-item label="停电设备数" prop="powerOutageDevices">
  210. <el-input-number v-model="form.powerOutageDevices" placeholder="请输入月计划停电设备数" min="0"/>
  211. </el-form-item>
  212. </el-col>
  213. <el-col :lg="12">
  214. <el-form-item label="停电时户数" prop="perHourHouseholdsM">
  215. <el-input-number v-model="form.perHourHouseholdsM" placeholder="请输入月计划时户数" min="0"/>
  216. </el-form-item>
  217. </el-col>
  218. </el-row>
  219. <el-row :gutter="24">
  220. <el-col :lg="12">
  221. <el-form-item label="市州单位" prop="city">
  222. <el-input v-model="form.city" placeholder="请输入市州单位" readonly/>
  223. </el-form-item>
  224. </el-col>
  225. <el-col :lg="12">
  226. <el-form-item label="区县单位" prop="county">
  227. <el-input v-model="form.county" placeholder="请输入区县单位" readonly/>
  228. </el-form-item>
  229. </el-col>
  230. </el-row>
  231. <el-row :gutter="24">
  232. <el-col :lg="12">
  233. <el-form-item label="供电服务站/所" prop="station">
  234. <el-input v-model="form.station" placeholder="请输入所属供电所" readonly/>
  235. </el-form-item>
  236. </el-col>
  237. <el-col :lg="12">
  238. <el-form-item label="申报单位" prop="declarAgency">
  239. <el-input v-model="form.declarAgency" placeholder="请输入申报单位" readonly/>
  240. </el-form-item>
  241. </el-col>
  242. </el-row>
  243. <el-row :gutter="24">
  244. <el-col :lg="12">
  245. <el-form-item label="线路编号" prop="lineCode">
  246. <el-input v-model="form.lineCode" placeholder="请输入线路编号" readonly/>
  247. </el-form-item>
  248. </el-col>
  249. <el-col :lg="12">
  250. <el-form-item label="线路名称" prop="lineName">
  251. <el-input v-model="form.lineName" placeholder="请输入线路名称" readonly/>
  252. </el-form-item>
  253. </el-col>
  254. </el-row>
  255. </el-form>
  256. <div slot="footer" class="dialog-footer">
  257. <el-button type="primary" @click="submitForm">确 定</el-button>
  258. <el-button @click="cancel">取 消</el-button>
  259. </div>
  260. </el-dialog>
  261. <!-- 文件上传对话框 -->
  262. <el-dialog :title="fileShow" :visible.sync="uploadVisible" width="550px" append-to-body>
  263. <el-form ref="uploadForm" :model="uploadForm" label-width="100px">
  264. <el-form-item label="月计划编号" prop="planCode">
  265. <el-input v-model="uploadForm.planCode" placeholder="请输入月计划编号" readonly/>
  266. </el-form-item>
  267. <el-form-item :label="label">
  268. <fileUpload :fileSize="10" :limit="1" :process="process" @success="handleSuccess"/>
  269. </el-form-item>
  270. </el-form>
  271. <div slot="footer" class="dialog-footer">
  272. <el-button type="primary" @click="submitForm">确 定</el-button>
  273. <el-button @click="uploadVisible=false" >取 消</el-button>
  274. </div>
  275. </el-dialog>
  276. <recordDetails v-if="dialog.detailsSave" ref="detailsDialog" @closed="dialog.detailsSave=false"></recordDetails>
  277. </div>
  278. </template>
  279. <script>
  280. import { listProcess, getProcess, delProcess, addProcess, updateProcess,exportProcess } from "@/api/powerdistribution/process";
  281. import recordDetails from './details'
  282. import fileUpload from "./components/fileUpload"
  283. export default {
  284. name: "Process",
  285. components: {
  286. recordDetails,
  287. fileUpload
  288. },
  289. data() {
  290. return {
  291. dialog: {
  292. detailsSave:false
  293. },
  294. uploadVisible: false,
  295. // 遮罩层
  296. loading: true,
  297. // 选中数组
  298. ids: [],
  299. // 非单个禁用
  300. single: true,
  301. // 非多个禁用
  302. multiple: true,
  303. // 检修计划
  304. maintenancePalan: true,
  305. // 显示搜索条件
  306. showSearch: true,
  307. // 总条数
  308. total: 0,
  309. // 检修计划全流程管理表格数据
  310. processList: [],
  311. // 弹出层标题
  312. title: "",
  313. fileShow: "",
  314. // 是否显示弹出层
  315. open: false,
  316. // 查询参数
  317. queryParams: {
  318. pageNum: 1,
  319. pageSize: 10,
  320. planCode: null,
  321. planCodeW:null,
  322. powerOutageDevices: null,
  323. perHourHouseholdsM: null,
  324. perHourHouseholdsW: null,
  325. city: null,
  326. county: null,
  327. station: null,
  328. lineCode: null,
  329. lineName: null,
  330. perHourHouseholdsArtif: null,
  331. declarAgency: null,
  332. isMaintenance: null,
  333. isApprove: null,
  334. maintenanceFilePath: null,
  335. approveFilePath: null,
  336. reportDate: [],
  337. },
  338. // 表单参数
  339. form: {},
  340. uploadForm: {},
  341. process:{},
  342. label: '',
  343. // 表单校验
  344. rules: {
  345. }
  346. };
  347. },
  348. created() {
  349. this.getList();
  350. },
  351. methods: {
  352. /** 查询检修计划全流程管理列表 */
  353. getList() {
  354. this.loading = true;
  355. listProcess({
  356. ...this.queryParams,
  357. startDate: this.queryParams.reportDate[0],
  358. endDate: this.queryParams.reportDate[1]
  359. }).then(response => {
  360. this.processList = response.rows;
  361. this.total = response.total;
  362. this.loading = false;
  363. });
  364. },
  365. // 取消按钮
  366. cancel() {
  367. this.open = false;
  368. this.reset();
  369. },
  370. // 表单重置
  371. reset() {
  372. this.form = {
  373. id: null,
  374. planCode: null,
  375. planCodeW: null,
  376. powerOutageDevices: null,
  377. perHourHouseholdsM: null,
  378. perHourHouseholdsW: null,
  379. city: null,
  380. county: null,
  381. station: null,
  382. lineCode: null,
  383. lineName: null,
  384. perHourHouseholdsArtif: null,
  385. declarAgency: null,
  386. isMaintenance: null,
  387. isApprove: null,
  388. maintenanceFilePath: null,
  389. approveFilePath: null,
  390. createBy: null,
  391. createTime: null,
  392. updateBy: null,
  393. updateTime: null,
  394. reportDate:[]
  395. };
  396. this.resetForm("form");
  397. },
  398. /** 搜索按钮操作 */
  399. handleQuery() {
  400. this.queryParams.pageNum = 1;
  401. this.getList();
  402. },
  403. /** 重置按钮操作 */
  404. resetQuery() {
  405. this.resetForm("queryForm");
  406. this.handleQuery();
  407. },
  408. // 多选框选中数据
  409. handleSelectionChange(selection) {
  410. this.ids = selection.map(item => item.id)
  411. this.single = selection.length!==1
  412. this.multiple = !selection.length
  413. if(selection.length==1 && selection[0].perHourHouseholdsM>150){
  414. this.maintenancePalan=false;
  415. this.process= selection[0];
  416. }else{
  417. this.maintenancePalan=true;
  418. this.process=null;
  419. }
  420. },
  421. /** 新增按钮操作 */
  422. handleAdd() {
  423. this.reset();
  424. this.open = true;
  425. this.title = "添加检修计划全流程管理";
  426. },
  427. /** 修改按钮操作 */
  428. handleUpdate(row) {
  429. this.reset();
  430. const id = row.id || this.ids
  431. getProcess(id).then(response => {
  432. this.form = response.data;
  433. this.open = true;
  434. this.title = "修改时户数/停电设备数";
  435. });
  436. },
  437. /** 提交按钮 */
  438. submitForm() {
  439. this.$refs["uploadForm"].validate(valid => {
  440. if (valid) {
  441. if (this.uploadForm.id != null) {
  442. updateProcess(this.uploadForm).then(response => {
  443. this.$modal.msgSuccess("修改成功");
  444. this.uploadVisible = false;
  445. this.getList();
  446. });
  447. } else {
  448. addProcess(this.uploadForm).then(response => {
  449. this.$modal.msgSuccess("新增成功");
  450. this.uploadVisible = false;
  451. this.getList();
  452. });
  453. }
  454. }
  455. });
  456. },
  457. /** 删除按钮操作 */
  458. handleDelete(row) {
  459. const ids = row.id || this.ids;
  460. this.$modal.confirm('是否确认删除检修计划全流程管理编号为"' + ids + '"的数据项?').then(function() {
  461. return delProcess(ids);
  462. }).then(() => {
  463. this.getList();
  464. this.$modal.msgSuccess("删除成功");
  465. }).catch(() => {});
  466. },
  467. /** 导出按钮操作 */
  468. async handleExport() {
  469. const res = await exportProcess({
  470. pageNum: this.queryParams.pageNum,
  471. pageSize: this.queryParams.pageSize,
  472. planCode: this.queryParams.planCode,
  473. planCodeW: this.queryParams.planCodeW,
  474. powerOutageDevices: this.queryParams.powerOutageDevices,
  475. perHourHouseholdsM: this.queryParams.perHourHouseholdsM,
  476. perHourHouseholdsW: this.queryParams.perHourHouseholdsW,
  477. city: this.queryParams.city,
  478. county: this.queryParams.county,
  479. station: this.queryParams.station,
  480. lineCode: this.queryParams.lineCode,
  481. lineName: this.queryParams.lineName,
  482. perHourHouseholdsArtif: this.queryParams.perHourHouseholdsArtif,
  483. declarAgency: this.queryParams.declarAgency,
  484. isMaintenance: this.queryParams.isMaintenance,
  485. isApprove: this.queryParams.isApprove,
  486. maintenanceFilePath: this.queryParams.maintenanceFilePath,
  487. approveFilePath: this.queryParams.approveFilePath,
  488. startDate: this.queryParams.reportDate[0],
  489. endDate: this.queryParams.reportDate[1]
  490. });
  491. if (res) {
  492. const elink = document.createElement("a");
  493. elink.download = `检修计划全流程.xlsx`;
  494. elink.style.display = "none";
  495. const blob = new Blob([res], { type: "application/vnd.ms-excel" });
  496. elink.href = URL.createObjectURL(blob);
  497. document.body.appendChild(elink);
  498. elink.click();
  499. document.body.removeChild(elink);
  500. window.URL.revokeObjectURL(url);
  501. } else {
  502. this.$message.error("导出异常请联系管理员");
  503. }
  504. },
  505. //查看
  506. table_show(row){
  507. this.dialog.detailsSave = true
  508. this.$nextTick(() => {
  509. this.$refs.detailsDialog.open().setData(row)
  510. })
  511. },
  512. getRowClassName({ row }) {
  513. // 根据row的某些属性决定是否高亮
  514. if (row.perHourHouseholdsM-row.perHourHouseholdsW!=0) {
  515. return 'highlight-row';
  516. }
  517. return '';
  518. },
  519. uploadMaintenanceFile(){
  520. this.uploadForm.uploadType=0;
  521. Object.assign(this.uploadForm, this.process)
  522. this.uploadVisible=true;
  523. this.fileShow="检修文件上传";
  524. this.label="检修文件"
  525. },
  526. uploadApproveFile(){
  527. this.uploadForm.uploadType=1;
  528. Object.assign(this.uploadForm, this.process)
  529. this.uploadVisible=true;
  530. this.fileShow="审批手续上传";
  531. this.label="审批手续"
  532. },
  533. async handleSuccess(data) {
  534. Object.assign(data, this.uploadForm)
  535. if(this.uploadForm.uploadType==0){
  536. this.uploadForm.maintenanceFilePath=data.fileUrl;
  537. this.uploadForm.maintenanceFileName=data.originalFilename;
  538. }
  539. if(this.uploadForm.uploadType==1){
  540. this.uploadForm.approveFilePath=data.fileUrl;
  541. this.uploadForm.approveFileName=data.originalFilename;
  542. }
  543. },
  544. }
  545. };
  546. </script>
  547. <style>
  548. /* 通过自定义类名添加高亮样式 */
  549. .highlight-row {
  550. background-color: #ff0000; /* 浅绿色背景色 */
  551. color: #ff0000; /* 绿色文字 */
  552. }
  553. </style>