Files
ba_web/src/views/securityManagement/personnelManagement/practitioner/components/addPractitionerDialog.vue

237 lines
7.7 KiB
Vue
Raw Normal View History

2025-09-22 09:01:41 +08:00
<template>
<div class="dialog" v-if="dialogVisible">
<div class="head_box">
<span class="title">{{ title }}</span>
<div>
2025-09-22 19:00:02 +08:00
<el-button size="small" @click="save" type="primary" v-if="!disabled" :loading="loading">保存</el-button>
2025-09-22 09:01:41 +08:00
<el-button size="small" @click="close">关闭</el-button>
</div>
</div>
<div class="cntinfo">
2026-01-13 22:17:31 +08:00
<FormMessage ref="FormRef" :disabled="disabled" v-model="formData" :rules="rules" :formList="formList"
:labelWidth='120'>
2025-09-26 16:55:18 +08:00
<template #pxgs>
<el-input v-model="formData.pxgs" @click="selectPxgs" readonly placeholder="请选择培训公司"></el-input>
</template>
<template #lzsj>
<el-input v-model="formData.lzsj" disabled placeholder="请选择离职时间"></el-input>
</template>
2025-09-22 09:01:41 +08:00
</FormMessage>
</div>
2025-09-26 16:55:18 +08:00
<!-- 选择公司 -->
<ChooseCompany ref="RefConmay" @change="changePxgs"></ChooseCompany>
2025-09-22 09:01:41 +08:00
</div>
</template>
<script setup>
2025-09-26 16:55:18 +08:00
import ChooseCompany from './chooseCompany.vue'
2026-01-14 17:49:38 +08:00
import { ref, reactive, getCurrentInstance, watch, onMounted } from 'vue'
2025-09-22 09:01:41 +08:00
import { qcckPost } from "@/api/qcckApi.js";
import FormMessage from '@/components/aboutTable/FormMessage.vue'
2026-01-13 22:17:31 +08:00
import { getItem } from '@/utils/storage'
2025-09-25 16:28:13 +08:00
import * as rule from "@/utils/rules.js";
2025-09-22 09:01:41 +08:00
const { proxy } = getCurrentInstance()
2026-01-13 22:17:31 +08:00
const { D_BAXX_GWLX, B_BZ_ZYLB, D_BAXX_SSHY, D_BAXX_DWLX } = proxy.$dict("D_BAXX_GWLX", "B_BZ_ZYLB", "D_BAXX_SSHY", "D_BAXX_DWLX");
2025-09-22 09:01:41 +08:00
const title = ref('新增从业人员')
const loading = ref(false)
const disabled = ref(false)
const FormRef = ref(null)
2025-09-26 16:55:18 +08:00
const RefConmay = ref()
2025-09-22 09:01:41 +08:00
const props = defineProps({
modelValue: {
type: Boolean,
default: false
},
})
2025-09-24 20:32:05 +08:00
const emits = defineEmits(['update:modelValue', 'refresh'])
2026-01-13 22:17:31 +08:00
const companyList = ref([])
// 获取我的公司
const myCompany = () => {
const cjrsfzh = getItem("userInfo")
const params = { cjrsfzh: cjrsfzh.sfzh }
2026-01-14 17:49:38 +08:00
qcckPost({
pageCurrent: 1,
pageSize: 1000
}, "/mosty-base/baxx/dwgl/page").then(res => {
companyList.value = res.records.map(item => {
2026-01-13 22:17:31 +08:00
return {
2026-01-14 17:49:38 +08:00
zdmc: item.dwmc || item.csmc,
dm: item.csdm || item.id
2026-01-13 22:17:31 +08:00
}
}) || [];
2026-01-14 17:49:38 +08:00
console.log(companyList.value);
2026-01-13 22:17:31 +08:00
});
}
2026-01-14 17:49:38 +08:00
2026-01-13 22:17:31 +08:00
onMounted(() => {
2026-01-14 17:49:38 +08:00
getPxgsidList()
2026-01-13 22:17:31 +08:00
myCompany()
})
const dicDefault = {
B_BZ_BAZGZ: [
{ zdmc: "保安员上岗证", value: "01" },
{ zdmc: "保安员职业资格证", value: "02" },
],
// 职业类别
B_BZ_ZYLB: [
{ zdmc: "国家机关", value: "01" },
{ zdmc: "党群组织", value: "02" },
{ zdmc: "事业单位负责人", value: "03" },
{ zdmc: "专业技术人员", value: "04" },
{ zdmc: "办事人员和有关人员", value: "05" },
{ zdmc: "商业、服务业人员", value: "06" },
{ zdmc: "农、林、牧、渔、水利业生产人员", value: "07" },
{ zdmc: "生产、运输设备操作人员及有关人员", value: "08" },
{ zdmc: "军人", value: "09" },
{ zdmc: "其他从业人员 ", value: "10" },
]
}
const pxgsidList = ref([])
2025-09-25 16:28:13 +08:00
const dialogVisible = ref(false)
2026-01-14 17:49:38 +08:00
const formList = ref()
watch(() => companyList.value, (newVal, oldVal) => {
if (newVal) {
formList.value = [
[
// { label: "单位名称", prop: "code", type: "select", options: companyList.value },
{ label: "所属公司", prop: "pxgs", type: "slot" },
{ label: "姓名", prop: "xm", type: "input" },
{ label: "证件号码", prop: "sfzh", type: "input" },
2026-01-13 22:17:31 +08:00
2025-09-22 09:01:41 +08:00
2026-01-14 17:49:38 +08:00
],
[
{ label: "联系电话", prop: "lxdh", type: "input" },
{ label: "居住地址", prop: "jzdz", type: "input" },
{ label: "职业类别", prop: "zydm", type: "select", options: dicDefault.B_BZ_ZYLB },
], [
{ label: "入职时间", prop: "rzsj", type: "date" },
{ label: "所属行业", prop: "sshy", type: "select", options: D_BAXX_SSHY },
{ label: "服务行业名称", prop: "hymc", type: "input" },
], [
{ label: "岗位", prop: "gw", type: "select", options: D_BAXX_GWLX },
{ label: "单位类型", prop: "dwlx", type: "select", options: D_BAXX_DWLX },
{ label: "资格证类型", prop: "zgzlx", type: "select", options: dicDefault.B_BZ_BAZGZ },
{ label: "资格证编号", prop: "zgzbh", type: "input" },
], [
{ label: "资格证起始日期", prop: "zgzKssj", type: "date" },
{ label: "资格证截止日期", prop: "zgzJssj", type: "date" },
{ label: "外派单位", prop: "wpdw", type: "input" },
],
[
{ label: "从业人员照片", prop: "tp", type: "upload" },
]
]
}
})
2025-09-22 09:01:41 +08:00
const rules = {
xm: [{ required: true, message: "请输入姓名", trigger: "change" }],
2026-01-13 22:17:31 +08:00
...rule.phoneRule({ validator: true, message: "请输入联系电话", require: true }, "lxdh"), // 是否必填 是否进行校验`
...rule.identityCardRule({ validator: true, message: "请输入身份证号", require: true }, "sfzh"), // 是否必填 是否进行校验
2025-09-22 09:01:41 +08:00
jzdz: [{ required: true, message: "请输入居住地址", trigger: "change" }],
rzsj: [{ required: true, message: "请选择入职时间", trigger: "change" }],
zgzbh: [{ required: true, message: "请输入资格证编号", trigger: "change" }],
gw: [{ required: true, message: "请输入岗位", trigger: "change" }],
2025-09-22 09:01:41 +08:00
zgzlx: [{ required: true, message: "请输入资格证类型", trigger: "change" }],
zgzKssj: [{ required: true, message: "请选择资格证起始日期", trigger: "change" }],
zgzJssj: [{ required: true, message: "请选择资格证截至日期", trigger: "blur" }],
whcd: [{ required: true, message: "请选择文化程度", trigger: "change" }],
2026-01-13 22:17:31 +08:00
// pxgs: [{ required: true, message: "请选择培训公司", trigger: "change" }],
}
const getPxgsidList = () => {
2026-01-14 17:49:38 +08:00
const userInfo = getItem("userInfo")
const params = { keyword: userInfo.sfzh, pageCurrent: 1, pageSize: 1000 }
qcckPost(params, "/mosty-base/baxx/dwgl/page").then(res => {
pxgsidList.value = res.records.map(item => {
2026-01-13 22:17:31 +08:00
return {
dm: item.id,
2026-01-14 17:49:38 +08:00
zdmc: item.csmc
2026-01-13 22:17:31 +08:00
}
}) || [];
});
2025-09-22 09:01:41 +08:00
}
2026-01-13 22:17:31 +08:00
const formData = ref({})
2026-01-14 17:49:38 +08:00
// watch(() => formData.value.dwlx, (newVal, oldVal) => {
// if (newVal !== oldVal) {
// getPxgsidList()
// }
// }, { deep: true })
2025-09-26 16:55:18 +08:00
const selectPxgs = () => {
RefConmay.value.open()
}
const changePxgs = (data) => {
formData.value.pxgs = data.pxgs
formData.value.pxgsid = data.pxgsid
}
2025-09-22 09:01:41 +08:00
const close = () => {
FormRef.value?.reset();
2025-09-25 16:28:13 +08:00
formData.value = {}
2025-09-22 09:01:41 +08:00
dialogVisible.value = false
}
const open = (row = {}, type = 'add') => {
dialogVisible.value = true
2025-09-22 18:11:34 +08:00
disabled.value = false
2025-09-26 10:50:15 +08:00
const fieldsToSplit = ['tp', 'bazzp'];
2025-09-26 17:22:28 +08:00
fieldsToSplit.forEach(field => {
2026-01-13 22:17:31 +08:00
row[field] = typeof row[field] === 'string' ? row[field].split(',') : row[field];
2025-09-26 10:50:15 +08:00
});
2025-09-22 09:01:41 +08:00
formData.value = { ...row }
if (type === 'add') {
title.value = '新增从业人员'
} else if (type === 'edit') {
title.value = '编辑从业人员'
} else {
2025-09-22 18:11:34 +08:00
disabled.value = true
2025-09-22 09:01:41 +08:00
title.value = '查看详情'
}
}
const save = () => {
FormRef.value.submit(() => {
loading.value = true;
2025-09-26 17:22:28 +08:00
const url = !formData.value?.id ? `/mosty-base/baxx/cyry/add` : `/mosty-base/baxx/cyry/edit`;
2025-09-25 16:28:13 +08:00
let params = { ...formData.value }
2026-01-13 22:17:31 +08:00
params.tp = params.tp ? params.tp.join(',') : ''
params.bazzp = params.bazzp ? params.bazzp.join(',') : ''
2025-09-25 16:28:13 +08:00
qcckPost(params, url).then(() => {
2025-09-22 09:01:41 +08:00
loading.value = false;
proxy.$message.success("保存成功");
emits("refresh");
close();
}).catch(() => {
loading.value = false;
})
});
}
defineExpose({ open })
</script>
<style lang="scss" scoped>
@import "@/assets/css/layout.scss";
2026-01-13 22:17:31 +08:00
.cntinfo {
2025-09-22 09:01:41 +08:00
height: calc(100% - 70px);
overflow: hidden;
overflow-y: auto;
}
.mapBox {
width: 100%;
height: 400px;
overflow: hidden;
}
</style>