Compare commits
2 Commits
6aaa47a451
...
8c6c28ba10
| Author | SHA1 | Date |
|---|---|---|
|
|
8c6c28ba10 | |
|
|
9345b935fb |
|
|
@ -1,30 +1,40 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="true">
|
||||
<JFormContainer :disabled="disabled">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
|
||||
name="BlWarehouseMaterialInfoForm">
|
||||
<a-row class="card-class">
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="BlWarehouseMaterialInfoForm">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="库房" v-bind="validateInfos.nuName" id="BlWarehouseMaterialInfoForm-nuName"
|
||||
name="nuName">
|
||||
<a-input v-model:value="formData.nuName"></a-input>
|
||||
<a-form-item label="库房" v-bind="validateInfos.nuName" id="BlWarehouseMaterialInfoForm-nuName" name="nuName" >
|
||||
<a-input v-model:value="formData.nuName" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="负责人" v-bind="validateInfos.fzr" id="BlWarehouseMaterialInfoForm-fzr" name="fzr">
|
||||
<a-input v-model:value="formData.fzr"></a-input>
|
||||
<a-form-item label="负责人" v-bind="validateInfos.fzr" id="BlWarehouseMaterialInfoForm-fzr" name="fzr" >
|
||||
<a-input v-model:value="formData.fzr" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="负责人电话" v-bind="validateInfos.fzrTel" id="BlWarehouseMaterialInfoForm-fzrTel"
|
||||
name="fzrTel">
|
||||
<a-input v-model:value="formData.fzrTel"></a-input>
|
||||
<a-form-item label="负责人电话" v-bind="validateInfos.fzrTel" id="BlWarehouseMaterialInfoForm-fzrTel" name="fzrTel" >
|
||||
<a-input v-model:value="formData.fzrTel" ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="负责人头像" v-bind="validateInfos.fzrHeadPath" id="BlWarehouseMaterialInfoForm-fzrHeadPath"
|
||||
name="fzrHeadPath">
|
||||
<a-form-item label="性别" v-bind="validateInfos.fzrSex" id="BlWarehouseMaterialInfoForm-fzrSex" name="fzrSex">
|
||||
<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>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
|
@ -36,85 +46,86 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { editFzr } from '../BlWarehouseMaterialInfo.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
|
||||
import { truncate } from 'node:fs';
|
||||
const props = defineProps({
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { editFzr } from '../BlWarehouseMaterialInfo.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: () => ({}) },
|
||||
formData: { type: Object, default: () => ({})},
|
||||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
nuId: '',
|
||||
nuName: '',
|
||||
fzr: '',
|
||||
fzrTel: '',
|
||||
fzrHeadPath: '',
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
fzrHeadPath:'',
|
||||
fzrSex:'',
|
||||
fzrAge:'',
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
nuName: [{ required: true, message: '请输入库房名称!' },],
|
||||
fzrTel: [{ required: false, message: '请输入负责人电话!' }, { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }],
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
fzrTel: [{ required: false, message: '请输入负责人电话!' },{ pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' }],
|
||||
});
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(() => {
|
||||
if (props.formBpm === true) {
|
||||
if (props.formData.disabled === false) {
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
return false;
|
||||
} else {
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return props.formDisabled;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
function add() {
|
||||
edit({});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
function edit(record) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
const tmpData = {};
|
||||
Object.keys(formData).forEach((key) => {
|
||||
if (record.hasOwnProperty(key)) {
|
||||
if(record.hasOwnProperty(key)){
|
||||
tmpData[key] = record[key]
|
||||
}
|
||||
})
|
||||
//赋值
|
||||
Object.assign(formData, tmpData);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
async function submitForm() {
|
||||
try {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
|
|
@ -157,30 +168,18 @@ async function submitForm() {
|
|||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
// 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;
|
||||
}
|
||||
.antd-modal-form {
|
||||
padding: 14px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue