Преглед изворни кода

支持非电能源价格配置

learshaw пре 1 недеља
родитељ
комит
63e3397710

+ 44 - 0
ems-ui-cloud/src/api/basecfg/FdEnergyPriceConfig.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询非电能源价格配置列表
+export function listFdEnergyPriceConfig(query) {
+  return request({
+    url: '/ems/basecfg/fdPrice/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询非电能源价格配置详细
+export function getFdEnergyPriceConfig(id) {
+  return request({
+    url: '/ems/basecfg/fdPrice/' + id,
+    method: 'get'
+  })
+}
+
+// 新增非电能源价格配置
+export function addFdEnergyPriceConfig(data) {
+  return request({
+    url: '/ems/basecfg/fdPrice',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改非电能源价格配置
+export function updateFdEnergyPriceConfig(data) {
+  return request({
+    url: '/ems/basecfg/fdPrice',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除非电能源价格配置
+export function delFdEnergyPriceConfig(id) {
+  return request({
+    url: '/ems/basecfg/fdPrice/' + id,
+    method: 'delete'
+  })
+}

+ 224 - 5
ems-ui-cloud/src/views/basecfg/price/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-tabs v-model="activeTab">
-      <el-tab-pane label="服务区用电" name="first">
+      <el-tab-pane label="用电分类" name="first">
         <el-row :gutter="20">
         <el-col :span="4" :xs="24">
           <div class="head-container">
@@ -25,7 +25,7 @@
         </el-row>
 
         <el-table v-loading="loading" :data="attrList">
-          <el-table-column label="服务区" align="center" prop="areaName"/>
+          <el-table-column label="区" align="center" prop="areaName"/>
           <el-table-column label="状态" align="center" width="100">
             <template slot-scope="scope">
               <el-tag :type="scope.$index === attrList.length - 1 ? 'success' : 'info'" disable-transitions>
@@ -238,7 +238,7 @@
           </div>
         </el-dialog>
       </el-tab-pane>
-      <el-tab-pane label="峰谷电价策略" name="fourth">
+      <el-tab-pane label="峰谷策略" name="fourth">
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
             <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleStrategyAdd" v-hasPermi="['basecfg:price:add']">新增
@@ -348,7 +348,85 @@
           </div>
         </el-dialog>
       </el-tab-pane>
-      <el-tab-pane label="商户计费配置" name="five">
+      <el-tab-pane label="非电价格" name="five">
+        <el-form :model="fdPriceQueryParams" ref="fdPriceQueryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+          <el-form-item label="计量介质" prop="meterCls">
+            <el-select
+              v-model="fdPriceQueryParams.meterCls"
+              placeholder="请选择计量介质"
+              clearable
+              @change="handleFdPriceQuery"
+            >
+              <el-option
+                v-for="item in meterClsOptions"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleFdPriceQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetFdPriceQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <el-table v-loading="fdPriceLoading" :data="fdPriceList" @selection-change="handleFdPriceSelectionChange">
+          <el-table-column label="区域" align="center">
+            <template slot-scope="scope">
+              {{ scope.row.areaName || '默认' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="计量介质" align="center" prop="meterClsName" />
+          <el-table-column label="单位价格" align="center" prop="unitPrice" />
+          <el-table-column label="计量单位" align="center" prop="meterUnit" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                @click="handleFdPriceUpdate(scope.row)"
+                v-hasPermi="['ems:FdEnergyPriceConfig:edit']"
+              >修改</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="fdPriceTotal>0"
+          :total="fdPriceTotal"
+          :page.sync="fdPriceQueryParams.pageNum"
+          :limit.sync="fdPriceQueryParams.pageSize"
+          @pagination="getFdPriceList"
+        />
+
+        <!-- 添加或修改非电能源价格配置对话框 -->
+        <el-dialog :title="fdPriceTitle" :visible.sync="fdPriceOpen" width="500px" append-to-body>
+          <el-form ref="fdPriceForm" :model="fdPriceForm" :rules="fdPriceRules" label-width="80px">
+            <el-form-item label="配置代码" prop="cfgCode">
+              <el-input v-model="fdPriceForm.cfgCode" placeholder="请输入配置代码" disabled />
+            </el-form-item>
+            <el-form-item label="区域" prop="areaName">
+              <el-input v-model="fdPriceForm.areaName" placeholder="园区名称" disabled />
+            </el-form-item>
+            <el-form-item label="计量介质" prop="meterClsName">
+              <el-input v-model="fdPriceForm.meterClsName" placeholder="计量介质" disabled />
+            </el-form-item>
+            <el-form-item label="单位价格" prop="unitPrice">
+              <el-input v-model="fdPriceForm.unitPrice" placeholder="请输入单位价格" />
+            </el-form-item>
+            <el-form-item label="计量单位" prop="meterUnit">
+              <el-input v-model="fdPriceForm.meterUnit" placeholder="请输入计量单位" />
+            </el-form-item>
+          </el-form>
+          <div slot="footer" class="dialog-footer">
+            <el-button type="primary" @click="submitFdPriceForm">确 定</el-button>
+            <el-button @click="fdPriceCancel">取 消</el-button>
+          </div>
+        </el-dialog>
+      </el-tab-pane>
+      <el-tab-pane label="商户计价" name="six">
         <!-- 商户计费配置 -->
         <el-row :gutter="10" class="mb8">
           <!-- <el-col :span="1.5">
@@ -358,7 +436,7 @@
           <right-toolbar :showSearch.sync="showSearch" :search="false" @queryTable="getChargingList"></right-toolbar>
         </el-row>
         <el-table v-loading="chargingParams.loading" :data="chargingList">
-          <el-table-column label="服务区名称" align="center" prop="areaName" />
+          <el-table-column label="区域" align="center" prop="areaName" />
           <el-table-column label="电计量单价" align="center" prop="elecUnitPrice" />
           <el-table-column label="电公摊计算类型" align="center">
             <template slot-scope="scope">
@@ -456,6 +534,7 @@ import {
   updateGwPriceConfig
 } from '@/api/basecfg/elecGwPrice'
 import { addPvPriceConfig, delPvPriceConfig, getPvPriceConfig, listPvPriceConfig, updatePvPriceConfig } from '@/api/basecfg/elecPvPrice'
+import { listFdEnergyPriceConfig, getFdEnergyPriceConfig, delFdEnergyPriceConfig, addFdEnergyPriceConfig, updateFdEnergyPriceConfig } from '@/api/basecfg/FdEnergyPriceConfig'
 import { getElecPriceType } from '@/api/commonApi'
 import { areaListByTag, areaTreeSelect } from '@/api/basecfg/area'
 
@@ -486,8 +565,11 @@ export default {
       strategyList: [],
       // 商户计费
       chargingList: [],
+      // 非电价格
+      fdPriceList: [],
       // 弹出层标题
       title: '',
+      fdPriceTitle: '',
 
       // 区域名称
       areaName: undefined,
@@ -507,10 +589,15 @@ export default {
       pvPriceOpen: false,
       strategyDialog: false,
       chargingDialog: false,
+      fdPriceOpen: false,
       // 选项定义
       priceTypeOptions: undefined,
       areaOptions: undefined,
       gwPriceOptions: undefined,
+      // 计量介质选项
+      meterClsOptions: [
+        { value: 70, label: '自来水' }
+      ],
       // 查询参数
       queryGwPriceParams: {
         pageNum: 1,
@@ -534,6 +621,38 @@ export default {
         pageNum: 1,
         pageSize: 10
       },
+      // 非电价格查询参数
+      fdPriceQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        cfgCode: null,
+        areaCode: null,
+        meterCls: null
+      },
+      // 非电价格表单数据
+      fdPriceForm: {},
+      // 非电价格表单验证规则
+      fdPriceRules: {
+        cfgCode: [
+          { required: true, message: '配置代码不能为空', trigger: 'blur' }
+        ],
+        meterCls: [
+          { required: true, message: '计量介质不能为空', trigger: 'blur' }
+        ],
+        unitPrice: [
+          { required: true, message: '单位价格不能为空', trigger: 'blur' }
+        ]
+      },
+      // 非电价格加载状态
+      fdPriceLoading: true,
+      // 非电价格总条数
+      fdPriceTotal: 0,
+      // 非电价格选中数组
+      fdPriceIds: [],
+      // 非电价格非单个禁用
+      fdPriceSingle: true,
+      // 非电价格非多个禁用
+      fdPriceMultiple: true,
       // 表单参数
       attrForm: {},
       gwPriceForm: {},
@@ -616,6 +735,7 @@ export default {
     this.getStrategyList()
     this.getChargingList()
     this.getRelateShopList('0')
+    this.getFdPriceList()
   },
   methods: {
     /** 查询区域树结构 */
@@ -664,6 +784,105 @@ export default {
       })
       return text
     },
+    /** 查询非电能源价格配置列表 */
+    getFdPriceList() {
+      this.fdPriceLoading = true;
+      listFdEnergyPriceConfig(this.fdPriceQueryParams).then(response => {
+        this.fdPriceList = response.rows;
+        this.fdPriceTotal = response.total;
+        this.fdPriceLoading = false;
+      });
+    },
+    // 非电价格取消按钮
+    fdPriceCancel() {
+      this.fdPriceOpen = false;
+      this.fdPriceReset();
+    },
+    // 非电价格表单重置
+    fdPriceReset() {
+      this.fdPriceForm = {
+        id: null,
+        cfgCode: null,
+        areaCode: null,
+        meterCls: null,
+        unitPrice: null,
+        meterUnit: null
+      };
+      this.resetForm("fdPriceForm");
+    },
+    /** 非电价格搜索按钮操作 */
+    handleFdPriceQuery() {
+      this.fdPriceQueryParams.pageNum = 1;
+      this.getFdPriceList();
+    },
+    /** 非电价格重置按钮操作 */
+    resetFdPriceQuery() {
+      this.resetForm("fdPriceQueryForm");
+      this.handleFdPriceQuery();
+    },
+    // 非电价格多选框选中数据
+    handleFdPriceSelectionChange(selection) {
+      this.fdPriceIds = selection.map(item => item.id)
+      this.fdPriceSingle = selection.length !== 1
+      this.fdPriceMultiple = !selection.length
+    },
+    /** 非电价格新增按钮操作 */
+    handleFdPriceAdd() {
+      this.fdPriceReset();
+      this.fdPriceOpen = true;
+      this.fdPriceTitle = "添加非电能源价格配置";
+    },
+    /** 非电价格修改按钮操作 */
+    handleFdPriceUpdate(row) {
+      this.fdPriceReset();
+      const id = row.id || this.fdPriceIds
+      getFdEnergyPriceConfig(id).then(response => {
+        this.fdPriceForm = response.data;
+        // 设置园区名称和计量介质名称
+        this.fdPriceForm.areaName = response.data.areaName || '默认';
+        // 从meterClsOptions中查找计量介质名称
+        const meterClsOption = this.meterClsOptions.find(item => item.value === response.data.meterCls);
+        this.fdPriceForm.meterClsName = meterClsOption ? meterClsOption.label : '';
+        this.fdPriceOpen = true;
+        this.fdPriceTitle = "修改非电能源价格配置";
+      });
+    },
+    /** 非电价格提交按钮 */
+    submitFdPriceForm() {
+      this.$refs["fdPriceForm"].validate(valid => {
+        if (valid) {
+          if (this.fdPriceForm.id != null) {
+            updateFdEnergyPriceConfig(this.fdPriceForm).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.fdPriceOpen = false;
+              this.getFdPriceList();
+            });
+          } else {
+            addFdEnergyPriceConfig(this.fdPriceForm).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.fdPriceOpen = false;
+              this.getFdPriceList();
+            });
+          }
+        }
+      });
+    },
+    /** 非电价格删除按钮操作 */
+    handleFdPriceDelete(row) {
+      const ids = row.id || this.fdPriceIds;
+      this.$modal.confirm('是否确认删除非电能源价格配置编号为"' + ids + '"的数据项?').then(function() {
+        return delFdEnergyPriceConfig(ids);
+      }).then(() => {
+        this.getFdPriceList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 非电价格导出按钮操作 */
+    handleFdPriceExport() {
+      this.download('ems/FdEnergyPriceConfig/export', {
+        ...this.fdPriceQueryParams
+      }, `FdEnergyPriceConfig_${new Date().getTime()}.xlsx`)
+    },
     getGwPriceList() {
       this.loading = true
       listGwPriceConfig(this.queryGwPriceParams).then(response => {