| | |
| | | <BasicForm @register="register"> |
| | | <template #add="{ field }"> |
| | | <Button v-if="field" @click="handleCreatelocation">{{ t('生成储位') }}</Button> |
| | | <div style="width:960px;height: 500px; overflow-x: scroll;"> |
| | | <div style="width: 960px; height: 500px; overflow-x: scroll"> |
| | | <div v-for="(itemc, indexc) in location" :style="{ width: divWidth + 'px' }"> |
| | | <div class="censhu"> |
| | | <span v-if="location.length > 0"> |
| | | {{ t('层', [cen - indexc]) }} |
| | | </span> |
| | | </div> |
| | | <div v-for="(item, index) in itemc" :style="getStatusStyle(item)" @click="handleClick(item.LOCATION_CODE)"> |
| | | <span style=" display: block;vertical-align:middle;"> |
| | | <div |
| | | v-for="(item, index) in itemc" |
| | | :style="getStatusStyle(item)" |
| | | @click="handleClick(item.LOCATION_CODE)" |
| | | > |
| | | <span style="display: block; vertical-align: middle"> |
| | | {{ item.LOCATION_CODE }} |
| | | </span> |
| | | </div> |
| | |
| | | <template #rightFooter> |
| | | <a-button type="primary" @click="handleSubmit"> {{ t('提交') }} </a-button> |
| | | </template> |
| | | <LocationModal @register="registerLocation" @success="setFormValues"/> |
| | | <LocationModal @register="registerLocation" @success="setFormValues" /> |
| | | </PageWrapper> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, onMounted, unref, ref, h, reactive } from 'vue'; |
| | | import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; |
| | | import { CollapseContainer } from '/@/components/Container'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { PageWrapper } from '/@/components/Page'; |
| | | import { optionsListApi } from '/@/api/tigerapi/wms/house'; |
| | | import { SaveShelf, SaveLocation, getLocationListByPage, CheckLocation,getLocationByPage,getWareHouseListByPage } from '/@/api/tigerapi/wms/house'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { nextTick } from 'vue'; |
| | | import { isEmpty } from '/@/utils/is'; |
| | | import LocationModal from './LocationModal.vue'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { defineComponent, onMounted, unref, ref, h, reactive } from 'vue'; |
| | | import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; |
| | | import { CollapseContainer } from '/@/components/Container'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { PageWrapper } from '/@/components/Page'; |
| | | import { optionsListApi } from '/@/api/tigerapi/wms/house'; |
| | | import { |
| | | SaveShelf, |
| | | SaveLocation, |
| | | getLocationListByPage, |
| | | CheckLocation, |
| | | getLocationByPage, |
| | | getWareHouseListByPage, |
| | | } from '/@/api/tigerapi/wms/house'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { nextTick } from 'vue'; |
| | | import { isEmpty } from '/@/utils/is'; |
| | | import LocationModal from './LocationModal.vue'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { useStorage } from '@vueuse/core'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | |
| | | |
| | | export default defineComponent({ |
| | | components: { BasicForm, CollapseContainer, PageWrapper,LocationModal }, |
| | | props: { |
| | | data: { |
| | | type: Object, |
| | | //default: () => ({}), |
| | | export default defineComponent({ |
| | | components: { BasicForm, CollapseContainer, PageWrapper, LocationModal }, |
| | | props: { |
| | | data: { |
| | | type: Object, |
| | | //default: () => ({}), |
| | | }, |
| | | whcode: { |
| | | type: String, |
| | | }, |
| | | }, |
| | | whcode: { |
| | | type: String, |
| | | } |
| | | }, |
| | | emit: ['success', 'register'], |
| | | setup(props, { emit }) { |
| | | const [registerLocation, { openModal: openLocationModal }] = useModal(); |
| | | const { t } = useI18n('WMS.WareHouse'); |
| | | var CENLength=ref(0); |
| | | var NOLength=ref(0); |
| | | const schemas: FormSchema[] = [ |
| | | { |
| | | field: 'CREATE_TIME', |
| | | component: 'Input', |
| | | label: '创建时间', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | show:false |
| | | }, |
| | | { |
| | | field: 'CREATE_USER', |
| | | component: 'Input', |
| | | label: '创建人', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | show:false |
| | | }, |
| | | { |
| | | field: 'UPDATE_TIME', |
| | | component: 'Input', |
| | | label: '修改时间', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | show:false |
| | | }, |
| | | { |
| | | field: 'UPDATE_USER', |
| | | component: 'Input', |
| | | label: '修改人', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | show:false |
| | | }, |
| | | { |
| | | field: 'SHELF_CODE', |
| | | component: 'Input', |
| | | label: t('货架代码'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | dynamicDisabled: true, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: 'SHELF_NAME', |
| | | component: 'Input', |
| | | label: t('货架名称'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: 'FLOORS', |
| | | component: 'InputNumber', |
| | | label: t('层数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: true, |
| | | defaultValue: 1, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | var floors = e; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | formModel.LENGHTCEN=changdu; |
| | | Rule(formModel,e) |
| | | // values.LENGHTCEN=changdu+1; |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | |
| | | if (value<1) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | emit: ['success', 'register'], |
| | | setup(props, { emit }) { |
| | | const [registerLocation, { openModal: openLocationModal }] = useModal(); |
| | | const { t } = useI18n(); |
| | | var CENLength = ref(0); |
| | | var NOLength = ref(0); |
| | | const schemas: FormSchema[] = [ |
| | | { |
| | | field: 'CREATE_TIME', |
| | | component: 'Input', |
| | | label: '创建时间', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | field: 'FLOOR_COUNT', |
| | | component: 'InputNumber', |
| | | label: t('每层储位数'), |
| | | colProps: { |
| | | span: 6, |
| | | show: false, |
| | | }, |
| | | required: true, |
| | | defaultValue: 1, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | var values = getFieldsValue() |
| | | var floors = e; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | formModel.LENGHT=changdu; |
| | | Rule(formModel, e) |
| | | // values.LENGHTCEN=changdu+1; |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | |
| | | if (value<1) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | { |
| | | field: 'CREATE_USER', |
| | | component: 'Input', |
| | | label: '创建人', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | field: 'REMARK', |
| | | component: 'Input', |
| | | label: t('备注'), |
| | | colProps: { |
| | | span: 6, |
| | | show: false, |
| | | }, |
| | | required: false, |
| | | }, |
| | | { |
| | | field: 'SHELF_TYPE', |
| | | component: 'ApiSelect', |
| | | label: t('货架类型'), |
| | | colProps: { |
| | | span: 6, |
| | | { |
| | | field: 'UPDATE_TIME', |
| | | component: 'Input', |
| | | label: '修改时间', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | show: false, |
| | | }, |
| | | componentProps: { |
| | | api: optionsListApi, |
| | | resultField: 'Data', |
| | | labelField: 'Desc', |
| | | valueField: 'Value', |
| | | // onChange: (e, v) => { |
| | | // alert(e) |
| | | // console.log('ApiSelect====>:', e, v); |
| | | // }, |
| | | { |
| | | field: 'UPDATE_USER', |
| | | component: 'Input', |
| | | label: '修改人', |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | show: false, |
| | | }, |
| | | required: false, |
| | | }, |
| | | { |
| | | field: 'ID', |
| | | label: 'ID', |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'InputNumber', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'REGION_ID', |
| | | label: t('储区代码'), |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'ORG_CODE', |
| | | label: 'ORG_CODE', |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'IS_ACTIVE', |
| | | component: 'RadioGroup', |
| | | label: t('是否启用'), |
| | | colProps: { |
| | | span: 12, |
| | | { |
| | | field: 'SHELF_CODE', |
| | | component: 'Input', |
| | | label: t('货架代码'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | dynamicDisabled: true, |
| | | required: true, |
| | | }, |
| | | required: true, |
| | | componentProps: { |
| | | options: [ |
| | | { |
| | | field: 'SHELF_NAME', |
| | | component: 'Input', |
| | | label: t('货架名称'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: 'FLOORS', |
| | | component: 'InputNumber', |
| | | label: t('层数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: true, |
| | | defaultValue: 1, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | var floors = e; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | formModel.LENGHTCEN = changdu; |
| | | Rule(formModel, e); |
| | | // values.LENGHTCEN=changdu+1; |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | label: t('是'), |
| | | value: 'Y', |
| | | }, |
| | | { |
| | | label: t('否'), |
| | | value: 'N', |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | if (value < 1) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }, |
| | | rules: [{ required: false, message: t('覆盖默认生成的校验信息') }], |
| | | }, |
| | | { |
| | | field: 'divider-basic', |
| | | component: 'Divider', |
| | | label: t('规则'), |
| | | colProps: { |
| | | { |
| | | field: 'FLOOR_COUNT', |
| | | component: 'InputNumber', |
| | | label: t('每层储位数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: true, |
| | | defaultValue: 1, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | var values = getFieldsValue(); |
| | | var floors = e; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | formModel.LENGHT = changdu; |
| | | Rule(formModel, e); |
| | | // values.LENGHTCEN=changdu+1; |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | if (value < 1) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | field: 'REMARK', |
| | | component: 'Input', |
| | | label: t('备注'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | }, |
| | | { |
| | | field: 'SHELF_TYPE', |
| | | component: 'ApiSelect', |
| | | label: t('货架类型'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | componentProps: { |
| | | api: optionsListApi, |
| | | resultField: 'Data', |
| | | labelField: 'Desc', |
| | | valueField: 'Value', |
| | | // onChange: (e, v) => { |
| | | // alert(e) |
| | | // console.log('ApiSelect====>:', e, v); |
| | | // }, |
| | | }, |
| | | required: false, |
| | | }, |
| | | { |
| | | field: 'ID', |
| | | label: 'ID', |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'InputNumber', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'REGION_ID', |
| | | label: t('储区代码'), |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'ORG_CODE', |
| | | label: 'ORG_CODE', |
| | | required: true, |
| | | defaultValue: useUserStore().getUserInfo.orgCode, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'IS_ACTIVE', |
| | | component: 'RadioGroup', |
| | | label: t('是否启用'), |
| | | colProps: { |
| | | span: 12, |
| | | }, |
| | | required: true, |
| | | componentProps: { |
| | | options: [ |
| | | { |
| | | label: t('是'), |
| | | value: 'Y', |
| | | }, |
| | | { |
| | | label: t('否'), |
| | | value: 'N', |
| | | }, |
| | | ], |
| | | }, |
| | | rules: [{ required: false, message: t('覆盖默认生成的校验信息') }], |
| | | }, |
| | | { |
| | | field: 'divider-basic', |
| | | component: 'Divider', |
| | | label: t('规则'), |
| | | colProps: { |
| | | span: 24, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'WH_CODE_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('仓库'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | if (e.target.checked) { |
| | | formModel.WH_CODE_guize = true; |
| | | Rule(formModel, e); |
| | | } else { |
| | | formModel.WH_CODE_guize = false; |
| | | Rule(formModel, e); |
| | | } |
| | | |
| | | // if (Boolean(e.target.checked)) { |
| | | // formModel.Example = 'W01' + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | |
| | | // //formModel.Example = 'W01' + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel?.Example1 |
| | | // } else { |
| | | // formModel.Example = formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | // } |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'REGION_CODE_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('区域'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | if (e.target.checked) { |
| | | formModel.REGION_CODE_guize = true; |
| | | Rule(formModel, e); |
| | | } else { |
| | | formModel.REGION_CODE_guize = false; |
| | | Rule(formModel, e); |
| | | } |
| | | // if (Boolean(e.target.checked)) { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + 'R01' + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | |
| | | // //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + 'R01' + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel?.Example1 |
| | | // } else { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | // } |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'SHELF_CODE_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('货架'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | dynamicDisabled: true, |
| | | defaultValue: true, |
| | | required: false, |
| | | }, |
| | | { |
| | | field: 'FLOORS_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('层数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | // defaultValue: true, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | console.log('formModel', formModel); |
| | | return { |
| | | onChange: (e) => { |
| | | console.log('e', e); |
| | | if (e.target.checked) { |
| | | formModel.FLOORS_guize = true; |
| | | Rule(formModel, e); |
| | | } else { |
| | | formModel.FLOORS_guize = false; |
| | | Rule(formModel, e); |
| | | } |
| | | // if (Boolean(e.target.checked)) { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | |
| | | // //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + (formModel.REGION_CODE_guize ? 'R01' : '') + (formModel.SHELF_CODE_guize ? 'S' : '') + '1'.padStart(4,"0") + formModel?.Example1 |
| | | // } else { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | // } |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'LENGHTCEN', |
| | | component: 'InputNumber', |
| | | label: t('层数位数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | defaultValue: 2, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | //formModel.Example='001' |
| | | formModel.LENGHTCEN = e; |
| | | Rule(formModel, e); |
| | | //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(e, '0') |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | var values = getFieldsValue(); |
| | | var floors = values.FLOORS; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | if (!value) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | if (value < changdu) { |
| | | return Promise.reject(t('位数不足,请调整大一点')); |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | field: 'LENGHT', |
| | | component: 'InputNumber', |
| | | label: t('序列号位数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | defaultValue: 2, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | //formModel.Example='001' |
| | | formModel.LENGHT = e; |
| | | Rule(formModel, e); |
| | | //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(e, '0') |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | var values = getFieldsValue(); |
| | | var floors = values.FLOOR_COUNT; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | if (!value) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | if (value < changdu) { |
| | | return Promise.reject(t('位数不足,请调整大一点')); |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | field: 'Connector', |
| | | component: 'Input', |
| | | label: t('连接符'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | formModel.Connector = e.target.value; |
| | | Rule(formModel, e); |
| | | //Rule(formModel, e) |
| | | //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + e.target.value + (formModel.REGION_CODE_guize ? 'R01' : '') + e.target.value + (formModel.SHELF_CODE_guize ? 'S' : '') + e.target.value + '1'.padStart(2, "0") + e.target.value + "1".padStart(formModel.LENGHT, '0') |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'Example', |
| | | component: 'Input', |
| | | label: t('示例'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | dynamicDisabled: true, |
| | | }, |
| | | { |
| | | field: 'REGION_ID', |
| | | label: t('储区代码'), |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'ORG_CODE', |
| | | label: 'ORG_CODE', |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: '0', |
| | | component: 'Input', |
| | | label: ' ', |
| | | slot: 'add', |
| | | colProps: { |
| | | span: 8, |
| | | }, |
| | | }, |
| | | ]; |
| | | |
| | | const { createConfirm } = useMessage(); |
| | | const { createMessage } = useMessage(); |
| | | const [ |
| | | register, |
| | | { validateFields, clearValidate, getFieldsValue, resetFields, setFieldsValue }, |
| | | ] = useForm({ |
| | | showSubmitButton: false, |
| | | showResetButton: false, |
| | | labelWidth: 120, |
| | | schemas, |
| | | canResize: true, |
| | | actionColOptions: { |
| | | span: 24, |
| | | }, |
| | | }, |
| | | { |
| | | field: 'WH_CODE_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('仓库'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | if (e.target.checked) { |
| | | formModel.WH_CODE_guize = true; |
| | | Rule(formModel, e) |
| | | } else { |
| | | formModel.WH_CODE_guize = false; |
| | | Rule(formModel, e) |
| | | } |
| | | |
| | | // if (Boolean(e.target.checked)) { |
| | | // formModel.Example = 'W01' + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | |
| | | // //formModel.Example = 'W01' + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel?.Example1 |
| | | // } else { |
| | | // formModel.Example = formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | // } |
| | | |
| | | }, |
| | | }; |
| | | }, |
| | | |
| | | }, |
| | | { |
| | | field: 'REGION_CODE_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('区域'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | if (e.target.checked) { |
| | | formModel.REGION_CODE_guize = true; |
| | | Rule(formModel, e) |
| | | } else { |
| | | formModel.REGION_CODE_guize = false; |
| | | Rule(formModel, e) |
| | | } |
| | | // if (Boolean(e.target.checked)) { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + 'R01' + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | |
| | | // //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + 'R01' + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel?.Example1 |
| | | // } else { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | // } |
| | | |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'SHELF_CODE_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('货架'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | dynamicDisabled: true, |
| | | defaultValue: true, |
| | | required: false, |
| | | }, |
| | | { |
| | | field: 'FLOORS_guize', |
| | | component: 'Checkbox', |
| | | label: ' ', |
| | | renderComponentContent: t('层数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | // defaultValue: true, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | console.log('formModel',formModel) |
| | | return { |
| | | onChange: (e) => { |
| | | console.log('e',e) |
| | | if (e.target.checked) { |
| | | formModel.FLOORS_guize = true; |
| | | Rule(formModel, e) |
| | | } else { |
| | | formModel.FLOORS_guize = false; |
| | | Rule(formModel, e) |
| | | } |
| | | // if (Boolean(e.target.checked)) { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | |
| | | // //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + (formModel.REGION_CODE_guize ? 'R01' : '') + (formModel.SHELF_CODE_guize ? 'S' : '') + '1'.padStart(4,"0") + formModel?.Example1 |
| | | // } else { |
| | | // formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + formModel.Connector + "1".padStart(formModel.LENGHT, '0') |
| | | // } |
| | | |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'LENGHTCEN', |
| | | component: 'InputNumber', |
| | | label: t('层数位数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | defaultValue: 2, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | //formModel.Example='001' |
| | | formModel.LENGHTCEN = e |
| | | Rule(formModel, e) |
| | | //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(e, '0') |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | var values = getFieldsValue() |
| | | var floors = values.FLOORS; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | if (!value) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | if (value < changdu) { |
| | | return Promise.reject(t('位数不足,请调整大一点')) |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | field: 'LENGHT', |
| | | component: 'InputNumber', |
| | | label: t('序列号位数'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | defaultValue: 2, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | //formModel.Example='001' |
| | | formModel.LENGHT = e |
| | | Rule(formModel, e) |
| | | //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + formModel.Connector + (formModel.REGION_CODE_guize ? 'R01' : '') + formModel.Connector + (formModel.SHELF_CODE_guize ? 'S' : '') + formModel.Connector + '1'.padStart(2, "0") + formModel.Connector + "1".padStart(e, '0') |
| | | }, |
| | | }; |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | // @ts-ignore |
| | | validator: async (rule, value) => { |
| | | var values = getFieldsValue() |
| | | var floors = values.FLOOR_COUNT; |
| | | //'1'.padStart(formModel.LENGHT, '0') |
| | | var changdu = String(floors).length; |
| | | if (!value) { |
| | | /* eslint-disable-next-line */ |
| | | return Promise.reject(t('必须大于0')); |
| | | } |
| | | if (value < changdu) { |
| | | return Promise.reject(t('位数不足,请调整大一点')) |
| | | } |
| | | |
| | | return Promise.resolve(); |
| | | }, |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | field: 'Connector', |
| | | component: 'Input', |
| | | label: t('连接符'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | componentProps: ({ schema, tableAction, formActionType, formModel }) => { |
| | | return { |
| | | onChange: (e) => { |
| | | formModel.Connector = e.target.value; |
| | | Rule(formModel, e) |
| | | //Rule(formModel, e) |
| | | //formModel.Example = (formModel.WH_CODE_guize ? 'W01' : '') + e.target.value + (formModel.REGION_CODE_guize ? 'R01' : '') + e.target.value + (formModel.SHELF_CODE_guize ? 'S' : '') + e.target.value + '1'.padStart(2, "0") + e.target.value + "1".padStart(formModel.LENGHT, '0') |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | { |
| | | field: 'Example', |
| | | component: 'Input', |
| | | label: t('示例'), |
| | | colProps: { |
| | | span: 6, |
| | | }, |
| | | required: false, |
| | | dynamicDisabled: true, |
| | | }, |
| | | { |
| | | field: 'REGION_ID', |
| | | label: t('储区代码'), |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: 'ORG_CODE', |
| | | label: 'ORG_CODE', |
| | | required: true, |
| | | defaultValue: 0, |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | { |
| | | field: '0', |
| | | component: 'Input', |
| | | label: ' ', |
| | | slot: 'add', |
| | | colProps: { |
| | | span: 8, |
| | | }, |
| | | }, |
| | | ]; |
| | | |
| | | const { createConfirm } = useMessage(); |
| | | const { createMessage } = useMessage(); |
| | | const [ |
| | | register, |
| | | { validateFields, clearValidate, getFieldsValue, resetFields, setFieldsValue }, |
| | | ] = useForm({ |
| | | showSubmitButton: false, |
| | | showResetButton: false, |
| | | labelWidth: 120, |
| | | schemas, |
| | | canResize:true, |
| | | actionColOptions: { |
| | | span: 24, |
| | | }, |
| | | }); |
| | | var divWidth = ref(200); |
| | | async function validateForm() { |
| | | try { |
| | | const res = await validateFields(); |
| | | console.log('passing', res); |
| | | } catch (error) { |
| | | console.log('not passing', error); |
| | | } |
| | | } |
| | | async function resetValidate() { |
| | | clearValidate(); |
| | | } |
| | | async function getFormValues() { |
| | | await nextTick() |
| | | formValues.value = getFieldsValue(); |
| | | //formValues.value.Example= formValues.value.SHELF_CODE+ formValues.value.FLOORS+'0001' |
| | | } |
| | | var location_code = ref('') |
| | | var wh_code = ref('') |
| | | var location_xuhao = ref('0001') |
| | | var weishu = ref(0); |
| | | var formValues = ref(); |
| | | var cen = ref(0); |
| | | var lie = ref(0); |
| | | var generate = ref(false); |
| | | // 自动请求并暴露内部方法 |
| | | onMounted(async () => { |
| | | await setFormValues() |
| | | setTimeout(async () => { |
| | | await getFormValues(); |
| | | }, 100); |
| | | //await getFormValues(); |
| | | }); |
| | | //set回来数据 |
| | | async function setFormValues() { |
| | | console.log('jdkj',props.data[0]) |
| | | lie.value =lie.value!==0?lie.value : Number(props.data[0]?.FLOOR_COUNT); |
| | | cen.value =cen.value!==0?cen.value : Number(props.data[0]?.FLOORS); |
| | | divWidth.value = lie.value * 81 + 61; |
| | | location.value=[] |
| | | setFieldsValue({ |
| | | ID: props.data[0]?.ID, |
| | | SHELF_CODE: props.data[0]?.SHELF_CODE, |
| | | SHELF_NAME: props.data[0]?.SHELF_NAME, |
| | | FLOORS: Number(props.data[0]?.FLOORS)===0?1:props.data[0]?.FLOORS, |
| | | FLOOR_COUNT: Number(props.data[0]?.FLOOR_COUNT)===0?1:props.data[0]?.FLOOR_COUNT, |
| | | ORG_CODE: props.data[0]?.ORG_CODE, |
| | | AUTH_ORG: props.data[0]?.AUTH_ORG, |
| | | // DIRECTION: string, |
| | | REGION_ID: props.data[0]?.REGION_ID, |
| | | SHELF_TYPE: props.data[0]?.SHELF_TYPE, |
| | | // // IS_CAR: string, |
| | | // // RACKID: string, |
| | | // // HOST_NAME: string, |
| | | // // IP: string, |
| | | // // PORT: string, |
| | | // // IS_ONLINE: string, |
| | | // // WEBHOOK_URL: string, |
| | | IS_ACTIVE: props.data[0]?.IS_ACTIVE, |
| | | CREATE_USER: props.data[0]?.CREATE_USER, |
| | | CREATE_TIME: props.data[0]?.CREATE_TIME, |
| | | //CREATE_TIME: String(props.data[0]?.CAREATE_TIME), |
| | | REMARK: props.data[0]?.REMARK, |
| | | Example: props.data[0]?.SHELF_CODE +'01' + '01', |
| | | }); |
| | | |
| | | var location_data = await getLocationListByPage(props.data[0]?.ID,props.data[0]?.AUTH_ORG) |
| | | if (!isEmpty(location_data.Items)) { |
| | | var cheshu = ref(0) |
| | | var locationlie = ref([]); |
| | | location_data.Items.forEach(item => { |
| | | if (item.FLOOR_NO != cheshu.value) { |
| | | cheshu.value = item.FLOOR_NO |
| | | if (locationlie.value != '') { |
| | | location.value.push(locationlie.value); |
| | | var divWidth = ref(200); |
| | | async function validateForm() { |
| | | try { |
| | | const res = await validateFields(); |
| | | console.log('passing', res); |
| | | } catch (error) { |
| | | console.log('not passing', error); |
| | | } |
| | | } |
| | | async function resetValidate() { |
| | | clearValidate(); |
| | | } |
| | | async function getFormValues() { |
| | | await nextTick(); |
| | | formValues.value = getFieldsValue(); |
| | | //formValues.value.Example= formValues.value.SHELF_CODE+ formValues.value.FLOORS+'0001' |
| | | } |
| | | var location_code = ref(''); |
| | | var wh_code = ref(''); |
| | | var location_xuhao = ref('0001'); |
| | | var weishu = ref(0); |
| | | var formValues = ref(); |
| | | var cen = ref(0); |
| | | var lie = ref(0); |
| | | var generate = ref(false); |
| | | // 自动请求并暴露内部方法 |
| | | onMounted(async () => { |
| | | await setFormValues(); |
| | | setTimeout(async () => { |
| | | await getFormValues(); |
| | | }, 100); |
| | | //await getFormValues(); |
| | | }); |
| | | //set回来数据 |
| | | async function setFormValues() { |
| | | console.log('jdkj', props.data[0]); |
| | | lie.value = lie.value !== 0 ? lie.value : Number(props.data[0]?.FLOOR_COUNT); |
| | | cen.value = cen.value !== 0 ? cen.value : Number(props.data[0]?.FLOORS); |
| | | divWidth.value = lie.value * 81 + 61; |
| | | location.value = []; |
| | | setFieldsValue({ |
| | | ID: props.data[0]?.ID, |
| | | SHELF_CODE: props.data[0]?.SHELF_CODE, |
| | | SHELF_NAME: props.data[0]?.SHELF_NAME, |
| | | FLOORS: Number(props.data[0]?.FLOORS) === 0 ? 1 : props.data[0]?.FLOORS, |
| | | FLOOR_COUNT: Number(props.data[0]?.FLOOR_COUNT) === 0 ? 1 : props.data[0]?.FLOOR_COUNT, |
| | | ORG_CODE: props.data[0]?.ORG_CODE, |
| | | AUTH_ORG: props.data[0]?.AUTH_ORG, |
| | | // DIRECTION: string, |
| | | REGION_ID: props.data[0]?.REGION_ID, |
| | | SHELF_TYPE: props.data[0]?.SHELF_TYPE, |
| | | // // IS_CAR: string, |
| | | // // RACKID: string, |
| | | // // HOST_NAME: string, |
| | | // // IP: string, |
| | | // // PORT: string, |
| | | // // IS_ONLINE: string, |
| | | // // WEBHOOK_URL: string, |
| | | IS_ACTIVE: props.data[0]?.IS_ACTIVE, |
| | | CREATE_USER: props.data[0]?.CREATE_USER, |
| | | CREATE_TIME: props.data[0]?.CREATE_TIME, |
| | | //CREATE_TIME: String(props.data[0]?.CAREATE_TIME), |
| | | REMARK: props.data[0]?.REMARK, |
| | | Example: props.data[0]?.SHELF_CODE + '01' + '01', |
| | | }); |
| | | |
| | | var location_data = await getLocationListByPage(props.data[0]?.ID, props.data[0]?.AUTH_ORG); |
| | | if (!isEmpty(location_data.Items)) { |
| | | var cheshu = ref(0); |
| | | var locationlie = ref([]); |
| | | location_data.Items.forEach((item) => { |
| | | if (item.FLOOR_NO != cheshu.value) { |
| | | cheshu.value = item.FLOOR_NO; |
| | | if (locationlie.value != '') { |
| | | location.value.push(locationlie.value); |
| | | } |
| | | locationlie.value = []; |
| | | } |
| | | locationlie.value = [] |
| | | } |
| | | if (item.FLOOR_NO === cheshu.value) { |
| | | locationlie.value.push(item) |
| | | } |
| | | |
| | | }); |
| | | location.value.push(locationlie.value); |
| | | } |
| | | var wh_data=await getWareHouseListByPage(props.data[0].SHELF_CODE) |
| | | wh_code.value=wh_data.Items[0].WH_CODE |
| | | } |
| | | |
| | | //点击提交 |
| | | async function handleSubmit() { |
| | | if (!generate.value) { |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: () => h('span', t('提示')), |
| | | content: () => h('span', t('没有生成储位,是否提交')), |
| | | onOk: async () => { |
| | | ConfirmSave() |
| | | }, |
| | | }); |
| | | } else { |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: () => h('span', t('提示')), |
| | | content: () => h('span', t('是否提交')), |
| | | onOk: async () => { |
| | | ConfirmSave() |
| | | }, |
| | | }); |
| | | if (item.FLOOR_NO === cheshu.value) { |
| | | locationlie.value.push(item); |
| | | } |
| | | }); |
| | | location.value.push(locationlie.value); |
| | | } |
| | | var wh_data = await getWareHouseListByPage(props.data[0].SHELF_CODE); |
| | | wh_code.value = wh_data.Items[0].WH_CODE; |
| | | } |
| | | |
| | | } |
| | | //确认提交 |
| | | async function ConfirmSave() { |
| | | var values = await validateFields() |
| | | const apiAction = SaveShelf(values, true) |
| | | apiAction.then((action) => { |
| | | if (action.IsSuccessed) { |
| | | createMessage.success('货架保存成功'); |
| | | emit('success', { |
| | | isUpdate: unref(false), |
| | | values: { ...values, id: 0 }, |
| | | //点击提交 |
| | | async function handleSubmit() { |
| | | if (!generate.value) { |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: () => h('span', t('提示')), |
| | | content: () => h('span', t('没有生成储位,是否提交')), |
| | | onOk: async () => { |
| | | ConfirmSave(); |
| | | }, |
| | | }); |
| | | } else { |
| | | createMessage.error('货架保存失败'); |
| | | //createMessage.success(values.SHELF_CODE + '保存失败'); |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: () => h('span', t('提示')), |
| | | content: () => h('span', t('是否提交')), |
| | | onOk: async () => { |
| | | ConfirmSave(); |
| | | }, |
| | | }); |
| | | } |
| | | }); |
| | | if (generate.value) { |
| | | const apiActionl = SaveLocation(location.value, false) |
| | | apiActionl.then((action) => { |
| | | } |
| | | //确认提交 |
| | | async function ConfirmSave() { |
| | | var values = await validateFields(); |
| | | const apiAction = SaveShelf(values, true); |
| | | apiAction.then((action) => { |
| | | if (action.IsSuccessed) { |
| | | createMessage.success('储位保存成功'); |
| | | createMessage.success('货架保存成功'); |
| | | emit('success', { |
| | | isUpdate: unref(false), |
| | | values: { ...values, id: 0 }, |
| | | }); |
| | | setFormValues() |
| | | } else { |
| | | createMessage.error('储位保存失败'); |
| | | createMessage.error('货架保存失败'); |
| | | //createMessage.success(values.SHELF_CODE + '保存失败'); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | //点击单个div |
| | | async function handleClick(item: string) { |
| | | var location_data=await getLocationByPage(item); |
| | | openLocationModal(true, { |
| | | data: location_data, |
| | | info: '', |
| | | }); |
| | | } |
| | | //生成储位规则 |
| | | function Rule(formModel: any, e: any) { |
| | | |
| | | formModel.Example = (formModel.WH_CODE_guize ? wh_code.value : '') + |
| | | (formModel.WH_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.REGION_CODE_guize ? formValues.value?.REGION_ID : '') + |
| | | (formModel.REGION_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.SHELF_CODE_guize ? formValues.value?.SHELF_CODE : '') + |
| | | (formModel.SHELF_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.FLOORS_guize ? ('1'.padStart(formModel.LENGHTCEN, '0')) : '') + |
| | | //(formModel.SHELF_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.FLOORS_guize ? (formValues.value.FLOORS) : '') + |
| | | (formModel.FLOORS_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + |
| | | '1'.padStart(formModel.LENGHT, '0') |
| | | |
| | | location_xuhao.value = '1'.padStart(formModel.LENGHT, '0') |
| | | weishu.value = formModel.LENGHT |
| | | location_code.value = (formModel.WH_CODE_guize ? wh_code.value : '') + |
| | | (formModel.WH_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.REGION_CODE_guize ? formValues.value?.REGION_ID : '') + |
| | | (formModel.REGION_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.SHELF_CODE_guize ? formValues.value?.SHELF_CODE : '') + |
| | | //(formModel.SHELF_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.FLOORS_guize ? (formValues.value.FLOORS) : '') +//'{0}' + |
| | | (formModel.FLOORS_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '')//+'{1}' |
| | | } |
| | | var location = ref([]); |
| | | //生成储位代码 |
| | | function CreateLocation() { |
| | | location.value = []; |
| | | var values = getFieldsValue() |
| | | cen.value = values.FLOORS; |
| | | lie.value = values.FLOOR_COUNT; |
| | | divWidth.value = lie.value * 81 + 61; |
| | | var hunfang = ref(''); |
| | | if (values.SHELF_TYPE === 1 || values.SHELF_TYPE === 2) { |
| | | hunfang.value = 'N' |
| | | } else { hunfang.value = 'Y' } |
| | | for (let indexc = cen.value; indexc > 0; indexc--) { |
| | | var locationlie = ref([]) |
| | | for (let index = lie.value; index >0; index--) { |
| | | var first_code = (indexc - 1) * lie.value + 1 |
| | | var code = (values.WH_CODE_guize ? wh_code.value : '') + |
| | | (values.WH_CODE_guize ? (values.Connector == undefined ? '' : values.Connector) : '') + (values?.REGION_CODE_guize ? values?.REGION_ID : '') + |
| | | (values.REGION_CODE_guize ? (values.Connector == undefined ? '' : values.Connector) : '') + (values?.SHELF_CODE_guize ? values?.SHELF_CODE : '') + |
| | | (values.SHELF_CODE_guize ? (values.Connector == undefined ? '' : values.Connector) : '') + (values.FLOORS_guize ?String(indexc).padStart(values.LENGHTCEN, '0'):'') + |
| | | (values.FLOORS_guize ? (values.Connector == undefined ? '' : values.Connector) : '') + String(index).padStart(values.LENGHT, '0') |
| | | locationlie.value.push({ LOCATION_CODE: code, IS_ACTIVE: '', ORG_CODE: values.ORG_CODE, SHELF_ID: values.ID, ISMIX: hunfang.value, FLOOR_NO: indexc, LEDID: index -1 + first_code,SEQ_NO: index }) |
| | | }); |
| | | if (generate.value) { |
| | | const apiActionl = SaveLocation(location.value, false); |
| | | apiActionl.then((action) => { |
| | | if (action.IsSuccessed) { |
| | | createMessage.success('储位保存成功'); |
| | | emit('success', { |
| | | isUpdate: unref(false), |
| | | values: { ...values, id: 0 }, |
| | | }); |
| | | setFormValues(); |
| | | } else { |
| | | createMessage.error('储位保存失败'); |
| | | } |
| | | }); |
| | | } |
| | | location.value.push(locationlie.value) |
| | | } |
| | | } |
| | | //生成 |
| | | async function handleCreatelocation() { |
| | | var values = await validateFields() |
| | | var result = await CheckLocation(values.ID) |
| | | if (result.IsSuccessed) { |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: () => h('span', t('提示')), |
| | | content: () => h('span', t('是否初始化,重新生成储位')), |
| | | onOk: async () => { |
| | | generate.value = true; |
| | | CreateLocation() |
| | | }, |
| | | }) |
| | | } else { |
| | | createMessage.error(t(result.LocaleMsg)); |
| | | //点击单个div |
| | | async function handleClick(item: string) { |
| | | var location_data = await getLocationByPage(item); |
| | | openLocationModal(true, { |
| | | data: location_data, |
| | | info: '', |
| | | }); |
| | | } |
| | | } |
| | | //生成储位规则 |
| | | function Rule(formModel: any, e: any) { |
| | | formModel.Example = |
| | | (formModel.WH_CODE_guize ? wh_code.value : '') + |
| | | (formModel.WH_CODE_guize |
| | | ? formModel.Connector == undefined |
| | | ? '' |
| | | : formModel.Connector |
| | | : '') + |
| | | (formModel?.REGION_CODE_guize ? formValues.value?.REGION_ID : '') + |
| | | (formModel.REGION_CODE_guize |
| | | ? formModel.Connector == undefined |
| | | ? '' |
| | | : formModel.Connector |
| | | : '') + |
| | | (formModel?.SHELF_CODE_guize ? formValues.value?.SHELF_CODE : '') + |
| | | (formModel.SHELF_CODE_guize |
| | | ? formModel.Connector == undefined |
| | | ? '' |
| | | : formModel.Connector |
| | | : '') + |
| | | (formModel?.FLOORS_guize ? '1'.padStart(formModel.LENGHTCEN, '0') : '') + |
| | | //(formModel.SHELF_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.FLOORS_guize ? (formValues.value.FLOORS) : '') + |
| | | (formModel.FLOORS_guize |
| | | ? formModel.Connector == undefined |
| | | ? '' |
| | | : formModel.Connector |
| | | : '') + |
| | | '1'.padStart(formModel.LENGHT, '0'); |
| | | |
| | | function getStatusStyle(item: any) { |
| | | var data=reactive({}); |
| | | if(item.IS_ACTIVE=='Y'){ |
| | | data = reactive({ |
| | | 'overflow-wrap': 'break-word', |
| | | 'text-align': 'center', |
| | | 'word-break': 'break-word', |
| | | 'vertical-align': 'middle', |
| | | 'border-width': 'medium', |
| | | 'border-color': 'white', |
| | | width: '80px', |
| | | display: 'table-cell', |
| | | color:'white', |
| | | height: '100px', |
| | | 'background-color': '#7CCD7C', |
| | | padding: '2px', |
| | | 'margin-top': '4px', |
| | | }) |
| | | location_xuhao.value = '1'.padStart(formModel.LENGHT, '0'); |
| | | weishu.value = formModel.LENGHT; |
| | | location_code.value = |
| | | (formModel.WH_CODE_guize ? wh_code.value : '') + |
| | | (formModel.WH_CODE_guize |
| | | ? formModel.Connector == undefined |
| | | ? '' |
| | | : formModel.Connector |
| | | : '') + |
| | | (formModel?.REGION_CODE_guize ? formValues.value?.REGION_ID : '') + |
| | | (formModel.REGION_CODE_guize |
| | | ? formModel.Connector == undefined |
| | | ? '' |
| | | : formModel.Connector |
| | | : '') + |
| | | (formModel?.SHELF_CODE_guize ? formValues.value?.SHELF_CODE : '') + |
| | | //(formModel.SHELF_CODE_guize ? (formModel.Connector == undefined ? '' : formModel.Connector) : '') + (formModel?.FLOORS_guize ? (formValues.value.FLOORS) : '') +//'{0}' + |
| | | (formModel.FLOORS_guize |
| | | ? formModel.Connector == undefined |
| | | ? '' |
| | | : formModel.Connector |
| | | : ''); //+'{1}' |
| | | } |
| | | else if(item.IS_ACTIVE=='N'){ |
| | | data = reactive({ |
| | | 'overflow-wrap': 'break-word', |
| | | 'text-align': 'center', |
| | | 'word-break': 'break-word', |
| | | 'vertical-align': 'middle', |
| | | 'border-width': 'medium', |
| | | 'border-color': 'white', |
| | | width: '80px', |
| | | color:'white', |
| | | display: 'table-cell', |
| | | height: '100px', |
| | | 'background-color': ' #FF4040', |
| | | padding: '2px', |
| | | 'margin-top': '4px', |
| | | }) |
| | | }else{ |
| | | data = reactive({ |
| | | 'overflow-wrap': 'break-word', |
| | | 'text-align': 'center', |
| | | 'word-break': 'break-word', |
| | | 'vertical-align': 'middle', |
| | | 'border-width': 'medium', |
| | | 'border-color': 'white', |
| | | width: '80px', |
| | | display: 'table-cell', |
| | | height: '100px', |
| | | 'background-color': 'rgb(154, 191, 219)', |
| | | padding: '2px', |
| | | 'margin-top': '4px', |
| | | }) |
| | | var location = ref([]); |
| | | //生成储位代码 |
| | | function CreateLocation() { |
| | | location.value = []; |
| | | var values = getFieldsValue(); |
| | | cen.value = values.FLOORS; |
| | | lie.value = values.FLOOR_COUNT; |
| | | divWidth.value = lie.value * 81 + 61; |
| | | var hunfang = ref(''); |
| | | if (values.SHELF_TYPE === 1 || values.SHELF_TYPE === 2) { |
| | | hunfang.value = 'N'; |
| | | } else { |
| | | hunfang.value = 'Y'; |
| | | } |
| | | for (let indexc = cen.value; indexc > 0; indexc--) { |
| | | var locationlie = ref([]); |
| | | for (let index = lie.value; index > 0; index--) { |
| | | var first_code = (indexc - 1) * lie.value + 1; |
| | | var code = |
| | | (values.WH_CODE_guize ? wh_code.value : '') + |
| | | (values.WH_CODE_guize |
| | | ? values.Connector == undefined |
| | | ? '' |
| | | : values.Connector |
| | | : '') + |
| | | (values?.REGION_CODE_guize ? values?.REGION_ID : '') + |
| | | (values.REGION_CODE_guize |
| | | ? values.Connector == undefined |
| | | ? '' |
| | | : values.Connector |
| | | : '') + |
| | | (values?.SHELF_CODE_guize ? values?.SHELF_CODE : '') + |
| | | (values.SHELF_CODE_guize |
| | | ? values.Connector == undefined |
| | | ? '' |
| | | : values.Connector |
| | | : '') + |
| | | (values.FLOORS_guize ? String(indexc).padStart(values.LENGHTCEN, '0') : '') + |
| | | (values.FLOORS_guize ? (values.Connector == undefined ? '' : values.Connector) : '') + |
| | | String(index).padStart(values.LENGHT, '0'); |
| | | locationlie.value.push({ |
| | | LOCATION_CODE: code, |
| | | IS_ACTIVE: '', |
| | | ORG_CODE: values.ORG_CODE, |
| | | SHELF_ID: values.ID, |
| | | ISMIX: hunfang.value, |
| | | FLOOR_NO: indexc, |
| | | LEDID: index - 1 + first_code, |
| | | SEQ_NO: index, |
| | | }); |
| | | } |
| | | location.value.push(locationlie.value); |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | |
| | | return { |
| | | t, |
| | | cen, |
| | | lie, |
| | | getStatusStyle, |
| | | generate, |
| | | divWidth, |
| | | location_code, |
| | | location_xuhao, |
| | | location, |
| | | register, |
| | | schemas, |
| | | Rule, |
| | | weishu, |
| | | handleSubmit, |
| | | handleClick, |
| | | handleCreatelocation, |
| | | getFormValues, |
| | | setFormValues, |
| | | validateForm, |
| | | resetValidate, |
| | | resetFields, |
| | | registerLocation |
| | | }; |
| | | }, |
| | | }); |
| | | //生成 |
| | | async function handleCreatelocation() { |
| | | var values = await validateFields(); |
| | | var result = await CheckLocation(values.ID); |
| | | if (result.IsSuccessed) { |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: () => h('span', t('提示')), |
| | | content: () => h('span', t('是否初始化,重新生成储位')), |
| | | onOk: async () => { |
| | | generate.value = true; |
| | | CreateLocation(); |
| | | }, |
| | | }); |
| | | } else { |
| | | createMessage.error(t(result.LocaleMsg)); |
| | | } |
| | | } |
| | | |
| | | function getStatusStyle(item: any) { |
| | | var data = reactive({}); |
| | | if (item.IS_ACTIVE == 'Y') { |
| | | data = reactive({ |
| | | 'overflow-wrap': 'break-word', |
| | | 'text-align': 'center', |
| | | 'word-break': 'break-word', |
| | | 'vertical-align': 'middle', |
| | | 'border-width': 'medium', |
| | | 'border-color': 'white', |
| | | width: '80px', |
| | | display: 'table-cell', |
| | | color: 'white', |
| | | height: '100px', |
| | | 'background-color': '#7CCD7C', |
| | | padding: '2px', |
| | | 'margin-top': '4px', |
| | | }); |
| | | } else if (item.IS_ACTIVE == 'N') { |
| | | data = reactive({ |
| | | 'overflow-wrap': 'break-word', |
| | | 'text-align': 'center', |
| | | 'word-break': 'break-word', |
| | | 'vertical-align': 'middle', |
| | | 'border-width': 'medium', |
| | | 'border-color': 'white', |
| | | width: '80px', |
| | | color: 'white', |
| | | display: 'table-cell', |
| | | height: '100px', |
| | | 'background-color': ' #FF4040', |
| | | padding: '2px', |
| | | 'margin-top': '4px', |
| | | }); |
| | | } else { |
| | | data = reactive({ |
| | | 'overflow-wrap': 'break-word', |
| | | 'text-align': 'center', |
| | | 'word-break': 'break-word', |
| | | 'vertical-align': 'middle', |
| | | 'border-width': 'medium', |
| | | 'border-color': 'white', |
| | | width: '80px', |
| | | display: 'table-cell', |
| | | height: '100px', |
| | | 'background-color': 'rgb(154, 191, 219)', |
| | | padding: '2px', |
| | | 'margin-top': '4px', |
| | | }); |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | |
| | | return { |
| | | t, |
| | | cen, |
| | | lie, |
| | | getStatusStyle, |
| | | generate, |
| | | divWidth, |
| | | location_code, |
| | | location_xuhao, |
| | | location, |
| | | register, |
| | | schemas, |
| | | Rule, |
| | | weishu, |
| | | handleSubmit, |
| | | handleClick, |
| | | handleCreatelocation, |
| | | getFormValues, |
| | | setFormValues, |
| | | validateForm, |
| | | resetValidate, |
| | | resetFields, |
| | | registerLocation, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | <style> |
| | | .location_lie_jingyong { |
| | | overflow-wrap: break-word; |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | border-width: medium; |
| | | border-color: white; |
| | | width: 80px; |
| | | display: table-cell; |
| | | height: 100px; |
| | | background-color: rgb(154, 191, 219); |
| | | padding: 2px; |
| | | margin-top: 4px; |
| | | } |
| | | .location_lie_jingyong { |
| | | display: table-cell; |
| | | width: 80px; |
| | | height: 100px; |
| | | margin-top: 4px; |
| | | padding: 2px; |
| | | border-width: medium; |
| | | border-color: white; |
| | | background-color: rgb(154 191 219); |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | overflow-wrap: break-word; |
| | | } |
| | | |
| | | .location_lie_qiyong { |
| | | overflow-wrap: break-word; |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | border-width: medium; |
| | | border-color: white; |
| | | width: 80px; |
| | | display: table-cell; |
| | | height: 100px; |
| | | background-color: rgb(120, 228, 138); |
| | | padding: 2px; |
| | | margin-top: 4px; |
| | | } |
| | | .location_lie_qiyong { |
| | | display: table-cell; |
| | | width: 80px; |
| | | height: 100px; |
| | | margin-top: 4px; |
| | | padding: 2px; |
| | | border-width: medium; |
| | | border-color: white; |
| | | background-color: rgb(120 228 138); |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | overflow-wrap: break-word; |
| | | } |
| | | |
| | | .location_lie_init { |
| | | overflow-wrap: break-word; |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | border-width: medium; |
| | | border-color: white; |
| | | width: 80px; |
| | | display: table-cell; |
| | | height: 100px; |
| | | background-color: rgb(154, 191, 219); |
| | | padding: 2px; |
| | | margin-top: 4px; |
| | | } |
| | | .location_lie_init { |
| | | display: table-cell; |
| | | width: 80px; |
| | | height: 100px; |
| | | margin-top: 4px; |
| | | padding: 2px; |
| | | border-width: medium; |
| | | border-color: white; |
| | | background-color: rgb(154 191 219); |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | overflow-wrap: break-word; |
| | | } |
| | | |
| | | .censhu { |
| | | width: 60px; |
| | | display: table-cell; |
| | | height: 100px; |
| | | margin-left: 2px; |
| | | text-align: center; |
| | | overflow-wrap: break-word; |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | border-width: medium; |
| | | border-color: white; |
| | | } |
| | | .censhu { |
| | | display: table-cell; |
| | | width: 60px; |
| | | height: 100px; |
| | | margin-left: 2px; |
| | | border-width: medium; |
| | | border-color: white; |
| | | text-align: center; |
| | | word-break: break-word; |
| | | vertical-align: middle; |
| | | overflow-wrap: break-word; |
| | | } |
| | | </style> |