mirror of https://gitee.com/lmlz_0/dc-ui.git
ljlong_2630
10 months ago
16 changed files with 8323 additions and 177 deletions
@ -0,0 +1,53 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询调控策略列表
|
||||
|
export function listAdjust(query) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjust/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询调控策略详细
|
||||
|
export function getAdjust(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjust/' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增调控策略
|
||||
|
export function addAdjust(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjust', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改调控策略
|
||||
|
export function updateAdjust(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjust', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除调控策略
|
||||
|
export function delAdjust(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjust/' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 导出调控策略
|
||||
|
export function exportAdjust(query) { |
||||
|
return request({ |
||||
|
url: '/${baseUrl}/export', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询调控策略资产列表
|
||||
|
export function listAdjustAsset(query) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustAsset/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询调控策略资产详细
|
||||
|
export function getAdjustAsset(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustAsset/' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增调控策略资产
|
||||
|
export function addAdjustAsset(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustAsset', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改调控策略资产
|
||||
|
export function updateAdjustAsset(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustAsset', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除调控策略资产
|
||||
|
export function delAdjustAsset(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustAsset/' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 导出调控策略资产
|
||||
|
export function exportAdjustAsset(query) { |
||||
|
return request({ |
||||
|
url: '/${baseUrl}/export', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询调控策略参数列表
|
||||
|
export function listAdjustParams(query) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustParams/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询调控策略参数详细
|
||||
|
export function getAdjustParams(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustParams/' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增调控策略参数
|
||||
|
export function addAdjustParams(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustParams', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改调控策略参数
|
||||
|
export function updateAdjustParams(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustParams', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除调控策略参数
|
||||
|
export function delAdjustParams(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustParams/' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 导出调控策略参数
|
||||
|
export function exportAdjustParams(query) { |
||||
|
return request({ |
||||
|
url: '/${baseUrl}/export', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询资产
|
||||
|
export function getAdjustAssets(query) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyAdjustParams/asset/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询调控方案列表
|
||||
|
export function listMethod(query) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyMethod/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
// 查询调控方案列表
|
||||
|
export function listNoPage(query) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyMethod/listNoPage', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
// 查询调控方案详细
|
||||
|
export function getMethod(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyMethod/' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增调控方案
|
||||
|
export function addMethod(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyMethod', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改调控方案
|
||||
|
export function updateMethod(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyMethod', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除调控方案
|
||||
|
export function delMethod(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyMethod/' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 导出调控方案
|
||||
|
export function exportMethod(query) { |
||||
|
return request({ |
||||
|
url: '/${baseUrl}/export', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询调控计划列表
|
||||
|
export function listPlan(query) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyPlan/list', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 查询调控计划详细
|
||||
|
export function getPlan(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyPlan/' + id, |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 新增调控计划
|
||||
|
export function addPlan(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyPlan', |
||||
|
method: 'post', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改调控计划
|
||||
|
export function updatePlan(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyPlan', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 删除调控计划
|
||||
|
export function delPlan(id) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyPlan/' + id, |
||||
|
method: 'delete' |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 导出调控计划
|
||||
|
export function exportPlan(query) { |
||||
|
return request({ |
||||
|
url: '/${baseUrl}/export', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 修改调控计划
|
||||
|
export function changeState(data) { |
||||
|
return request({ |
||||
|
url: '/model/dcBaseStrategyPlan/changeState', |
||||
|
method: 'put', |
||||
|
data: data |
||||
|
}) |
||||
|
} |
@ -0,0 +1,281 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px"> |
||||
|
<el-form-item label="编码" prop="adjustCode"> |
||||
|
<el-input v-model="queryParams.adjustCode" placeholder="请输入编码" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="名称" prop="adjustName"> |
||||
|
<el-input v-model="queryParams.adjustName" placeholder="请输入名称" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="方案" prop="methodType"> |
||||
|
<el-select v-model="form.methodType" filterable placeholder="方案"> |
||||
|
<el-option v-for="dict in methodList" :label="dict.methodName" :value=dict.methodCode> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
|
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button> |
||||
|
</el-col> |
||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-table v-loading="loading" :data="adjustList" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column type="selection" width="55" align="center" /> |
||||
|
<el-table-column label="编码" align="center" prop="adjustCode" /> |
||||
|
<el-table-column label="名称" align="center" prop="adjustName" /> |
||||
|
<el-table-column label="方案" align="center" prop="methodType" /> |
||||
|
<el-table-column label="是否有效" align="center" prop="flagEnabled" /> |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
|
<template #default="scope"> |
||||
|
<el-button type="text" icon="Edit" @click="handleParams(scope.row)">资产参数配置</el-button> |
||||
|
<el-button type="text" icon="Link" @click="handleAsset(scope.row)">资产配置</el-button> |
||||
|
<el-button type="text" icon="Edit" @click="handlePlan(scope.row)">调度计划</el-button> |
||||
|
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> |
||||
|
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" |
||||
|
@pagination="getList" /> |
||||
|
|
||||
|
<!-- 添加或修改调控策略对话框 --> |
||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body> |
||||
|
<el-form ref="adjustRef" :model="form" :rules="rules" label-width="80px"> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="编码" prop="adjustCode"> |
||||
|
<el-input v-model="form.adjustCode" placeholder="请输入编码" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="名称" prop="adjustName"> |
||||
|
<el-input v-model="form.adjustName" placeholder="请输入名称" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="方案" prop="methodType"> |
||||
|
<el-select v-model="form.methodType" filterable placeholder="请选择方案"> |
||||
|
<el-option v-for="dict in methodList" :label="dict.methodName" :value=dict.methodCode> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="是否有效"> |
||||
|
<el-checkbox v-model="form.flagEnabled"></el-checkbox> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
|
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup name="Adjust"> |
||||
|
import { listAdjust, getAdjust, delAdjust, addAdjust, updateAdjust } from "@/api/model/strategy/adjust"; |
||||
|
import { listNoPage } from "@/api/model/strategy/method"; |
||||
|
const { proxy } = getCurrentInstance(); |
||||
|
const router = useRouter(); |
||||
|
const adjustList = ref([]); |
||||
|
const open = ref(false); |
||||
|
const loading = ref(true); |
||||
|
const showSearch = ref(true); |
||||
|
const ids = ref([]); |
||||
|
const single = ref(true); |
||||
|
const multiple = ref(true); |
||||
|
const total = ref(0); |
||||
|
const title = ref(""); |
||||
|
const methodList = ref([]); |
||||
|
const data = reactive({ |
||||
|
form: {}, |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
tentantId: null, |
||||
|
adjustCode: null, |
||||
|
adjustName: null, |
||||
|
methodType: null, |
||||
|
flagEnabled: null |
||||
|
}, |
||||
|
rules: { |
||||
|
} |
||||
|
}); |
||||
|
const assetCode = router.currentRoute.value.query.assetCode; |
||||
|
const { queryParams, form, rules } = toRefs(data); |
||||
|
|
||||
|
/** 查询调控策略列表 */ |
||||
|
function getList() { |
||||
|
loading.value = true; |
||||
|
listAdjust(queryParams.value).then(response => { |
||||
|
adjustList.value = response.rows; |
||||
|
total.value = response.total; |
||||
|
loading.value = false; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 取消按钮 |
||||
|
function cancel() { |
||||
|
open.value = false; |
||||
|
reset(); |
||||
|
} |
||||
|
|
||||
|
// 表单重置 |
||||
|
function reset() { |
||||
|
form.value = { |
||||
|
tentantId: null, |
||||
|
version: null, |
||||
|
createBy: null, |
||||
|
createTime: null, |
||||
|
updateBy: null, |
||||
|
updateTime: null, |
||||
|
deptId: null, |
||||
|
userId: null, |
||||
|
deleteBy: null, |
||||
|
deleteTime: null, |
||||
|
id: null, |
||||
|
adjustCode: null, |
||||
|
adjustName: null, |
||||
|
methodType: null, |
||||
|
flagEnabled: [] |
||||
|
}; |
||||
|
proxy.resetForm("adjustRef"); |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
function handleQuery() { |
||||
|
queryParams.value.pageNum = 1; |
||||
|
getList(); |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
function resetQuery() { |
||||
|
proxy.resetForm("queryRef"); |
||||
|
handleQuery(); |
||||
|
} |
||||
|
|
||||
|
// 多选框选中数据 |
||||
|
function handleSelectionChange(selection) { |
||||
|
ids.value = selection.map(item => item.id); |
||||
|
single.value = selection.length != 1; |
||||
|
multiple.value = !selection.length; |
||||
|
} |
||||
|
|
||||
|
/** 新增按钮操作 */ |
||||
|
function handleAdd() { |
||||
|
reset(); |
||||
|
open.value = true; |
||||
|
title.value = "添加调控策略"; |
||||
|
} |
||||
|
|
||||
|
/** 修改按钮操作 */ |
||||
|
function handleUpdate(row) { |
||||
|
reset(); |
||||
|
const _id = row.id || ids.value |
||||
|
getAdjust(_id).then(response => { |
||||
|
form.value = response.data; |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
open.value = true; |
||||
|
title.value = "修改调控策略"; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮 */ |
||||
|
function submitForm() { |
||||
|
proxy.$refs["adjustRef"].validate(valid => { |
||||
|
if (valid) { |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
if (form.value.id != null) { |
||||
|
updateAdjust(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} else { |
||||
|
addAdjust(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("新增成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
function handleDelete(row) { |
||||
|
const _ids = row.id || ids.value; |
||||
|
proxy.$modal.confirm('是否确认删除调控策略编号为"' + _ids + '"的数据项?').then(function () { |
||||
|
return delAdjust(_ids); |
||||
|
}).then(() => { |
||||
|
getList(); |
||||
|
proxy.$modal.msgSuccess("删除成功"); |
||||
|
}).catch(() => { }); |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
function handleExport() { |
||||
|
proxy.download('strategy/adjust/export', { |
||||
|
...queryParams.value |
||||
|
}, `adjust_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
|
||||
|
function getMethodList() { |
||||
|
listNoPage({}).then(response => { |
||||
|
methodList.value = response.data; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function handleParams(row) { |
||||
|
router.push({ |
||||
|
path: "adjustParams", |
||||
|
query: { |
||||
|
adjustCode: row.adjustCode |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function handlePlan(row) { |
||||
|
router.push({ |
||||
|
path: "plan", |
||||
|
query: { |
||||
|
adjustCode: row.adjustCode |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function handleAsset(row) { |
||||
|
router.push({ |
||||
|
path: "adjustAsset", |
||||
|
query: { |
||||
|
adjustCode: row.adjustCode |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
getList(); |
||||
|
getMethodList() |
||||
|
</script> |
@ -0,0 +1,275 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px"> |
||||
|
<el-form-item label="策略编码" prop="adjustCode"> |
||||
|
<el-input v-model="queryParams.adjustCode" disabled=false placeholder="请输入策略编码" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="资产编号" prop="assetCode"> |
||||
|
<el-input v-model="queryParams.assetCode" placeholder="请输入资产编号" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="资产名称" prop="assetName"> |
||||
|
<el-input v-model="queryParams.assetName" placeholder="请输入资产名称" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="是否启用" prop="flagEnabled"> |
||||
|
<el-select v-model="queryParams.flagEnabled" placeholder="请选择是否启用" clearable> |
||||
|
<el-option v-for="dict in sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="组(字典)" prop="dictGroup"> |
||||
|
<el-select v-model="queryParams.dictGroup" placeholder="请选择组(字典)" clearable> |
||||
|
<el-option v-for="dict in dc_adjust_asset_group" :key="dict.value" :label="dict.label" :value="dict.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
|
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button> |
||||
|
</el-col> |
||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-table v-loading="loading" :data="adjustAssetList" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column type="selection" width="55" align="center" /> |
||||
|
<el-table-column label="资产编号" align="center" prop="assetCode" /> |
||||
|
<el-table-column label="资产名称" align="center" prop="assetName" /> |
||||
|
<el-table-column label="是否启用" align="center" prop="flagEnabled"> |
||||
|
<template #default="scope"> |
||||
|
<dict-tag :options="sys_yes_no" :value="scope.row.flagEnabled" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="组(字典)" align="center" prop="dictGroup"> |
||||
|
<template #default="scope"> |
||||
|
<dict-tag :options="dc_adjust_asset_group" :value="scope.row.dictGroup" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
|
<template #default="scope"> |
||||
|
<el-button type="text" icon="Link" @click="handleParams(scope.row)">资产参数配置</el-button> |
||||
|
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> |
||||
|
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" |
||||
|
@pagination="getList" /> |
||||
|
|
||||
|
<!-- 添加或修改调控策略资产对话框 --> |
||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body> |
||||
|
<el-form ref="adjustAssetRef" :model="form" :rules="rules" label-width="80px"> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="策略编码" prop="adjustCode"> |
||||
|
<el-input v-model="form.adjustCode" placeholder="请输入策略编码" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="资产编号" prop="assetCode"> |
||||
|
<el-input v-model="form.assetCode" placeholder="请输入资产编号" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="是否启用" prop="flagEnabled"> |
||||
|
<el-select v-model="form.flagEnabled" placeholder="请选择是否启用"> |
||||
|
<el-option v-for="dict in sys_yes_no" :key="dict.value" :label="dict.label" |
||||
|
:value="dict.value"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="组(字典)" prop="dictGroup"> |
||||
|
<el-select v-model="form.dictGroup" placeholder="请选择组(字典)"> |
||||
|
<el-option v-for="dict in dc_adjust_asset_group" :key="dict.value" :label="dict.label" |
||||
|
:value="dict.value"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup name="AdjustAsset"> |
||||
|
import { listAdjustAsset, getAdjustAsset, delAdjustAsset, addAdjustAsset, updateAdjustAsset } from "@/api/model/strategy/adjustAsset"; |
||||
|
|
||||
|
const { proxy } = getCurrentInstance(); |
||||
|
const { dc_adjust_asset_group, sys_yes_no } = proxy.useDict('dc_adjust_asset_group', 'sys_yes_no'); |
||||
|
|
||||
|
const adjustAssetList = ref([]); |
||||
|
const open = ref(false); |
||||
|
const loading = ref(true); |
||||
|
const showSearch = ref(true); |
||||
|
const ids = ref([]); |
||||
|
const single = ref(true); |
||||
|
const multiple = ref(true); |
||||
|
const total = ref(0); |
||||
|
const title = ref(""); |
||||
|
const router = useRouter(); |
||||
|
const adjustCode = router.currentRoute.value.query.adjustCode; |
||||
|
|
||||
|
const data = reactive({ |
||||
|
form: {}, |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
tentantId: null, |
||||
|
adjustCode: null, |
||||
|
assetCode: null, |
||||
|
assetName:null, |
||||
|
flagEnabled: null, |
||||
|
dictGroup: null |
||||
|
}, |
||||
|
rules: { |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const { queryParams, form, rules } = toRefs(data); |
||||
|
|
||||
|
/** 查询调控策略资产列表 */ |
||||
|
function getList() { |
||||
|
loading.value = true; |
||||
|
queryParams.value.adjustCode = adjustCode |
||||
|
listAdjustAsset(queryParams.value).then(response => { |
||||
|
adjustAssetList.value = response.rows; |
||||
|
total.value = response.total; |
||||
|
loading.value = false; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 取消按钮 |
||||
|
function cancel() { |
||||
|
open.value = false; |
||||
|
reset(); |
||||
|
} |
||||
|
|
||||
|
// 表单重置 |
||||
|
function reset() { |
||||
|
form.value = { |
||||
|
tentantId: null, |
||||
|
version: null, |
||||
|
createBy: null, |
||||
|
createTime: null, |
||||
|
updateBy: null, |
||||
|
updateTime: null, |
||||
|
deptId: null, |
||||
|
userId: null, |
||||
|
deleteBy: null, |
||||
|
deleteTime: null, |
||||
|
id: null, |
||||
|
adjustCode: null, |
||||
|
assetCode: null, |
||||
|
flagEnabled: null, |
||||
|
dictGroup: null |
||||
|
}; |
||||
|
proxy.resetForm("adjustAssetRef"); |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
function handleQuery() { |
||||
|
queryParams.value.pageNum = 1; |
||||
|
getList(); |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
function resetQuery() { |
||||
|
proxy.resetForm("queryRef"); |
||||
|
handleQuery(); |
||||
|
} |
||||
|
|
||||
|
// 多选框选中数据 |
||||
|
function handleSelectionChange(selection) { |
||||
|
ids.value = selection.map(item => item.id); |
||||
|
single.value = selection.length != 1; |
||||
|
multiple.value = !selection.length; |
||||
|
} |
||||
|
|
||||
|
/** 新增按钮操作 */ |
||||
|
function handleAdd() { |
||||
|
reset(); |
||||
|
open.value = true; |
||||
|
title.value = "添加调控策略资产"; |
||||
|
} |
||||
|
|
||||
|
/** 修改按钮操作 */ |
||||
|
function handleUpdate(row) { |
||||
|
reset(); |
||||
|
const _id = row.id || ids.value |
||||
|
getAdjustAsset(_id).then(response => { |
||||
|
form.value = response.data; |
||||
|
open.value = true; |
||||
|
title.value = "修改调控策略资产"; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮 */ |
||||
|
function submitForm() { |
||||
|
proxy.$refs["adjustAssetRef"].validate(valid => { |
||||
|
if (valid) { |
||||
|
if (form.value.id != null) { |
||||
|
updateAdjustAsset(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} else { |
||||
|
form.value.adjustCode = adjustCode |
||||
|
addAdjustAsset(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("新增成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
function handleDelete(row) { |
||||
|
const _ids = row.id || ids.value; |
||||
|
proxy.$modal.confirm('是否确认删除调控策略资产编号为"' + _ids + '"的数据项?').then(function () { |
||||
|
return delAdjustAsset(_ids); |
||||
|
}).then(() => { |
||||
|
getList(); |
||||
|
proxy.$modal.msgSuccess("删除成功"); |
||||
|
}).catch(() => { }); |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
function handleExport() { |
||||
|
proxy.download('strategy/adjustAsset/export', { |
||||
|
...queryParams.value |
||||
|
}, `adjustAsset_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
|
||||
|
function handleParams(row) { |
||||
|
router.push({ |
||||
|
path: "adjustParams", |
||||
|
query: { |
||||
|
adjustCode: row.adjustCode, |
||||
|
assetCode: row.assetCode |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
getList(); |
||||
|
</script> |
@ -0,0 +1,315 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-row :gutter="10"> |
||||
|
<el-col :span="4"> |
||||
|
<el-tree style = "height: 700px;overflow:auto;display: flex" :data="assetOptions" :props="{ label: 'label', children: 'children' }" :expand-on-click-node="false" |
||||
|
:filter-node-method="filterNode" ref="deptTreeRef" node-key="id" highlight-current default-expand-all |
||||
|
@node-click="handleNodeClick" /> |
||||
|
</el-col> |
||||
|
<el-col :span="20"> |
||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px"> |
||||
|
<el-form-item label="策略编码" prop="adjustCode"> |
||||
|
<el-input v-model="queryParams.adjustCode" placeholder="请输入策略编码" clearable @keyup.enter="handleQuery" |
||||
|
disabled=false /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="资产编号" prop="assetCode"> |
||||
|
<el-input v-model="queryParams.assetCode" placeholder="请输入资产编号" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="参数编码" prop="paramCode"> |
||||
|
<el-input v-model="queryParams.paramCode" placeholder="请输入参数编码" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
|
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button> |
||||
|
</el-col> |
||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
<el-table v-loading="loading" :data="adjustParamsList" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column type="selection" width="55" align="center" /> |
||||
|
<el-table-column label="策略编码" align="center" prop="adjustCode" /> |
||||
|
<el-table-column label="资产编号" align="center" prop="assetCode" /> |
||||
|
<el-table-column label="资产名称" align="center" prop="assetName" /> |
||||
|
<el-table-column label="参数编码" align="center" prop="paramCode" /> |
||||
|
<el-table-column label="参数模板" align="center" prop="paramClassName" /> |
||||
|
<el-table-column label="分区" align="center" prop="partion" /> |
||||
|
<el-table-column label="是否有效" align="center" prop="flagEnabled" /> |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
|
<template #default="scope"> |
||||
|
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> |
||||
|
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" |
||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" /> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<!-- 添加或修改调控策略参数对话框 --> |
||||
|
<el-dialog :title="title" v-model="open" width="1000px" append-to-body> |
||||
|
|
||||
|
<el-row> |
||||
|
<el-col :span="6"> |
||||
|
<div class="head-container"> |
||||
|
<el-input v-model="deptName" placeholder="请输入部门名称" clearable prefix-icon="Search" |
||||
|
style="margin-bottom: 20px" /> |
||||
|
</div> |
||||
|
<div class="head-container"> |
||||
|
<el-tree :data="deptOptions" :props="{ label: 'label', children: 'children' }" :expand-on-click-node="false" |
||||
|
:filter-node-method="filterNode" ref="deptTreeRef" node-key="id" highlight-current default-expand-all |
||||
|
@node-click="handleNodeClick" /> |
||||
|
</div> |
||||
|
</el-col> |
||||
|
<el-col :span="18"> |
||||
|
<el-form ref="adjustParamsRef" :model="form" :rules="rules" label-width="80px"> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="策略编码" prop="adjustCode"> |
||||
|
<el-input v-model="form.adjustCode" disabled=false placeholder="请输入策略编码" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="资产编号" prop="assetCode"> |
||||
|
<el-input v-model="form.assetCode" placeholder="请输入资产编号" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="参数编码" prop="paramCode"> |
||||
|
<el-input v-model="form.paramCode" placeholder="请输入参数编码" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="是否有效"> |
||||
|
<el-checkbox v-model="form.flagEnabled"></el-checkbox> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
|
||||
|
|
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup name="AdjustParams"> |
||||
|
import { listAdjustParams, getAdjustParams, delAdjustParams, addAdjustParams, updateAdjustParams, getAdjustAssets } from "@/api/model/strategy/adjustParams"; |
||||
|
import { deptTreeSelect } from "@/api/system/user"; |
||||
|
const { proxy } = getCurrentInstance(); |
||||
|
|
||||
|
const adjustParamsList = ref([]); |
||||
|
const open = ref(false); |
||||
|
const loading = ref(true); |
||||
|
const showSearch = ref(true); |
||||
|
const ids = ref([]); |
||||
|
const single = ref(true); |
||||
|
const multiple = ref(true); |
||||
|
const total = ref(0); |
||||
|
const title = ref(""); |
||||
|
const router = useRouter(); |
||||
|
const adjustCode = router.currentRoute.value.query.adjustCode; |
||||
|
const assetCode = router.currentRoute.value.query.assetCode; |
||||
|
const data = reactive({ |
||||
|
form: {}, |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
tentantId: null, |
||||
|
adjustCode: null, |
||||
|
assetCode: null, |
||||
|
paramCode: null, |
||||
|
flagEnabled: null |
||||
|
}, |
||||
|
rules: { |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const { queryParams, form, rules } = toRefs(data); |
||||
|
|
||||
|
/** 查询调控策略参数列表 */ |
||||
|
function getList() { |
||||
|
queryParams.value.adjustCode = adjustCode; |
||||
|
queryParams.value.assetCode = assetCode; |
||||
|
loading.value = true; |
||||
|
listAdjustParams(queryParams.value).then(response => { |
||||
|
adjustParamsList.value = response.rows; |
||||
|
total.value = response.total; |
||||
|
loading.value = false; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 取消按钮 |
||||
|
function cancel() { |
||||
|
open.value = false; |
||||
|
reset(); |
||||
|
} |
||||
|
|
||||
|
// 表单重置 |
||||
|
function reset() { |
||||
|
form.value = { |
||||
|
tentantId: null, |
||||
|
version: null, |
||||
|
createBy: null, |
||||
|
createTime: null, |
||||
|
updateBy: null, |
||||
|
updateTime: null, |
||||
|
deptId: null, |
||||
|
userId: null, |
||||
|
deleteBy: null, |
||||
|
deleteTime: null, |
||||
|
id: null, |
||||
|
adjustCode: null, |
||||
|
assetCode: null, |
||||
|
paramCode: null, |
||||
|
flagEnabled: null |
||||
|
}; |
||||
|
proxy.resetForm("adjustParamsRef"); |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
function handleQuery() { |
||||
|
queryParams.value.pageNum = 1; |
||||
|
getList(); |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
function resetQuery() { |
||||
|
proxy.resetForm("queryRef"); |
||||
|
handleQuery(); |
||||
|
} |
||||
|
|
||||
|
// 多选框选中数据 |
||||
|
function handleSelectionChange(selection) { |
||||
|
ids.value = selection.map(item => item.id); |
||||
|
single.value = selection.length != 1; |
||||
|
multiple.value = !selection.length; |
||||
|
} |
||||
|
|
||||
|
/** 新增按钮操作 */ |
||||
|
function handleAdd() { |
||||
|
reset(); |
||||
|
open.value = true; |
||||
|
title.value = "添加调控策略参数"; |
||||
|
form.value.adjustCode = adjustCode; |
||||
|
} |
||||
|
|
||||
|
/** 修改按钮操作 */ |
||||
|
function handleUpdate(row) { |
||||
|
reset(); |
||||
|
form.value.adjustCode = adjustCode; |
||||
|
const _id = row.id || ids.value |
||||
|
getAdjustParams(_id).then(response => { |
||||
|
form.value = response.data; |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
open.value = true; |
||||
|
title.value = "修改调控策略参数"; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮 */ |
||||
|
function submitForm() { |
||||
|
proxy.$refs["adjustParamsRef"].validate(valid => { |
||||
|
if (valid) { |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
if (form.value.id != null) { |
||||
|
updateAdjustParams(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} else { |
||||
|
addAdjustParams(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("新增成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
function handleDelete(row) { |
||||
|
const _ids = row.id || ids.value; |
||||
|
proxy.$modal.confirm('是否确认删除调控策略参数编号为"' + _ids + '"的数据项?').then(function () { |
||||
|
return delAdjustParams(_ids); |
||||
|
}).then(() => { |
||||
|
getList(); |
||||
|
proxy.$modal.msgSuccess("删除成功"); |
||||
|
}).catch(() => { }); |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
function handleExport() { |
||||
|
proxy.download('strategy/adjustParams/export', { |
||||
|
...queryParams.value |
||||
|
}, `adjustParams_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
|
||||
|
const assetOptions = ref([]); |
||||
|
assetOptions.value.push({ code: null, label: '换热站', children: [] }) |
||||
|
/** */ |
||||
|
function getAssets() { |
||||
|
queryParams.value.adjustCode = adjustCode |
||||
|
getAdjustAssets(queryParams.value).then(response => { |
||||
|
if (response.code == 200) { |
||||
|
let childrens = response.data.map(i => { |
||||
|
return { ['code']: i['assetCode'], ['label']: i['assetName'] } |
||||
|
}) |
||||
|
assetOptions.value[0].children = childrens |
||||
|
} |
||||
|
console.log(response) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
getList(); |
||||
|
getAssets(); |
||||
|
|
||||
|
/** 部门树 */ |
||||
|
getDeptTree(); |
||||
|
const deptOptions = ref([]); |
||||
|
const deptName = ref(null); |
||||
|
function getDeptTree() { |
||||
|
deptTreeSelect().then(response => { |
||||
|
deptOptions.value = response.data; |
||||
|
}); |
||||
|
}; |
||||
|
/** 通过条件过滤节点 */ |
||||
|
const filterNode = (value, data) => { |
||||
|
if (!value) return true; |
||||
|
return data.label.indexOf(value) !== -1; |
||||
|
}; |
||||
|
/** 节点单击事件 */ |
||||
|
function handleNodeClick(data) { |
||||
|
// queryParams.value.orgCode = data.id; |
||||
|
// handleQuery(); |
||||
|
}; |
||||
|
|
||||
|
function selectDept(val) { |
||||
|
// form.value.orgCode = val.id; |
||||
|
} |
||||
|
/** 根据名称筛选部门树 */ |
||||
|
watch(deptName, val => { |
||||
|
proxy.$refs["deptTreeRef"].filter(val); |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,248 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px"> |
||||
|
<el-form-item label="编码" prop="methodCode"> |
||||
|
<el-input v-model="queryParams.methodCode" placeholder="请输入编码" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="名称" prop="methodName"> |
||||
|
<el-input v-model="queryParams.methodName" placeholder="请输入名称" clearable @keyup.enter="handleQuery" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="类别" prop="adjustType"> |
||||
|
<el-select v-model="queryParams.adjustType" placeholder="请选择类别" clearable> |
||||
|
<el-option v-for="dict in dc_strategy_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
|
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button> |
||||
|
</el-col> |
||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-table v-loading="loading" :data="methodList" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column type="selection" width="55" align="center" /> |
||||
|
<el-table-column label="编码" align="center" prop="methodCode" /> |
||||
|
<el-table-column label="名称" align="center" prop="methodName" /> |
||||
|
<el-table-column label="类别" align="center" prop="adjustType"> |
||||
|
<template #default="scope"> |
||||
|
<dict-tag :options="dc_strategy_type" :value="scope.row.adjustType" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="是否有效" align="center" prop="flagEnabled" /> |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
|
<template #default="scope"> |
||||
|
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> |
||||
|
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" |
||||
|
@pagination="getList" /> |
||||
|
|
||||
|
<!-- 添加或修改调控方案对话框 --> |
||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body> |
||||
|
<el-form ref="methodRef" :model="form" :rules="rules" label-width="80px"> |
||||
|
|
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="编码" prop="methodCode"> |
||||
|
<el-input v-model="form.methodCode" placeholder="请输入编码" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="名称" prop="methodName"> |
||||
|
<el-input v-model="form.methodName" placeholder="请输入名称" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="类别" prop="adjustType"> |
||||
|
<el-select v-model="form.adjustType" placeholder="请选择类别"> |
||||
|
<el-option v-for="dict in dc_strategy_type" :key="dict.value" :label="dict.label" |
||||
|
:value="dict.value"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="是否有效"> |
||||
|
<el-checkbox v-model="form.flagEnabled"></el-checkbox> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup name="Method"> |
||||
|
import { listMethod, getMethod, delMethod, addMethod, updateMethod } from "@/api/model/strategy/method"; |
||||
|
|
||||
|
const { proxy } = getCurrentInstance(); |
||||
|
const { dc_strategy_type } = proxy.useDict('dc_strategy_type'); |
||||
|
|
||||
|
const methodList = ref([]); |
||||
|
const open = ref(false); |
||||
|
const loading = ref(true); |
||||
|
const showSearch = ref(true); |
||||
|
const ids = ref([]); |
||||
|
const single = ref(true); |
||||
|
const multiple = ref(true); |
||||
|
const total = ref(0); |
||||
|
const title = ref(""); |
||||
|
|
||||
|
const data = reactive({ |
||||
|
form: {}, |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
tentantId: null, |
||||
|
methodCode: null, |
||||
|
methodName: null, |
||||
|
adjustType: null, |
||||
|
flagEnabled: null |
||||
|
}, |
||||
|
rules: { |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const { queryParams, form, rules } = toRefs(data); |
||||
|
|
||||
|
/** 查询调控方案列表 */ |
||||
|
function getList() { |
||||
|
loading.value = true; |
||||
|
listMethod(queryParams.value).then(response => { |
||||
|
methodList.value = response.rows; |
||||
|
total.value = response.total; |
||||
|
loading.value = false; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 取消按钮 |
||||
|
function cancel() { |
||||
|
open.value = false; |
||||
|
reset(); |
||||
|
} |
||||
|
|
||||
|
// 表单重置 |
||||
|
function reset() { |
||||
|
form.value = { |
||||
|
tentantId: null, |
||||
|
version: null, |
||||
|
createBy: null, |
||||
|
createTime: null, |
||||
|
updateBy: null, |
||||
|
updateTime: null, |
||||
|
deptId: null, |
||||
|
userId: null, |
||||
|
deleteBy: null, |
||||
|
deleteTime: null, |
||||
|
id: null, |
||||
|
methodCode: null, |
||||
|
methodName: null, |
||||
|
adjustType: null, |
||||
|
flagEnabled: [] |
||||
|
}; |
||||
|
proxy.resetForm("methodRef"); |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
function handleQuery() { |
||||
|
queryParams.value.pageNum = 1; |
||||
|
getList(); |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
function resetQuery() { |
||||
|
proxy.resetForm("queryRef"); |
||||
|
handleQuery(); |
||||
|
} |
||||
|
|
||||
|
// 多选框选中数据 |
||||
|
function handleSelectionChange(selection) { |
||||
|
ids.value = selection.map(item => item.id); |
||||
|
single.value = selection.length != 1; |
||||
|
multiple.value = !selection.length; |
||||
|
} |
||||
|
|
||||
|
/** 新增按钮操作 */ |
||||
|
function handleAdd() { |
||||
|
reset(); |
||||
|
open.value = true; |
||||
|
title.value = "添加调控方案"; |
||||
|
} |
||||
|
|
||||
|
/** 修改按钮操作 */ |
||||
|
function handleUpdate(row) { |
||||
|
reset(); |
||||
|
const _id = row.id || ids.value |
||||
|
getMethod(_id).then(response => { |
||||
|
form.value = response.data; |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
open.value = true; |
||||
|
title.value = "修改调控方案"; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮 */ |
||||
|
function submitForm() { |
||||
|
proxy.$refs["methodRef"].validate(valid => { |
||||
|
if (valid) { |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
if (form.value.id != null) { |
||||
|
updateMethod(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} else { |
||||
|
addMethod(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("新增成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
function handleDelete(row) { |
||||
|
const _ids = row.id || ids.value; |
||||
|
proxy.$modal.confirm('是否确认删除调控方案编号为"' + _ids + '"的数据项?').then(function () { |
||||
|
return delMethod(_ids); |
||||
|
}).then(() => { |
||||
|
getList(); |
||||
|
proxy.$modal.msgSuccess("删除成功"); |
||||
|
}).catch(() => { }); |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
function handleExport() { |
||||
|
proxy.download('strategy/method/export', { |
||||
|
...queryParams.value |
||||
|
}, `method_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
|
||||
|
getList(); |
||||
|
</script> |
@ -0,0 +1,364 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px"> |
||||
|
<el-form-item label="策略编码" prop="adjustCode"> |
||||
|
<el-input v-model="queryParams.adjustCode" placeholder="请输入策略编码" clearable @keyup.enter="handleQuery" |
||||
|
disabled=false /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="计划日期" prop="planDate"> |
||||
|
<el-date-picker v-model="queryParams.planDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择计划日期"> |
||||
|
</el-date-picker> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="状态" prop="state"> |
||||
|
<el-select v-model="queryParams.state" placeholder="请选择状态" clearable> |
||||
|
<el-option v-for="dict in dc_doc_state" :key="dict.value" :label="dict.label" :value="dict.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
|
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button> |
||||
|
</el-col> |
||||
|
<!-- <el-col :span="1.5"> |
||||
|
<el-button-group> |
||||
|
<el-button type="success" @click="handleAdd">提交</el-button> |
||||
|
<el-button type="success" @click="handleUpdate">审核</el-button> |
||||
|
</el-button-group> |
||||
|
</el-col> --> |
||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
<el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange"> |
||||
|
<el-table-column type="selection" width="55" align="center" /> |
||||
|
<el-table-column label="计划日期" align="center" prop="planDate"> |
||||
|
<template #default="scope"> |
||||
|
<span>{{ scope.row.planDate.slice(0, 10) }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="开始时间" align="center" prop="startTime" width="180"> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="结束时间" align="center" prop="endTime" width="180"> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="热量" align="center" prop="heatQuantity" /> |
||||
|
<el-table-column label="状态" align="center" prop="state"> |
||||
|
<template #default="scope"> |
||||
|
<el-tag :type="getTagType(scope.row.state)"> |
||||
|
<dict-tag :options="dc_doc_state" :value="scope.row.state" /> |
||||
|
</el-tag> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<!-- <el-table-column label="是否有效" align="center" prop="flagEnabled" /> --> |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
|
<template #default="scope"> |
||||
|
<el-button link type="success" v-if="scope.row.state == 'save'" icon="Top" |
||||
|
@click="handleChangeState(scope.row.state, scope.row.id)">提交</el-button> |
||||
|
<el-button link type="success" v-if="scope.row.state == 'submit'" icon="Finished" |
||||
|
@click="handleChangeState(scope.row.state, scope.row.id)">审核</el-button> |
||||
|
<el-button link type="danger" v-if="scope.row.state == 'audit'" icon="Close" |
||||
|
@click="handleChangeState(scope.row.state, scope.row.id)">撤销</el-button> |
||||
|
<el-button type="text" v-if="scope.row.state == 'save'" icon="Edit" |
||||
|
@click="handleUpdate(scope.row)">修改</el-button> |
||||
|
<el-button type="text" v-if="scope.row.state == 'save'" icon="Delete" |
||||
|
@click="handleDelete(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" |
||||
|
@pagination="getList" /> |
||||
|
<!-- 添加或修改调控计划对话框 --> |
||||
|
<el-dialog :title="title" v-model="open" width="700px" append-to-body> |
||||
|
<el-form ref="planRef" :model="form" :rules="rules" label-width="80px"> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="策略编码" prop="adjustCode"> |
||||
|
<el-input v-model="form.adjustCode" disabled=false placeholder="请输入策略编码" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="计划日期" prop="planDate"> |
||||
|
<el-date-picker clearable v-model="form.planDate" type="date" value-format="YYYY-MM-DD" |
||||
|
placeholder="请选择计划日期"> |
||||
|
</el-date-picker> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="开始时间" prop="startTime"> |
||||
|
<el-time-select v-model="form.startTime" :max-time="form.endTime" placeholder="开始时间" start="00:00" |
||||
|
step="01:00" end="23:00" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="结束时间" prop="endTime"> |
||||
|
<el-time-select v-model="form.endTime" :min-time="form.startTime" placeholder="结束时间" start="00:59" |
||||
|
step="01:00" end="23:59" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="热量" prop="heatQuantity"> |
||||
|
<el-input-number v-model="form.heatQuantity" placeholder="请输入热量" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<!-- <el-col :span="12"> |
||||
|
<el-form-item label="是否有效"> |
||||
|
<el-checkbox-group v-model="form.flagEnabled"> |
||||
|
<el-checkbox v-model="form.flagEnabled"></el-checkbox> |
||||
|
</el-checkbox-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
--> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup name="Plan"> |
||||
|
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/model/strategy/plan"; |
||||
|
import { parseTime } from "@/utils/ruoyi" |
||||
|
const { proxy } = getCurrentInstance(); |
||||
|
const { dc_doc_state } = proxy.useDict('dc_doc_state'); |
||||
|
|
||||
|
const planList = ref([]); |
||||
|
const open = ref(false); |
||||
|
const loading = ref(true); |
||||
|
const showSearch = ref(true); |
||||
|
const ids = ref([]); |
||||
|
const single = ref(true); |
||||
|
const multiple = ref(true); |
||||
|
const total = ref(0); |
||||
|
const title = ref(""); |
||||
|
const startTime = ref('') |
||||
|
const endTime = ref('') |
||||
|
const router = useRouter(); |
||||
|
const adjustCode = router.currentRoute.value.query.adjustCode; |
||||
|
let now = parseTime(new Date(), '{y}-{m}-{d}') |
||||
|
const data = reactive({ |
||||
|
form: {}, |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
tentantId: null, |
||||
|
adjustCode: null, |
||||
|
planDate: now, |
||||
|
startTime: null, |
||||
|
endTime: null, |
||||
|
heatQuantity: null, |
||||
|
state: null, |
||||
|
flagEnabled: null, |
||||
|
sort: null |
||||
|
}, |
||||
|
rules: { |
||||
|
planDate: [ |
||||
|
{ required: true, message: "日期不能为空", trigger: "change" } |
||||
|
], |
||||
|
startTime: [ |
||||
|
{ required: true, message: "开始时间不能为空", trigger: "change" } |
||||
|
], |
||||
|
endTime: [ |
||||
|
{ required: true, message: "结束时间不能为空", trigger: "change" } |
||||
|
], |
||||
|
heatQuantity: [ |
||||
|
{ required: true, message: "热量不能为空", trigger: "change" } |
||||
|
] |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const { queryParams, form, rules } = toRefs(data); |
||||
|
|
||||
|
/** 查询调控计划列表 */ |
||||
|
function getList() { |
||||
|
queryParams.value.adjustCode = adjustCode; |
||||
|
loading.value = true; |
||||
|
listPlan(queryParams.value).then(response => { |
||||
|
planList.value = response.rows; |
||||
|
total.value = response.total; |
||||
|
loading.value = false; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 取Tag样式 */ |
||||
|
function getTagType(state) { |
||||
|
let type = '' |
||||
|
switch (state) { |
||||
|
case 'save': |
||||
|
type = '' |
||||
|
break; |
||||
|
case 'submit': |
||||
|
type = 'warning' |
||||
|
break; |
||||
|
case 'audit': |
||||
|
type = 'success' |
||||
|
break; |
||||
|
default: |
||||
|
type = '' |
||||
|
break; |
||||
|
} |
||||
|
return type |
||||
|
} |
||||
|
|
||||
|
// 取消按钮 |
||||
|
function cancel() { |
||||
|
open.value = false; |
||||
|
reset(); |
||||
|
} |
||||
|
|
||||
|
// 表单重置 |
||||
|
function reset() { |
||||
|
form.value = { |
||||
|
tentantId: null, |
||||
|
version: null, |
||||
|
createBy: null, |
||||
|
createTime: null, |
||||
|
updateBy: null, |
||||
|
updateTime: null, |
||||
|
deptId: null, |
||||
|
userId: null, |
||||
|
deleteBy: null, |
||||
|
deleteTime: null, |
||||
|
id: null, |
||||
|
adjustCode: null, |
||||
|
planDate: null, |
||||
|
startTime: null, |
||||
|
endTime: null, |
||||
|
heatQuantity: null, |
||||
|
state: null, |
||||
|
flagEnabled: null, |
||||
|
sort: null |
||||
|
}; |
||||
|
proxy.resetForm("planRef"); |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
function handleQuery() { |
||||
|
console.log(startTime.value) |
||||
|
queryParams.value.pageNum = 1; |
||||
|
getList(); |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
function resetQuery() { |
||||
|
proxy.resetForm("queryRef"); |
||||
|
handleQuery(); |
||||
|
} |
||||
|
|
||||
|
// 多选框选中数据 |
||||
|
function handleSelectionChange(selection) { |
||||
|
ids.value = selection.map(item => item.id); |
||||
|
single.value = selection.length != 1; |
||||
|
multiple.value = !selection.length; |
||||
|
} |
||||
|
|
||||
|
/** 新增按钮操作 */ |
||||
|
function handleAdd() { |
||||
|
reset(); |
||||
|
open.value = true; |
||||
|
form.value.adjustCode = adjustCode; |
||||
|
title.value = "添加调控计划"; |
||||
|
} |
||||
|
|
||||
|
/** 修改按钮操作 */ |
||||
|
function handleUpdate(row) { |
||||
|
reset(); |
||||
|
const _id = row.id || ids.value |
||||
|
getPlan(_id).then(response => { |
||||
|
form.value = response.data; |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
open.value = true; |
||||
|
title.value = "修改调控计划"; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮 */ |
||||
|
function submitForm() { |
||||
|
proxy.$refs["planRef"].validate(valid => { |
||||
|
if (valid) { |
||||
|
form.value.flagEnabled = form.value.flagEnabled; |
||||
|
form.value.planDate = form.value.planDate + ' 00:00:00' |
||||
|
form.value.state = 'save' |
||||
|
if (form.value.id != null) { |
||||
|
updatePlan(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} else { |
||||
|
addPlan(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("新增成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
function handleDelete(row) { |
||||
|
const _ids = row.id || ids.value; |
||||
|
proxy.$modal.confirm('是否确认删除调控计划编号为"' + _ids + '"的数据项?').then(function () { |
||||
|
return delPlan(_ids); |
||||
|
}).then(() => { |
||||
|
getList(); |
||||
|
proxy.$modal.msgSuccess("删除成功"); |
||||
|
}).catch(() => { }); |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
function handleExport() { |
||||
|
proxy.download('strategy/plan/export', { |
||||
|
...queryParams.value |
||||
|
}, `plan_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
|
||||
|
/** 修改状态 */ |
||||
|
function handleChangeState(state, id) { |
||||
|
console.log(`state:${state},id:${id}`) |
||||
|
switch (state) { |
||||
|
case 'save': |
||||
|
form.value.state = 'submit' |
||||
|
break; |
||||
|
case 'submit': |
||||
|
form.value.state = 'audit' |
||||
|
break; |
||||
|
case 'audit': |
||||
|
form.value.state = 'save' |
||||
|
break; |
||||
|
default: |
||||
|
form.value.state = 'save' |
||||
|
break; |
||||
|
} |
||||
|
form.value.id = id |
||||
|
updatePlan(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
watch( |
||||
|
[data], |
||||
|
() => { |
||||
|
if( queryParams.value.planDate === null){ |
||||
|
queryParams.value.planDate = now |
||||
|
} |
||||
|
} |
||||
|
); |
||||
|
getList(); |
||||
|
</script> |
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,172 @@ |
|||||
|
<template> |
||||
|
<div class="bg"> |
||||
|
|
||||
|
webscoket |
||||
|
<br> |
||||
|
万盈大厦-一供温<input v-model="data.P0001" /> |
||||
|
万盈大厦-一供回<input v-model="data.P0002" /> |
||||
|
万盈大厦-二供回<input v-model="data.P0003" /> |
||||
|
<br> |
||||
|
民丰大厦-一供温<input v-model="data.P0004" /> |
||||
|
民丰大厦-一供回<input v-model="data.P0005" /> |
||||
|
民丰大厦-二供回<input v-model="data.P0006" /> |
||||
|
<button @click="meshPush()">提交</button> |
||||
|
<el-button type="primary" :icon="Close"></el-button> |
||||
|
<br> |
||||
|
回调值:<input style="width: 250px;" :value="showMsg" /> |
||||
|
<br> |
||||
|
<br> |
||||
|
<br> |
||||
|
<h3>======================== 动态生成组件 ============================</h3> |
||||
|
<br> |
||||
|
<br> |
||||
|
<br> |
||||
|
<MonitorView :data="data" :mesh="mesh" @callfun="callfun"></MonitorView> |
||||
|
|
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup name = "Vi"> |
||||
|
import { ref, defineComponent } from 'vue'; |
||||
|
import { getMesh } from './h'; |
||||
|
|
||||
|
const showMsg = ref('') |
||||
|
let data = ref({ P0001: '', P0002: '', P0003: '', P0004: '', P0005: '', P0006: '', P0007: 12 }) |
||||
|
let mesh = ref(false) |
||||
|
const callfun = (obj) => { |
||||
|
showMsg.value = '参数编码:' + obj.code + '参数值:' + obj.value; |
||||
|
} |
||||
|
|
||||
|
onMounted(() => { |
||||
|
let meshObj = getMesh() |
||||
|
mesh.value = meshObj.struct |
||||
|
data.value = meshObj.params |
||||
|
// setTimeout(() => { |
||||
|
|
||||
|
// }, 3000); |
||||
|
}) |
||||
|
|
||||
|
const MonitorView = defineComponent({ |
||||
|
props: { |
||||
|
data: { |
||||
|
type: String, |
||||
|
required: true |
||||
|
}, |
||||
|
mesh: { |
||||
|
type: Object, |
||||
|
required: true |
||||
|
} |
||||
|
}, |
||||
|
emits: ['callfun'], // 子组件发送自定义事件 |
||||
|
setup(props, { emit }) { |
||||
|
return () => { |
||||
|
return props.mesh != false ? h(props.mesh.type, { id: props.mesh.key, style: props.mesh.type, class: props.mesh.class }, [ |
||||
|
// 第二层 tr |
||||
|
props.mesh.items.map(tr => { |
||||
|
return h(tr.type, { style: tr.style, key: tr.rowIndex }, [ |
||||
|
// 第三层 td |
||||
|
tr.items.map(td => { |
||||
|
return td.delTag === false ? |
||||
|
td.valueType == 0 ? h(td.type, { key: td.key, style: td.style, rowspan: td.rowspan, colspan: td.colspan }, [td.value]) : |
||||
|
td.valueType == 1 ? h(td.type, { key: td.key, style: td.style, rowspan: td.rowspan, colspan: td.colspan }, [props.data[td.code]]) : |
||||
|
td.valueType == 2 ? h(td.type, { key: td.key, style: td.style, rowspan: td.rowspan, colspan: td.colspan }, [ |
||||
|
// 第四层 |
||||
|
td.items.map(content => { |
||||
|
return content.valueType == 1 ? h(content.type, { style: content.style }, props.data[content.code]) : |
||||
|
content.valueType == 3 ? h(content.type, { style: content.style, class: content.class, onClick: () => emit(content.fun, { code: content.param.value, value: props.data[content.param.value] }) }, content.value) : null |
||||
|
}) |
||||
|
]) : |
||||
|
td.valueType == 4 ? h(td.type, { key: td.key, style: td.style, rowspan: td.rowspan, colspan: td.colspan }, [ |
||||
|
// 第四层 图标 |
||||
|
td.items.map(content => { |
||||
|
return content.valueType == 0 ? h(content.type, { style: content.style }, [content.value]) : |
||||
|
content.valueType == 5 ? h(content.type, { style: content.style, class: content.class }) : null |
||||
|
}) |
||||
|
]) : h(td.type, { key: td.key, style: td.style }, ["???"]) |
||||
|
: null |
||||
|
}) |
||||
|
]) |
||||
|
}) |
||||
|
]) : null //h('span', '正在加载!') |
||||
|
} |
||||
|
|
||||
|
// return () => { |
||||
|
// return h('table',{class:"tw"},[ |
||||
|
// h('tr',[ |
||||
|
// h('th',{style:'width: 80px'},'#'), |
||||
|
// h('th',{style:'width: 60px'},'一供温'), |
||||
|
// h('th',{style:'width: 60px'},'一回温'), |
||||
|
// h('th',{style:'width: 60px'},'二供温') |
||||
|
// ]), |
||||
|
// h('tr',{style:'height:120px'},[ |
||||
|
// h('td', {style:"border: 1px solid black;"},'万盈大厦'), |
||||
|
// h('td', {style:"border: 1px solid black;"},props.data['P00001']), |
||||
|
// h('td', {style:"border: 1px solid black;"},props.data['P00002']), |
||||
|
// h('td', {style:"border: 1px solid black;"},props.data['P00003']) |
||||
|
// ]), |
||||
|
// h('tr',[ |
||||
|
// h('td','民丰大厦'), |
||||
|
// h('td',props.data['P00004']), |
||||
|
// h('td',[ |
||||
|
// h('div',props.data['P00005']), |
||||
|
// h('el-button',{onClick: () => emit('callfun', {code:'P00005',value:props.data['P00005']} )},'设置') |
||||
|
// ]), |
||||
|
// h('td',{style:"border: 1px solid black; border-collapse: collapse;"},props.data['P00006']) |
||||
|
// ]) |
||||
|
// ] |
||||
|
// )} |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style lang='scss' scoped> |
||||
|
.bg { |
||||
|
margin: 1rem; |
||||
|
} |
||||
|
|
||||
|
.tw { |
||||
|
border-collapse: collapse; |
||||
|
border: 2px solid rgb(49, 47, 47); |
||||
|
|
||||
|
:deep(td) { |
||||
|
border-collapse: collapse; |
||||
|
border: 1px solid rgb(29, 28, 28); |
||||
|
padding: 5px; |
||||
|
} |
||||
|
|
||||
|
:deep(th) { |
||||
|
border-collapse: collapse; |
||||
|
border: 1px solid rgb(29, 28, 28); |
||||
|
background-color: cornflowerblue; |
||||
|
padding: 5px; |
||||
|
} |
||||
|
|
||||
|
:deep(.btn) { |
||||
|
float: left; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
margin-left: 5px; |
||||
|
margin-bottom: 3px; |
||||
|
background-image: url("../../../assets/icons/png/edit.png"); |
||||
|
background-size: 20px; |
||||
|
} |
||||
|
|
||||
|
:deep(.img) { |
||||
|
float: left; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
margin-top: 2px; |
||||
|
|
||||
|
background-size: 20px; |
||||
|
} |
||||
|
|
||||
|
:deep(.red) { |
||||
|
background-image: url("../../../assets/icons/svg/wifi-red.svg"); |
||||
|
} |
||||
|
|
||||
|
:deep(.green) { |
||||
|
background-image: url("../../../assets/icons/svg/wifi-green.svg"); |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
|
|
Loading…
Reference in new issue