From 3d7bf6dff3d1e2f12c4ecd0120ee110348ccdf49 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 21 十二月 2023 16:27:09 +0800 Subject: [PATCH] 1. 自评预检查功能修改中 --- src/views/fysp/evaluation/components/precheck/CompCheckExemption.vue | 39 ++++ src/components/search-option/FYOptionTime.vue | 5 src/views/fysp/evaluation/components/precheck/CompCheckArea.vue | 100 ++++++++++++ src/views/fysp/evaluation/ResultManage.vue | 3 src/components.d.ts | 2 src/composables/formConfirm.js | 9 src/components/form/FYForm.vue | 49 ++++- src/components/search-option/FYOptionLocation.vue | 7 src/test.js | 39 +++- src/views/fysp/evaluation/components/precheck/CompCheckSource.vue | 39 ++++ src/components/search-option/FYOptionUserType.vue | 20 +- src/views/fysp/evaluation/components/precheck/CompCheckConfirm.vue | 39 ++++ src/views/fysp/evaluation/components/CompPreCheck.vue | 60 +------ src/views/fysp/evaluation/components/CompQuickSet.vue | 25 ++ src/components/search-option/FYOptionScene.vue | 5 15 files changed, 335 insertions(+), 106 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index c260238..62001ec 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -10,7 +10,6 @@ BaseContentLayout: typeof import('./components/core/BaseContentLayout.vue')['default'] BasePanelLayout: typeof import('./components/core/BasePanelLayout.vue')['default'] Content: typeof import('./components/core/Content.vue')['default'] - copy: typeof import('./components/search-option/FYOptionLocation copy.vue')['default'] ElAside: typeof import('element-plus/es')['ElAside'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBacktop: typeof import('element-plus/es')['ElBacktop'] @@ -62,6 +61,7 @@ ElTag: typeof import('element-plus/es')['ElTag'] ElText: typeof import('element-plus/es')['ElText'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] + ElTransfer: typeof import('element-plus/es')['ElTransfer'] ElTree: typeof import('element-plus/es')['ElTree'] Footer: typeof import('./components/core/Footer.vue')['default'] FormCol: typeof import('./components/layout/FormCol.vue')['default'] diff --git a/src/components/form/FYForm.vue b/src/components/form/FYForm.vue index ade1ff9..1b9625f 100644 --- a/src/components/form/FYForm.vue +++ b/src/components/form/FYForm.vue @@ -26,7 +26,7 @@ * 鍙紶鍏ュ垵濮嬭〃鍗曟暟鎹甪ormInfo锛岃〃鍗曟牎楠岃鍒檙ules * 瀹炵幇submit鍜宑ancel瑙﹀彂鍑芥暟 */ -import { defineProps, defineEmits, reactive, ref, watch, computed } from 'vue'; +import { defineProps, defineEmits, reactive, ref, watch, computed, defineExpose } from 'vue'; import { useFormConfirm } from '@/composables/formConfirm'; const props = defineProps({ @@ -62,15 +62,29 @@ _locations: [ { required: true, - message: '鐪�/甯�/鍖�/闀囦笉鑳戒负绌�', + // message: '琛屾斂鍖哄垝涓嶈兘涓虹┖', trigger: 'change', + validator: (rule, value, callback) => { + if (!value) { + callback(new Error('Please input the age')); + } else { + callback() + } + } } ], _scenetype: [ { required: true, message: '鍦烘櫙绫诲瀷涓嶈兘涓虹┖', - trigger: 'change' + trigger: 'change', + validator: (rule, value, callback) => { + if (!value) { + callback(new Error('Please input the age')); + } else { + callback() + } + } } ] }); @@ -92,13 +106,18 @@ function submit() { loading.value = true; return new Promise((resolve, reject) => { - emit('submit', formObj, () => { - loading.value = false; - resolve(); - },(err)=>{ - loading.value = false; - reject(err); - }); + emit( + 'submit', + formObj, + () => { + loading.value = false; + resolve(); + }, + (err) => { + loading.value = false; + reject(err); + } + ); }); } @@ -107,9 +126,9 @@ emit('cancel'); } -const allRules = computed(()=>{ - return {...baseRules, ...props.rules} -}) +const allRules = computed(() => { + return { ...baseRules, ...props.rules }; +}); //鐩戝惉琛ㄥ崟鍒濆鏁版嵁浼犲叆 watch( @@ -117,7 +136,7 @@ (nValue) => { formObj.value = nValue; }, - { deep: false, immediate: true } + { deep: true, immediate: true } ); //鐩戝惉琛ㄥ崟閲嶇疆鍔熻兘瑙﹀彂 @@ -134,6 +153,8 @@ watch(edit, (nValue) => { emit('update:isEdit', nValue); }); + +defineExpose({ onSubmit, onCancel, onReset }); </script> <style scoped></style> diff --git a/src/components/search-option/FYOptionLocation.vue b/src/components/search-option/FYOptionLocation.vue index 78ccb2b..6a13c96 100644 --- a/src/components/search-option/FYOptionLocation.vue +++ b/src/components/search-option/FYOptionLocation.vue @@ -21,7 +21,7 @@ type: Boolean, default: true }, - // 鏌ヨ鐨勮鏀跨骇鍒紝鍙栧��1锛�2锛�3锛�4 + // 鏌ヨ鐨勮鏀跨骇鍒紝鍙栧��1锛�2锛�3锛�4, 5, 6 level: { type: Number, default: 4 @@ -38,7 +38,10 @@ type: Boolean, default: true }, - prop: String + prop: { + type: String, + default: '_locations' + } }, emits: ['update:value'], data() { diff --git a/src/components/search-option/FYOptionScene.vue b/src/components/search-option/FYOptionScene.vue index 441b57d..0786b61 100644 --- a/src/components/search-option/FYOptionScene.vue +++ b/src/components/search-option/FYOptionScene.vue @@ -38,7 +38,10 @@ type: Boolean, default: true, }, - prop: String + prop: { + type: String, + default: '_scenetype' + } }, emits: ['update:value'], data() { diff --git a/src/components/search-option/FYOptionTime.vue b/src/components/search-option/FYOptionTime.vue index b55bb6b..18ccb34 100644 --- a/src/components/search-option/FYOptionTime.vue +++ b/src/components/search-option/FYOptionTime.vue @@ -1,5 +1,5 @@ <template> - <el-form-item label="鏃堕棿"> + <el-form-item label="鏃堕棿" :prop="prop"> <el-date-picker :model-value="value" @change="handleChange" @@ -27,7 +27,8 @@ initValue: { type: Boolean, default: true - } + }, + prop: String }, emits: ['update:value'], data() { diff --git a/src/components/search-option/FYOptionUserType.vue b/src/components/search-option/FYOptionUserType.vue index e274241..050f772 100644 --- a/src/components/search-option/FYOptionUserType.vue +++ b/src/components/search-option/FYOptionUserType.vue @@ -6,12 +6,7 @@ placeholder="鐢ㄦ埛绫诲瀷" style="width: 150px" > - <el-option - v-for="s in userTypes" - :key="s.value" - :label="s.label" - :value="s" - /> + <el-option v-for="s in userTypes" :key="s.value" :label="s.label" :value="s" /> </el-select> </el-form-item> </template> @@ -24,21 +19,24 @@ // 鏄惁鍦ㄩ閫夐」澶勬坊鍔犫�滃叏閮ㄢ�濋�夐」 allOption: { type: Boolean, - default: true, + default: true }, // 杩斿洖缁撴灉 value: Object, // 鏄惁榛樿杩斿洖鍒濆閫夐」 initValue: { type: Boolean, - default: true, + default: true }, - prop: String + prop: { + type: String, + default: '_usertype' + } }, emits: ['update:value'], data() { return { - userTypes: enumUser(this.allOption), + userTypes: enumUser(this.allOption) }; }, methods: { @@ -50,6 +48,6 @@ if (this.initValue) { this.handleChange(this.userTypes[0]); } - }, + } }; </script> diff --git a/src/composables/formConfirm.js b/src/composables/formConfirm.js index dc295d5..ffe4b1b 100644 --- a/src/composables/formConfirm.js +++ b/src/composables/formConfirm.js @@ -92,9 +92,10 @@ }; // 鎻愪氦琛ㄥ崟 - const onSubmit = function () { - formRef.value.validate((valid) => { + const onSubmit = function (messageBox = true) { + formRef.value.validate(async (valid) => { if (valid) { + if (messageBox) { useMessageBoxTip({ confirmMsg: submit.msg, confirmTitle: submit.title, @@ -104,6 +105,10 @@ return res; } }); + } else { + await submit.do(); + submited(); + } } }); }; diff --git a/src/test.js b/src/test.js index cca19e1..11a2465 100644 --- a/src/test.js +++ b/src/test.js @@ -1,17 +1,26 @@ -const shape = { - radius: 9, - d() { - return this.radius * 2; - }, - p: () => 2 * Math.PI * this.radius, -}; +// const shape = { +// radius: 9, +// d() { +// return this.radius * 2; +// }, +// p: () => 2 * Math.PI * this.radius, +// }; -console.log(shape.d()); -console.log(shape.p()); +// console.log(shape.d()); +// console.log(shape.p()); -const str = 'abc'; -if (str[0] >= 'a' && str[0] <= 'z') { - let a = parseInt(str[0]); - a -= 32; - console.log(a); -} +// const str = 'abc'; +// if (str[0] >= 'a' && str[0] <= 'z') { +// let a = parseInt(str[0]); +// a -= 32; +// console.log(a); +// } + + +let a = 4 +let b = new Number(4) +let c = '4' +console.log(a == b); +console.log(a === b); +console.log(a == c); +console.log(b === c); \ No newline at end of file diff --git a/src/views/fysp/evaluation/ResultManage.vue b/src/views/fysp/evaluation/ResultManage.vue index da2c668..b076fda 100644 --- a/src/views/fysp/evaluation/ResultManage.vue +++ b/src/views/fysp/evaluation/ResultManage.vue @@ -167,7 +167,4 @@ }; </script> <style scoped> -.a { - color: #f7a62c; -} </style> diff --git a/src/views/fysp/evaluation/components/CompPreCheck.vue b/src/views/fysp/evaluation/components/CompPreCheck.vue index f99b60b..ad11ba1 100644 --- a/src/views/fysp/evaluation/components/CompPreCheck.vue +++ b/src/views/fysp/evaluation/components/CompPreCheck.vue @@ -5,71 +5,31 @@ <el-step title="璞佸厤鏉$洰" /> <el-step title="鑷姩璇勪及" /> </el-steps> - - <el-card v-if="stepIndex == 0" shadow="never"> - <template #header> - <div><el-text tag="b" size="large">閫夋嫨璇勪及鑼冨洿</el-text></div> - <el-text size="small" type="info">鍖呮嫭鍖哄幙銆佸満鏅被鍨嬩互鍙婃湀浠�</el-text> - </template> - <FYForm :form-info="evaConditon" :rules="evaConditionRules" :showButtons="false"> - <template #form-item="{ formObj }"> - <!-- 鍖哄幙 --> - <FYOptionLocation - :allOption="false" - :level="3" - :checkStrictly="false" - v-model:value="formObj.locations" - ></FYOptionLocation> - <!-- 鍦烘櫙绫诲瀷 --> - <FYOptionScene - :allOption="false" - :type="2" - v-model:value="formObj.scenetype" - ></FYOptionScene> - <!-- 鏃堕棿 --> - <FYOptionTime - :initValue="true" - type="month" - v-model:value="formObj.time" - ></FYOptionTime> - </template> - </FYForm> - <template #footer> - <el-row justify="space-around"> - <el-button type="primary" size="default">涓嬩竴姝�</el-button> - </el-row> - </template> - </el-card> - <el-card v-if="stepIndex == 1" shadow="never"> Never2 </el-card> - <el-card v-if="stepIndex == 2" shadow="never"> Never3 </el-card> - <el-card v-if="stepIndex == 3" shadow="never"> Never4 </el-card> + <CompCheckArea v-show="stepIndex == 0" v-model="stepIndex"></CompCheckArea> + <CompCheckSource v-show="stepIndex == 1" v-model="stepIndex"></CompCheckSource> + <CompCheckExemption v-show="stepIndex == 2" v-model="stepIndex"></CompCheckExemption> + <CompCheckConfirm v-show="stepIndex == 3" v-model="stepIndex"></CompCheckConfirm> </template> <script> import dayjs from 'dayjs'; +import CompCheckArea from './precheck/CompCheckArea.vue'; +import CompCheckSource from './precheck/CompCheckSource.vue'; +import CompCheckExemption from './precheck/CompCheckExemption.vue'; +import CompCheckConfirm from './precheck/CompCheckConfirm.vue'; /** * 鑷姩璇勪及鏉′欢鍚堣鎬ф鏌� */ export default { name: 'CompPreCheck', + components: { CompCheckArea, CompCheckSource, CompCheckExemption, CompCheckConfirm }, props: {}, emits: ['preCheck'], data() { return { // 鎿嶄綔姝ラ涓嬫爣 - stepIndex: 0, - // 璇勪及浠诲姟鑼冨洿 - evaConditon: {}, - evaConditionRules: { - acountname: [ - { - required: true, - message: '璐︽埛鍚嶄笉鑳戒负绌�', - trigger: 'blur' - } - ] - } + stepIndex: 0 }; }, methods: { diff --git a/src/views/fysp/evaluation/components/CompQuickSet.vue b/src/views/fysp/evaluation/components/CompQuickSet.vue index 23a99a8..e401b49 100644 --- a/src/views/fysp/evaluation/components/CompQuickSet.vue +++ b/src/views/fysp/evaluation/components/CompQuickSet.vue @@ -1,10 +1,19 @@ <template> - <el-row> - <span>蹇嵎閫夋嫨</span> - <el-button v-for="(v, i) in quickSetting" :key="i" type="primary" @click="quickSet(v)">{{ + <el-form-item label="蹇嵎閫夋嫨"> + <el-space> + <el-button v-for="(v, i) in quickSetting" :key="i" type="primary" size="small" @click="quickSet(v)">{{ v.name }}</el-button> - </el-row> + </el-space> + </el-form-item> + <!-- <el-row class="row"> + <el-space> + <el-text>蹇嵎閫夋嫨</el-text> + <el-button v-for="(v, i) in quickSetting" :key="i" type="primary" size="small" @click="quickSet(v)">{{ + v.name + }}</el-button> + </el-space> + </el-row> --> </template> <script> export default { @@ -21,7 +30,7 @@ cCode: '3100', cName: '涓婃捣甯�', dCode: '310106', - dName: '闈欏畨鍖�' + dName: '闈欏畨鍖�', }, scenetype: { label: '宸ュ湴', value: '1' } }, @@ -92,3 +101,9 @@ } } </script> +<style scoped> +.row { + padding: 8px 0px; + /* background-color: antiquewhite; */ +} +</style> diff --git a/src/views/fysp/evaluation/components/precheck/CompCheckArea.vue b/src/views/fysp/evaluation/components/precheck/CompCheckArea.vue new file mode 100644 index 0000000..2d6ac12 --- /dev/null +++ b/src/views/fysp/evaluation/components/precheck/CompCheckArea.vue @@ -0,0 +1,100 @@ +<template> + <el-card shadow="never"> + <template #header> + <div><el-text tag="b" size="large">閫夋嫨璇勪及鑼冨洿</el-text></div> + <el-text size="small" type="info">鍖呮嫭鍖哄幙銆佸満鏅被鍨嬩互鍙婃湀浠�</el-text> + </template> + <FYForm + ref="formRef" + :form-info="evaConditon" + :rules="evaConditionRules" + :showButtons="false" + @submit="nextStep" + > + <template #form-item="{ formObj }"> + <CompQuickSet @quick-set="setOptions"></CompQuickSet> + <!-- 鍖哄幙 --> + <FYOptionLocation + :allOption="false" + :level="3" + :initValue="false" + :checkStrictly="false" + v-model:value="formObj._locations" + ></FYOptionLocation> + <!-- 鍦烘櫙绫诲瀷 --> + <FYOptionScene + :allOption="false" + :initValue="false" + :type="2" + v-model:value="formObj._scenetype" + ></FYOptionScene> + <!-- 鏃堕棿 --> + <FYOptionTime + prop="time" + :initValue="true" + type="month" + v-model:value="formObj.time" + ></FYOptionTime> + </template> + </FYForm> + <template #footer> + <el-row justify="space-around"> + <el-button type="primary" size="default" :loading="loading" @click="submit" + >涓嬩竴姝�</el-button + > + </el-row> + </template> + </el-card> +</template> + +<script> +import CompQuickSet from '../CompQuickSet.vue'; + +/** + * 璇勪及鑼冨洿鍚堣鎬ф鏌� + */ +export default { + components: { CompQuickSet }, + props: { + // 姝ラ涓嬫爣 + modelValue: Number + }, + emits: ['update:modelValue'], + data() { + return { + loading: false, + // 璇勪及浠诲姟鑼冨洿 + evaConditon: {}, + evaConditionRules: { + time: [ + { + required: true, + message: '鏃堕棿涓嶈兘涓虹┖', + trigger: 'change' + } + ] + } + }; + }, + methods: { + setOptions(param) { + this.evaConditon._locations = param.locations; + this.evaConditon._scenetype = param.scenetype; + }, + submit() { + this.$refs.formRef.onSubmit(false); + }, + // 璺宠浆涓嬩竴姝� + nextStep() { + this.loading = true; + return new Promise((reslove, reject) => { + setTimeout(() => { + this.$emit('update:modelValue', this.modelValue + 1); + this.loading = false; + reslove(); + }, 1000); + }); + } + } +}; +</script> diff --git a/src/views/fysp/evaluation/components/precheck/CompCheckConfirm.vue b/src/views/fysp/evaluation/components/precheck/CompCheckConfirm.vue new file mode 100644 index 0000000..b8f819e --- /dev/null +++ b/src/views/fysp/evaluation/components/precheck/CompCheckConfirm.vue @@ -0,0 +1,39 @@ +<template> + <el-card shadow="never"> + Never4 + <template #footer> + <el-row justify="space-around"> + <el-button type="primary" size="default" @click="lastStep">涓婁竴姝�</el-button> + <!-- <el-button type="primary" size="default" @click="nextStep">涓嬩竴姝�</el-button> --> + </el-row> + </template> + </el-card> +</template> + +<script> +/** + * 璇勪及浠诲姟鏈�缁堝紑鍚‘璁� + */ +export default { + props: { + // 姝ラ涓嬫爣 + modelValue: Number + }, + emits: ['update:modelValue'], + data() { + return { + + }; + }, + methods: { + // 璺宠浆涓嬩竴姝� + nextStep() { + this.$emit('update:modelValue', this.modelValue + 1); + }, + // 璺宠浆涓嬩竴姝� + lastStep() { + this.$emit('update:modelValue', this.modelValue - 1); + } + } +}; +</script> diff --git a/src/views/fysp/evaluation/components/precheck/CompCheckExemption.vue b/src/views/fysp/evaluation/components/precheck/CompCheckExemption.vue new file mode 100644 index 0000000..4098017 --- /dev/null +++ b/src/views/fysp/evaluation/components/precheck/CompCheckExemption.vue @@ -0,0 +1,39 @@ +<template> + <el-card shadow="never"> + Never3 + <template #footer> + <el-row justify="space-around"> + <el-button type="primary" size="default" @click="lastStep">涓婁竴姝�</el-button> + <el-button type="primary" size="default" @click="nextStep">涓嬩竴姝�</el-button> + </el-row> + </template> + </el-card> +</template> + +<script> +/** + * 璇勪及鏉$洰璞佸厤璁惧畾 + */ +export default { + props: { + // 姝ラ涓嬫爣 + modelValue: Number + }, + emits: ['update:modelValue'], + data() { + return { + + }; + }, + methods: { + // 璺宠浆涓嬩竴姝� + nextStep() { + this.$emit('update:modelValue', this.modelValue + 1); + }, + // 璺宠浆涓嬩竴姝� + lastStep() { + this.$emit('update:modelValue', this.modelValue - 1); + } + } +}; +</script> diff --git a/src/views/fysp/evaluation/components/precheck/CompCheckSource.vue b/src/views/fysp/evaluation/components/precheck/CompCheckSource.vue new file mode 100644 index 0000000..49ed8e9 --- /dev/null +++ b/src/views/fysp/evaluation/components/precheck/CompCheckSource.vue @@ -0,0 +1,39 @@ +<template> + <el-card shadow="never"> + Never2 + <template #footer> + <el-row justify="space-around"> + <el-button type="primary" size="default" @click="lastStep">涓婁竴姝�</el-button> + <el-button type="primary" size="default" @click="nextStep">涓嬩竴姝�</el-button> + </el-row> + </template> + </el-card> +</template> + +<script> +/** + * 璇勪及鏁版嵁婧愬畬鏁存�ф鏌� + */ +export default { + props: { + // 姝ラ涓嬫爣 + modelValue: Number + }, + emits: ['update:modelValue'], + data() { + return { + + }; + }, + methods: { + // 璺宠浆涓嬩竴姝� + nextStep() { + this.$emit('update:modelValue', this.modelValue + 1); + }, + // 璺宠浆涓嬩竴姝� + lastStep() { + this.$emit('update:modelValue', this.modelValue - 1); + } + } +}; +</script> -- Gitblit v1.9.3