Compare commits

...

2 Commits

Author SHA1 Message Date
yangjun 8c6c28ba10 Merge branch 'master' of http://47.115.223.229:8888/yangjun/nursing_unit_vue
# Conflicts:
#	src/views/invoicing/warehouseMaterialInfo/components/CkfzrForm.vue
2025-11-04 13:53:23 +08:00
yangjun 9345b935fb 添加字段 2025-11-04 13:51:48 +08:00
1 changed files with 161 additions and 162 deletions

View File

@ -1,30 +1,40 @@
<template> <template>
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<JFormContainer :disabled="true"> <JFormContainer :disabled="disabled">
<template #detail> <template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" <a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="BlWarehouseMaterialInfoForm">
name="BlWarehouseMaterialInfoForm"> <a-row>
<a-row class="card-class">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="库房" v-bind="validateInfos.nuName" id="BlWarehouseMaterialInfoForm-nuName" <a-form-item label="库房" v-bind="validateInfos.nuName" id="BlWarehouseMaterialInfoForm-nuName" name="nuName" >
name="nuName"> <a-input v-model:value="formData.nuName" ></a-input>
<a-input v-model:value="formData.nuName"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="负责人" v-bind="validateInfos.fzr" id="BlWarehouseMaterialInfoForm-fzr" name="fzr"> <a-form-item label="负责人" v-bind="validateInfos.fzr" id="BlWarehouseMaterialInfoForm-fzr" name="fzr" >
<a-input v-model:value="formData.fzr"></a-input> <a-input v-model:value="formData.fzr" ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="负责人电话" v-bind="validateInfos.fzrTel" id="BlWarehouseMaterialInfoForm-fzrTel" <a-form-item label="负责人电话" v-bind="validateInfos.fzrTel" id="BlWarehouseMaterialInfoForm-fzrTel" name="fzrTel" >
name="fzrTel"> <a-input v-model:value="formData.fzrTel" ></a-input>
<a-input v-model:value="formData.fzrTel"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="负责人头像" v-bind="validateInfos.fzrHeadPath" id="BlWarehouseMaterialInfoForm-fzrHeadPath" <a-form-item label="性别" v-bind="validateInfos.fzrSex" id="BlWarehouseMaterialInfoForm-fzrSex" name="fzrSex">
name="fzrHeadPath"> <a-select placeholder="性别" v-model:value="formData.fzrSex">
<a-select-option value="">请选择</a-select-option>
<a-select-option value="男"></a-select-option>
<a-select-option value="女"></a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="年龄" v-bind="validateInfos.fzrAge" id="BlWarehouseMaterialInfoForm-fzrAge" name="fzrAge">
<a-input-number placeholder="年龄" v-model:value="formData.fzrAge" min="18" max="99" style="width: 100%" ></a-input-number>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="负责人头像" v-bind="validateInfos.fzrHeadPath" id="BlWarehouseMaterialInfoForm-fzrHeadPath" name="fzrHeadPath">
<j-image-upload :fileMax="1" text="无" v-model:value="formData.fzrHeadPath"></j-image-upload> <j-image-upload :fileMax="1" text="无" v-model:value="formData.fzrHeadPath"></j-image-upload>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -36,85 +46,86 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue'; import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue'; import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
import { getValueType } from '/@/utils'; import { getValueType } from '/@/utils';
import { editFzr } from '../BlWarehouseMaterialInfo.api'; import { editFzr } from '../BlWarehouseMaterialInfo.api';
import { Form } from 'ant-design-vue'; import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'; import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue'; import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
import { truncate } from 'node:fs'; const props = defineProps({
const props = defineProps({
formDisabled: { type: Boolean, default: false }, formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) }, formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true } formBpm: { type: Boolean, default: true }
}); });
const formRef = ref(); const formRef = ref();
const useForm = Form.useForm; const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']); const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({ const formData = reactive<Record<string, any>>({
id: '', id: '',
nuId: '', nuId: '',
nuName: '', nuName: '',
fzr: '', fzr: '',
fzrTel: '', fzrTel: '',
fzrHeadPath: '', fzrHeadPath:'',
}); fzrSex:'',
const { createMessage } = useMessage(); fzrAge:'',
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } }); const { createMessage } = useMessage();
const confirmLoading = ref<boolean>(false); const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
// const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const validatorRules = reactive({ const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
nuName: [{ required: true, message: '请输入库房名称!' },], nuName: [{ required: true, message: '请输入库房名称!' },],
fzrTel: [{ required: false, message: '请输入负责人电话!' }, { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }], fzrTel: [{ required: false, message: '请输入负责人电话!' },{ pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }],
}); });
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false }); const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
// //
const disabled = computed(() => { const disabled = computed(()=>{
if (props.formBpm === true) { if(props.formBpm === true){
if (props.formData.disabled === false) { if(props.formData.disabled === false){
return false; return false;
} else { }else{
return true; return true;
} }
} }
return props.formDisabled; return props.formDisabled;
}); });
/** /**
* 新增 * 新增
*/ */
function add() { function add() {
edit({}); edit({});
} }
/** /**
* 编辑 * 编辑
*/ */
function edit(record) { function edit(record) {
nextTick(() => { nextTick(() => {
resetFields(); resetFields();
const tmpData = {}; const tmpData = {};
Object.keys(formData).forEach((key) => { Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) { if(record.hasOwnProperty(key)){
tmpData[key] = record[key] tmpData[key] = record[key]
} }
}) })
// //
Object.assign(formData, tmpData); Object.assign(formData, tmpData);
}); });
} }
/** /**
* 提交数据 * 提交数据
*/ */
async function submitForm() { async function submitForm() {
try { try {
// //
await validate(); await validate();
@ -157,30 +168,18 @@ async function submitForm() {
.finally(() => { .finally(() => {
confirmLoading.value = false; confirmLoading.value = false;
}); });
} }
defineExpose({ defineExpose({
add, add,
edit, edit,
submitForm, submitForm,
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.antd-modal-form { .antd-modal-form {
// padding: 14px; padding: 14px;
} }
.card-class {
padding-top: 24px;
padding-bottom: 24px;
padding-left: 14px;
padding-right: 14px;
// background-color: rgba(255, 255, 255, 0.9);
background-color: #fcfdff;
border-radius: 10px;
// box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 12px;
margin-bottom: 14px;
}
</style> </style>