generated from Leo_Ding/web-template
Merge branch 'master' of https://gitlab.guxuan.icu/Leo_Ding/hahaPension_admin
This commit is contained in:
commit
db3428381b
1
.env.dev
1
.env.dev
@ -13,6 +13,7 @@ VITE_ROUTER_HISTORY=hash
|
|||||||
|
|
||||||
# api
|
# api
|
||||||
VITE_API_BASIC='http://10.10.1.39:8040'
|
VITE_API_BASIC='http://10.10.1.39:8040'
|
||||||
|
VITE_API_UPLOAD='http://115.239.217.220:9458'
|
||||||
VITE_API_HTTP=/api/v1/
|
VITE_API_HTTP=/api/v1/
|
||||||
# storage
|
# storage
|
||||||
VITE_STORAGE_NAMESPACE = gin-admin_local_
|
VITE_STORAGE_NAMESPACE = gin-admin_local_
|
||||||
2
.env.pre
2
.env.pre
@ -13,6 +13,6 @@ VITE_ROUTER_HISTORY=hash
|
|||||||
# api
|
# api
|
||||||
VITE_API_BASIC=/
|
VITE_API_BASIC=/
|
||||||
VITE_API_HTTP=/api/v1/
|
VITE_API_HTTP=/api/v1/
|
||||||
|
VITE_API_UPLOAD='http://115.239.217.220:9458'
|
||||||
# storage
|
# storage
|
||||||
VITE_STORAGE_NAMESPACE=admin_pre_
|
VITE_STORAGE_NAMESPACE=admin_pre_
|
||||||
|
|||||||
@ -13,6 +13,6 @@ VITE_ROUTER_HISTORY=hash
|
|||||||
# api
|
# api
|
||||||
VITE_API_BASIC=/
|
VITE_API_BASIC=/
|
||||||
VITE_API_HTTP=/api/v1/
|
VITE_API_HTTP=/api/v1/
|
||||||
|
VITE_API_UPLOAD='http://115.239.217.220:9458'
|
||||||
# storage
|
# storage
|
||||||
VITE_STORAGE_NAMESPACE=ginadmin_
|
VITE_STORAGE_NAMESPACE=ginadmin_
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
import axios from 'axios'
|
||||||
|
import { config } from '@/config'
|
||||||
// 获取地区
|
// 获取地区
|
||||||
export const getRegion = (params) => request.basic.get('/region', params)
|
export const getRegion = (params) => request.basic.get('/region', params)
|
||||||
|
|
||||||
@ -9,7 +10,12 @@ export const getDictByType = (type) => request.basic.get(`/api/v1/dictionaries?c
|
|||||||
export const getAreaList = (params) => request.basic.get('/api/v1/areas', params)
|
export const getAreaList = (params) => request.basic.get('/api/v1/areas', params)
|
||||||
export const getChildAreaList = (id) => request.basic.get(`/api/v1/areas/${id}`)
|
export const getChildAreaList = (id) => request.basic.get(`/api/v1/areas/${id}`)
|
||||||
//上传图片
|
//上传图片
|
||||||
export const uploadFile=(params)=>request.basic.post('/api/v1/upload',params,{
|
// export const uploadFile=(params)=>request.basic.post('/upload',params,{
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'multipart/form-data'
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
export const uploadFile=(params)=>axios.post(`${config('http.apiUpload')}/upload`,params,{
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data'
|
'Content-Type': 'multipart/form-data'
|
||||||
},
|
},
|
||||||
|
|||||||
@ -143,8 +143,8 @@ const handleCustomRequest = async (options) => {
|
|||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
|
|
||||||
const { data } = await apis.common.uploadFile(formData);
|
const { data } = await apis.common.uploadFile(formData);
|
||||||
const fullUrl = config('http.apiBasic') + data;
|
const fullUrl = config('http.apiUpload') + data.saved_path;
|
||||||
|
console.log('上传成功,文件URL:', fullUrl);
|
||||||
// 正确构造文件对象
|
// 正确构造文件对象
|
||||||
onSuccess({
|
onSuccess({
|
||||||
uid: file.uid,
|
uid: file.uid,
|
||||||
@ -155,7 +155,7 @@ const handleCustomRequest = async (options) => {
|
|||||||
}, file);
|
}, file);
|
||||||
|
|
||||||
// 触发成功事件
|
// 触发成功事件
|
||||||
emit('uploadSuccess', data);
|
emit('uploadSuccess', { url: fullUrl });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
onError(err);
|
onError(err);
|
||||||
message.error('上传失败');
|
message.error('上传失败');
|
||||||
|
|||||||
@ -1,44 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-input
|
<a-upload
|
||||||
v-model:value="currentValue"
|
:multiple="multiple"
|
||||||
class="x-upload x-upload-input"
|
@change="handleChange"
|
||||||
:allow-clear="allowClear"
|
v-model:file-list="fileList"
|
||||||
@input="onInput">
|
:custom-request="handleCustomRequest"
|
||||||
<template #addonAfter>
|
:show-upload-list="{ showRemoveIcon: allowClear }"
|
||||||
<a-button
|
>
|
||||||
v-if="loading"
|
<a-button>
|
||||||
loading>
|
<upload-outlined></upload-outlined>
|
||||||
{{ loadingBtnText }}
|
{{ loading ? loadingBtnText : btnText }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-upload
|
</a-upload>
|
||||||
v-else
|
|
||||||
:show-upload-list="false"
|
|
||||||
:custom-request="customRequest">
|
|
||||||
<a-button>{{ btnText }}</a-button>
|
|
||||||
</a-upload>
|
|
||||||
</template>
|
|
||||||
</a-input>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Form } from 'ant-design-vue'
|
import { Form, message } from 'ant-design-vue'
|
||||||
import { onMounted, ref, watch } from 'vue'
|
import { onMounted, ref, watch } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { config } from '@/config'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'XUploadInput',
|
name: 'XUploadInput',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const fileList = ref([])
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 组件属性
|
||||||
* @property {string} modelValue v-model
|
|
||||||
* @property {string} btnText 按钮内容。默认:选择文件
|
|
||||||
* @property {string} loadingBtnText 上传中按钮内容。默认:上传中
|
|
||||||
* @property {boolean} allowClear 允许清空。默认:true
|
|
||||||
*/
|
*/
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: Array,
|
||||||
default: '',
|
default: () => []
|
||||||
},
|
},
|
||||||
btnText: {
|
btnText: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -52,83 +46,157 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
multiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'change'])
|
const emit = defineEmits(['update:modelValue', 'change', 'uploadSuccess', 'uploadError'])
|
||||||
|
|
||||||
const { onFieldChange } = Form.useInjectFormItemContext()
|
const { onFieldChange } = Form.useInjectFormItemContext()
|
||||||
const loading = ref(false)
|
|
||||||
const currentValue = ref('')
|
|
||||||
|
|
||||||
watch(
|
/**
|
||||||
() => props.modelValue,
|
* 初始化文件列表
|
||||||
(val) => {
|
*/
|
||||||
if (currentValue.value !== val) {
|
const initFileList = () => {
|
||||||
currentValue.value = val
|
if (props.modelValue && props.modelValue.length > 0) {
|
||||||
}
|
fileList.value = props.modelValue.map(url => ({
|
||||||
|
uid: `preview-${Date.now()}-${Math.random()}`,
|
||||||
|
name: url.substring(url.lastIndexOf('/') + 1),
|
||||||
|
status: 'done',
|
||||||
|
url: url
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
fileList.value = []
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
currentValue.value = props.modelValue
|
initFileList()
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内容发生改变
|
* 监听外部值变化
|
||||||
* @param e
|
|
||||||
*/
|
*/
|
||||||
function onInput(e) {
|
watch(() => props.modelValue, (newVal) => {
|
||||||
trigger(e.target.value)
|
// 只有当 fileList 中的完成文件URL与外部值不一致时才更新
|
||||||
}
|
const doneUrls = fileList.value
|
||||||
|
.filter(f => f.status === 'done' && f.url)
|
||||||
|
.map(f => f.url)
|
||||||
|
|
||||||
|
if (JSON.stringify(newVal) !== JSON.stringify(doneUrls)) {
|
||||||
|
initFileList()
|
||||||
|
}
|
||||||
|
}, { deep: true })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义上传
|
* 自定义上传请求
|
||||||
* @param info
|
|
||||||
*/
|
*/
|
||||||
async function customRequest(info) {
|
const handleCustomRequest = async (options) => {
|
||||||
const { file } = info
|
const { file, onProgress, onSuccess, onError } = options
|
||||||
|
|
||||||
// 演示
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
setTimeout(() => {
|
|
||||||
loading.value = false
|
|
||||||
currentValue.value = file.name
|
|
||||||
trigger(currentValue.value)
|
|
||||||
}, 2000)
|
|
||||||
|
|
||||||
// 真实业务场景
|
try {
|
||||||
// loading.value = true
|
const formData = new FormData()
|
||||||
// const { code, data } = await apis.common.upload({
|
formData.append('file', file)
|
||||||
// file,
|
|
||||||
// })
|
// 模拟上传进度
|
||||||
// loading.value = false
|
const progressInterval = setInterval(() => {
|
||||||
// if (config('http.code.success') === code) {
|
if (onProgress) {
|
||||||
// currentValue.value = data?.src
|
const percent = Math.min(95, (file.percent || 0) + 10)
|
||||||
// trigger(currentValue.value)
|
file.percent = percent
|
||||||
// }
|
onProgress({ percent })
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
|
||||||
|
const { data } = await apis.common.uploadFile(formData)
|
||||||
|
clearInterval(progressInterval)
|
||||||
|
|
||||||
|
const fullUrl = config('http.apiUpload') + data.saved_path
|
||||||
|
|
||||||
|
// 完成进度
|
||||||
|
if (onProgress) {
|
||||||
|
onProgress({ percent: 100 })
|
||||||
|
}
|
||||||
|
|
||||||
|
onSuccess({
|
||||||
|
url: fullUrl
|
||||||
|
}, file)
|
||||||
|
|
||||||
|
emit('uploadSuccess', { url: fullUrl })
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('上传失败:', err)
|
||||||
|
onError(err)
|
||||||
|
emit('uploadError', err)
|
||||||
|
message.error('上传失败')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 触发
|
* 处理文件变化
|
||||||
*/
|
*/
|
||||||
function trigger(value) {
|
const handleChange = ({ file, fileList: updatedList }) => {
|
||||||
emit('update:modelValue', value)
|
console.log('文件状态变化:', file.status)
|
||||||
emit('change', value)
|
|
||||||
|
switch (file.status) {
|
||||||
|
case 'uploading':
|
||||||
|
loading.value = true
|
||||||
|
break
|
||||||
|
|
||||||
|
case 'done':
|
||||||
|
loading.value = false
|
||||||
|
// 确保文件对象有正确的URL
|
||||||
|
const responseUrl = file.response?.url
|
||||||
|
if (responseUrl) {
|
||||||
|
const targetFile = updatedList.find(f => f.uid === file.uid)
|
||||||
|
if (targetFile) {
|
||||||
|
targetFile.url = responseUrl
|
||||||
|
}
|
||||||
|
message.success(`${file.name} 上传成功`)
|
||||||
|
}
|
||||||
|
updateModelValue(updatedList)
|
||||||
|
break
|
||||||
|
|
||||||
|
case 'error':
|
||||||
|
loading.value = false
|
||||||
|
message.error(`${file.name} 上传失败`)
|
||||||
|
break
|
||||||
|
|
||||||
|
case 'removed':
|
||||||
|
updateModelValue(updatedList)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新模型值
|
||||||
|
*/
|
||||||
|
const updateModelValue = (fileList) => {
|
||||||
|
const urls = fileList
|
||||||
|
.filter(item => item.status === 'done' && item.url)
|
||||||
|
.map(item => item.url)
|
||||||
|
|
||||||
|
emit('update:modelValue', urls)
|
||||||
|
emit('change', urls)
|
||||||
onFieldChange()
|
onFieldChange()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.x-upload {
|
:deep(.ant-upload-wrapper) {
|
||||||
:deep(.ant-input-group-addon) {
|
|
||||||
padding: 0;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-btn {
|
.ant-btn {
|
||||||
margin: -1px 0 -1px -1px;
|
display: inline-flex;
|
||||||
border-top-left-radius: 0;
|
align-items: center;
|
||||||
border-bottom-left-radius: 0;
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-upload-list {
|
||||||
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -2,6 +2,7 @@ import { env } from '@/utils/util'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
apiBasic: env('apiBasic'),
|
apiBasic: env('apiBasic'),
|
||||||
|
apiUpload: env('apiUpload'),
|
||||||
code: {
|
code: {
|
||||||
success: true,
|
success: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -539,8 +539,8 @@ async function handleEdit(record = {}) {
|
|||||||
}
|
}
|
||||||
formData.value = { ...data }
|
formData.value = { ...data }
|
||||||
formData.value.birthDate = dayjs(data.birthDate)
|
formData.value.birthDate = dayjs(data.birthDate)
|
||||||
formData.value.archive.idCardPhotos = data.archive.idCardPhotos ? data.archive.idCardPhotos.map(item => config('http.apiBasic') + item) : []
|
formData.value.archive.idCardPhotos = data.archive.idCardPhotos ? data.archive.idCardPhotos.map(item => config('http.apiUpload') + item) : []
|
||||||
formData.value.archive.uploadedDocuments = data.archive.uploadedDocuments ? data.archive.uploadedDocuments.map(item => config('http.apiBasic') + item) : []
|
formData.value.archive.uploadedDocuments = data.archive.uploadedDocuments ? data.archive.uploadedDocuments.map(item => config('http.apiUpload') + item) : []
|
||||||
formData.value.governmentPurchasedServiceStartDate = [dayjs(formData.value.starGovernmentService), dayjs(formData.value.endGovernmentService)]
|
formData.value.governmentPurchasedServiceStartDate = [dayjs(formData.value.starGovernmentService), dayjs(formData.value.endGovernmentService)]
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
areaCascaderRef.value.initData(data.archive.homeAreaCodes)
|
areaCascaderRef.value.initData(data.archive.homeAreaCodes)
|
||||||
|
|||||||
@ -287,7 +287,7 @@ const handleCustomRequest = async (options) => {
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
const { data } = await apis.common.uploadFile(formData);
|
const { data } = await apis.common.uploadFile(formData);
|
||||||
const fullUrl = config('http.apiBasic') + data;
|
const fullUrl = config('http.apiUpload') + data;
|
||||||
console.log(fullUrl)
|
console.log(fullUrl)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
message.error('上传失败');
|
message.error('上传失败');
|
||||||
|
|||||||
@ -36,6 +36,13 @@
|
|||||||
<a-radio value="2">女</a-radio>
|
<a-radio value="2">女</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status">
|
||||||
|
<a-radio v-for="item in dicsStore.dictOptions.STAFF_STATUS" :key="item.dval" :value="item.dval">{{ item.introduction }}</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<!-- 证件号码 -->
|
<!-- 证件号码 -->
|
||||||
|
|
||||||
@ -170,12 +177,12 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="证件照片" name="imgs">
|
<a-form-item label="证件照片" name="imgs">
|
||||||
<gx-upload v-model="formData.imgs" accept-types=".jpg,.png,.webp" />
|
<gx-upload v-model="formData.imgs" :fileNumber="1" accept-types=".jpg,.png,.webp" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-item label="附件" name="attachments">
|
<a-form-item label="附件" name="attachments">
|
||||||
<gx-upload v-model="formData.attachments" accept-types=".jpg,.png,.webp,.xlsx,.docx,.doc" />
|
<UploadInput v-model="formData.attachments"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
@ -199,6 +206,7 @@ import dayjs from 'dayjs'
|
|||||||
import { getBirthDate, spliceUrl } from '@/utils/util'
|
import { getBirthDate, spliceUrl } from '@/utils/util'
|
||||||
import { validatePhone, validateEmail, validateIdCard } from '@/utils/validate'
|
import { validatePhone, validateEmail, validateIdCard } from '@/utils/validate'
|
||||||
import storage from '@/utils/storage'
|
import storage from '@/utils/storage'
|
||||||
|
import UploadInput from '@/components/Upload/UploadInput.vue'
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
@ -219,6 +227,7 @@ formRules.value = {
|
|||||||
*/
|
*/
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formData.value.gender = '1'
|
formData.value.gender = '1'
|
||||||
|
formData.value.status = '1'
|
||||||
formData.value.companyId = storage.local.getItem('companyId')
|
formData.value.companyId = storage.local.getItem('companyId')
|
||||||
formData.value.stationId = storage.local.getItem('stationId')
|
formData.value.stationId = storage.local.getItem('stationId')
|
||||||
showModal({
|
showModal({
|
||||||
@ -269,12 +278,12 @@ async function handleEdit(record = {}) {
|
|||||||
if (formData.value.laborContractStartAt && formData.value.laborContractEndAt) {
|
if (formData.value.laborContractStartAt && formData.value.laborContractEndAt) {
|
||||||
formData.value.laborContract = [dayjs(formData.value.laborContractStartAt), dayjs(formData.value.laborContractEndAt)]
|
formData.value.laborContract = [dayjs(formData.value.laborContractStartAt), dayjs(formData.value.laborContractEndAt)]
|
||||||
}
|
}
|
||||||
formData.value.imgs = (data.imgs && data.imgs.length > 0) ? data.imgs.map(item => config('http.apiBasic') + item) : []
|
formData.value.imgs = (data.imgs && data.imgs.length > 0) ? data.imgs.map(item => config('http.apiUpload') + item) : []
|
||||||
formData.value.attachments = (data.attachments && data.attachments.length > 0) ? data.attachments.map(item => config('http.apiBasic') + item) : []
|
formData.value.attachments = (data.attachments && data.attachments.length > 0) ? data.attachments.map(item => config('http.apiUpload') + item) : []
|
||||||
formData.value.commissionRate = formData.value.commissionRate ?? formData.value.commissionRate * 100
|
formData.value.commissionRate = formData.value.commissionRate ?? formData.value.commissionRate * 100
|
||||||
formData.value.birthDate2 = dayjs(data.birthDate).format('YYYY-DD-MM')
|
formData.value.birthDate2 = dayjs(data.birthDay).format('YYYY-DD-MM')
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
areaCascaderRef.value.initData(data.archive.homeAreaCodes)
|
areaCascaderRef.value.initData(data.sAreaCodes||[])
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
@ -294,13 +303,14 @@ function handleOk() {
|
|||||||
showLoading()
|
showLoading()
|
||||||
let params = {
|
let params = {
|
||||||
...formData.value,
|
...formData.value,
|
||||||
birthDate: new Date(formData.value.birthDate)
|
birthDay: formData.value.birthDate2
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.value.laborContract && formData.value.laborContract.length > 0) {
|
if (formData.value.laborContract && formData.value.laborContract.length > 0) {
|
||||||
params.laborContractStartAt = formData.value.laborContract[0]
|
params.laborContractStartAt = formData.value.laborContract[0]
|
||||||
params.laborContractEndAt = formData.value.laborContract[1]
|
params.laborContractEndAt = formData.value.laborContract[1]
|
||||||
}
|
}
|
||||||
|
console.log(formData.value.imgs)
|
||||||
params.imgs = (formData.value.imgs && formData.value.imgs.length) > 0 ? formData.value.imgs.map(item => spliceUrl(item)) : []
|
params.imgs = (formData.value.imgs && formData.value.imgs.length) > 0 ? formData.value.imgs.map(item => spliceUrl(item)) : []
|
||||||
params.attachments = (formData.value.attachments && formData.value.attachments.length) > 0 ? formData.value.attachments.map(item => spliceUrl(item)) : []
|
params.attachments = (formData.value.attachments && formData.value.attachments.length) > 0 ? formData.value.attachments.map(item => spliceUrl(item)) : []
|
||||||
params.commissionRate = formData.value.commissionRate ?? formData.value.commissionRate / 100
|
params.commissionRate = formData.value.commissionRate ?? formData.value.commissionRate / 100
|
||||||
|
|||||||
@ -4,74 +4,90 @@
|
|||||||
<a-card class="">
|
<a-card class="">
|
||||||
<div style="display: flex;justify-content: space-around;">
|
<div style="display: flex;justify-content: space-around;">
|
||||||
<div
|
<div
|
||||||
style="width:200px;margin-top: 20px;border-right: 1px solid #f0f0f0;display: flex;flex-direction: column;align-items: center;">
|
style="width:250px;margin-top: 20px;border-right: 1px solid #f0f0f0;display: flex;flex-direction: column;align-items: center;">
|
||||||
<gx-upload v-model="formData.imgList" accept-types=".jpg,.png,.webp" :fileNumber="1" />
|
<gx-upload v-model="formData.imgList" accept-types=".jpg,.png,.webp" :fileNumber="1" />
|
||||||
<div>
|
<div>
|
||||||
<p>姓名:{{ formData.name }}</p>
|
<p>姓名:{{ formData.name }}</p>
|
||||||
<p>性别:{{ formData.gender==1?'男':'女' }}</p>
|
<p>性别:{{ formData.gender == 1 ? '男' : '女' }}</p>
|
||||||
<p>身份证号:{{ formData.idNumber }}</p>
|
<p>身份证号:{{ formData.idCard }}</p>
|
||||||
<p>手机号:{{ formData.contact1 }}</p>
|
<p>手机号:{{ formData.phone }}</p>
|
||||||
|
<p>状态: <a-tag>{{ dicsStore.getDictLabel('STAFF_STATUS', formData.status) }}</a-tag></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: calc(100% - 200px);padding: 20px;">
|
<div style="width: calc(100% - 200px);padding: 20px;">
|
||||||
<a-row :gutter="20">
|
<a-row :gutter="20">
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">出生日期:</span> {{ formData.birthDate || '-' }}</div>
|
<div><span class="label">出生日期:</span> {{ formData.birthday || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<!-- 基本信息 -->
|
<!-- 基本信息 -->
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">参保情况:</span> {{ formData.socialSecurityCardNumber || '-' }}</div>
|
<div><span class="label">参保情况:</span> {{ dicsStore.getDictLabel('INSURANCE_STATUS',
|
||||||
|
formData.insuranceStatus) || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">护理人员类型:</span> {{ dicsStore.getDictLabel('STAFF_TYPE',formData.serviceType)}}</div>
|
<div><span class="label">学历:</span> {{ dicsStore.getDictLabel('Level_Education',
|
||||||
|
formData.education) || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">用工形式:</span> {{ formData.idNumber || '-' }}</div>
|
<div><span class="label">护理人员类型:</span> {{
|
||||||
|
dicsStore.getDictLabel('STAFF_TYPE', formData.serviceType) }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">负责区域:</span> {{ formData.nursingLevel || '-' }}</div>
|
<div><span class="label">用工形式:</span> {{ dicsStore.getDictLabel('USE_TYPE',
|
||||||
|
formData.workType) || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
|
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">提成比例:</span> {{ formData.healthStatus || '-' }}</div>
|
<div><span class="label">提成比例:</span> {{ formData.commissionRate + '%' || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">入职日期:</span> {{ formData.survivalStatus || '-' }}</div>
|
<div><span class="label">入职日期:</span> {{ dayjs(formData.joinAt).format('YYYY-MM-DD') || '-'
|
||||||
|
}}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">资格证照名称:</span> {{ formData.serviceStatus || '-' }}</div>
|
<div><span class="label">资格证照名称:</span> {{ formData.qualificationName || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">资格证照等级:</span> {{ formData.serviceForm || '-' }}</div>
|
<div><span class="label">资格证照等级:</span> {{ dicsStore.getDictLabel('QUA_LV',
|
||||||
|
formData.qualificationLV) || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">银行卡号:</span> {{ formData.serviceForm || '-' }}</div>
|
<div><span class="label">银行卡号:</span> {{ formData.bankNo || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">开户行名称:</span> {{ formData.serviceForm || '-' }}</div>
|
<div><span class="label">开户行名称:</span> {{ formData.bankName || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<div><span class="label">家庭住址:</span> {{ formData.serviceForm || '-' }}</div>
|
<div><span class="label">补贴类型:</span> {{ dicsStore.getDictLabel('SUBSIDY_TYPE',
|
||||||
|
formData.subsidyType) || '-' }}</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<!-- 数组类字段 -->
|
<a-col :span="24">
|
||||||
<a-col :span="24" v-if="formData.idCardPhotos && formData.idCardPhotos.length > 0">
|
<div><span class="label">负责区域:</span> {{ formData.sAreaLabels ?
|
||||||
|
formData.sAreaLabels.join('/')
|
||||||
|
: '-' }}</div>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<div><span class="label">家庭住址:</span> {{ formData.areaLabels ? formData.areaLabels.join('/')
|
||||||
|
:
|
||||||
|
'-' }}</div>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<div><span class="label">备注:</span> {{ formData.remark || '-' }}</div>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
<div>
|
<div>
|
||||||
<span class="label">证件照:</span>
|
<span class="label">附件:</span>
|
||||||
<div style="margin-top: 8px;">
|
<div>
|
||||||
<a-image v-for="(url, index) in formData.idCardPhotos" :key="index" :src="url"
|
<a v-for="value in formData.attachments" :key="value" :href="value"
|
||||||
fit="cover" style="width: 100px; height: 60px; margin-right: 8px;"
|
target="_blank">{{ value }}</a>
|
||||||
:preview-src-list="formData.idCardPhotos" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="8">
|
|
||||||
<div><span class="label">附件:</span> {{ formData.serviceForm || '-' }}</div>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="8">
|
|
||||||
<div><span class="label">备注:</span> {{ formData.serviceForm || '-' }}</div>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
</a-row>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -86,7 +102,7 @@ import { ref, computed, defineAsyncComponent, defineExpose, getCurrentInstance,
|
|||||||
import { config } from '@/config'
|
import { config } from '@/config'
|
||||||
import apis from '@/apis'
|
import apis from '@/apis'
|
||||||
import { useForm, useModal } from '@/hooks'
|
import { useForm, useModal } from '@/hooks'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
import { useDicsStore } from '@/store'
|
import { useDicsStore } from '@/store'
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const activeKey = ref('1')
|
const activeKey = ref('1')
|
||||||
@ -111,14 +127,19 @@ function handleCreate() {
|
|||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*/
|
*/
|
||||||
function handleEdit(record = {}) {
|
async function handleEdit(record = {}) {
|
||||||
console.log('record', record)
|
|
||||||
showModal({
|
showModal({
|
||||||
type: 'edit',
|
type: 'edit',
|
||||||
title: '服务人员详情',
|
title: '服务人员详情',
|
||||||
})
|
})
|
||||||
formRecord.value = record
|
const { data, success } = await apis.serviceStaffList.getItem(record.id).catch()
|
||||||
formData.value = cloneDeep(record)
|
if (!success) {
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
formData.value = data
|
||||||
|
formData.value.imgList = data.imgs ? data.imgs.map(item => config('http.apiUpload') + item) : []
|
||||||
|
formData.value.attachments = (data.attachments && data.attachments.length > 0) ? data.attachments.map(item => config('http.apiUpload') + item) : []
|
||||||
}
|
}
|
||||||
const callback = (val) => {
|
const callback = (val) => {
|
||||||
console.log(val);
|
console.log(val);
|
||||||
@ -173,7 +194,8 @@ function handleCancel() {
|
|||||||
* 关闭后
|
* 关闭后
|
||||||
*/
|
*/
|
||||||
function onAfterClose() {
|
function onAfterClose() {
|
||||||
resetForm()
|
// resetForm()
|
||||||
|
formData.value = {}
|
||||||
hideLoading()
|
hideLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,11 +77,18 @@
|
|||||||
<template #bodyCell="{ index, column, record }">
|
<template #bodyCell="{ index, column, record }">
|
||||||
<template v-if="column.key === 'serialNumber'">
|
<template v-if="column.key === 'serialNumber'">
|
||||||
<span>{{ index + 1 }}</span>
|
<span>{{ index + 1 }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'workType'">
|
||||||
|
<span>{{ dicsStore.getDictLabel('USE_TYPE', record.workType) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'gender'">
|
<template v-if="column.key === 'gender'">
|
||||||
<span v-if="record.gender == '1'">男</span>
|
<span v-if="record.gender == '1'">男</span>
|
||||||
<span v-else>女</span>
|
<span v-else>女</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status == '1'" color="green">启用</a-tag>
|
||||||
|
<a-tag v-else color="red">禁用</a-tag>
|
||||||
|
</template>
|
||||||
<template v-if="column.key === 'serviceType'">
|
<template v-if="column.key === 'serviceType'">
|
||||||
<span>{{ dicsStore.getDictLabel('STAFF_TYPE', record.serviceType) }}</span>
|
<span>{{ dicsStore.getDictLabel('STAFF_TYPE', record.serviceType) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@ -208,7 +215,7 @@ const columns = [
|
|||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 320,
|
width: 180,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@ -217,66 +224,6 @@ const { listData, loading, showLoading, hideLoading, paginationState, resetPagin
|
|||||||
const editDialogRef = ref()
|
const editDialogRef = ref()
|
||||||
const detailRef = ref()
|
const detailRef = ref()
|
||||||
|
|
||||||
const treeData = ref([
|
|
||||||
{
|
|
||||||
title: 'Node1',
|
|
||||||
value: '0-0',
|
|
||||||
key: '0-0',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: '0-0-1',
|
|
||||||
key: '0-0-1',
|
|
||||||
slots: {
|
|
||||||
title: 'title',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Child Node2',
|
|
||||||
value: '0-0-2',
|
|
||||||
key: '0-0-2',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Node2',
|
|
||||||
value: '0-1',
|
|
||||||
key: '0-1',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const options = ref([
|
|
||||||
{
|
|
||||||
value: 'zhejiang',
|
|
||||||
label: 'Zhejiang',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: 'hangzhou',
|
|
||||||
label: 'Hangzhou',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: 'xihu',
|
|
||||||
label: 'West Lake',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'jiangsu',
|
|
||||||
label: 'Jiangsu',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: 'nanjing',
|
|
||||||
label: 'Nanjing',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
value: 'zhonghuamen',
|
|
||||||
label: 'Zhong Hua Men',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},])
|
|
||||||
|
|
||||||
getPageList()
|
getPageList()
|
||||||
|
|
||||||
async function getPageList() {
|
async function getPageList() {
|
||||||
|
|||||||
@ -529,8 +529,8 @@ async function handleEdit(record = {}) {
|
|||||||
}
|
}
|
||||||
formData.value = { ...data }
|
formData.value = { ...data }
|
||||||
formData.value.birthDate = dayjs(data.birthDate)
|
formData.value.birthDate = dayjs(data.birthDate)
|
||||||
formData.value.archive.idCardPhotos = data.archive.idCardPhotos ? data.archive.idCardPhotos.map(item => config('http.apiBasic') + item) : []
|
formData.value.archive.idCardPhotos = data.archive.idCardPhotos ? data.archive.idCardPhotos.map(item => config('http.apiUpload') + item) : []
|
||||||
formData.value.archive.uploadedDocuments = data.archive.uploadedDocuments ? data.archive.uploadedDocuments.map(item => config('http.apiBasic') + item) : []
|
formData.value.archive.uploadedDocuments = data.archive.uploadedDocuments ? data.archive.uploadedDocuments.map(item => config('http.apiUpload') + item) : []
|
||||||
formData.value.governmentPurchasedServiceStartDate = [dayjs(formData.value.starGovernmentService), dayjs(formData.value.endGovernmentService)]
|
formData.value.governmentPurchasedServiceStartDate = [dayjs(formData.value.starGovernmentService), dayjs(formData.value.endGovernmentService)]
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
areaCascaderRef.value.initData(data.archive.homeAreaCodes)
|
areaCascaderRef.value.initData(data.archive.homeAreaCodes)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user