diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index d2b84e8..4961513 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -75,11 +75,11 @@ export default { // index: 'configure', // title: '服务配置' // }, - { - icon: 'el-icon-document-checked', - index: 'curriculum', - title: '课程管理' - }, + // { + // icon: 'el-icon-document-checked', + // index: 'curriculum', + // title: '课程管理' + // }, { icon: 'el-icon-notebook-2', index: 'data', diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index fa7fb6f..19a4ff8 100644 --- a/src/views/data/Framework.vue +++ b/src/views/data/Framework.vue @@ -124,7 +124,7 @@ export default { total: 0, multipleSelection: [], importTypeList: [], - importTypeIndex: 10000, + importTypeIndex: 100000, fieldData: [], fieldHead: [], tableName: '', @@ -138,6 +138,8 @@ export default { previewHead: [], previewData: [], submited: false, + names: [], + showNames: [] }; }, watch: { @@ -216,6 +218,8 @@ export default { }).catch(() => {}) }, confirmType(){ + if(this.submited) return false + this.submited = true if(this.id){ this.$post(this.api.updateCategory,{ id: this.id, @@ -224,7 +228,12 @@ export default { this.$message.success('编辑成功') this.getType() this.typeVisible = false - }).catch(res => {}) + setTimeout(() => { + this.submited = false + },1500) + }).catch(res => { + this.submited = false + }) }else{ this.$post(this.api.saveCategory,{ levelId: this.levelId, @@ -233,7 +242,12 @@ export default { this.$message.success('添加成功') this.getType() this.typeVisible = false - }).catch(res => {}) + setTimeout(() => { + this.submited = false + },1500) + }).catch(res => { + this.submited = false + }) } }, closeType(){ @@ -321,7 +335,7 @@ export default { },50) }, getTable(n,isConcat){ - this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=${n.typeTreePage}&pageSize=${this.typeTreeUnit}`).then(res => { + this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=${n.typeTreePage ? n.typeTreePage : 1}&pageSize=${this.typeTreeUnit}`).then(res => { let list = res.list.records list.map(n => { n.label = n.showName @@ -331,11 +345,12 @@ export default { } }) if(isConcat){ - n.typeTreePage++ n.children = n.children.concat(list) }else{ n.children = list + n.tableLen = res.list.total } + n.typeTreePage++ }).catch(res => {}) }, batchImport(){ @@ -420,39 +435,65 @@ export default { }, closeImport(){ this.$refs.typeTree.setCheckedKeys([]) + this.names = [] + this.showNames = [] }, - confirmImport(){ - if(this.submited) return false + getNames(){ let list = this.$refs.typeTree.getCheckedNodes() - let names = [] - let showNames = [] - list.map(n => { - if(n.name && !n.disabled){ - names.push(n.name) - showNames.push(n.showName) - } + return new Promise((resolve,reject) => { + let getLen = 0 + list.map(n => { + if(n.tableLen && n.tableLen > n.children.length) getLen++ + }) + list.map((n,i) => { + if(n.tableLen && n.tableLen > n.children.length){ + this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=1&pageSize=10000`).then(res => { + let tableList = res.list.records + getLen-- + tableList.map(n => { + if(!this.defaultTypeChecked.includes(String(n.id))){ + this.names.push(n.name) + this.showNames.push(n.showName) + } + }) + if(!getLen) resolve() + }).catch(res => {}) + }else if(n.name && !n.disabled && !this.names.includes(n.name)){ + this.names.push(n.name) + this.showNames.push(n.showName) + if(!getLen) resolve() + } + }) }) - if(!names.length) return this.$message.warning('请选择数据') + }, + confirmImport(){ + if(this.submited) return false + if(!this.$refs.typeTree.getCheckedNodes().length) return this.$message.warning('请选择数据') + this.getNames().then(() => { + let names = Array.from(new Set(this.names)) + let showNames = Array.from(new Set(this.showNames)) + if(!names.length) return this.$message.warning('请选择数据') - this.submited = true - let data = [] - let categoryId = Number(this.categoryId) - names.map((n,i) => { - data.push({ - categoryId, - name: n, - showName: showNames[i], + this.submited = true + let data = [] + let categoryId = Number(this.categoryId) + names.map((n,i) => { + data.push({ + categoryId, + name: n, + showName: showNames[i], + }) }) - }) - this.$post(this.api.saveTable,data).then(res => { - this.$message.success('导入成功') - this.getData() - this.importVisible = false - setTimeout(() => { + this.$post(this.api.saveTable,data).then(res => { + this.$message.success('导入成功') + this.getData() + this.importVisible = false + setTimeout(() => { + this.submited = false + },1000) + }).catch(res => { this.submited = false - },1000) - }).catch(res => { - this.submited = false + }) }) }, } diff --git a/src/views/data/Product.vue b/src/views/data/Product.vue index 8f88277..495a384 100644 --- a/src/views/data/Product.vue +++ b/src/views/data/Product.vue @@ -194,6 +194,7 @@ export default { typeUnit: 20, typeScrollTop: 0, typeTimer: null, + tableId: [], configVisible: false, configChecked: [], @@ -210,7 +211,8 @@ export default { listConfigAll: [], previewVisible: false, previewHead: [], - previewData: [] + previewData: [], + submited: false, }; }, watch: { @@ -266,11 +268,12 @@ export default { n.id = String(n.id) }) if(isConcat){ - n.typePage++ n.children = n.children.concat(list) }else{ n.children = list + n.tableLen = res.pageList.total } + n.typePage++ }).catch(res => {}) }, getType(){ @@ -458,45 +461,79 @@ export default { this.productName = '' this.market = '' this.isDetail = false - this.typeIndex = 1000 + this.typeIndex = 100000 this.typeList = [] + this.tableId = [] + }, + getIds(){ + let list = this.$refs.type.getCheckedNodes() + return new Promise((resolve,reject) => { + let getLen = 0 + list.map(n => { + if(n.tableLen && n.tableLen > n.children.length) getLen++ + }) + list.map((n,i) => { + if(n.tableLen && n.tableLen > n.children.length){ + this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=1&pageSize=10000&updateTime=`).then(res => { + let tableList = res.pageList.records + tableList.map(n => { + this.tableId.push(String(n.id)) + }) + getLen-- + if(!getLen) resolve() + }).catch(res => {}) + }else if(n.name && !this.tableId.includes(n.id)){ + this.tableId.push(n.id) + if(!getLen) resolve() + } + }) + }) }, confirm(){ + if(this.submited) return false if(!this.productName) return this.$message.warning('请输入数据产品名称') if(!this.market) return this.$message.warning('请输入市场价格') if(isNaN(this.market)) return this.$message.warning('市场价格请输入数字') - let list = this.$refs.type.getCheckedNodes() - let tableId = [] - list.map(n => { - if(n.name) tableId.push(n.id) + if(!this.$refs.type.getCheckedNodes().length) return this.$message.warning('请选择数据') + + this.submited = true + + this.getIds().then(() => { + let tableId = Array.from(new Set(this.tableId)) + if(!tableId.length) return this.$message.warning('请选择数据') + let data = { + id: this.id, + productName: this.productName, + market: this.market, + tableId: tableId.join(), + userId: this.userId, + userName: this.userName, + createTime: '', + orderNum: '', + status: '', + tableNum: tableId.length, + updateTime: '', + } + if(this.id){ + this.$post(this.api.updateProduct,data).then(res => { + this.$message.success('新增成功') + this.productVisible = false + this.getData() + this.submited = false + }).catch(res => { + this.submited = false + }) + }else{ + this.$post(this.api.saveProduct,data).then(res => { + this.$message.success('新增成功') + this.productVisible = false + this.getData() + this.submited = false + }).catch(res => { + this.submited = false + }) + } }) - if(!tableId.length) return this.$message.warning('请选择数据') - let data = { - id: this.id, - productName: this.productName, - market: this.market, - tableId: tableId.join(), - userId: this.userId, - userName: this.userName, - createTime: '', - orderNum: '', - status: '', - tableNum: tableId.length, - updateTime: '', - } - if(this.id){ - this.$post(this.api.updateProduct,data).then(res => { - this.$message.success('新增成功') - this.productVisible = false - this.getData() - }).catch(res => {}) - }else{ - this.$post(this.api.saveProduct,data).then(res => { - this.$message.success('新增成功') - this.productVisible = false - this.getData() - }).catch(res => {}) - } }, configData(){ diff --git a/src/views/order/selectClient.vue b/src/views/order/selectClient.vue index 4abcd89..7dfa515 100644 --- a/src/views/order/selectClient.vue +++ b/src/views/order/selectClient.vue @@ -46,7 +46,7 @@ - +