123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949 |
- <template>
- <LjDetail
- name="rpMustPayCrmDetail"
- ref="LjDetailRef"
- v-bind="detailProps"
- :request-api="getData"
- :data-callback="dataCallback"
- :init-param="initParams"
- v-model:order-status="orderStatus"
- :action="orderDefaultAction"
- @after-mounted="funcAfterMound"
- :if-layout-editable="false"
- :default-columns-value="defaultColumnsValue"
- >
- <template #rightBtn="scope">
- <el-space warp>
- <el-checkbox
- v-model="isShowOriginFormulaMattress"
- v-if="CheckPower(131)"
- label="显示旧公式"
- size="small"
- @change="showOriginFormulaMattress"
- />
- <el-select v-model="scope.data.dannum_type" placeholder="大小单" style="width: 80px">
- <el-option label="散单" :value="1" />
- <el-option label="小单" :value="4" />
- <el-option label="标准" :value="2" />
- <el-option label="大单" :value="3" />
- </el-select>
- </el-space>
- </template>
- <template #headerSuffix>
- <Statistic
- :data="cmpFormulaReplace"
- :differ="cmpDiffer"
- :iforigin="isShowOriginFormulaMattress"
- :precision="2"
- @click="gotoShowFormula"
- />
- </template>
- <!-- @to-pin-detail="emit('toPinDetail')" -->
- <template #fabricMx__tabtitle="scope">
- <template v-if="isTabsBadge_fabric_error">
- <el-badge :value="isTabsBadge_fabric_error + '异常'" type="danger">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template v-else>
- <el-badge :value="isTabsBadge_fabric" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- </template>
- <template #fabricMx>
- <el-tabs v-model="fabricMxTabs" type="card" class="h-full flx-col fabric-mx-tabs" @tab-click="SetCurrentTabs">
- <el-tab-pane
- class="h-full flx"
- label="裥面"
- name="tabpage_8"
- v-if="mattresstypeEnum && Number(mattresstypeEnum?.if_top_side) == 1"
- >
- <template #label>
- <template v-if="isFilterErrorBadge(fabricMxTab8)">
- <el-badge :value="isFilterErrorBadge(fabricMxTab8) + '异常'" type="danger"> 裥面 </el-badge>
- </template>
- <template v-else>
- <el-badge
- :value="isFilterSucessBadge(fabricMxTab8)"
- type="primary"
- :show-zero="false"
- :color="_variables.colorPrimary200"
- >
- 裥面
- </el-badge>
- </template>
- </template>
- <LjVxeTable
- ref="fabricMxTab8Ref"
- row-key="key"
- table-cls="h-full"
- :data="fabricMxTab8"
- :columns="columnsMx"
- :dwname="DwnameEnum.mattressQuoteMx"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- :request-auto="false"
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'fabricMxTab8Ref')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'fabricMxTab8Ref')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </el-tab-pane>
- <el-tab-pane
- class="h-full flx"
- label="裥底"
- name="tabpage_9"
- v-if="mattresstypeEnum && Number(mattresstypeEnum.if_button_sdie) == 1"
- >
- <template #label>
- <template v-if="isFilterErrorBadge(fabricMxTab9)">
- <el-badge :value="isFilterErrorBadge(fabricMxTab9) + '异常'" type="danger"> 裥底 </el-badge>
- </template>
- <template v-else>
- <el-badge
- :value="isFilterSucessBadge(fabricMxTab9)"
- type="primary"
- :show-zero="false"
- :color="_variables.colorPrimary200"
- >
- 裥底
- </el-badge>
- </template>
- </template>
- <LjVxeTable
- ref="fabricMxTab9Ref"
- row-key="key"
- table-cls="h-full"
- :data="fabricMxTab9"
- :columns="columnsMx"
- :dwname="DwnameEnum.mattressQuoteMx"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'fabricMxTab9Ref')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'fabricMxTab9Ref')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </el-tab-pane>
- <el-tab-pane
- class="h-full flx"
- label="裥大恻"
- name="tabpage_10"
- v-if="mattresstypeEnum && Number(mattresstypeEnum.if_big_side) == 1"
- >
- <template #label>
- <template v-if="isFilterErrorBadge(fabricMxTab10)">
- <el-badge :value="isFilterErrorBadge(fabricMxTab10) + '异常'" type="danger"> 裥大恻 </el-badge>
- </template>
- <template v-else>
- <el-badge
- :value="isFilterSucessBadge(fabricMxTab10)"
- type="primary"
- :show-zero="false"
- :color="_variables.colorPrimary200"
- >
- 裥大恻
- </el-badge>
- </template>
- </template>
- <LjVxeTable
- ref="fabricMxTab10Ref"
- row-key="key"
- table-cls="h-full"
- :data="fabricMxTab10"
- :columns="columnsMx"
- :dwname="DwnameEnum.mattressQuoteMx"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-dropdown placement="bottom-start" @command="val => handleSelFabricMxNewMtrlGroup('tabpage_10', val)">
- <el-button type="primary">
- {{ t("business.detail.addChastr") }}<el-icon class="el-icon--right"><ArrowDown /></el-icon>
- </el-button>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item v-for="item in fabricMx10NewMtrlGroup" :key="item.value" :command="item">{{
- item.label
- }}</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- <el-button type="danger" @click="handleDelFabricMxNewMtrlGroup('tabpage_10')">{{
- t("business.detail.delChastr")
- }}</el-button>
- </el-space>
- <el-divider direction="vertical" />
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'fabricMxTab10Ref')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'fabricMxTab10Ref')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </el-tab-pane>
- <el-tab-pane
- class="h-full flx"
- label="裥小恻"
- name="tabpage_11"
- v-if="mattresstypeEnum && Number(mattresstypeEnum.if_small_side) == 1"
- >
- <template #label>
- <template v-if="isFilterErrorBadge(fabricMxTab11)">
- <el-badge :value="isFilterErrorBadge(fabricMxTab11) + '异常'" type="danger"> 裥小恻 </el-badge>
- </template>
- <template v-else>
- <el-badge
- :value="isFilterSucessBadge(fabricMxTab11)"
- type="primary"
- :show-zero="false"
- :color="_variables.colorPrimary200"
- >
- 裥小恻
- </el-badge>
- </template>
- </template>
- <LjVxeTable
- ref="fabricMxTab11Ref"
- row-key="key"
- table-cls="h-full"
- :data="fabricMxTab11"
- :columns="columnsMx"
- :dwname="DwnameEnum.mattressQuoteMx"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-dropdown placement="bottom-start" @command="val => handleSelFabricMxNewMtrlGroup('tabpage_11', val)">
- <el-button type="primary">
- {{ t("business.detail.addChastr") }}<el-icon class="el-icon--right"><ArrowDown /></el-icon>
- </el-button>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item v-for="item in fabricMx11NewMtrlGroup" :key="item.value" :command="item">{{
- item.label
- }}</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- <el-button type="danger" @click="handleDelFabricMxNewMtrlGroup('tabpage_10')">{{
- t("business.detail.delChastr")
- }}</el-button>
- </el-space>
- <el-divider direction="vertical" />
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'fabricMxTab11Ref')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'fabricMxTab11Ref')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </el-tab-pane>
- <el-tab-pane
- class="h-full flx"
- label="裥V恻"
- name="tabpage_12"
- v-if="mattresstypeEnum && Number(mattresstypeEnum.if_v_side) == 1"
- >
- <template #label>
- <template v-if="isFilterErrorBadge(fabricMxTab12)">
- <el-badge :value="isFilterErrorBadge(fabricMxTab12) + '异常'" type="danger"> 裥V恻 </el-badge>
- </template>
- <template v-else>
- <el-badge
- :value="isFilterSucessBadge(fabricMxTab12)"
- type="primary"
- :show-zero="false"
- :color="_variables.colorPrimary200"
- >
- 裥V恻
- </el-badge>
- </template>
- </template>
- <LjVxeTable
- ref="fabricMxTab12Ref"
- row-key="key"
- table-cls="h-full"
- :data="fabricMxTab12"
- :columns="columnsMx"
- :dwname="DwnameEnum.mattressQuoteMx"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'fabricMxTab12Ref')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'fabricMxTab12Ref')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </el-tab-pane>
- <el-tab-pane class="h-full flx" label="拉手刺绣及其他工艺" name="tabpage_13">
- <template #label>
- <template v-if="isFilterErrorBadge(fabricMxTab13)">
- <el-badge :value="isFilterErrorBadge(fabricMxTab13) + '异常'" type="danger"> 拉手刺绣及其他工艺 </el-badge>
- </template>
- <template v-else>
- <el-badge
- :value="isFilterSucessBadge(fabricMxTab13)"
- type="primary"
- :show-zero="false"
- :color="_variables.colorPrimary200"
- >
- 拉手刺绣及其他工艺
- </el-badge>
- </template>
- </template>
- <LjVxeTable
- ref="fabricMxTab13Ref"
- row-key="key"
- table-cls="h-full"
- :data="fabricMxTab13"
- :columns="columnsMx"
- :dwname="DwnameEnum.mattressQuoteMx"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'fabricMxTab13Ref')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'fabricMxTab13Ref')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </el-tab-pane>
- </el-tabs>
- </template>
- <template #bednetMx__tabtitle="scope">
- <template v-if="isTabsBadge_bednet_error">
- <el-badge :value="isTabsBadge_bednet_error + '异常'" type="danger">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template v-else>
- <el-badge :value="isTabsBadge_bednet" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- </template>
- <template #bednetMx>
- <LjVxeTable
- ref="bednetMxRef"
- row-key="key"
- table-cls="h-full"
- :data="bednetMxData"
- :columns="columnsMxBednet"
- :dwname="DwnameEnum.mattressQuoteMxBednet"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- @cell-dblclick="handleCellDblClick_bednet"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="primary" @click="handleAddBednetMx">{{ t("common.add") }}</el-button>
- <el-button type="danger" @click="handleEditBednetMx">{{ t("common.editText") }}</el-button>
- </el-space>
- <el-divider direction="vertical" />
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'bednetMxRef')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'bednetMxRef')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- <template #cushionsMx__tabtitle="scope">
- <template v-if="isTabsBadge_cushions_error">
- <el-badge :value="isTabsBadge_cushions_error + '异常'" type="danger">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template v-else>
- <el-badge :value="isTabsBadge_cushions" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- </template>
- <template #cushionsMx>
- <LjVxeTable
- ref="cushionsMxRef"
- row-key="key"
- table-cls="h-full"
- :data="cushionsMxData"
- :columns="columnsMxCushions"
- :dwname="DwnameEnum.mattressQuoteMxCushions"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="primary" @click="toAddMx_cushions(0)">{{ t("common.addText") }}</el-button>
- <el-button type="primary" @click="toAddMx_cushions(1)">{{ t("common.insert") }}</el-button>
- <el-button type="danger" @click="toDelMx_cushions">{{ t("common.delText") }}</el-button>
- </el-space>
- <el-divider direction="vertical" />
- <el-space wrap>
- <el-button type="default" @click="toMove(1, 'cushionsMxRef')">{{ t("common.moveUp") }}</el-button>
- <el-button type="default" @click="toMove(-1, 'cushionsMxRef')">{{ t("common.moveDown") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- <template #accessoriesMx__tabtitle="scope">
- <template v-if="isTabsBadge_accessories_error">
- <el-badge :value="isTabsBadge_accessories_error + '异常'" type="danger">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template v-else>
- <el-badge :value="isTabsBadge_accessories" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- </template>
- <template #accessoriesMx>
- <LjVxeTable
- ref="accessoriesMxRef"
- row-key="key"
- table-cls="h-full"
- :data="accessoriesMxData"
- :columns="columnsMxAccessories"
- :dwname="DwnameEnum.mattressQuoteMxAccessories"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <!-- <template #tableHeader>
- <el-space wrap>
- <el-button type="primary">{{ $t("common.addText") }}</el-button>
- <el-button type="danger">{{ $t("common.delText") }}</el-button>
- </el-space>
- </template> -->
- </LjVxeTable>
- </template>
- <template #packagMx__tabtitle="scope">
- <template v-if="isTabsBadge_packag_error">
- <el-badge :value="isTabsBadge_packag_error + '异常'" type="danger">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template v-else>
- <el-badge :value="isTabsBadge_packag" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- </template>
- <template #packagMx="scope">
- <LjVxeTable
- ref="packagMxRef"
- row-key="key"
- table-cls="h-full"
- :data="packagMxData"
- :columns="columnsMxPackag"
- :dwname="DwnameEnum.mattressQuoteMxPackag"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :request-auto="false"
- :auto-load-layout="false"
- collapseButtons
- :extra-loading="mxLoading"
- :footer-method="footerMethod"
- >
- <template #tableHeader>
- <el-space wrap>
- <el-form label-width="70px" inline :disabled="!orderStatus">
- <el-form-item label="包装方式">
- <el-select v-model="scope.data.packtype" style="width: 120px" @change="funcPacktypeChange">
- <el-option v-for="item in packtypeOptions" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item label="卷包直径" v-if="scope.data.packtype == 1">
- <el-input-number v-model="scope.data.diameter" :min="0" :max="1000" />CM
- </el-form-item>
- <el-form-item label="木托方式" v-if="scope.data.packtype == 0">
- <el-select v-model="scope.data.woodpallettype" style="width: 120px">
- <el-option v-for="item in woodpallettypeOptions" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item label="压包数量" v-if="scope.data.packtype == 0">
- <el-input-number v-model="scope.data.packqty" :min="0" :max="1000" />
- </el-form-item>
- <el-form-item label="地区">
- <el-select v-model="scope.data.area" style="width: 120px" clearable>
- <el-option v-for="item in areaOptions" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item label="柜型">
- <el-select v-model="scope.data.cabinet_type" style="width: 120px" clearable>
- <el-option v-for="item in cabinetTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item label="体积">
- <el-input-number v-model="scope.data.cubage" :min="0" :max="1000" />
- </el-form-item>
- </el-form>
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- <template #innerClothLayerMx__tabtitle="scope">
- <template v-if="innerClothLayerNum_error">
- <el-badge :value="innerClothLayerNum_error + '异常'" type="danger">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template v-else>
- <el-badge :value="innerClothLayerNum" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- </template>
- <template #innerClothLayerMx>
- <LjVxeTable
- ref="innerClothLayerMxRef"
- row-key="key"
- table-cls="h-full"
- :request-api="getData_innerClothLayer"
- :data-callback="dataCallbackMx"
- :init-param="initParams"
- :columns="columnsMxInnerClothLayer"
- :dwname="DwnameEnum.mattressQuoteMxInnerClothLayer"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- :footer-method="footerMethod"
- @after-mounted="resetMergeCellsInner"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="primary" @click="handleToImportMxInner">{{ t("business.detail.importMx") }}</el-button>
- <el-button type="danger" @click="hanleDelMxInner(0)">{{ t("business.detail.deleteMx") }}</el-button>
- <el-button type="danger" @click="hanleDelMxInner(1)">{{ t("business.detail.deleteAllMx") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- <template #topCottonMx__tabtitle="scope">
- <template v-if="topCottonNum_error">
- <el-badge :value="topCottonNum_error + '异常'" type="danger">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template v-else>
- <el-badge :value="topCottonNum" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- </template>
- <template #topCottonMx>
- <LjVxeTable
- ref="topCottonMxRef"
- row-key="key"
- table-cls="h-full"
- :request-api="getData_topCotton"
- :data-callback="dataCallbackMx"
- :init-param="initParams"
- :columns="columnsMx"
- :dwname="DwnameEnum.mattressQuoteMx"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- :footer-method="footerMethod"
- @after-mounted="resetMergeCellsTopCotton"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-dropdown placement="bottom-start" @command="wf_add_w_butao">
- <el-button type="primary">
- {{ t("common.addText") }}<el-icon class="el-icon--right"><ArrowDown /></el-icon>
- </el-button>
- <template #dropdown>
- <el-dropdown-menu>
- <el-dropdown-item v-for="item in topCottonAddList" :key="item.value" :command="item">{{
- item.label
- }}</el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- <el-button type="danger" @click="wf_del_w_butao">{{ t("common.delText") }}</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- <template #specialProcesses__tabtitle="scope">
- <el-badge :value="specialProcessesNum" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template #specialProcesses>
- <LjVxeTable
- ref="specialProcessesMxRef"
- row-key="key"
- table-cls="h-full"
- :request-api="getData_specialProcesses"
- :data-callback="dataCallbackMx"
- :init-param="initParams"
- :columns="columnsMx_processes"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- :footer-sum-attrs="['price']"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="primary" @click="funcAddMtrlMx({}, null, 'specialProcessesMxRef', -1)">
- {{ t("common.addText") }}
- </el-button>
- <!-- <el-button type="danger" @click="funcDelMtrlMx()">{{ t("common.delText") }}</el-button> -->
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- <template #additionalCosts__tabtitle="scope">
- <el-badge :value="additionalCostsNum" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template #additionalCosts>
- <LjVxeTable
- ref="additionalCostsMxRef"
- row-key="key"
- table-cls="h-full"
- :request-api="getData_additionalCosts"
- :data-callback="dataCallbackMx"
- :init-param="initParams"
- :columns="columnsMx_additional"
- :table-props="tableProps_mx"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- :footer-sum-attrs="['price']"
- >
- <template #tableHeader v-if="orderStatus">
- <el-space wrap>
- <el-button type="primary" @click="funcAddMtrlMx({}, null, 'additionalCostsMxRef', -1)">
- {{ t("common.addText") }}
- </el-button>
- <!-- <el-button type="danger" @click="wf_del_w_butao">{{ t("common.delText") }}</el-button> -->
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- <template #subSpecs__tabtitle="scope">
- <template v-if="LjDetailRef._mainData.parentid > 0">
- <el-badge value="副" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <el-badge v-else :value="subSpecsNum" type="primary" :show-zero="false">
- {{ scope.props.label }}
- </el-badge>
- </template>
- <template #subSpecs>
- <LjVxeTable
- ref="subSpecsRef"
- row-key="key"
- table-cls="h-full"
- :request-auto="false"
- :request-api="getData_subSpecs"
- :data-callback="dataCallbackMx"
- :init-param="initParams"
- :columns="columnsMx_subSpecs"
- :dwname="DwnameEnum.mattressQuoteSubspecs"
- :table-props="tableProps_subSpecs"
- :table-events="tableEvents"
- :tool-button="[]"
- :auto-load-layout="false"
- collapseButtons
- >
- <template #tableHeader>
- <el-space wrap v-if="orderStatus">
- <el-button type="primary" @click="toAddMx_subSpecs">{{ t("common.addText") }}</el-button>
- <el-button type="danger" @click="toDelMx_subSpecs">{{ t("common.delText") }}</el-button>
- </el-space>
- <el-space wrap v-else-if="!LjDetailRef._mainData.parentid && Number(LjDetailRef._mainData.flag) == 1">
- <template v-if="!editSubSpecs">
- <el-button type="primary" @click="toEdit_subSpecs">{{ t("common.editText") }}</el-button>
- </template>
- <template v-else>
- <el-button type="primary" @click="toAddMx_subSpecs">{{ t("common.addText") }}</el-button>
- <el-button type="danger" @click="toDelMx_subSpecs">{{ t("common.delText") }}</el-button>
- <el-divider direction="vertical" />
- <el-button type="success" @click="toSave_subSpecs">{{ t("common.saveText") }}</el-button>
- <el-button type="default" @click="toCancel_subSpecs">{{ t("common.cancelText") }}</el-button>
- </template>
- </el-space>
- <el-space wrap v-if="LjDetailRef._mainData.parentid > 0">
- <el-button type="primary" @click="gotoMainMattress">查看主规格</el-button>
- </el-space>
- </template>
- </LjVxeTable>
- </template>
- </LjDetail>
- <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" />
- <BednetDialog ref="BednetDialogRef" v-bind="BednetDialogProps" />
- <LjDrawerQuoteList ref="QuoteListDrawerRef" :iforigin="isShowOriginFormulaMattress" />
- <AllFormula ref="AllFormulaRef" :iforigin="isShowOriginFormulaMattress" />
- <LjDrawer ref="LjDrawerRef" class="lj-drawer-win" size="80%" direction="btt" :title="drawerTitle">
- <BednetDetail
- :mattress-width="LjDetailRef._mainData.mattress_width"
- :mattress-length="LjDetailRef._mainData.mattress_length"
- v-bind="bednetDrawerProps"
- @aftersave="autoBednetSave"
- @aftercancel="LjDrawerRef.hide()"
- />
- </LjDrawer>
- </template>
- <script setup lang="ts" name="mattressQuoteEdit">
- import { ref, watch, reactive, inject, nextTick, computed, onMounted, getCurrentInstance } from "vue";
- import { DwnameEnum } from "@/enums/dwnameEnum";
- import LjDetail from "@/components/LjDetail/index.vue";
- import { DetailProp } from "@/components/LjDetail/interface";
- import { useI18n } from "vue-i18n";
- import { useHooks } from "./hooks/index";
- import { useHooksCpQuote } from "./hooks/cpQuote";
- import { useAuthButtons } from "@/hooks/useAuthButtons";
- import LjVxeTable from "@/components/LjVxeTable/index.vue";
- import { cloneDeep } from "lodash-es";
- import { useRoute, useRouter } from "vue-router";
- import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
- import { SaveMattress, SaveMattressAuditing, DelMattress, GetMattressImportDW2 } from "@/api/modules/quote";
- // import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
- import { TYPE, useToast, POSITION } from "vue-toastification";
- import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
- import { ArrowDown } from "@element-plus/icons-vue";
- // import { calculateFormula } from "@/utils/index";
- import MtrldefDialog from "@/views/system/selector/mtrldef/index.vue";
- import BednetDialog from "@/views/system/selector/bednet/index.vue";
- // import LjDrawerQuoteList from "./components/QuoteList.vue";
- import LjDrawerQuoteList from "./components/QuoteListNew.vue";
- import mittBus from "@/utils/mittBus";
- import { MittEnum } from "@/enums/mittEnum";
- import { getCurrentRecords, floatAdd, floatMul, text2Formula } from "@/utils/index";
- import { useUserStore } from "@/stores/modules/user";
- import AllFormula from "./components/AllFormula.vue";
- import LjDrawer from "@/components/LjDrawer/index.vue";
- import BednetDetail from "@/views/quote/bednetQuote/detail.vue";
- import Statistic from "./components/Statistic.vue";
- import variables from "@/styles/js.module.scss";
- import { useGlobalStore } from "@/stores/modules/global";
- // interface detailProp {
- // // /**
- // // * @argument any 页面数据
- // // */
- // // data1?: any;
- // // /**
- // // * @argument string 请求数据的api ==> 非必传
- // // */
- // // requestApi?: (params: any) => Promise<any>;
- // // /**
- // // * @argument any 基础信息,表格展示数据
- // // */
- // // // columns?: any;
- // // /**
- // // * @description 是否可编辑
- // // */
- // // status: "edit" | "new" | string;
- // }
- // const props = withDefaults(defineProps<detailProp>(), {});
- const { t } = useI18n();
- const route = useRoute();
- const router = useRouter();
- const globalStore = useGlobalStore();
- // const { isShowOriginFormulaMattress } = storeToRefs(globalStore);
- const showOriginFormulaMattress = (value: any) => {
- globalStore.setGlobalState("isShowOriginFormulaMattress", Boolean(value));
- // 刷新页面
- router.go(0);
- // LjDetailRef.value.refresh();
- };
- const _variables: any = variables;
- const {
- columns,
- columnsMx,
- columnsMxBednet,
- columnsMxCushions,
- columnsMxAccessories,
- columnsMxPackag,
- columnsMxInnerClothLayer,
- columnsMx_processes,
- columnsMx_additional,
- LjDetailRef,
- MtrldefDialogRef,
- MtrldefDialogProps,
- BednetDialogRef,
- BednetDialogProps,
- fabricMxTabList,
- mattresstypeEnum,
- fabricMxTabs,
- fabricMxTab8Ref,
- fabricMxTab9Ref,
- fabricMxTab10Ref,
- fabricMxTab11Ref,
- fabricMxTab12Ref,
- fabricMxTab13Ref,
- fabricMxTab8,
- fabricMxTab9,
- fabricMxTab10,
- fabricMxTab11,
- fabricMxTab12,
- fabricMxTab13,
- fabricMx10NewMtrlGroup,
- fabricMx11NewMtrlGroup,
- initParams,
- cushionsMxData,
- fabricMxData,
- accessoriesMxData,
- bednetMxData,
- packagMxData,
- oriMxData,
- orderStatus,
- showFormula,
- QuoteListDrawerRef,
- formulaKindEnum,
- bednetMxRef,
- cushionsMxRef,
- accessoriesMxRef,
- packagMxRef,
- innerClothLayerMxRef,
- topCottonMxRef,
- packtypeOptions,
- woodpallettypeOptions,
- areaOptions,
- cabinetTypeOptions,
- topCottonAddList,
- AllFormulaRef,
- LjDrawerRef,
- cmpFormulas,
- cmpFormulaReplace,
- cmpFormulasOri,
- cmpFormulasBednet,
- cmpDiffer,
- subSpecsRef,
- columnsMx_subSpecs,
- diancengAreaEnum,
- specialProcessesMxRef,
- additionalCostsMxRef,
- specialProcessesMxData,
- additionalCostsMxData,
- specialProcessesMxInitData,
- additionalCostsMxInitData,
- specialProcessesEnum,
- additionalCostsEnum,
- isShowOriginFormulaMattress,
- funcAddMxSide,
- funcChaifenTab,
- getData_mx,
- dataCallback,
- dataCallbackMx,
- getMattressType,
- gotoSummy,
- gotoHisprice,
- getFormulakindEnum,
- funcPacktypeChange,
- dynamicRef,
- wf_cmp_cb,
- handleToImportMxInner,
- hanleDelMxInner,
- wf_add_w_butao,
- wf_del_w_butao,
- w_mattress_add_itemname_choose,
- wf_rtr_bednet,
- funcAddMtrlMx,
- resetMergeCellsInner,
- resetMergeCellsTopCotton,
- wf_rtr_cwdc,
- resetSpecialProcesses
- } = useHooks(t);
- const { toExcelQuote } = useHooksCpQuote();
- const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
- const { userInfo } = useUserStore();
- // const toast = useToast();
- // const orderStatus = ref("");
- // const mainData = ref([]);
- const tabRemove: Function = inject("tabRemove") as Function;
- const defaultColumnsValue = ref<any>({});
- const mxLoading = ref(false);
- const drawerTitle = ref("");
- const bednetDrawerProps = reactive({
- bednetid: 0,
- state: "",
- deptid: 0,
- onlyView: false
- });
- const footerMethod = ({ columns, data }: any) => {
- // 返回一个二维数组的表尾合计
- return [
- columns.map((column: any, columnIndex: number) => {
- if (columnIndex === 0) {
- return "合计";
- }
- if (columnIndex === 1) {
- return data.length;
- }
- // if ((column.field && column.field.indexOf("qty") > -1) || props.footerSumAttrs?.includes(column.field)) {
- if ((column.field && column.field.indexOf("qty") > -1) || (column.field && column.field.indexOf("amt") > -1)) {
- let count = 0;
- data.forEach((item: any) => {
- count = floatAdd(count, isNaN(Number(item[column.field])) ? 0 : Number(item[column.field]));
- });
- return count;
- } else if (column.field && column.field.indexOf("dannum") > -1) {
- let count = 0;
- data.forEach((item: any) => {
- count = floatAdd(count, floatMul(Number(item.costamt), 1 + item[column.field]));
- });
- return count;
- }
- })
- ];
- };
- /**
- * @description 明细表格组件基础配置
- */
- const tableProps_mx = ref({
- height: "auto",
- align: "left",
- // height: "",
- minHeight: "100px",
- editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
- // exportConfig: {
- // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
- // }
- editRules: {
- mattress_width: [
- {
- validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
- const { _mainData } = LjDetailRef.value;
- let _value = Number(cellValue);
- if (_value < 0) {
- return new Error("不能小于0");
- }
- if (!isNaN(_value) && _value > Number(_mainData.mattress_width)) {
- return new Error("不能大于床垫尺寸");
- }
- return true;
- }
- }
- ],
- mattress_length: [
- {
- validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
- const { _mainData } = LjDetailRef.value;
- let _value = Number(cellValue);
- if (_value < 0) {
- return new Error("不能小于0");
- }
- if (!isNaN(_value) && _value > Number(_mainData.mattress_length)) {
- return new Error("不能大于床垫尺寸");
- }
- return true;
- }
- }
- ]
- },
- keyboardConfig: {
- isEdit: true,
- isArrow: true,
- isEnter: true,
- isTab: true,
- isDel: true,
- isBack: true,
- isEsc: true,
- editMethod({ $table, row, column }) {
- // 先清空原先的值
- row[column.field] = "";
- // 再激活编辑状态并输入新值
- $table.setEditCell(row, column);
- }
- },
- mouseConfig: {
- selected: true
- }
- });
- // const tableEventsMx = {
- // "edit-activated": ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) => {
- // console.log("thickness row editDisabled:>> ", row.if_inputqty, row.formulakind);
- // if (column.field === "thickness") {
- // return !(
- // (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
- // row.formulakind == 7 ||
- // row.formulakind == 202
- // );
- // }
- // },
- // "edit-disabled": ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) => {
- // console.log("thickness row editDisabled:>> ", row.if_inputqty, row.formulakind);
- // if (column.field === "thickness") {
- // return !(
- // (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
- // row.formulakind == 7 ||
- // row.formulakind == 202
- // );
- // }
- // }
- // };
- const tableProps_subSpecs = ref({
- height: "auto",
- align: "left",
- // height: "",
- minHeight: "100px",
- editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
- // exportConfig: {
- // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
- // }
- keyboardConfig: {
- isEdit: true,
- isArrow: true,
- isEnter: true,
- isTab: true,
- isDel: true,
- isBack: true,
- isEsc: true,
- editMethod({ $table, row, column }) {
- // 先清空原先的值
- row[column.field] = "";
- // 再激活编辑状态并输入新值
- $table.setEditCell(row, column);
- }
- },
- mouseConfig: {
- selected: true
- }
- });
- // const keyboardConfig = ref<any>({
- // isEdit: true,
- // isArrow: true,
- // isEnter: true,
- // isTab: true,
- // isDel: true,
- // isBack: true,
- // isEsc: true,
- // editMethod({ $table, row, column }) {
- // // 先清空原先的值
- // row[column.field] = "";
- // // 再激活编辑状态并输入新值
- // $table.setEditCell(row, column);
- // }
- // });
- const isTabsBadge_packag = computed(() => {
- let arr = [];
- arr = packagMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- return arr.length;
- });
- const isTabsBadge_packag_error = computed(() => {
- let arr = [];
- arr = packagMxData.value.filter(t => Number(t.if_success));
- return arr.length;
- });
- const isTabsBadge_cushions = computed(() => {
- let arr = [];
- arr = cushionsMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- return arr.length;
- });
- const isTabsBadge_cushions_error = computed(() => {
- let arr = [];
- console.log("isTabsBadge_cushions_error cushionsMxData.value:>> ", cushionsMxData.value);
- arr = cushionsMxData.value.filter(t => Number(t.if_success));
- return arr.length;
- });
- const isTabsBadge_accessories = computed(() => {
- let arr = [];
- arr = accessoriesMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- return arr.length;
- });
- const isTabsBadge_accessories_error = computed(() => {
- let arr = [];
- arr = accessoriesMxData.value.filter(t => Number(t.if_success));
- return arr.length;
- });
- const isTabsBadge_bednet = computed(() => {
- let arr = [];
- const $table = bednetMxRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- }
- return arr.length;
- });
- const isTabsBadge_bednet_error = computed(() => {
- let arr = [];
- arr = bednetMxData.value.filter(t => Number(t.if_success));
- return arr.length;
- });
- const isTabsBadge_fabric = computed(() => {
- let arr = [];
- arr = fabricMxTab8.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- arr = arr.concat(fabricMxTab9.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
- arr = arr.concat(fabricMxTab10.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
- arr = arr.concat(fabricMxTab11.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
- arr = arr.concat(fabricMxTab12.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
- arr = arr.concat(fabricMxTab13.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
- console.log("isTabsBadge_fabric arr :>> ", arr);
- return arr.length;
- });
- const isTabsBadge_fabric_error = computed(() => {
- let arr = [];
- arr = fabricMxTab8.value.filter(t => Number(t.if_success));
- arr = arr.concat(fabricMxTab9.value.filter(t => Number(t.if_success)));
- arr = arr.concat(fabricMxTab10.value.filter(t => Number(t.if_success)));
- arr = arr.concat(fabricMxTab11.value.filter(t => Number(t.if_success)));
- arr = arr.concat(fabricMxTab12.value.filter(t => Number(t.if_success)));
- arr = arr.concat(fabricMxTab13.value.filter(t => Number(t.if_success)));
- return arr.length;
- });
- const isFilterErrorBadge = data => {
- let arr = [];
- arr = data.filter(t => Number(t.if_success));
- return arr.length;
- };
- const isFilterSucessBadge = data => {
- let arr = [];
- arr = data.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- return arr.length;
- };
- const isQuoteListMxData = computed(() => {
- return [
- {
- label: "面裥绵",
- field: "tabpage_8",
- replace: "面裥绵-",
- data: fabricMxTab8.value
- },
- {
- label: "底裥绵",
- field: "tabpage_9",
- replace: "底裥绵-",
- data: fabricMxTab9.value
- },
- {
- label: "裥大侧",
- field: "tabpage_10",
- replace: "大侧裥绵-",
- data: fabricMxTab10.value
- },
- {
- label: "裥小侧",
- field: "tabpage_11",
- replace: "小侧裥绵-",
- data: fabricMxTab11.value
- },
- {
- label: "裥V侧",
- field: "tabpage_12",
- replace: "V侧裥绵-",
- data: fabricMxTab12.value
- },
- {
- label: "其他工艺",
- field: "tabpage_13",
- replace: "V侧裥绵-",
- data: fabricMxTab13.value
- },
- {
- label: "垫层",
- field: "cushions",
- data: {
- cushions: cushionsMxData.value,
- bednet: bednetMxData.value
- }
- },
- {
- label: "辅料",
- field: "accessories",
- data: accessoriesMxData.value
- },
- {
- label: "包装",
- field: "packag",
- data: packagMxData.value
- }
- ];
- });
- /**
- * @description tab 面料
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- // /**
- // * @description 面料数据
- // */
- // const fabricMxData = ref([]);
- // const fabricMxTabData = ref([]);
- // const fabricMxTabs = ref("fabricMx");
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description tab 床网
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- // /**
- // * @description 床网数据
- // */
- // const bednetMxData = ref([]);
- // const getData_cushions = (params: any) => {
- // console.log("getData params :>> ", params);
- // let newParams: any = {};
- // params.pageNum && (newParams.pageindex = params.pageNum);
- // params.pageSize && (newParams.pagesize = params.pageSize);
- // delete params.pageNum;
- // delete params.pageSize;
- // newParams.queryParams = params;
- // console.log("params :>> ", params);
- // newParams.dsname = "web_mattress_mx_dianceng";
- // return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxBednet);
- // };
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description tab 垫层
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- // /**
- // * @description 垫层数据
- // */
- // const cushionsMxData = ref([]);
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description tab 辅料
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- // /**
- // * @description 辅料数据
- // */
- // const accessoriesMxData = ref([]);
- // const getData_bednet = (params: any) => {
- // console.log("getData params :>> ", params);
- // let newParams: any = {};
- // params.pageNum && (newParams.pageindex = params.pageNum);
- // params.pageSize && (newParams.pagesize = params.pageSize);
- // delete params.pageNum;
- // delete params.pageSize;
- // newParams.queryParams = params;
- // console.log("params :>> ", params);
- // newParams.dsname = "web_mattress_mx_bednet";
- // return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxAccessories);
- // };
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description tab 包装
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- // /**
- // * @description 包装数据
- // */
- // const packagMxData = ref([]);
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description tab 内布套
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- /**
- * @description 内布套数据
- */
- // const innerClothLayerMxData = ref([]);
- // const innerClothLayerMxRef = ref();
- const innerClothLayerNum = computed(() => {
- let arr = [];
- const $table = innerClothLayerMxRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- }
- return arr.length;
- });
- const innerClothLayerNum_error = computed(() => {
- let arr = [];
- const $table = innerClothLayerMxRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData.filter(t => Number(t.if_success));
- }
- return arr.length;
- });
- const getData_innerClothLayer = (params: any) => {
- console.log("getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- newParams.queryParams.arg_formulatype = [101, 102];
- console.log("params :>> ", params);
- newParams.dsname = "web_mattress_mx_neibutao";
- return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxInnerClothLayer);
- };
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description tab 顶部裥棉
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- // const topCottonMxRef = ref();
- const topCottonNum = computed(() => {
- let arr = [];
- const $table = topCottonMxRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
- }
- return arr.length;
- });
- const topCottonNum_error = computed(() => {
- let arr = [];
- const $table = topCottonMxRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData.filter(t => Number(t.if_success));
- }
- return arr.length;
- });
- const getData_topCotton = async (params: any) => {
- if (!Object.keys(initParams.value).includes("arg_mattressid") || initParams.value.arg_mattressid == 0) return false;
- let _params = { ...params, arg_formulatype: [103] };
- return await getData_mx(_params);
- };
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description 主副规格
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- const subSpecsNum = computed(() => {
- let arr = [];
- const $table = subSpecsRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData;
- }
- return arr.length;
- });
- const getData_subSpecs = (params: any) => {
- console.log("getData_subSpecs getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- console.log("params :>> ", params);
- newParams.dsname = "web_mattress_subspecs";
- return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteSubspecs);
- };
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description 特殊工艺
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- const specialProcessesNum = computed(() => {
- let arr = [];
- const $table = specialProcessesMxRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData.filter(t => t.extraid && Number(t.extraid) > 0);
- }
- return arr.length;
- });
- const getData_specialProcesses = (params: any) => {
- console.log("getData_subSpecs getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- newParams.queryParams.arg_typeid = 1; // 1:特殊工艺 2:额外费用
- console.log("params :>> ", params);
- newParams.dsname = "web_mattress_mx_extra";
- return CommonDynamicSelect(newParams);
- };
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- /**
- * @description 额外费用
- * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
- */
- const additionalCostsNum = computed(() => {
- let arr = [];
- const $table = additionalCostsMxRef.value?.element;
- if ($table) {
- arr = $table.getTableData().visibleData.filter(t => t.extraid && Number(t.extraid) > 0);
- }
- return arr.length;
- });
- const getData_additionalCosts = (params: any) => {
- console.log("getData_subSpecs getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- newParams.queryParams.arg_typeid = 2;
- console.log("params :>> ", params);
- newParams.dsname = "web_mattress_mx_extra";
- return CommonDynamicSelect(newParams);
- };
- /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
- const detailProps = reactive<DetailProp>({
- dwname: DwnameEnum.mattressQuote,
- columns: columns,
- // headerstatus: ["status", "ifamt_ok"],
- basicDefault: {},
- header: {
- fieldNames: {
- code: "sptcode",
- codeLabel: t("table.u_spt.sptcode") + ":",
- name: "name"
- },
- // icon: "iconclipboard",
- // tabsProp: {
- // scrollspy: true,
- // sticky: true
- // }
- floatbtn: [
- {
- id: "oaFlow",
- originLeft: 100,
- originTop: 50
- }
- ]
- },
- mould: [
- {
- id: "fabricMx",
- type: "table",
- label: t("business.detail.fabric")
- },
- {
- id: "bednetMx",
- type: "table",
- label: t("business.detail.bednet")
- },
- {
- id: "cushionsMx",
- type: "table",
- label: t("business.detail.cushions")
- },
- {
- id: "accessoriesMx",
- type: "table",
- label: t("business.detail.accessories")
- },
- {
- id: "packagMx",
- type: "table",
- label: t("business.detail.packag")
- },
- {
- id: "innerClothLayerMx",
- type: "table",
- label: t("business.detail.innerClothLayer"),
- limited: (params: any) => {
- if (!params) return true;
- return !params?.if_n_butao || params?.if_n_butao == "0";
- }
- },
- {
- id: "topCottonMx",
- type: "table",
- label: t("business.detail.topCotton"),
- limited: (params: any) => {
- if (!params) return true;
- return !params?.if_w_butao || params?.if_w_butao == "0";
- }
- },
- {
- id: "specialProcesses",
- type: "table",
- label: t("business.detail.specialProcesses")
- },
- {
- id: "additionalCosts",
- type: "table",
- label: t("business.detail.additionalCosts")
- },
- {
- id: "subSpecs",
- type: "table",
- label: t("business.detail.subSpecs")
- }
- ]
- });
- const getData = (params: any) => {
- console.log("getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- console.log("params :>> ", params);
- newParams.dsname = "web_mattress";
- return CommonDynamicSelect(newParams, DwnameEnum.mattressQuote);
- // return [];
- };
- const gotoShowFormula = (data: any) => {
- AllFormulaRef.value.open({
- dannum_type: data.type,
- formula: cmpFormulas.value,
- replace: cmpFormulaReplace.value,
- formula_ori: cmpFormulasOri.value,
- formula_bednet: cmpFormulasBednet.value,
- differ: cmpDiffer.value
- });
- };
- const loadingStatus = reactive({
- save: false,
- download: false
- });
- const save = async () => {
- console.log("save LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
- console.log("save------------ :>> ", loadingStatus.save);
- console.log("save cushionsMxData :>> ", cushionsMxData.value);
- try {
- await LjDetailRef.value.toValidateForm();
- if (!(await wf_cmp_cb())) return;
- let mattress = LjDetailRef.value._mainData;
- mattress.mattressid = Number(mattress.mattressid ?? 0);
- mattress.xd_flag = Number(mattress.xd_flag ?? 0);
- console.log("bbbbbbbbbbbbbbbbbbbb mattress :>> ", mattress);
- // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
- // mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
- // mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
- // mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
- // mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
- // mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
- // mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
- // mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
- // mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
- let mattressMx = [];
- try {
- fabricMxTabList.value.map(t => {
- if (t.ref) {
- console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
- if (dynamicRef(t.ref) && !["specialProcessesMxRef", "additionalCostsMxRef"].includes(t.ref)) {
- let $table = dynamicRef(t.ref)?.element;
- $table.clearEdit();
- let { visibleData } = $table.getTableData();
- console.log("visibleData t.ref?.value :>> ", t.ref, visibleData);
- visibleData = visibleData.map((itm, idx) => {
- // 检查明细输入是否正确
- let _disabled = !(
- (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(itm.formulakind)) ||
- itm.formulakind == 202 ||
- itm.formulakind == 7
- );
- console.log("_disabled :>> ", _disabled);
- if (t.ref == "cushionsMxRef") {
- _disabled = !(
- (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
- itm.formulakind == 7 ||
- itm.formulakind == 999
- );
- } else if (t.ref == "innerClothLayerMxRef") {
- _disabled = !(
- (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
- itm.formulakind == 202 ||
- itm.formulakind == 203
- );
- }
- console.log(
- "itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0 :>> ",
- _disabled,
- itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0
- );
- if (itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0) {
- throw new Error(t.label + "相关厚度输入有误,请检查");
- }
- itm.xu = idx + 1;
- return itm;
- });
- mattressMx = mattressMx.concat(visibleData);
- }
- }
- });
- } catch (error) {
- ElMessage.error(error.message);
- return false;
- }
- if (orderStatus.value == "copy") {
- mattress.copy_id = mattress.mattressid;
- }
- // 主副规格
- let subspecs = [];
- let $table_subspecs = subSpecsRef.value.element;
- if ($table_subspecs) {
- $table_subspecs.clearEdit();
- subspecs = $table_subspecs.getTableData().visibleData;
- try {
- // 忽略长宽高没填的明细行
- subspecs = subspecs.filter(
- itm => Number(itm.mattress_width) <= 0 && Number(itm.mattress_length) <= 0 && Number(itm.mattress_height) <= 0
- );
- subspecs.map(itm => {
- if (Number(itm.mattress_width) <= 0 || Number(itm.mattress_length) <= 0 || Number(itm.mattress_height) <= 0) {
- throw new Error("主副规格相关尺寸输入有误,请检查");
- }
- });
- } catch (error) {
- ElMessage.error(error.message);
- return false;
- }
- }
- // 特殊工艺
- let extraProcesses = [];
- let $table_processes = specialProcessesMxRef.value.element;
- if ($table_processes) {
- $table_processes.clearEdit();
- console.log("$table_processes.getTableData() :>> ", $table_processes.getTableData());
- extraProcesses = $table_processes.getTableData().visibleData;
- extraProcesses = extraProcesses.filter(itm => Number(itm.extraid) > 0);
- }
- console.log("save++++extraProcesses :>> ", extraProcesses);
- // 其他额外费用
- let extraCosts = [];
- let $table_costs = additionalCostsMxRef.value.element;
- if ($table_costs) {
- $table_costs.clearEdit();
- extraCosts = $table_costs.getTableData().visibleData;
- extraCosts = extraCosts.filter(itm => Number(itm.extraid) > 0);
- }
- loadingStatus.save = true;
- let _param_mf = {
- mattress,
- mattressMx,
- subspecs,
- extraProcesses,
- extraCosts
- };
- try {
- console.log("综合 _param_mf :>> ", _param_mf);
- await SaveMattress(_param_mf)
- .then(res => {
- ElNotification({
- title: "温馨提示",
- message: t("sys.api.sueccessToSave"),
- type: "success"
- });
- if (res.mattressid) {
- console.log("tabRemove route.fullPath :>> ", route.fullPath);
- tabRemove(route.fullPath);
- router.push(`/mattressQuote/detail?id=${res.mattressid}&code=${res.mattresscode}`);
- } else {
- router.replace("/mattressQuote");
- }
- setTimeout(() => {
- let _msg = res.message ?? "";
- if (res.message || res.mxmessage?.length) {
- let defaultNum = res.message ? 1 : 0;
- _msg && (_msg = "1." + _msg + "<br/>");
- if (res.mxmessage?.length) {
- res.mxmessage.map((itm, idx) => {
- _msg += `${idx + 1 + defaultNum}. ${itm}<br/>`;
- });
- }
- let _num = res.message ? 1 + res.mxmessage?.length : res.mxmessage?.length;
- ElNotification({
- title: `计算失败(${_num})`,
- message: `<div style="word-wrap:break-word;word-break:break-all;">${_msg}</div>`,
- dangerouslyUseHTMLString: true,
- type: "warning"
- });
- }
- }, 100);
- loadingStatus.save = false;
- })
- .catch(error => {
- console.log("error !! :>> ", error);
- loadingStatus.save = false;
- });
- } catch (error) {
- ElMessage.error(t("sys.api.operationFailed"));
- }
- } catch (e) {
- loadingStatus.save = false;
- console.log("buttonNew eee :>> ", e, loadingStatus.save);
- }
- };
- const orderDefaultAction = [
- buttonDefault({
- label: t("common.cancelText"),
- icon: "iconchevron-left",
- limited: () => {
- return !orderStatus.value;
- },
- clickFunc: item => {
- if (route.path.indexOf("/new") > -1) {
- tabRemove(route.fullPath);
- router.replace("/mattressQuote");
- } else {
- router.replace(
- `/mattressQuote/detail?id=${LjDetailRef.value._mainData.mattressid}&code=${LjDetailRef.value._mainData.mattresscode}`
- );
- }
- }
- }),
- buttonNew({
- label: t("common.saveText"),
- icon: "iconsave-01",
- loading: () => loadingStatus.save,
- limited: () => !orderStatus.value,
- clickFunc: () => save()
- }),
- buttonDefault({
- label: t("common.add"),
- power: 72,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- router.push(`/mattressQuote/new?id=0&deptid=${LjDetailRef.value._mainData?.deptid ?? 0}`);
- }
- }),
- buttonDefault({
- power: 72,
- label: t("common.editText"),
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: data => {
- if (data.parentid > 0) {
- return "副规格无法编辑,请在主规格中进行";
- }
- if (data.flag == 1) {
- return "单据已审核,不能修改";
- }
- return "";
- },
- clickFunc: item => {
- router.replace(
- `/mattressQuote/edit?id=${LjDetailRef.value._mainData.mattressid}&code=${LjDetailRef.value._mainData.mattresscode}`
- );
- }
- }),
- buttonDefault({
- power: 77,
- label: t("common.delText"),
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (!CheckPower(77)) {
- return "你没有【报价单-删除】的使用权限";
- }
- return "";
- },
- clickFunc: item => {
- console.log("dellll clickFunc item :>> ", LjDetailRef.value);
- ElMessageBox.confirm("是否确定要删除床垫报价单吗?", "询问", {
- confirmButtonText: t("common.delText"),
- cancelButtonText: "否",
- type: "error"
- })
- .then(() => {
- DelMattress({ mattressids: [Number(LjDetailRef.value._mainData.mattressid)] }).then(() => {
- ElMessage.success("删除成功!");
- tabRemove(route.fullPath);
- router.replace("/mattressQuote");
- mittBus.emit(MittEnum.MattressList);
- });
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- }),
- [
- buttonDefault({
- label: t("common.businessOrder"),
- power: 94,
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (!CheckPower(94)) {
- return `你没有【报价单-${t("common.businessOrder")}】的使用权限`;
- }
- if (data.parentid > 0) {
- return "副规格无法操作,请在主规格中进行";
- }
- return "";
- },
- clickFunc: item => {
- ElMessageBox.confirm("是否确定要业务下单吗?", "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- let _params = {
- mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
- xd_flag: 1
- };
- SaveMattressAuditing(_params).then(() => {
- ElMessage.success(t("sys.api.operationSuccess"));
- LjDetailRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- }),
- buttonDefault({
- label: t("common.businessOrderCancel"),
- power: 95,
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (!CheckPower(95)) {
- return `你没有【报价单-${t("common.businessOrderCancel")}】的使用权限`;
- }
- if (data.parentid > 0) {
- return "副规格无法操作,请在主规格中进行";
- }
- return "";
- },
- clickFunc: item => {
- ElMessageBox.confirm(`是否确定要${t("common.businessOrderCancel")}吗?`, "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- let _params = {
- mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
- xd_flag: 0
- };
- SaveMattressAuditing(_params).then(() => {
- ElMessage.success(t("sys.api.operationSuccess"));
- LjDetailRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- })
- ],
- [
- buttonDefault({
- label: t("common.auditFinance"),
- power: 73,
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (!CheckPower(73)) {
- return `你没有【报价单-${t("common.auditFinance")}】的使用权限`;
- }
- if (data.parentid > 0) {
- return "副规格无法操作,请在主规格中进行";
- }
- if (data.flag == 1) {
- return "已审核";
- }
- return "";
- },
- clickFunc: item => {
- ElMessageBox.confirm(`是否确定要${t("common.auditFinance")}吗?`, "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- let _params = {
- mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
- flag: 1
- };
- SaveMattressAuditing(_params).then(() => {
- ElMessage.success(t("sys.api.operationSuccess"));
- LjDetailRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- }),
- buttonDefault({
- label: t("common.withdrawAuditFinance"),
- power: 74,
- limited: () => {
- return !!orderStatus.value;
- },
- disabledTextCallBack: (data: any) => {
- if (!CheckPower(74)) {
- return `你没有【报价单-${t("common.withdrawAuditFinance")}】的使用权限`;
- }
- if (data.parentid > 0) {
- return "副规格无法操作,请在主规格中进行";
- }
- if (data.flag != 1) {
- return "未审核";
- }
- return "";
- },
- clickFunc: item => {
- ElMessageBox.confirm(`是否确定要${t("common.withdrawAuditFinance")}吗?`, "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning"
- })
- .then(() => {
- let _params = {
- mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
- flag: 0
- };
- SaveMattressAuditing(_params).then(() => {
- ElMessage.success(t("sys.api.operationSuccess"));
- LjDetailRef.value.refresh();
- });
- })
- .catch((e: TypeError) => {
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- })
- ],
- buttonDefault({
- label: t("common.copyQuote"),
- power: 75,
- limited: () => {
- return !!orderStatus.value;
- },
- clickFunc: item => {
- let _cur = LjDetailRef.value._mainData;
- router.push(`/mattressQuote/copy?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
- }
- }),
- buttonDefault({
- label: t("common.showFormula"),
- disabledTextCallBack: () => {
- return userInfo.usermode == 1 ? "业务员模式不可以查看!" : "";
- },
- clickFunc: item => gotoShowFormula({ type: LjDetailRef.value._mainData.dannum_type })
- }),
- buttonDefault({
- label: t("common.viewHistoricalQuotes"),
- clickFunc: () => {
- console.log("LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
- gotoHisprice(0, { id: LjDetailRef.value._mainData.mattressid, typeid: 1 });
- }
- }),
- buttonDefault({
- label: t("common.showQuoteList"),
- clickFunc: item => {
- let _data = {
- data: LjDetailRef.value._mainData,
- mxdata: isQuoteListMxData.value,
- enumMap: LjDetailRef.value.enumMap,
- fabricMx: fabricMxTabList.value,
- formulakindenum: formulaKindEnum.value,
- dannum_type: LjDetailRef.value._mainData.dannum_type,
- formula: cmpFormulas.value,
- replace: cmpFormulaReplace.value,
- formula_ori: cmpFormulasOri.value,
- formula_bednet: cmpFormulasBednet.value,
- differ: cmpDiffer.value
- };
- QuoteListDrawerRef.value.show(_data);
- }
- }),
- buttonDefault({
- label: t("common.exportQuoteList"),
- loading: () => loadingStatus.download,
- power: 72,
- clickFunc: async item => {
- loadingStatus.download = true;
- let _data = {
- data: LjDetailRef.value._mainData,
- mxdata: isQuoteListMxData.value,
- enumMap: LjDetailRef.value.enumMap,
- fabricMx: fabricMxTabList.value,
- formulakindenum: formulaKindEnum.value,
- differ: cmpDiffer.value
- };
- await toExcelQuote(_data, "床垫报价单_" + LjDetailRef.value._mainData.mattresscode);
- loadingStatus.download = false;
- }
- }),
- // buttonDefault({
- // label: t("common.dataTransmission"),
- // power: 72,
- // clickFunc: item => {
- // router.push(`/mattressQuote/new?id=0`);
- // }
- // })
- buttonDefault({
- label: t("common.back"),
- clickFunc: item => {
- router.push("/mattressQuote");
- }
- })
- ];
- onMounted(() => {
- console.log("route onMounted:>> ", route);
- console.log("route onMounted:>> ", route.params);
- console.log("route onMounted:>> ", route.params.id);
- if (Number(route.query?.id)) {
- // 赋值主表数据
- // mainData.value = res.datatable.length ? res.datatable[0] : {};
- // console.log("mainData.value :>> ", mainData.value);
- // 刷新数据
- initParams.value.arg_mattressid = Number(route.query?.id);
- console.log("detail onMounted initParams.value :>> ", initParams.value);
- } else {
- if (route.query?.deptid) {
- defaultColumnsValue.value.deptid = Number(route.query?.deptid);
- }
- }
- defaultColumnsValue.value.packtype = "0";
- defaultColumnsValue.value.packqty = 1;
- // defaultColumnsValue.value.woodpallettype = "0";
- // defaultColumnsValue.value.total_cost = 0;
- // defaultColumnsValue.value.nottax_factory_cost = 0;
- // defaultColumnsValue.value.nottax_dept_cost = 0;
- // defaultColumnsValue.value.foreign_cost = 0;
- // defaultColumnsValue.value.fob = 0;
- defaultColumnsValue.value.dannum_type = 2;
- defaultColumnsValue.value.dannum_rate = 1;
- defaultColumnsValue.value.if_moneyrate = "0";
- defaultColumnsValue.value.moneyrate = "1";
- defaultColumnsValue.value.taxrate = 1.07;
- defaultColumnsValue.value.taxes = 1;
- // defaultColumnsValue.value.flag = 0;
- defaultColumnsValue.value.woodpallettype = "0";
- defaultColumnsValue.value.total_hr_cost = "0";
- defaultColumnsValue.value.total_material_cost = "0";
- defaultColumnsValue.value.total_hr_cost = 0;
- defaultColumnsValue.value.total_material_cost = 0;
- defaultColumnsValue.value.total_fees_cost = 0;
- defaultColumnsValue.value.total_cost = 0;
- defaultColumnsValue.value.commissionrate = 0;
- defaultColumnsValue.value.fob = 0;
- defaultColumnsValue.value.profitrate = 0;
- defaultColumnsValue.value.nottax_factory_cost = 0;
- defaultColumnsValue.value.nottax_dept_cost = 0;
- defaultColumnsValue.value.dept_cost = 0;
- defaultColumnsValue.value.foreign_cost = 0;
- defaultColumnsValue.value.diameter = 0;
- defaultColumnsValue.value.area = "";
- defaultColumnsValue.value.cabinet_type = "";
- defaultColumnsValue.value.hrcost = 0;
- defaultColumnsValue.value.biandaicost = 0;
- defaultColumnsValue.value.flag = 0;
- defaultColumnsValue.value.dept_profitrate_rangli = 0;
- defaultColumnsValue.value.profitrate_point = 0;
- defaultColumnsValue.value.chaizhuang_point = 0;
- defaultColumnsValue.value.haimian_point = 0;
- defaultColumnsValue.value.qr_auditingdate = "";
- defaultColumnsValue.value.zhizao_amt = 0;
- defaultColumnsValue.value.foreign_cost_bz = 0;
- defaultColumnsValue.value.cubage = 0;
- defaultColumnsValue.value.discount = 1;
- defaultColumnsValue.value.butao_point = 1;
- defaultColumnsValue.value.guanli_rate = 1;
- defaultColumnsValue.value.if_bcp_type = 0;
- defaultColumnsValue.value.if_d_chai = 0;
- defaultColumnsValue.value.if_m_chai = 0;
- defaultColumnsValue.value.if_m_wbutao_way = 0;
- defaultColumnsValue.value.if_n_butao = 0;
- defaultColumnsValue.value.if_w_butao = 0;
- defaultColumnsValue.value.if_z_chai = 0;
- defaultColumnsValue.value.if_zhedie_type = 0;
- console.log("defaultColumnsValue.value :>> ", route.query?.deptid, defaultColumnsValue.value);
- getFormulakindEnum();
- });
- /**
- * @description 页面数据加载完成
- */
- const funcAfterMound = async () => {
- console.log("onMounted detail sale start!!!! :>> ", orderStatus.value, orderStatus.value != "new");
- if (!orderStatus.value) {
- // 详情页
- } else {
- // 新增/编辑
- tableProps_mx.value.editConfig.enabled = true;
- tableProps_subSpecs.value.editConfig.enabled = true;
- topCottonAddList.value = w_mattress_add_itemname_choose(4);
- }
- console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
- if (orderStatus.value != "new") {
- mxLoading.value = true;
- getMattressType();
- let res = await getData_mx(initParams.value);
- oriMxData.value = dataCallbackMx(res);
- oriMxData.value.list = oriMxData.value.list.map(t => {
- t.formulakind = Number(t.formulakind);
- t.thickness = Number(t.thickness);
- t.qty = Number(t.qty);
- return t;
- });
- let _params = {
- mattressid: Number(initParams.value.arg_mattressid),
- mattresstypeid: 0,
- ifbcptype: 0,
- packtype: 0
- };
- let resDw2 = await GetMattressImportDW2(_params);
- if (resDw2) {
- diancengAreaEnum.value = resDw2?.diancengarea;
- specialProcessesMxData.value = resDw2?.extraEnum.filter(t => t.typeid == 1);
- additionalCostsMxData.value = resDw2?.extraEnum.filter(t => t.typeid == 2);
- specialProcessesEnum.value = resDw2?.extraTypeEnum.filter(t => t.typeid == 1);
- additionalCostsEnum.value = resDw2?.extraTypeEnum.filter(t => t.typeid == 2);
- }
- console.log("funcAfterMound oriMxData.value :>> ", oriMxData.value);
- funcChaifenTab();
- mxLoading.value = false;
- nextTick(() => {
- console.log("detail onMounted subSpecsRef.value :>> ", subSpecsRef.value);
- subSpecsRef.value.refresh();
- gotoSummy(8000);
- });
- }
- };
- const handleSelFabricMxNewMtrlGroup = async (target: string, item: any) => {
- console.log("handleSelFabricMxNewMtrlGroup target :>> ", target, item, fabricMxTab10.value);
- if (target == "tabpage_10") {
- // 裥大恻
- const $table = fabricMxTab10Ref.value.element;
- const { visibleData } = $table.getTableData();
- let hasSame = visibleData.findIndex(t => t.sortcode == item.label);
- if (hasSame > -1) {
- ElMessage.error(item.label + "已存在");
- return false;
- }
- if ($table) {
- let _arr = [];
- if (item.label == "普通大侧") {
- $table.remove();
- } else {
- visibleData.map(t => {
- if (t.sortcode == "普通大侧") {
- _arr.push(t);
- }
- });
- $table.remove(_arr);
- }
- }
- let _params = {
- arg_array_formulakind: [2, 42, 52, 62, 72, 82],
- arg_array_formulatype: [0, 1, 2, 3]
- };
- await funcAddMxSide(_params, item, fabricMxTab10Ref.value);
- autoLoadExtraData(fabricMxTab10Ref.value, specialProcessesMxRef.value);
- } else if (target == "tabpage_11") {
- // 裥小恻
- const $table = fabricMxTab11Ref.value.element;
- const { visibleData } = $table.getTableData();
- let hasSame = visibleData.findIndex(t => t.sortcode == item.label);
- if (hasSame > -1) {
- ElMessage.error(item.label + "已存在");
- return false;
- }
- if ($table) {
- let _arr = [];
- visibleData.map(t => {
- if (t.sortcode == "小侧1") {
- _arr.push(t);
- }
- });
- $table.remove(_arr);
- }
- let _params = {
- arg_array_formulakind: [3, 83, 43, 53, 63, 73],
- arg_array_formulatype: [0, 1, 2, 3]
- };
- await funcAddMxSide(_params, item, fabricMxTab11Ref.value);
- }
- };
- /**
- * @description 判断目前选择的拼接数据量,自动导入修改特殊工艺费用
- */
- const autoLoadExtraData = (tableRef?: any, targetRef?: any) => {
- //计算拼侧数量
- const $table = tableRef.element;
- const { visibleData } = $table.getTableData();
- const $tableTarget = targetRef.element;
- const { visibleData: tgVisibleData } = $tableTarget.getTableData();
- let arr = [];
- // 收集拼侧,并去重
- visibleData.map(t => arr.push(t.sortcode));
- arr = Array.from(new Set(arr));
- //
- let _remove = [];
- tgVisibleData.map(t => {
- if (t.extraid == 1) {
- _remove.push(t);
- }
- });
- $tableTarget.remove(_remove);
- if (!arr.includes("普通大侧")) {
- let result = [];
- result = result.concat(computedExtraSizeNum(specialProcessesMxData.value, arr, "上下"));
- result = result.concat(computedExtraSizeNum(specialProcessesMxData.value, arr, "左右"));
- console.log("autoLoadExtraData result :>> ", result);
- if (result.length) {
- let _arr = [];
- let _mattressId = LjDetailRef.value._mainData.mattressid;
- result.map(o => {
- let _itm = {
- mattressid: _mattressId,
- mattressmxid: 0,
- extraid: o.extraid,
- // extratypename: "",
- extraname: o.extramxname,
- price: o.price,
- qty: o.qty,
- dscrp: o.dscrp,
- inputtype: o.inputtype,
- typeid: o.typeid
- };
- _arr.push(_itm);
- });
- $tableTarget.insertAt(_arr, -1);
- }
- }
- };
- /**
- * @description 计算拼侧数量
- */
- const computedExtraSizeNum = (enumarr: any, arr: any, key: string) => {
- console.log("computedExtraSizeNum specialProcessesEnum.value :>> ", enumarr);
- let extraArr = enumarr.filter(item => item.typeid == 1 && item.extraid == 1 && item.extramxname.includes(key));
- let arrNum = arr.filter(item => item.includes(key)).length;
- let result = [];
- extraArr.forEach(o => {
- // 判断名称中出现的数量
- try {
- const checker = new Function("value", `return ${text2Formula(o.extramxname)};`);
- if (checker(arrNum)) {
- result.push(o);
- }
- } catch (error) {
- console.log("error :>> ", error);
- ElMessage.error(`${t("sys.api.operationFailed")}特殊工艺名称: ${error}`);
- }
- });
- return result;
- };
- const handleDelFabricMxNewMtrlGroup = (target: string) => {
- let sameMx = [];
- let $table = null;
- if (target == "tabpage_10") {
- $table = fabricMxTab10Ref.value.element;
- } else if (target == "tabpage_11") {
- $table = fabricMxTab11Ref.value.element;
- }
- if ($table) {
- const curRow = $table.getCurrentRecord();
- let { visibleData } = $table.getTableData();
- if (!curRow) {
- ElMessage.warning("请先选择要删除的行");
- return;
- }
- sameMx = visibleData.filter(t => t.sortcode == curRow.sortcode);
- ElMessageBox.confirm(`是否确定要删除${sameMx.length}条明细吗?`, "询问:" + sameMx[0].sortcode, {
- confirmButtonText: t("common.delText"),
- cancelButtonText: "否",
- type: "error"
- })
- .then(() => {
- if (target == "tabpage_10") {
- let _arr = [];
- let _idx = [];
- visibleData.map((t, idx) => {
- if (t.sortcode == sameMx[0].sortcode) {
- _arr.push(t);
- _idx.push(idx);
- }
- });
- $table.remove(_arr);
- fabricMxTab10.value = visibleData.filter((t, idx) => !_idx.includes(idx));
- autoLoadExtraData(fabricMxTab10Ref.value, specialProcessesMxRef.value);
- } else if (target == "tabpage_11") {
- let _arr = [];
- let _idx = [];
- fabricMxTab11.value.map((t, idx) => {
- if (t.sortcode == sameMx[0].sortcode) {
- _arr.push(t);
- _idx.push(idx);
- }
- });
- $table.remove(_arr);
- fabricMxTab11.value = visibleData.filter((t, idx) => !_idx.includes(idx));
- }
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- }
- };
- const moveData = async ($table: any, index: number, nextIndex: number) => {
- let { visibleData } = $table.getTableData();
- const curRecords = $table?.getCurrentRecord();
- let prevRow = visibleData[nextIndex];
- visibleData[nextIndex] = visibleData[index];
- visibleData[index] = prevRow;
- $table.reloadData(visibleData);
- await $table.setCurrentRow(curRecords);
- };
- const fMoveFormBednetMxToCushionsMx = ($table: any, curIdx: number, action: number) => {
- let curRecords = $table?.getCurrentRecord();
- let visibleData = $table.getTableData().visibleData;
- const $table_cushions = dynamicRef("cushionsMxRef")?.element;
- const { visibleData: visibleData_cushions } = $table_cushions.getTableData();
- let currentBednetIndex = $table.getRowSeq(curRecords);
- console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
- let index = 1;
- visibleData_cushions.map(o => {
- if (Number(o.formulakind) == 999) {
- if (index == currentBednetIndex) {
- curRecords = o;
- }
- index++;
- }
- });
- index = 1;
- let oNextRecordes = visibleData[curIdx - action];
- currentBednetIndex = $table.getRowSeq(oNextRecordes);
- console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
- let nextRecords = null;
- visibleData_cushions.map(o => {
- if (Number(o.formulakind) == 999) {
- if (index == currentBednetIndex) {
- nextRecords = o;
- }
- index++;
- }
- });
- console.log("wf_rtr_cwdc table_cushions :>> ", $table_cushions.getRowSeq(curRecords), $table_cushions.getRowSeq(nextRecords));
- curIdx = visibleData_cushions.findIndex(t => t === curRecords);
- let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
- console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
- moveData($table_cushions, curIdx, nextIdx);
- };
- const fMoveFormCushionsMxToBednetMx = ($table: any, curIdx: number, action: number) => {
- let curRecords = $table?.getCurrentRecord();
- let visibleData = $table.getTableData().visibleData;
- let nextIdx = -1;
- let oNextRecordes = visibleData[curIdx - action];
- const $table_bednet = dynamicRef("bednetMxRef")?.element;
- const { visibleData: visibleData_cushions } = $table_bednet.getTableData();
- let currentBednetIndex = $table.getRowSeq(curRecords);
- console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
- let index = -1;
- curIdx = 0;
- visibleData.map((o, idx) => {
- if (Number(o.formulakind) == 999) {
- index++;
- if (idx + 1 == currentBednetIndex) {
- curIdx = index;
- }
- }
- });
- index = -1;
- currentBednetIndex = $table.getRowSeq(oNextRecordes);
- console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
- let nextRecords = null;
- visibleData.map((o, idx) => {
- if (Number(o.formulakind) == 999) {
- index++;
- if (idx + 1 == currentBednetIndex) {
- nextIdx = index;
- }
- }
- });
- // console.log("wf_rtr_cwdc table_cushions :>> ", $table_bednet.getRowSeq(curRecords), $table_bednet.getRowSeq(nextRecords));
- // curIdx = visibleData_cushions.findIndex(t => t === curRecords);
- // let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
- console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
- if (curIdx > -1 && nextIdx > -1) {
- moveData($table_bednet, curIdx, nextIdx);
- }
- };
- const toMove = async (action: number, tableName: string) => {
- console.log("bvtoMove action :>> ", action);
- // const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
- const $table = dynamicRef(tableName)?.element;
- let curRecords = $table?.getCurrentRecord();
- console.log("curRecords :>> ", curRecords);
- console.log("$table.getTableData() :>> ", $table.getTableData());
- let visibleData = $table.getTableData().visibleData;
- if (!curRecords) {
- ElMessage.warning("请先选择要移动的行");
- return;
- }
- let curIdx = visibleData.findIndex(t => t === curRecords);
- console.log("curIdx :>> ", curIdx);
- if (action == 1) {
- // 上移
- if (curIdx == 0) {
- ElMessage.warning("已经是第一条了");
- return;
- }
- // let prevRow = visibleData[curIdx - 1];
- // visibleData[curIdx - 1] = visibleData[curIdx];
- // visibleData[curIdx] = prevRow;
- // $table.reloadData(visibleData);
- // await $table.setCurrentRow(curRecords);
- moveData($table, curIdx, curIdx - 1);
- // 床网与垫层互联
- if (tableName == "bednetMxRef") {
- fMoveFormBednetMxToCushionsMx($table, curIdx, action);
- // const $table_cushions = dynamicRef("cushionsMxRef")?.element;
- // const { visibleData: visibleData_cushions } = $table_cushions.getTableData();
- // let currentBednetIndex = $table.getRowSeq(curRecords);
- // console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
- // let index = 1;
- // visibleData_cushions.map(o => {
- // if (Number(o.formulakind) == 999) {
- // if (index == currentBednetIndex) {
- // curRecords = o;
- // }
- // index++;
- // }
- // });
- // index = 1;
- // let oNextRecordes = visibleData[curIdx - 1];
- // currentBednetIndex = $table.getRowSeq(oNextRecordes);
- // console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
- // let nextRecords = null;
- // visibleData_cushions.map(o => {
- // if (Number(o.formulakind) == 999) {
- // if (index == currentBednetIndex) {
- // nextRecords = o;
- // }
- // index++;
- // }
- // });
- // console.log(
- // "wf_rtr_cwdc table_cushions :>> ",
- // $table_cushions.getRowSeq(curRecords),
- // $table_cushions.getRowSeq(nextRecords)
- // );
- // curIdx = visibleData_cushions.findIndex(t => t === curRecords);
- // let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
- // console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
- // moveData($table_cushions, curIdx, nextIdx);
- } else if (tableName == "cushionsMxRef") {
- fMoveFormCushionsMxToBednetMx($table, curIdx, action);
- }
- } else if (action == -1) {
- // 下移
- if (curIdx == visibleData.length - 1) {
- ElMessage.warning("已经是最后一条了");
- return;
- }
- // let nextRow = visibleData[curIdx + 1];
- // visibleData[curIdx + 1] = visibleData[curIdx];
- // visibleData[curIdx] = nextRow;
- moveData($table, curIdx, curIdx + 1);
- // $table.reloadData(visibleData);
- // await $table.setCurrentRow(curRecords);
- // 床网与垫层互联
- if (tableName == "bednetMxRef") {
- fMoveFormBednetMxToCushionsMx($table, curIdx, action);
- } else if (tableName == "cushionsMxRef") {
- fMoveFormCushionsMxToBednetMx($table, curIdx, action);
- }
- }
- };
- /**
- * @description 垫层:增加明细
- */
- const toAddMx_cushions = async (type: number) => {
- const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
- const row = curRecords[0];
- const { visibleData } = $table.getTableData();
- let newRow;
- if ($table) {
- const records = {
- chastr: row.chastr,
- formulatype: row.formulatype,
- if_mtrl: row.if_mtrl,
- formulaid: row.formulaid,
- sortcode: row.sortcode,
- formulakind: row.formulakind,
- formula: row.formula,
- thickness: 0,
- mtrlid: 0
- };
- if (type) {
- // 插入
- const curIndex = visibleData.findIndex(t => t._X_ROW_KEY === row._X_ROW_KEY);
- // 插入数据
- visibleData.splice(curIndex + 1, 0, records); // 假设 records 是要插入的新数据
- $table.loadData(visibleData); // 重新加载数据
- newRow = records;
- } else {
- // 新增
- const { row } = await $table.insertAt(records, -1);
- newRow = row;
- }
- // await $table.setEditCell(newRow, "mtrlname");
- await $table.setCurrentRow(newRow);
- console.log("wf_rtr_cwdc formulakind :>> ", row, row.formulakind);
- if (row.formulakind == 999) {
- const $table_bednet = bednetMxRef.value.element;
- if ($table_bednet) {
- const { visibleData: visibleData_bednet } = $table_bednet.getTableData();
- let curIndex = visibleData_bednet.length - 1;
- if (type) {
- curIndex = visibleData.filter(t => t.formulakind == 999).findIndex(t => t._X_ROW_KEY === row._X_ROW_KEY);
- }
- funcAddMtrlMx({ row: visibleData_bednet[curIndex] }, null, "bednetMxRef");
- }
- }
- }
- };
- /**
- * @description 垫层:删除
- */
- const toDelMx_cushions = () => {
- ElMessageBox.confirm(`是否确定要删除明细吗?`, "询问", {
- confirmButtonText: t("common.delText"),
- cancelButtonText: "否",
- type: "error"
- })
- .then(() => {
- const $table = cushionsMxRef.value.element;
- $table.removeCurrentRow();
- })
- .catch((e: TypeError) => {
- console.log("e :>> ", e);
- ElMessage({
- type: "info",
- message: "操作取消"
- });
- });
- };
- const handleAddBednetMx = () => {
- nextTick(() => {
- console.log("LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
- drawerTitle.value = "新增床网报价";
- bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
- bednetDrawerProps.bednetid = 0;
- bednetDrawerProps.state = "new";
- bednetDrawerProps.onlyView = false;
- LjDrawerRef.value.show(true);
- });
- };
- const handleEditBednetMx = () => {
- const $table = bednetMxRef.value.element;
- if ($table) {
- const { $table, curRecords } = getCurrentRecords(bednetMxRef.value);
- if (curRecords) {
- const records = curRecords[0];
- if (!Number(records?.mtrlid)) {
- handleAddBednetMx();
- } else {
- nextTick(() => {
- drawerTitle.value = "修改床网报价";
- bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
- bednetDrawerProps.bednetid = records.mtrlid;
- bednetDrawerProps.state = "edit";
- bednetDrawerProps.onlyView = false;
- LjDrawerRef.value.show(true);
- });
- }
- }
- }
- };
- const autoBednetSave = async (res: any) => {
- const $table = bednetMxRef.value.element;
- let _res = res.bednet;
- _res.bednet_height = res.bednet.mattress_height;
- if ($table) {
- const { visibleData } = $table.getTableData();
- let idx = visibleData.findIndex(t => t.mtrlid == _res.bednetid || t.mtrlid == 0);
- let _mtrlname =
- _res.typename + " " + _res.bednetcode + " " + _res.mattress_width + "*" + _res.mattress_length + "*" + _res.mattress_height;
- if (idx > -1) {
- visibleData[idx].mtrlid = _res.bednetid;
- visibleData[idx].mtrlname = _mtrlname;
- visibleData[idx].price = _res.nottax_factory_cost;
- visibleData[idx].qty = 1;
- await $table.reloadData(visibleData);
- wf_rtr_cwdc(visibleData[idx], _res, "set");
- } else {
- let _data = cloneDeep(visibleData[0]);
- let _row = {
- addmx: "+",
- delmx: "-",
- formulatype: _data.formulatype,
- if_mtrl: _data.if_mtrl,
- formulaid: _data.formulaid,
- sortcode: _data.sortcode,
- formulakind: _data.formulakind,
- formula: _data.formula,
- thickness: 0,
- mtrlid: _res.bednetid,
- mtrlname: _mtrlname,
- price: _res.nottax_factory_cost,
- qty: 1
- };
- await $table.insertAt(_row, -1);
- wf_rtr_cwdc(_row, _res, "add");
- }
- }
- LjDrawerRef.value.hide();
- };
- /**
- * @description 设置上次激活的标签页
- * @param type 类型
- * @param data 数据
- */
- const SetCurrentTabs = (data: any) => {
- let _dwname = detailProps.dwname + "__fabric";
- let _dftabs = globalStore?.detailtabs ?? {};
- _dftabs[_dwname] = data.paneName;
- globalStore.setGlobalState("mattresTabs", _dftabs);
- };
- /**
- * @description 新增主副规格
- */
- const toAddMx_subSpecs = async () => {
- const $table = subSpecsRef.value.element;
- if ($table) {
- let records = {
- mattressid: 0,
- mattresscode: "",
- mattress_width: "",
- mattress_length: "",
- mattress_height: ""
- };
- const { row: newRow } = await $table.insertNextAt(records, -1);
- await $table.setEditCell(newRow, "mattress_width");
- await $table.setCurrentRow(newRow);
- }
- };
- /**
- * @description 删除主副规格
- */
- const toDelMx_subSpecs = () => {
- const { $table, curRecords } = getCurrentRecords(subSpecsRef.value);
- if ($table) {
- $table.remove(curRecords);
- }
- };
- /**
- * @description 审核后,修改主副规格
- */
- const editSubSpecs = ref(false);
- const toEdit_subSpecs = () => {
- editSubSpecs.value = true;
- tableProps_subSpecs.value.editConfig.enabled = true;
- };
- const toCancel_subSpecs = () => {
- editSubSpecs.value = false;
- subSpecsRef.value.refresh();
- };
- const toSave_subSpecs = async () => {
- await save();
- editSubSpecs.value = false;
- };
- const gotoMainMattress = () => {
- if (globalStore.detailBlank) {
- // 打开新的窗口
- const routeUrl = router.resolve({
- path: `/mattressQuote/detail`,
- query: {
- id: LjDetailRef.value._mainData.parentid
- // code: row.mattresscode
- }
- });
- window.open(routeUrl.href, "_blank");
- } else {
- router.push(`/mattressQuote/detail?id=${LjDetailRef.value._mainData.parentid}`);
- }
- };
- const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
- if (orderStatus.value || editSubSpecs.value) return false;
- if (globalStore.detailBlank) {
- // 打开新的窗口
- const routeUrl = router.resolve({
- path: `/mattressQuote/detail`,
- query: {
- id: row.mattressid,
- code: row.mattresscode
- }
- });
- window.open(routeUrl.href, "_blank");
- } else {
- router.push(`/mattressQuote/detail?id=${row.mattressid}&code=${row.mattresscode}`);
- }
- };
- // 返回绑定的事件
- const tableEvents = {
- "cell-dblclick": handleDBlClickTable
- };
- const handleCellDblClick_bednet = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
- console.log("handleCellDblClick_bednet row :>> ", row);
- if (!orderStatus.value && row.mtrlid > 0) {
- drawerTitle.value = "床网报价详情";
- // bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
- bednetDrawerProps.bednetid = row.mtrlid;
- bednetDrawerProps.state = "";
- bednetDrawerProps.onlyView = true;
- LjDrawerRef.value.show(true);
- }
- };
- </script>
- <style lang="scss">
- .select-text-right {
- .el-select__wrapper {
- text-align: right;
- }
- }
- .fabric-mx-tabs {
- .el-tabs__content {
- flex: 1;
- }
- .el-tab-pane {
- display: flex;
- flex-direction: column;
- }
- }
- </style>
|