|
@ -3,10 +3,10 @@ |
|
|
<div class="submitBtn"> |
|
|
<div class="submitBtn"> |
|
|
<el-button |
|
|
<el-button |
|
|
type="primary" |
|
|
type="primary" |
|
|
:icon="Check" |
|
|
:icon="submitIcon" |
|
|
@click="paramSubmit(paramsFormRef)" |
|
|
@click="paramSubmit(paramsFormRef)" |
|
|
> |
|
|
> |
|
|
提交 |
|
|
{{ paramsText }} |
|
|
</el-button> |
|
|
</el-button> |
|
|
</div> |
|
|
</div> |
|
|
<el-collapse class="paramsCollapse" v-model="activeNames"> |
|
|
<el-collapse class="paramsCollapse" v-model="activeNames"> |
|
@ -16,11 +16,11 @@ |
|
|
class="paramsForm" |
|
|
class="paramsForm" |
|
|
:rules="paramsRules" |
|
|
:rules="paramsRules" |
|
|
:inline="true" |
|
|
:inline="true" |
|
|
:model="paramsForm" |
|
|
:model="formData.paramsForm" |
|
|
> |
|
|
> |
|
|
<el-form-item label="组织" prop="orgName"> |
|
|
<el-form-item label="组织" prop="orgName"> |
|
|
<el-tree-select |
|
|
<el-tree-select |
|
|
v-model="paramsForm.orgName" |
|
|
v-model="formData.paramsForm.orgName" |
|
|
:data="deptOptions" |
|
|
:data="deptOptions" |
|
|
:props="{ |
|
|
:props="{ |
|
|
value: 'label', |
|
|
value: 'label', |
|
@ -34,16 +34,16 @@ |
|
|
@node-click="selectDept" |
|
|
@node-click="selectDept" |
|
|
/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="编码"> |
|
|
<el-form-item label="编码" prop="assetCode"> |
|
|
<el-input |
|
|
<el-input |
|
|
v-model="paramsForm.assetCode" |
|
|
v-model="formData.paramsForm.assetCode" |
|
|
placeholder="编码" |
|
|
placeholder="编码" |
|
|
clearable |
|
|
clearable |
|
|
/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="是否可用" prop="flagEnabled"> |
|
|
<el-form-item label="是否可用" prop="flagEnabled"> |
|
|
<el-select |
|
|
<el-select |
|
|
v-model="paramsForm.flagEnabled" |
|
|
v-model="formData.paramsForm.flagEnabled" |
|
|
placeholder="请选择是否可用" |
|
|
placeholder="请选择是否可用" |
|
|
> |
|
|
> |
|
|
<el-option |
|
|
<el-option |
|
@ -56,14 +56,14 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="名称" prop="assetName"> |
|
|
<el-form-item label="名称" prop="assetName"> |
|
|
<el-input |
|
|
<el-input |
|
|
v-model="paramsForm.assetName" |
|
|
v-model="formData.paramsForm.assetName" |
|
|
placeholder="名称" |
|
|
placeholder="名称" |
|
|
clearable |
|
|
clearable |
|
|
/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="类别" prop="assetType"> |
|
|
<el-form-item label="类别" prop="assetType"> |
|
|
<el-select |
|
|
<el-select |
|
|
v-model="paramsForm.assetType" |
|
|
v-model="formData.paramsForm.assetType" |
|
|
placeholder="请选择类别" |
|
|
placeholder="请选择类别" |
|
|
clearable |
|
|
clearable |
|
|
> |
|
|
> |
|
@ -75,6 +75,7 @@ |
|
|
/> |
|
|
/> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
<div> |
|
|
<el-form-item label="组成设备"> |
|
|
<el-form-item label="组成设备"> |
|
|
<el-select |
|
|
<el-select |
|
|
v-model="paramsDevice" |
|
|
v-model="paramsDevice" |
|
@ -82,6 +83,9 @@ |
|
|
filterable |
|
|
filterable |
|
|
allow-create |
|
|
allow-create |
|
|
default-first-option |
|
|
default-first-option |
|
|
|
|
|
collapse-tags |
|
|
|
|
|
collapse-tags-tooltip |
|
|
|
|
|
:max-collapse-tags="3" |
|
|
:reserve-keyword="false" |
|
|
:reserve-keyword="false" |
|
|
placeholder="组成设备" |
|
|
placeholder="组成设备" |
|
|
style="width: 240px" |
|
|
style="width: 240px" |
|
@ -95,11 +99,24 @@ |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button type="success" @click="selectParams">选择参数</el-button> |
|
|
<el-button type="success" @click="selectParams" |
|
|
|
|
|
>选择参数</el-button |
|
|
|
|
|
> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
</div> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</el-collapse-item> |
|
|
</el-collapse-item> |
|
|
<el-collapse-item title="参数列表" name="2"> |
|
|
<el-collapse-item title="参数列表" name="2"> |
|
|
|
|
|
<vxe-toolbar> |
|
|
|
|
|
<template #buttons> |
|
|
|
|
|
<vxe-button |
|
|
|
|
|
status="danger" |
|
|
|
|
|
content="删除" |
|
|
|
|
|
icon="vxe-icon-delete" |
|
|
|
|
|
@click="removeEvent()" |
|
|
|
|
|
></vxe-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
</vxe-toolbar> |
|
|
<vxe-table |
|
|
<vxe-table |
|
|
class="tableCollapse" |
|
|
class="tableCollapse" |
|
|
border |
|
|
border |
|
@ -115,8 +132,8 @@ |
|
|
field="paramName" |
|
|
field="paramName" |
|
|
title="参数名称" |
|
|
title="参数名称" |
|
|
:filters="addressOptions" |
|
|
:filters="addressOptions" |
|
|
:filter-method="filterAddressMethod" |
|
|
:filter-method="filterParamName" |
|
|
:filter-recover-method="filterAddressRecoverMethod" |
|
|
:filter-recover-method="filterParamNameRecover" |
|
|
> |
|
|
> |
|
|
<template #filter="{ $panel, column }"> |
|
|
<template #filter="{ $panel, column }"> |
|
|
<vxe-input |
|
|
<vxe-input |
|
@ -141,6 +158,15 @@ |
|
|
<vxe-checkbox v-model="row.contrlFlag"></vxe-checkbox> |
|
|
<vxe-checkbox v-model="row.contrlFlag"></vxe-checkbox> |
|
|
</template> |
|
|
</template> |
|
|
</vxe-column> |
|
|
</vxe-column> |
|
|
|
|
|
<vxe-column title="操作" width="100" show-overflow> |
|
|
|
|
|
<template #default="{ row }"> |
|
|
|
|
|
<vxe-button |
|
|
|
|
|
type="text" |
|
|
|
|
|
icon="vxe-icon-delete" |
|
|
|
|
|
@click="removeEvent(row)" |
|
|
|
|
|
></vxe-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
</vxe-column> |
|
|
</vxe-table> |
|
|
</vxe-table> |
|
|
</el-collapse-item> |
|
|
</el-collapse-item> |
|
|
</el-collapse> |
|
|
</el-collapse> |
|
@ -167,8 +193,8 @@ |
|
|
field="paramModelName" |
|
|
field="paramModelName" |
|
|
title="参数模版名称" |
|
|
title="参数模版名称" |
|
|
:filters="ageOptions" |
|
|
:filters="ageOptions" |
|
|
:filter-method="filterAgeMethod" |
|
|
:filter-method="filterParamModel" |
|
|
:filter-recover-method="filterAgeRecoverMethod" |
|
|
:filter-recover-method="filterParamModelRecover" |
|
|
> |
|
|
> |
|
|
<template #filter="{ $panel, column }"> |
|
|
<template #filter="{ $panel, column }"> |
|
|
<vxe-input |
|
|
<vxe-input |
|
@ -187,8 +213,8 @@ |
|
|
field="paramName" |
|
|
field="paramName" |
|
|
title="参数名称" |
|
|
title="参数名称" |
|
|
:filters="addressOptions" |
|
|
:filters="addressOptions" |
|
|
:filter-method="filterAddressMethod" |
|
|
:filter-method="filterParamNameSel" |
|
|
:filter-recover-method="filterAddressRecoverMethod" |
|
|
:filter-recover-method="filterParamNameRecoverSel" |
|
|
> |
|
|
> |
|
|
<template #filter="{ $panel, column }"> |
|
|
<template #filter="{ $panel, column }"> |
|
|
<vxe-input |
|
|
<vxe-input |
|
@ -221,9 +247,13 @@ |
|
|
</template> |
|
|
</template> |
|
|
<script setup> |
|
|
<script setup> |
|
|
import { ref, reactive, onMounted } from "vue"; |
|
|
import { ref, reactive, onMounted } from "vue"; |
|
|
import { useRoute } from "vue-router"; |
|
|
import { ElMessage } from "element-plus"; |
|
|
import { deptTreeSelect } from "@/api/system/user"; |
|
|
import { deptTreeSelect } from "@/api/system/user"; |
|
|
import { listByDeviceUuids } from "@/api/model/asset/params"; |
|
|
import { |
|
|
|
|
|
listByDeviceUuids, |
|
|
|
|
|
listParams, |
|
|
|
|
|
delParams, |
|
|
|
|
|
} from "@/api/model/asset/params"; |
|
|
import { listDeviceNoPage } from "@/api/model/device"; |
|
|
import { listDeviceNoPage } from "@/api/model/device"; |
|
|
import { |
|
|
import { |
|
|
listInfo, |
|
|
listInfo, |
|
@ -239,7 +269,11 @@ const { dc_asset_attr } = proxy.useDict("dc_asset_attr"); |
|
|
|
|
|
|
|
|
const activeNames = ref(["1", "2"]); |
|
|
const activeNames = ref(["1", "2"]); |
|
|
const route = useRoute(); |
|
|
const route = useRoute(); |
|
|
|
|
|
const router = useRouter(); |
|
|
const id = route.query.id; |
|
|
const id = route.query.id; |
|
|
|
|
|
const ids = ref(); |
|
|
|
|
|
const submitIcon = ref("Plus"); |
|
|
|
|
|
const paramsText = ref("新增"); |
|
|
const paramsFormRef = ref(); |
|
|
const paramsFormRef = ref(); |
|
|
const dialogTableVisible = ref(false); |
|
|
const dialogTableVisible = ref(false); |
|
|
const deptOptions = ref([]); |
|
|
const deptOptions = ref([]); |
|
@ -252,7 +286,8 @@ const enabledFlag = ref([ |
|
|
{ label: "可用", value: 1, elTagType: "default", elTagClass: null }, |
|
|
{ label: "可用", value: 1, elTagType: "default", elTagClass: null }, |
|
|
{ label: "不可用", value: 0, elTagType: "default", elTagClass: null }, |
|
|
{ label: "不可用", value: 0, elTagType: "default", elTagClass: null }, |
|
|
]); |
|
|
]); |
|
|
const paramsForm = reactive({ |
|
|
const formData = reactive({ |
|
|
|
|
|
paramsForm: { |
|
|
assetCode: "", |
|
|
assetCode: "", |
|
|
flagEnabled: null, |
|
|
flagEnabled: null, |
|
|
assetName: "", |
|
|
assetName: "", |
|
@ -266,41 +301,80 @@ const paramsForm = reactive({ |
|
|
contrlFlag: false, |
|
|
contrlFlag: false, |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
const paramsTableRef = ref(); |
|
|
const paramsTableRef = ref(); |
|
|
const addTableRef = ref(); |
|
|
const addTableRef = ref(); |
|
|
const loading = ref(false); |
|
|
const loading = ref(false); |
|
|
const sexOptions = ref([ |
|
|
const sexOptions = ref([ |
|
|
{ label: "高区", value: "高区" }, |
|
|
{ label: "A", value: "A" }, |
|
|
{ label: "中区", value: "中区" }, |
|
|
{ label: "B", value: "B" }, |
|
|
{ label: "低区", value: "低区" }, |
|
|
{ label: "C", value: "C" }, |
|
|
|
|
|
{ label: "D", value: "D" }, |
|
|
]); |
|
|
]); |
|
|
const ageOptions = ref([{ data: "" }]); |
|
|
const ageOptions = ref([{ data: "" }]); |
|
|
const addressOptions = ref([{ data: "" }]); |
|
|
const addressOptions = ref([{ data: "" }]); |
|
|
const paramsRules = reactive({ |
|
|
const paramsRules = reactive({ |
|
|
|
|
|
orgName: [{ required: true, message: "请选择组织", trigger: "change" }], |
|
|
|
|
|
assetCode: [{ required: true, message: "请输入编码", trigger: "blur" }], |
|
|
|
|
|
flagEnabled: [ |
|
|
|
|
|
{ required: true, message: "请选择是否可用", trigger: "change" }, |
|
|
|
|
|
], |
|
|
assetName: [{ required: true, message: "请输入资产名称", trigger: "blur" }], |
|
|
assetName: [{ required: true, message: "请输入资产名称", trigger: "blur" }], |
|
|
|
|
|
assetType: [{ required: true, message: "请选择类别", trigger: "change" }], |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const filterAgeMethod = ({ option, row }) => { |
|
|
const filterParamModel = ({ option, row }) => { |
|
|
return row.age === Number(option.data); |
|
|
//参数模板名称搜索 |
|
|
|
|
|
return row.paramModelName === option.data; |
|
|
|
|
|
}; |
|
|
|
|
|
const filterParamModelRecover = ({ option }) => { |
|
|
|
|
|
// 参数模板名称如果是自定义筛选模板,当为点击确认时,该选项将被恢复为默认值 |
|
|
|
|
|
option.data = ""; |
|
|
|
|
|
}; |
|
|
|
|
|
const filterParamName = ({ option, row }) => { |
|
|
|
|
|
//参数名称搜索 |
|
|
|
|
|
return row.paramName === option.data; |
|
|
}; |
|
|
}; |
|
|
const filterAgeRecoverMethod = ({ option }) => { |
|
|
const filterParamNameRecover = ({ option }) => { |
|
|
// 如果是自定义筛选模板,当为点击确认时,该选项将被恢复为默认值 |
|
|
// 参数名称如果是自定义筛选模板,当为点击确认时,该选项将被恢复为默认值 |
|
|
option.data = ""; |
|
|
option.data = ""; |
|
|
}; |
|
|
}; |
|
|
const filterAddressMethod = ({ option, row }) => { |
|
|
const filterParamNameSel = ({ option, row }) => { |
|
|
return row.address === option.data; |
|
|
//选择参数名称搜索 |
|
|
|
|
|
return row.paramName === option.data; |
|
|
}; |
|
|
}; |
|
|
const filterAddressRecoverMethod = ({ option }) => { |
|
|
const filterParamNameRecoverSel = ({ option }) => { |
|
|
// 如果是自定义筛选模板,当为点击确认时,该选项将被恢复为默认值 |
|
|
// 参数名称如果是自定义筛选模板,当为点击确认时,该选项将被恢复为默认值 |
|
|
option.data = ""; |
|
|
option.data = ""; |
|
|
}; |
|
|
}; |
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
const dsfsdf = route.query.id; |
|
|
if (route.query.id != undefined) { |
|
|
debugger; |
|
|
getBasicInfo(); |
|
|
|
|
|
getParamsList(); |
|
|
|
|
|
} |
|
|
getDeptTree(); |
|
|
getDeptTree(); |
|
|
getDevice(); |
|
|
getDevice(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
function getBasicInfo() { |
|
|
|
|
|
getInfo(route.query.id).then((response) => { |
|
|
|
|
|
formData.paramsForm = response.data; |
|
|
|
|
|
submitIcon.value = "Check"; |
|
|
|
|
|
paramsText.value = "修改"; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
function getParamsList() { |
|
|
|
|
|
//获取参数列表 |
|
|
|
|
|
const params = { |
|
|
|
|
|
assetCode: route.query.assetCode, |
|
|
|
|
|
}; |
|
|
|
|
|
listParams(params).then((res) => { |
|
|
|
|
|
if (res.code === 200) { |
|
|
|
|
|
paramsList.value = res.rows; |
|
|
|
|
|
paramsCode.value = paramsList.value.map((item) => item.paramCode); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
function getDeptTree() { |
|
|
function getDeptTree() { |
|
|
//获取部门树 |
|
|
//获取部门树 |
|
|
deptTreeSelect().then((response) => { |
|
|
deptTreeSelect().then((response) => { |
|
@ -319,7 +393,7 @@ function selectParams() { |
|
|
if (paramsDevice.value.length != 0) { |
|
|
if (paramsDevice.value.length != 0) { |
|
|
const params = { |
|
|
const params = { |
|
|
deviceUuids: paramsDevice.value, |
|
|
deviceUuids: paramsDevice.value, |
|
|
excludeParamCodes: [], |
|
|
excludeParamCodes: paramsCode.value, |
|
|
}; |
|
|
}; |
|
|
listByDeviceUuids(params).then((res) => { |
|
|
listByDeviceUuids(params).then((res) => { |
|
|
if (res.code === 200) { |
|
|
if (res.code === 200) { |
|
@ -327,29 +401,73 @@ function selectParams() { |
|
|
dialogTableVisible.value = true; |
|
|
dialogTableVisible.value = true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
message: "请先选择组成设备!", |
|
|
|
|
|
type: "warning", |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
function selectDept(val) { |
|
|
function selectDept(val) { |
|
|
//部门参数选择 |
|
|
//部门参数选择 |
|
|
paramsForm.orgCode = val.id; |
|
|
formData.paramsForm.orgCode = val.id; |
|
|
} |
|
|
} |
|
|
function addConfirm() { |
|
|
function addConfirm() { |
|
|
//选择参数确认 |
|
|
//选择参数确认 |
|
|
const $addTable = addTableRef.value; |
|
|
const $addTable = addTableRef.value; |
|
|
if ($addTable) { |
|
|
if ($addTable) { |
|
|
const selectRecords = $addTable.getCheckboxRecords(); |
|
|
const selectRecords = $addTable.getCheckboxRecords(); |
|
|
paramsList.value = selectRecords.map((item) => { |
|
|
selectRecords.map((item) => { |
|
|
return { |
|
|
paramsList.value.push({ |
|
|
...item, |
|
|
...item, |
|
|
flagEnabled: false, |
|
|
flagEnabled: false, |
|
|
contrlFlag: false, |
|
|
contrlFlag: false, |
|
|
}; |
|
|
|
|
|
}); |
|
|
}); |
|
|
paramsCode.value = selectRecords.map((item) => item.paramCode); |
|
|
}); |
|
|
|
|
|
paramsCode.value = paramsList.value.map((item) => item.paramCode); |
|
|
|
|
|
console.log(paramsList.value, paramsCode.value); |
|
|
dialogTableVisible.value = false; |
|
|
dialogTableVisible.value = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const removeEvent = async (row) => { |
|
|
|
|
|
//删除 |
|
|
|
|
|
if (row) { |
|
|
|
|
|
ids.value = row.id; |
|
|
|
|
|
} else { |
|
|
|
|
|
const $submitTable = paramsTableRef.value; |
|
|
|
|
|
ids.value = $submitTable.getCheckboxRecords().map((item) => item.id); |
|
|
|
|
|
if (ids.value.length === 0) { |
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
message: "请选择删除数据!", |
|
|
|
|
|
type: "warning", |
|
|
|
|
|
}); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (route.query.id != undefined) { |
|
|
|
|
|
proxy.$modal |
|
|
|
|
|
.confirm("是否确认删除数据项?") |
|
|
|
|
|
.then(function () { |
|
|
|
|
|
return delParams(ids.value); |
|
|
|
|
|
}) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
getParamsList(); |
|
|
|
|
|
proxy.$modal.msgSuccess("删除成功"); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => {}); |
|
|
|
|
|
} else { |
|
|
|
|
|
const $submitTable = paramsTableRef.value; |
|
|
|
|
|
const selectParamsList = $submitTable.getCheckboxRecords(); |
|
|
|
|
|
if ($submitTable) { |
|
|
|
|
|
$submitTable.remove(row || selectParamsList); |
|
|
|
|
|
paramsList.value = $submitTable.getTableData().tableData; |
|
|
|
|
|
paramsCode.value = paramsList.value.map((item) => item.paramCode); |
|
|
|
|
|
console.log(paramsList.value); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const paramSubmit = async (formEl) => { |
|
|
const paramSubmit = async (formEl) => { |
|
|
//提交 |
|
|
//提交 |
|
|
if (!formEl) return; |
|
|
if (!formEl) return; |
|
@ -363,21 +481,22 @@ const paramSubmit = async (formEl) => { |
|
|
flagEnabled: item.flagEnabled, |
|
|
flagEnabled: item.flagEnabled, |
|
|
contrlFlag: item.contrlFlag, |
|
|
contrlFlag: item.contrlFlag, |
|
|
})); |
|
|
})); |
|
|
paramsForm.assetParamsDtos = selectParamsListArr; |
|
|
formData.paramsForm.assetParamsDtos = selectParamsListArr; |
|
|
if (id.value != undefined) { |
|
|
if (route.query.id != undefined) { |
|
|
updateInfo(paramsForm).then((response) => { |
|
|
updateInfo(formData.paramsForm).then((response) => { |
|
|
proxy.$modal.msgSuccess("修改成功"); |
|
|
proxy.$modal.msgSuccess("修改成功"); |
|
|
open.value = false; |
|
|
open.value = false; |
|
|
getList(); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
addInfo(paramsForm).then((response) => { |
|
|
addInfo(formData.paramsForm).then((response) => { |
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
open.value = false; |
|
|
open.value = false; |
|
|
getList(); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
console.log(paramsForm); |
|
|
router.push({ |
|
|
|
|
|
path: "AssetInfo", |
|
|
|
|
|
}); |
|
|
|
|
|
console.log(formData.paramsForm); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
console.log("error submit!", fields); |
|
|
console.log("error submit!", fields); |
|
|