From 8b6eba58c666295de2f764dd7032afd36d7591fc Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 20 九月 2023 11:10:13 +0800
Subject: [PATCH] 1.设备清单页面及导入100%
---
src/views/systemSetting/dataImport.vue | 123 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 117 insertions(+), 6 deletions(-)
diff --git a/src/views/systemSetting/dataImport.vue b/src/views/systemSetting/dataImport.vue
index 6a2e2fc..105cbde 100644
--- a/src/views/systemSetting/dataImport.vue
+++ b/src/views/systemSetting/dataImport.vue
@@ -128,7 +128,7 @@
item.indexOf('鎵�灞炰粨搴撶紪鐮�')!==-1||
item.indexOf('涓婄骇搴撲綅缂栫爜')!==-1||
item.indexOf('瑙勬牸鍨嬪彿')!==-1||
- item.indexOf('瀛樿揣鍒嗙被缂栫爜')!==-1||
+ item.indexOf('瀛樿揣鍒嗙被')!==-1||
item.indexOf('璁¢噺鍗曚綅/缁勫悕绉�')!==-1
"
@@ -505,6 +505,22 @@
j.uuid = nanoid()
})
}
+ if (this.sheetName.indexOf('璁惧绫诲瀷') !== -1) {
+ this.statusArr = [
+ { code: '0', name: '姝e父' },
+ { code: '1', name: '鍋滅敤' }
+ ]
+ const orgArr = this.orgArr.map(i => i.torg_code)
+
+ this.tableData[0].forEach(j => {
+ j.uuid = nanoid()
+ })
+ this.tableData[1].forEach(j => {
+ j['*鐘舵��'] = j['*鐘舵��'] ? this.statusArr.find(e => e.name === j['*鐘舵��']).code : ''
+ j['*鎵�灞炵粍缁囩紪鐮�'] = j['*鎵�灞炵粍缁囩紪鐮�'] ? (orgArr.includes(j['*鎵�灞炵粍缁囩紪鐮�']) ? this.findParent([], j['*鎵�灞炵粍缁囩紪鐮�'], this.orgOptions).reverse() : '') : ''
+ j.uuid = nanoid()
+ })
+ }
},
// 鎻愪氦
submit() {
@@ -565,6 +581,12 @@
return this.$message.info(res.message)
}
}
+ if (this.sheetName.indexOf('璁惧绫诲瀷') !== -1) {
+ const res = this.handleDeviceListSubmitData()
+ if (res.code !== '200') {
+ return this.$message.info(res.message)
+ }
+ }
const data = {
fileCode: this.excelCode,
@@ -604,6 +626,15 @@
if (this.sheetName.indexOf('浜哄憳绠$悊') !== -1) {
this.handlePersonListUploadTemplate(false)
}
+ if (this.sheetName.indexOf('璁惧绫诲瀷') !== -1) {
+ this.tableData[0].forEach(j => {
+ j.uuid = nanoid()
+ })
+ this.tableData[1].forEach(j => {
+ j['*鎵�灞炵粍缁囩紪鐮�'] = this.findParent([], j['*鎵�灞炵粍缁囩紪鐮�'], this.orgOptions).reverse()
+ j.uuid = nanoid()
+ })
+ }
})
})
.catch(e => {
@@ -624,7 +655,7 @@
const orgArr = this.orgArr.map(i => i.torg_code)
// this.sheetName.indexOf('浜哄憳绠$悊')
- // 绗竴娆℃彁浜�
+ // 绗竴娆℃覆鏌�
if (isFirstUpload) {
this.tableData[0].forEach(j => {
j['鎵�灞炲矖浣嶇紪鐮�'] = j['鎵�灞炲矖浣嶇紪鐮�'] ? j['鎵�灞炲矖浣嶇紪鐮�'].split(',').filter(e => postArr.includes(e)) : []
@@ -636,7 +667,7 @@
})
}
- // 闈炵涓�娆℃彁浜�
+ // 闈炵涓�娆℃覆鏌�
if (!isFirstUpload) {
this.tableData[0].forEach(j => {
j.鎵�灞炲矖浣嶇紪鐮� = typeof j.鎵�灞炲矖浣嶇紪鐮� === 'string' ? j.鎵�灞炲矖浣嶇紪鐮�.split(',').filter(e => postArr.includes(e)) : []
@@ -991,6 +1022,67 @@
return { code: '200', message: '鎴愬姛锛�' }
},
+ // 澶勭悊璁惧娓呭崟鎻愪氦鏁版嵁
+ handleDeviceListSubmitData() {
+ let flag = true
+ let msg = ''
+ if ([...new Set(this.tableData[0].map(i => i['*璁惧绫诲瀷缂栧彿(鍞竴)']))].length !== this.tableData[0].length) {
+ return this.$message.info('璁惧绫诲瀷缂栧彿涓嶈兘閲嶅锛�')
+ }
+ if ([...new Set(this.tableData[1].map(i => i['*璁惧缂栧彿(鍞竴)']))].length !== this.tableData[1].length) {
+ return this.$message.info('璁惧缂栧彿涓嶈兘閲嶅锛�')
+ }
+ this.tableData[0].forEach(j => {
+ if (!j['*璁惧绫诲瀷缂栧彿(鍞竴)']) {
+ flag = false
+ msg = '*璁惧绫诲瀷缂栧彿(鍞竴)涓嶈兘涓虹┖锛�'
+ }
+ if (!j['*璁惧绫诲瀷鍚嶇О']) {
+ flag = false
+ msg = '*璁惧绫诲瀷鍚嶇О涓嶈兘涓虹┖锛�'
+ }
+ })
+ this.tableData[1].forEach(j => {
+ if (!j['*璁惧缂栧彿(鍞竴)']) {
+ flag = false
+ msg = '*璁惧缂栧彿(鍞竴)涓嶈兘涓虹┖锛�'
+ }
+ if (!j['*璁惧鍚嶇О']) {
+ flag = false
+ msg = '*璁惧鍚嶇О涓嶈兘涓虹┖锛�'
+ }
+ if (!j['*鎵�灞炵粍缁囩紪鐮�']) {
+ flag = false
+ msg = '*鎵�灞炵粍缁囩紪鐮佷笉鑳戒负绌猴紒'
+ }
+ if (!j['*璁惧绫诲瀷缂栫爜']) {
+ flag = false
+ msg = '*璁惧绫诲瀷缂栫爜涓嶈兘涓虹┖锛�'
+ }
+ if (!j['*鐘舵��']) {
+ flag = false
+ msg = '*鐘舵�佷笉鑳戒负绌猴紒'
+ }
+ })
+
+ if (!flag) {
+ return { code: '301', message: msg }
+ }
+
+ this.tableData[1].forEach(j => {
+ j['*鎵�灞炵粍缁囩紪鐮�'] = j['*鎵�灞炵粍缁囩紪鐮�'][j['*鎵�灞炵粍缁囩紪鐮�'].length - 1]
+ })
+
+ this.tableData[0].map(item => {
+ delete (item.uuid)
+ })
+ this.tableData[1].map(item => {
+ delete (item.uuid)
+ })
+
+ return { code: '200', message: '鎴愬姛锛�' }
+ },
+
// parents:鐢ㄤ簬杩斿洖鐨勬暟缁勶紝childNode:瑕佹煡璇㈢殑鑺傜偣锛宼reeData锛歫son鏍戝舰鏁版嵁
findParent(parents, childNode, treeData) {
// console.log(parents, childNode, treeData, 2)
@@ -1104,10 +1196,10 @@
})
}
// 瀛樿揣妗f
- if (this.sheetName.indexOf('瀛樿揣绫诲瀷') !== -1 && this.activeName === '0') {
+ if (this.sheetName.indexOf('瀛樿揣鍒嗙被') !== -1 && this.activeName === '0') {
this.tableData[0].unshift({
uuid: nanoid(),
- '*瀛樿揣鍒嗙被缂栫爜(鍞竴)': '',
+ '*瀛樿揣鍒嗙被缂栧彿(鍞竴)': '',
'*瀛樿揣鍒嗙被鍚嶇О': '',
'涓婄骇缂栫爜': ''
})
@@ -1115,7 +1207,7 @@
if (this.sheetName.indexOf('瀛樿揣') !== -1 && this.activeName === '1') {
this.tableData[1].unshift({
uuid: nanoid(),
- '*瀛樿揣缂栫爜(鍞竴)': '',
+ '*瀛樿揣缂栧彿(鍞竴)': '',
'*瀛樿揣鍚嶇О': '',
'瑙勬牸鍨嬪彿': '',
'*瀛樿揣鍒嗙被缂栫爜': '',
@@ -1130,6 +1222,25 @@
'鏄惁濮斿': '0'
})
}
+ // 璁惧娓呭崟
+ if (this.sheetName.indexOf('璁惧绫诲瀷') !== -1 && this.activeName === '0') {
+ this.tableData[0].unshift({
+ uuid: nanoid(),
+ '*璁惧绫诲瀷缂栧彿(鍞竴)': '',
+ '*璁惧绫诲瀷鍚嶇О': '',
+ '鎻忚堪': ''
+ })
+ }
+ if (this.sheetName.indexOf('璁惧娓呭崟') !== -1 && this.activeName === '1') {
+ this.tableData[1].unshift({
+ uuid: nanoid(),
+ '*璁惧缂栧彿(鍞竴)': '',
+ '*璁惧鍚嶇О': '',
+ '*鎵�灞炵粍缁囩紪鐮�': '',
+ '璁惧绫诲瀷缂栫爜': '',
+ '*鐘舵��': '0'
+ })
+ }
},
delRow(row) {
// 閽堝鍗晄heet
--
Gitblit v1.9.3