提交:电价合同 移入 项目详情下>>能源管理>>电价合同 前端
This commit is contained in:
parent
50b11bd0ac
commit
dda6806b0b
|
@ -38,6 +38,7 @@ import EEnergyLoad from "../EnergyManage/EEnergyLoad";
|
||||||
import ENavMenuButton from '../ENavMenuButton/index';
|
import ENavMenuButton from '../ENavMenuButton/index';
|
||||||
import ShopLocation from "@/components/Amap/components/shopLocation/index";
|
import ShopLocation from "@/components/Amap/components/shopLocation/index";
|
||||||
import ESceneManage from '../ESceneManage/index'
|
import ESceneManage from '../ESceneManage/index'
|
||||||
|
import EPrice from '../EPrice/index'
|
||||||
export default {
|
export default {
|
||||||
name: 'EProjectNavLayout',
|
name: 'EProjectNavLayout',
|
||||||
components: {
|
components: {
|
||||||
|
@ -61,7 +62,8 @@ export default {
|
||||||
EEnergyLoad,
|
EEnergyLoad,
|
||||||
ShopLocation,
|
ShopLocation,
|
||||||
ESceneManage,
|
ESceneManage,
|
||||||
ENavMenuButton
|
ENavMenuButton,
|
||||||
|
EPrice
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
tabs: {
|
tabs: {
|
||||||
|
|
|
@ -0,0 +1,522 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container contract-wrap" style="padding: 0;">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="合同名称" prop="contractName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.contractName"
|
||||||
|
placeholder="请输入合同名称"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="计价类型" prop="contractType">
|
||||||
|
<el-select v-model="queryParams.contractType" placeholder="请选择计价类型" clearable size="small">
|
||||||
|
<el-option
|
||||||
|
:label="keys"
|
||||||
|
v-for="(keys, vals) in contractTypeOption"
|
||||||
|
:key="keys"
|
||||||
|
:value="vals"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- <el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['iot:contract:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['iot:contract:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row> -->
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :height="total > 0 ? '460px' : '500px'" :data="contractList">
|
||||||
|
<el-table-column type="index" label="序号" align="center" :index="indexFormatter" width="80px"></el-table-column>
|
||||||
|
<el-table-column label="合同名称" align="left" prop="contractName" />
|
||||||
|
<el-table-column
|
||||||
|
label="计价类型"
|
||||||
|
align="left"
|
||||||
|
prop="contractType"
|
||||||
|
:formatter="contractTypeFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="状态"
|
||||||
|
align="center"
|
||||||
|
width="150px"
|
||||||
|
prop="status"
|
||||||
|
:formatter="statusFormatter"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="200px"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleDestail(scope.row)"
|
||||||
|
>详情</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['iot:contract:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['iot:contract:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
style="margin-top: 5px; height: 35px"
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改电价合同对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
class="eldialog-wrap"
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="open"
|
||||||
|
width="720px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<el-form ref="form" :disabled="tempType === 'destail'" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="合同名称:" prop="contractName">
|
||||||
|
<el-input v-model="form.contractName" placeholder="请输入合同名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="计价类型:" prop="contractType">
|
||||||
|
<el-select
|
||||||
|
v-model="form.contractType"
|
||||||
|
style="width: 100%;"
|
||||||
|
@change="contractTypeChange"
|
||||||
|
placeholder="请选择计价类型"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:label="keys"
|
||||||
|
v-for="(keys, vals) in contractTypeOption"
|
||||||
|
:key="keys"
|
||||||
|
:value="vals"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="状态:">
|
||||||
|
<el-switch
|
||||||
|
v-model="form.status"
|
||||||
|
active-value="0"
|
||||||
|
inactive-value="1"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-form-item label="合同规则:" prop>
|
||||||
|
<el-button size="mini" type="primary" @click="handelAddRule">添加规则</el-button>
|
||||||
|
<div class="contract-gz-wrap" v-for="(item, index) in form.priceContractRuleList" :key="item.guid">
|
||||||
|
<time-picker-wrap
|
||||||
|
:priceList="item"
|
||||||
|
:contractType="form.contractType"
|
||||||
|
:tempIndex="item.guid"
|
||||||
|
:delshow="form.priceContractRuleList.length >= 2"
|
||||||
|
:nodeMaxTime="returnMinTime(index)"
|
||||||
|
:nodeMaxVal="returnMaxVal(index)"
|
||||||
|
@resultEvent="resultEvent"
|
||||||
|
@delEvent="delEvent"
|
||||||
|
></time-picker-wrap>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button size="mini" type="primary" v-show="tempType !== 'destail'" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button size="mini" @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listContract,
|
||||||
|
getContract,
|
||||||
|
delContract,
|
||||||
|
addContract,
|
||||||
|
updateContract,
|
||||||
|
exportContract
|
||||||
|
} from "@/api/iot/contract";
|
||||||
|
|
||||||
|
import TimePickerWrap from "./profile/timePicker";
|
||||||
|
|
||||||
|
const contractTypeOption = {
|
||||||
|
PEAK_VALLEY: "峰谷时段计价",
|
||||||
|
LADDER: "阶梯计价"
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Contract",
|
||||||
|
components: {
|
||||||
|
TimePickerWrap
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
projectInfo: {
|
||||||
|
type: Object,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
sourceId: {
|
||||||
|
type: [Number, String],
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
isFoldRight: {
|
||||||
|
type: Boolean,
|
||||||
|
default: () => {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
contractTypeOption,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 电价合同表格数据
|
||||||
|
contractList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
contractName: null,
|
||||||
|
contractType: null,
|
||||||
|
status: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
contractName: [
|
||||||
|
{ required: true, message: "请填写合同名称", trigger: "blur" }
|
||||||
|
],
|
||||||
|
contractType: [
|
||||||
|
{ required: true, message: "请选择合同类型", trigger: "blur" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
tempType: ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
sourceId: {
|
||||||
|
handler: function(val) {
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getGuid() {
|
||||||
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
|
||||||
|
c
|
||||||
|
) {
|
||||||
|
var r = (Math.random() * 16) | 0,
|
||||||
|
v = c == "x" ? r : (r & 0x3) | 0x8;
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
contractTypeFormatter(row) {
|
||||||
|
return this.contractTypeOption[row.contractType];
|
||||||
|
},
|
||||||
|
statusFormatter(row) {
|
||||||
|
return row.status === "0" ? "启用" : "禁用";
|
||||||
|
},
|
||||||
|
resultEvent(data) {
|
||||||
|
for (var i = 0; i < this.form.priceContractRuleList.length; i++) {
|
||||||
|
if (this.form.priceContractRuleList[i]["guid"] === data.index) {
|
||||||
|
this.form.priceContractRuleList[i] = data.result;
|
||||||
|
this.$forceUpdate();
|
||||||
|
}
|
||||||
|
this.form.priceContractRuleList[i]['ruleNum'] = i + 1;
|
||||||
|
}
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
returnMinTime(index) {
|
||||||
|
var time =
|
||||||
|
index >= 1
|
||||||
|
? this.form.priceContractRuleList[index - 1].maxTime
|
||||||
|
: "00:00:00";
|
||||||
|
return time;
|
||||||
|
},
|
||||||
|
returnMaxVal(index) {
|
||||||
|
var time =
|
||||||
|
index >= 1 ? this.form.priceContractRuleList[index - 1].maxVal : 0;
|
||||||
|
return time;
|
||||||
|
},
|
||||||
|
delEvent(data) {
|
||||||
|
for (var i = 0; i < this.form.priceContractRuleList.length; i++) {
|
||||||
|
if (this.form.priceContractRuleList[i]["guid"] === data.index) {
|
||||||
|
this.form.priceContractRuleList.splice(i, 1);
|
||||||
|
this.$forceUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handelAddRule() {
|
||||||
|
this.form.priceContractRuleList.push({
|
||||||
|
maxTime: "",
|
||||||
|
maxVal: "",
|
||||||
|
minTime: "",
|
||||||
|
minVal: "",
|
||||||
|
ruleName: "",
|
||||||
|
ruleNum: null,
|
||||||
|
unitPrice: "",
|
||||||
|
guid: this.getGuid()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
contractTypeChange(val) {
|
||||||
|
this.form.priceContractRuleList = [];
|
||||||
|
this.form.priceContractRuleList.push({
|
||||||
|
maxTime: "",
|
||||||
|
maxVal: "",
|
||||||
|
minTime: "",
|
||||||
|
minVal: "",
|
||||||
|
ruleName: "",
|
||||||
|
ruleNum: null,
|
||||||
|
unitPrice: "",
|
||||||
|
guid: this.getGuid()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
indexFormatter(val) {
|
||||||
|
return (
|
||||||
|
val + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
|
||||||
|
);
|
||||||
|
},
|
||||||
|
/** 查询电价合同列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listContract(Object.assign(this.queryParams, {
|
||||||
|
projectId: this.sourceId
|
||||||
|
})).then(response => {
|
||||||
|
this.contractList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
contractId: null,
|
||||||
|
contractName: null,
|
||||||
|
contractType: "PEAK_VALLEY",
|
||||||
|
status: "0",
|
||||||
|
remark: null,
|
||||||
|
priceContractRuleList: []
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.contractId);
|
||||||
|
this.single = selection.length !== 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加电价合同";
|
||||||
|
this.tempType = 'add'
|
||||||
|
this.form.priceContractRuleList.push({
|
||||||
|
maxTime: "",
|
||||||
|
maxVal: "",
|
||||||
|
minTime: "",
|
||||||
|
minVal: "",
|
||||||
|
ruleName: "",
|
||||||
|
ruleNum: null,
|
||||||
|
unitPrice: "",
|
||||||
|
guid: this.getGuid()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const contractId = row.contractId || this.ids;
|
||||||
|
getContract(contractId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
var arr = [];
|
||||||
|
response.data.priceContractRuleList.forEach(v => {
|
||||||
|
arr.push(Object.assign(v, { guid: this.getGuid() }));
|
||||||
|
});
|
||||||
|
this.form.priceContractRuleList = arr || [];
|
||||||
|
this.open = true;
|
||||||
|
this.tempType = 'update'
|
||||||
|
this.title = "修改电价合同";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDestail(row) {
|
||||||
|
this.reset();
|
||||||
|
const contractId = row.contractId || this.ids;
|
||||||
|
getContract(contractId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
var arr = [];
|
||||||
|
response.data.priceContractRuleList.forEach(v => {
|
||||||
|
arr.push(Object.assign(v, { guid: this.getGuid() }));
|
||||||
|
});
|
||||||
|
this.form.priceContractRuleList = arr || [];
|
||||||
|
this.tempType = 'destail'
|
||||||
|
this.open = true;
|
||||||
|
this.title = "电价合同详情";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.contractId != null) {
|
||||||
|
updateContract(Object.assign(this.form, {
|
||||||
|
projectId: this.sourceId
|
||||||
|
})).then(response => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addContract(Object.assign(this.form, {
|
||||||
|
projectId: this.sourceId
|
||||||
|
})).then(response => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const contractIds = row.contractId || this.ids;
|
||||||
|
this.$confirm("是否删除该选项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(function() {
|
||||||
|
return delContract(contractIds);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm("是否确认导出所有电价合同数据项?", "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(function() {
|
||||||
|
return exportContract(queryParams);
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
this.download(response.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.contract-gz-wrap {
|
||||||
|
min-height: 50px;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
top: 15px;
|
||||||
|
border: 1px solid #a9a6a6;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
left: -70px;
|
||||||
|
width: calc(100% + 70px);
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,223 @@
|
||||||
|
<template>
|
||||||
|
<div class="time-picker-wrap">
|
||||||
|
<el-row :gutter="20" style="margin-bottom: 10px; width: calc(100% - 10px);">
|
||||||
|
<el-col :span="12">
|
||||||
|
<span class="form-span">规则名称:</span>
|
||||||
|
<el-input class="form-input" v-model="form.ruleName" placeholder="请输入规则名称" />
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<span class="form-span">单价:</span>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.unitPrice"
|
||||||
|
:precision="2"
|
||||||
|
class="form-input"
|
||||||
|
placeholder="单价"
|
||||||
|
></el-input-number>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20" style="width: calc(100% - 10px);" v-if="contractType === 'LADDER'">
|
||||||
|
<el-col :span="12">
|
||||||
|
<span class="form-span">最小值:</span>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.minVal"
|
||||||
|
:precision="2"
|
||||||
|
:disabled="nodeMaxVal !== 0"
|
||||||
|
class="form-input"
|
||||||
|
:min="nodeMaxVal"
|
||||||
|
label="最小值"
|
||||||
|
></el-input-number>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<span class="form-span">最大值:</span>
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.maxVal"
|
||||||
|
:precision="2"
|
||||||
|
class="form-input"
|
||||||
|
:min="form.minVal"
|
||||||
|
label="最大值"
|
||||||
|
></el-input-number>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20" style="width: calc(100% - 10px);" v-else>
|
||||||
|
<el-col :span="24">
|
||||||
|
<span class="form-span">时间:</span>
|
||||||
|
<el-time-picker
|
||||||
|
is-range
|
||||||
|
v-model="times"
|
||||||
|
value-format="HH:mm:ss"
|
||||||
|
range-separator="至"
|
||||||
|
class="form-input"
|
||||||
|
start-placeholder="开始时间"
|
||||||
|
end-placeholder="结束时间"
|
||||||
|
@change="timeChange"
|
||||||
|
maxTime="23:59:59"
|
||||||
|
:disabled="nodeMaxTime === '23:59:59'"
|
||||||
|
placeholder="选择时间范围"
|
||||||
|
></el-time-picker>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
style="color: #f56c6c; font-size: 20px; position: relative; left: 5px;"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
v-show="delshow"
|
||||||
|
@click="handelDelRule(index)"
|
||||||
|
></el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "",
|
||||||
|
props: [
|
||||||
|
"priceList",
|
||||||
|
"contractType",
|
||||||
|
"nodeMaxTime",
|
||||||
|
"tempIndex",
|
||||||
|
"nodeMaxVal",
|
||||||
|
"delshow"
|
||||||
|
],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
times: [],
|
||||||
|
form: {},
|
||||||
|
timeMin: ""
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.form = this.priceList;
|
||||||
|
if (this.contractType === "LADDER") {
|
||||||
|
this.valSet(this.nodeMaxVal);
|
||||||
|
} else {
|
||||||
|
this.timtSet(this.nodeMaxTime);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
form: {
|
||||||
|
handler(val, oldVal) {
|
||||||
|
this.reultEventFu();
|
||||||
|
if (
|
||||||
|
this.contractType === "LADDER" &&
|
||||||
|
this.form.minVal >= this.form.maxVal
|
||||||
|
) {
|
||||||
|
this.form.maxVal = this.form.minVal;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
},
|
||||||
|
nodeMaxTime(val) {
|
||||||
|
if (val) {
|
||||||
|
this.timtSet(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nodeMaxVal(val) {
|
||||||
|
if (val || val === 0) {
|
||||||
|
this.valSet(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
contractType(val) {
|
||||||
|
this.form = this.priceList;
|
||||||
|
if (val === "LADDER") {
|
||||||
|
this.valSet(this.nodeMaxVal);
|
||||||
|
} else {
|
||||||
|
this.timtSet(this.nodeMaxTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
timtSet(val) {
|
||||||
|
this.form.maxTime = this.priceList.maxTime || "23:59:59";
|
||||||
|
this.form.minTime = this.priceList.minTime || "00:00:00";
|
||||||
|
if (val === "23:59:59") {
|
||||||
|
this.form.minTime = "23:59:59";
|
||||||
|
} else if (val) {
|
||||||
|
this.form.minTime = val;
|
||||||
|
// this.timeReckon(val, this.form.minTime)
|
||||||
|
// ? val
|
||||||
|
// : this.form.minTime;
|
||||||
|
}
|
||||||
|
this.times = [this.form.minTime, this.form.maxTime];
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
valSet(val) {
|
||||||
|
this.form.minVal = this.priceList.minVal || 0;
|
||||||
|
if (val === "" || val === 0) {
|
||||||
|
this.form.minVal = 0;
|
||||||
|
this.form.maxVal = this.form.minVal + 1;
|
||||||
|
} else {
|
||||||
|
this.form.minVal = val;
|
||||||
|
if (this.form.minVal >= this.form.maxVal) {
|
||||||
|
this.form.maxVal = this.form.minVal + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
reultEventFu() {
|
||||||
|
this.$emit("resultEvent", { result: this.form, index: this.tempIndex });
|
||||||
|
},
|
||||||
|
timeChange(val) {
|
||||||
|
if (val) {
|
||||||
|
this.form.minTime = this.nodeMaxTime
|
||||||
|
// this.times[0] = this.nodeMaxTime;
|
||||||
|
this.times = [
|
||||||
|
this.nodeMaxTime,
|
||||||
|
this.timeReckon(this.nodeMaxTime, val[1]) ? "23:59:59" : val[1]
|
||||||
|
];
|
||||||
|
// ? this.nodeMaxTime
|
||||||
|
// : val[0];
|
||||||
|
// if (this.timeReckon(this.nodeMaxTime, val[0])) {
|
||||||
|
// this.times = [
|
||||||
|
// this.nodeMaxTime,
|
||||||
|
// this.timeReckon(this.nodeMaxTime, val[1]) ? "23:59:59" : val[1]
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
this.form.maxTime = val[1];
|
||||||
|
} else {
|
||||||
|
this.form.minTime = "";
|
||||||
|
this.form.maxTime = "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
returnMaxTime(index) {
|
||||||
|
var time = this.form.priceContractRuleList[index].minTime
|
||||||
|
? this.form.priceContractRuleList[index].minTime
|
||||||
|
: "00:00:00";
|
||||||
|
return time + " - 23:59:59";
|
||||||
|
},
|
||||||
|
handelDelRule(index) {
|
||||||
|
this.$emit("delEvent", { result: this.form, index: this.tempIndex });
|
||||||
|
},
|
||||||
|
timeReckon(refer, timeStr) {
|
||||||
|
const referTime = new Date(
|
||||||
|
this.parseTime(new Date(), "{y}-{m}-{d}") + " " + refer
|
||||||
|
).getTime();
|
||||||
|
const time = new Date(
|
||||||
|
this.parseTime(new Date(), "{y}-{m}-{d}") + " " + timeStr
|
||||||
|
).getTime();
|
||||||
|
return referTime > time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.time-picker-wrap {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
.form-span {
|
||||||
|
display: block;
|
||||||
|
width: 80px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.form-input {
|
||||||
|
margin-left: 10px;
|
||||||
|
width: calc(100% - 80px);
|
||||||
|
}
|
||||||
|
.el-col-12 {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.el-col-24 {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -376,12 +376,17 @@ export default {
|
||||||
template: 'ENavLayout',
|
template: 'ENavLayout',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
label: "电 量",
|
label: "电 量",
|
||||||
key: "electricity",
|
key: "electricity",
|
||||||
template: "EElectricity",
|
template: "EElectricity",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "负 载",
|
label: "电价合同",
|
||||||
|
key: "eprice",
|
||||||
|
template: "EPrice",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "负 载",
|
||||||
key: "energyLoad",
|
key: "energyLoad",
|
||||||
template: "EEnergyLoad",
|
template: "EEnergyLoad",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue