|
|
@ -1,7 +1,9 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="wrap"> |
|
|
|
<div class="wrap"> |
|
|
|
<div class="side"> |
|
|
|
<div class="side"> |
|
|
|
<org ref="tree" @initData="initData" @getData="getData"></org> |
|
|
|
<org ref="tree" |
|
|
|
|
|
|
|
@initData="initData" |
|
|
|
|
|
|
|
@getData="getData"></org> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="right"> |
|
|
|
<div class="right"> |
|
|
@ -9,54 +11,95 @@ |
|
|
|
<div class="tool"> |
|
|
|
<div class="tool"> |
|
|
|
<ul class="filter"> |
|
|
|
<ul class="filter"> |
|
|
|
<li> |
|
|
|
<li> |
|
|
|
<el-input placeholder="请输入模型名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
|
|
|
<el-input placeholder="请输入模型名称" |
|
|
|
|
|
|
|
prefix-icon="el-icon-search" |
|
|
|
|
|
|
|
v-model.trim="keyword" |
|
|
|
|
|
|
|
clearable></el-input> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" round @click="add">导入模型</el-button> |
|
|
|
<el-button type="primary" |
|
|
|
<el-button type="primary" round @click="batchDel">批量移除</el-button> |
|
|
|
round |
|
|
|
|
|
|
|
@click="add">导入模型</el-button> |
|
|
|
|
|
|
|
<el-button type="primary" |
|
|
|
|
|
|
|
round |
|
|
|
|
|
|
|
@click="batchDel">批量移除</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> |
|
|
|
<el-table :data="listData" |
|
|
|
<el-table-column type="selection" width="55" align="center"></el-table-column> |
|
|
|
class="table" |
|
|
|
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column> |
|
|
|
ref="table" |
|
|
|
<el-table-column prop="modelName" label="模型名称" align="center"></el-table-column> |
|
|
|
stripe |
|
|
|
<el-table-column v-if="isTopLevel" prop="categoryName" label="分类" width="150" align="center"></el-table-column> |
|
|
|
header-align="center" |
|
|
|
<el-table-column prop="createTime" label="导入时间" align="center"></el-table-column> |
|
|
|
@selection-change="handleSelectionChange"> |
|
|
|
<el-table-column label="状态" align="center"> |
|
|
|
<el-table-column type="selection" |
|
|
|
|
|
|
|
width="55" |
|
|
|
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column type="index" |
|
|
|
|
|
|
|
label="序号" |
|
|
|
|
|
|
|
width="55" |
|
|
|
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="modelName" |
|
|
|
|
|
|
|
label="模型名称" |
|
|
|
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column v-if="isTopLevel" |
|
|
|
|
|
|
|
prop="categoryName" |
|
|
|
|
|
|
|
label="分类" |
|
|
|
|
|
|
|
width="150" |
|
|
|
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="createTime" |
|
|
|
|
|
|
|
label="导入时间" |
|
|
|
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="状态" |
|
|
|
|
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
{{ scope.row.isOpen ? '禁用' : '启用' }} |
|
|
|
{{ scope.row.isOpen ? '禁用' : '启用' }} |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" width="200" align="center"> |
|
|
|
<el-table-column label="操作" |
|
|
|
|
|
|
|
width="200" |
|
|
|
|
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="text" @click="show(scope.row)">查看</el-button> |
|
|
|
<el-button type="text" |
|
|
|
<el-button type="text" @click="del(scope.row)">移除</el-button> |
|
|
|
@click="show(scope.row)">查看</el-button> |
|
|
|
|
|
|
|
<el-button type="text" |
|
|
|
|
|
|
|
@click="del(scope.row)">移除</el-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-table> |
|
|
|
<div class="pagination"> |
|
|
|
<div class="pagination"> |
|
|
|
<el-pagination background layout="total, prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination> |
|
|
|
<el-pagination background |
|
|
|
|
|
|
|
layout="total, prev, pager, next" |
|
|
|
|
|
|
|
:current-page="page" |
|
|
|
|
|
|
|
@current-change="handleCurrentChange" |
|
|
|
|
|
|
|
:total="total"></el-pagination> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false"> |
|
|
|
<el-dialog title="请选择需要导入的模型" |
|
|
|
|
|
|
|
:visible.sync="modelVisible" |
|
|
|
|
|
|
|
width="500px" |
|
|
|
|
|
|
|
class="dialog" |
|
|
|
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
<div class="model-wrap"> |
|
|
|
<div class="model-wrap"> |
|
|
|
<el-tree |
|
|
|
<el-tree v-if="modelData.length" |
|
|
|
v-if="modelData.length" |
|
|
|
:data="modelData" |
|
|
|
:data="modelData" v-loading="modelLoading" |
|
|
|
v-loading="modelLoading" |
|
|
|
ref="model" |
|
|
|
ref="model" |
|
|
|
default-expand-all |
|
|
|
default-expand-all |
|
|
|
show-checkbox |
|
|
|
show-checkbox |
|
|
|
node-key="id" |
|
|
|
node-key="id" |
|
|
|
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> |
|
|
|
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> |
|
|
|
</el-tree> |
|
|
|
</el-tree> |
|
|
|
<div class="none" v-else>暂无可导入的模型</div> |
|
|
|
<div class="none" |
|
|
|
|
|
|
|
v-else>暂无可导入的模型</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<span slot="footer" |
|
|
|
|
|
|
|
class="dialog-footer"> |
|
|
|
<el-button @click="modelVisible = false">取 消</el-button> |
|
|
|
<el-button @click="modelVisible = false">取 消</el-button> |
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
<el-button type="primary" |
|
|
|
|
|
|
|
@click="submit">确 定</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -64,7 +107,7 @@ |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import org from "./modelType" |
|
|
|
import org from "./modelType" |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
isTopLevel: true, // 是否是在顶级分类 |
|
|
|
isTopLevel: true, // 是否是在顶级分类 |
|
|
@ -84,16 +127,16 @@ export default { |
|
|
|
org |
|
|
|
org |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
keyword: function(val) { |
|
|
|
keyword: function (val) { |
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.initData() |
|
|
|
this.initData() |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() {}, |
|
|
|
mounted () { }, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getData() { |
|
|
|
getData () { |
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // 获取当前选中的分类 |
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // 获取当前选中的分类 |
|
|
|
this.isTopLevel = !curNode.level && curNode.categoryName === '全部' |
|
|
|
this.isTopLevel = !curNode.level && curNode.categoryName === '全部' |
|
|
|
// 如果是首级,要调另一个接口 |
|
|
|
// 如果是首级,要调另一个接口 |
|
|
@ -106,26 +149,27 @@ export default { |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
this.listData = res.data.records |
|
|
|
this.listData = res.data.records |
|
|
|
this.total = res.data.total |
|
|
|
this.total = res.data.total |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$post(this.api.referenceDemoList, { |
|
|
|
this.$post(this.api.referenceDemoList, { |
|
|
|
modelName: this.keyword, |
|
|
|
modelName: this.keyword, |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
|
pageSize: this.pageSize, |
|
|
|
pageSize: this.pageSize, |
|
|
|
categoryId: curNode.id |
|
|
|
categoryId: curNode.id, |
|
|
|
|
|
|
|
founder: 0 |
|
|
|
}).then(res => { |
|
|
|
}).then(res => { |
|
|
|
this.listData = res.data.records |
|
|
|
this.listData = res.data.records |
|
|
|
this.total = res.data.total |
|
|
|
this.total = res.data.total |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
initData() { |
|
|
|
initData () { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 导入模型 |
|
|
|
// 导入模型 |
|
|
|
add() { |
|
|
|
add () { |
|
|
|
if (!this.$refs.tree.orgList.length) return this.$message.error('请先添加模型分类') |
|
|
|
if (!this.$refs.tree.orgList.length) return this.$message.error('请先添加模型分类') |
|
|
|
if (this.isTopLevel) return this.$message.error('请选择子分类进入导入模型') |
|
|
|
if (this.isTopLevel) return this.$message.error('请选择子分类进入导入模型') |
|
|
|
this.modelVisible = true |
|
|
|
this.modelVisible = true |
|
|
@ -145,7 +189,7 @@ export default { |
|
|
|
const addType = list => { |
|
|
|
const addType = list => { |
|
|
|
list.map((e, i) => { |
|
|
|
list.map((e, i) => { |
|
|
|
// 用promise储存以添加完后更新数据 |
|
|
|
// 用promise储存以添加完后更新数据 |
|
|
|
promises.push(new Promise((resolve,reject) => { |
|
|
|
promises.push(new Promise((resolve, reject) => { |
|
|
|
// 获取源模型列表 |
|
|
|
// 获取源模型列表 |
|
|
|
this.$post(this.api.sysModelDemoList, { |
|
|
|
this.$post(this.api.sysModelDemoList, { |
|
|
|
pageNum: 1, |
|
|
|
pageNum: 1, |
|
|
@ -191,32 +235,32 @@ export default { |
|
|
|
data = handleType(data) |
|
|
|
data = handleType(data) |
|
|
|
this.modelData = (data.length && data[0].children && data[0].children.length) ? data : [] |
|
|
|
this.modelData = (data.length && data[0].children && data[0].children.length) ? data : [] |
|
|
|
this.modelLoading = false |
|
|
|
this.modelLoading = false |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 把删除了的分类去除 |
|
|
|
// 把删除了的分类去除 |
|
|
|
|
|
|
|
|
|
|
|
// 查看模型 |
|
|
|
// 查看模型 |
|
|
|
show(row) { |
|
|
|
show (row) { |
|
|
|
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&model=1`) |
|
|
|
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&model=1`) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除模型 |
|
|
|
// 删除模型 |
|
|
|
del(row) { |
|
|
|
del (row) { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
this.$post(this.api.deleteReferenceDemo, [row.id]).then(res => { |
|
|
|
this.$post(this.api.deleteReferenceDemo, [row.id]).then(res => { |
|
|
|
this.$message.success("删除成功") |
|
|
|
this.$message.success("删除成功") |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleSelectionChange(val) { |
|
|
|
handleSelectionChange (val) { |
|
|
|
this.multipleSelection = val |
|
|
|
this.multipleSelection = val |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 批量删除 |
|
|
|
// 批量删除 |
|
|
|
batchDel() { |
|
|
|
batchDel () { |
|
|
|
if (this.multipleSelection.length) { |
|
|
|
if (this.multipleSelection.length) { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
@ -226,13 +270,13 @@ export default { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$message.success("删除成功") |
|
|
|
this.$message.success("删除成功") |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => { }) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleCurrentChange(val) { |
|
|
|
handleCurrentChange (val) { |
|
|
|
this.page = val |
|
|
|
this.page = val |
|
|
|
this.$router.push({ |
|
|
|
this.$router.push({ |
|
|
|
path: 'backstage', |
|
|
|
path: 'backstage', |
|
|
@ -244,7 +288,7 @@ export default { |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 导入模型提交 |
|
|
|
// 导入模型提交 |
|
|
|
submit() { |
|
|
|
submit () { |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.submiting) return false |
|
|
|
const data = [] |
|
|
|
const data = [] |
|
|
|
const systemId = this.systemId |
|
|
|
const systemId = this.systemId |
|
|
@ -294,7 +338,7 @@ export default { |
|
|
|
padding: 24px; |
|
|
|
padding: 24px; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.el-input__inner{ |
|
|
|
.el-input__inner { |
|
|
|
height: 32px; |
|
|
|
height: 32px; |
|
|
|
} |
|
|
|
} |
|
|
|
.model-wrap { |
|
|
|
.model-wrap { |
|
|
|