数据相关完善注释

dev_2022-03-03
yujialong 3 years ago
parent fbb64f6dcf
commit 37bf68f2e5
  1. 25
      src/views/data/Introduce.vue
  2. 27
      src/views/data/Product.vue

@ -44,7 +44,7 @@
</div> </div>
<div class="btns" v-if="editing"> <div class="btns" v-if="editing">
<el-button @click="editing = false"> </el-button> <el-button @click="editing = false"> </el-button>
<el-button type="primary" @click="addKeyword"> </el-button> <el-button type="primary" @click="confirmData"> </el-button>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
@ -120,6 +120,7 @@ export default {
this.getKeyword() this.getKeyword()
}).catch(res => {}) }).catch(res => {})
}, },
//
typeClick(data,node){ typeClick(data,node){
this.editing = false this.editing = false
this.categoryId = data.id this.categoryId = data.id
@ -129,6 +130,7 @@ export default {
this.dataSource = data.dataSource this.dataSource = data.dataSource
this.getKeyword() this.getKeyword()
}, },
//
getKeyword(){ getKeyword(){
this.$get(this.api.getKeywordByCategoryId,{ this.$get(this.api.getKeywordByCategoryId,{
categoryId: this.categoryId categoryId: this.categoryId
@ -136,12 +138,14 @@ export default {
this.keywordList = res.keywords this.keywordList = res.keywords
}).catch(res => {}) }).catch(res => {})
}, },
//
edit(){ edit(){
this.editing = true this.editing = true
this.introduce = this.introduceText this.introduce = this.introduceText
}, },
confirmEdit(){ //
const id = this.categoryId saveType(){
const id = this.categoryId // id
this.$post(this.api.updateCategory,{ this.$post(this.api.updateCategory,{
id, id,
introduce: this.introduce, introduce: this.introduce,
@ -154,26 +158,31 @@ export default {
this.getData() this.getData()
}).catch(res => {}) }).catch(res => {})
}, },
//
delKeyword(item) { delKeyword(item) {
this.$post(`${this.api.deleteKeyword}?categoryId=${this.categoryId}&keyword=${item.keyword}`).then(res => { this.$post(`${this.api.deleteKeyword}?categoryId=${this.categoryId}&keyword=${item.keyword}`).then(res => {
this.$message.success('删除成功') this.$message.success('删除成功')
this.getKeyword() this.getKeyword()
}).catch(res => {}) }).catch(res => {})
}, },
addKeyword() { //
const keyword = this.newKeyword confirmData() {
const keyword = this.newKeyword //
//
if (keyword) { if (keyword) {
//
if (this.keywordList.find(e => e.keyword === keyword)) return this.$message.error('请不要输入重复关键字!') if (this.keywordList.find(e => e.keyword === keyword)) return this.$message.error('请不要输入重复关键字!')
this.confirmEdit() this.saveType()
//
this.$post(this.api.addKeyword,{ this.$post(this.api.addKeyword,{
categoryId: this.categoryId, categoryId: this.categoryId,
keyword keyword
}).then(res => { }).then(res => {
this.newKeyword = '' this.newKeyword = '' //
this.getKeyword() this.getKeyword()
}).catch(res => {}) }).catch(res => {})
} else { } else {
this.confirmEdit() this.saveType()
} }
} }
} }

@ -241,6 +241,7 @@ export default {
this.getData() this.getData()
}, },
methods: { methods: {
//
getData() { getData() {
this.$post(this.api.listByEntity,{ this.$post(this.api.listByEntity,{
createTime: this.startTime, createTime: this.startTime,
@ -254,17 +255,19 @@ export default {
this.totals = res.pageList.total this.totals = res.pageList.total
}).catch(res => {}) }).catch(res => {})
}, },
// 1
initData(){ initData(){
this.page = 1 this.page = 1
this.getData() this.getData()
}, },
//
getTable(n,isConcat){ getTable(n,isConcat){
this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=${n.typePage}&pageSize=${this.typeUnit}&updateTime=`).then(res => { this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=${n.typePage}&pageSize=${this.typeUnit}&updateTime=`).then(res => {
let list = res.pageList.records let list = res.pageList.records
list.map(n => { list.map(n => {
n.label = n.showName n.label = n.showName
n.id = String(n.id) n.id = String(n.id)
n.disabled = true n.disabled = true //
}) })
// , // ,
if(isConcat){ if(isConcat){
@ -293,7 +296,7 @@ export default {
}) })
} }
handleId(res) handleId(res)
this.typeConfigList = JSON.parse(JSON.stringify(res)) this.typeConfigList = JSON.parse(JSON.stringify(res)) // 使
// //
function getTable(data){ function getTable(data){
@ -301,8 +304,8 @@ export default {
if(n.children.length){ if(n.children.length){
getTable(n.children) getTable(n.children)
}else{ }else{
n.typePage = 1 n.typePage = 1 //
n.disabled = true n.disabled = true //
that.getTable(n) that.getTable(n)
} }
}) })
@ -377,25 +380,29 @@ export default {
} }
},50) },50)
}, },
//
getDetail(){ getDetail(){
this.$post(`${this.api.findById}?id=${this.id}`).then(res => { this.$post(`${this.api.findById}?id=${this.id}`).then(res => {
const data = res.product const data = res.product
this.productName = data.productName this.productName = data.productName
this.market = data.market this.market = data.market
this.checkedIds = data.tableId.split(',') this.checkedIds = data.tableId.split(',')
this.$refs.type.setCheckedKeys(this.checkedIds) this.$refs.type.setCheckedKeys(this.checkedIds) //
}).catch(res => {}) }).catch(res => {})
}, },
//
add(){ add(){
this.getType() this.getType()
this.id = '' this.id = ''
this.checkedIds = [] this.checkedIds = []
}, },
//
edit(row){ edit(row){
this.getType(true) this.getType(true)
this.id = row.id this.id = row.id
this.userId = row.userId this.userId = row.userId
}, },
//
switchOff(val,row) { switchOff(val,row) {
this.$post(this.api.updateProduct,{ this.$post(this.api.updateProduct,{
id: row.id, id: row.id,
@ -413,11 +420,13 @@ export default {
this.$message.success(val ? '上架成功' : '下架成功') this.$message.success(val ? '上架成功' : '下架成功')
}).catch(err => {}) }).catch(err => {})
}, },
//
preview(row){ preview(row){
this.getType(true) this.getType(true)
this.isDetail = true this.isDetail = true
this.id = row.id this.id = row.id
}, },
//
handleDelete(row) { handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
type: 'warning' type: 'warning'
@ -452,6 +461,7 @@ export default {
this.page = val this.page = val
this.getData() this.getData()
}, },
//
closeProduct(){ closeProduct(){
this.productName = '' this.productName = ''
this.market = '' this.market = ''
@ -485,6 +495,7 @@ export default {
this.configLoading = false this.configLoading = false
}) })
}, },
//
confirm(){ confirm(){
if(this.submited) return false if(this.submited) return false
if(!this.productName) return this.$message.warning('请输入数据产品名称') if(!this.productName) return this.$message.warning('请输入数据产品名称')
@ -527,6 +538,7 @@ export default {
}) })
} }
}, },
//
configData(){ configData(){
this.configVisible = true this.configVisible = true
this.getConfigType() this.getConfigType()
@ -537,11 +549,13 @@ export default {
this.$refs.typeConfig.setCheckedKeys(this.configIds) this.$refs.typeConfig.setCheckedKeys(this.configIds)
} }
}, },
//
typeConfigClick(data){ typeConfigClick(data){
this.categoryId = data.id this.categoryId = data.id
this.categoryOriginId = data.originId this.categoryOriginId = data.originId
this.getConfigTable() this.getConfigTable()
}, },
//
closeConfig(){ closeConfig(){
// //
this.$refs.typeConfig.setCheckedNodes([]) this.$refs.typeConfig.setCheckedNodes([])
@ -577,6 +591,7 @@ export default {
this.totalConfig = res.pageList.total this.totalConfig = res.pageList.total
}).catch(res => {}) }).catch(res => {})
}, },
//
initConfigData(){ initConfigData(){
this.pageConfig = 1 this.pageConfig = 1
this.getConfigTable() this.getConfigTable()
@ -585,6 +600,7 @@ export default {
this.pageConfig = val this.pageConfig = val
this.getConfigTable() this.getConfigTable()
}, },
//
previewConfig(row){ previewConfig(row){
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
@ -606,6 +622,7 @@ export default {
this.previewVisible = true this.previewVisible = true
}).catch(res => {}) }).catch(res => {})
}, },
//
confirmConfig(){ confirmConfig(){
const list = this.$refs.typeConfig.getCheckedNodes().map(e => e.originId) // id const list = this.$refs.typeConfig.getCheckedNodes().map(e => e.originId) // id
this.getIds(list).then(() => { this.getIds(list).then(() => {

Loading…
Cancel
Save