产品新增编辑改成传分类id,接口返回全部tableId

dev
yujialong 3 years ago
parent 79746ba660
commit f1ecd77ff6
  1. 15
      src/views/data/Product.vue

@ -80,9 +80,10 @@
<span slot="suffix">/账号</span> <span slot="suffix">/账号</span>
</el-input> </el-input>
</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" v-if="configChecked.length"> -->
<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 }">
<span :title="node.label">{{ node.label }}</span> <span :title="node.label">{{ node.label }}</span>
@ -462,6 +463,7 @@ export default {
this.typeList = [] this.typeList = []
this.tableId = [] this.tableId = []
this.configChecked = [] this.configChecked = []
this.configIds = []
}, },
// tableId, // tableId,
getIds(){ getIds(){
@ -488,7 +490,7 @@ 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.$refs.type.getCheckedNodes().length) return this.$message.warning('')
this.submited = true this.submited = true
@ -627,13 +629,10 @@ export default {
}, },
confirmConfig(){ confirmConfig(){
this.configChecked = this.$refs.typeConfig.getCheckedKeys().map(n => n) this.configChecked = this.$refs.typeConfig.getCheckedKeys().map(n => n)
// this.getTableId(this.typeList)
this.checkedIds = this.configChecked this.checkedIds = this.configChecked
console.log(44, this.checkedIds, this.configChecked, this.typeList)
this.getIds().then(() => {
this.configVisible = false this.configVisible = false
console.log(33, this.tableId) this.$nextTick(() => {
this.$refs.type.setCheckedNodes([...this.tableId, ...this.checkedIds]) this.$refs.type.setCheckedNodes(this.checkedIds)
}) })
} }
} }

Loading…
Cancel
Save