|
|
|
@ -1,281 +1,327 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="wrap"> |
|
|
|
|
<div class="side"> |
|
|
|
|
<org ref="tree" @initData="initData" @getData="getData"></org> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="right"> |
|
|
|
|
<h6 class="p-title">筛选</h6> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li> |
|
|
|
|
<el-input placeholder="请输入模型名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" round @click="add">导入模型</el-button> |
|
|
|
|
<el-button type="primary" round @click="batchDel">批量移除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="wrap"> |
|
|
|
|
<div class="side"> |
|
|
|
|
<org ref="tree" |
|
|
|
|
@initData="initData" |
|
|
|
|
@getData="getData"></org> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> |
|
|
|
|
<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"> |
|
|
|
|
{{ scope.row.isOpen ? '禁用' : '启用' }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" width="200" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="show(scope.row)">查看</el-button> |
|
|
|
|
<el-button type="text" @click="del(scope.row)">移除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total, prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
<div class="right"> |
|
|
|
|
<h6 class="p-title">筛选</h6> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li> |
|
|
|
|
<el-input placeholder="请输入模型名称" |
|
|
|
|
prefix-icon="el-icon-search" |
|
|
|
|
v-model.trim="keyword" |
|
|
|
|
clearable></el-input> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
round |
|
|
|
|
@click="add">导入模型</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
round |
|
|
|
|
@click="batchDel">批量移除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
<div class="model-wrap"> |
|
|
|
|
<el-tree |
|
|
|
|
v-if="modelData.length" |
|
|
|
|
:data="modelData" v-loading="modelLoading" |
|
|
|
|
ref="model" |
|
|
|
|
default-expand-all |
|
|
|
|
show-checkbox |
|
|
|
|
node-key="id" |
|
|
|
|
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> |
|
|
|
|
</el-tree> |
|
|
|
|
<div class="none" v-else>暂无可导入的模型</div> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="modelVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<el-table :data="listData" |
|
|
|
|
class="table" |
|
|
|
|
ref="table" |
|
|
|
|
stripe |
|
|
|
|
header-align="center" |
|
|
|
|
@selection-change="handleSelectionChange"> |
|
|
|
|
<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"> |
|
|
|
|
{{ scope.row.isOpen ? '禁用' : '启用' }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" |
|
|
|
|
width="200" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" |
|
|
|
|
@click="show(scope.row)">查看</el-button> |
|
|
|
|
<el-button type="text" |
|
|
|
|
@click="del(scope.row)">移除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background |
|
|
|
|
layout="total, prev, pager, next" |
|
|
|
|
:current-page="page" |
|
|
|
|
@current-change="handleCurrentChange" |
|
|
|
|
:total="total"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="请选择需要导入的模型" |
|
|
|
|
:visible.sync="modelVisible" |
|
|
|
|
width="500px" |
|
|
|
|
class="dialog" |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<div class="model-wrap"> |
|
|
|
|
<el-tree v-if="modelData.length" |
|
|
|
|
:data="modelData" |
|
|
|
|
v-loading="modelLoading" |
|
|
|
|
ref="model" |
|
|
|
|
default-expand-all |
|
|
|
|
show-checkbox |
|
|
|
|
node-key="id" |
|
|
|
|
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> |
|
|
|
|
</el-tree> |
|
|
|
|
<div class="none" |
|
|
|
|
v-else>暂无可导入的模型</div> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<el-button @click="modelVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="submit">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import org from "./modelType" |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
|
isTopLevel: true, // 是否是在顶级分类 |
|
|
|
|
listData: [], |
|
|
|
|
keyword: '', |
|
|
|
|
page: +this.$route.query.page || 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
total: 0, |
|
|
|
|
multipleSelection: [], |
|
|
|
|
modelVisible: false, |
|
|
|
|
modelLoading: false, |
|
|
|
|
modelData: [], |
|
|
|
|
submiting: false |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
|
org |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
|
isTopLevel: true, // 是否是在顶级分类 |
|
|
|
|
listData: [], |
|
|
|
|
keyword: '', |
|
|
|
|
page: +this.$route.query.page || 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
total: 0, |
|
|
|
|
multipleSelection: [], |
|
|
|
|
modelVisible: false, |
|
|
|
|
modelLoading: false, |
|
|
|
|
modelData: [], |
|
|
|
|
submiting: false |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
|
org |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword: function (val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData() |
|
|
|
|
}, 500) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { }, |
|
|
|
|
methods: { |
|
|
|
|
getData () { |
|
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // 获取当前选中的分类 |
|
|
|
|
this.isTopLevel = !curNode.level && curNode.categoryName === '全部' |
|
|
|
|
// 如果是首级,要调另一个接口 |
|
|
|
|
if (this.isTopLevel) { |
|
|
|
|
this.$post(this.api.getAllModelList, { |
|
|
|
|
modelName: this.keyword, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
systemId: this.systemId |
|
|
|
|
}).then(res => { |
|
|
|
|
this.listData = res.data.records |
|
|
|
|
this.total = res.data.total |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.referenceDemoList, { |
|
|
|
|
modelName: this.keyword, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
categoryId: curNode.id, |
|
|
|
|
founder: 1 |
|
|
|
|
}).then(res => { |
|
|
|
|
this.listData = res.data.records |
|
|
|
|
this.total = res.data.total |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword: function(val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData() |
|
|
|
|
}, 500) |
|
|
|
|
} |
|
|
|
|
initData () { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
mounted() {}, |
|
|
|
|
methods: { |
|
|
|
|
getData() { |
|
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // 获取当前选中的分类 |
|
|
|
|
this.isTopLevel = !curNode.level && curNode.categoryName === '全部' |
|
|
|
|
// 如果是首级,要调另一个接口 |
|
|
|
|
if (this.isTopLevel) { |
|
|
|
|
this.$post(this.api.getAllModelList, { |
|
|
|
|
modelName: this.keyword, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
systemId: this.systemId |
|
|
|
|
}).then(res => { |
|
|
|
|
this.listData = res.data.records |
|
|
|
|
this.total = res.data.total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.referenceDemoList, { |
|
|
|
|
modelName: this.keyword, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
categoryId: curNode.id |
|
|
|
|
}).then(res => { |
|
|
|
|
this.listData = res.data.records |
|
|
|
|
this.total = res.data.total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
initData() { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
// 导入模型 |
|
|
|
|
add() { |
|
|
|
|
if (!this.$refs.tree.orgList.length) return this.$message.error('请先添加模型分类') |
|
|
|
|
if (this.isTopLevel) return this.$message.error('请选择子分类进入导入模型') |
|
|
|
|
this.modelVisible = true |
|
|
|
|
this.modelLoading = true |
|
|
|
|
// 获取模型列表,用以跟源模型列表作比对,重复的不再显示 |
|
|
|
|
this.$post(this.api.getAllModelList, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 10000, |
|
|
|
|
systemId: this.systemId |
|
|
|
|
}).then(res => { |
|
|
|
|
const modelList = res.data.records |
|
|
|
|
// 导入模型 |
|
|
|
|
add () { |
|
|
|
|
if (!this.$refs.tree.orgList.length) return this.$message.error('请先添加模型分类') |
|
|
|
|
if (this.isTopLevel) return this.$message.error('请选择子分类进入导入模型') |
|
|
|
|
this.modelVisible = true |
|
|
|
|
this.modelLoading = true |
|
|
|
|
// 获取模型列表,用以跟源模型列表作比对,重复的不再显示 |
|
|
|
|
this.$post(this.api.getAllModelList, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 10000, |
|
|
|
|
systemId: this.systemId |
|
|
|
|
}).then(res => { |
|
|
|
|
const modelList = res.data.records |
|
|
|
|
|
|
|
|
|
// 查询源模型分类 |
|
|
|
|
this.$post(this.api.sourceModelClassification).then(res => { |
|
|
|
|
let { data } = res |
|
|
|
|
const promises = [] |
|
|
|
|
const addType = list => { |
|
|
|
|
list.map((e, i) => { |
|
|
|
|
// 用promise储存以添加完后更新数据 |
|
|
|
|
promises.push(new Promise((resolve,reject) => { |
|
|
|
|
// 获取源模型列表 |
|
|
|
|
this.$post(this.api.sysModelDemoList, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 10000, |
|
|
|
|
categoryId: e.id |
|
|
|
|
}).then(res => { |
|
|
|
|
const { records } = res.data |
|
|
|
|
const modelChildren = [] |
|
|
|
|
// 判重,重复的模型不再显示,通过模型的copyId和源模型的id作比对 |
|
|
|
|
records.map(n => { |
|
|
|
|
if (!modelList.find(e => e.copyId === n.id)) { |
|
|
|
|
n.categoryName = n.modelName |
|
|
|
|
modelChildren.push(n) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 如果有未导入的模型,则添加到子级,否则设置为disabled |
|
|
|
|
if (modelChildren.length) { |
|
|
|
|
e.children = [...e.children, ...modelChildren] |
|
|
|
|
} else if (records.length) { |
|
|
|
|
e.disabled = true |
|
|
|
|
} |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
})) |
|
|
|
|
e.children && e.children.length && addType(e.children) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
addType(data) |
|
|
|
|
// 筛选出disabled不为true的分类,因为没有模型的分类不需要展示 |
|
|
|
|
const handleType = list => { |
|
|
|
|
return list.filter((e, i) => { |
|
|
|
|
return !e.disabled |
|
|
|
|
}).map(e => { |
|
|
|
|
if (e.children) { |
|
|
|
|
e.children = handleType(e.children) |
|
|
|
|
} |
|
|
|
|
return e |
|
|
|
|
}) |
|
|
|
|
// 查询源模型分类 |
|
|
|
|
this.$post(this.api.sourceModelClassification, { |
|
|
|
|
founder: 1 |
|
|
|
|
}).then(res => { |
|
|
|
|
let { data } = res |
|
|
|
|
const promises = [] |
|
|
|
|
const addType = list => { |
|
|
|
|
list.map((e, i) => { |
|
|
|
|
// 用promise储存以添加完后更新数据 |
|
|
|
|
promises.push(new Promise((resolve, reject) => { |
|
|
|
|
// 获取源模型列表 |
|
|
|
|
this.$post(this.api.sysModelDemoList, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 10000, |
|
|
|
|
categoryId: e.id |
|
|
|
|
}).then(res => { |
|
|
|
|
const { records } = res.data |
|
|
|
|
const modelChildren = [] |
|
|
|
|
// 判重,重复的模型不再显示,通过模型的copyId和源模型的id作比对 |
|
|
|
|
records.map(n => { |
|
|
|
|
if (!modelList.find(e => e.copyId === n.id)) { |
|
|
|
|
n.categoryName = n.modelName |
|
|
|
|
modelChildren.push(n) |
|
|
|
|
} |
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|
data = handleType(data) |
|
|
|
|
this.modelData = (data.length && data[0].children && data[0].children.length) ? data : [] |
|
|
|
|
this.modelLoading = false |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 把删除了的分类去除 |
|
|
|
|
|
|
|
|
|
// 查看模型 |
|
|
|
|
show(row) { |
|
|
|
|
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&model=1`) |
|
|
|
|
}, |
|
|
|
|
// 删除模型 |
|
|
|
|
del(row) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(this.api.deleteReferenceDemo, [row.id]).then(res => { |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange(val) { |
|
|
|
|
this.multipleSelection = val |
|
|
|
|
}, |
|
|
|
|
// 批量删除 |
|
|
|
|
batchDel() { |
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
let ids = this.multipleSelection.map(e => e.id) |
|
|
|
|
this.$post(this.api.deleteReferenceDemo, ids).then(res => { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
} else { |
|
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.page = val |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: 'backstage', |
|
|
|
|
query: { |
|
|
|
|
...this.$route.query, |
|
|
|
|
page: val |
|
|
|
|
}) |
|
|
|
|
// 如果有未导入的模型,则添加到子级,否则设置为disabled |
|
|
|
|
if (modelChildren.length) { |
|
|
|
|
e.children = [...e.children, ...modelChildren] |
|
|
|
|
} else if (records.length) { |
|
|
|
|
e.disabled = true |
|
|
|
|
} |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
})) |
|
|
|
|
e.children && e.children.length && addType(e.children) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
addType(data) |
|
|
|
|
// 筛选出disabled不为true的分类,因为没有模型的分类不需要展示 |
|
|
|
|
const handleType = list => { |
|
|
|
|
return list.filter((e, i) => { |
|
|
|
|
return !e.disabled |
|
|
|
|
}).map(e => { |
|
|
|
|
if (e.children) { |
|
|
|
|
e.children = handleType(e.children) |
|
|
|
|
} |
|
|
|
|
return e |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|
data = handleType(data) |
|
|
|
|
this.modelData = (data.length && data[0].children && data[0].children.length) ? data : [] |
|
|
|
|
this.modelLoading = false |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 把删除了的分类去除 |
|
|
|
|
|
|
|
|
|
// 查看模型 |
|
|
|
|
show (row) { |
|
|
|
|
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&model=1`) |
|
|
|
|
}, |
|
|
|
|
// 删除模型 |
|
|
|
|
del (row) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(this.api.deleteReferenceDemo, [row.id]).then(res => { |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange (val) { |
|
|
|
|
this.multipleSelection = val |
|
|
|
|
}, |
|
|
|
|
// 批量删除 |
|
|
|
|
batchDel () { |
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
let ids = this.multipleSelection.map(e => e.id) |
|
|
|
|
this.$post(this.api.deleteReferenceDemo, ids).then(res => { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
// 导入模型提交 |
|
|
|
|
submit() { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
const data = [] |
|
|
|
|
const systemId = this.systemId |
|
|
|
|
if (this.$refs.model) { |
|
|
|
|
const list = this.$refs.model.getCheckedNodes() // 获取选择的分类模型 |
|
|
|
|
const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() // 获取当前分类 |
|
|
|
|
if (!list.length) return this.$message.error('请选择模型') |
|
|
|
|
this.submiting = true |
|
|
|
|
list.map(e => { |
|
|
|
|
// 有categoryId的才是模型,只导入模型,不导入分类 |
|
|
|
|
e.categoryId && data.push({ |
|
|
|
|
systemId, |
|
|
|
|
categoryId, |
|
|
|
|
copyId: e.id |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.$post(this.api.saveReferenceDemo, data).then(res => { |
|
|
|
|
this.modelVisible = false |
|
|
|
|
this.initData() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}, 2000) |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.submiting = false |
|
|
|
|
this.modelVisible = false |
|
|
|
|
} |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} else { |
|
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange (val) { |
|
|
|
|
this.page = val |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: 'backstage', |
|
|
|
|
query: { |
|
|
|
|
...this.$route.query, |
|
|
|
|
page: val |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
// 导入模型提交 |
|
|
|
|
submit () { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
const data = [] |
|
|
|
|
const systemId = this.systemId |
|
|
|
|
if (this.$refs.model) { |
|
|
|
|
const list = this.$refs.model.getCheckedNodes() // 获取选择的分类模型 |
|
|
|
|
const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() // 获取当前分类 |
|
|
|
|
if (!list.length) return this.$message.error('请选择模型') |
|
|
|
|
this.submiting = true |
|
|
|
|
list.map(e => { |
|
|
|
|
// 有categoryId的才是模型,只导入模型,不导入分类 |
|
|
|
|
e.categoryId && data.push({ |
|
|
|
|
systemId, |
|
|
|
|
categoryId, |
|
|
|
|
copyId: e.id |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.$post(this.api.saveReferenceDemo, data).then(res => { |
|
|
|
|
this.modelVisible = false |
|
|
|
|
this.initData() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}, 2000) |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.submiting = false |
|
|
|
|
this.modelVisible = false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
<style lang="scss" scoped> |
|
|
|
@ -294,15 +340,15 @@ export default { |
|
|
|
|
padding: 24px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.el-input__inner{ |
|
|
|
|
.el-input__inner { |
|
|
|
|
height: 32px; |
|
|
|
|
} |
|
|
|
|
.model-wrap { |
|
|
|
|
max-height: 400px; |
|
|
|
|
overflow: auto; |
|
|
|
|
.none { |
|
|
|
|
text-align: center; |
|
|
|
|
color: #8b8b8b; |
|
|
|
|
} |
|
|
|
|
max-height: 400px; |
|
|
|
|
overflow: auto; |
|
|
|
|
.none { |
|
|
|
|
text-align: center; |
|
|
|
|
color: #8b8b8b; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |