| | |
| | | import isEqual from 'lodash/isEqual' |
| | | import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' |
| | | import { cloneDeep } from 'lodash' |
| | | // å¼å
¥å
Œ
±é项é
ç½® |
| | | import { |
| | | FILTER_MODE_OPTIONS_STRING, |
| | | FILTER_MODE_OPTIONS_NUM, |
| | | FILTER_MODE_OPTIONS_BOOL |
| | | } from '@/components/DyFormForHighQuery/DyFormForHighQueryOptions'; |
| | | import { |
| | | BOOLEAN_OPTIONS |
| | | } from '@/utils/commonOptionConstants'; |
| | | |
| | | export const use$EntityName$QueryDrawer = (props: any, ctx?: any) => { |
| | | const $PageMenuInstanceName$Drawer = injectModel<$EntityName$Drawer>('$EntityName$Drawer') |
| | |
| | | ) |
| | | } |
| | | |
| | | const datePickerRange = (attrs) => { |
| | | return ( |
| | | <el-date-picker |
| | | type="daterange" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | {...attrs} |
| | | ></el-date-picker> |
| | | ) |
| | | } |
| | | |
| | | const dateTimePickerRange = (attrs) => { |
| | | return ( |
| | | <el-date-picker |
| | | type="datetimerange" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | {...attrs} |
| | | ></el-date-picker> |
| | | ) |
| | | } |
| | | |
| | | const visible = computed({ |
| | | get() { |
| | |
| | | }, |
| | | }) |
| | | /** |
| | | * æ·»å çformåæ®µ |
| | | * é«çº§æ¥è¯¢çformåæ®µ |
| | | */ |
| | | const formItems = reactive([ |
| | | $PageAddFormAttributes_Query$ |
| | |
| | | const check = isEqual(initiateData.value, data) |
| | | return check |
| | | } |
| | | const commonGetFormData=()=>{ |
| | | const data = { |
| | | $Save_PageAddFormAttributes_Query$ |
| | | /** |
| | | * è·åè¡¨åæ°æ® - ä¼åç |
| | | */ |
| | | const commonGetFormData = () => { |
| | | const data = {}; |
| | | |
| | | // éå表åé
ç½®æ¶éæ°æ® |
| | | formItems.forEach(item => { |
| | | // æ¶éåºç¡å段 |
| | | data[item.prop] = formData.value[item.prop] || ''; |
| | | |
| | | // æ¶éè¿æ»¤æ¨¡å¼å段 |
| | | if (item.highSelectAttrs && item.highSelectAttrs.prop) { |
| | | const filterModeProp = item.highSelectAttrs.prop; |
| | | data[filterModeProp] = formData.value[filterModeProp] || ''; |
| | | } |
| | | return data; |
| | | } |
| | | }); |
| | | |
| | | return data; |
| | | } |
| | | const onClose = (done: () => void) => { |
| | | if (visible.value) { |
| | | visible.value = false |
| | |
| | | const data =commonGetFormData(); |
| | | ctx.emit('confirmQuery', data) |
| | | } |
| | | /** |
| | | * éç½®æ¥è¯¢ |
| | | */ |
| | | const onReset = async () => { |
| | | formData.value = {} |
| | | $Save_PageAddFormAttributes_Query_Clear$ |
| | | //åç¶ç»ä»¶åéèªå®ä¹äºä»¶ |
| | | ctx.emit('restQuery'); |
| | | } |
| | | /** |
| | | * éç½®å
Œ
±selectæ¥è¯¢ |
| | | */ |
| | | const onResetForHighSelect = () => { |
| | | // éåææè¡¨ååæ®µ |
| | | formItems.forEach(item => { |
| | | // æ£æ¥å段æ¯å¦æé«çº§æ¥è¯¢çè¿æ»¤æ¨¡å¼é
ç½® |
| | | if (item.highSelectAttrs && item.highSelectAttrs.prop) { |
| | | const filterModeProp = item.highSelectAttrs.prop; |
| | | const options = item.highSelectAttrs.options || []; |
| | | |
| | | // 妿åå¨é项ï¼å设置为第ä¸ä¸ªé项çå¼ |
| | | if (options.length > 0) { |
| | | // å设éé¡¹æ ¼å¼ä¸º { value, label } æç±»ä¼¼ç»æ |
| | | const firstValue = options[0].value !== undefined ? options[0].value : options[0]; |
| | | formData.value[filterModeProp] = firstValue; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | /** |
| | | * éç½®æ¥è¯¢ - ä¼åç |
| | | */ |
| | | const onReset = async () => { |
| | | // 1. æ¸
空ææåºç¡å段ï¼ä¸å
å«è¿æ»¤æ¨¡å¼åæ®µï¼ |
| | | const baseFields = formItems.reduce((acc, item) => { |
| | | acc[item.prop] = ''; |
| | | return acc; |
| | | }, {}); |
| | | |
| | | // 2. åºç¨åºç¡å段åå§å¼ |
| | | formData.value = { ...baseFields }; |
| | | |
| | | // 3. 使ç¨åææ¹æ³éç½®è¿æ»¤æ¨¡å¼å段 |
| | | onResetForHighSelect(); // ä¿çåææ¹æ³è°ç¨ |
| | | |
| | | // 4. åç¶ç»ä»¶åéèªå®ä¹äºä»¶ |
| | | ctx.emit('restQuery'); |
| | | } |
| | | |
| | | const updateCheckData = () => { |
| | | initiateData.value = { |
| | |
| | | $CommonQueryEnumForFrom$ |
| | | } |
| | | commonQueryEnumForFrom() |
| | | onResetForHighSelect();//éç½®å
Œ
±selectæ¥è¯¢ |
| | | /** |
| | | * å¼¹çªæå¼è·å详æ
|
| | | */ |