Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VNode, Component, DefineComponent } from 'vue' |
| | | |
| | | export interface OptionItemType { |
| | | label?: string |
| | | description?: string |
| | | name?: string |
| | | value: string | number |
| | | } |
| | | |
| | | export interface FormItemPropType { |
| | | prop?: string | Ref<string> |
| | | highSelectProp?: string | Ref<string> |
| | | label?: String | Ref<string> |
| | | rules?: any[] | Ref<any[]> |
| | | disabled?: boolean | Ref<boolean> |
| | | isDateControl?: boolean | Ref<boolean> |
| | | placeholder?: string | Ref<string> |
| | | type?: string | Ref<string> |
| | | width?: string | Ref<string> |
| | | el?: string | Component | DefineComponent | Ref<string> |
| | | options?: OptionItemType[] | any[] | Ref<any> |
| | | highSelectAttrs?: object | Ref<object> |
| | | isTitle?: boolean |
| | | title?:string | Component |
| | | [key: string]: any | Ref<string> |
| | | } |
| | | |
| | | export interface FormPropsType { |
| | | formData: { [key: string]: any } |
| | | formItemProps: FormItemPropType[] |
| | | [key: string]: any |
| | | } |
| | | |
| | | export interface PropsType { |
| | | formItemProps: FormItemPropType[] |
| | | formData: { [key: string]: any } |
| | | labelWidth: string |
| | | [key: string]: any |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .formStyle { |
| | | .formItem { |
| | | // ç§»é¤åºå®å®½åº¦éå¶ |
| | | width: auto !important; |
| | | margin-right: 0 !important; |
| | | } |
| | | |
| | | .formControl { |
| | | flex: 1; // 让æ§ä»¶å æ®å©ä½ç©ºé´ |
| | | min-width: 0; // å
许æ§ä»¶æ¶ç¼© |
| | | } |
| | | |
| | | .formItemLabel { |
| | | display: inline-flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | flex: 0 0 auto; |
| | | font-size: var(--cs-form-label-font-size); |
| | | color: var(--cs-text-color-regular); |
| | | height: 32px; |
| | | line-height: 32px; |
| | | padding: 0 12px 0 0; |
| | | box-sizing: border-box; |
| | | > img { |
| | | margin-left: 10px; |
| | | } |
| | | } |
| | | |
| | | :global(.cs-select) { |
| | | width: 100%; |
| | | } |
| | | |
| | | // ç§»é¤åºå®å®½åº¦è®¾ç½® |
| | | :global(.cs-form--inline .cs-form-item) { |
| | | width: auto !important; |
| | | } |
| | | |
| | | :global(.cs-form--inline .cs-form-item:nth-last-of-type(2n)) { |
| | | margin-right: 0 !important; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // import { ElInput } from "element-plus"; |
| | | import { |
| | | defineComponent, |
| | | PropType, |
| | | ref, |
| | | Ref, |
| | | SetupContext, |
| | | computed, |
| | | unref, |
| | | markRaw, |
| | | DefineComponent, |
| | | } from 'vue' |
| | | import styles from './DyFormForHighQuery.module.scss' |
| | | import ElInput from 'element-plus/es/components/input/index' |
| | | import Option from '@/components/Select/Option' |
| | | import Select from '@/components/Select/Select' |
| | | import SelectInput from '@/components/SelectInput/SelectInput' |
| | | import type { FormInstance } from 'element-plus' |
| | | import Icon from '../Icon/Icon' |
| | | import { |
| | | FormPropsType, |
| | | FormItemPropType, |
| | | PropsType, |
| | | OptionItemType, |
| | | } from './DyFormForHighQuery.d' |
| | | import Variable from '../Variable/Variable' |
| | | import Title from '../Title/Title' |
| | | import TextareaFlow from '../Flow/Flow' |
| | | import get from 'lodash/get' |
| | | import set from 'lodash/set' |
| | | |
| | | const formItemElementMap = markRaw<Record<string, any>>({ |
| | | input: ElInput, |
| | | select: Select, |
| | | selectInput: SelectInput, |
| | | variable: Variable, |
| | | textareaFlow: TextareaFlow, |
| | | }) |
| | | |
| | | const Type: Record<string, any> = { |
| | | select: 'select', |
| | | } |
| | | export default defineComponent<FormPropsType>({ |
| | | //@ts-ignore |
| | | name: 'å¨æè¡¨å', |
| | | props: { |
| | | labelWidth: { |
| | | type: String, |
| | | default: '100px', |
| | | }, |
| | | labelPosition: { |
| | | type: String, |
| | | default: 'left', |
| | | }, |
| | | formData: { |
| | | type: Object as PropType<{ [key: string]: any }>, |
| | | default: () => ({}), |
| | | }, |
| | | formItemProps: { |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | | inLine: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | }, |
| | | setup(props: PropsType, { attrs, emit, expose }: SetupContext) { |
| | | const formRef = ref<FormInstance>() |
| | | const form: any = computed({ |
| | | get() { |
| | | return props.formData |
| | | }, |
| | | set(v) { |
| | | emit('update:formData', v) |
| | | }, |
| | | }) |
| | | |
| | | const currentWidgetModel = computed(() => { |
| | | return (path: string) => { |
| | | return get(form.value, path) |
| | | } |
| | | }) |
| | | |
| | | const validate = () => { |
| | | if (!formRef.value) return false |
| | | return new Promise((resolve, reject) => { |
| | | formRef.value?.validate((valid: boolean) => { |
| | | if (valid) { |
| | | resolve(true) |
| | | } else { |
| | | reject(false) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const resetForm = () => { |
| | | if (!formRef.value) return false |
| | | formRef.value.resetFields() |
| | | } |
| | | |
| | | const formItemProps = computed(() => { |
| | | return props.formItemProps || [] |
| | | }) |
| | | |
| | | expose({ validate, resetForm }) |
| | | |
| | | const FormRender: any = ($props: any) => { |
| | | const item: FormItemPropType = $props.item |
| | | const options = $props.item.options || [] |
| | | if (item.el && Type[item.el as string]) { |
| | | return options.map((el: OptionItemType) => ( |
| | | <Option |
| | | label={el.label || el.description || el.name} |
| | | value={el.value} |
| | | ></Option> |
| | | )) |
| | | } |
| | | return null |
| | | } |
| | | const FormRenderForHighSelectOptions: any = ($props: any) => { |
| | | const item: FormItemPropType = $props.item |
| | | const options = $props.item.highSelectAttrs?.options || [] |
| | | if (1===1) { |
| | | return options.map((el: OptionItemType) => ( |
| | | <Option |
| | | label={el.label || el.description || el.name} |
| | | value={el.value} |
| | | ></Option> |
| | | )) |
| | | } |
| | | return null |
| | | } |
| | | |
| | | const onUpdateModelValue = (v: string | number, prop: string) => { |
| | | set(form.value, prop, v) |
| | | } |
| | | |
| | | return () => { |
| | | return ( |
| | | <div class={styles.formStyle}> |
| | | <el-form |
| | | labelPosition={props.labelPosition} |
| | | labelWidth={props.labelWidth} |
| | | model={form.value} |
| | | ref={formRef} |
| | | inline={props.inLine} |
| | | > |
| | | {formItemProps.value.map( |
| | | (item: FormItemPropType, index: number) => { |
| | | if (item.isTitle) { |
| | | if (typeof item.title === 'string') { |
| | | return ( |
| | | <Title style="margin-bottom: 10px">{item.title}</Title> |
| | | ) |
| | | } |
| | | return item.title |
| | | } |
| | | |
| | | const itemProps: FormItemPropType = {} |
| | | Object.entries(item).forEach(([key, value]) => { |
| | | itemProps[key] = unref(value) |
| | | }) |
| | | |
| | | const el = |
| | | typeof itemProps.el === 'string' |
| | | ? formItemElementMap[itemProps.el] |
| | | : itemProps.el || null |
| | | const Component = el |
| | | const el2 = |
| | | formItemElementMap['select']; |
| | | const ComponentForHighSelect = el2 |
| | | return Component && !item.isHide ? ( |
| | | |
| | | <el-form-item |
| | | label={itemProps.label} |
| | | prop={itemProps.prop} |
| | | rules={itemProps.rules} |
| | | key={itemProps.prop} |
| | | vSlots={ |
| | | itemProps.labelIcon |
| | | ? { |
| | | label: () => ( |
| | | <label class={styles.formitemPropsLabel}> |
| | | {itemProps.label} |
| | | <Icon icon={itemProps.labelIcon} /> |
| | | </label> |
| | | ), |
| | | } |
| | | : null |
| | | } |
| | | > |
| | | {/* æ·»å çæ¯è¾æä½ç¬¦éæ©å¨ */} |
| | | {/* 使ç¨flexå¸å±è®©ä¸ä¸ªå
ç´ å¨åä¸è¡ */} |
| | | <div class="flex items-center w-full" style="width:100%"> |
| | | {/* <el-select |
| | | size="small" |
| | | style="margin-right: 8px; min-width: 10px;" |
| | | > |
| | | <el-option label="çäº" value="2" /> |
| | | <el-option label="ä¸çäº" value="8" /> |
| | | </el-select> */} |
| | | {/* å½ç»ä»¶ç±»å䏿¯æ¥ææ§ä»¶æ¶æ¾ç¤ºComponentForHighSelect */} |
| | | {(!itemProps.isDateControl && ( |
| | | // ComponentForHighSelect çæ¸²æä»£ç |
| | | <ComponentForHighSelect style="width:150px;" |
| | | {...itemProps.highSelectAttrs} |
| | | modelValue={currentWidgetModel.value(itemProps.highSelectAttrs?.prop || '')} |
| | | onUpdate:modelValue={(val: string | number) => |
| | | onUpdateModelValue(val, itemProps.highSelectAttrs?.prop || '') |
| | | }> |
| | | <FormRenderForHighSelectOptions item={itemProps} /> |
| | | </ComponentForHighSelect> |
| | | ))} |
| | | {/* æ¥ææ§ä»¶æ¶çå ä½å
ç´ */} |
| | | {itemProps.isDateControl && <span style="width:150px;margin-right:8px;"></span>} |
| | | |
| | | |
| | | <Component |
| | | style={{ |
| | | width: itemProps.width, // é»è®¤å 满å©ä½å®½åº¦ |
| | | // width: itemProps.width , // é»è®¤å 满å©ä½å®½åº¦ |
| | | height: itemProps.height, |
| | | }} |
| | | {...itemProps} |
| | | // v-model={form.value[itemProps.prop as keyof any]} |
| | | modelValue={currentWidgetModel.value(itemProps.prop)} |
| | | onUpdate:modelValue={(val: string | number) => |
| | | onUpdateModelValue(val, itemProps.prop) |
| | | } |
| | | > |
| | | <FormRender item={itemProps} /> |
| | | </Component> |
| | | </div> |
| | | </el-form-item> |
| | | ) : null |
| | | } |
| | | )} |
| | | </el-form> |
| | | </div> |
| | | ) |
| | | } |
| | | }, |
| | | }) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // å符串类æ¥è¯¢ |
| | | export const FILTER_MODE_OPTIONS_STRING = [ |
| | | { label: 'æ¨¡ç³æ¥è¯¢', value: 1 }, |
| | | { label: 'ç²¾åæ¥è¯¢', value: 2 }, |
| | | ]; |
| | | // æ°åç±»æ¥è¯¢ |
| | | export const FILTER_MODE_OPTIONS_NUM = [ |
| | | { label: 'ç²¾åæ¥è¯¢', value: 2 }, |
| | | { label: '大äºçäº', value: 3 }, |
| | | { label: 'å°äºçäº', value: 4 }, |
| | | { label: '大äº', value: 5 }, |
| | | { label: 'å°äº', value: 6 }, |
| | | { label: 'ä¸çäº', value: 7 }, |
| | | ]; |
| | | // boolæ¥è¯¢ |
| | | export const FILTER_MODE_OPTIONS_BOOL = [ |
| | | { label: 'ç²¾åæ¥è¯¢', value: 2 }, |
| | | { label: 'ä¸çäº', value: 7 }, |
| | | ]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // æ¯ å¦ |
| | | export const BOOLEAN_OPTIONS = [ |
| | | { label: 'æ¯', value: true }, |
| | | { label: 'å¦', value: false }, |
| | | ]; |
| | |
| | | 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 useWmsMaterialQueryDrawer = (props: any, ctx?: any) => { |
| | | const wmsMaterialDrawer = injectModel<WmsMaterialDrawer>('WmsMaterialDrawer') |
| | |
| | | el: 'input', |
| | | //disabled: disabled, |
| | | placeholder: '请è¾å
¥ç©æç¼ç ï¼å¯ä¸æ è¯ï¼', |
| | | highSelectAttrs:{ |
| | | prop: 'materialCode_FilterMode', |
| | | el: 'select', |
| | | placeholder: 'è¯·éæ©', |
| | | options:FILTER_MODE_OPTIONS_STRING, |
| | | } |
| | | }, |
| | | { |
| | | label: 'æ¯å¦ææç©æ', |
| | |
| | | el: 'select', |
| | | //disabled: disabled, |
| | | placeholder: '请è¾å
¥æ¯å¦ææç©æ', |
| | | options: [{label: 'æ¯',value: true}, {label: 'å¦',value: false}] |
| | | options: [{label: 'æ¯',value: true}, {label: 'å¦',value: false}], |
| | | selectOptions: [{label: 'ç',value: true}, {label: 'åå',value: false}] |
| | | }, |
| | | { |
| | | label: 'æ¯å¦èªäº§', |
| | |
| | | el: 'select', |
| | | //disabled: disabled, |
| | | placeholder: '请è¾å
¥æ¯å¦èªäº§', |
| | | options: [{label: 'æ¯',value: true}, {label: 'å¦',value: false}] |
| | | options: [{label: 'æ¯',value: true}, {label: 'å¦',value: false}] , |
| | | selectOptions: [{label: 'ç',value: true}, {label: 'åå',value: false}] |
| | | }, |
| | | { |
| | | label: 'æ°é', |
| | | prop: 'num', |
| | | highSelectAttrs:{ |
| | | prop: 'num_FilterMode', |
| | | el: 'select', |
| | | placeholder: 'è¯·éæ©', |
| | | options:FILTER_MODE_OPTIONS_NUM, |
| | | }, |
| | | el: (props: any, { attrs }: SetupContext) => { |
| | | return h(inputNumber, { |
| | | ...props, |
| | |
| | | el: 'select', |
| | | //disabled: disabled, |
| | | placeholder: '请è¾å
¥æ¯å¦ç¦ç¨', |
| | | options: [{label: 'æ¯',value: true}, {label: 'å¦',value: false}] |
| | | options:BOOLEAN_OPTIONS |
| | | }, |
| | | { |
| | | label: 'æ©å±å±æ§', |
| | |
| | | { |
| | | label: 'å建æ¶é´', |
| | | prop: 'creationTime', |
| | | isDateControl: true, // æ¾å¼æ è®°ä¸ºæ¥ææ§ä»¶ |
| | | el: (props: any, { attrs }: SetupContext) => { |
| | | return h(dateTimePickerRange, { |
| | | ...props, |
| | |
| | | { |
| | | label: 'ä¿®æ¹æ¶é´', |
| | | prop: 'lastModificationTime', |
| | | isDateControl: true, // æ¾å¼æ è®°ä¸ºæ¥ææ§ä»¶ |
| | | el: (props: any, { attrs }: SetupContext) => { |
| | | return h(dateTimePickerRange, { |
| | | ...props, |
| | |
| | | return check |
| | | } |
| | | const commonGetFormData=()=>{ |
| | | //alert(formData.value.materialCode_FilterMode) |
| | | const data = { |
| | | materialCode: formData.value.materialCode || '', |
| | | materialCode_FilterMode: formData.value.materialCode_FilterMode || '', |
| | | isValid: formData.value.isValid || '', |
| | | isSelfMade: formData.value.isSelfMade || '', |
| | | num: formData.value.num || '', |
| | |
| | | ctx.emit('confirmQuery', data) |
| | | } |
| | | /** |
| | | * éç½®å
Œ
±selectæ¥è¯¢ |
| | | */ |
| | | const onResetForHighSelect = async () => { |
| | | formData.value.materialCode_FilterMode = 1 |
| | | } |
| | | /** |
| | | * éç½®æ¥è¯¢ |
| | | */ |
| | | const onReset = async () => { |
| | | formData.value = {} |
| | | onResetForHighSelect();//éç½®å
Œ
±selectæ¥è¯¢ |
| | | formData.value.MaterialCode = '' |
| | | formData.value.IsValid = '' |
| | | formData.value.IsSelfMade = '' |
| | |
| | | |
| | | } |
| | | commonQueryEnumForFrom() |
| | | onResetForHighSelect();//éç½®å
Œ
±selectæ¥è¯¢ |
| | | /** |
| | | * å¼¹çªæå¼è·å详æ
|
| | | */ |
| | |
| | | import BaseQueryDrawer from '@/components/BaseQueryDrawer/BaseQueryDrawer' |
| | | import styles from './WmsMaterialQueryDrawer.module.scss' |
| | | import { useWmsMaterialQueryDrawer } from '../../../../Controllers/WmsMaterialQueryDrawer.tsx' |
| | | import DyForm from '@/components/DyForm/DyForm' |
| | | import DyFormForHighQuery from '@/components/DyFormForHighQuery/DyFormForHighQuery' |
| | | |
| | | // @ts-ignore |
| | | export default defineComponent<{ |
| | |
| | | before-close={onClose} |
| | | onClose={onClose} |
| | | > |
| | | <DyForm |
| | | <DyFormForHighQuery |
| | | ref={formRef} |
| | | formData={formData.value} |
| | | labelWidth="106px" |
| | | formItemProps={formItems} |
| | | ></DyForm> |
| | | ></DyFormForHighQuery> |
| | | </BaseQueryDrawer> |
| | | ) |
| | | }, |