配置特定的禁用的方法

main
significative 4 months ago
parent 70839057e4
commit 640f2ee95e
  1. 168
      jeecgboot-vue3-master/src/views/awardpersion/components/AwardPersionForm.vue
  2. 1
      jeecgboot-vue3-master/src/views/awardpersion/components/AwardPersionModal.vue

@ -4,36 +4,38 @@
<a-row>
<a-col :span="24">
<a-form-item label="年度" v-bind="validateInfos.annualid">
<j-dict-select-tag v-model:value="formData.annualid" dictCode="annual,annual_name,id" placeholder="请选择年度" :disabled="disabled"/>
<j-dict-select-tag v-model:value="formData.annualid" dictCode="annual,annual_name,id" placeholder="请选择年度"
:disabled="disabled || isT" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="年度比赛" v-bind="validateInfos.annalComp">
<j-search-select v-model:value="formData.annalComp" :dict="strst" :disabled="disabled" />
<j-search-select v-model:value="formData.annalComp" :dict="strst" :disabled="disabled || isT" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="年度比赛项目" v-bind="validateInfos.annualCompP">
<j-search-select v-model:value="formData.annualCompP" :dict="ndbsxm" :disabled="disabled" />
<j-search-select v-model:value="formData.annualCompP" :dict="ndbsxm" :disabled="disabled || isT" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="报名编号" v-bind="validateInfos.enrollCode">
<a-input v-model:value="formData.enrollCode" placeholder="请输入报名编号" :disabled="disabled"></a-input>
<a-input v-model:value="formData.enrollCode" placeholder="请输入报名编号" :disabled="disabled || isT"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="奖项名称" v-bind="validateInfos.awardname">
<j-dict-select-tag v-model:value="formData.awardname" dictCode="" :options="options" placeholder="请选择奖项名称" :disabled="disabled"/>
<j-dict-select-tag v-model:value="formData.awardname" dictCode="" :options="options" placeholder="请选择奖项名称"
:disabled="disabled" />
</a-form-item>
</a-col>
<!-- <a-col :span="24">
<!-- <a-col :span="24">
<a-form-item label="状态" v-bind="validateInfos.status">
<j-dict-select-tag v-model:value="formData.status" dictCode="sh_status" placeholder="请选择状态" :disabled="disabled"/>
</a-form-item>
</a-col>-->
<a-input v-model:value="formData.awardsort" hidden/>
<!-- <a-col :span="24">
<a-input v-model:value="formData.awardsort" hidden />
<!-- <a-col :span="24">
<a-form-item label="奖项" v-bind="validateInfos.awardid">
<a-input v-model:value="formData.awardid" placeholder="请输入奖项" :disabled="disabled"></a-input>
</a-form-item>
@ -44,28 +46,28 @@
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted,watch } 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 JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate,queryCompId,queryOptions } from '../AwardPersion.api';
import { Form } from 'ant-design-vue';
import { duplicateValidate } from '/@/utils/helper/validator'
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, watch } 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 JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate, queryCompId, queryOptions } from '../AwardPersion.api';
import { Form } from 'ant-design-vue';
import { duplicateValidate } from '/@/utils/helper/validator'
let strst = ref();
let ndbsxm = ref();
let options= ref();
const props = defineProps({
let strst = ref();
let ndbsxm = ref();
let options = ref();
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: '',
annualid: '',
annalComp: '',
@ -75,94 +77,101 @@
status: undefined,
awardsort: undefined,
awardid: '',
});
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 = {
annualid: [{ required: true, message: '请输入年度!'},],
annalComp: [{ required: true, message: '请输入年度比赛!'},],
annualCompP: [{ required: true, message: '请输入年度比赛项目!'},],
enrollCode: [{ required: true, message: '请输入报名编号!'}, { validator: enrollCodeDuplicatevalidate }],
awardname: [{ required: true, message: '请输入奖项名称!'},],
};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
});
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 = {
annualid: [{ required: true, message: '请输入年度!' },],
annalComp: [{ required: true, message: '请输入年度比赛!' },],
annualCompP: [{ required: true, message: '请输入年度比赛项目!' },],
enrollCode: [{ required: true, message: '请输入报名编号!' }, { validator: enrollCodeDuplicatevalidate }],
awardname: [{ required: true, message: '请输入奖项名称!' },],
};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
//
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;
});
watch(formData, (newVal) => {
if(formData.annualid==null||formData.annualid==""){
});
watch(formData, (newVal) => {
if (formData.annualid == null || formData.annualid == "") {
}else{
queryCompId("").then((result)=>{
} else {
queryCompId("").then((result) => {
//console.log(result);
const str = result;
if (str!=null&&str!="") {
if (str != null && str != "") {
//const ndbs = "annual_comp,name,id,annualid='1691982939857920001' and (compid='1696134761153875969' or compid='1697137689830363138')";
var ndbsstr="annual_comp,name,id,annualid='"+formData.annualid+"' and "+"("+str+")";
strst.value=ndbsstr;
var ndbsstr = "annual_comp,name,id,annualid='" + formData.annualid + "' and " + "(" + str + ")";
strst.value = ndbsstr;
}
});
}
if(formData.annalComp!=""){
ndbsxm.value = "annual_comp_point,obj_name,id,annual_comp_id='"+formData.annalComp+"'";
if (formData.annalComp != "") {
ndbsxm.value = "annual_comp_point,obj_name,id,annual_comp_id='" + formData.annalComp + "'";
}
if(formData.annualCompP!=""&&formData.annualCompP!=null&&formData.annualCompP!=undefined){
queryOptions({annucompid:formData.annualCompP}).then((result)=>{
if (formData.annualCompP != "" && formData.annualCompP != null && formData.annualCompP != undefined) {
queryOptions({ annucompid: formData.annualCompP }).then((result) => {
//console.log(result);
if (result!=null&&result!=""&&result!=undefined) {
if (result != null && result != "" && result != undefined) {
options.value = result;
if(formData.awardname!=""&&formData.awardname!=null&&formData.awardname!=undefined){
if(formData.awardname==1||formData.awardname==2||formData.awardname==3||formData.awardname==4||formData.awardname==5){
formData.awardsort = result[formData.awardname-1].label;
if (formData.awardname != "" && formData.awardname != null && formData.awardname != undefined) {
if (formData.awardname == 1 || formData.awardname == 2 || formData.awardname == 3 || formData.awardname == 4 || formData.awardname == 5) {
formData.awardsort = result[formData.awardname - 1].label;
}
}
}
});
}
});
});
/**
* 特定的禁用
*/
let isT = ref(false)
function setIsT(bool=false){
isT.value=bool
}
/**
/**
* 新增
*/
function add() {
function add() {
edit({});
}
}
/**
/**
* 编辑
*/
function edit(record) {
function edit(record) {
nextTick(() => {
resetFields();
//
Object.assign(formData, record);
});
}
}
/**
/**
* 提交数据
*/
async function submitForm() {
async function submitForm() {
//
await validate();
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if(model.awardname==1||model.awardname==2||model.awardname==3||model.awardname==4||model.awardname==5){
if (model.awardname == 1 || model.awardname == 2 || model.awardname == 3 || model.awardname == 4 || model.awardname == 5) {
let awardsort = model.awardname;
let awardname = model.awardsort;
model.awardname = awardname;
@ -195,23 +204,24 @@
.finally(() => {
confirmLoading.value = false;
});
}
}
async function enrollCodeDuplicatevalidate(_r, value) {
async function enrollCodeDuplicatevalidate(_r, value) {
return duplicateValidate('award_persion', 'enroll_code', value, formData.id || '')
}
defineExpose({
}
defineExpose({
add,
edit,
submitForm,
});
setIsT
});
</script>
<style lang="less" scoped>
.antd-modal-form {
.antd-modal-form {
min-height: 500px !important;
overflow-y: auto;
padding: 24px 24px 24px 24px;
}
}
</style>

@ -35,6 +35,7 @@
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
registerForm.value.setIsT(true);
});
}

Loading…
Cancel
Save