金融机构完成

This commit is contained in:
aixianling
2022-02-22 19:50:36 +08:00
parent 0a50030333
commit 3982ed8b04

View File

@@ -0,0 +1,142 @@
<template>
<section class="AppFinanceOrg">
<ai-list>
<ai-title slot="title" title="金融机构管理" isShowBottomBorder/>
<template #content>
<ai-search-bar>
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="dialog=true">添加
</el-button>
</template>
<template #right>
<el-input size="small" placeholder="金融机构名称" v-model="search.organizationName" clearable
@change="page.current=1,getTableData()"/>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
@getList="getTableData" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="options" align="center" label="操作" fixed="right" width="160px">
<el-row type="flex" justify="center" align="middle" slot-scope="{row}">
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button>
</el-row>
</el-table-column>
</ai-table>
</template>
</ai-list>
<ai-dialog title="添加机构" :visible.sync="dialog" width="600px" @closed="form={}" @onConfirm="submitAddAcount">
<el-form ref="addAccountForm" :model="form" :rules="rules" size="small"
label-width="120px">
<el-form-item required label="机构名称" prop="organizationName">
<el-input v-model.trim="form.organizationName" placeholder="请输入" clearable :maxLength="32" show-word-limit/>
</el-form-item>
<el-form-item required label="机构类型" prop="organizationType">
<ai-select v-model="form.organizationType" :selectList="dict.getDict('financialOrganizationType')"
placeholder="请选择"/>
</el-form-item>
<el-form-item label="行政地区" prop="logoUrl">
<ai-uploader v-model="form.logoUrl" :instance="instance" :limit="1"/>
</el-form-item>
</el-form>
</ai-dialog>
</section>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "AppFinanceOrg",
label: "金融机构管理",
props: {
instance: Function,
dict: Object,
permissions: Function
},
computed: {
...mapState(['user']),
rules() {
return {
organizationName: [{required: true, message: "请输入机构名称"}],
organizationType: [{required: true, message: "请选择机构类型"}],
logoUrl: [{required: true, message: "请上传logo"}],
}
},
},
data() {
return {
page: {current: 1, size: 10, total: 0},
dialog: false,
tableData: [],
search: {organizationName: ""},
form: {},
colConfigs: [
{label: "金融机构名称", prop: "organizationName"},
{label: "创建人", prop: "createUserName", align: 'center', width: "120px"},
{label: "创建时间", prop: "createTime", width: "120px", align: '120px'},
{slot: "options"}
]
}
},
methods: {
getTableData() {
this.instance.post("/appfinancialorganization/list", null, {
params: {...this.page, ...this.search}
}).then(res => {
if (res?.data) {
this.tableData = res.data?.records
this.page.total = res.data.total
}
})
},
//添加账号
submitAddAcount() {
this.$refs.addAccountForm.validate(v => {
if (v) {
let {form: {logoUrl}} = this
this.form.logoUrl = logoUrl?.[0]?.url
this.instance.post("/appfinancialorganization/addOrUpdate", form).then(res => {
if (res?.code == 0) {
this.$message.success("提交成功!")
this.dialog = false
}
})
}
})
},
handleEdit(row) {
this.dialog = true
this.form = JSON.parse(JSON.stringify(row))
this.form.logoUrl = [{url: row.logoUrl}]
},
handleDelete(ids) {
this.$confirm("是否要删除该机构?").then(() => {
this.instance.post("/appfinancialorganization/delete", null, {
params: {ids}
}).then(res => {
if (res?.code == 0) {
this.$message.success("删除成功!")
this.getTableData()
}
})
}).catch(() => 0)
}
},
created() {
this.dict.load('financialOrganizationType')
this.getTableData()
}
}
</script>
<style lang="scss" scoped>
.AppFinanceOrg {
height: 100%;
::v-deep .avatar {
width: 40px;
height: 40px;
margin-right: 10px;
}
}
</style>