From 9c52ab2819efbc84a5551ac11fc93b2e2d8683b8 Mon Sep 17 00:00:00 2001
From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com>
Date: Fri, 27 Sep 2024 19:12:06 +0800
Subject: [PATCH] =?UTF-8?q?=E8=BE=B9=E5=B8=A6=E9=A1=B5=E9=9D=A2=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E6=9D=86=E5=A1=94=E7=BB=91=E5=AE=9A=20=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
prettier.config.js | 10 +
src/api/base/edgeDevice.js | 15 +-
src/components/TableModelTwo/index.vue | 302 +++++++++++-----------
src/views/base/edgeDeviceManage/index.vue | 163 +++++++++---
vue.config.js | 2 +-
5 files changed, 302 insertions(+), 190 deletions(-)
create mode 100644 prettier.config.js
diff --git a/prettier.config.js b/prettier.config.js
new file mode 100644
index 0000000..c4bf424
--- /dev/null
+++ b/prettier.config.js
@@ -0,0 +1,10 @@
+module.exports = {
+ tabWidth: 4,
+ semi: false,
+ vueIndentScriptAndStyle: false,
+ singleQuote: true,
+ trailingComma: 'all',
+ proseWrap: 'never',
+ htmlWhitespaceSensitivity: 'strict',
+ endOfLine: 'auto',
+}
diff --git a/src/api/base/edgeDevice.js b/src/api/base/edgeDevice.js
index efd00d6..2bd73fe 100644
--- a/src/api/base/edgeDevice.js
+++ b/src/api/base/edgeDevice.js
@@ -4,9 +4,16 @@
import request from '@/utils/request'
/** 边代设备列表查询 */
export const queryEdgeDeviceListApiTwo = (data) => {
- return request.get('/base/tbBdDeviceRecord//getDeviceList', {
- params: data
- })
+ return request.get('/base/tbBdDeviceRecord//getDeviceList', {
+ params: data,
+ })
}
-
+/* 获取杆塔数据 */
+export const getPowerListApi = (params) => {
+ return request.get('/base/tbBdDeviceRecord/getPowerList', { params })
+}
+/* 修改边带与杆塔的绑定关系 */
+export const putPowerDataApi = (params) => {
+ return request.post('/base/tbBdDeviceRecord/updatePowerId', params)
+}
diff --git a/src/components/TableModelTwo/index.vue b/src/components/TableModelTwo/index.vue
index 0738046..1c46f41 100644
--- a/src/components/TableModelTwo/index.vue
+++ b/src/components/TableModelTwo/index.vue
@@ -46,17 +46,24 @@
:props="item.optionProps"
:show-all-levels="false"
clearable
- @change="handleCasAdd($event, item.f_model, cascaderFunc, extraTableProp)"
+ @change="
+ handleCasAdd(
+ $event,
+ item.f_model,
+ cascaderFunc,
+ extraTableProp,
+ )
+ "
style="width: 240px"
/>
@@ -109,7 +116,7 @@
-
+
@@ -132,8 +139,9 @@
select-on-indeterminate
style="width: 100%"
v-loading="loading"
- @selection-change="handleSelectionChange">
+ @selection-change="handleSelectionChange"
>
+ >
+
@@ -221,57 +229,62 @@ export default {
},
/** 传递参数 */
sendParams: {
- type: Object,
- default: () => null
+ type: Object,
+ default: () => null,
},
sendId: {
- type: Number,
- default: () => null
+ type: Number,
+ default: () => null,
},
/** 是否显示查询按钮 */
showSearchBtn: {
- type: Boolean,
- default: true,
+ type: Boolean,
+ default: true,
},
showBtnCrews: {
- type: Boolean,
- default: true,
+ type: Boolean,
+ default: true,
},
cascaderFunc: {
- type: Function,
- default: () => null
+ type: Function,
+ default: () => null,
},
extraTableProp: {
- type: Object,
- default: () => null
+ type: Object,
+ default: () => null,
},
showOperation: {
- type: Boolean,
- default: true
+ type: Boolean,
+ default: true,
},
showRightTools: {
- type: Boolean,
- default: true
+ type: Boolean,
+ default: true,
},
selectable: {
- type: Function,
- default: () => {
- return true
- }
+ type: Function,
+ default: () => {
+ return true
+ },
},
selSingle: {
- type: Boolean,
- default: false
+ type: Boolean,
+ default: false,
},
showIndex: {
- type: Boolean,
- default: true
- }
+ type: Boolean,
+ default: true,
+ },
+
+ isShowHandle: {
+ type: Boolean,
+ default: () => false,
+ },
},
computed: {
/* 根据操作栏控制表头是否显示 */
tableColumCheckProps() {
- return this.columCheckList.filter(e => {
+ return this.columCheckList.filter((e) => {
return e.checked != false
})
},
@@ -286,17 +299,17 @@ export default {
},
columnsList: {
handler(nv, ov) {
- if(nv !== ov) {
+ if (nv !== ov) {
this.columnsList = nv
- this.columCheckList = this.columnsList.map(e => {
- this.$set(e, 'checked', true)
- return e
+ this.columCheckList = this.columnsList.map((e) => {
+ this.$set(e, 'checked', true)
+ return e
})
}
},
- deep: true
- }
- /* sendParams: {
+ deep: true,
+ },
+ /* sendParams: {
handler(nv, ov) {
console.log(nv, ov)
if(nv !== ov) {
@@ -311,9 +324,7 @@ export default {
data() {
return {
// 表单校验
- formRules: {
-
- },
+ formRules: {},
loading: false,
// 列表接口查询参数
queryParams: {
@@ -338,37 +349,37 @@ export default {
columCheckList: [],
// 操作列最小宽度
dynamicWidth: 0,
- idCount: 1
+ idCount: 1,
}
},
created() {
- this.columCheckList = this.columnsList.map(e => {
+ this.columCheckList = this.columnsList.map((e) => {
this.$set(e, 'checked', true)
return e
})
/* 生成查询参数 */
- this.formLabel.map(e => {
+ this.formLabel.map((e) => {
this.$set(this.queryParams, e.f_model, '')
// 设置表单必填
- if(e.f_rule) {
- this.$set(this.formRules, e.f_rule, [
- {
- required: true,
- message: `请填写${e.f_label}`,
- trigger: 'blur'
- }
- ])
+ if (e.f_rule) {
+ this.$set(this.formRules, e.f_rule, [
+ {
+ required: true,
+ message: `请填写${e.f_label}`,
+ trigger: 'blur',
+ },
+ ])
}
})
- if(this.sendParams !== null) {
- Object.assign(this.queryParams, this.sendParams)
- /* for(let key in this.sendParams) {
+ if (this.sendParams !== null) {
+ Object.assign(this.queryParams, this.sendParams)
+ /* for(let key in this.sendParams) {
console.log(key, this.sendParams[key])
this.$set(this.queryParams, key, this.sendParams[key])
} */
}
- if(this.sendId !== null) this.queryParams.id = this.sendId
+ if (this.sendId !== null) this.queryParams.id = this.sendId
this.getTableList()
},
updated() {
@@ -378,46 +389,45 @@ export default {
methods: {
/** 获取列表数据 */
async getTableList() {
- if(this.queryParams.time && this.queryParams.time.length !== 0) {
- this.queryParams.startTime = this.queryParams.time[0]
- this.queryParams.endTime = this.queryParams.time[1]
- delete this.queryParams.time
- }
- console.log(this.queryParams)
- if(Object.keys(this.formRules).length !== 0) {
- this.$refs.queryFormRef.validate(async valid => {
- if (valid) {
+ if (this.queryParams.time && this.queryParams.time.length !== 0) {
+ this.queryParams.startTime = this.queryParams.time[0]
+ this.queryParams.endTime = this.queryParams.time[1]
+ delete this.queryParams.time
+ }
+ console.log(this.queryParams)
+ if (Object.keys(this.formRules).length !== 0) {
+ this.$refs.queryFormRef.validate(async (valid) => {
+ if (valid) {
+ this.loading = true
+ const res = await this.requestApi(this.queryParams)
+ this.loading = false
+ console.log(res, '列表数据')
+ if (res.code === 200) {
+ if (res.data) {
+ this.tableList = res.data.rows || res.data
+ this.total = res.data.total || res.data.length
+ } else {
+ this.tableList = res.rows || res.data
+ this.total = res.data.total || res.rows.length
+ }
+ }
+ }
+ })
+ } else {
this.loading = true
const res = await this.requestApi(this.queryParams)
this.loading = false
- console.log(res, '列表数据')
+ console.log(res, '列表数据2')
if (res.code === 200) {
- if (res.data) {
- this.tableList = res.data.rows || res.data
- this.total = res.data.total || res.data.length
- } else {
- this.tableList = res.rows || res.data
- this.total = res.data.total || res.rows.length
- }
+ if (res.data) {
+ this.tableList = res.data.rows || res.data
+ this.total = res.data.total
+ } else {
+ this.tableList = res.rows || res.data
+ this.total = res.total
+ }
}
- }
- })
- } else {
- this.loading = true
- const res = await this.requestApi(this.queryParams)
- this.loading = false
- console.log(res, '列表数据2')
- if (res.code === 200) {
- if (res.data) {
- this.tableList = res.data.rows || res.data
- this.total = res.data.total
- } else {
- this.tableList = res.rows || res.data
- this.total = res.total
- }
}
- }
-
},
/** 查询按钮 */
handleQuery() {
@@ -425,7 +435,7 @@ export default {
},
/** 填充按钮 */
handleFill() {
- /* this.tableList.forEach(obj => {
+ /* this.tableList.forEach(obj => {
Object.assign(obj, this.formLabel)
}) */
},
@@ -438,39 +448,36 @@ export default {
},
/** 级联选择 */
handleCas(e, val) {
- this.queryParams[val] = e[e.length - 1]
+ this.queryParams[val] = e[e.length - 1]
},
/** 级联选择只选最后一级 */
- handleCasAdd(
- e,
- val,
- func,
- prop
- ) {
- if(e.length !== 0) {
- this.queryParams[val] = e[e.length - 1]
- let setObj = {}
- // 合并
- if(prop) {
- Object.assign(setObj, prop)
+ handleCasAdd(e, val, func, prop) {
+ if (e.length !== 0) {
+ this.queryParams[val] = e[e.length - 1]
+ let setObj = {}
+ // 合并
+ if (prop) {
+ Object.assign(setObj, prop)
+ }
+ // 设置id自增
+ this.$set(setObj, 'id', this.idCount)
+ this.idCount++
+ // 获取单位
+ func({
+ id: e[e.length - 1],
+ })
+ .then((res) => {
+ this.$set(setObj, 'name', res.data.parentName)
+ this.$set(setObj, 'unitName', res.data.unitName)
+ this.$set(setObj, 'typeName', res.data.name)
+ })
+ .catch((err) => {})
+ for (let key in this.queryParams) {
+ this.$set(setObj, key, this.queryParams[key])
+ }
+ this.tableList.unshift(setObj)
+ console.log(this.tableList)
}
- // 设置id自增
- this.$set(setObj, 'id', this.idCount)
- this.idCount++
- // 获取单位
- func({
- id: e[e.length - 1]
- }).then(res => {
- this.$set(setObj, 'name', res.data.parentName)
- this.$set(setObj, 'unitName', res.data.unitName)
- this.$set(setObj, 'typeName', res.data.name)
- }).catch(err => {})
- for(let key in this.queryParams) {
- this.$set(setObj, key, this.queryParams[key])
- }
- this.tableList.unshift(setObj)
- console.log(this.tableList)
- }
},
/** 动态设置操作列的列宽 */
getOperatorWidth() {
@@ -500,16 +507,15 @@ export default {
},
queryTableList(params) {
- Object.assign(this.queryParams, params)
- this.getTableList()
+ Object.assign(this.queryParams, params)
+ this.getTableList()
},
handleSelectionChange(e) {
- console.log(e, 'e')
- this.msgList = e
- this.$emit('transIdList', this.msgList)
+ console.log(e, 'e')
+ this.msgList = e
+ this.$emit('transIdList', this.msgList)
},
-
},
}
diff --git a/src/views/base/edgeDeviceManage/index.vue b/src/views/base/edgeDeviceManage/index.vue
index cb25899..f09b9b9 100644
--- a/src/views/base/edgeDeviceManage/index.vue
+++ b/src/views/base/edgeDeviceManage/index.vue
@@ -1,50 +1,139 @@
-
-
-
-
-
- {{ phoneCrypto(data.devUserPhone) || '-' }}
-
-
+
+
+
+
+
+ {{ phoneCrypto(data.devUserPhone) || '-' }}
+
-
+
+ {{ data.bindId ? '修改杆塔' : '绑定杆塔' }}
+
+
+
+
+
+
+
+
+
+
+
+
+ 确 定
+ 取 消
+
+
+
+
diff --git a/vue.config.js b/vue.config.js
index 2d5e433..5c6efde 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -35,7 +35,7 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
- target: `http://192.168.2.12:18080`,
+ target: `http://192.168.0.110:18080`,
changeOrigin: true,
pathRewrite: {
["^" + process.env.VUE_APP_BASE_API]: "",