标签管理样式完成

This commit is contained in:
aixianling
2022-04-19 15:36:41 +08:00
parent 31b3e6c670
commit 99e8432ea7

View File

@@ -0,0 +1,133 @@
<template>
<section class="AppResidentTags">
<ai-list>
<ai-title slot="title" title="标签管理" isShowBottomBorder/>
<template #content>
<ai-search-bar>
<template #left>
<el-button type="primary" icon="iconfont iconAdd" @click="dialog=true">添加
</el-button>
<el-button icon="iconfont iconDelete" @click="dialog=true">删除</el-button>
</template>
<template #right>
<el-input size="small" placeholder="标签信息/添加人" v-model="search.title" 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="dialogTitle" :visible.sync="dialog" width="600px" @closed="form={}" @onConfirm="submit">
<el-form ref="DialogForm" :model="form" :rules="rules" size="small" label-width="60px">
<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>
</ai-dialog>
</section>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "AppResidentTags",
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"}],
maxOrderNumber: [{required: true, message: "请输入抢单数量"}, {pattern: /^\d+$/, message: '请输入正整数'}],
}
},
dialogTitle() {
return `${this.form.id ? "编辑" : "添加"}标签`
}
},
data() {
return {
page: {current: 1, size: 10, total: 0},
dialog: false,
tableData: [],
search: {organizationName: ""},
form: {logoUrl: []},
colConfigs: [
{type: "selection"},
{label: "标签信息", prop: "organizationName"},
{label: "创建时间", prop: "createTime", align: '120px'},
{label: "创建人", prop: "createUserName", align: 'center'},
{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
}
})
},
//添加账号
submit() {
this.$refs.DialogForm.validate(v => {
if (v) {
let {form: {logoUrl: logo}} = this, logoUrl = logo?.[0]?.url
this.instance.post("/appfinancialorganization/addOrUpdate", {...this.form, logoUrl}).then(res => {
if (res?.code == 0) {
this.$message.success("提交成功!")
this.dialog = false
this.getTableData()
}
})
}
})
},
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.getTableData()
}
}
</script>
<style lang="scss" scoped>
.AppResidentTags {
height: 100%;
}
</style>