|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="wrap"> |
|
|
|
|
<div class="side"> |
|
|
|
|
<org ref="org"></org> |
|
|
|
|
<org ref="tree" @initData="initData"></org> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="right"> |
|
|
|
@ -21,12 +21,16 @@ |
|
|
|
|
<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="userName" label="模型名称" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="account" label="导入时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="workNumber" label="状态" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="modelName" label="模型名称" 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="showTeacher(scope.row)">查看</el-button> |
|
|
|
|
<el-button type="text" @click="show(scope.row)">查看</el-button> |
|
|
|
|
<el-button type="text" @click="del(scope.row)">移除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -39,13 +43,14 @@ |
|
|
|
|
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
<el-tree |
|
|
|
|
:data="modelData" |
|
|
|
|
ref="tree" |
|
|
|
|
ref="model" |
|
|
|
|
default-expand-all |
|
|
|
|
show-checkbox |
|
|
|
|
:check-strictly="true" |
|
|
|
|
node-key="id"> |
|
|
|
|
node-key="id" |
|
|
|
|
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> |
|
|
|
|
</el-tree> |
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button @click="modelVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
@ -57,6 +62,7 @@ import org from "./modelType" |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
|
listData: [], |
|
|
|
|
keyword: '', |
|
|
|
|
page: 1, |
|
|
|
@ -64,56 +70,7 @@ export default { |
|
|
|
|
total: 0, |
|
|
|
|
multipleSelection: [], |
|
|
|
|
modelVisible: false, |
|
|
|
|
modelData: [ |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
label: '品牌一', |
|
|
|
|
children: [ |
|
|
|
|
{ |
|
|
|
|
id: 4, |
|
|
|
|
label: '华东区域', |
|
|
|
|
children: [ |
|
|
|
|
{ |
|
|
|
|
id: 9, |
|
|
|
|
label: '上海' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 10, |
|
|
|
|
label: '昆山' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
label: '品牌二', |
|
|
|
|
children: [ |
|
|
|
|
{ |
|
|
|
|
id: 5, |
|
|
|
|
label: '华东区域' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 6, |
|
|
|
|
label: '华南区域' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 3, |
|
|
|
|
label: '品牌三', |
|
|
|
|
children: [ |
|
|
|
|
{ |
|
|
|
|
id: 7, |
|
|
|
|
label: '华北区域' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 8, |
|
|
|
|
label: '华南区域' |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
modelData: [] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -130,17 +87,15 @@ export default { |
|
|
|
|
mounted() {}, |
|
|
|
|
methods: { |
|
|
|
|
getData() { |
|
|
|
|
let data = { |
|
|
|
|
keyWord: this.keyword, |
|
|
|
|
this.$post(this.api.referenceDemoList, { |
|
|
|
|
modelName: this.keyword, |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
staffArchitectureId: this.staffArchitectureId, |
|
|
|
|
gradeId: this.gradeId |
|
|
|
|
}; |
|
|
|
|
this.$post(this.api.staffList, data).then(res => { |
|
|
|
|
this.listData = res.page.records; |
|
|
|
|
this.total = res.page.total; |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
categoryId: this.$refs.tree.$refs.tree.getCurrentKey() |
|
|
|
|
}).then(res => { |
|
|
|
|
this.listData = res.data.records |
|
|
|
|
this.total = res.data.total |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
initData() { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
@ -150,21 +105,55 @@ export default { |
|
|
|
|
// 导入模型 |
|
|
|
|
add() { |
|
|
|
|
this.modelVisible = true |
|
|
|
|
// 查询源模型分类 |
|
|
|
|
this.$post(this.api.sourceModelClassification).then(res => { |
|
|
|
|
const { data } = res |
|
|
|
|
const promises = [] |
|
|
|
|
const addType = list => { |
|
|
|
|
list.map(e => { |
|
|
|
|
// 用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 |
|
|
|
|
records.map(n => { |
|
|
|
|
n.categoryName = n.modelName |
|
|
|
|
}) |
|
|
|
|
e.children = [...e.children, ...records] |
|
|
|
|
// console.log(11, e) |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
})) |
|
|
|
|
e.children && e.children.length && addType(e.children) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
addType(data) |
|
|
|
|
// debugger |
|
|
|
|
console.log(data, promises) |
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|
this.modelData = data |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 查看模型 |
|
|
|
|
show(row) { |
|
|
|
|
this.modelVisible = true |
|
|
|
|
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.delStaff}?accountIds=${row.accountId}`).then(res => { |
|
|
|
|
this.$message.success("删除成功"); |
|
|
|
|
this.getData(); |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}).catch(() => {}); |
|
|
|
|
this.$post(this.api.deleteReferenceDemo, [row.id]).then(res => { |
|
|
|
|
this.$message.success("删除成功") |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange(val) { |
|
|
|
|
this.multipleSelection = val |
|
|
|
@ -175,20 +164,15 @@ export default { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
let ids = this.multipleSelection.map(item => { |
|
|
|
|
return item.accountId; |
|
|
|
|
}); |
|
|
|
|
this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => { |
|
|
|
|
this.multipleSelection = []; |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
this.$message.success("删除成功"); |
|
|
|
|
this.getData(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
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("请先选择模型 !"); |
|
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
@ -197,7 +181,21 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 导入模型提交 |
|
|
|
|
submit() { |
|
|
|
|
|
|
|
|
|
const data = [] |
|
|
|
|
const systemId = this.systemId |
|
|
|
|
const list = this.$refs.model.getCheckedNodes() |
|
|
|
|
const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() // 获取当前分类 |
|
|
|
|
list.map(e => { |
|
|
|
|
data.push({ |
|
|
|
|
systemId, |
|
|
|
|
categoryId, |
|
|
|
|
copyId: e.id |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.$post(this.api.saveReferenceDemo, data).then(res => { |
|
|
|
|
this.modelVisible = false |
|
|
|
|
this.initData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|