Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/data/Introduce.vue
dev_2022-03-03
e 3 years ago
commit 880d7e1795
  1. 179
      src/views/data/Framework.vue
  2. 24
      src/views/data/Introduce.vue
  3. 27
      src/views/data/Product.vue

@ -1,6 +1,7 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<el-container> <el-container>
<!-- 左边的分类 -->
<el-aside width="300px"> <el-aside width="300px">
<div class="plus"> <div class="plus">
<i class="el-icon-circle-plus-outline" @click.stop="addType(0)"></i> <i class="el-icon-circle-plus-outline" @click.stop="addType(0)"></i>
@ -16,7 +17,7 @@
</span> </span>
</el-tree> </el-tree>
</el-aside> </el-aside>
<!-- 右边的表 -->
<el-main style="padding-top: 0"> <el-main style="padding-top: 0">
<el-card class="main-wrap" shadow="hover"> <el-card class="main-wrap" shadow="hover">
<el-form label-width="80px" class="flex-between mgb20"> <el-form label-width="80px" class="flex-between mgb20">
@ -64,7 +65,7 @@
</el-card> </el-card>
</el-main> </el-main>
</el-container> </el-container>
<!-- 导入数据 -->
<el-dialog title="导入" :visible.sync="importVisible" width="80%" center @close="closeImport" class="dialog" :close-on-click-modal="false"> <el-dialog title="导入" :visible.sync="importVisible" width="80%" center @close="closeImport" class="dialog" :close-on-click-modal="false">
<el-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;"> <el-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;">
<div style="overflow:auto;height: 558px;width:330px;padding:15px;background:#fff" ref="typeTreeWrap" @scroll="loadType"> <div style="overflow:auto;height: 558px;width:330px;padding:15px;background:#fff" ref="typeTreeWrap" @scroll="loadType">
@ -104,7 +105,7 @@
<el-button type="primary" :loading="submited" @click="confirmImport"> </el-button> <el-button type="primary" :loading="submited" @click="confirmImport"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 新增编辑分类 -->
<el-dialog :title="id ? '编辑分类' : '新增分类'" :visible.sync="typeVisible" width="24%" center @close="closeType" :close-on-click-modal="false"> <el-dialog :title="id ? '编辑分类' : '新增分类'" :visible.sync="typeVisible" width="24%" center @close="closeType" :close-on-click-modal="false">
<el-input placeholder="请输入分类名称" v-model="categoryName"></el-input> <el-input placeholder="请输入分类名称" v-model="categoryName"></el-input>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -112,14 +113,14 @@
<el-button type="primary" @click="confirmType"> </el-button> <el-button type="primary" @click="confirmType"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 预览 -->
<el-dialog title="预览" :visible.sync="previewVisible" width="60%" center :close-on-click-modal="false"> <el-dialog title="预览" :visible.sync="previewVisible" width="60%" center :close-on-click-modal="false">
<el-table :data="previewData" class="table" stripe header-align="center" row-key="id"> <el-table :data="previewData" class="table" stripe header-align="center" row-key="id">
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> <el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column v-for="(item,index) in previewHead" :prop="item.field" :key="index" :label="item.comment" align="center"></el-table-column> <el-table-column v-for="(item,index) in previewHead" :prop="item.field" :key="index" :label="item.comment" align="center"></el-table-column>
</el-table> </el-table>
</el-dialog> </el-dialog>
<!-- 编辑产品数据表名称 -->
<el-dialog title="编辑产品数据表名称" :visible.sync="nameVisible" width="24%" center :close-on-click-modal="false"> <el-dialog title="编辑产品数据表名称" :visible.sync="nameVisible" width="24%" center :close-on-click-modal="false">
<el-input placeholder="请输入产品数据表名称" v-model="curRow.showName"></el-input> <el-input placeholder="请输入产品数据表名称" v-model="curRow.showName"></el-input>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -127,7 +128,7 @@
<el-button type="primary" @click="confirmName"> </el-button> <el-button type="primary" @click="confirmName"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 自定义表头 -->
<el-dialog title="自定义表头" :visible.sync="headVisible" width="60%" center :close-on-click-modal="false"> <el-dialog title="自定义表头" :visible.sync="headVisible" width="60%" center :close-on-click-modal="false">
<el-table :data="previewData" class="table" stripe header-align="center" row-key="id" :key="editIndex"> <el-table :data="previewData" class="table" stripe header-align="center" row-key="id" :key="editIndex">
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
@ -162,7 +163,7 @@ export default {
label: 'label' label: 'label'
}, },
defaultActive: [], defaultActive: [],
added: false, addEd: false,
typeVisible: false, typeVisible: false,
categoryName: '', categoryName: '',
categoryId: '', categoryId: '',
@ -194,7 +195,7 @@ export default {
previewData: [], previewData: [],
curComment: [], curComment: [],
submited: false, submited: false,
names: [], categorys: [],
nameVisible: false, nameVisible: false,
curRow: {}, curRow: {},
headVisible: false, headVisible: false,
@ -216,6 +217,7 @@ export default {
this.getType() this.getType()
}, },
methods: { methods: {
//
getType(){ getType(){
this.$post(this.api.getTableByClassification).then(res => { this.$post(this.api.getTableByClassification).then(res => {
// , // ,
@ -230,29 +232,31 @@ export default {
}) })
} }
handleId(res) handleId(res)
this.typeList = res this.typeList = res
if (!this.added) { // addEd
if(res[0].children.length){ if (!this.addEd) {
if(res[0].children.length){ //
this.categoryId = res[0].children[0].id this.categoryId = res[0].children[0].id
this.defaultActive = [res[0].children[0].id] this.defaultActive = [res[0].children[0].id]
}else{ }else{
this.categoryId = res[0].id this.categoryId = res[0].id
this.defaultActive = [res[0].id] this.defaultActive = [res[0].id]
} }
// id //
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.type.setCurrentKey(res[0].children[0].id) this.$refs.type.setCurrentKey(this.categoryId)
}) })
} }
this.added = false this.addEd = false // false
this.getData() this.getData()
}).catch(res => {}) }).catch(res => {})
}, },
//
getData(){ getData(){
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res => { this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res => {
const list = res.pageList.records const list = res.pageList.records
list.map(e => { list.map(e => {
//
const startTime = e.startTime ? e.startTime.slice(0, 10) : '' const startTime = e.startTime ? e.startTime.slice(0, 10) : ''
const endTime = e.endTime ? e.endTime.slice(0, 10) : '' const endTime = e.endTime ? e.endTime.slice(0, 10) : ''
if (startTime && endTime) { if (startTime && endTime) {
@ -267,40 +271,46 @@ export default {
this.total = res.pageList.total this.total = res.pageList.total
}).catch(res => {}) }).catch(res => {})
}, },
// 1
initData(){ initData(){
this.page = 1 this.page = 1
this.getData() this.getData()
}, },
//
typeClick(data,node){ typeClick(data,node){
this.categoryId = data.id this.categoryId = data.id
this.getData() this.getData()
}, },
//
addType(row){ addType(row){
if (row) this.defaultActive = [row.data.id] if (row) this.defaultActive = [row.data.id] // idrow0
this.typeVisible = true this.typeVisible = true
this.levelId = row ? row.data.id : 0 this.levelId = row ? row.data.id : 0 // levelIdidid0
}, },
//
editType(row){ editType(row){
this.typeVisible = true this.typeVisible = true
this.id = row.data.id this.id = row.data.id
this.categoryName = row.data.categoryName this.categoryName = row.data.categoryName
}, },
//
delType(row){ delType(row){
// //
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.added = true this.addEd = true
this.$post(`${this.api.deleteCategory}?categoryId=${row.data.id}`).then(res => { this.$post(`${this.api.deleteCategory}?categoryId=${row.data.id}`).then(res => {
this.$message.success('删除成功') this.$message.success('删除成功')
this.getType() this.getType()
}).catch(res => {}) }).catch(res => {})
}).catch(() => {}) }).catch(() => {})
}, },
//
confirmType(){ confirmType(){
if(this.submited) return false if(this.submited) return false //
this.submited = true this.submited = true
this.added = true this.addEd = true
if(this.id){ if(this.id){
this.$post(this.api.updateCategory,{ this.$post(this.api.updateCategory,{
id: this.id, id: this.id,
@ -331,22 +341,30 @@ export default {
}) })
} }
}, },
//
closeType(){ closeType(){
this.id = 0 this.id = 0
this.levelId = 0 this.levelId = 0
this.categoryName = '' this.categoryName = ''
}, },
/**
* 表预览
* @param row 行数据
* @param isEdit 是否是从自定义表头进来的
*/
preview(row, isEdit){ preview(row, isEdit){
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 = []
this.curComment = comment this.curComment = comment //
comment.map(n => { comment.map(n => {
// id
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) n.field != 'id' && n.field != 'operation_time' && previewHead.push(n)
}) })
this.previewHead = previewHead this.previewHead = previewHead
let data = res.data let data = res.data
// custom
isEdit && data.unshift({ isEdit && data.unshift({
custom: true custom: true
}) })
@ -357,9 +375,10 @@ export default {
} }
}) })
this.previewData = data this.previewData = data
if (!isEdit) this.previewVisible = true if (!isEdit) this.previewVisible = true //
}).catch(res => {}) }).catch(res => {})
}, },
//
delTable(row){ delTable(row){
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
type: 'warning' type: 'warning'
@ -370,10 +389,12 @@ export default {
}).catch(res => {}) }).catch(res => {})
}).catch(() => {}) }).catch(() => {})
}, },
//
editName(row){ editName(row){
this.curRow = JSON.parse(JSON.stringify(row)) this.curRow = JSON.parse(JSON.stringify(row))
this.nameVisible = true this.nameVisible = true
}, },
//
confirmName(){ confirmName(){
this.$post(this.api.editTableName, { this.$post(this.api.editTableName, {
id: this.curRow.id, id: this.curRow.id,
@ -384,12 +405,14 @@ export default {
this.getData() this.getData()
}).catch(res => {}) }).catch(res => {})
}, },
//
editHead(row){ editHead(row){
this.curRow = JSON.parse(JSON.stringify(row)) this.curRow = JSON.parse(JSON.stringify(row))
this.preview(row, 1) this.preview(row, 1)
this.editIndex++ this.editIndex++ //
this.headVisible = true this.headVisible = true
}, },
//
confirmHead(){ confirmHead(){
let data = JSON.parse(JSON.stringify(this.curComment)) let data = JSON.parse(JSON.stringify(this.curComment))
this.$post(`${this.api.updateTableCommit}?tableName=${this.curRow.name}`, data).then(res => { this.$post(`${this.api.updateTableCommit}?tableName=${this.curRow.name}`, data).then(res => {
@ -487,9 +510,12 @@ export default {
n.typeTreePage++ n.typeTreePage++
}).catch(res => {}) }).catch(res => {})
}, },
//
batchImport(){ batchImport(){
//
this.$post(this.api.originalList).then(res => { this.$post(this.api.originalList).then(res => {
const that = this const that = this
// idlabelnamekeylabelnamekey
function handleId(data){ function handleId(data){
data.map(n => { data.map(n => {
that.importTypeIndex++ that.importTypeIndex++
@ -503,10 +529,12 @@ export default {
}) })
} }
handleId(res) handleId(res)
// pageSize3000
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=3000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => { this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=3000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => {
let list = res1.pageList.records let list = res1.pageList.records
this.defaultTypeChecked = list.map(n => n.copyId) this.defaultTypeChecked = list.map(n => n.copyId) // copyIdidid
const that = this const that = this
//
function handleId(data){ function handleId(data){
data.map(n => { data.map(n => {
if(n.children.length){ if(n.children.length){
@ -519,7 +547,17 @@ export default {
}) })
} }
handleId(res) handleId(res)
//
function handleDisabled (list) {
list.map(e => {
if (e.children && e.children.length) {
if (e.children.every(e => e.disabled)) e.disabled = true
handleDisabled(e.children)
}
})
}
setTimeout(() => { setTimeout(() => {
handleDisabled(res)
this.importTypeList = res this.importTypeList = res
},500) },500)
}).catch(res => {}) }).catch(res => {})
@ -527,6 +565,7 @@ export default {
this.importVisible = true this.importVisible = true
}).catch(res => {}) }).catch(res => {})
}, },
//
getFields(){ getFields(){
this.$get(`${this.api.staticPreview}?tableName=${this.tableName}`).then(res => { this.$get(`${this.api.staticPreview}?tableName=${this.tableName}`).then(res => {
let comment = res.comment let comment = res.comment
@ -548,6 +587,7 @@ export default {
}).catch(res => {}) }).catch(res => {})
this.importVisible = true this.importVisible = true
}, },
//
importTypeClick(data){ importTypeClick(data){
// ,, // ,,
if(data.name){ if(data.name){
@ -561,48 +601,74 @@ export default {
this.curExpand = obj.id this.curExpand = obj.id
this.renderChecked() this.renderChecked()
}, },
//
closeImport(){ closeImport(){
this.$refs.typeTree.setCheckedKeys([]) this.$refs.typeTree.setCheckedKeys([])
this.names = [] this.categorys = []
}, },
// namesshowNames, // id
getNames(list){ getNames(list){
const categoryId = Number(this.categoryId) const categoryId = Number(this.categoryId)
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
// idid
this.$get(`${this.api.getAllTableInfoByCategoryId}?categoryId=${list.join()}`).then(res => { this.$get(`${this.api.getAllTableInfoByCategoryId}?categoryId=${list.join()}`).then(res => {
const list = res.tableInfo const list = res.tableInfo
list.map(e => { list.map(e => {
delete e.id delete e.id // id
e.categoryId = categoryId e.categoryId = categoryId
}) })
this.names = list this.categorys = list
resolve() resolve()
}).catch(res => {}) }).catch(res => {})
}) })
}, },
//
saveSuccess() {
this.$message.success('导入成功')
this.getData()
this.importVisible = false
setTimeout(() => {
this.submited = false
},1000)
},
//
confirmImport(){ confirmImport(){
if(this.submited) return false if(this.submited) return false //
const checked = this.$refs.typeTree.getCheckedNodes() // const checked = this.$refs.typeTree.getCheckedNodes().filter(e => !e.disabled) //
// //
if(!checked.length) return this.$message.warning('请选择数据') if(!checked.length) return this.$message.warning('请选择数据')
this.submited = true this.submited = true
const typeIds = checked.filter(e => !e.name).map(e => e.realId) // idid // ididid
const tableIds = checked.filter(e => e.name) const typeIds = checked.filter(e => !e.name).map(e => e.realId) // idnamenameididididrealIdid
const categoryId = Number(this.categoryId) const tableIds = checked.filter(e => e.name) //
const categoryId = Number(this.categoryId) //
// categoryId
tableIds.map(e => { tableIds.map(e => {
delete e.id delete e.id
e.categoryId = categoryId e.categoryId = categoryId
}) })
/**
* 根据某个值给数组对象去重
* @param arr 要处理的数组
* @param val 去重依据的值
*/
function uniq (arr, val) {
const res = new Map()
return arr.filter(e => !res.has(e[val]) && res.set(e[val], 1))
}
// ididid
if (typeIds.length) { if (typeIds.length) {
this.getNames(typeIds).then(() => { this.getNames(typeIds).then(() => {
const data = this.names const allIds = [...this.categorys, ...tableIds] // idid
const data = uniq(allIds, 'name')
const dataList = [] const dataList = []
// 2000
for (let i = 0, len = data.length; i < len; i += 2000) { for (let i = 0, len = data.length; i < len; i += 2000) {
dataList.push(data.slice(i, i + 2000)) dataList.push(data.slice(i, i + 2000))
} }
const promiseList = [] const promiseList = []
dataList.map(e => { // 2000item6item6item2000item6item6item2000666
if (dataList.length > 6) {
dataList.slice(0, 6).map(e => {
promiseList.push(new Promise((resolve,reject) => { promiseList.push(new Promise((resolve,reject) => {
this.$post(this.api.saveTable, e).then(res => { this.$post(this.api.saveTable, e).then(res => {
resolve() resolve()
@ -612,24 +678,43 @@ export default {
})) }))
}) })
Promise.all(promiseList).then(res => { Promise.all(promiseList).then(res => {
this.$message.success('导入成功') dataList.slice(6).map(e => {
this.getData() promiseList.push(new Promise((resolve,reject) => {
this.importVisible = false this.$post(this.api.saveTable, e).then(res => {
setTimeout(() => { resolve()
this.submited = false }).catch(res => {
},1000) reject()
})
}))
})
Promise.all(promiseList).then(res => {
this.saveSuccess()
}).catch(err => { }).catch(err => {
this.submited = false this.submited = false
}) })
}).catch(err => {
this.submited = false
}) })
} else { } else {
this.$post(this.api.saveTable, tableIds).then(res => { dataList.map(e => {
this.$message.success('导入成功') promiseList.push(new Promise((resolve,reject) => {
this.getData() this.$post(this.api.saveTable, e).then(res => {
this.importVisible = false resolve()
setTimeout(() => { }).catch(res => {
reject()
})
}))
})
Promise.all(promiseList).then(res => {
this.saveSuccess()
}).catch(err => {
this.submited = false this.submited = false
},1000) })
}
})
} else { //
this.$post(this.api.saveTable, tableIds).then(res => {
this.saveSuccess()
}).catch(res => { }).catch(res => {
this.submited = false this.submited = false
}) })

@ -24,7 +24,6 @@
<p class="label">数据源</p> <p class="label">数据源</p>
<el-input style="width: 250px" placeholder="请输入数据源" v-model="dataSource" type="text" :disabled="!editing"></el-input> <el-input style="width: 250px" placeholder="请输入数据源" v-model="dataSource" type="text" :disabled="!editing"></el-input>
</div> </div>
</template> </template>
<div class="field"> <div class="field">
<p class="label">关键字</p> <p class="label">关键字</p>
@ -124,6 +123,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
@ -133,6 +133,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
@ -140,12 +141,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,
@ -158,6 +161,7 @@ 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('删除成功')
@ -180,20 +184,24 @@ export default {
this.confirmEdit() this.confirmEdit()
} }
}, },
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