2024-08-30 17:03:25 +08:00
|
|
|
<template>
|
|
|
|
<TableProMax
|
|
|
|
ref="tableRef"
|
|
|
|
:request-api="reqApi"
|
|
|
|
:columns="columns"
|
|
|
|
:searchFormOptions="searchFormOptions"
|
|
|
|
>
|
|
|
|
|
|
|
|
</TableProMax>
|
|
|
|
</template>
|
|
|
|
|
2024-09-02 11:48:12 +08:00
|
|
|
<script setup lang="tsx">
|
2024-08-30 17:03:25 +08:00
|
|
|
import TableProMax from "@/components/table/TableProMax.vue";
|
|
|
|
import {ref} from "vue";
|
|
|
|
import {ComponentExposed} from "vue-component-type-helpers";
|
|
|
|
import {TableProMaxProps} from "@/types/components/table";
|
|
|
|
import {PoliceUnitPagerQueryParams, PoliceUnitPagerVo} from "@/types/views/unitManage/policeUnit.ts";
|
|
|
|
import api from "@/axios";
|
|
|
|
import {enumSelectNodes} from "@/config/dict.ts";
|
2024-09-02 11:48:12 +08:00
|
|
|
import {message} from "ant-design-vue";
|
2024-08-30 17:03:25 +08:00
|
|
|
|
|
|
|
type TableProps = TableProMaxProps<PoliceUnitPagerVo, PoliceUnitPagerQueryParams>
|
|
|
|
|
|
|
|
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
|
|
|
|
const reqApi: TableProps['requestApi'] = (params) => api.post('/policeUnit/pager', params)
|
|
|
|
const columns: TableProps['columns'] = [
|
|
|
|
{
|
|
|
|
dataIndex: 'name',
|
|
|
|
title: '名称'
|
|
|
|
}, {
|
|
|
|
dataIndex: 'code',
|
|
|
|
title: '代码'
|
|
|
|
}, {
|
2024-09-02 11:48:12 +08:00
|
|
|
dataIndex: 'contactPersonInfo',
|
|
|
|
title: '联系人',
|
|
|
|
customRender({record}) {
|
|
|
|
return record.contactPersonInfo?.name + "/" + record.contactPersonInfo?.telephone
|
|
|
|
},
|
2024-08-30 17:03:25 +08:00
|
|
|
}, {
|
|
|
|
dataIndex: 'provinceName',
|
|
|
|
title: '行政区划',
|
|
|
|
customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join('/')
|
|
|
|
}, {
|
|
|
|
dataIndex: 'isEnable',
|
2024-09-02 11:48:12 +08:00
|
|
|
title: '是否启用',
|
|
|
|
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
|
2024-08-30 17:03:25 +08:00
|
|
|
}, {
|
|
|
|
dataIndex: 'checkStatus',
|
2024-09-02 11:48:12 +08:00
|
|
|
title: '审核状态',
|
|
|
|
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
|
2024-08-30 17:03:25 +08:00
|
|
|
}, {
|
|
|
|
dataIndex: 'createTime',
|
|
|
|
title: '创建时间'
|
2024-09-02 11:48:12 +08:00
|
|
|
}, {
|
|
|
|
dataIndex: 'opt',
|
|
|
|
title: '操作',
|
|
|
|
customRender({record}) {
|
|
|
|
return <a-space>
|
|
|
|
{record.checkStatus.value === 1 && <a-popconfirm
|
|
|
|
title="确认审核通过嘛?"
|
|
|
|
onConfirm={async () => {
|
|
|
|
const resp = await api.post('/management/checkPass', {
|
|
|
|
checkDataId: record.snowFlakeId,
|
|
|
|
unitOptType: 'POLICE_UNIT'
|
|
|
|
})
|
|
|
|
message.success(resp.message)
|
|
|
|
await tableRef.value?.requestGetTableData()
|
|
|
|
}}>
|
|
|
|
<a-button type="primary">审核通过
|
|
|
|
</a-button>
|
|
|
|
</a-popconfirm>
|
|
|
|
}
|
|
|
|
{record.isEnable.value === 0 ? <a-button danger>禁用</a-button> : <a-button>启用</a-button>}
|
|
|
|
</a-space>
|
|
|
|
},
|
2024-08-30 17:03:25 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
const searchFormOptions: TableProps["searchFormOptions"] = {
|
|
|
|
name: {
|
|
|
|
type: 'input',
|
|
|
|
label: '名称'
|
|
|
|
}, code: {
|
|
|
|
type: 'input',
|
|
|
|
label: '代码'
|
|
|
|
}, isEnable: {
|
|
|
|
type: 'select',
|
|
|
|
label: '是否启用',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
value: null,
|
|
|
|
label: '全部'
|
|
|
|
}, ...enumSelectNodes('IsEnable')
|
|
|
|
]
|
|
|
|
}, checkStatus: {
|
|
|
|
type: 'select',
|
|
|
|
label: '审核状态',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
value: null,
|
|
|
|
label: '全部'
|
|
|
|
}, ...enumSelectNodes('CheckStatus')
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
|
|
</style>
|