|
|
|
@ -59,7 +59,7 @@ |
|
|
|
|
align="center"> |
|
|
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.row.schoolName || scope.row.modifyName }} |
|
|
|
|
{{ scope.row.schoolName || scope.row.modifyName }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="updateTime" |
|
|
|
@ -75,7 +75,7 @@ |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" |
|
|
|
|
width="230"> |
|
|
|
|
width="260"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" |
|
|
|
|
@click="show(scope.row)">查看</el-button> |
|
|
|
@ -83,12 +83,14 @@ |
|
|
|
|
@click="edit(scope.row)">编辑</el-button> |
|
|
|
|
<el-button type="text" |
|
|
|
|
@click="del(scope.row)">删除</el-button> |
|
|
|
|
<el-button type="text" |
|
|
|
|
@click="copy(scope.row)">复制</el-button> |
|
|
|
|
<el-switch v-if="scope.row.postStatus" |
|
|
|
|
v-model="scope.row.isOpen" |
|
|
|
|
v-model="scope.row.ztOpen" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1" |
|
|
|
|
style="margin: 0 10px 0 5px" |
|
|
|
|
:active-text="scope.row.isOpen ? '禁用' : '启用'" |
|
|
|
|
:active-text="scope.row.ztOpen ? '禁用' : '启用'" |
|
|
|
|
@change="switchOff($event,scope.row,scope.$index)"></el-switch> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -101,6 +103,34 @@ |
|
|
|
|
:total="total"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="复制" |
|
|
|
|
:visible.sync="copyVisible" |
|
|
|
|
width="400px" |
|
|
|
|
center |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<el-form label-position="left"> |
|
|
|
|
<el-form-item label="模型名称"> |
|
|
|
|
<el-input placeholder="请输入模型名称" |
|
|
|
|
v-model="curRow.modelName" |
|
|
|
|
style="width: 280px"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="模型分类"> |
|
|
|
|
<el-cascader :options="categoryList" |
|
|
|
|
v-model="categoryIdCus" |
|
|
|
|
:props="categoryProps" |
|
|
|
|
clearable |
|
|
|
|
style="width: 280px"> |
|
|
|
|
</el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<el-button @click="copyVisible = false">取 消</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="copySubmit">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
@ -114,7 +144,17 @@ export default { |
|
|
|
|
page: +this.$route.query.page || 1, |
|
|
|
|
pageSize: 10, |
|
|
|
|
total: 0, |
|
|
|
|
multipleSelection: [] |
|
|
|
|
multipleSelection: [], |
|
|
|
|
copyVisible: false, |
|
|
|
|
curRow: {}, |
|
|
|
|
categoryIdCus: [], |
|
|
|
|
categoryList: [], |
|
|
|
|
categoryProps: { |
|
|
|
|
checkStrictly: true, |
|
|
|
|
label: 'categoryName', |
|
|
|
|
value: 'id' |
|
|
|
|
}, |
|
|
|
|
timer: null |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -129,12 +169,14 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
|
|
|
|
|
this.$once('hook:beforeDestroy', function () { |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取列表 |
|
|
|
|
async getData (school) { |
|
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // 获取当前选中的分类 |
|
|
|
|
async getList (school) { |
|
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() || {}// 获取当前选中的分类 |
|
|
|
|
this.isTopLevel = !curNode.level |
|
|
|
|
// 如果是首级,要调另一个接口 |
|
|
|
|
const { data } = await this.$post(this.api[school ? 'InstitutionSourceModel' : !curNode.level ? 'getAllModelListBySys' : 'sysModelDemoList'], { |
|
|
|
@ -142,11 +184,18 @@ export default { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
categoryId: curNode.id, |
|
|
|
|
founder: 0 |
|
|
|
|
founder: school ? 1 : 0 |
|
|
|
|
}) |
|
|
|
|
this.listData = data.records |
|
|
|
|
this.total = data.total |
|
|
|
|
}, |
|
|
|
|
getData (school) { |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
this.getList(school) |
|
|
|
|
// this.timer = setInterval(() => { |
|
|
|
|
// this.getList(school) |
|
|
|
|
// }, 1000) |
|
|
|
|
}, |
|
|
|
|
initData (school) { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
this.page = 1 |
|
|
|
@ -173,24 +222,6 @@ export default { |
|
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 批量禁用启用 |
|
|
|
|
batchOff (isOpen) { |
|
|
|
|
const off = isOpen === 0 |
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
|
// 批量删除 |
|
|
|
|
let ids = this.multipleSelection.map(e => e.id) |
|
|
|
|
this.$confirm(`确定要${off ? '启用' : '禁用'}吗?`, "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.bulkDisable}?isOpen=${isOpen}`, ids).then(res => { |
|
|
|
|
this.$message.success(`${off ? '启用' : '禁用'}成功`) |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} else { |
|
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 查看 |
|
|
|
|
show (row) { |
|
|
|
|
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1`) |
|
|
|
@ -198,6 +229,31 @@ export default { |
|
|
|
|
// 编辑 |
|
|
|
|
edit (row) { |
|
|
|
|
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&postStatus=${row.postStatus}`) |
|
|
|
|
}, |
|
|
|
|
// 复制 |
|
|
|
|
copy (row) { |
|
|
|
|
this.$post(this.api.sourceModelClassification + '?founder=0').then(res => { |
|
|
|
|
const { data } = res |
|
|
|
|
// 没有子级,删除children属性 |
|
|
|
|
const handleLeaf = list => { |
|
|
|
|
list.map(e => { |
|
|
|
|
if (e.children.length) { |
|
|
|
|
handleLeaf(e.children) |
|
|
|
|
} else { |
|
|
|
|
delete e.children |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
handleLeaf(data) |
|
|
|
|
this.categoryList = data[0].children |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
|
|
|
|
|
this.curRow = JSON.parse(JSON.stringify(row)) |
|
|
|
|
this.copyVisible = true |
|
|
|
|
}, |
|
|
|
|
// 复制提交 |
|
|
|
|
copySubmit () { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
del (row) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
@ -209,8 +265,39 @@ export default { |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 批量禁用启用 |
|
|
|
|
batchOff (ztOpen) { |
|
|
|
|
const off = ztOpen === 0 |
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
|
// 批量删除 |
|
|
|
|
let list = [] |
|
|
|
|
this.multipleSelection.map(e => { |
|
|
|
|
list.push({ |
|
|
|
|
isOpen: ztOpen, |
|
|
|
|
modelId: e.id, |
|
|
|
|
type: 0 |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.$confirm(`确定要${off ? '启用' : '禁用'}吗?`, "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(this.api.disableModelDemo, list).then(res => { |
|
|
|
|
this.$message.success(`${off ? '启用' : '禁用'}成功`) |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} else { |
|
|
|
|
this.$message.error("请先选择模型 !") |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 禁用 |
|
|
|
|
switchOff (val, row, index) { |
|
|
|
|
this.$post(`${this.api.bulkDisable}?isOpen=${val}`, [row.id]).then(res => { |
|
|
|
|
this.$post(this.api.disableModelDemo, [{ |
|
|
|
|
isOpen: val, |
|
|
|
|
modelId: row.id, |
|
|
|
|
type: 0 |
|
|
|
|
}]).then(res => { |
|
|
|
|
this.$message.success(val ? '禁用成功' : '启用成功') |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|