Browse Source

增加能源计划、能源费率

dongjh 1 year ago
parent
commit
16e2ea96a5

+ 246 - 0
src/views/module_base/energyPlan/BaseEnergyPlanList.vue

@@ -0,0 +1,246 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 查询区域-END -->
+
+    <!-- 操作按钮区域 -->
+    <div class="table-operator">
+      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+      <a-button type="primary" icon="download" @click="handleExportXls('base_energy_plan')">导出</a-button>
+      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
+        <a-button type="primary" icon="import">导入</a-button>
+      </a-upload>
+      <!-- 高级查询区域 -->
+      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
+        </a-menu>
+        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
+      </a-dropdown>
+    </div>
+
+    <!-- table区域-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
+        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{x:true}"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        class="j-table-force-nowrap"
+        @change="handleTableChange">
+
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+        <template slot="imgSlot" slot-scope="text,record">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
+          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
+        </template>
+        <template slot="fileSlot" slot-scope="text">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
+          <a-button
+            v-else
+            :ghost="true"
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)">
+            下载
+          </a-button>
+        </template>
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">编辑</a>
+
+          <a-divider type="vertical" />
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a @click="handleDetail(record)">详情</a>
+              </a-menu-item>
+              <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+        </span>
+
+      </a-table>
+    </div>
+
+    <base-energy-plan-modal ref="modalForm" @ok="modalFormOk"></base-energy-plan-modal>
+  </a-card>
+</template>
+
+<script>
+
+  import '@/assets/less/TableExpand.less'
+  import { mixinDevice } from '@/utils/mixin'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import BaseEnergyPlanModal from './modules/BaseEnergyPlanModal'
+
+  export default {
+    name: 'BaseEnergyPlanList',
+    mixins:[JeecgListMixin, mixinDevice],
+    components: {
+      BaseEnergyPlanModal
+    },
+    data () {
+      return {
+        description: 'base_energy_plan管理页面',
+        // 表头
+        columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+          },
+          {
+            title:'能源计划ID',
+            align:"center",
+            dataIndex: 'energyplanid'
+          },
+          {
+            title:'备注',
+            align:"center",
+            dataIndex: 'remark'
+          },
+          {
+            title:'设备ID',
+            align:"center",
+            dataIndex: 'equipmentid'
+          },
+          {
+            title:'设备编号',
+            align:"center",
+            dataIndex: 'equipmentcode'
+          },
+          {
+            title:'计划日期',
+            align:"center",
+            dataIndex: 'plandate',
+            customRender:function (text) {
+              return !text?"":(text.length>10?text.substr(0,10):text)
+            }
+          },
+          {
+            title:'能源分类ID',
+            align:"center",
+            dataIndex: 'energytypeid'
+          },
+          {
+            title:'计划值',
+            align:"center",
+            dataIndex: 'planvalue'
+          },
+          {
+            title:'所属年',
+            align:"center",
+            dataIndex: 'year'
+          },
+          {
+            title:'所属月',
+            align:"center",
+            dataIndex: 'month'
+          },
+          {
+            title:'日期',
+            align:"center",
+            dataIndex: 'day'
+          },
+          {
+            title:'所属年月',
+            align:"center",
+            dataIndex: 'yearmonth'
+          },
+          {
+            title:'所属周',
+            align:"center",
+            dataIndex: 'week'
+          },
+          {
+            title:'周几',
+            align:"center",
+            dataIndex: 'dayofweek'
+          },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            fixed:"right",
+            width:147,
+            scopedSlots: { customRender: 'action' }
+          }
+        ],
+        url: {
+          list: "/baseEnergyPlan/baseEnergyPlan/list",
+          delete: "/baseEnergyPlan/baseEnergyPlan/delete",
+          deleteBatch: "/baseEnergyPlan/baseEnergyPlan/deleteBatch",
+          exportXlsUrl: "/baseEnergyPlan/baseEnergyPlan/exportXls",
+          importExcelUrl: "baseEnergyPlan/baseEnergyPlan/importExcel",
+          
+        },
+        dictOptions:{},
+        superFieldList:[],
+      }
+    },
+    created() {
+    this.getSuperFieldList();
+    },
+    computed: {
+      importExcelUrl: function(){
+        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+      },
+    },
+    methods: {
+      initDictConfig(){
+      },
+      getSuperFieldList(){
+        let fieldList=[];
+        fieldList.push({type:'int',value:'energyplanid',text:'能源计划ID'})
+        fieldList.push({type:'string',value:'remark',text:'备注'})
+        fieldList.push({type:'int',value:'equipmentid',text:'设备ID'})
+        fieldList.push({type:'string',value:'equipmentcode',text:'设备编号'})
+        fieldList.push({type:'date',value:'plandate',text:'计划日期'})
+        fieldList.push({type:'int',value:'energytypeid',text:'能源分类ID'})
+        fieldList.push({type:'number',value:'planvalue',text:'计划值'})
+        fieldList.push({type:'int',value:'year',text:'所属年'})
+        fieldList.push({type:'int',value:'month',text:'所属月'})
+        fieldList.push({type:'string',value:'day',text:'日期'})
+        fieldList.push({type:'string',value:'yearmonth',text:'所属年月'})
+        fieldList.push({type:'int',value:'week',text:'所属周'})
+        fieldList.push({type:'int',value:'dayofweek',text:'周几'})
+        this.superFieldList = fieldList
+      }
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less';
+</style>

+ 167 - 0
src/views/module_base/energyPlan/modules/BaseEnergyPlanForm.vue

@@ -0,0 +1,167 @@
+<template>
+  <a-spin :spinning="confirmLoading">
+    <j-form-container :disabled="formDisabled">
+      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+        <a-row>
+          <a-col :span="24">
+            <a-form-model-item label="能源计划ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="energyplanid">
+              <a-input-number v-model="model.energyplanid" placeholder="请输入能源计划ID" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
+              <a-input v-model="model.remark" placeholder="请输入备注"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="设备ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentid">
+              <a-input-number v-model="model.equipmentid" placeholder="请输入设备ID" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentcode">
+              <a-input v-model="model.equipmentcode" placeholder="请输入设备编号"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="计划日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="plandate">
+              <j-date placeholder="请选择计划日期" v-model="model.plandate"  style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="能源分类ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="energytypeid">
+              <a-input-number v-model="model.energytypeid" placeholder="请输入能源分类ID" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="计划值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planvalue">
+              <a-input-number v-model="model.planvalue" placeholder="请输入计划值" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="所属年" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="year">
+              <a-input-number v-model="model.year" placeholder="请输入所属年" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="所属月" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="month">
+              <a-input-number v-model="model.month" placeholder="请输入所属月" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="day">
+              <a-input v-model="model.day" placeholder="请输入日期"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="所属年月" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yearmonth">
+              <a-input v-model="model.yearmonth" placeholder="请输入所属年月"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="所属周" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="week">
+              <a-input-number v-model="model.week" placeholder="请输入所属周" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="周几" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dayofweek">
+              <a-input-number v-model="model.dayofweek" placeholder="请输入周几" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </j-form-container>
+  </a-spin>
+</template>
+
+<script>
+
+  import { httpAction, getAction } from '@/api/manage'
+  import { validateDuplicateValue } from '@/utils/util'
+
+  export default {
+    name: 'BaseEnergyPlanForm',
+    components: {
+    },
+    props: {
+      //表单禁用
+      disabled: {
+        type: Boolean,
+        default: false,
+        required: false
+      }
+    },
+    data () {
+      return {
+        model:{
+         },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+        confirmLoading: false,
+        validatorRules: {
+           energyplanid: [
+              { required: true, message: '请输入能源计划ID!'},
+           ],
+        },
+        url: {
+          add: "/baseEnergyPlan/baseEnergyPlan/add",
+          edit: "/baseEnergyPlan/baseEnergyPlan/edit",
+          queryById: "/baseEnergyPlan/baseEnergyPlan/queryById"
+        }
+      }
+    },
+    computed: {
+      formDisabled(){
+        return this.disabled
+      },
+    },
+    created () {
+       //备份model原始值
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    },
+    methods: {
+      add () {
+        this.edit(this.modelDefault);
+      },
+      edit (record) {
+        this.model = Object.assign({}, record);
+        this.visible = true;
+      },
+      submitForm () {
+        const that = this;
+        // 触发表单验证
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+            })
+          }
+         
+        })
+      },
+    }
+  }
+</script>

+ 84 - 0
src/views/module_base/energyPlan/modules/BaseEnergyPlanModal.Style#Drawer.vue

@@ -0,0 +1,84 @@
+<template>
+  <a-drawer
+    :title="title"
+    :width="width"
+    placement="right"
+    :closable="false"
+    @close="close"
+    destroyOnClose
+    :visible="visible">
+    <base-energy-plan-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></base-energy-plan-form>
+    <div class="drawer-footer">
+      <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
+      <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
+    </div>
+  </a-drawer>
+</template>
+
+<script>
+
+  import BaseEnergyPlanForm from './BaseEnergyPlanForm'
+
+  export default {
+    name: 'BaseEnergyPlanModal',
+    components: {
+      BaseEnergyPlanForm
+    },
+    data () {
+      return {
+        title:"操作",
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        });
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+/** Button按钮间距 */
+  .ant-btn {
+    margin-left: 30px;
+    margin-bottom: 30px;
+    float: right;
+  }
+  .drawer-footer{
+    position: absolute;
+    bottom: -8px;
+    width: 100%;
+    border-top: 1px solid #e8e8e8;
+    padding: 10px 16px;
+    text-align: right;
+    left: 0;
+    background: #fff;
+    border-radius: 0 0 2px 2px;
+  }
+</style>

+ 60 - 0
src/views/module_base/energyPlan/modules/BaseEnergyPlanModal.vue

@@ -0,0 +1,60 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+    @cancel="handleCancel"
+    cancelText="关闭">
+    <base-energy-plan-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></base-energy-plan-form>
+  </j-modal>
+</template>
+
+<script>
+
+  import BaseEnergyPlanForm from './BaseEnergyPlanForm'
+  export default {
+    name: 'BaseEnergyPlanModal',
+    components: {
+      BaseEnergyPlanForm
+    },
+    data () {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>

+ 266 - 0
src/views/module_base/energyRate/BaseEnergyRateList.vue

@@ -0,0 +1,266 @@
+<template>
+  <a-card class="j-inner-table-wrapper" :bordered="false">
+
+    <!-- 查询区域 begin -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline">
+        <a-row :gutter="24">
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="名称">
+             <a-input v-model="queryParam.name" placeholder="请输入名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <span class="table-page-search-submitButtons table-operator">
+              <a-button type="primary" icon="search" @click="searchQuery">查询</a-button>
+              <a-button type="primary" icon="reload" @click="searchReset">重置</a-button>
+              <a @click="handleToggleSearch" style="margin-left: 8px">
+                <span>{{ toggleSearchStatus ? '收起' : '展开' }}</span>
+                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
+              </a>
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 查询区域 end -->
+
+    <!-- 操作按钮区域 begin -->
+    <div class="table-operator">
+      <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
+      <a-button type="primary" icon="download" @click="handleExportXls('base_energy_rate')">导出</a-button>
+      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
+        <a-button type="primary" icon="import">导入</a-button>
+      </a-upload>
+      <!-- 高级查询区域 -->
+      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+      <a-dropdown v-if="selectedRowKeys.length > 0">
+        <a-menu slot="overlay">
+          <a-menu-item key="1" @click="batchDel">
+            <a-icon type="delete"/>
+            <span>删除</span>
+          </a-menu-item>
+        </a-menu>
+        <a-button>
+          <span>批量操作</span>
+          <a-icon type="down"/>
+        </a-button>
+      </a-dropdown>
+    </div>
+    <!-- 操作按钮区域 end -->
+
+    <!-- table区域 begin -->
+    <div>
+
+      <a-alert type="info" showIcon style="margin-bottom: 16px;">
+        <template slot="message">
+          <span>已选择</span>
+          <a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
+          <span>项</span>
+          <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+        </template>
+      </a-alert>
+
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        class="j-table-force-nowrap"
+        :scroll="{x:true}"
+        :loading="loading"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :expandedRowKeys="expandedRowKeys"
+        :rowSelection="{selectedRowKeys, onChange: onSelectChange}"
+        @expand="handleExpand"
+        @change="handleTableChange"
+      >
+
+        <!-- 内嵌table区域 begin -->
+        <template slot="expandedRowRender" slot-scope="record">
+          <a-tabs tabPosition="top">
+            <a-tab-pane tab="base_energy_rate_detail" key="baseEnergyRateDetail" forceRender>
+              <base-energy-rate-detail-sub-table :record="record"/>
+            </a-tab-pane>
+          </a-tabs>
+        </template>
+        <!-- 内嵌table区域 end -->
+
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+
+        <template slot="imgSlot" slot-scope="text,record">
+          <div style="font-size: 12px;font-style: italic;">
+            <span v-if="!text">无图片</span>
+            <img v-else :src="getImgView(text)" :preview="record.id" alt="" style="max-width:80px;height:25px;"/>
+          </div>
+        </template>
+
+
+        <template slot="fileSlot" slot-scope="text">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
+          <a-button
+            v-else
+            ghost
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)"
+          >
+            <span>下载</span>
+          </a-button>
+        </template>
+
+        <template slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">编辑</a>
+          <a-divider type="vertical"/>
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="handleDelete(record.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+
+        </template>
+
+      </a-table>
+    </div>
+    <!-- table区域 end -->
+
+    <!-- 表单区域 -->
+    <base-energy-rate-modal ref="modalForm" @ok="modalFormOk"/>
+
+  </a-card>
+</template>
+
+<script>
+
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import BaseEnergyRateModal from './modules/BaseEnergyRateModal'
+  import BaseEnergyRateDetailSubTable from './subTables/BaseEnergyRateDetailSubTable'
+  import '@/assets/less/TableExpand.less'
+
+  export default {
+    name: 'BaseEnergyRateList',
+    mixins: [JeecgListMixin],
+    components: {
+      BaseEnergyRateModal,
+      BaseEnergyRateDetailSubTable,
+    },
+    data() {
+      return {
+        description: 'base_energy_rate列表管理页面',
+        // 表头
+        columns: [
+          {
+            title: '#',
+            key: 'rowIndex',
+            width: 60,
+            align: 'center',
+            customRender: (t, r, index) => parseInt(index) + 1
+          },
+          {
+            title: '能源费率ID',
+            align: 'center',
+            dataIndex: 'energyrateid',
+          },
+          {
+            title: '备注',
+            align: 'center',
+            dataIndex: 'remark',
+          },
+          {
+            title: '名称',
+            align: 'center',
+            dataIndex: 'name',
+          },
+          {
+            title: '能源分类ID',
+            align: 'center',
+            dataIndex: 'energytypeid',
+          },
+          {
+            title: '费率类型:分时费率、阶梯费率',
+            align: 'center',
+            dataIndex: 'ratetype',
+          },
+          {
+            title: '单位',
+            align: 'center',
+            dataIndex: 'rateunit',
+          },
+          {
+            title: '费率有效期开始',
+            align: 'center',
+            dataIndex: 'begintime',
+          },
+          {
+            title: '费率有效期结束',
+            align: 'center',
+            dataIndex: 'endtime',
+          },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align: 'center',
+            width:147,
+            scopedSlots: { customRender: 'action' },
+          },
+        ],
+        // 字典选项
+        dictOptions: {},
+        // 展开的行test
+        expandedRowKeys: [],
+        url: {
+          list: '/energyRate/baseEnergyRate/list',
+          delete: '/energyRate/baseEnergyRate/delete',
+          deleteBatch: '/energyRate/baseEnergyRate/deleteBatch',
+          exportXlsUrl: '/energyRate/baseEnergyRate/exportXls',
+          importExcelUrl: '/energyRate/baseEnergyRate/importExcel',
+        },
+        superFieldList:[],
+      }
+    },
+    created() {
+      this.getSuperFieldList();
+    },
+    computed: {
+      importExcelUrl() {
+        return window._CONFIG['domianURL'] + this.url.importExcelUrl
+      }
+    },
+    methods: {
+      initDictConfig() {
+      },
+
+      handleExpand(expanded, record) {
+        this.expandedRowKeys = []
+        if (expanded === true) {
+          this.expandedRowKeys.push(record.id)
+        }
+      },
+      getSuperFieldList(){
+        let fieldList=[];
+        fieldList.push({type:'int',value:'energyrateid',text:'能源费率ID',dictCode:''})
+        fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
+        fieldList.push({type:'string',value:'name',text:'名称',dictCode:''})
+        fieldList.push({type:'int',value:'energytypeid',text:'能源分类ID',dictCode:''})
+        fieldList.push({type:'string',value:'ratetype',text:'费率类型:分时费率、阶梯费率',dictCode:''})
+        fieldList.push({type:'string',value:'rateunit',text:'单位',dictCode:''})
+        fieldList.push({type:'date',value:'begintime',text:'费率有效期开始'})
+        fieldList.push({type:'date',value:'endtime',text:'费率有效期结束'})
+        this.superFieldList = fieldList
+      }
+    }
+  }
+</script>
+<style lang="less" scoped>
+  @import '~@assets/less/common.less';
+</style>

+ 260 - 0
src/views/module_base/energyRate/modules/BaseEnergyRateForm.vue

@@ -0,0 +1,260 @@
+<template>
+   <a-spin :spinning="confirmLoading">
+     <j-form-container :disabled="formDisabled">
+       <!-- 主表单区域 -->
+       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+         <a-row>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="能源费率ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="energyrateid">
+              <a-input-number v-model="model.energyrateid" placeholder="请输入能源费率ID" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
+              <a-input v-model="model.remark" placeholder="请输入备注" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
+              <a-input v-model="model.name" placeholder="请输入名称" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="能源分类ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="energytypeid">
+              <a-input-number v-model="model.energytypeid" placeholder="请输入能源分类ID" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="费率类型:分时费率、阶梯费率" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ratetype">
+              <a-input v-model="model.ratetype" placeholder="请输入费率类型:分时费率、阶梯费率" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rateunit">
+              <a-input v-model="model.rateunit" placeholder="请输入单位" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="费率有效期开始" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="begintime">
+              <j-date placeholder="请选择费率有效期开始" v-model="model.begintime" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :xs="24" :sm="12">
+            <a-form-model-item label="费率有效期结束" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="endtime">
+              <j-date placeholder="请选择费率有效期结束" v-model="model.endtime" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+     </j-form-container>
+      <!-- 子表单区域 -->
+      <a-tabs v-model="activeKey" @change="handleChangeTabs">
+        <a-tab-pane tab="base_energy_rate_detail" :key="refKeys[0]" :forceRender="true">
+          <j-editable-table
+            :ref="refKeys[0]"
+            :loading="baseEnergyRateDetailTable.loading"
+            :columns="baseEnergyRateDetailTable.columns"
+            :dataSource="baseEnergyRateDetailTable.dataSource"
+            :maxHeight="300"
+            :disabled="formDisabled"
+            :rowNumber="true"
+            :rowSelection="true"
+            :actionButton="true"/>
+        </a-tab-pane>
+      </a-tabs>
+    </a-spin>
+</template>
+
+<script>
+
+  import { FormTypes,getRefPromise,VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
+  import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
+  import { validateDuplicateValue } from '@/utils/util'
+
+  export default {
+    name: 'BaseEnergyRateForm',
+    mixins: [JEditableTableModelMixin],
+    components: {
+    },
+    data() {
+      return {
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+        model:{
+        },
+        validatorRules: {
+           energyrateid: [
+              { required: true, message: '请输入能源费率ID!'},
+           ],
+           name: [
+              { required: true, message: '请输入名称!'},
+           ],
+           energytypeid: [
+              { required: true, message: '请输入能源分类ID!'},
+           ],
+           ratetype: [
+              { required: true, message: '请输入费率类型:分时费率、阶梯费率!'},
+           ],
+           rateunit: [
+              { required: true, message: '请输入单位!'},
+           ],
+           begintime: [
+              { required: true, message: '请输入费率有效期开始!'},
+           ],
+           endtime: [
+              { required: true, message: '请输入费率有效期结束!'},
+           ],
+        },
+        // 新增时子表默认添加几行空数据
+        addDefaultRowNum: 1,
+        refKeys: ['baseEnergyRateDetail', ],
+        tableKeys:['baseEnergyRateDetail', ],
+        activeKey: 'baseEnergyRateDetail',
+        // base_energy_rate_detail
+        baseEnergyRateDetailTable: {
+          loading: false,
+          dataSource: [],
+          columns: [
+            {
+              title: '分时开始时间',
+              key: 'begintime',
+              type: FormTypes.date,
+              width:"200px",
+              placeholder: '请输入${title}',
+              defaultValue:'',
+              validateRules: [{ required: true, message: '${title}不能为空' }],
+            },
+            {
+              title: '分时结束时间',
+              key: 'endtime',
+              type: FormTypes.date,
+              width:"200px",
+              placeholder: '请输入${title}',
+              defaultValue:'',
+            },
+            {
+              title: '峰平谷:尖、峰、谷、平',
+              key: 'pandv',
+              type: FormTypes.input,
+              width:"200px",
+              placeholder: '请输入${title}',
+              defaultValue:'',
+              validateRules: [{ required: true, message: '${title}不能为空' }],
+            },
+            {
+              title: '价格',
+              key: 'price',
+              type: FormTypes.input,
+              width:"200px",
+              placeholder: '请输入${title}',
+              defaultValue:'',
+              validateRules: [{ required: true, message: '${title}不能为空' }],
+            },
+            {
+              title: '起始量',
+              key: 'beginamount',
+              type: FormTypes.input,
+              width:"200px",
+              placeholder: '请输入${title}',
+              defaultValue:'',
+              validateRules: [{ required: true, message: '${title}不能为空' }],
+            },
+            {
+              title: '结束量',
+              key: 'endamount',
+              type: FormTypes.input,
+              width:"200px",
+              placeholder: '请输入${title}',
+              defaultValue:'',
+              validateRules: [{ required: true, message: '${title}不能为空' }],
+            },
+          ]
+        },
+        url: {
+          add: "/energyRate/baseEnergyRate/add",
+          edit: "/energyRate/baseEnergyRate/edit",
+          baseEnergyRateDetail: {
+            list: '/energyRate/baseEnergyRate/queryBaseEnergyRateDetailByMainId'
+          },
+        }
+      }
+    },
+    props: {
+      //表单禁用
+      disabled: {
+        type: Boolean,
+        default: false,
+        required: false
+      }
+    },
+    computed: {
+      formDisabled(){
+        return this.disabled
+      },
+    },
+    created () {
+    },
+    methods: {
+     addBefore(){
+            this.baseEnergyRateDetailTable.dataSource=[]
+      },
+      getAllTable() {
+        let values = this.tableKeys.map(key => getRefPromise(this, key))
+        return Promise.all(values)
+      },
+      /** 调用完edit()方法之后会自动调用此方法 */
+      editAfter() {
+        this.$nextTick(() => {
+        })
+        // 加载子表数据
+        if (this.model.id) {
+          let params = { id: this.model.id }
+          this.requestSubTableData(this.url.baseEnergyRateDetail.list, params, this.baseEnergyRateDetailTable)
+        }
+      },
+      //校验所有一对一子表表单
+    validateSubForm(allValues){
+        return new Promise((resolve,reject)=>{
+          Promise.all([
+          ]).then(() => {
+            resolve(allValues)
+          }).catch(e => {
+            if (e.error === VALIDATE_NO_PASSED) {
+              // 如果有未通过表单验证的子表,就自动跳转到它所在的tab
+              this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
+            } else {
+              console.error(e)
+            }
+          })
+        })
+    },
+      /** 整理成formData */
+      classifyIntoFormData(allValues) {
+        let main = Object.assign(this.model, allValues.formValue)
+
+        return {
+          ...main, // 展开
+          baseEnergyRateDetailList: allValues.tablesValue[0].values,
+        }
+      },
+      validateError(msg){
+        this.$message.error(msg)
+      },
+     close() {
+        this.visible = false
+        this.$emit('close')
+        this.$refs.form.clearValidate();
+      },
+
+    }
+  }
+</script>
+
+<style scoped>
+</style>

+ 61 - 0
src/views/module_base/energyRate/modules/BaseEnergyRateModal.vue

@@ -0,0 +1,61 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="1200"
+    :visible="visible"
+    :maskClosable="false"
+    switchFullscreen
+    @ok="handleOk"
+    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
+    @cancel="handleCancel">
+    <base-energy-rate-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
+  </j-modal>
+</template>
+
+<script>
+  import BaseEnergyRateForm from './BaseEnergyRateForm'
+  export default {
+    name: 'BaseEnergyRateModal',
+    components: {
+      BaseEnergyRateForm
+    },
+    data() {
+      return {
+        title:'',
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods:{
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.handleOk();
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>
+
+<style scoped>
+</style>

+ 128 - 0
src/views/module_base/energyRate/subTables/BaseEnergyRateDetailSubTable.vue

@@ -0,0 +1,128 @@
+<template>
+  <a-table
+    rowKey="id"
+    size="middle"
+    bordered
+    :loading="loading"
+    :columns="columns"
+    :dataSource="dataSource"
+    :pagination="false"
+  >
+
+    <template slot="htmlSlot" slot-scope="text">
+      <div v-html="text"></div>
+    </template>
+
+    <template slot="imgSlot" slot-scope="text,record">
+      <div style="font-size: 12px;font-style: italic;">
+        <span v-if="!text">无图片</span>
+        <img v-else :src="getImgView(text)" :preview="record.id" alt="" style="max-width:80px;height:25px;"/>
+      </div>
+    </template>
+
+    <template slot="fileSlot" slot-scope="text">
+      <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
+      <a-button
+              v-else
+              ghost
+              type="primary"
+              icon="download"
+              size="small"
+              @click="downloadFile(text)"
+      >
+        <span>下载</span>
+      </a-button>
+    </template>
+
+  </a-table>
+</template>
+
+<script>
+  import { getAction } from '@api/manage'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+  export default {
+    name: 'BaseEnergyRateDetailSubTable',
+    mixins: [JeecgListMixin],
+    props: {
+      record: {
+        type: Object,
+        default: null,
+      }
+    },
+    data() {
+      return {
+        description: 'base_energy_rate_detail内嵌列表',
+        disableMixinCreated: true,
+        loading: false,
+        dataSource: [],
+        columns: [
+          {
+            title: '分时开始时间',
+            align: 'center',
+            dataIndex: 'begintime',
+          },
+          {
+            title: '分时结束时间',
+            align: 'center',
+            dataIndex: 'endtime',
+          },
+          {
+            title: '峰平谷:尖、峰、谷、平',
+            align: 'center',
+            dataIndex: 'pandv',
+          },
+          {
+            title: '价格',
+            align: 'center',
+            dataIndex: 'price',
+          },
+          {
+            title: '起始量',
+            align: 'center',
+            dataIndex: 'beginamount',
+          },
+          {
+            title: '结束量',
+            align: 'center',
+            dataIndex: 'endamount',
+          },
+        ],
+        url: {
+          listByMainId: '/energyRate/baseEnergyRate/queryBaseEnergyRateDetailByMainId',
+        },
+      }
+    },
+    watch: {
+      record: {
+        immediate: true,
+        handler() {
+          if (this.record != null) {
+            this.loadData(this.record)
+          }
+        }
+      }
+    },
+    methods: {
+
+      loadData(record) {
+        this.loading = true
+        this.dataSource = []
+        getAction(this.url.listByMainId, {
+          id: record.id
+        }).then((res) => {
+          if (res.success) {
+            this.dataSource = res.result.records
+          }
+        }).finally(() => {
+          this.loading = false
+        })
+      },
+
+    },
+  }
+</script>
+
+<style scoped>
+
+</style>