数据架构导入表及产品添加uuid等

dev_2022-03-03
yujialong 3 years ago
parent b882a9bc37
commit 3be54099e4
  1. 21
      package-lock.json
  2. 1
      package.json
  3. 80
      src/views/data/Framework.vue
  4. 6
      src/views/data/Product.vue

21
package-lock.json generated

@ -1047,6 +1047,11 @@
"integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==", "integrity": "sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==",
"dev": true "dev": true
}, },
"@types/uuid": {
"version": "8.3.3",
"resolved": "https://registry.npmmirror.com/@types/uuid/download/@types/uuid-8.3.3.tgz?cache=0&sync_timestamp=1637271089246&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2F%40types%2Fuuid%2Fdownload%2F%40types%2Fuuid-8.3.3.tgz",
"integrity": "sha512-0LbEEx1zxrYB3pgpd1M5lEhLcXjKJnYghvhTRgaBeUivLHMDM1TzF3IJ6hXU2+8uA4Xz+5BA63mtZo5DjVT8iA=="
},
"@vue/babel-helper-vue-jsx-merge-props": { "@vue/babel-helper-vue-jsx-merge-props": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0.tgz", "resolved": "https://registry.npmjs.org/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0.tgz",
@ -12728,6 +12733,22 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true "dev": true
}, },
"vue-uuid": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/vue-uuid/download/vue-uuid-2.0.2.tgz",
"integrity": "sha1-DPtznmYKOvHU4zQnQ1eBFPebJDg=",
"requires": {
"@types/uuid": "^8.0.0",
"uuid": "^8.1.0"
},
"dependencies": {
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmmirror.com/uuid/download/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
},
"vuedraggable": { "vuedraggable": {
"version": "2.23.2", "version": "2.23.2",
"resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.23.2.tgz", "resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.23.2.tgz",

@ -22,6 +22,7 @@
"vue-quill-editor": "^3.0.6", "vue-quill-editor": "^3.0.6",
"vue-router": "^3.5.1", "vue-router": "^3.5.1",
"vue-schart": "^2.0.0", "vue-schart": "^2.0.0",
"vue-uuid": "^2.0.2",
"vuedraggable": "^2.17.0", "vuedraggable": "^2.17.0",
"vuex": "^3.1.2" "vuex": "^3.1.2"
}, },

@ -154,6 +154,8 @@
</div> </div>
</template> </template>
<script> <script>
import { uuid } from 'vue-uuid'
import { Loading } from 'element-ui'
export default { export default {
data() { data() {
return { return {
@ -179,8 +181,9 @@ export default {
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
importLoading: null,
tablePromises: [],
importTypeList: [], importTypeList: [],
importTypeIndex: 100000,
fieldData: [], fieldData: [],
fieldHead: [], fieldHead: [],
tableName: '', tableName: '',
@ -489,39 +492,45 @@ export default {
}, },
// //
getTable(n,isConcat){ getTable(n,isConcat){
this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=${n.typeTreePage ? n.typeTreePage : 1}&pageSize=${this.typeTreeUnit}`).then(res => { this.tablePromises.push(new Promise((resolve,reject) => {
let list = res.list.records this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=${n.typeTreePage ? n.typeTreePage : 1}&pageSize=${this.typeTreeUnit}`).then(res => {
list.map(n => { let list = res.list.records
n.label = n.showName list.map(n => {
n.id = String(n.id) n.label = n.showName
// , n.id = String(n.id)
if(this.defaultTypeChecked.includes(n.id)){ // ,
n.disabled = true if(this.defaultTypeChecked.includes(n.id)){
n.disabled = true
}
})
// ,
if(isConcat){
n.children = n.children.concat(list)
}else{
n.children = list
n.tableLen = res.list.total
} }
// ,+1
n.typeTreePage++
resolve()
}).catch(res => {
reject()
}) })
// , }))
if(isConcat){
n.children = n.children.concat(list)
}else{
n.children = list
n.tableLen = res.list.total
}
// ,+1
n.typeTreePage++
}).catch(res => {})
}, },
// //
batchImport(){ batchImport(){
this.importLoading = Loading.service({
background: 'rgba(255, 255, 255, .5)'
})
// //
this.$post(this.api.originalList).then(res => { this.$post(this.api.originalList).then(res => {
const that = this
// idlabelnamekeylabelnamekey // idlabelnamekeylabelnamekey
function handleId(data){ function handleId(data){
data.map(n => { data.map(n => {
that.importTypeIndex++
n.realId = n.id n.realId = n.id
// idid, // ididuuid
n.id = String(that.importTypeIndex + n.id) n.id = uuid.v4()
n.label = n.categoryName n.label = n.categoryName
if(n.children.length){ if(n.children.length){
handleId(n.children) handleId(n.children)
@ -529,20 +538,19 @@ export default {
}) })
} }
handleId(res) handleId(res)
// pageSize3000 // pageSize300020
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=3000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => { this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=3000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => {
let list = res1.pageList.records let list = res1.pageList.records
this.defaultTypeChecked = list.map(n => n.copyId) // copyIdidid this.defaultTypeChecked = list.map(n => n.copyId) // copyIdidid
const that = this
// //
function handleId(data){ const handleId = data => {
data.map(n => { data.map(n => {
if(n.children.length){ if(n.children.length){
handleId(n.children) handleId(n.children)
}else{ }else{
// 1 // 1
n.typeTreePage = 1 n.typeTreePage = 1
that.getTable(n) this.getTable(n)
} }
}) })
} }
@ -556,14 +564,20 @@ export default {
} }
}) })
} }
setTimeout(() => { Promise.all(this.tablePromises).then(_ => {
handleDisabled(res) handleDisabled(res)
this.importTypeList = res this.importTypeList = res
},500) this.importLoading.close()
}).catch(res => {}) this.importVisible = true
console.log('全部分类:', res)
this.importVisible = true console.log('该分类下已选的表id:', this.defaultTypeChecked)
}).catch(res => {}) })
}).catch(res => {
this.importLoading.close()
})
}).catch(res => {
this.importLoading.close()
})
}, },
// //
getFields(){ getFields(){

@ -151,6 +151,7 @@
</template> </template>
<script> <script>
import { uuid } from 'vue-uuid'
export default { export default {
data() { data() {
return { return {
@ -189,7 +190,6 @@ export default {
}, },
checkedIds: [], checkedIds: [],
isDetail: false, isDetail: false,
typeIndex: 100000,
curExpand: '', curExpand: '',
typeUnit: 20, typeUnit: 20,
typeScrollTop: 0, typeScrollTop: 0,
@ -287,7 +287,8 @@ export default {
function handleId(data){ function handleId(data){
data.map(n => { data.map(n => {
n.originId = n.id n.originId = n.id
n.id = String(++that.typeIndex) // idididoriginIdid // ididuuidoriginIdid
n.id = uuid.v4()
n.label = n.categoryName n.label = n.categoryName
n.disabled = true // n.disabled = true //
if(n.children.length){ if(n.children.length){
@ -466,7 +467,6 @@ export default {
this.productName = '' this.productName = ''
this.market = '' this.market = ''
this.isDetail = false this.isDetail = false
this.typeIndex = 100000
this.typeList = [] this.typeList = []
this.configIds = [] this.configIds = []
}, },

Loading…
Cancel
Save