GST002精简

gst2base
Gitea 2 days ago
parent c56017bf29
commit ec5352bbf0
  1. 172
      jeecgboot-vue3-master/src/views/scorepersion/components/ScorePersionForm2.vue
  2. 75
      jeecgboot-vue3-master/src/views/scorepersion/components/ScorePersionModal2.vue

@ -1,172 +0,0 @@
<template>
<a-spin :spinning="confirmLoading">
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<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"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="年度比赛" v-bind="validateInfos.annualCompid">
<j-search-select v-model:value="formData.annualCompid" :dict="strst" :disabled="disabled" />
</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" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</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 { saveOrUpdate2,queryCompId } from '../ScorePersion.api';
import { Form } from 'ant-design-vue';
import { duplicateValidate } from '/@/utils/helper/validator'
let strst = ref();
let ndbsxm = ref();
const props = defineProps({
formDisabled: { type: Boolean, default: false },
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>>({
id: '',
annualid: '',
annualCompid: '',
annualCompP: '',
enrollCode: '',
score: '',
sort: undefined,
});
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: '请输入年度!'},],
annualCompid: [{ required: true, message: '请输入年度比赛!'},],
annualCompP: [{ required: true, message: '请输入年度比赛项目!'},],
};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
watch(formData, (newVal) => {
if(formData.annualid==null||formData.annualid==""){
}else{
queryCompId("").then((result)=>{
//console.log(result);
const str = result;
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;
}
});
}
if(formData.annualCompid!=""){
ndbsxm.value = "annual_comp_point,obj_name,id,annual_comp_id='"+formData.annualCompid+"'";
}
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
//
Object.assign(formData, record);
});
}
/**
* 提交数据
*/
async function submitForm() {
//
await validate();
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
await saveOrUpdate2(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) {
return duplicateValidate('score_persion', 'enroll_code', value, formData.id || '')
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
min-height: 500px !important;
overflow-y: auto;
padding: 24px 24px 24px 24px;
}
</style>

@ -1,75 +0,0 @@
<template>
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<ScorePersionForm2 ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ScorePersionForm2>
</a-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import ScorePersionForm2 from './ScorePersionForm2.vue'
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '同分复评';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style>
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
Loading…
Cancel
Save