|
|
@ -82,7 +82,6 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="配置数据"> |
|
|
|
<el-form-item label="配置数据"> |
|
|
|
<el-button type="primary" @click="configData">配置数据权限</el-button> |
|
|
|
<el-button type="primary" @click="configData">配置数据权限</el-button> |
|
|
|
<!-- <div class="type-wrap" ref="typeWrap" @scroll="loadType" v-if="configChecked.length"> --> |
|
|
|
|
|
|
|
<div class="type-wrap" ref="typeWrap" @scroll="loadType" style="display: none"> |
|
|
|
<div class="type-wrap" ref="typeWrap" @scroll="loadType" style="display: none"> |
|
|
|
<el-tree ref="type" :data="typeList" show-checkbox accordion node-key="id" :default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps" @node-expand="typeExpand"> |
|
|
|
<el-tree ref="type" :data="typeList" show-checkbox accordion node-key="id" :default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps" @node-expand="typeExpand"> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
@ -286,9 +285,9 @@ 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) |
|
|
|
n.id = String(++that.typeIndex) // 分类id跟表id有可能会重复,所以把分类id都加上个基数,防止冲突,同时用originId保存起来真正的id |
|
|
|
n.label = n.categoryName |
|
|
|
n.label = n.categoryName |
|
|
|
n.disabled = true |
|
|
|
n.disabled = true // 一律禁止勾选 |
|
|
|
if(n.children.length){ |
|
|
|
if(n.children.length){ |
|
|
|
handleId(n.children) |
|
|
|
handleId(n.children) |
|
|
|
} |
|
|
|
} |
|
|
@ -471,6 +470,7 @@ export default { |
|
|
|
let list = this.checkedIds |
|
|
|
let list = this.checkedIds |
|
|
|
this.tableId = [] |
|
|
|
this.tableId = [] |
|
|
|
const proList = [] |
|
|
|
const proList = [] |
|
|
|
|
|
|
|
// 勾选的分类id分别去查询下面的表id,也可以全部id用逗号分隔去查,这里遍历去查是因为这样速度更快 |
|
|
|
list.map(e => { |
|
|
|
list.map(e => { |
|
|
|
proList.push(new Promise((resolve,reject) => { |
|
|
|
proList.push(new Promise((resolve,reject) => { |
|
|
|
this.$get(`${this.api.getAllTableIdBycategoryId}?categoryId=${e}`).then(res => { |
|
|
|
this.$get(`${this.api.getAllTableIdBycategoryId}?categoryId=${e}`).then(res => { |
|
|
@ -481,6 +481,7 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
})) |
|
|
|
})) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
// 全部分类id遍历查询完resolve回去 |
|
|
|
return Promise.all(proList).then(res => { |
|
|
|
return Promise.all(proList).then(res => { |
|
|
|
resolve() |
|
|
|
resolve() |
|
|
|
}).catch(err => {}) |
|
|
|
}).catch(err => {}) |
|
|
@ -490,10 +491,8 @@ export default { |
|
|
|
if(!this.productName) return this.$message.warning('请输入数据产品名称') |
|
|
|
if(!this.productName) return this.$message.warning('请输入数据产品名称') |
|
|
|
if(!this.market) return this.$message.warning('请输入市场价格') |
|
|
|
if(!this.market) return this.$message.warning('请输入市场价格') |
|
|
|
if(isNaN(this.market)) return this.$message.warning('市场价格请输入数字') |
|
|
|
if(isNaN(this.market)) return this.$message.warning('市场价格请输入数字') |
|
|
|
// if(!this.$refs.type.getCheckedNodes().length) return this.$message.warning('请选择数据') |
|
|
|
if(!this.checkedIds.length) return this.$message.warning('请选择数据') |
|
|
|
|
|
|
|
this.submited = true // 提交状态 |
|
|
|
this.submited = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getIds().then(() => { |
|
|
|
this.getIds().then(() => { |
|
|
|
let tableId = Array.from(new Set(this.tableId)) |
|
|
|
let tableId = Array.from(new Set(this.tableId)) |
|
|
|
if(!tableId.length) return this.$message.warning('请选择数据') |
|
|
|
if(!tableId.length) return this.$message.warning('请选择数据') |
|
|
@ -508,7 +507,7 @@ export default { |
|
|
|
orderNum: '', |
|
|
|
orderNum: '', |
|
|
|
status: '', |
|
|
|
status: '', |
|
|
|
tableNum: tableId.length, |
|
|
|
tableNum: tableId.length, |
|
|
|
updateTime: '', |
|
|
|
updateTime: '' |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.id){ |
|
|
|
if(this.id){ |
|
|
|
this.$post(this.api.updateProduct,data).then(res => { |
|
|
|
this.$post(this.api.updateProduct,data).then(res => { |
|
|
@ -531,15 +530,15 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
configData(){ |
|
|
|
configData(){ |
|
|
|
this.configVisible = true |
|
|
|
this.configVisible = true |
|
|
|
this.getConfigType() |
|
|
|
this.getConfigType() |
|
|
|
|
|
|
|
// 编辑的时候才需要获取外面的弹框的已选数据,传到配置数据里去默认勾选 |
|
|
|
if (this.id) { |
|
|
|
if (this.id) { |
|
|
|
let list = this.$refs.type.getCheckedNodes() |
|
|
|
let list = this.$refs.type.getCheckedNodes() |
|
|
|
let configIds = [] |
|
|
|
let configIds = [] |
|
|
|
list.map(n => { |
|
|
|
list.map(n => { |
|
|
|
if(!n.name) configIds.push(n.originId) |
|
|
|
if(!n.name) configIds.push(n.originId) // 分类没有name。只需要分类id,因为配置数据里是以分类为维度的,所以获取表id无法默认勾选 |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.configIds = configIds |
|
|
|
this.configIds = configIds |
|
|
|
} |
|
|
|
} |
|
|
@ -598,6 +597,7 @@ export default { |
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
let comment = res.comment |
|
|
|
let comment = res.comment |
|
|
|
let previewHead = [] |
|
|
|
let previewHead = [] |
|
|
|
|
|
|
|
// 不显示id和操作时间 |
|
|
|
comment.map(n => { |
|
|
|
comment.map(n => { |
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -606,6 +606,7 @@ export default { |
|
|
|
let data = res.data |
|
|
|
let data = res.data |
|
|
|
data.map(n => { |
|
|
|
data.map(n => { |
|
|
|
for(let i in n){ |
|
|
|
for(let i in n){ |
|
|
|
|
|
|
|
// 把返回的时间格式化 |
|
|
|
if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = this.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) |
|
|
|
if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = this.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -619,7 +620,7 @@ export default { |
|
|
|
list.map(n => { |
|
|
|
list.map(n => { |
|
|
|
if(n.children && n.children.length){ |
|
|
|
if(n.children && n.children.length){ |
|
|
|
this.getTableId(n.children) |
|
|
|
this.getTableId(n.children) |
|
|
|
if(checked.includes(n.originId) && n.children[0].name){ |
|
|
|
if(checked.includes(n.originId) && n.children[0].name){ // 选中的并且是表(表才有name) |
|
|
|
this.configCheckedTableId = [...this.configCheckedTableId,...n.children.map(n => n.id)] |
|
|
|
this.configCheckedTableId = [...this.configCheckedTableId,...n.children.map(n => n.id)] |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.getTableId(n.children) |
|
|
|
this.getTableId(n.children) |
|
|
@ -628,7 +629,7 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
confirmConfig(){ |
|
|
|
confirmConfig(){ |
|
|
|
this.configChecked = this.$refs.typeConfig.getCheckedKeys().map(n => n) |
|
|
|
this.configChecked = this.$refs.typeConfig.getCheckedKeys().map(n => n) // 获取选中的id |
|
|
|
this.checkedIds = this.configChecked |
|
|
|
this.checkedIds = this.configChecked |
|
|
|
this.configVisible = false |
|
|
|
this.configVisible = false |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|