From 5808f76456ca0d40de5074f132b73a5a488e3e13 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 09 Dec 2025 09:12:03 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v9.0/9.0.1' into test
---
src/views/device/addDevice.vue | 167 +++++++++++++++++++++++++------------------------------
1 files changed, 75 insertions(+), 92 deletions(-)
diff --git a/src/views/device/addDevice.vue b/src/views/device/addDevice.vue
index 8745e8c..8eece02 100644
--- a/src/views/device/addDevice.vue
+++ b/src/views/device/addDevice.vue
@@ -11,7 +11,7 @@
@click.stop="copyInfo(scope.row, scope.index)" v-if="userInfo.role_name.includes('admin')">复制
</el-button>
</template>
- </avue-crud>F
+ </avue-crud>
</basic-container>
</template>
@@ -72,10 +72,10 @@
dialogWidth: 1050,
searchGutter: 30,
+ searchMenuPosition: 'left',
+ searchMenuSpan: 4,
tip: false,
searchShow: true,
- searchMenuPosition: 'right',
- searchMenuSpan: 10,
border: true,
index: true,
indexLabel: '序号',
@@ -98,8 +98,7 @@
editDisplay: false,
labelWidth: 130,
search: true,
- // searchSpan: 4,
- labelWidth: 130,
+ searchSpan: 4,
rules: [
{
required: true,
@@ -126,7 +125,7 @@
],
},
{
- label: '所属单位',
+ label: '所属部门',
prop: 'dept_name',
addDisplay: false,
editDisplay: false,
@@ -136,13 +135,13 @@
rules: [
{
required: true,
- message: '请输入所属单位',
+ message: '请输入所属部门',
trigger: 'blur',
},
],
},
{
- label: '所属单位',
+ label: '所属部门',
prop: 'dept_id',
hide: true,
type: 'tree',
@@ -158,7 +157,7 @@
rules: [
{
required: true,
- message: '请输入所属单位',
+ message: '请输入所属部门',
trigger: 'blur',
},
],
@@ -214,66 +213,32 @@
width: 200,
},
{
- label: '设备位置',
- prop: 'area_code',
- type: 'cascader',
- labelWidth: 130,
- searchSpan: 4,
- hide: true,
- search: true,
- // overHidden: true,
- editDisplay: true,
- viewDisplay: true,
- checkStrictly: true,
-
- props: {
- label: 'title',
- value: 'value',
- emitPath: false,
- multiple: false,
- expandTrigger: 'hover',
- },
- dataType: 'string',
- rules: [
+ label: '设备位置',
+ prop: 'area_code',
+ // type: 'cascader',
+ type: 'tree',
+ labelWidth: 130,
+ searchSpan: 4,
+ hide: true,
+ search: true,
+ // overHidden: true,
+ editDisplay: true,
+ viewDisplay: true,
+ checkStrictly: true,
+ defaultExpandAll: true,
+ dicData: [],
+ props: {
+ label: 'name',
+ value: 'id',
+ children: 'childrens',
+ },
+ rules: [
{
- required: true,
- message: '请选择设备位置',
- trigger: 'change',
+ required: true,
+ message: '请选择设备位置',
+ trigger: 'change',
},
- ],
- lazy: true,
- lazyLoad (node, resolve) {
- let level = node.level
- let list = []
- let callback = () => {
- resolve(
- (list || []).map(ele => ({
- ...ele,
- value: ele.value,
- leaf: level >= 2,
- }))
- )
- }
-
- if (level === 0) {
- getLazyTree('000000000000').then(res => {
- list = res.data.data
- callback()
- })
- } else if (level === 1) {
- getLazyTree(node.value).then(res => {
- list = res.data.data
- callback()
- })
- } else if (level === 2) {
- getLazyTree(node.value).then(res => {
- list = res.data.data
- callback()
- })
- } else {
- callback()
- }
- },
+ ],
},
{
label: '创建时间',
@@ -323,9 +288,9 @@
},
],
},
-
-
-
+
+
+
],
},
@@ -370,6 +335,12 @@
await this.getRegionTreeList();
await this.getSystemNamesList();
},
+ mounted() {
+ getRegionTreeAll({ parentCode: this.userInfo.detail.areaCode }).then(res => {
+ const column = this.findObject(this.option.column, 'area_code');
+ column.dicData = res.data.data ? [res.data.data] : [];
+ });
+ },
methods: {
async getRegionTreeList(code) {
try {
@@ -400,20 +371,20 @@
this.systemNamesList = [];
}
},
- beforeOpen (type, row, index) {
- if (type === 'add') {
- this.form = {
- workspace_name: '',
- platform_name: '',
- dept_name: '',
- bind_code: '',
- type: 0,
- workspace_desc: '',
- area_name: '',
- area_code: '',
- }
- }
- },
+ // beforeOpen (type, row, index) {
+ // if (type === 'add') {
+ // this.form = {
+ // workspace_name: '',
+ // platform_name: '',
+ // dept_name: '',
+ // bind_code: '',
+ // type: 0,
+ // workspace_desc: '',
+ // area_name: '',
+ // area_code: '',
+ // }
+ // }
+ // },
async getXZQHList(area_code) {
try {
const res = await getLazyTree(area_code);
@@ -422,7 +393,7 @@
console.error('获取行政区划数据失败:', error);
return [];
}
- },
+ },
findNodeById(tree, id) {
if (tree.id === id) {
return tree;
@@ -440,11 +411,11 @@
try {
const response = await this.getFullAreaCode(areaCode);
const codes = response.split(',');
-
+
// 获取区域树数据
const xzqhData = await this.getRegionTreeList(codes[0]);
if (!xzqhData) return '/';
-
+
const names = [];
for (const code of codes) {
const node = this.findNodeById(xzqhData, code);
@@ -463,7 +434,7 @@
copyInfo (row, index) {
const ipAddress = import.meta.env.VITE_APP_DEVICE_IP
let params = `
- host: tcp://${ipAddress}
+ 网关地址: tcp://${ipAddress}
账号:drone
密码:drone@123
组织id:${row.bing_id}
@@ -606,12 +577,24 @@
}
},
beforeOpen (done, type) {
+ if (type === 'add') {
+ this.form = {
+ workspace_name: '',
+ platform_name: '',
+ dept_name: '',
+ bind_code: '',
+ type: 0,
+ workspace_desc: '',
+ area_name: '',
+ area_code: '',
+ }
+ }
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(async res => {
const data = res.data.data
this.form = {
...data,
- area_code: await this.getFullAreaCode(data.area_code),
+ // area_code: await this.getFullAreaCode(data.area_code),
}
})
}
@@ -627,7 +610,7 @@
this.onLoad(this.page, this.query)
},
onLoad (page, params = {}) {
-
+
const { releaseTimeRange } = this.query
let values = {
...params,
@@ -646,7 +629,7 @@
if (values.area_code) {
values['area_code'] = values.area_code.split(',').pop()
}
-
+
this.loading = true
getList(page.currentPage, page.pageSize, values).then(async res => {
const data = res.data.data
@@ -666,7 +649,7 @@
this.loading = false
this.selectionClear()
})
-
+
},
treeLoad (tree, treeNode, resolve) {
var params = {
--
Gitblit v1.9.3