Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
e3febc2bb8
|
@ -1,7 +1,7 @@
|
|||
# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config
|
||||
TARO_APP_ID="wx0acd1c4fcf94bdd3"
|
||||
# TARO_APP_BASE_API="http://172.10.10.93:8765"
|
||||
TARO_APP_BASE_API="https://www.hnjinglian.cn:5678"
|
||||
TARO_APP_BASE_API="http://172.10.10.93:8765"
|
||||
# TARO_APP_BASE_API="https://www.hnjinglian.cn:5678"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
|
|||
// title: '加载中...',
|
||||
// mask: true,
|
||||
// })
|
||||
const res = await api.get<StarRating[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
|
||||
const res = await api.get<StarRating[]>(`/m2/sa/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
|
||||
|
||||
res.data?.forEach((item) => {
|
||||
item.currentScore = 0
|
||||
|
@ -203,7 +203,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
|
|||
const selectorCheckedType = ref<string>('')
|
||||
const selectorType = ref<CkProjectListByType[]>()
|
||||
const ckProjectListByType = async function (type) {
|
||||
const res = await api.get<CkProjectListByType[]>(`/assessmentCriteria/ckProjectListByType`, { type })
|
||||
const res = await api.get<CkProjectListByType[]>(`/m2/sa/ckProjectListByType`, { type })
|
||||
console.log(res.data)
|
||||
|
||||
if (res.data?.length === 0) {
|
||||
|
@ -326,7 +326,7 @@ const onSubmit = async function () {
|
|||
}
|
||||
Object.assign(assessmentRecordParams, _form)
|
||||
assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value]
|
||||
const result = await api.post('/assessmentCriteria/submitAssessmentRecord', assessmentRecordParams)
|
||||
const result = await api.post('/m2/sa/submitAssessmentRecord', assessmentRecordParams)
|
||||
|
||||
clearData() //清空数据
|
||||
if (result.code === 200) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,8 +28,9 @@
|
|||
"@amap/amap-jsapi-types": "^0.0.15",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^22.5.1",
|
||||
"@types/react": "^18.3.12",
|
||||
"@vitejs/plugin-vue": "^5.1.2",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.1.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.41",
|
||||
"tailwindcss": "^3.4.10",
|
||||
|
|
|
@ -81,6 +81,10 @@ export const staticRouter: RouteRecordRaw[] =
|
|||
keepalive: true
|
||||
},
|
||||
component: () => import('@/views/query/publicUnit.vue')
|
||||
// component: () => import('@/views/query/index.tsx')
|
||||
// component: () => import('@/views/query/EnterprisesUnit')
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
path: 'assessment-record', // 这里使用相对路径而不是 '/register'
|
||||
|
|
|
@ -1,103 +1,110 @@
|
|||
import api from "@/axios";
|
||||
import {AssessmentRecordPagerVo, DeductedDetailRes} from "@/types/views/assessmentRecord.ts";
|
||||
import {ColumnsType} from "ant-design-vue/es/table";
|
||||
import {Modal, Table} from "ant-design-vue";
|
||||
import api from '@/axios'
|
||||
import { AssessmentRecordPagerVo, DeductedDetailRes } from '@/types/views/assessmentRecord.ts'
|
||||
import { ColumnsType } from 'ant-design-vue/es/table'
|
||||
import { Modal, Table } from 'ant-design-vue'
|
||||
|
||||
export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo) => {
|
||||
const {data} = await api.get<DeductedDetailRes[]>('/assessmentRecord/deductedDetail', {assessmentRecordId: assessmentRecord.snowFlakeId})
|
||||
const groupRowSpan: Record<string, { firstIndex: number, count: number }> = {}
|
||||
const itemRowSpan: Record<string, { firstIndex: number, count: number }> = {}
|
||||
const { data } = await api.get<DeductedDetailRes[]>('/m1/ar/deductedDetail', { assessmentRecordId: assessmentRecord.snowFlakeId })
|
||||
const groupRowSpan: Record<string, { firstIndex: number; count: number }> = {}
|
||||
const itemRowSpan: Record<string, { firstIndex: number; count: number }> = {}
|
||||
|
||||
data.forEach((item, index) => {
|
||||
//如果第一次没有值
|
||||
if (item.ckGroupId) {
|
||||
if (!groupRowSpan[item.ckGroupId]) {
|
||||
groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index}
|
||||
} else {
|
||||
groupRowSpan[item.ckGroupId].count++;
|
||||
data[index].groupRowSpan = 0
|
||||
}
|
||||
data.forEach((item, index) => {
|
||||
//如果第一次没有值
|
||||
if (item.ckGroupId) {
|
||||
if (!groupRowSpan[item.ckGroupId]) {
|
||||
groupRowSpan[item.ckGroupId] = { count: 1, firstIndex: index }
|
||||
} else {
|
||||
groupRowSpan[item.ckGroupId].count++
|
||||
data[index].groupRowSpan = 0
|
||||
}
|
||||
}
|
||||
|
||||
if (item.ckItemId) {
|
||||
if (!itemRowSpan[item.ckItemId]) {
|
||||
itemRowSpan[item.ckItemId] = { count: 1, firstIndex: index }
|
||||
} else {
|
||||
itemRowSpan[item.ckItemId].count++
|
||||
data[index].itemRowSpan = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Object.values(groupRowSpan).forEach(({ count, firstIndex }) => {
|
||||
data[firstIndex].groupRowSpan = count
|
||||
})
|
||||
|
||||
Object.values(itemRowSpan).forEach(({ count, firstIndex }) => {
|
||||
data[firstIndex].itemRowSpan = count
|
||||
})
|
||||
|
||||
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
|
||||
{
|
||||
dataIndex: 'groupName',
|
||||
title: '考核分组',
|
||||
customCell: (_record) => {
|
||||
return {
|
||||
rowspan: _record.groupRowSpan,
|
||||
}
|
||||
|
||||
if (item.ckItemId) {
|
||||
if (!itemRowSpan[item.ckItemId]) {
|
||||
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index}
|
||||
} else {
|
||||
itemRowSpan[item.ckItemId].count++;
|
||||
data[index].itemRowSpan = 0
|
||||
}
|
||||
},
|
||||
customRender: ({ record: _record }) => {
|
||||
return (
|
||||
<div>
|
||||
<p>
|
||||
{_record.groupName}({_record.groupTotalScore})
|
||||
</p>
|
||||
<p>{_record.groupRemark}</p>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'itemName',
|
||||
title: '考核项',
|
||||
customCell: (_record) => {
|
||||
return {
|
||||
rowspan: _record.itemRowSpan,
|
||||
}
|
||||
})
|
||||
|
||||
Object.values(groupRowSpan).forEach(({count, firstIndex}) => {
|
||||
data[firstIndex].groupRowSpan = count;
|
||||
})
|
||||
|
||||
Object.values(itemRowSpan).forEach(({count, firstIndex}) => {
|
||||
data[firstIndex].itemRowSpan = count;
|
||||
})
|
||||
|
||||
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
|
||||
{
|
||||
dataIndex: 'groupName',
|
||||
title: '考核分组',
|
||||
customCell: (_record) => {
|
||||
return {
|
||||
rowspan: _record.groupRowSpan
|
||||
}
|
||||
},
|
||||
customRender: ({record: _record}) => {
|
||||
return <div>
|
||||
<p>{_record.groupName}({_record.groupTotalScore})</p>
|
||||
<p>{_record.groupRemark}</p>
|
||||
</div>
|
||||
}
|
||||
}, {
|
||||
dataIndex: 'itemName',
|
||||
title: '考核项',
|
||||
customCell: (_record) => {
|
||||
return {
|
||||
rowspan: _record.itemRowSpan
|
||||
}
|
||||
},
|
||||
customRender: ({record: _record}) => {
|
||||
if (!_record.ckItemId) {
|
||||
return '/'
|
||||
}
|
||||
return <div>
|
||||
<p>{_record.itemName}({_record.itemType?.label})
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
}, {
|
||||
dataIndex: 'standardName',
|
||||
title: '标准',
|
||||
customRender: ({record: _record}) => {
|
||||
if (!_record.ckStandardId) {
|
||||
return '/'
|
||||
}
|
||||
return <div>
|
||||
<p style={{color: _record.isSelected ? 'red' : ''}}>{_record.standardName}扣{_record.deductionPoints}分</p>
|
||||
</div>
|
||||
}
|
||||
},
|
||||
customRender: ({ record: _record }) => {
|
||||
if (!_record.ckItemId) {
|
||||
return '/'
|
||||
}
|
||||
]
|
||||
|
||||
Modal.info({
|
||||
title: `【${assessmentRecord.enterprisesUnitName}/${assessmentRecord.ckProjectName}】扣分详情`,
|
||||
icon: ' ',
|
||||
width: '80%',
|
||||
centered: true,
|
||||
content: () => <div style={{height: '80vh', overflow: 'auto'}}>
|
||||
<Table
|
||||
size="small"
|
||||
bordered
|
||||
pagination={false}
|
||||
class="margin-top-xs"
|
||||
columns={ckProjectDetailTableColumns}
|
||||
data-source={data}
|
||||
></Table>
|
||||
</div>
|
||||
})
|
||||
return (
|
||||
<div>
|
||||
<p>
|
||||
{_record.itemName}({_record.itemType?.label})
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'standardName',
|
||||
title: '标准',
|
||||
customRender: ({ record: _record }) => {
|
||||
if (!_record.ckStandardId) {
|
||||
return '/'
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<p style={{ color: _record.isSelected ? 'red' : '' }}>
|
||||
{_record.standardName}扣{_record.deductionPoints}分
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
Modal.info({
|
||||
title: `【${assessmentRecord.enterprisesUnitName}/${assessmentRecord.ckProjectName}】扣分详情`,
|
||||
icon: ' ',
|
||||
width: '80%',
|
||||
centered: true,
|
||||
content: () => (
|
||||
<div style={{ height: '80vh', overflow: 'auto' }}>
|
||||
<Table size='small' bordered pagination={false} class='margin-top-xs' columns={ckProjectDetailTableColumns} data-source={data}></Table>
|
||||
</div>
|
||||
),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,92 +1,102 @@
|
|||
<template>
|
||||
<div>
|
||||
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns">
|
||||
</TableProMax>
|
||||
</div>
|
||||
<div>
|
||||
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns"> </TableProMax>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import TableProMax from "@/components/table/TableProMax.vue";
|
||||
import api from "@/axios";
|
||||
import {TableProMaxProps} from "@/types/components/table";
|
||||
import {
|
||||
AssessmentRecordPagerQueryParams,
|
||||
AssessmentRecordPagerVo,
|
||||
} from "@/types/views/assessmentRecord.ts";
|
||||
import {ComponentExposed} from "vue-component-type-helpers";
|
||||
import { ref} from "vue";
|
||||
import {Modal} from "ant-design-vue";
|
||||
import {deductedDetail} from "@/views/query/assessmentIndex.tsx";
|
||||
import TableProMax from '@/components/table/TableProMax.vue'
|
||||
import api from '@/axios'
|
||||
import { TableProMaxProps } from '@/types/components/table'
|
||||
import { AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo } from '@/types/views/assessmentRecord.ts'
|
||||
import { ComponentExposed } from 'vue-component-type-helpers'
|
||||
import { ref } from 'vue'
|
||||
import { Modal } from 'ant-design-vue'
|
||||
import { deductedDetail } from '@/views/query/assessmentIndex.tsx'
|
||||
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
|
||||
type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams>
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/assessmentRecord/pager', params) //分页
|
||||
type TableProps = TableProMaxProps<AssessmentRecordPagerVo, AssessmentRecordPagerQueryParams>
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/m1/ar/pager', params) //分页
|
||||
const columns: TableProps['columns'] = [
|
||||
{
|
||||
dataIndex: 'enterprisesUnitName',
|
||||
title: '单位名称'
|
||||
}, {
|
||||
title: '单位名称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'type',
|
||||
title: '类型',
|
||||
customRender: ({text}) => text?.label
|
||||
}, {
|
||||
customRender: ({ text }) => text?.label,
|
||||
},
|
||||
{
|
||||
dataIndex: 'ckProjectName',
|
||||
title: '考核项目'
|
||||
}, {
|
||||
title: '考核项目',
|
||||
},
|
||||
{
|
||||
dataIndex: 'totalScore',
|
||||
title: '总分'
|
||||
}, {
|
||||
title: '总分',
|
||||
},
|
||||
{
|
||||
dataIndex: 'deductionPointsTotal',
|
||||
title: '扣分',
|
||||
customRender:({record})=>{
|
||||
customRender: ({ record }) => {
|
||||
if (!record.deductionPointsTotal) {
|
||||
return <a-tag color="green">0</a-tag>
|
||||
return <a-tag color='green'>0</a-tag>
|
||||
}
|
||||
return <a-tag class="pointer" color="red" onClick={()=>deductedDetail(record)}>{record.deductionPointsTotal}</a-tag>
|
||||
}
|
||||
}, {
|
||||
return (
|
||||
<a-tag class='pointer' color='red' onClick={() => deductedDetail(record)}>
|
||||
{record.deductionPointsTotal}
|
||||
</a-tag>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
dataIndex: 'result',
|
||||
title: '得分',
|
||||
customRender: ({record}) => record.totalScore - record.deductionPointsTotal
|
||||
}, {
|
||||
customRender: ({ record }) => record.totalScore - record.deductionPointsTotal,
|
||||
},
|
||||
{
|
||||
dataIndex: 'policeUnitName',
|
||||
title: '考核单位'
|
||||
}, {
|
||||
title: '考核单位',
|
||||
},
|
||||
{
|
||||
dataIndex: 'createUserName',
|
||||
title: '考核人'
|
||||
}, {
|
||||
title: '考核人',
|
||||
},
|
||||
{
|
||||
dataIndex: 'createTime',
|
||||
title: '考核时间'
|
||||
}, {
|
||||
title: '考核时间',
|
||||
},
|
||||
{
|
||||
dataIndex: 'remark',
|
||||
title: '考核备注'
|
||||
}, {
|
||||
title: '考核备注',
|
||||
},
|
||||
{
|
||||
dataIndex: 'signature',
|
||||
title: '签字',
|
||||
customRender:({record})=>{
|
||||
return <a-button onClick={()=>{
|
||||
Modal.info({
|
||||
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
|
||||
content: () => <>
|
||||
<div>审核人签字: <a-image src={record.assessmentUserSignature}/>
|
||||
</div>
|
||||
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div>
|
||||
</>
|
||||
})
|
||||
}}>查看</a-button>
|
||||
customRender: ({ record }) => {
|
||||
return (
|
||||
<a-button
|
||||
onClick={() => {
|
||||
Modal.info({
|
||||
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
|
||||
content: () => (
|
||||
<>
|
||||
<div>
|
||||
审核人签字: <a-image src={record.assessmentUserSignature} />
|
||||
</div>
|
||||
<div>
|
||||
被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature} />
|
||||
</div>
|
||||
</>
|
||||
),
|
||||
})
|
||||
}}
|
||||
>
|
||||
查看
|
||||
</a-button>
|
||||
)
|
||||
},
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
<style scoped lang="scss"></style>
|
||||
|
|
|
@ -1,331 +0,0 @@
|
|||
import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table'
|
||||
import { EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo, EnterprisesUnitSaveOrUpdateParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts'
|
||||
import { ref } from 'vue'
|
||||
import { FormExpose } from 'ant-design-vue/es/form/Form'
|
||||
import { ComponentExposed } from 'vue-component-type-helpers'
|
||||
import MapContainer from '@/components/aMap/MapContainer.vue'
|
||||
import { FormProMaxItemOptions } from '@/types/components/form'
|
||||
import { dictSelectNodes } from '@/config/dict.ts'
|
||||
import { AutoComplete, Button, Input, message, Modal, Space } from 'ant-design-vue'
|
||||
import api from '@/axios'
|
||||
import TableProMax from '@/components/table/TableProMax.vue'
|
||||
import { deleteDataModal } from '@/components/tsx/ModalPro.tsx'
|
||||
import { PageParams } from '@/types/hooks/useTableProMax.ts'
|
||||
import FormProMax from '@/components/form/FormProMax.vue'
|
||||
import { debounce } from 'lodash-es'
|
||||
|
||||
type _TableProps = TableProMaxProps<EnterprisesUnitPagerVo, EnterprisesUnitPagerQueryParams>
|
||||
type _FormType = EnterprisesUnitSaveOrUpdateParams & {
|
||||
contactPersonInfoName?: string
|
||||
contactPersonInfoTelephone?: string
|
||||
}
|
||||
const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
|
||||
const _formRef = ref<FormExpose>(null)
|
||||
const _mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
|
||||
const _formParams = ref<_FormType>({ ...params })
|
||||
|
||||
let city = ''
|
||||
const initMarker = (map: AMap.Map) => {
|
||||
//添加maker点 设置point
|
||||
const maker = new AMap.Marker({
|
||||
position: _formParams.value.point,
|
||||
draggable: true,
|
||||
})
|
||||
maker.on('dragend', ({ lnglat }) => {
|
||||
_formParams.value.point = lnglat
|
||||
})
|
||||
map.clearMap()
|
||||
map.add(maker)
|
||||
map.setFitView()
|
||||
}
|
||||
const autoAddress = ref<SelectNodeVo<string>[]>([])
|
||||
|
||||
const _formOptions = ref<FormProMaxItemOptions<_FormType>>({
|
||||
name: {
|
||||
type: 'custom',
|
||||
label: '单位名称',
|
||||
required: true,
|
||||
customRender: () => {
|
||||
return (
|
||||
// AutoComplete 自动完成 组件
|
||||
<AutoComplete
|
||||
v-model:value={_formParams.value.name}
|
||||
options={autoAddress.value}
|
||||
onSelect={(_, options: SelectNodeVo<string>) => {
|
||||
_formParams.value.point = options.extData?.location
|
||||
_formParams.value.address = options.extData?.address
|
||||
initMarker(_mapRef.value?.mapInstance)
|
||||
}}
|
||||
onSearch={debounce((val: string) => {
|
||||
console.log('onSearch___________________', val)
|
||||
|
||||
//@ts-ignore
|
||||
const auto = new AMap.AutoComplete({
|
||||
city: city,
|
||||
// input: 'tipinput',
|
||||
citylimit: true,
|
||||
})
|
||||
auto.search(val, (status, result) => {
|
||||
console.log('🚀 ~ auto.search ~ status, result:', status, result)
|
||||
if (status === 'complete') {
|
||||
// 生成组件需要数据
|
||||
autoAddress.value = result.tips?.map((e) => {
|
||||
return {
|
||||
value: e.name,
|
||||
label: e.name,
|
||||
extData: {
|
||||
district: e.district,
|
||||
address: e.address,
|
||||
location: e.location,
|
||||
},
|
||||
} as SelectNodeVo<string>
|
||||
})
|
||||
} else {
|
||||
autoAddress.value = []
|
||||
}
|
||||
})
|
||||
}, 300)}
|
||||
v-slots={{
|
||||
option: (item: SelectNodeVo<string>) => {
|
||||
return (
|
||||
<div>
|
||||
<p>{item.label}</p>
|
||||
<p style={{ color: '#9a9c9d' }}>
|
||||
{item.extData?.district} {item.extData?.address}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Input placeholder='请输入单位名称' />
|
||||
</AutoComplete>
|
||||
)
|
||||
},
|
||||
},
|
||||
type: {
|
||||
type: 'select',
|
||||
label: '单位类型',
|
||||
required: true,
|
||||
options: dictSelectNodes('EnterprisesUnitType'),
|
||||
},
|
||||
administrativeDivisionCodes: {
|
||||
type: 'administrativeDivisionTree',
|
||||
label: '行政区划',
|
||||
required: true,
|
||||
componentsProps: {
|
||||
displayRender: ({ labels }): string => {
|
||||
city = labels[1]
|
||||
return labels.join(' / ')
|
||||
},
|
||||
},
|
||||
},
|
||||
address: {
|
||||
type: 'inputTextArea',
|
||||
label: '详细地址',
|
||||
},
|
||||
map: {
|
||||
type: 'custom',
|
||||
label: '经纬度',
|
||||
customRender: () => (
|
||||
<MapContainer
|
||||
ref={_mapRef}
|
||||
plugins={['AMap.AutoComplete', 'AMap.PlaceSearch']}
|
||||
style={{ width: '100%', height: '300px', position: 'relative' }}
|
||||
initCallback={(map) => {
|
||||
const contextMenu = new AMap.ContextMenu()
|
||||
contextMenu.addItem(
|
||||
'标记',
|
||||
() => {
|
||||
const { lng, lat } = contextMenu.getPosition()
|
||||
_formParams.value.point = [lng, lat]
|
||||
initMarker(map)
|
||||
},
|
||||
0
|
||||
)
|
||||
map.on('rightclick', ({ lnglat }) => {
|
||||
contextMenu.open(map, lnglat)
|
||||
})
|
||||
if (_formParams.value.point) {
|
||||
initMarker(map)
|
||||
}
|
||||
}}
|
||||
></MapContainer>
|
||||
),
|
||||
},
|
||||
contactPersonInfoName: {
|
||||
type: 'input',
|
||||
label: '联系人名称',
|
||||
},
|
||||
contactPersonInfoTelephone: {
|
||||
type: 'input',
|
||||
label: '联系人电话',
|
||||
},
|
||||
remark: {
|
||||
type: 'inputTextArea',
|
||||
label: '备注',
|
||||
},
|
||||
})
|
||||
Modal.confirm({
|
||||
title: params.snowFlakeId ? `【${params.name}】 信息编辑` : '新增企事业单位',
|
||||
width: 600,
|
||||
icon: ' ',
|
||||
centered: true,
|
||||
content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />,
|
||||
onOk: async () => {
|
||||
await _formRef.value?.validate()
|
||||
const resp = await api.post('/enterprisesUnit/saveOrUpdate', {
|
||||
..._formParams.value,
|
||||
contactPersonInfo: {
|
||||
name: _formParams.value.contactPersonInfoName,
|
||||
telephone: _formParams.value.contactPersonInfoTelephone,
|
||||
},
|
||||
})
|
||||
message.success(resp.message)
|
||||
callback && callback()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
|
||||
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
|
||||
const _columns: _TableProps['columns'] = [
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '名称',
|
||||
},
|
||||
{
|
||||
dataIndex: 'type',
|
||||
title: '类型',
|
||||
customRender: ({ text }) => text?.label,
|
||||
},
|
||||
{
|
||||
dataIndex: 'contactPersonInfo',
|
||||
title: '联系人',
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => text?.name + '/' + text.telephone,
|
||||
},
|
||||
{
|
||||
dataIndex: 'province',
|
||||
title: '行政区划',
|
||||
ellipsis: true,
|
||||
customRender: ({ record }) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join('/'),
|
||||
},
|
||||
{
|
||||
dataIndex: 'address',
|
||||
title: '详细地址',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'remark',
|
||||
title: '备注',
|
||||
},
|
||||
{
|
||||
dataIndex: 'createTime',
|
||||
title: '创建时间',
|
||||
},
|
||||
{
|
||||
dataIndex: 'opt',
|
||||
title: '操作',
|
||||
customRender: ({ record }) => (
|
||||
<Space>
|
||||
<Button
|
||||
class='btn-warn'
|
||||
onClick={() =>
|
||||
saveOrUpdateEnterprisesUnit(
|
||||
{
|
||||
snowFlakeId: record.snowFlakeId,
|
||||
policeUnitId: record.policeUnitId,
|
||||
name: record.name,
|
||||
type: record.type.value,
|
||||
administrativeDivisionCodes: [record.province, record.city, record.districts, record.street].filter(Boolean),
|
||||
address: record.address,
|
||||
point: record.point,
|
||||
contactPersonInfoName: record.contactPersonInfo?.name,
|
||||
contactPersonInfoTelephone: record.contactPersonInfo?.telephone,
|
||||
remark: record.remark,
|
||||
},
|
||||
_tableRef.value?.requestGetTableData
|
||||
)
|
||||
}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
class='btn-danger'
|
||||
onClick={() =>
|
||||
deleteDataModal(record.name, async () => {
|
||||
const resp = await api.delete('/enterprisesUnit/deleteById', {
|
||||
enterprisesUnitId: record.snowFlakeId,
|
||||
})
|
||||
message.success(resp.message)
|
||||
await _tableRef.value?.requestGetTableData()
|
||||
})
|
||||
}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]
|
||||
const _reqApi: _TableProps['requestApi'] = (params) => {
|
||||
;(params as PageParams<EnterprisesUnitPagerQueryParams>).params.policeUnitId = policeUnitPagerVo.snowFlakeId
|
||||
return api.post('/enterprisesUnit/pager', params)
|
||||
}
|
||||
Modal.info({
|
||||
title: `【${policeUnitPagerVo.name}】 管辖企事业单位`,
|
||||
width: '80%',
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
content: () => (
|
||||
<TableProMax
|
||||
ref={_tableRef}
|
||||
size='small'
|
||||
columns={_columns}
|
||||
requestApi={_reqApi}
|
||||
searchFormOptions={{
|
||||
name: {
|
||||
type: 'input',
|
||||
label: '单位名称',
|
||||
},
|
||||
address: {
|
||||
type: 'input',
|
||||
label: '地址',
|
||||
},
|
||||
remark: {
|
||||
type: 'input',
|
||||
label: '备注',
|
||||
},
|
||||
}}
|
||||
v-slots={
|
||||
{
|
||||
tableHeader: (_) => {
|
||||
return (
|
||||
<Space>
|
||||
<Button
|
||||
class='btn-success'
|
||||
onClick={() =>
|
||||
saveOrUpdateEnterprisesUnit(
|
||||
{
|
||||
name: undefined,
|
||||
type: 'party_government',
|
||||
policeUnitId: policeUnitPagerVo.snowFlakeId,
|
||||
administrativeDivisionCodes: [policeUnitPagerVo.province, policeUnitPagerVo.city, policeUnitPagerVo.districts, policeUnitPagerVo.street].filter(Boolean),
|
||||
},
|
||||
_tableRef.value?.requestGetTableData
|
||||
)
|
||||
}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
<Button disabled>导入</Button>
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
} as TableProMaxSlots<PoliceUnitPagerVo>
|
||||
}
|
||||
/>
|
||||
),
|
||||
})
|
||||
}
|
|
@ -1,46 +1,46 @@
|
|||
<template>
|
||||
<div>
|
||||
<!-- 企事业单位 -->
|
||||
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns" :searchFormOptions="searchFormOptions" :scroll="{ x }">
|
||||
<!-- <template #tableHeader>
|
||||
<template #tableHeader>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="addUserManagement">新增用户</a-button>
|
||||
<a-button type="primary" @click="saveOrUpdateEnterprisesUnit">新增企事业单位</a-button>
|
||||
</a-space>
|
||||
</template> -->
|
||||
</template>
|
||||
</TableProMax>
|
||||
<a-modal v-model:open="visible" :title="title" @ok="submit" @cancel="closeModal">
|
||||
<!-- <FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions" /> -->
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
// import { storeTreeData, loadTreeFromCache } from '@/utils/DB.ts'
|
||||
import { deleteDataModal } from '@/components/tsx/ModalPro.tsx'
|
||||
import { EnterprisesUnitSaveOrUpdateParams } from '@/types/views/unitManage/police/policeUnit.ts'
|
||||
import MapContainer from '@/components/aMap/MapContainer.vue'
|
||||
import { AutoComplete, Button, Input, message, Modal, Space } from 'ant-design-vue'
|
||||
import { debounce } from 'lodash-es'
|
||||
import FormProMax from '@/components/form/FormProMax.vue'
|
||||
import api from '@/axios'
|
||||
import { ref, reactive } from 'vue'
|
||||
import TableProMax from '@/components/table/TableProMax.vue'
|
||||
import { TableProMaxProps } from '@/types/components/table/index.ts'
|
||||
import { ComponentExposed } from 'vue-component-type-helpers'
|
||||
import { dictSelectNodes } from '@/config/dict.ts'
|
||||
import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.ts'
|
||||
// import FormProMax from '@/components/form/FormProMax.vue'
|
||||
import { publicUnitPagerQueryParams } from '@/types/views/publicUnit.ts'
|
||||
import { FormProMaxItemOptions } from '@/types/components/form//index.ts'
|
||||
import { FormExpose } from 'ant-design-vue/es/form/Form'
|
||||
import { showEnterprisesUnit } from './index'
|
||||
const formRef = ref<FormExpose>(null)
|
||||
type _FormType = EnterprisesUnitSaveOrUpdateParams & {
|
||||
contactPersonInfoName?: string
|
||||
contactPersonInfoTelephone?: string
|
||||
}
|
||||
type TableProps = TableProMaxProps<publicUnitPagerQueryParams>
|
||||
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/enterprisesUnit/pager', params) //分页
|
||||
|
||||
// const reqApi: TableProps['requestApi'] = (params) => api.post('/enterprisesUnit/pager', params) //分页
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/eu/pager', params) //分页
|
||||
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
|
||||
const columns: TableProps['columns'] = [
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '单位名称',
|
||||
},
|
||||
// {
|
||||
// dataIndex: 'code',
|
||||
// title: '单位代码',
|
||||
// },
|
||||
|
||||
{
|
||||
dataIndex: 'provinceName',
|
||||
title: '行政区划',
|
||||
|
@ -49,19 +49,6 @@ const columns: TableProps['columns'] = [
|
|||
},
|
||||
},
|
||||
|
||||
// {
|
||||
// dataIndex: 'isEnable',
|
||||
// title: '是否启用',
|
||||
// customRender: ({ text }) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
|
||||
// width: 150,
|
||||
// },
|
||||
// {
|
||||
// dataIndex: 'checkStatus',
|
||||
// title: '是否审核',
|
||||
// customRender: ({ record }) => {
|
||||
// return record.checkStatus?.extData?.color === 'success' ? <a-tag color='green'>{record?.checkStatus?.label}</a-tag> : <a-tag color='#f50'>{record?.checkStatus?.label}</a-tag>
|
||||
// },
|
||||
// },
|
||||
{
|
||||
dataIndex: 'address',
|
||||
title: '详细地址',
|
||||
|
@ -92,45 +79,225 @@ const columns: TableProps['columns'] = [
|
|||
{
|
||||
dataIndex: 'opt',
|
||||
title: '操作',
|
||||
customRender({ record }) {
|
||||
return (
|
||||
<a-space>
|
||||
<a-button class='btn-success' onClick={() => showEnterprisesUnit(record)}>
|
||||
企事业单位
|
||||
</a-button>
|
||||
</a-space>
|
||||
)
|
||||
},
|
||||
customRender: ({ record }) => (
|
||||
<Space>
|
||||
<Button
|
||||
class='btn-warn'
|
||||
onClick={() =>
|
||||
saveOrUpdateEnterprisesUnit(
|
||||
{
|
||||
snowFlakeId: record.snowFlakeId,
|
||||
policeUnitId: record.policeUnitId,
|
||||
name: record.name,
|
||||
type: record.type.value,
|
||||
administrativeDivisionCodes: [record.province, record.city, record.districts, record.street].filter(Boolean),
|
||||
address: record.address,
|
||||
point: record.point,
|
||||
contactPersonInfoName: record.contactPersonInfo?.name,
|
||||
contactPersonInfoTelephone: record.contactPersonInfo?.telephone,
|
||||
remark: record.remark,
|
||||
},
|
||||
tableRef.value?.requestGetTableData
|
||||
)
|
||||
}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
class='btn-danger'
|
||||
onClick={() =>
|
||||
deleteDataModal(record.name, async () => {
|
||||
// const resp = await api.delete('/enterprisesUnit/deleteById', {
|
||||
const resp = await api.delete('/eu/del_id', {
|
||||
enterprisesUnitId: record.snowFlakeId,
|
||||
})
|
||||
message.success(resp.message)
|
||||
await tableRef.value?.requestGetTableData()
|
||||
})
|
||||
}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]
|
||||
const x: number = columns.reduce((a, b) => a + (b.width as number), 0)
|
||||
const visible = ref(false)
|
||||
const title = ref('新增用户')
|
||||
const addUserManagement = () => {
|
||||
visible.value = true
|
||||
title.value = ''
|
||||
|
||||
const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
|
||||
const _formRef = ref<FormExpose>(null)
|
||||
const _mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
|
||||
const _formParams = ref<_FormType>({ ...params })
|
||||
|
||||
let city = ''
|
||||
const initMarker = (map: AMap.Map) => {
|
||||
//添加maker点 设置point
|
||||
const maker = new AMap.Marker({
|
||||
position: _formParams.value.point,
|
||||
draggable: true,
|
||||
})
|
||||
maker.on('dragend', ({ lnglat }) => {
|
||||
_formParams.value.point = lnglat
|
||||
})
|
||||
map.clearMap()
|
||||
map.add(maker)
|
||||
map.setFitView()
|
||||
}
|
||||
const autoAddress = ref<SelectNodeVo<string>[]>([])
|
||||
|
||||
const _formOptions = ref<FormProMaxItemOptions<_FormType>>({
|
||||
name: {
|
||||
type: 'custom',
|
||||
label: '单位名称',
|
||||
required: true,
|
||||
customRender: () => {
|
||||
return (
|
||||
// AutoComplete 自动完成 组件
|
||||
<AutoComplete
|
||||
v-model:value={_formParams.value.name}
|
||||
options={autoAddress.value}
|
||||
onSelect={(_, options: SelectNodeVo<string>) => {
|
||||
_formParams.value.point = options.extData?.location
|
||||
_formParams.value.address = options.extData?.address
|
||||
initMarker(_mapRef.value?.mapInstance)
|
||||
}}
|
||||
onSearch={debounce((val: string) => {
|
||||
console.log('onSearch___________________', val)
|
||||
|
||||
//@ts-ignore
|
||||
const auto = new AMap.AutoComplete({
|
||||
city: city,
|
||||
// input: 'tipinput',
|
||||
citylimit: true,
|
||||
})
|
||||
auto.search(val, (status, result) => {
|
||||
console.log('🚀 ~ auto.search ~ status, result:', status, result)
|
||||
if (status === 'complete') {
|
||||
// 生成组件需要数据
|
||||
autoAddress.value = result.tips?.map((e) => {
|
||||
return {
|
||||
value: e.name,
|
||||
label: e.name,
|
||||
extData: {
|
||||
district: e.district,
|
||||
address: e.address,
|
||||
location: e.location,
|
||||
},
|
||||
} as SelectNodeVo<string>
|
||||
})
|
||||
} else {
|
||||
autoAddress.value = []
|
||||
}
|
||||
})
|
||||
}, 300)}
|
||||
v-slots={{
|
||||
option: (item: SelectNodeVo<string>) => {
|
||||
return (
|
||||
<div>
|
||||
<p>{item.label}</p>
|
||||
<p style={{ color: '#9a9c9d' }}>
|
||||
{item.extData?.district} {item.extData?.address}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Input placeholder='请输入单位名称' />
|
||||
</AutoComplete>
|
||||
)
|
||||
},
|
||||
},
|
||||
type: {
|
||||
type: 'select',
|
||||
label: '单位类型',
|
||||
required: true,
|
||||
// @ts-ignore
|
||||
options: dictSelectNodes('EnterprisesUnitType'),
|
||||
},
|
||||
administrativeDivisionCodes: {
|
||||
type: 'administrativeDivisionTree',
|
||||
label: '行政区划',
|
||||
required: true,
|
||||
componentsProps: {
|
||||
// @ts-ignore
|
||||
displayRender: ({ labels }): string => {
|
||||
city = labels[1]
|
||||
return labels.join(' / ')
|
||||
},
|
||||
},
|
||||
},
|
||||
address: {
|
||||
type: 'inputTextArea',
|
||||
label: '详细地址',
|
||||
},
|
||||
map: {
|
||||
type: 'custom',
|
||||
label: '经纬度',
|
||||
customRender: () => (
|
||||
<MapContainer
|
||||
ref={_mapRef}
|
||||
plugins={['AMap.AutoComplete', 'AMap.PlaceSearch']}
|
||||
style={{ width: '100%', height: '300px', position: 'relative' }}
|
||||
initCallback={(map) => {
|
||||
const contextMenu = new AMap.ContextMenu()
|
||||
contextMenu.addItem(
|
||||
'标记',
|
||||
() => {
|
||||
const { lng, lat } = contextMenu.getPosition()
|
||||
_formParams.value.point = [lng, lat]
|
||||
initMarker(map)
|
||||
},
|
||||
0
|
||||
)
|
||||
map.on('rightclick', ({ lnglat }) => {
|
||||
contextMenu.open(map, lnglat)
|
||||
})
|
||||
if (_formParams.value.point) {
|
||||
initMarker(map)
|
||||
}
|
||||
}}
|
||||
></MapContainer>
|
||||
),
|
||||
},
|
||||
contactPersonInfoName: {
|
||||
type: 'input',
|
||||
label: '联系人名称',
|
||||
},
|
||||
contactPersonInfoTelephone: {
|
||||
type: 'input',
|
||||
label: '联系人电话',
|
||||
},
|
||||
remark: {
|
||||
type: 'inputTextArea',
|
||||
label: '备注',
|
||||
},
|
||||
})
|
||||
Modal.confirm({
|
||||
title: params.snowFlakeId ? `【${params.name}】 信息编辑` : '新增企事业单位',
|
||||
width: 600,
|
||||
icon: ' ',
|
||||
centered: true,
|
||||
content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />,
|
||||
onOk: async () => {
|
||||
await _formRef.value?.validate()
|
||||
// const resp = await api.post('/enterprisesUnit/saveOrUpdate', {
|
||||
const resp = await api.post('/eu/add_upd', {
|
||||
..._formParams.value,
|
||||
contactPersonInfo: {
|
||||
name: _formParams.value.contactPersonInfoName,
|
||||
telephone: _formParams.value.contactPersonInfoTelephone,
|
||||
},
|
||||
})
|
||||
message.success(resp.message)
|
||||
await tableRef.value?.requestGetTableData()
|
||||
|
||||
// reqApi(params)
|
||||
callback && callback()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// const getTree = async () => {
|
||||
// // 先尝试从缓存中加载数据
|
||||
// const cachedData = await loadTreeFromCache()
|
||||
// if (cachedData) {
|
||||
// console.log('未发请求')
|
||||
// // 如果缓存存在,直接使用缓存数据
|
||||
// return cachedData
|
||||
// } else {
|
||||
// console.log('发起了请求')
|
||||
// // 如果缓存不存在,发起 API 请求
|
||||
// const res = await api.get<any>('/common/administrativeDivisionTree')
|
||||
// await storeTreeData(res.data)
|
||||
// return res.data
|
||||
// }
|
||||
// }
|
||||
// const loadOptions = async () => {
|
||||
// const treeData = await getTree()
|
||||
// searchFormOptions.treeSelect.options = treeData
|
||||
// }
|
||||
// loadOptions()
|
||||
const searchFormOptions = reactive<TableProps['searchFormOptions']>({
|
||||
name: {
|
||||
type: 'input',
|
||||
|
@ -145,65 +312,5 @@ const searchFormOptions = reactive<TableProps['searchFormOptions']>({
|
|||
type: 'input',
|
||||
label: '手机号',
|
||||
},
|
||||
// isEnable: {
|
||||
// type: 'select',
|
||||
// label: '是否启用',
|
||||
// options: [
|
||||
// {
|
||||
// value: null,
|
||||
// label: '全部',
|
||||
// },
|
||||
// ...dictSelectNodes('IsEnable'),
|
||||
// ],
|
||||
// },
|
||||
})
|
||||
|
||||
const formParams = ref<{
|
||||
snowFlakeId?: string
|
||||
name: string
|
||||
sex: number
|
||||
telephone: string
|
||||
isEnable: any
|
||||
remark?: string
|
||||
}>({
|
||||
name: '',
|
||||
sex: 0,
|
||||
telephone: '',
|
||||
isEnable: 0,
|
||||
})
|
||||
|
||||
const submit = async () => {
|
||||
// await formRef.value.validate()
|
||||
}
|
||||
const closeModal = () => {
|
||||
visible.value = false
|
||||
}
|
||||
const formItemOptions = ref<FormProMaxItemOptions<FromItem>>({
|
||||
name: {
|
||||
type: 'input',
|
||||
label: '姓名',
|
||||
required: true,
|
||||
},
|
||||
sex: {
|
||||
type: 'radioGroup',
|
||||
label: '性别',
|
||||
options: dictSelectNodes('Sex'),
|
||||
required: true,
|
||||
},
|
||||
telephone: {
|
||||
type: 'input',
|
||||
label: '手机号',
|
||||
required: true,
|
||||
},
|
||||
isEnable: {
|
||||
type: 'radioGroup',
|
||||
label: '启用状态',
|
||||
options: dictSelectNodes('IsEnable'),
|
||||
required: true,
|
||||
},
|
||||
remark: {
|
||||
type: 'inputTextArea',
|
||||
label: '备注',
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -2,13 +2,7 @@
|
|||
<!-- 后台用户 -->
|
||||
<!-- template 内部必须有一个根节点 div,否则<Transition>将会失效,所以这个<a-modal></a-modal> 组件必须放在 根节点 div 里面 -->
|
||||
<div>
|
||||
<TableProMax
|
||||
ref="tableRef"
|
||||
:request-api="reqApi"
|
||||
:columns="columns"
|
||||
:searchFormOptions="searchFormOptions"
|
||||
:scroll="{x}"
|
||||
>
|
||||
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns" :searchFormOptions="searchFormOptions" :scroll="{ x }">
|
||||
<template #tableHeader>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="addUserManagement">新增用户</a-button>
|
||||
|
@ -17,36 +11,37 @@
|
|||
</TableProMax>
|
||||
<!-- template 内部必须有一个根节点 div,否则<Transition>将会失效,所以这个<a-modal></a-modal> 组件必须放在 根节点 div 里面 -->
|
||||
<a-modal v-model:open="visible" :title="title" @ok="submit" @cancel="closeModal">
|
||||
<FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions"/>
|
||||
<FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions" />
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import TableProMax from "@/components/table/TableProMax.vue";
|
||||
import {TableProMaxProps} from "@/types/components/table";
|
||||
import {message} from 'ant-design-vue'
|
||||
import {dictSelectNodes} from '@/config/dict.ts'
|
||||
import TableProMax from '@/components/table/TableProMax.vue'
|
||||
import { TableProMaxProps } from '@/types/components/table'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { dictSelectNodes } from '@/config/dict.ts'
|
||||
// const enumsSex = ref<any[]>(dictSelectNodes('Sex'))
|
||||
// const enumsIsEnable = ref<any[]>(dictSelectNodes('IsEnable'))
|
||||
import api from '@/axios/index.ts'
|
||||
import {ref, reactive, onMounted} from 'vue'
|
||||
import FormProMax from "@/components/form/FormProMax.vue";
|
||||
import {FormProMaxItemOptions} from "@/types/components/form";
|
||||
import {FormExpose} from "ant-design-vue/es/form/Form";
|
||||
import {publicUnitPagerQueryParams, FromItem} from "@/types/views/publicUnit.ts";
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import FormProMax from '@/components/form/FormProMax.vue'
|
||||
import { FormProMaxItemOptions } from '@/types/components/form'
|
||||
import { FormExpose } from 'ant-design-vue/es/form/Form'
|
||||
import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.ts'
|
||||
|
||||
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
|
||||
const formRef = ref<FormExpose>(null)
|
||||
type TableProps = TableProMaxProps<publicUnitPagerQueryParams>
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/management/police/user/pager', params) //分页
|
||||
const formParams = ref<{
|
||||
snowFlakeId?: string,
|
||||
name: string,
|
||||
sex: number,
|
||||
telephone: string,
|
||||
isEnable: any,
|
||||
// const reqApi: TableProps['requestApi'] = (params) => api.post('/management/police/user/pager', params) //分页
|
||||
const reqApi: TableProps['requestApi'] = (params) => api.post('/m2/user/pager', params) //分页
|
||||
|
||||
const formParams = ref<{
|
||||
snowFlakeId?: string
|
||||
name: string
|
||||
sex: number
|
||||
telephone: string
|
||||
isEnable: any
|
||||
}>({
|
||||
name: '',
|
||||
sex: 0,
|
||||
|
@ -58,9 +53,7 @@ const formItemOptions = ref<FormProMaxItemOptions<FromItem>>({
|
|||
type: 'input',
|
||||
label: '姓名',
|
||||
required: true,
|
||||
rules: [
|
||||
{required: true, message: '请输入姓名'}
|
||||
],
|
||||
rules: [{ required: true, message: '请输入姓名' }],
|
||||
},
|
||||
sex: {
|
||||
type: 'radioGroup',
|
||||
|
@ -73,16 +66,16 @@ const formItemOptions = ref<FormProMaxItemOptions<FromItem>>({
|
|||
label: '手机号',
|
||||
required: true,
|
||||
rules: [
|
||||
{required: true, message: '请输入手机号'},
|
||||
{ required: true, message: '请输入手机号' },
|
||||
{
|
||||
validator: (rule, value) => {
|
||||
const phoneRegex = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
||||
if (!value) {
|
||||
return Promise.reject('手机号不能为空');
|
||||
return Promise.reject('手机号不能为空')
|
||||
} else if (!phoneRegex.test(value)) {
|
||||
return Promise.reject('手机号格式不正确');
|
||||
return Promise.reject('手机号格式不正确')
|
||||
} else {
|
||||
return Promise.resolve();
|
||||
return Promise.resolve()
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
|
@ -101,25 +94,25 @@ const columns: TableProps['columns'] = [
|
|||
dataIndex: 'account',
|
||||
title: '账号',
|
||||
width: 100,
|
||||
ellipsis: true
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'name',
|
||||
title: '名称',
|
||||
width: 200,
|
||||
ellipsis: true
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'sex',
|
||||
title: '性别',
|
||||
customRender: ({text}) => <a-tag>{text?.label}</a-tag>,
|
||||
width: 150
|
||||
customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
dataIndex: 'telephone',
|
||||
title: '手机号码',
|
||||
width: 150,
|
||||
ellipsis: true
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'createTime',
|
||||
|
@ -131,66 +124,72 @@ const columns: TableProps['columns'] = [
|
|||
{
|
||||
dataIndex: 'isEnable',
|
||||
title: '是否启用',
|
||||
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
|
||||
width: 150
|
||||
customRender: ({ text }) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
dataIndex: 'opt',
|
||||
title: '操作',
|
||||
fixed: "right",
|
||||
customRender({record}) {
|
||||
return (
|
||||
record.isAdmin.value === 1 ?
|
||||
<a-space>
|
||||
<a-popconfirm
|
||||
style="width:100%"
|
||||
title="确认删除账号吗?"
|
||||
onConfirm={async () => {
|
||||
const resp = await api.delete('/management/police/user/deleteById', {
|
||||
managementPoliceUnitUserId: record.snowFlakeId,
|
||||
})
|
||||
message.success(resp.message)
|
||||
await tableRef.value?.requestGetTableData()
|
||||
}}>
|
||||
<a-button type="primary" danger>删除</a-button>
|
||||
</a-popconfirm>
|
||||
<a-button type="primary" onClick={async () => {
|
||||
visible.value = true
|
||||
title.value = "编辑用户"
|
||||
formParams.value.snowFlakeId = record.snowFlakeId
|
||||
formParams.value.name = record.name,
|
||||
formParams.value.sex = record.sex.value,
|
||||
formParams.value.telephone = record.telephone,
|
||||
formParams.value.isEnable = record.isEnable?.value
|
||||
|
||||
}}>
|
||||
编辑
|
||||
</a-button>
|
||||
</a-space>
|
||||
:
|
||||
<div>超级管理员不能编辑</div>
|
||||
fixed: 'right',
|
||||
customRender({ record }) {
|
||||
return record.isAdmin.value === 1 ? (
|
||||
<a-space>
|
||||
<a-popconfirm
|
||||
style='width:100%'
|
||||
title='确认删除账号吗?'
|
||||
onConfirm={async () => {
|
||||
{
|
||||
/* const resp = await api.delete('/management/police/user/deleteById', { */
|
||||
}
|
||||
const resp = await api.delete('/m2/user/del_id', {
|
||||
managementPoliceUnitUserId: record.snowFlakeId,
|
||||
})
|
||||
message.success(resp.message)
|
||||
await tableRef.value?.requestGetTableData()
|
||||
}}
|
||||
>
|
||||
<a-button type='primary' danger>
|
||||
删除
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
<a-button
|
||||
type='primary'
|
||||
onClick={async () => {
|
||||
visible.value = true
|
||||
title.value = '编辑用户'
|
||||
formParams.value.snowFlakeId = record.snowFlakeId
|
||||
;(formParams.value.name = record.name), (formParams.value.sex = record.sex.value), (formParams.value.telephone = record.telephone), (formParams.value.isEnable = record.isEnable?.value)
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</a-button>
|
||||
</a-space>
|
||||
) : (
|
||||
<div>超级管理员不能编辑</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
const x: number = columns.reduce((a, b) => a + (b.width as number), 0)
|
||||
const searchFormOptions: TableProps["searchFormOptions"] = {
|
||||
const searchFormOptions: TableProps['searchFormOptions'] = {
|
||||
name: {
|
||||
type: 'input',
|
||||
label: '名称'
|
||||
}, sex: {
|
||||
label: '名称',
|
||||
},
|
||||
sex: {
|
||||
type: 'select',
|
||||
label: '性别',
|
||||
options: [
|
||||
{
|
||||
value: null,
|
||||
label: '全部'
|
||||
}, ...dictSelectNodes('Sex')
|
||||
]
|
||||
label: '全部',
|
||||
},
|
||||
...dictSelectNodes('Sex'),
|
||||
],
|
||||
},
|
||||
telephone: {
|
||||
type: 'input',
|
||||
label: '手机号'
|
||||
label: '手机号',
|
||||
},
|
||||
isEnable: {
|
||||
type: 'select',
|
||||
|
@ -198,10 +197,11 @@ const searchFormOptions: TableProps["searchFormOptions"] = {
|
|||
options: [
|
||||
{
|
||||
value: null,
|
||||
label: '全部'
|
||||
}, ...dictSelectNodes('IsEnable')
|
||||
]
|
||||
}
|
||||
label: '全部',
|
||||
},
|
||||
...dictSelectNodes('IsEnable'),
|
||||
],
|
||||
},
|
||||
}
|
||||
const visible = ref(false)
|
||||
const title = ref('新增用户')
|
||||
|
@ -222,13 +222,13 @@ const submit = async () => {
|
|||
sex: formParams.value.sex,
|
||||
telephone: formParams.value.telephone,
|
||||
isEnable: formParams.value.isEnable,
|
||||
|
||||
}
|
||||
const resp = await api.post('/management/police/user/saveOrUpdate', managementSecurityUnitUserSaveOrUpdateParams)
|
||||
// const resp = await api.post('/management/police/user/saveOrUpdate', managementSecurityUnitUserSaveOrUpdateParams)
|
||||
const resp = await api.post('/m2/user/add_upd', managementSecurityUnitUserSaveOrUpdateParams)
|
||||
|
||||
message.success(resp.message)
|
||||
tableRef.value?.requestGetTableData()
|
||||
closeModal()
|
||||
|
||||
}
|
||||
|
||||
const closeModal = () => {
|
||||
|
@ -236,7 +236,7 @@ const closeModal = () => {
|
|||
name: '',
|
||||
sex: 0,
|
||||
telephone: '',
|
||||
isEnable: 0
|
||||
isEnable: 0,
|
||||
}
|
||||
visible.value = false
|
||||
title.value = '新增用户'
|
||||
|
|
|
@ -32,7 +32,7 @@ router.beforeEach(async (to, from, next) => {
|
|||
// 不在白名单内需要查看是否携带token 没有token需要返回登录页进行登录
|
||||
if (!userStore.getTokenInfo?.value) {
|
||||
await message.warn('未找到token,请重新登陆!')
|
||||
return next('/enterprise');
|
||||
return next('/login');
|
||||
}
|
||||
//放行
|
||||
return next();
|
||||
|
|
|
@ -252,7 +252,7 @@ const enterprisesUnitIdList = ref<SelectNodeVo<string>[]>([])
|
|||
const enterprisesUnitId = ref('')
|
||||
|
||||
const isRecruitSecurityHidden = ref<boolean>(false)
|
||||
const idNumberDisabled = ref<boolean>(false)
|
||||
const idNumberDisabled = ref<boolean>(true)
|
||||
|
||||
// 切换options
|
||||
const netType = computed(() => {
|
||||
|
@ -329,7 +329,7 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
|
|||
outsourceName:{
|
||||
type: 'input',
|
||||
label: '外包公司名称',
|
||||
hidden:idNumberDisabled as any
|
||||
hidden:idNumberDisabled as any,
|
||||
},
|
||||
isFiling:{
|
||||
type: 'radioGroup',
|
||||
|
|
Loading…
Reference in New Issue