|
|
@ -4,36 +4,38 @@ |
|
|
|
<a-row> |
|
|
|
<a-row> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="年度" v-bind="validateInfos.annualid"> |
|
|
|
<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-form-item> |
|
|
|
</a-col> |
|
|
|
</a-col> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="年度比赛" v-bind="validateInfos.annalComp"> |
|
|
|
<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-form-item> |
|
|
|
</a-col> |
|
|
|
</a-col> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="年度比赛项目" v-bind="validateInfos.annualCompP"> |
|
|
|
<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-form-item> |
|
|
|
</a-col> |
|
|
|
</a-col> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="报名编号" v-bind="validateInfos.enrollCode"> |
|
|
|
<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-form-item> |
|
|
|
</a-col> |
|
|
|
</a-col> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="奖项名称" v-bind="validateInfos.awardname"> |
|
|
|
<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-form-item> |
|
|
|
</a-col> |
|
|
|
</a-col> |
|
|
|
<!-- <a-col :span="24"> |
|
|
|
<!-- <a-col :span="24"> |
|
|
|
<a-form-item label="状态" v-bind="validateInfos.status"> |
|
|
|
<a-form-item label="状态" v-bind="validateInfos.status"> |
|
|
|
<j-dict-select-tag v-model:value="formData.status" dictCode="sh_status" placeholder="请选择状态" :disabled="disabled"/> |
|
|
|
<j-dict-select-tag v-model:value="formData.status" dictCode="sh_status" placeholder="请选择状态" :disabled="disabled"/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
</a-col>--> |
|
|
|
</a-col>--> |
|
|
|
<a-input v-model:value="formData.awardsort" hidden/> |
|
|
|
<a-input v-model:value="formData.awardsort" hidden /> |
|
|
|
<!-- <a-col :span="24"> |
|
|
|
<!-- <a-col :span="24"> |
|
|
|
<a-form-item label="奖项" v-bind="validateInfos.awardid"> |
|
|
|
<a-form-item label="奖项" v-bind="validateInfos.awardid"> |
|
|
|
<a-input v-model:value="formData.awardid" placeholder="请输入奖项" :disabled="disabled"></a-input> |
|
|
|
<a-input v-model:value="formData.awardid" placeholder="请输入奖项" :disabled="disabled"></a-input> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
@ -44,174 +46,182 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted,watch } from 'vue'; |
|
|
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, watch } 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 JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; |
|
|
|
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; |
|
|
|
import { getValueType } from '/@/utils'; |
|
|
|
import { getValueType } from '/@/utils'; |
|
|
|
import { saveOrUpdate,queryCompId,queryOptions } from '../AwardPersion.api'; |
|
|
|
import { saveOrUpdate, queryCompId, queryOptions } from '../AwardPersion.api'; |
|
|
|
import { Form } from 'ant-design-vue'; |
|
|
|
import { Form } from 'ant-design-vue'; |
|
|
|
import { duplicateValidate } from '/@/utils/helper/validator' |
|
|
|
import { duplicateValidate } from '/@/utils/helper/validator' |
|
|
|
|
|
|
|
|
|
|
|
let strst = ref(); |
|
|
|
let strst = ref(); |
|
|
|
let ndbsxm = ref(); |
|
|
|
let ndbsxm = ref(); |
|
|
|
let options= ref(); |
|
|
|
let options = ref(); |
|
|
|
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: '', |
|
|
|
annualid: '', |
|
|
|
annualid: '', |
|
|
|
annalComp: '', |
|
|
|
annalComp: '', |
|
|
|
annualCompP: '', |
|
|
|
annualCompP: '', |
|
|
|
enrollCode: '', |
|
|
|
enrollCode: '', |
|
|
|
awardname: '', |
|
|
|
awardname: '', |
|
|
|
status: undefined, |
|
|
|
status: undefined, |
|
|
|
awardsort: undefined, |
|
|
|
awardsort: undefined, |
|
|
|
awardid: '', |
|
|
|
awardid: '', |
|
|
|
}); |
|
|
|
}); |
|
|
|
const { createMessage } = useMessage(); |
|
|
|
const { createMessage } = useMessage(); |
|
|
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); |
|
|
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); |
|
|
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } }); |
|
|
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } }); |
|
|
|
const confirmLoading = ref<boolean>(false); |
|
|
|
const confirmLoading = ref<boolean>(false); |
|
|
|
//表单验证 |
|
|
|
//表单验证 |
|
|
|
const validatorRules = { |
|
|
|
const validatorRules = { |
|
|
|
annualid: [{ required: true, message: '请输入年度!'},], |
|
|
|
annualid: [{ required: true, message: '请输入年度!' },], |
|
|
|
annalComp: [{ required: true, message: '请输入年度比赛!'},], |
|
|
|
annalComp: [{ required: true, message: '请输入年度比赛!' },], |
|
|
|
annualCompP: [{ required: true, message: '请输入年度比赛项目!'},], |
|
|
|
annualCompP: [{ required: true, message: '请输入年度比赛项目!' },], |
|
|
|
enrollCode: [{ required: true, message: '请输入报名编号!'}, { validator: enrollCodeDuplicatevalidate }], |
|
|
|
enrollCode: [{ required: true, message: '请输入报名编号!' }, { validator: enrollCodeDuplicatevalidate }], |
|
|
|
awardname: [{ required: true, message: '请输入奖项名称!'},], |
|
|
|
awardname: [{ required: true, message: '请输入奖项名称!' },], |
|
|
|
}; |
|
|
|
}; |
|
|
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); |
|
|
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); |
|
|
|
|
|
|
|
|
|
|
|
// 表单禁用 |
|
|
|
// 表单禁用 |
|
|
|
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; |
|
|
|
watch(formData, (newVal) => { |
|
|
|
}); |
|
|
|
if(formData.annualid==null||formData.annualid==""){ |
|
|
|
watch(formData, (newVal) => { |
|
|
|
|
|
|
|
if (formData.annualid == null || formData.annualid == "") { |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
queryCompId("").then((result)=>{ |
|
|
|
queryCompId("").then((result) => { |
|
|
|
//console.log(result); |
|
|
|
//console.log(result); |
|
|
|
const str = 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')"; |
|
|
|
//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+")"; |
|
|
|
var ndbsstr = "annual_comp,name,id,annualid='" + formData.annualid + "' and " + "(" + str + ")"; |
|
|
|
strst.value=ndbsstr; |
|
|
|
strst.value = ndbsstr; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if(formData.annalComp!=""){ |
|
|
|
if (formData.annalComp != "") { |
|
|
|
ndbsxm.value = "annual_comp_point,obj_name,id,annual_comp_id='"+formData.annalComp+"'"; |
|
|
|
ndbsxm.value = "annual_comp_point,obj_name,id,annual_comp_id='" + formData.annalComp + "'"; |
|
|
|
} |
|
|
|
} |
|
|
|
if(formData.annualCompP!=""&&formData.annualCompP!=null&&formData.annualCompP!=undefined){ |
|
|
|
if (formData.annualCompP != "" && formData.annualCompP != null && formData.annualCompP != undefined) { |
|
|
|
queryOptions({annucompid:formData.annualCompP}).then((result)=>{ |
|
|
|
queryOptions({ annucompid: formData.annualCompP }).then((result) => { |
|
|
|
//console.log(result); |
|
|
|
//console.log(result); |
|
|
|
if (result!=null&&result!=""&&result!=undefined) { |
|
|
|
if (result != null && result != "" && result != undefined) { |
|
|
|
options.value = result; |
|
|
|
options.value = result; |
|
|
|
if(formData.awardname!=""&&formData.awardname!=null&&formData.awardname!=undefined){ |
|
|
|
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){ |
|
|
|
if (formData.awardname == 1 || formData.awardname == 2 || formData.awardname == 3 || formData.awardname == 4 || formData.awardname == 5) { |
|
|
|
formData.awardsort = result[formData.awardname-1].label; |
|
|
|
formData.awardsort = result[formData.awardname - 1].label; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 特定的禁用 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
let isT = ref(false) |
|
|
|
|
|
|
|
function setIsT(bool=false){ |
|
|
|
|
|
|
|
isT.value=bool |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 新增 |
|
|
|
* 新增 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function add() { |
|
|
|
function add() { |
|
|
|
edit({}); |
|
|
|
edit({}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 编辑 |
|
|
|
* 编辑 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function edit(record) { |
|
|
|
function edit(record) { |
|
|
|
nextTick(() => { |
|
|
|
nextTick(() => { |
|
|
|
resetFields(); |
|
|
|
resetFields(); |
|
|
|
//赋值 |
|
|
|
//赋值 |
|
|
|
Object.assign(formData, record); |
|
|
|
Object.assign(formData, record); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 提交数据 |
|
|
|
* 提交数据 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async function submitForm() { |
|
|
|
async function submitForm() { |
|
|
|
// 触发表单验证 |
|
|
|
// 触发表单验证 |
|
|
|
await validate(); |
|
|
|
await validate(); |
|
|
|
confirmLoading.value = true; |
|
|
|
confirmLoading.value = true; |
|
|
|
const isUpdate = ref<boolean>(false); |
|
|
|
const isUpdate = ref<boolean>(false); |
|
|
|
//时间格式化 |
|
|
|
//时间格式化 |
|
|
|
let model = formData; |
|
|
|
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 awardsort = model.awardname; |
|
|
|
let awardname = model.awardsort; |
|
|
|
let awardname = model.awardsort; |
|
|
|
model.awardname = awardname; |
|
|
|
model.awardname = awardname; |
|
|
|
model.awardsort = awardsort; |
|
|
|
model.awardsort = awardsort; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (model.id) { |
|
|
|
if (model.id) { |
|
|
|
isUpdate.value = true; |
|
|
|
isUpdate.value = true; |
|
|
|
} |
|
|
|
} |
|
|
|
//循环数据 |
|
|
|
//循环数据 |
|
|
|
for (let data in model) { |
|
|
|
for (let data in model) { |
|
|
|
//如果该数据是数组并且是字符串类型 |
|
|
|
//如果该数据是数组并且是字符串类型 |
|
|
|
if (model[data] instanceof Array) { |
|
|
|
if (model[data] instanceof Array) { |
|
|
|
let valueType = getValueType(formRef.value.getProps, data); |
|
|
|
let valueType = getValueType(formRef.value.getProps, data); |
|
|
|
//如果是字符串类型的需要变成以逗号分割的字符串 |
|
|
|
//如果是字符串类型的需要变成以逗号分割的字符串 |
|
|
|
if (valueType === 'string') { |
|
|
|
if (valueType === 'string') { |
|
|
|
model[data] = model[data].join(','); |
|
|
|
model[data] = model[data].join(','); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
await saveOrUpdate(model, isUpdate.value) |
|
|
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
|
|
createMessage.success(res.message); |
|
|
|
|
|
|
|
emit('ok'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
createMessage.warning(res.message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.finally(() => { |
|
|
|
|
|
|
|
confirmLoading.value = false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
await saveOrUpdate(model, isUpdate.value) |
|
|
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
|
|
createMessage.success(res.message); |
|
|
|
|
|
|
|
emit('ok'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
createMessage.warning(res.message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.finally(() => { |
|
|
|
|
|
|
|
confirmLoading.value = false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function enrollCodeDuplicatevalidate(_r, value) { |
|
|
|
async function enrollCodeDuplicatevalidate(_r, value) { |
|
|
|
return duplicateValidate('award_persion', 'enroll_code', value, formData.id || '') |
|
|
|
return duplicateValidate('award_persion', 'enroll_code', value, formData.id || '') |
|
|
|
} |
|
|
|
} |
|
|
|
defineExpose({ |
|
|
|
defineExpose({ |
|
|
|
add, |
|
|
|
add, |
|
|
|
edit, |
|
|
|
edit, |
|
|
|
submitForm, |
|
|
|
submitForm, |
|
|
|
}); |
|
|
|
setIsT |
|
|
|
|
|
|
|
}); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped> |
|
|
|
<style lang="less" scoped> |
|
|
|
.antd-modal-form { |
|
|
|
.antd-modal-form { |
|
|
|
min-height: 500px !important; |
|
|
|
min-height: 500px !important; |
|
|
|
overflow-y: auto; |
|
|
|
overflow-y: auto; |
|
|
|
padding: 24px 24px 24px 24px; |
|
|
|
padding: 24px 24px 24px 24px; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|