index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="月计划编号" prop="planCode" label-width="120">
  5. <el-input
  6. v-model="queryParams.planCode"
  7. placeholder="请输入月计划编号"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. </el-form-item>
  13. </el-form-item>
  14. <el-form-item label="区县单位" prop="county">
  15. <el-input
  16. v-model="queryParams.county"
  17. placeholder="请输入区县单位"
  18. clearable
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="供电所" prop="station">
  23. <el-input
  24. v-model="queryParams.station"
  25. placeholder="请输入所属供电所"
  26. clearable
  27. @keyup.enter.native="handleQuery"
  28. />
  29. </el-form-item>
  30. <!--el-form-item label="线路编号" prop="lineCode">
  31. <el-input
  32. v-model="queryParams.lineCode"
  33. placeholder="请输入线路编号"
  34. clearable
  35. @keyup.enter.native="handleQuery"
  36. />
  37. </el-form-item-->
  38. <el-form-item label="线路名称" prop="lineName">
  39. <el-input
  40. v-model="queryParams.lineName"
  41. placeholder="请输入线路名称"
  42. clearable
  43. @keyup.enter.native="handleQuery"
  44. />
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <el-col :span="1.5">
  53. <el-button
  54. type="success"
  55. plain
  56. icon="el-icon-upload"
  57. size="mini"
  58. :disabled="single"
  59. @click=""
  60. v-hasPermi="['powerdistribution:process:edit']"
  61. >人工上传</el-button>
  62. </el-col>
  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=""
  71. v-hasPermi="['powerdistribution:process:export']"
  72. >上传检修方案</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="danger"
  77. plain
  78. icon="el-icon-upload"
  79. size="mini"
  80. :disabled="maintenancePalan"
  81. @click=""
  82. v-hasPermi="['powerdistribution:process:export']"
  83. >上传审批单</el-button>
  84. </el-col>
  85. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  86. </el-row>
  87. <el-table v-loading="loading" :data="processList" @selection-change="handleSelectionChange"
  88. :row-class-name="getRowClassName"
  89. >
  90. <el-table-column type="selection" width="55" align="center" />
  91. <el-table-column label="月计划编号" align="center" prop="planCode" width="150">
  92. <template slot-scope="scope">
  93. <a @click="table_show(scope.row, scope.$index)" style="color:blue;cursor:pointer">{{scope.row.planCode}}</a>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="停电设备数" align="center" prop="powerOutageDevices" />
  97. <el-table-column label="月计划时户数" align="center" prop="perHourHouseholdsM" />
  98. <el-table-column label="周计划时户数" align="center" prop="perHourHouseholdsW" />
  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="130" />
  104. <el-table-column label="人工计划时户数" align="center" prop="perHourHouseholdsArtif" />
  105. <el-table-column label="是否超目标" align="center">
  106. <template slot-scope="scope">
  107. <el-tag type="warning" effect="dark" v-if="scope.row.perHourHouseholdsArtif>scope.row.perHourHouseholdsM">超目标</el-tag>
  108. <el-tag type="success" effect="dark" v-else>正常</el-tag>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="申报单位" align="center" prop="declarAgency" width="150"/>
  112. <el-table-column label="检修方案" align="center" prop="isMaintenance">
  113. <template slot-scope="scope">
  114. <span v-if="scope.row.isMaintenance=='1'">待上传</span>
  115. <span type="info" effect="dark" v-if="scope.row.isMaintenance=='0'">不需要</span>
  116. <span type="success" effect="dark" v-if="scope.row.isMaintenance=='2'">已上传</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="审批单" align="center" prop="isApprove">
  120. <template slot-scope="scope">
  121. <span v-if="scope.row.isApprove=='1'">待上传</span>
  122. <span type="info" effect="dark" v-if="scope.row.isApprove=='0'">不需要</span>
  123. <span type="success" effect="dark" v-if="scope.row.isApprove=='2'">已上传</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  127. <template slot-scope="scope">
  128. <el-button
  129. size="mini"
  130. type="text"
  131. icon="el-icon-edit"
  132. @click="handleUpdate(scope.row)"
  133. v-hasPermi="['powerdistribution:process:edit']"
  134. >修改</el-button>
  135. </template>
  136. </el-table-column>
  137. </el-table>
  138. <pagination
  139. v-show="total>0"
  140. :total="total"
  141. :page.sync="queryParams.pageNum"
  142. :limit.sync="queryParams.pageSize"
  143. @pagination="getList"
  144. />
  145. <!-- 添加或修改检修计划全流程管理对话框 -->
  146. <el-dialog :title="title" :visible.sync="open" width="650px" append-to-body>
  147. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  148. <el-form-item label="月计划编号" prop="planCode">
  149. <el-input v-model="form.planCode" placeholder="请输入月计划编号" readonly/>
  150. </el-form-item>
  151. <el-row :gutter="24">
  152. <el-col :lg="12">
  153. <el-form-item label="停电设备数" prop="powerOutageDevices">
  154. <el-input-number v-model="form.powerOutageDevices" placeholder="请输入月计划停电设备数" min="0"/>
  155. </el-form-item>
  156. </el-col>
  157. <el-col :lg="12">
  158. <el-form-item label="时户数" prop="perHourHouseholdsM">
  159. <el-input-number v-model="form.perHourHouseholdsM" placeholder="请输入月计划时户数" min="0"/>
  160. </el-form-item>
  161. </el-col>
  162. </el-row>
  163. <el-row :gutter="24">
  164. <el-col :lg="12">
  165. <el-form-item label="所属市公司" prop="city">
  166. <el-input v-model="form.city" placeholder="请输入所属市公司" readonly/>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :lg="12">
  170. <el-form-item label="所属县公司" prop="county">
  171. <el-input v-model="form.county" placeholder="请输入所属县公司" readonly/>
  172. </el-form-item>
  173. </el-col>
  174. </el-row>
  175. <el-row :gutter="24">
  176. <el-col :lg="12">
  177. <el-form-item label="所属供电所" prop="station">
  178. <el-input v-model="form.station" placeholder="请输入所属供电所" readonly/>
  179. </el-form-item>
  180. </el-col>
  181. <el-col :lg="12">
  182. <el-form-item label="申报单位" prop="declarAgency">
  183. <el-input v-model="form.declarAgency" placeholder="请输入申报单位" readonly/>
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. <el-row :gutter="24">
  188. <el-col :lg="12">
  189. <el-form-item label="线路编号" prop="lineCode">
  190. <el-input v-model="form.lineCode" placeholder="请输入线路编号" readonly/>
  191. </el-form-item>
  192. </el-col>
  193. <el-col :lg="12">
  194. <el-form-item label="线路名称" prop="lineName">
  195. <el-input v-model="form.lineName" placeholder="请输入线路名称" readonly/>
  196. </el-form-item>
  197. </el-col>
  198. </el-row>
  199. </el-form>
  200. <div slot="footer" class="dialog-footer">
  201. <el-button type="primary" @click="submitForm">确 定</el-button>
  202. <el-button @click="cancel">取 消</el-button>
  203. </div>
  204. </el-dialog>
  205. <recordDetails v-if="dialog.detailsSave" ref="detailsDialog" @closed="dialog.detailsSave=false"></recordDetails>
  206. </div>
  207. </template>
  208. <script>
  209. import { listProcess, getProcess, delProcess, addProcess, updateProcess } from "@/api/powerdistribution/process";
  210. import recordDetails from './details'
  211. export default {
  212. name: "Process",
  213. components: {
  214. recordDetails
  215. },
  216. data() {
  217. return {
  218. dialog: {
  219. detailsSave:false
  220. },
  221. // 遮罩层
  222. loading: true,
  223. // 选中数组
  224. ids: [],
  225. // 非单个禁用
  226. single: true,
  227. // 非多个禁用
  228. multiple: true,
  229. // 检修计划
  230. maintenancePalan: true,
  231. // 显示搜索条件
  232. showSearch: true,
  233. // 总条数
  234. total: 0,
  235. // 检修计划全流程管理表格数据
  236. processList: [],
  237. // 弹出层标题
  238. title: "",
  239. // 是否显示弹出层
  240. open: false,
  241. // 查询参数
  242. queryParams: {
  243. pageNum: 1,
  244. pageSize: 10,
  245. planCode: null,
  246. powerOutageDevices: null,
  247. perHourHouseholdsM: null,
  248. perHourHouseholdsW: null,
  249. city: null,
  250. county: null,
  251. station: null,
  252. lineCode: null,
  253. lineName: null,
  254. perHourHouseholdsArtif: null,
  255. declarAgency: null,
  256. isMaintenance: null,
  257. isApprove: null,
  258. maintenanceFilePath: null,
  259. approveFilePath: null,
  260. },
  261. // 表单参数
  262. form: {},
  263. // 表单校验
  264. rules: {
  265. }
  266. };
  267. },
  268. created() {
  269. this.getList();
  270. },
  271. methods: {
  272. /** 查询检修计划全流程管理列表 */
  273. getList() {
  274. this.loading = true;
  275. listProcess(this.queryParams).then(response => {
  276. this.processList = response.rows;
  277. this.total = response.total;
  278. this.loading = false;
  279. });
  280. },
  281. // 取消按钮
  282. cancel() {
  283. this.open = false;
  284. this.reset();
  285. },
  286. // 表单重置
  287. reset() {
  288. this.form = {
  289. id: null,
  290. planCode: null,
  291. powerOutageDevices: null,
  292. perHourHouseholdsM: null,
  293. perHourHouseholdsW: null,
  294. city: null,
  295. county: null,
  296. station: null,
  297. lineCode: null,
  298. lineName: null,
  299. perHourHouseholdsArtif: null,
  300. declarAgency: null,
  301. isMaintenance: null,
  302. isApprove: null,
  303. maintenanceFilePath: null,
  304. approveFilePath: null,
  305. createBy: null,
  306. createTime: null,
  307. updateBy: null,
  308. updateTime: null
  309. };
  310. this.resetForm("form");
  311. },
  312. /** 搜索按钮操作 */
  313. handleQuery() {
  314. this.queryParams.pageNum = 1;
  315. this.getList();
  316. },
  317. /** 重置按钮操作 */
  318. resetQuery() {
  319. this.resetForm("queryForm");
  320. this.handleQuery();
  321. },
  322. // 多选框选中数据
  323. handleSelectionChange(selection) {
  324. this.ids = selection.map(item => item.id)
  325. this.single = selection.length!==1
  326. this.multiple = !selection.length
  327. if(selection.length==1 && selection[0].isMaintenance>0){
  328. this.maintenancePalan=false;
  329. }else{
  330. this.maintenancePalan=true;
  331. }
  332. },
  333. /** 新增按钮操作 */
  334. handleAdd() {
  335. this.reset();
  336. this.open = true;
  337. this.title = "添加检修计划全流程管理";
  338. },
  339. /** 修改按钮操作 */
  340. handleUpdate(row) {
  341. this.reset();
  342. const id = row.id || this.ids
  343. getProcess(id).then(response => {
  344. this.form = response.data;
  345. this.open = true;
  346. this.title = "修改时户数/停电设备数";
  347. });
  348. },
  349. /** 提交按钮 */
  350. submitForm() {
  351. this.$refs["form"].validate(valid => {
  352. if (valid) {
  353. if (this.form.id != null) {
  354. updateProcess(this.form).then(response => {
  355. this.$modal.msgSuccess("修改成功");
  356. this.open = false;
  357. this.getList();
  358. });
  359. } else {
  360. addProcess(this.form).then(response => {
  361. this.$modal.msgSuccess("新增成功");
  362. this.open = false;
  363. this.getList();
  364. });
  365. }
  366. }
  367. });
  368. },
  369. /** 删除按钮操作 */
  370. handleDelete(row) {
  371. const ids = row.id || this.ids;
  372. this.$modal.confirm('是否确认删除检修计划全流程管理编号为"' + ids + '"的数据项?').then(function() {
  373. return delProcess(ids);
  374. }).then(() => {
  375. this.getList();
  376. this.$modal.msgSuccess("删除成功");
  377. }).catch(() => {});
  378. },
  379. /** 导出按钮操作 */
  380. handleExport() {
  381. this.download('powerdistribution/process/export', {
  382. ...this.queryParams
  383. }, `process_${new Date().getTime()}.xlsx`)
  384. },
  385. //查看
  386. table_show(row){
  387. this.dialog.detailsSave = true
  388. this.$nextTick(() => {
  389. this.$refs.detailsDialog.open().setData(row)
  390. })
  391. },
  392. getRowClassName({ row }) {
  393. // 根据row的某些属性决定是否高亮
  394. if (row.perHourHouseholdsM-row.perHourHouseholdsW!=0) {
  395. return 'highlight-row';
  396. }
  397. return '';
  398. }
  399. }
  400. };
  401. </script>
  402. <style>
  403. /* 通过自定义类名添加高亮样式 */
  404. .highlight-row {
  405. background-color: #ff0000; /* 浅绿色背景色 */
  406. color: #ff0000; /* 绿色文字 */
  407. }
  408. </style>