|
|
@ -2,7 +2,7 @@ |
|
|
|
<div class="wrap"> |
|
|
|
<div class="wrap"> |
|
|
|
<div class="side"> |
|
|
|
<div class="side"> |
|
|
|
<org ref="tree" |
|
|
|
<org ref="tree" |
|
|
|
@initData="initData" |
|
|
|
@initData="catetoryClick" |
|
|
|
@getData="getData"></org> |
|
|
|
@getData="getData"></org> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -83,7 +83,8 @@ |
|
|
|
@click="edit(scope.row)">编辑</el-button> |
|
|
|
@click="edit(scope.row)">编辑</el-button> |
|
|
|
<el-button type="text" |
|
|
|
<el-button type="text" |
|
|
|
@click="del(scope.row)">删除</el-button> |
|
|
|
@click="del(scope.row)">删除</el-button> |
|
|
|
<el-button type="text" |
|
|
|
<el-button v-if="isSchool" |
|
|
|
|
|
|
|
type="text" |
|
|
|
@click="copy(scope.row)">复制</el-button> |
|
|
|
@click="copy(scope.row)">复制</el-button> |
|
|
|
<el-switch v-if="scope.row.postStatus" |
|
|
|
<el-switch v-if="scope.row.postStatus" |
|
|
|
v-model="scope.row.ztOpen" |
|
|
|
v-model="scope.row.ztOpen" |
|
|
@ -116,7 +117,7 @@ |
|
|
|
style="width: 280px"></el-input> |
|
|
|
style="width: 280px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="模型分类"> |
|
|
|
<el-form-item label="模型分类"> |
|
|
|
<el-cascader :options="categoryList" |
|
|
|
<el-cascader :options="categories" |
|
|
|
v-model="categoryIdCus" |
|
|
|
v-model="categoryIdCus" |
|
|
|
:props="categoryProps" |
|
|
|
:props="categoryProps" |
|
|
|
clearable |
|
|
|
clearable |
|
|
@ -135,9 +136,11 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import org from "./sourceType" |
|
|
|
import org from "./sourceType" |
|
|
|
|
|
|
|
import Setting from '@/setting' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data () { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
isTopLevel: true, // 是否是在顶级分类 |
|
|
|
isTopLevel: true, // 是否是在顶级分类 |
|
|
|
listData: [], |
|
|
|
listData: [], |
|
|
|
keyword: "", |
|
|
|
keyword: "", |
|
|
@ -154,7 +157,9 @@ export default { |
|
|
|
label: 'categoryName', |
|
|
|
label: 'categoryName', |
|
|
|
value: 'id' |
|
|
|
value: 'id' |
|
|
|
}, |
|
|
|
}, |
|
|
|
timer: null |
|
|
|
timer: null, |
|
|
|
|
|
|
|
isSchool: 0, |
|
|
|
|
|
|
|
categories: [] |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
components: { |
|
|
|
components: { |
|
|
@ -175,31 +180,44 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 获取列表 |
|
|
|
// 获取列表 |
|
|
|
async getList (school) { |
|
|
|
async getList () { |
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() || {}// 获取当前选中的分类 |
|
|
|
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() || {}// 获取当前选中的分类 |
|
|
|
this.isTopLevel = !curNode.level |
|
|
|
this.isTopLevel = !curNode.level |
|
|
|
// 如果是首级,要调另一个接口 |
|
|
|
// 如果是首级,要调另一个接口 |
|
|
|
const { data } = await this.$post(this.api[school ? 'InstitutionSourceModel' : !curNode.level ? 'getAllModelListBySys' : 'sysModelDemoList'], { |
|
|
|
const { data } = await this.$post(this.api[this.isSchool ? 'InstitutionSourceModel' : !curNode.level ? 'getAllModelListBySys' : 'sysModelDemoList'], { |
|
|
|
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: school ? 1 : 0 |
|
|
|
founder: this.isSchool ? 1 : 0 |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.listData = data.records |
|
|
|
this.listData = data.records |
|
|
|
this.total = data.total |
|
|
|
this.total = data.total |
|
|
|
}, |
|
|
|
}, |
|
|
|
getData (school) { |
|
|
|
getData () { |
|
|
|
clearInterval(this.timer) |
|
|
|
clearInterval(this.timer) |
|
|
|
this.getList(school) |
|
|
|
this.getList() |
|
|
|
// this.timer = setInterval(() => { |
|
|
|
if (!Setting.isDev) { |
|
|
|
// this.getList(school) |
|
|
|
this.timer = setInterval(this.getRedis, 1000) |
|
|
|
// }, 1000) |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
initData (school) { |
|
|
|
// 获取redis缓存 |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
getRedis () { |
|
|
|
|
|
|
|
this.$post(this.api.modelRedis).then(({ data }) => { |
|
|
|
|
|
|
|
if (data) { |
|
|
|
|
|
|
|
localStorage.getItem('modelNakadai') !== data && this.getList() // 本地缓存跟redis返回的不一样,就查询列表 |
|
|
|
|
|
|
|
localStorage.setItem('modelNakadai', data) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => { }) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 分类点击回调 |
|
|
|
|
|
|
|
catetoryClick (school) { |
|
|
|
|
|
|
|
this.isSchool = school |
|
|
|
|
|
|
|
this.initData() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
initData () { |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.getData(school) |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 新增 |
|
|
|
// 新增 |
|
|
|
add () { |
|
|
|
add () { |
|
|
@ -232,28 +250,23 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 复制 |
|
|
|
// 复制 |
|
|
|
copy (row) { |
|
|
|
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.curRow = JSON.parse(JSON.stringify(row)) |
|
|
|
this.copyVisible = true |
|
|
|
this.copyVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 复制提交 |
|
|
|
// 复制提交 |
|
|
|
copySubmit () { |
|
|
|
async copySubmit () { |
|
|
|
|
|
|
|
const ids = this.categoryIdCus |
|
|
|
|
|
|
|
const row = this.curRow |
|
|
|
|
|
|
|
if (!row.modelName) return this.$message.error('请输入模型名称!') |
|
|
|
|
|
|
|
if (!ids.length) return this.$message.error('请选择模型分类!') |
|
|
|
|
|
|
|
await this.$post(this.api.copyTheModelToTheNakadai, { |
|
|
|
|
|
|
|
beCopiedModelId: row.id, |
|
|
|
|
|
|
|
categoryId: ids[ids.length - 1], |
|
|
|
|
|
|
|
modelName: row.modelName, |
|
|
|
|
|
|
|
systemId: this.systemId |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.$message.success('复制成功!') |
|
|
|
|
|
|
|
this.copyVisible = false |
|
|
|
}, |
|
|
|
}, |
|
|
|
del (row) { |
|
|
|
del (row) { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|