Browse Source

部门字段添加并供暖办功能机构数对应修改

develop
ljlong_2630 12 months ago
parent
commit
919807e372
  1. 78
      src/views/model/heatapiconf/heatSendContent.vue
  2. 79
      src/views/model/heatapiconf/index.vue
  3. 45
      src/views/system/dept/index.vue

78
src/views/model/heatapiconf/heatSendContent.vue

@ -38,10 +38,10 @@
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> <el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="loading" :data="currentPageData" class="table-container"> <el-table v-loading="loading" :data="currentPageData" class="table-container" :expand-row-keys="expandRowKeys" @expand-change="handleExpandChange" row-key="deviceId">
<el-table-column type="expand"> <el-table-column type="expand">
<template #default="props" class="blueTheButton"> <template #default="props" class="blueTheButton">
<el-table :data="props.row.params" :border="childBorder" style="margin-left:40px;margin-top:20px"> <el-table :data="props.row.params" :border="childBorder" style="margin-left:40px;margin-top:20px" row-key="paramCode">
<el-table-column label="参数名称" prop="paramName" /> <el-table-column label="参数名称" prop="paramName" />
<el-table-column label="参数编号" prop="paramCode" /> <el-table-column label="参数编号" prop="paramCode" />
<el-table-column label="分区" prop="partion" /> <el-table-column label="分区" prop="partion" />
@ -85,6 +85,7 @@ const loading = ref(false);
const showSearch = ref(true); const showSearch = ref(true);
const currentPage = ref(1); const currentPage = ref(1);
const pageSize = ref(10); const pageSize = ref(10);
const expandRowKeys = ref([]);
const queryParams = reactive({ const queryParams = reactive({
deviceUuid: null, deviceUuid: null,
deviceName: null, deviceName: null,
@ -93,29 +94,70 @@ const queryParams = reactive({
}); });
const router = useRouter() const router = useRouter()
function solveData() { function solveData() {
const heatapiContentListData = (router.currentRoute._value.query.heatapiContentListData !== undefined && router.currentRoute._value.query.heatapiContentListData !== null)?router.currentRoute._value.query.heatapiContentListData : null; const heatapiContentListData =
oldData.value = heatapiContentListData; router.currentRoute._value.query.heatapiContentListData !== undefined &&
router.currentRoute._value.query.heatapiContentListData !== null
? router.currentRoute._value.query.heatapiContentListData
: null;
if (heatapiContentListData != null) { if (heatapiContentListData != null) {
oldData.value = heatapiContentListData;
heatapiContentList.value = JSON.parse(heatapiContentListData); heatapiContentList.value = JSON.parse(heatapiContentListData);
console.log(heatapiContentList.value); console.log(heatapiContentList.value);
} }
} }
onMounted(() => {
solveData();
});
function handleQuery() { function handleQuery() {
// heatapiContentList // heatapiContentList
heatapiContentList.value = JSON.parse(oldData.value).filter(item => { const filteredHeatapiContentList = JSON.parse(oldData.value).filter((item) => {
// 使 // 使
//
let flag = (!queryParams.deviceUuid || item.deviceId?.includes(queryParams.deviceUuid)) &&
(!queryParams.deviceName || item.name?.toLowerCase().includes(queryParams.deviceName.toLowerCase()));
if(!flag){
return false;
}
// //
const matchedParams = item.params.filter((param) => {
return ( return (
(!queryParams.deviceUuid || (item.deviceId && item.deviceId.indexOf(queryParams.deviceUuid) !== -1)) && (!queryParams.paramCode || param.paramCode?.includes(queryParams.paramCode)) &&
(!queryParams.deviceName || (item.name && item.name.indexOf(queryParams.deviceName) !== -1)) && (!queryParams.paramName || param.paramName?.includes(queryParams.paramName))
(!queryParams.paramCode || item.params.some(param => param.paramCode && param.paramCode.indexOf(queryParams.paramCode) !== -1)) &&
(!queryParams.paramName || item.params.some(param => param.paramName && param.paramName.indexOf(queryParams.paramName) !== -1))
); );
}); });
//
item.params = matchedParams;
//
const hasMatchedParams = matchedParams.length > 0;
//
flag = flag && (queryParams.paramCode || queryParams.paramName) ? hasMatchedParams : flag;
return flag;
});
//
heatapiContentList.value = filteredHeatapiContentList;
//
//
if (queryParams.paramCode || queryParams.paramName) {
expandAllRows();
} else {
collapseAllRows();
}
//
currentPage.value = 1;
} }
@ -127,6 +169,7 @@ function resetQuery() {
queryParams.paramName = null, queryParams.paramName = null,
// //
heatapiContentList.value = JSON.parse(oldData.value); heatapiContentList.value = JSON.parse(oldData.value);
expandRowKeys.value = [];
} }
@ -145,5 +188,18 @@ const currentPageData = computed(() => {
return heatapiContentList.value.slice(startIndex, endIndex); return heatapiContentList.value.slice(startIndex, endIndex);
}); });
solveData(); // key
function handleExpandChange(row, expandedRows) {
expandRowKeys.value = expandedRows.map((row) => row.deviceId);
}
//
function expandAllRows() {
expandRowKeys.value = heatapiContentList.value.map((item) => item.deviceId);
}
//
function collapseAllRows() {
expandRowKeys.value = [];
}
</script> </script>

79
src/views/model/heatapiconf/index.vue

@ -15,13 +15,6 @@
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="90px" <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="90px"
class="my-custom-form"> class="my-custom-form">
<el-row> <el-row>
<!-- <el-col :span="4">
<el-form-item label="机构编号" prop="orgCode">
<el-tree-select v-model="queryParams.orgCode" :data="deptOptions"
:props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择"
check-strictly :default-expand-all="true" @node-click="selectDept" />
</el-form-item>
</el-col> -->
<el-col :span="8"> <el-col :span="8">
<el-form-item label="排除设备" prop="excludeDevices"> <el-form-item label="排除设备" prop="excludeDevices">
<el-select v-model="queryParams.excludeDevices" placeholder="请选择排除设备" clearable multiple> <el-select v-model="queryParams.excludeDevices" placeholder="请选择排除设备" clearable multiple>
@ -54,7 +47,7 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> <el-button type="success" icon="Plus" @click="handleAdd" :disabled="disabled">新增</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button> <el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button>
@ -120,9 +113,19 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="所属公司" prop="orgCode"> <el-form-item label="所属公司" prop="orgCode">
<el-tree-select v-model="form.orgCode" :data="deptOptions" <el-tree-select
:props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择" :disabled = "editable"
check-strictly :default-expand-all="true" @node-click="selectDept" filterable style="width:100%" /> v-model="form.orgCode"
:data="deptOptions"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
placeholder="请选择"
check-strictly
:default-expand-all="true"
@node-click="selectDept"
filterable
style="width:100%"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -131,7 +134,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="发送地址" prop="sendIp"> <el-form-item label="发送地址" prop="sendIp" v-hasPermi="['model:heatapiconf:edit']">
<el-input v-model="form.sendIp" placeholder="请输入发送地址" /> <el-input v-model="form.sendIp" placeholder="请输入发送地址" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -187,6 +190,9 @@ const listDevices = ref([]);
const orgCode = ref(null); const orgCode = ref(null);
const listDeviceAll = ref([]); const listDeviceAll = ref([]);
const param = ref({}); const param = ref({});
const disabled = ref(false);
const editable = ref(false);
const treeSelected = ref(null);
const data = reactive({ const data = reactive({
form: {}, form: {},
queryParams: { queryParams: {
@ -219,6 +225,7 @@ function cancel() {
open.value = false; open.value = false;
form.value.standard = null; form.value.standard = null;
loading.value = false; loading.value = false;
editable.value = false;
} }
// //
@ -253,6 +260,7 @@ function resetQuery() {
queryParams.value.standard = null; queryParams.value.standard = null;
queryParams.value.sendIp = null; queryParams.value.sendIp = null;
queryParams.value.excludeDevices = []; queryParams.value.excludeDevices = [];
treeSelected.value = null;
handleQuery(); handleQuery();
} }
@ -274,6 +282,12 @@ function handleAdd() {
title.value = "添加供热办推送接口配置"; title.value = "添加供热办推送接口配置";
form.value.excludeDevices = null; form.value.excludeDevices = null;
getListDevice(); getListDevice();
if(treeSelected.value != null && treeSelected.value != ''){
editable.value = true;
}else{
editable.value = false;
}
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
@ -296,10 +310,16 @@ function handleUpdate(row) {
getListDevice(row.orgCode); getListDevice(row.orgCode);
getHeatapiconf(_id).then(response => { getHeatapiconf(_id).then(response => {
form.value = response.data; form.value = response.data;
form.value.excludeDevices = form.value.excludeDevices?.split(","); if(form.value.excludeDevices != null && form.value.excludeDevices?.trim() != ""){
form.value.excludeDevices = form.value.excludeDevices.split(",");
}else{
form.value.excludeDevices = null;
} // formorgName
open.value = true; open.value = true;
title.value = "修改供热办推送接口配置"; title.value = "修改供热办推送接口配置";
}); });
editable.value = true;
} }
/** 提交按钮 */ /** 提交按钮 */
@ -364,6 +384,8 @@ function handleNodeClick(data) {
queryParams.value.orgCode = data.id; queryParams.value.orgCode = data.id;
form.value.orgCode = data.id; form.value.orgCode = data.id;
form.value.orgName = data.label; form.value.orgName = data.label;
disabled.value = data.isLeaf
treeSelected.value = data.id;
handleQuery(); handleQuery();
}; };
@ -411,27 +433,26 @@ const calculateTableHeight = () => {
tableHeight.value = remainingHeight + 'px'; tableHeight.value = remainingHeight + 'px';
}); });
}; };
function getDeptTreeNew(data) {
function getDeptTreeNew(data, level = 0) {
const result = []; const result = [];
if (level === 0) {
data.forEach(item => {
if (item.children) {
result.push(...getDeptTreeNew(item.children, level + 1));
}
});
} else {
data.forEach(item => { data.forEach(item => {
if (level < 2) { if (item.orgType === '2') {
const newItem = { ...item }; const newItem = { ...item }; // 使
newItem.id = String(item.id); // id newItem.children = []; // children
if (item.children) { newItem.isLeaf = false;
newItem.children = getDeptTreeNew(item.children, level + 1); newItem.id = String(item.id);
} result.push(newItem);
} else if (item.children) {
const children = getDeptTreeNew(item.children); //
if (children.length > 0) {
const newItem = { ...item }; // 使
newItem.children = children;
newItem.isLeaf = true;
newItem.id = String(item.id);
result.push(newItem); result.push(newItem);
} }
});
} }
});
return result; return result;
} }

45
src/views/system/dept/index.vue

@ -20,6 +20,25 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="简称" prop="shortName">
<el-input
v-model="queryParams.shortName"
placeholder="请输入部门简称"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="类别" prop="orgType">
<el-select v-model="queryParams.orgType" placeholder="部门类别" clearable style="width: 240px">
<el-option
v-for="dict in sys_org_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@ -55,6 +74,13 @@
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
> >
<el-table-column prop="deptName" label="部门名称" width="360"></el-table-column> <el-table-column prop="deptName" label="部门名称" width="360"></el-table-column>
<el-table-column prop="shortName" label="简称" width="100"></el-table-column>
<el-table-column prop="allName" label="全名" width="100"></el-table-column>
<el-table-column prop="orgType" label="类型" width="100">
<template #default="scope">
<dict-tag :options="sys_org_type" :value="scope.row.orgType" />
</template>
</el-table-column>
<el-table-column prop="orderNum" label="排序" width="100"></el-table-column> <el-table-column prop="orderNum" label="排序" width="100"></el-table-column>
<el-table-column prop="status" label="状态" width="100"> <el-table-column prop="status" label="状态" width="100">
<template #default="scope"> <template #default="scope">
@ -96,6 +122,23 @@
<el-input v-model="form.deptName" placeholder="请输入部门名称" /> <el-input v-model="form.deptName" placeholder="请输入部门名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="简称" prop="shortName">
<el-input v-model="form.shortName" placeholder="请输入部门名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类别" prop="orgType">
<el-select v-model="form.orgType" placeholder="部门类别" clearable style="width: 240px">
<el-option
v-for="dict in sys_org_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="显示排序" prop="orderNum"> <el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
@ -143,7 +186,7 @@
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); const { sys_normal_disable,sys_org_type } = proxy.useDict("sys_normal_disable","sys_org_type");
const deptList = ref([]); const deptList = ref([]);
const open = ref(false); const open = ref(false);

Loading…
Cancel
Save