|
|
|
@ -12,10 +12,10 @@ |
|
|
|
|
<el-form label-width="80px" class="flex-between"> |
|
|
|
|
<div class="flex-center"> |
|
|
|
|
<el-form-item label="创建日期"> |
|
|
|
|
<el-date-picker v-model="date" align="right" unlink-panels type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="getData" clearable></el-date-picker> |
|
|
|
|
<el-date-picker v-model="date" align="right" unlink-panels type="daterange" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="状态"> |
|
|
|
|
<el-select v-model="status" clearable placeholder="请选择状态" @change="getData"> |
|
|
|
|
<el-select v-model="status" clearable placeholder="请选择状态" @change="initData"> |
|
|
|
|
<el-option v-for="(item,index) in statusList" :key="index" :label="item.name" :value="item.value"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
@ -34,41 +34,25 @@ |
|
|
|
|
<div class="flex-between mgb20"> |
|
|
|
|
<div class="flex-center"> |
|
|
|
|
<p class="hr_tag"></p> |
|
|
|
|
<span>订单列表</span> |
|
|
|
|
<span>产品列表</span> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" size="small" round @click="add">新增</el-button> |
|
|
|
|
<el-button type="primary" size="small" round @click="delAllSelection">批量删除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="orderData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
|
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
|
|
|
|
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="orderNumber" label="订单编号" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="customerName" label="产品名称" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="orderAmount" label="数据量(表)" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="orderDate" label="创建人" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="orderType" label="订单数量" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="orderStatus" label="市场价" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="orderNature" label="创建时间" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="productName" label="产品名称" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="tableNum" label="数据量(表)" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="userName" label="创建人" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="orderNum" label="订单数量" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="market" label="市场价" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="orderNature" label="状态" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="scope.row.enable" |
|
|
|
|
:active-text="scope.row.enable ? '上架' : '下架'" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1" |
|
|
|
|
style="margin: 0 10px 0 10px" |
|
|
|
|
@change="switchOff($event,scope.row,scope.$index)" |
|
|
|
|
></el-switch> |
|
|
|
|
<el-switch v-model="scope.row.status" :active-text="scope.row.status ? '上架' : '下架'" :active-value="1" :inactive-value="0" @change="switchOff($event,scope.row,scope.$index)"></el-switch> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center"> |
|
|
|
@ -80,8 +64,7 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total, prev, pager, next" @current-change="handleCurrentChange" :current-page="pageNo" :total="totals"> |
|
|
|
|
</el-pagination> |
|
|
|
|
<el-pagination background layout="total, prev, pager, next" @current-change="handleCurrentChange" :current-page="page" :total="totals"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
</el-col> |
|
|
|
@ -89,24 +72,71 @@ |
|
|
|
|
|
|
|
|
|
<el-dialog :title="isDetail ? '查看产品' : (id ? '编辑产品' : '新增产品')" :visible.sync="productVisible" width="30%" center @close="closeProduct" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
<el-form ref="form" label-width="120px" :disabled="isDetail"> |
|
|
|
|
<el-form-item prop="userAccount" label="数据产品名称"> |
|
|
|
|
<el-input v-model="userAccount" placeholder="请输入数据产品名称"></el-input> |
|
|
|
|
<el-form-item label="数据产品名称"> |
|
|
|
|
<el-input v-model="productName" placeholder="请输入数据产品名称"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="userName" label="市场价格"> |
|
|
|
|
<el-input v-model="userName" placeholder="请输入市场价格"> |
|
|
|
|
<el-form-item label="市场价格"> |
|
|
|
|
<el-input v-model="market" placeholder="请输入市场价格"> |
|
|
|
|
<span slot="suffix">元/账号</span> |
|
|
|
|
</el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="userName" label="已选数据"> |
|
|
|
|
<el-button type="primary" size="small">配置数据权限</el-button> |
|
|
|
|
<el-tree ref="type" :data="typeList" node-key="id" accordion show-checkbox :props="defaultProps" highlight-current></el-tree> |
|
|
|
|
<el-form-item label="已选数据"> |
|
|
|
|
<el-button type="primary" size="small" @click="configData">配置数据权限</el-button> |
|
|
|
|
<el-tree ref="type" :data="typeList" show-checkbox node-key="id" :default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps"></el-tree> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
|
<el-button @click="productVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="saveSure('teacherForm')">确 定</el-button> |
|
|
|
|
<el-button type="primary" @click="confirm">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="数据配置" :visible.sync="configVisible" width="70%" center @close="closeConfig" :close-on-click-modal="false"> |
|
|
|
|
<el-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;"> |
|
|
|
|
<el-aside width="300px"> |
|
|
|
|
<el-tree style="margin: 10px;" ref="typeConfig" :data="typeConfigList" show-checkbox node-key="id" accordion :default-expanded-keys="defaultActive" :current-node-key="categoryId" :props="defaultProps" highlight-current @current-change="typeConfigClick"></el-tree> |
|
|
|
|
</el-aside> |
|
|
|
|
|
|
|
|
|
<el-main style="padding-top: 0;padding-bottom: 0;"> |
|
|
|
|
<el-card shadow="hover"> |
|
|
|
|
<el-form label-width="80px" class="flex-between mgb20"> |
|
|
|
|
<div class="flex-center"> |
|
|
|
|
<el-form-item label="创建日期" style="margin: 0 20px 0 0"> |
|
|
|
|
<el-date-picker v-model="updateTime" type="date" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="initConfigData"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-input placeholder="请输入数据表名称" v-model="keywordConfig" prefix-icon="el-icon-search" clearable></el-input> |
|
|
|
|
</div> |
|
|
|
|
</el-form> |
|
|
|
|
<el-table :data="listConfigData" class="table" ref="table" stripe header-align="center"> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="showName" label="数据表名称" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="dataTotal" label="数据总量" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="dataSize" label="数据大小" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="updateTime" width="150" label="更新时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="操作" width="220" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="previewConfig(scope.row)">预览</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total, prev, pager, next" :current-page="pageConfig" @current-change="handleCurrentConfigChange" :total="totalConfig"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
</el-main> |
|
|
|
|
</el-container> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="configVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="confirmConfig">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<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-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> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -114,11 +144,15 @@ |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
userId: this.$store.state.userLoginId, |
|
|
|
|
userName: this.$store.state.userName, |
|
|
|
|
keyword: '', |
|
|
|
|
searchTimer: null, |
|
|
|
|
date: [], |
|
|
|
|
startTime: '', |
|
|
|
|
endTime: '', |
|
|
|
|
status: '', |
|
|
|
|
orderData:[], |
|
|
|
|
listData:[], |
|
|
|
|
multipleSelection: [], |
|
|
|
|
statusList: [{ |
|
|
|
|
name: '不限', |
|
|
|
@ -129,26 +163,63 @@ export default { |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
name: '已下架', |
|
|
|
|
value: 2 |
|
|
|
|
value: 0 |
|
|
|
|
}], |
|
|
|
|
pageNo: 1, |
|
|
|
|
page: 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
totals: 1, |
|
|
|
|
productVisible: false, |
|
|
|
|
id: '', |
|
|
|
|
productName: '', |
|
|
|
|
market: '', |
|
|
|
|
typeList: [], |
|
|
|
|
defaultProps: { |
|
|
|
|
children: 'children', |
|
|
|
|
label: 'label' |
|
|
|
|
}, |
|
|
|
|
checkedIds: [], |
|
|
|
|
isDetail: false, |
|
|
|
|
typeIndex: 1000, |
|
|
|
|
|
|
|
|
|
configVisible: false, |
|
|
|
|
configChecked: [], |
|
|
|
|
configCheckedTableId: [], |
|
|
|
|
categoryId: '', |
|
|
|
|
defaultActive: [], |
|
|
|
|
updateTime: '', |
|
|
|
|
keywordConfig: '', |
|
|
|
|
typeConfigList: [], |
|
|
|
|
pageConfig: 1, |
|
|
|
|
pageSizeConfig: 10, |
|
|
|
|
totalConfig: 0, |
|
|
|
|
listConfigData: [], |
|
|
|
|
previewVisible: false, |
|
|
|
|
previewHead: [], |
|
|
|
|
previewData: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
date: function(val){ |
|
|
|
|
if(val){ |
|
|
|
|
this.startTime = val[0] |
|
|
|
|
this.endTime = val[1] |
|
|
|
|
}else{ |
|
|
|
|
this.startTime = '' |
|
|
|
|
this.endTime = '' |
|
|
|
|
} |
|
|
|
|
this.initData() |
|
|
|
|
}, |
|
|
|
|
keyword: function(val) { |
|
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData() |
|
|
|
|
},500) |
|
|
|
|
}, |
|
|
|
|
keywordConfig: function(val) { |
|
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initConfigData() |
|
|
|
|
},500) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
@ -156,64 +227,134 @@ export default { |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getData() { |
|
|
|
|
// this.$get(this.api.queryOrder,data).then(res => { |
|
|
|
|
// res.message.rows.forEach(e => { |
|
|
|
|
// e.orderType = this.orderTypeFn(e.orderType) |
|
|
|
|
// e.orderStatus = this.orderStatusFn(e.orderStatus) |
|
|
|
|
// e.orderNature = this.orderNatureFn(e.orderNature) |
|
|
|
|
// }) |
|
|
|
|
// this.orderData = res.message.rows |
|
|
|
|
// this.totals = res.message.total |
|
|
|
|
// }).catch(res => {}); |
|
|
|
|
this.$post(this.api.listByEntity,{ |
|
|
|
|
createTime: this.startTime, |
|
|
|
|
endTime: this.endTime, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
productName: this.keyword, |
|
|
|
|
status: this.status, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.listData = res.pageList.records |
|
|
|
|
this.totals = res.pageList.total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
initData(){ |
|
|
|
|
this.pageNo = 1 |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
getTable(n,i){ |
|
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=1&pageSize=10000&updateTime=`).then(res => { |
|
|
|
|
res.list.map(n => { |
|
|
|
|
n.label = n.showName |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
}) |
|
|
|
|
n.children = res.list |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
getType(){ |
|
|
|
|
this.productVisible = true |
|
|
|
|
this.$post(this.api.getTableByClassification).then(res => { |
|
|
|
|
res.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.originId = n.id |
|
|
|
|
n.id = String(++this.typeIndex) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.children.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.originId = n.id |
|
|
|
|
n.id = String(++this.typeIndex) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.children.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.originId = n.id |
|
|
|
|
n.id = String(++this.typeIndex) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.isThird = true |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.typeList = res |
|
|
|
|
this.productVisible = true |
|
|
|
|
res.map((n,i) => { |
|
|
|
|
if(n.children.length){ |
|
|
|
|
n.children.map(n => { |
|
|
|
|
if(n.children.length){ |
|
|
|
|
n.children.map(n => this.getTable(n,i)) |
|
|
|
|
}else{ |
|
|
|
|
this.getTable(n,i) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.getTable(n,i) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.typeList = res |
|
|
|
|
},500) |
|
|
|
|
this.importVisible = true |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
handleType(data,typeList){ |
|
|
|
|
let result = data |
|
|
|
|
if(typeList.length){ |
|
|
|
|
typeList.map(e => { |
|
|
|
|
if(result.includes(e.id) && e.children.length){ |
|
|
|
|
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id),1) |
|
|
|
|
} |
|
|
|
|
e.children.length && this.handleType(data,e.children) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
return result |
|
|
|
|
}, |
|
|
|
|
getDetail(){ |
|
|
|
|
this.$post(`${this.api.findById}?id=${this.id}`).then(res => { |
|
|
|
|
let data = res.product |
|
|
|
|
this.productName = data.productName |
|
|
|
|
this.market = data.market |
|
|
|
|
// console.log(22,data.tableId,this.typeList) |
|
|
|
|
this.checkedIds = this.handleType(data.tableId.split(','),this.typeList) |
|
|
|
|
console.log(this.checkedIds) |
|
|
|
|
this.$refs.type.setCheckedNodes(this.checkedIds) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
add(){ |
|
|
|
|
this.getType() |
|
|
|
|
this.id = '' |
|
|
|
|
this.checkedIds = [] |
|
|
|
|
}, |
|
|
|
|
edit(row){ |
|
|
|
|
this.getType() |
|
|
|
|
this.id = row.id |
|
|
|
|
this.getDetail() |
|
|
|
|
}, |
|
|
|
|
switchOff(val,row,index) { |
|
|
|
|
this.$post(this.api.updateProduct,{ |
|
|
|
|
id: row.id, |
|
|
|
|
productName: row.productName, |
|
|
|
|
market: row.market, |
|
|
|
|
tableId: row.tableId, |
|
|
|
|
userId: row.userId, |
|
|
|
|
userName: row.userName, |
|
|
|
|
createTime: '', |
|
|
|
|
orderNum: '', |
|
|
|
|
status: val, |
|
|
|
|
tableNum: row.tableNum, |
|
|
|
|
updateTime: '', |
|
|
|
|
}).then(res => { |
|
|
|
|
this.$message.success(val ? '上架成功' : '下架成功') |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
preview(row){ |
|
|
|
|
this.isDetail = true |
|
|
|
|
this.getType() |
|
|
|
|
this.id = row.id |
|
|
|
|
this.getDetail() |
|
|
|
|
}, |
|
|
|
|
handleDelete(row) { |
|
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
let result = row.orderId |
|
|
|
|
var arr = [] |
|
|
|
|
arr.push(result) |
|
|
|
|
let data = arr |
|
|
|
|
this.$post(this.api.deleteOrder,data).then(res => { |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.deleteProduct}?ids=${row.id}`).then(res => { |
|
|
|
|
this.$message.success('删除成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}) |
|
|
|
|
.catch(() => {}); |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange(val) { |
|
|
|
|
this.multipleSelection = val |
|
|
|
@ -221,33 +362,176 @@ export default { |
|
|
|
|
delAllSelection() { |
|
|
|
|
if(this.multipleSelection.length != ''){ |
|
|
|
|
let arr = this.multipleSelection |
|
|
|
|
let result = arr.map(e => e.orderId) |
|
|
|
|
let result = arr.map(e => e.id) |
|
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
let data = result |
|
|
|
|
this.$post(this.api.deleteOrder,data).then(res => { |
|
|
|
|
this.multipleSelection = [] |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.deleteProduct}?ids=${result.join(',')}`).then(res => { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
this.$message.success('删除成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}else{ |
|
|
|
|
this.$message.error('请先选择订单 !') |
|
|
|
|
this.$message.error('请先选择数据') |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.pageNo = val |
|
|
|
|
this.page = val |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
closeProduct(){ |
|
|
|
|
this.productName = '' |
|
|
|
|
this.market = '' |
|
|
|
|
this.isDetail = false |
|
|
|
|
this.typeIndex = 1000 |
|
|
|
|
this.typeList = [] |
|
|
|
|
}, |
|
|
|
|
confirm(){ |
|
|
|
|
if(!this.productName) return this.$message.warning('请输入数据产品名称') |
|
|
|
|
if(!this.market) return this.$message.warning('请输入市场价格') |
|
|
|
|
if(isNaN(this.market)) return this.$message.warning('市场价格请输入数字') |
|
|
|
|
let list = this.$refs.type.getCheckedNodes() |
|
|
|
|
let tableId = [] |
|
|
|
|
list.map(n => { |
|
|
|
|
if(n.name) tableId.push(n.id) |
|
|
|
|
}) |
|
|
|
|
if(!tableId.length) return this.$message.warning('请选择数据') |
|
|
|
|
let data = { |
|
|
|
|
id: this.id, |
|
|
|
|
productName: this.productName, |
|
|
|
|
market: this.market, |
|
|
|
|
tableId: tableId.join(), |
|
|
|
|
userId: this.userId, |
|
|
|
|
userName: this.userName, |
|
|
|
|
createTime: '', |
|
|
|
|
orderNum: '', |
|
|
|
|
status: '', |
|
|
|
|
tableNum: tableId.length, |
|
|
|
|
updateTime: '', |
|
|
|
|
} |
|
|
|
|
if(this.id){ |
|
|
|
|
this.$post(this.api.updateProduct,data).then(res => { |
|
|
|
|
this.$message.success('新增成功') |
|
|
|
|
this.productVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}else{ |
|
|
|
|
this.$post(this.api.saveProduct,data).then(res => { |
|
|
|
|
this.$message.success('新增成功') |
|
|
|
|
this.productVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
configData(){ |
|
|
|
|
this.configVisible = true |
|
|
|
|
this.getConfigType() |
|
|
|
|
}, |
|
|
|
|
typeConfigClick(data,node){ |
|
|
|
|
this.categoryId = data.id |
|
|
|
|
this.getConfigTable() |
|
|
|
|
}, |
|
|
|
|
closeConfig(){ |
|
|
|
|
this.$refs.typeConfig.setCheckedNodes([]) |
|
|
|
|
}, |
|
|
|
|
getConfigType(){ |
|
|
|
|
this.$post(this.api.getTableByClassification).then(res => { |
|
|
|
|
res.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.children.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.children.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.isThird = true |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.typeConfigList = res |
|
|
|
|
if(res[0].children.length){ |
|
|
|
|
this.categoryId = res[0].children[0].id |
|
|
|
|
this.defaultActive = [res[0].children[0].id] |
|
|
|
|
}else{ |
|
|
|
|
this.categoryId = res[0].id |
|
|
|
|
this.defaultActive = [res[0].id] |
|
|
|
|
} |
|
|
|
|
this.getConfigTable() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
getConfigTable(){ |
|
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keywordConfig}&pageNum=${this.pageConfig}&pageSize=${this.pageSizeConfig}&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res => { |
|
|
|
|
this.listConfigData = res.list |
|
|
|
|
this.totalConfig = res.totalCount |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
initConfigData(){ |
|
|
|
|
this.pageConfig = 1 |
|
|
|
|
this.getConfigTable() |
|
|
|
|
}, |
|
|
|
|
handleCurrentConfigChange(){ |
|
|
|
|
this.pageConfig = val |
|
|
|
|
this.getConfigTable() |
|
|
|
|
}, |
|
|
|
|
previewConfig(row){ |
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
|
this.$post(`${this.api.saveRecord}?platformUserId=4&tableId=${row.id}&type=2&schoolId=1`).then(res => {}).catch(res => {}) |
|
|
|
|
let comment = res.comment |
|
|
|
|
let previewHead = [] |
|
|
|
|
comment.map(n => { |
|
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
|
}) |
|
|
|
|
this.previewHead = previewHead |
|
|
|
|
|
|
|
|
|
let data = res.data |
|
|
|
|
data.map(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])) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.previewData = data |
|
|
|
|
this.previewVisible = true |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
getTableId(list){ |
|
|
|
|
let checked = this.configChecked |
|
|
|
|
list.map(n => { |
|
|
|
|
if(n.children && n.children.length){ |
|
|
|
|
this.getTableId(n.children) |
|
|
|
|
if(checked.includes(n.originId) && n.children[0].name){ |
|
|
|
|
this.configCheckedTableId = [...this.configCheckedTableId,...n.children.map(n => n.id)] |
|
|
|
|
}else{ |
|
|
|
|
this.getTableId(n.children) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
confirmConfig(){ |
|
|
|
|
this.configChecked = this.$refs.typeConfig.getCheckedKeys().map(n => Number(n)) |
|
|
|
|
this.getTableId(this.typeList) |
|
|
|
|
let data = Array.from(new Set(this.configCheckedTableId)) |
|
|
|
|
// console.log(this.$refs.type.setCheckedNodes,Array.from(new Set(this.configCheckedTableId))) |
|
|
|
|
// setTimeout(() => { |
|
|
|
|
// this.$refs.type.setCheckedNodes(Array.from(new Set(this.configCheckedTableId))) |
|
|
|
|
// },500) |
|
|
|
|
this.configVisible = false |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
console.log(data,this.typeList) |
|
|
|
|
this.$refs.type.setCheckedNodes(data) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
|
|
|
|
|
/deep/.el-container{ |
|
|
|
|
.el-aside{ |
|
|
|
|
padding: 15px; |
|
|
|
|
background-color: #fff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |