先提交一波

This commit is contained in:
aixianling
2023-03-27 18:03:05 +08:00
parent ac0baae856
commit e653f84891
3 changed files with 144 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<template>
<section class="AppDataModel">
<component :is="currentPage" v-bind="$props"/>
</section>
</template>
<script>
import DmAdd from "./dmAdd";
import DmList from "./dmList";
export default {
name: "AppDataModel",
components: {DmList, DmAdd},
label: "数据模型",
props: {
instance: Function,
dict: Object
},
computed: {
currentPage() {
let {hash} = this.$route
return hash == "#add" ? DmAdd : DmList
}
},
created() {
this.dict.load("detailType")
}
}
</script>
<style lang="scss" scoped>
.AppDataModel {
height: 100%;
& > section {
height: 100%;
}
}
</style>

View File

@@ -0,0 +1,22 @@
<template>
<section class="dmAdd">
</section>
</template>
<script>
export default {
name: "dmAdd",
data() {
return {}
},
methods: {},
created() {
}
}
</script>
<style lang="scss" scoped>
.dmAdd {
}
</style>

View File

@@ -0,0 +1,83 @@
<template>
<ai-list class="dmList">
<ai-title slot="title" :title="$options.label" isShowBottomBorder/>
<template #content>
<ai-search-bar>
<template #left>
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd">添加</el-button>
</template>
<template #right>
<el-input size="small" placeholder="搜索应用" v-model="search.name" clearable @change="page.current=1,getTableData()"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="page.current" :size.sync="page.size"
@getList="getTableData" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" label="操作" fixed="right" align="center" width="200">
<template slot-scope="{row}">
<el-button type="text" @click="handleAdd(row.id)">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import {confirm} from "dui/lib/js/decorator";
export default {
name: "dmList",
label: "数据模型",
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {name: ""},
page: {current: 1, size: 10},
total: 0,
tableData: [],
colConfigs: [
{label: "数据模型", prop: "name"},
{label: "模型别名", prop: "alias"},
]
}
},
methods: {
getTableData() {
this.instance.post("/node/aicode/list", null, {
params: {...this.page, ...this.search}
}).then(res => {
if (res?.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
handleAdd(id) {
this.$router.push({hash: "#add", query: {id}})
},
@confirm("是否要删除该模型?")
handleDelete(ids) {
this.instance.post("/node/aicode/delete", null, {
params: {ids}
}).then(res => {
if (res?.code == 0) {
this.$message.success("删除成功")
this.getTableData()
}
})
}
},
created() {
}
}
</script>
<style lang="scss" scoped>
.dmList {
height: 100%;
}
</style>