|
|
|
@ -241,6 +241,7 @@ export default { |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取产品列表 |
|
|
|
|
getData() { |
|
|
|
|
this.$post(this.api.listByEntity,{ |
|
|
|
|
createTime: this.startTime, |
|
|
|
@ -254,17 +255,19 @@ export default { |
|
|
|
|
this.totals = res.pageList.total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 重置分页为1 |
|
|
|
|
initData(){ |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
// 获取分类下的表 |
|
|
|
|
getTable(n,isConcat){ |
|
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=${n.typePage}&pageSize=${this.typeUnit}&updateTime=`).then(res => { |
|
|
|
|
let list = res.pageList.records |
|
|
|
|
list.map(n => { |
|
|
|
|
n.label = n.showName |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.disabled = true |
|
|
|
|
n.disabled = true // 外面的弹框里的分类禁止操作,只能查看 |
|
|
|
|
}) |
|
|
|
|
// 如果是懒加载的情况,则拼接 |
|
|
|
|
if(isConcat){ |
|
|
|
@ -293,7 +296,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
handleId(res) |
|
|
|
|
this.typeConfigList = JSON.parse(JSON.stringify(res)) |
|
|
|
|
this.typeConfigList = JSON.parse(JSON.stringify(res)) // 深拷贝,用来数据配置里直接使用 |
|
|
|
|
|
|
|
|
|
// 获取分类下的表 |
|
|
|
|
function getTable(data){ |
|
|
|
@ -301,8 +304,8 @@ export default { |
|
|
|
|
if(n.children.length){ |
|
|
|
|
getTable(n.children) |
|
|
|
|
}else{ |
|
|
|
|
n.typePage = 1 |
|
|
|
|
n.disabled = true |
|
|
|
|
n.typePage = 1 // 获取表要用到的分页 |
|
|
|
|
n.disabled = true // 表同样禁止操作 |
|
|
|
|
that.getTable(n) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -377,25 +380,29 @@ export default { |
|
|
|
|
} |
|
|
|
|
},50) |
|
|
|
|
}, |
|
|
|
|
// 获取产品详情 |
|
|
|
|
getDetail(){ |
|
|
|
|
this.$post(`${this.api.findById}?id=${this.id}`).then(res => { |
|
|
|
|
const data = res.product |
|
|
|
|
this.productName = data.productName |
|
|
|
|
this.market = data.market |
|
|
|
|
this.checkedIds = data.tableId.split(',') |
|
|
|
|
this.$refs.type.setCheckedKeys(this.checkedIds) |
|
|
|
|
this.$refs.type.setCheckedKeys(this.checkedIds) // 选中已选的表 |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 新增产品 |
|
|
|
|
add(){ |
|
|
|
|
this.getType() |
|
|
|
|
this.id = '' |
|
|
|
|
this.checkedIds = [] |
|
|
|
|
}, |
|
|
|
|
// 编辑产品 |
|
|
|
|
edit(row){ |
|
|
|
|
this.getType(true) |
|
|
|
|
this.id = row.id |
|
|
|
|
this.userId = row.userId |
|
|
|
|
}, |
|
|
|
|
// 启用禁用产品,直接调用编辑产品的接口,状态变下即可 |
|
|
|
|
switchOff(val,row) { |
|
|
|
|
this.$post(this.api.updateProduct,{ |
|
|
|
|
id: row.id, |
|
|
|
@ -413,11 +420,13 @@ export default { |
|
|
|
|
this.$message.success(val ? '上架成功' : '下架成功') |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
// 表预览 |
|
|
|
|
preview(row){ |
|
|
|
|
this.getType(true) |
|
|
|
|
this.isDetail = true |
|
|
|
|
this.id = row.id |
|
|
|
|
}, |
|
|
|
|
// 删除产品 |
|
|
|
|
handleDelete(row) { |
|
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
@ -452,6 +461,7 @@ export default { |
|
|
|
|
this.page = val |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
// 关闭产品弹框回调 |
|
|
|
|
closeProduct(){ |
|
|
|
|
this.productName = '' |
|
|
|
|
this.market = '' |
|
|
|
@ -485,6 +495,7 @@ export default { |
|
|
|
|
this.configLoading = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 操作产品保存 |
|
|
|
|
confirm(){ |
|
|
|
|
if(this.submited) return false |
|
|
|
|
if(!this.productName) return this.$message.warning('请输入数据产品名称') |
|
|
|
@ -527,6 +538,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 配置数据 |
|
|
|
|
configData(){ |
|
|
|
|
this.configVisible = true |
|
|
|
|
this.getConfigType() |
|
|
|
@ -537,11 +549,13 @@ export default { |
|
|
|
|
this.$refs.typeConfig.setCheckedKeys(this.configIds) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 数据配置里的分类点击回调 |
|
|
|
|
typeConfigClick(data){ |
|
|
|
|
this.categoryId = data.id |
|
|
|
|
this.categoryOriginId = data.originId |
|
|
|
|
this.getConfigTable() |
|
|
|
|
}, |
|
|
|
|
// 关闭数据配置弹框回调 |
|
|
|
|
closeConfig(){ |
|
|
|
|
// 关闭的时候清除多选 |
|
|
|
|
this.$refs.typeConfig.setCheckedNodes([]) |
|
|
|
@ -577,6 +591,7 @@ export default { |
|
|
|
|
this.totalConfig = res.pageList.total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 重置数据配置里的分页 |
|
|
|
|
initConfigData(){ |
|
|
|
|
this.pageConfig = 1 |
|
|
|
|
this.getConfigTable() |
|
|
|
@ -585,6 +600,7 @@ export default { |
|
|
|
|
this.pageConfig = val |
|
|
|
|
this.getConfigTable() |
|
|
|
|
}, |
|
|
|
|
// 预览 |
|
|
|
|
previewConfig(row){ |
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
|
let comment = res.comment |
|
|
|
@ -606,6 +622,7 @@ export default { |
|
|
|
|
this.previewVisible = true |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 数据配置保存 |
|
|
|
|
confirmConfig(){ |
|
|
|
|
const list = this.$refs.typeConfig.getCheckedNodes().map(e => e.originId) // 获取选中的id |
|
|
|
|
this.getIds(list).then(() => { |
|
|
|
|