'新增页面'
This commit is contained in:
@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<div class="dialog" v-if="dialogVisible">
|
||||
<div class="head_box">
|
||||
<span class="title">{{ title }}</span>
|
||||
<div>
|
||||
<el-button size="small" @click="save" type="primary" :loading="loading">保存</el-button>
|
||||
<el-button size="small" @click="close">关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cntinfo">
|
||||
<FormMessage ref="FormRef" :disabled="disabled" v-model="formData" :rules="rules" :formList="formList" :labelWidth='120'>
|
||||
<!-- <template #zb>
|
||||
<el-input v-model="formData.zb" placeholder="请选择巡逻路线">
|
||||
<template #append><el-button type="primary" @click="chackLat">开始绘制</el-button></template>
|
||||
</el-input>
|
||||
</template> -->
|
||||
</FormMessage>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, reactive, getCurrentInstance } from 'vue'
|
||||
import { qcckPost } from "@/api/qcckApi.js";
|
||||
import FormMessage from '@/components/aboutTable/FormMessage.vue'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const title = ref('新增培训人员')
|
||||
const loading = ref(false)
|
||||
const disabled = ref(false)
|
||||
const FormRef = ref(null)
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
dic: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
|
||||
const dialogVisible = computed({
|
||||
get() {
|
||||
return props.modelValue
|
||||
},
|
||||
set(val) {
|
||||
emits('update:modelValue', val)
|
||||
}
|
||||
})
|
||||
|
||||
const formList = reactive([
|
||||
[
|
||||
{ label: "姓名", prop: "xm", type: "input" },
|
||||
{ label: "证件号码", prop: "sfzh", type: "select", options: props.dic.D_BZ_BXDLX },
|
||||
{ label: "联系电话", prop: "lxdh", type: "input" },
|
||||
],
|
||||
[
|
||||
{ label: "居住地址", prop: "jzdz", type: "input" },
|
||||
{ label: "申请时间", prop: "rzsj", type: "date" },
|
||||
{ label: "岗位", prop: "ssbmdm", type: "select" },
|
||||
],
|
||||
[
|
||||
{ label: "所属保安公司", prop: "pxgs", type: "select" },
|
||||
],
|
||||
[
|
||||
{ label: "身份证正反面", prop: "ssbmdm", type: "upload", limit: 2 },
|
||||
],
|
||||
[
|
||||
{ label: "体检报告", prop: "ssbmdm", type: "upload", limit: 1 },
|
||||
],
|
||||
[
|
||||
{ label: "无犯罪记录证明", prop: "ssbmdm", type: "upload", limit: 1 },
|
||||
]
|
||||
])
|
||||
|
||||
const rules = {
|
||||
xm: [{ required: true, message: "请输入姓名", trigger: "change" }],
|
||||
sfzh: [{ required: true, message: "请输入证件号码", trigger: "change" }],
|
||||
lxdh: [{ required: true, message: "请输入联系电话", trigger: "change" }],
|
||||
jzdz: [{ required: true, message: "请输入居住地址", trigger: "change" }],
|
||||
rzsj: [{ required: true, message: "请选择入职时间", trigger: "change" }],
|
||||
pxgs: [{ required: true, message: "请选择所属保安公司", trigger: "change" }],
|
||||
}
|
||||
|
||||
const formData = ref({})
|
||||
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
const open = (row = {}, type = 'add') => {
|
||||
disabled.value = false
|
||||
dialogVisible.value = true
|
||||
formData.value = { ...row }
|
||||
if (type === 'add') {
|
||||
title.value = '新增从业人员'
|
||||
} else if (type === 'edit') {
|
||||
title.value = '编辑从业人员'
|
||||
} else {
|
||||
disabled.value = true
|
||||
title.value = '查看详情'
|
||||
}
|
||||
}
|
||||
|
||||
const save = () => {
|
||||
FormRef.value.submit(() => {
|
||||
loading.value = true;
|
||||
const url = !formData.value?.id ? `/mosty-base/baxx/cyry/add` : `/mosty-base/baxx/cyry/edit`;
|
||||
qcckPost(formData.value, url).then(() => {
|
||||
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";
|
||||
|
||||
.cntinfo{
|
||||
height: calc(100% - 70px);
|
||||
overflow: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.mapBox {
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user