detail.vue 113 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405
  1. <template>
  2. <LjDetail
  3. name="rpMustPayCrmDetail"
  4. ref="LjDetailRef"
  5. v-bind="detailProps"
  6. :init-param="initParams"
  7. v-model:order-status="orderStatus"
  8. :action="orderDefaultAction"
  9. @after-mounted="funcAfterMound"
  10. :if-layout-editable="false"
  11. :default-columns-value="defaultColumnsValue"
  12. >
  13. <template #rightBtn="scope">
  14. <el-space warp>
  15. <el-checkbox
  16. v-model="isShowOriginFormulaMattress"
  17. v-if="CheckPower(131)"
  18. label="显示旧公式"
  19. size="small"
  20. @change="showOriginFormulaMattress"
  21. />
  22. <el-select disabled v-model="scope.data.dannum_type" placeholder="大小单" style="width: 80px">
  23. <el-option label="散单" :value="1" />
  24. <el-option label="小单" :value="4" />
  25. <el-option label="标准" :value="2" />
  26. <el-option label="大单" :value="3" />
  27. </el-select>
  28. </el-space>
  29. </template>
  30. <template #headerSuffix>
  31. <Statistic
  32. :data="cmpFormulaReplace"
  33. :main-data="LjDetailRef?._mainData"
  34. :differ="cmpDiffer"
  35. :iforigin="isShowOriginFormulaMattress"
  36. :precision="2"
  37. :moneyrate="cmpMoneyrate"
  38. :ifMoneyrate="cmpIfMoneyrate"
  39. @click="gotoShowFormula"
  40. />
  41. </template>
  42. <!-- @to-pin-detail="emit('toPinDetail')" -->
  43. <template #fabricMx__tabtitle="scope">
  44. <template v-if="isTabsBadge_fabric_error">
  45. <el-badge :value="isTabsBadge_fabric_error + '异常'" type="danger">
  46. {{ scope.props.label }}
  47. </el-badge>
  48. </template>
  49. <template v-else>
  50. <el-badge :value="isTabsBadge_fabric" type="primary" :show-zero="false">
  51. {{ scope.props.label }}
  52. </el-badge>
  53. </template>
  54. </template>
  55. <template #fabricMx>
  56. <el-tabs v-model="fabricMxTabs" type="card" class="h-full flx-col fabric-mx-tabs" @tab-click="SetCurrentTabs">
  57. <el-tab-pane
  58. class="h-full flx"
  59. label="裥面"
  60. name="tabpage_8"
  61. v-if="mattresstypeEnum && Number(mattresstypeEnum?.if_top_side) == 1"
  62. >
  63. <template #label>
  64. <template v-if="isFilterErrorBadge(fabricMxTab8)">
  65. <el-badge :value="isFilterErrorBadge(fabricMxTab8) + '异常'" type="danger"> 裥面 </el-badge>
  66. </template>
  67. <template v-else>
  68. <el-badge
  69. :value="isFilterSucessBadge(fabricMxTab8)"
  70. type="primary"
  71. :show-zero="false"
  72. :color="_variables.colorPrimary200"
  73. >
  74. 裥面
  75. </el-badge>
  76. </template>
  77. </template>
  78. <LjVxeTable
  79. ref="fabricMxTab8Ref"
  80. row-key="key"
  81. table-cls="h-full"
  82. :data="fabricMxTab8"
  83. :columns="columnsMx"
  84. :dwname="DwnameEnum.mattressQuoteMx"
  85. :table-props="tableProps_mx"
  86. :tool-button="[]"
  87. :auto-load-layout="false"
  88. collapseButtons
  89. :request-auto="false"
  90. :extra-loading="mxLoading"
  91. :footer-method="footerMethod"
  92. >
  93. <template #tableHeader v-if="orderStatus">
  94. <el-space wrap>
  95. <el-button type="default" @click="toMove(1, 'fabricMxTab8Ref')">{{ t("common.moveUp") }}</el-button>
  96. <el-button type="default" @click="toMove(-1, 'fabricMxTab8Ref')">{{ t("common.moveDown") }}</el-button>
  97. </el-space>
  98. </template>
  99. </LjVxeTable>
  100. </el-tab-pane>
  101. <el-tab-pane
  102. class="h-full flx"
  103. label="裥底"
  104. name="tabpage_9"
  105. v-if="mattresstypeEnum && Number(mattresstypeEnum.if_button_sdie) == 1"
  106. >
  107. <template #label>
  108. <template v-if="isFilterErrorBadge(fabricMxTab9)">
  109. <el-badge :value="isFilterErrorBadge(fabricMxTab9) + '异常'" type="danger"> 裥底 </el-badge>
  110. </template>
  111. <template v-else>
  112. <el-badge
  113. :value="isFilterSucessBadge(fabricMxTab9)"
  114. type="primary"
  115. :show-zero="false"
  116. :color="_variables.colorPrimary200"
  117. >
  118. 裥底
  119. </el-badge>
  120. </template>
  121. </template>
  122. <LjVxeTable
  123. ref="fabricMxTab9Ref"
  124. row-key="key"
  125. table-cls="h-full"
  126. :data="fabricMxTab9"
  127. :columns="columnsMx"
  128. :dwname="DwnameEnum.mattressQuoteMx"
  129. :table-props="tableProps_mx"
  130. :tool-button="[]"
  131. :request-auto="false"
  132. :auto-load-layout="false"
  133. collapseButtons
  134. :extra-loading="mxLoading"
  135. :footer-method="footerMethod"
  136. >
  137. <template #tableHeader v-if="orderStatus">
  138. <el-space wrap>
  139. <el-button type="default" @click="toMove(1, 'fabricMxTab9Ref')">{{ t("common.moveUp") }}</el-button>
  140. <el-button type="default" @click="toMove(-1, 'fabricMxTab9Ref')">{{ t("common.moveDown") }}</el-button>
  141. </el-space>
  142. </template>
  143. </LjVxeTable>
  144. </el-tab-pane>
  145. <el-tab-pane
  146. class="h-full flx"
  147. label="裥大恻"
  148. name="tabpage_10"
  149. v-if="mattresstypeEnum && Number(mattresstypeEnum.if_big_side) == 1"
  150. >
  151. <template #label>
  152. <template v-if="isFilterErrorBadge(fabricMxTab10)">
  153. <el-badge :value="isFilterErrorBadge(fabricMxTab10) + '异常'" type="danger"> 裥大恻 </el-badge>
  154. </template>
  155. <template v-else>
  156. <el-badge
  157. :value="isFilterSucessBadge(fabricMxTab10)"
  158. type="primary"
  159. :show-zero="false"
  160. :color="_variables.colorPrimary200"
  161. >
  162. 裥大恻
  163. </el-badge>
  164. </template>
  165. </template>
  166. <LjVxeTable
  167. ref="fabricMxTab10Ref"
  168. row-key="key"
  169. table-cls="h-full"
  170. :data="fabricMxTab10"
  171. :columns="columnsMx"
  172. :dwname="DwnameEnum.mattressQuoteMx"
  173. :table-props="tableProps_mx"
  174. :tool-button="[]"
  175. :request-auto="false"
  176. :auto-load-layout="false"
  177. collapseButtons
  178. :extra-loading="mxLoading"
  179. :footer-method="footerMethod"
  180. >
  181. <template #tableHeader v-if="orderStatus">
  182. <el-space wrap>
  183. <el-dropdown placement="bottom-start" @command="val => handleSelFabricMxNewMtrlGroup('tabpage_10', val)">
  184. <el-button type="primary">
  185. {{ t("business.detail.addChastr") }}<el-icon class="el-icon--right"><ArrowDown /></el-icon>
  186. </el-button>
  187. <template #dropdown>
  188. <el-dropdown-menu>
  189. <el-dropdown-item v-for="item in fabricMx10NewMtrlGroup" :key="item.value" :command="item">{{
  190. item.label
  191. }}</el-dropdown-item>
  192. </el-dropdown-menu>
  193. </template>
  194. </el-dropdown>
  195. <el-button type="danger" @click="handleDelFabricMxNewMtrlGroup('tabpage_10')">{{
  196. t("business.detail.delChastr")
  197. }}</el-button>
  198. </el-space>
  199. <el-divider direction="vertical" />
  200. <el-space wrap>
  201. <el-button type="default" @click="toMove(1, 'fabricMxTab10Ref')">{{ t("common.moveUp") }}</el-button>
  202. <el-button type="default" @click="toMove(-1, 'fabricMxTab10Ref')">{{ t("common.moveDown") }}</el-button>
  203. </el-space>
  204. </template>
  205. </LjVxeTable>
  206. </el-tab-pane>
  207. <el-tab-pane
  208. class="h-full flx"
  209. label="裥小恻"
  210. name="tabpage_11"
  211. v-if="mattresstypeEnum && Number(mattresstypeEnum.if_small_side) == 1"
  212. >
  213. <template #label>
  214. <template v-if="isFilterErrorBadge(fabricMxTab11)">
  215. <el-badge :value="isFilterErrorBadge(fabricMxTab11) + '异常'" type="danger"> 裥小恻 </el-badge>
  216. </template>
  217. <template v-else>
  218. <el-badge
  219. :value="isFilterSucessBadge(fabricMxTab11)"
  220. type="primary"
  221. :show-zero="false"
  222. :color="_variables.colorPrimary200"
  223. >
  224. 裥小恻
  225. </el-badge>
  226. </template>
  227. </template>
  228. <LjVxeTable
  229. ref="fabricMxTab11Ref"
  230. row-key="key"
  231. table-cls="h-full"
  232. :data="fabricMxTab11"
  233. :columns="columnsMx"
  234. :dwname="DwnameEnum.mattressQuoteMx"
  235. :table-props="tableProps_mx"
  236. :tool-button="[]"
  237. :request-auto="false"
  238. :auto-load-layout="false"
  239. collapseButtons
  240. :extra-loading="mxLoading"
  241. :footer-method="footerMethod"
  242. >
  243. <template #tableHeader v-if="orderStatus">
  244. <el-space wrap>
  245. <el-dropdown placement="bottom-start" @command="val => handleSelFabricMxNewMtrlGroup('tabpage_11', val)">
  246. <el-button type="primary">
  247. {{ t("business.detail.addChastr") }}<el-icon class="el-icon--right"><ArrowDown /></el-icon>
  248. </el-button>
  249. <template #dropdown>
  250. <el-dropdown-menu>
  251. <el-dropdown-item v-for="item in fabricMx11NewMtrlGroup" :key="item.value" :command="item">{{
  252. item.label
  253. }}</el-dropdown-item>
  254. </el-dropdown-menu>
  255. </template>
  256. </el-dropdown>
  257. <el-button type="danger" @click="handleDelFabricMxNewMtrlGroup('tabpage_10')">{{
  258. t("business.detail.delChastr")
  259. }}</el-button>
  260. </el-space>
  261. <el-divider direction="vertical" />
  262. <el-space wrap>
  263. <el-button type="default" @click="toMove(1, 'fabricMxTab11Ref')">{{ t("common.moveUp") }}</el-button>
  264. <el-button type="default" @click="toMove(-1, 'fabricMxTab11Ref')">{{ t("common.moveDown") }}</el-button>
  265. </el-space>
  266. </template>
  267. </LjVxeTable>
  268. </el-tab-pane>
  269. <el-tab-pane
  270. class="h-full flx"
  271. label="裥V恻"
  272. name="tabpage_12"
  273. v-if="mattresstypeEnum && Number(mattresstypeEnum.if_v_side) == 1"
  274. >
  275. <template #label>
  276. <template v-if="isFilterErrorBadge(fabricMxTab12)">
  277. <el-badge :value="isFilterErrorBadge(fabricMxTab12) + '异常'" type="danger"> 裥V恻 </el-badge>
  278. </template>
  279. <template v-else>
  280. <el-badge
  281. :value="isFilterSucessBadge(fabricMxTab12)"
  282. type="primary"
  283. :show-zero="false"
  284. :color="_variables.colorPrimary200"
  285. >
  286. 裥V恻
  287. </el-badge>
  288. </template>
  289. </template>
  290. <LjVxeTable
  291. ref="fabricMxTab12Ref"
  292. row-key="key"
  293. table-cls="h-full"
  294. :data="fabricMxTab12"
  295. :columns="columnsMx"
  296. :dwname="DwnameEnum.mattressQuoteMx"
  297. :table-props="tableProps_mx"
  298. :tool-button="[]"
  299. :request-auto="false"
  300. :auto-load-layout="false"
  301. collapseButtons
  302. :extra-loading="mxLoading"
  303. :footer-method="footerMethod"
  304. >
  305. <template #tableHeader v-if="orderStatus">
  306. <el-space wrap>
  307. <el-button type="default" @click="toMove(1, 'fabricMxTab12Ref')">{{ t("common.moveUp") }}</el-button>
  308. <el-button type="default" @click="toMove(-1, 'fabricMxTab12Ref')">{{ t("common.moveDown") }}</el-button>
  309. </el-space>
  310. </template>
  311. </LjVxeTable>
  312. </el-tab-pane>
  313. <el-tab-pane class="h-full flx" label="拉手刺绣及其他工艺" name="tabpage_13">
  314. <template #label>
  315. <template v-if="isFilterErrorBadge(fabricMxTab13)">
  316. <el-badge :value="isFilterErrorBadge(fabricMxTab13) + '异常'" type="danger"> 拉手刺绣及其他工艺 </el-badge>
  317. </template>
  318. <template v-else>
  319. <el-badge
  320. :value="isFilterSucessBadge(fabricMxTab13)"
  321. type="primary"
  322. :show-zero="false"
  323. :color="_variables.colorPrimary200"
  324. >
  325. 拉手刺绣及其他工艺
  326. </el-badge>
  327. </template>
  328. </template>
  329. <LjVxeTable
  330. ref="fabricMxTab13Ref"
  331. row-key="key"
  332. table-cls="h-full"
  333. :data="fabricMxTab13"
  334. :columns="columnsMx"
  335. :dwname="DwnameEnum.mattressQuoteMx"
  336. :table-props="tableProps_mx"
  337. :tool-button="[]"
  338. :request-auto="false"
  339. :auto-load-layout="false"
  340. collapseButtons
  341. :extra-loading="mxLoading"
  342. :footer-method="footerMethod"
  343. >
  344. <template #tableHeader v-if="orderStatus">
  345. <el-space wrap>
  346. <el-dropdown placement="bottom-start" @command="val => funcAddGongYi(val)">
  347. <el-button type="primary"
  348. >新增工艺<el-icon class="el-icon--right"><ArrowDown /></el-icon>
  349. </el-button>
  350. <template #dropdown>
  351. <el-dropdown-menu>
  352. <el-dropdown-item v-for="item in fabricMx13NewMtrlGroup" :key="item.value" :command="item">{{
  353. item.label
  354. }}</el-dropdown-item>
  355. </el-dropdown-menu>
  356. </template>
  357. </el-dropdown>
  358. <el-button type="danger" @click="handleDelFabricMxNewMtrlGroup('tabpage_13')">删除工艺</el-button>
  359. </el-space>
  360. <el-divider direction="vertical" />
  361. <el-space wrap>
  362. <el-button type="default" @click="toMove(1, 'fabricMxTab13Ref')">{{ t("common.moveUp") }}</el-button>
  363. <el-button type="default" @click="toMove(-1, 'fabricMxTab13Ref')">{{ t("common.moveDown") }}</el-button>
  364. </el-space>
  365. </template>
  366. </LjVxeTable>
  367. </el-tab-pane>
  368. </el-tabs>
  369. </template>
  370. <template #bednetMx__tabtitle="scope">
  371. <template v-if="isTabsBadge_bednet_error">
  372. <el-badge :value="isTabsBadge_bednet_error + '异常'" type="danger">
  373. {{ scope.props.label }}
  374. </el-badge>
  375. </template>
  376. <template v-else>
  377. <el-badge :value="isTabsBadge_bednet" type="primary" :show-zero="false">
  378. {{ scope.props.label }}
  379. </el-badge>
  380. </template>
  381. </template>
  382. <template #bednetMx>
  383. <LjVxeTable
  384. ref="bednetMxRef"
  385. row-key="key"
  386. table-cls="h-full"
  387. :data="bednetMxData"
  388. :columns="columnsMxBednet"
  389. :dwname="DwnameEnum.mattressQuoteMxBednet"
  390. :table-props="tableProps_mx"
  391. :tool-button="[]"
  392. :request-auto="false"
  393. :auto-load-layout="false"
  394. collapseButtons
  395. :extra-loading="mxLoading"
  396. :footer-method="footerMethod"
  397. @cell-dblclick="handleCellDblClick_bednet"
  398. >
  399. <template #tableHeader v-if="orderStatus">
  400. <el-space wrap>
  401. <el-button type="primary" @click="handleAddBednetMx">{{ t("common.add") }}</el-button>
  402. <el-button type="danger" @click="handleEditBednetMx">{{ t("common.editText") }}</el-button>
  403. </el-space>
  404. <el-divider direction="vertical" />
  405. <el-space wrap>
  406. <el-button type="default" @click="toMove(1, 'bednetMxRef')">{{ t("common.moveUp") }}</el-button>
  407. <el-button type="default" @click="toMove(-1, 'bednetMxRef')">{{ t("common.moveDown") }}</el-button>
  408. </el-space>
  409. </template>
  410. </LjVxeTable>
  411. </template>
  412. <template #cushionsMx__tabtitle="scope">
  413. <template v-if="isTabsBadge_cushions_error">
  414. <el-badge :value="isTabsBadge_cushions_error + '异常'" type="danger">
  415. {{ scope.props.label }}
  416. </el-badge>
  417. </template>
  418. <template v-else>
  419. <el-badge :value="isTabsBadge_cushions" type="primary" :show-zero="false">
  420. {{ scope.props.label }}
  421. </el-badge>
  422. </template>
  423. </template>
  424. <template #cushionsMx>
  425. <LjVxeTable
  426. ref="cushionsMxRef"
  427. row-key="key"
  428. table-cls="h-full"
  429. :data="cushionsMxData"
  430. :columns="columnsMxCushions"
  431. :dwname="DwnameEnum.mattressQuoteMxCushions"
  432. :table-props="tableProps_mx"
  433. :tool-button="[]"
  434. :request-auto="false"
  435. :auto-load-layout="false"
  436. collapseButtons
  437. :extra-loading="mxLoading"
  438. :footer-method="footerMethod"
  439. >
  440. <template #tableHeader v-if="orderStatus">
  441. <el-space wrap>
  442. <el-button type="primary" @click="toAddMx_cushions(0)">{{ t("common.addText") }}</el-button>
  443. <el-button type="primary" @click="toAddMx_cushions(1)">{{ t("common.insert") }}</el-button>
  444. <el-button type="danger" @click="toDelMx_cushions">{{ t("common.delText") }}</el-button>
  445. </el-space>
  446. <el-divider direction="vertical" />
  447. <el-space wrap>
  448. <el-button type="default" @click="toMove(1, 'cushionsMxRef')">{{ t("common.moveUp") }}</el-button>
  449. <el-button type="default" @click="toMove(-1, 'cushionsMxRef')">{{ t("common.moveDown") }}</el-button>
  450. </el-space>
  451. </template>
  452. </LjVxeTable>
  453. </template>
  454. <template #accessoriesMx__tabtitle="scope">
  455. <template v-if="isTabsBadge_accessories_error">
  456. <el-badge :value="isTabsBadge_accessories_error + '异常'" type="danger">
  457. {{ scope.props.label }}
  458. </el-badge>
  459. </template>
  460. <template v-else>
  461. <el-badge :value="isTabsBadge_accessories" type="primary" :show-zero="false">
  462. {{ scope.props.label }}
  463. </el-badge>
  464. </template>
  465. </template>
  466. <template #accessoriesMx>
  467. <LjVxeTable
  468. ref="accessoriesMxRef"
  469. row-key="key"
  470. table-cls="h-full"
  471. :data="accessoriesMxData"
  472. :columns="columnsMxAccessories"
  473. :dwname="DwnameEnum.mattressQuoteMxAccessories"
  474. :table-props="tableProps_mx"
  475. :tool-button="[]"
  476. :request-auto="false"
  477. :auto-load-layout="false"
  478. collapseButtons
  479. :extra-loading="mxLoading"
  480. :footer-method="footerMethod"
  481. >
  482. <template #tableHeader v-if="orderStatus">
  483. <el-space wrap>
  484. <el-button type="primary" @click="funcAddMtrlMx({}, null, 'accessoriesMxRef', -1)">{{
  485. $t("common.addText")
  486. }}</el-button>
  487. <el-button type="danger" @click="toDelMx_accessories">{{ $t("common.delText") }}</el-button>
  488. </el-space>
  489. </template>
  490. </LjVxeTable>
  491. </template>
  492. <template #packagMx__tabtitle="scope">
  493. <template v-if="isTabsBadge_packag_error">
  494. <el-badge :value="isTabsBadge_packag_error + '异常'" type="danger">
  495. {{ scope.props.label }}
  496. </el-badge>
  497. </template>
  498. <template v-else>
  499. <el-badge :value="isTabsBadge_packag" type="primary" :show-zero="false">
  500. {{ scope.props.label }}
  501. </el-badge>
  502. </template>
  503. </template>
  504. <template #packagMx="scope">
  505. <LjVxeTable
  506. ref="packagMxRef"
  507. row-key="key"
  508. table-cls="h-full"
  509. :data="packagMxData"
  510. :columns="columnsMxPackag"
  511. :dwname="DwnameEnum.mattressQuoteMxPackag"
  512. :table-props="tableProps_mx"
  513. :tool-button="[]"
  514. :request-auto="false"
  515. :auto-load-layout="false"
  516. collapseButtons
  517. :extra-loading="mxLoading"
  518. :footer-method="footerMethod"
  519. >
  520. <template #tableHeader>
  521. <el-space wrap>
  522. <el-form label-width="70px" inline :disabled="!orderStatus">
  523. <el-form-item label="包装方式">
  524. <el-select v-model="scope.data.packtype" style="width: 120px" @change="funcPacktypeChange">
  525. <el-option v-for="item in packtypeOptions" :key="item.value" :label="item.label" :value="item.value" />
  526. </el-select>
  527. </el-form-item>
  528. <el-form-item label="卷包直径" v-if="scope.data.packtype == 1">
  529. <el-input-number v-model="scope.data.diameter" :min="0" :max="1000" />CM
  530. </el-form-item>
  531. <el-form-item label="木托方式" v-if="scope.data.packtype == 0">
  532. <el-select v-model="scope.data.woodpallettype" style="width: 120px">
  533. <el-option v-for="item in woodpallettypeOptions" :key="item.value" :label="item.label" :value="item.value" />
  534. </el-select>
  535. </el-form-item>
  536. <el-form-item label="压包数量" v-if="scope.data.packtype == 0">
  537. <el-input-number v-model="scope.data.packqty" :min="0" :max="1000" />
  538. </el-form-item>
  539. <el-form-item label="地区">
  540. <el-select v-model="scope.data.area" style="width: 120px" clearable>
  541. <el-option v-for="item in areaOptions" :key="item.value" :label="item.label" :value="item.value" />
  542. </el-select>
  543. </el-form-item>
  544. <el-form-item label="柜型">
  545. <el-select v-model="scope.data.cabinet_type" style="width: 120px" clearable>
  546. <el-option v-for="item in cabinetTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
  547. </el-select>
  548. </el-form-item>
  549. <el-form-item label="体积">
  550. <el-input-number v-model="scope.data.cubage" :min="0" :max="1000" />
  551. </el-form-item>
  552. </el-form>
  553. </el-space>
  554. </template>
  555. </LjVxeTable>
  556. </template>
  557. <template #innerClothLayerMx__tabtitle="scope">
  558. <template v-if="innerClothLayerNum_error">
  559. <el-badge :value="innerClothLayerNum_error + '异常'" type="danger">
  560. {{ scope.props.label }}
  561. </el-badge>
  562. </template>
  563. <template v-else>
  564. <el-badge :value="innerClothLayerNum" type="primary" :show-zero="false">
  565. {{ scope.props.label }}
  566. </el-badge>
  567. </template>
  568. </template>
  569. <template #innerClothLayerMx>
  570. <LjVxeTable
  571. ref="innerClothLayerMxRef"
  572. row-key="key"
  573. table-cls="h-full"
  574. :request-api="getData_innerClothLayer"
  575. :data-callback="dataCallbackMx"
  576. :init-param="initParams"
  577. :columns="columnsMxInnerClothLayer"
  578. :dwname="DwnameEnum.mattressQuoteMxInnerClothLayer"
  579. :table-props="tableProps_mx"
  580. :tool-button="[]"
  581. :auto-load-layout="false"
  582. collapseButtons
  583. :footer-method="footerMethod"
  584. @after-mounted="resetMergeCellsInner"
  585. >
  586. <template #tableHeader v-if="orderStatus">
  587. <el-space wrap>
  588. <el-button type="primary" @click="handleToImportMxInner">{{ t("business.detail.importMx") }}</el-button>
  589. <el-button type="danger" @click="hanleDelMxInner(0)">{{ t("business.detail.deleteMx") }}</el-button>
  590. <el-button type="danger" @click="hanleDelMxInner(1)">{{ t("business.detail.deleteAllMx") }}</el-button>
  591. </el-space>
  592. </template>
  593. </LjVxeTable>
  594. </template>
  595. <template #topCottonMx__tabtitle="scope">
  596. <template v-if="topCottonNum_error">
  597. <el-badge :value="topCottonNum_error + '异常'" type="danger">
  598. {{ scope.props.label }}
  599. </el-badge>
  600. </template>
  601. <template v-else>
  602. <el-badge :value="topCottonNum" type="primary" :show-zero="false">
  603. {{ scope.props.label }}
  604. </el-badge>
  605. </template>
  606. </template>
  607. <template #topCottonMx>
  608. <LjVxeTable
  609. ref="topCottonMxRef"
  610. row-key="key"
  611. table-cls="h-full"
  612. :request-api="getData_topCotton"
  613. :data-callback="dataCallbackMx"
  614. :init-param="initParams"
  615. :columns="columnsMx"
  616. :dwname="DwnameEnum.mattressQuoteMx"
  617. :table-props="tableProps_mx"
  618. :tool-button="[]"
  619. :auto-load-layout="false"
  620. collapseButtons
  621. :footer-method="footerMethod"
  622. @after-mounted="resetMergeCellsTopCotton"
  623. >
  624. <template #tableHeader v-if="orderStatus">
  625. <el-space wrap>
  626. <el-dropdown placement="bottom-start" @command="wf_add_w_butao">
  627. <el-button type="primary">
  628. {{ t("common.addText") }}<el-icon class="el-icon--right"><ArrowDown /></el-icon>
  629. </el-button>
  630. <template #dropdown>
  631. <el-dropdown-menu>
  632. <el-dropdown-item v-for="item in topCottonAddList" :key="item.value" :command="item">{{
  633. item.label
  634. }}</el-dropdown-item>
  635. </el-dropdown-menu>
  636. </template>
  637. </el-dropdown>
  638. <el-button type="danger" @click="wf_del_w_butao">{{ t("common.delText") }}</el-button>
  639. </el-space>
  640. </template>
  641. </LjVxeTable>
  642. </template>
  643. <template #specialProcesses__tabtitle="scope">
  644. <el-badge :value="specialProcessesNum" type="primary" :show-zero="false">
  645. {{ scope.props.label }}
  646. </el-badge>
  647. </template>
  648. <template #specialProcesses>
  649. <LjVxeTable
  650. ref="specialProcessesMxRef"
  651. row-key="key"
  652. table-cls="h-full"
  653. :request-api="getData_specialProcesses"
  654. :data-callback="dataCallbackMx"
  655. :init-param="initParams"
  656. :columns="columnsMx_processes"
  657. :table-props="tableProps_mx"
  658. :tool-button="[]"
  659. :auto-load-layout="false"
  660. collapseButtons
  661. :footer-sum-attrs="['price']"
  662. >
  663. <template #tableHeader v-if="orderStatus">
  664. <el-space wrap>
  665. <el-button type="primary" @click="funcAddMtrlMx({}, null, 'specialProcessesMxRef', -1)">
  666. {{ t("common.addText") }}
  667. </el-button>
  668. <!-- <el-button type="danger" @click="funcDelMtrlMx()">{{ t("common.delText") }}</el-button> -->
  669. </el-space>
  670. </template>
  671. </LjVxeTable>
  672. </template>
  673. <template #additionalCosts__tabtitle="scope">
  674. <el-badge :value="additionalCostsNum" type="primary" :show-zero="false">
  675. {{ scope.props.label }}
  676. </el-badge>
  677. </template>
  678. <template #additionalCosts>
  679. <LjVxeTable
  680. ref="additionalCostsMxRef"
  681. row-key="key"
  682. table-cls="h-full"
  683. :request-api="getData_additionalCosts"
  684. :data-callback="dataCallbackMx"
  685. :init-param="initParams"
  686. :columns="columnsMx_additional"
  687. :table-props="tableProps_mx"
  688. :tool-button="[]"
  689. :auto-load-layout="false"
  690. collapseButtons
  691. :footer-sum-attrs="['price']"
  692. >
  693. <template #tableHeader v-if="orderStatus">
  694. <el-space wrap>
  695. <el-button type="primary" @click="funcAddMtrlMx({}, null, 'additionalCostsMxRef', -1)">
  696. {{ t("common.addText") }}
  697. </el-button>
  698. <!-- <el-button type="danger" @click="wf_del_w_butao">{{ t("common.delText") }}</el-button> -->
  699. </el-space>
  700. </template>
  701. </LjVxeTable>
  702. </template>
  703. <template #subSpecs__tabtitle="scope">
  704. <template v-if="LjDetailRef._mainData.parentid > 0">
  705. <el-badge value="副" type="primary" :show-zero="false">
  706. {{ scope.props.label }}
  707. </el-badge>
  708. </template>
  709. <el-badge v-else :value="subSpecsNum" type="primary" :show-zero="false">
  710. {{ scope.props.label }}
  711. </el-badge>
  712. </template>
  713. <template #subSpecs>
  714. <LjVxeTable
  715. v-if="columnsMx_subSpecs_dis.length"
  716. ref="subSpecsRef"
  717. row-key="key"
  718. table-cls="h-full"
  719. :request-auto="false"
  720. :data="subSpecsData"
  721. :columns="columnsMx_subSpecs_dis"
  722. :table-props="tableProps_subSpecs"
  723. :table-events="tableEvents"
  724. :tool-button="[]"
  725. :auto-load-layout="false"
  726. collapseButtons
  727. >
  728. <template #tableHeader>
  729. <el-space wrap v-if="orderStatus">
  730. <el-button type="primary" @click="toAddMx_subSpecs">{{ t("common.addText") }}</el-button>
  731. <el-button type="danger" @click="toDelMx_subSpecs">{{ t("common.delText") }}</el-button>
  732. </el-space>
  733. <el-space wrap v-else-if="!LjDetailRef._mainData.parentid && Number(LjDetailRef._mainData.flag) == 1">
  734. <template v-if="!editSubSpecs">
  735. <el-button type="primary" @click="toEdit_subSpecs">{{ t("common.editText") }}</el-button>
  736. </template>
  737. <template v-else>
  738. <el-button type="primary" @click="toAddMx_subSpecs">{{ t("common.addText") }}</el-button>
  739. <el-button type="danger" @click="toDelMx_subSpecs">{{ t("common.delText") }}</el-button>
  740. <el-divider direction="vertical" />
  741. <el-button type="success" @click="toSave_subSpecs" :loading="loadingStatus.save">{{
  742. t("common.saveText")
  743. }}</el-button>
  744. <el-button type="default" @click="toCancel_subSpecs">{{ t("common.cancelText") }}</el-button>
  745. </template>
  746. </el-space>
  747. <el-space wrap v-if="LjDetailRef._mainData.parentid > 0">
  748. <el-button type="primary" @click="gotoMainMattress">查看主规格</el-button>
  749. </el-space>
  750. </template>
  751. </LjVxeTable>
  752. </template>
  753. </LjDetail>
  754. <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" />
  755. <BednetDialog ref="BednetDialogRef" v-bind="BednetDialogProps" />
  756. <LjDrawerQuoteList ref="QuoteListDrawerRef" :iforigin="isShowOriginFormulaMattress" @export="handleExportQuote" />
  757. <AllFormula
  758. ref="AllFormulaRef"
  759. :iforigin="isShowOriginFormulaMattress"
  760. :dannum_type="currentType"
  761. :formula="cmpFormulas"
  762. :replace="cmpFormulaReplace"
  763. :formula_ori="cmpFormulasOri"
  764. :formula_bednet="cmpFormulasBednet"
  765. :differ="cmpDiffer"
  766. />
  767. <LjDrawer ref="LjDrawerRef" class="lj-drawer-win" size="80%" direction="btt" :title="drawerTitle">
  768. <BednetDetail
  769. :mattress-width="LjDetailRef._mainData.mattress_width"
  770. :mattress-length="LjDetailRef._mainData.mattress_length"
  771. :ifcopy="ifcopy"
  772. :ifnotoutper="1"
  773. v-bind="bednetDrawerProps"
  774. @aftersave="autoBednetSave"
  775. @aftercancel="LjDrawerRef.hide()"
  776. />
  777. </LjDrawer>
  778. </template>
  779. <script setup lang="ts" name="mattressQuoteEdit">
  780. import { ref, watch, reactive, inject, nextTick, computed, onMounted, getCurrentInstance } from "vue";
  781. import { DwnameEnum } from "@/enums/dwnameEnum";
  782. import LjDetail from "@/components/LjDetail/index.vue";
  783. import { DetailProp } from "@/components/LjDetail/interface";
  784. import { useI18n } from "vue-i18n";
  785. import { useHooks } from "./hooks/index";
  786. import { useHooksCpQuote } from "./hooks/cpQuote";
  787. import { useAuthButtons } from "@/hooks/useAuthButtons";
  788. import LjVxeTable from "@/components/LjVxeTable/index.vue";
  789. import { cloneDeep } from "lodash-es";
  790. import { useRoute, useRouter } from "vue-router";
  791. import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
  792. import {
  793. SaveMattress,
  794. SaveMattressAuditing,
  795. DelMattress,
  796. GetMattressImportDW2,
  797. GetMattressSubspecs,
  798. SaveMattressSubSpecs
  799. } from "@/api/modules/quote";
  800. // import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
  801. import { TYPE, useToast, POSITION } from "vue-toastification";
  802. import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
  803. import { ArrowDown } from "@element-plus/icons-vue";
  804. // import { calculateFormula } from "@/utils/index";
  805. import MtrldefDialog from "@/views/system/selector/mtrldef/index.vue";
  806. import BednetDialog from "@/views/system/selector/bednet/index.vue";
  807. // import LjDrawerQuoteList from "./components/QuoteList.vue";
  808. import LjDrawerQuoteList from "./components/QuoteListNew.vue";
  809. import mittBus from "@/utils/mittBus";
  810. import { MittEnum } from "@/enums/mittEnum";
  811. import { getCurrentRecords, floatAdd, floatMul } from "@/utils/index";
  812. import { useUserStore } from "@/stores/modules/user";
  813. import AllFormula from "./components/AllFormula.vue";
  814. import LjDrawer from "@/components/LjDrawer/index.vue";
  815. import BednetDetail from "@/views/quote/bednetQuote/detail.vue";
  816. import Statistic from "./components/Statistic.vue";
  817. import variables from "@/styles/js.module.scss";
  818. import { useGlobalStore } from "@/stores/modules/global";
  819. // interface detailProp {
  820. // // /**
  821. // // * @argument any 页面数据
  822. // // */
  823. // // data1?: any;
  824. // // /**
  825. // // * @argument string 请求数据的api ==> 非必传
  826. // // */
  827. // // requestApi?: (params: any) => Promise<any>;
  828. // // /**
  829. // // * @argument any 基础信息,表格展示数据
  830. // // */
  831. // // // columns?: any;
  832. // // /**
  833. // // * @description 是否可编辑
  834. // // */
  835. // // status: "edit" | "new" | string;
  836. // }
  837. // const props = withDefaults(defineProps<detailProp>(), {});
  838. const { t } = useI18n();
  839. const route = useRoute();
  840. const router = useRouter();
  841. const globalStore = useGlobalStore();
  842. // const { isShowOriginFormulaMattress } = storeToRefs(globalStore);
  843. const ifcopy = ref(false);
  844. const showOriginFormulaMattress = (value: any) => {
  845. globalStore.setGlobalState("isShowOriginFormulaMattress", Boolean(value));
  846. // 刷新页面
  847. router.go(0);
  848. // LjDetailRef.value.refresh();
  849. };
  850. const _variables: any = variables;
  851. const {
  852. columns,
  853. columnsMx,
  854. columnsMxBednet,
  855. columnsMxCushions,
  856. columnsMxAccessories,
  857. columnsMxPackag,
  858. columnsMxInnerClothLayer,
  859. columnsMx_processes,
  860. columnsMx_additional,
  861. LjDetailRef,
  862. MtrldefDialogRef,
  863. MtrldefDialogProps,
  864. BednetDialogRef,
  865. BednetDialogProps,
  866. fabricMxTabList,
  867. mattresstypeEnum,
  868. fabricMxTabs,
  869. fabricMxTab8Ref,
  870. fabricMxTab9Ref,
  871. fabricMxTab10Ref,
  872. fabricMxTab11Ref,
  873. fabricMxTab12Ref,
  874. fabricMxTab13Ref,
  875. fabricMxTab8,
  876. fabricMxTab9,
  877. fabricMxTab10,
  878. fabricMxTab11,
  879. fabricMxTab12,
  880. fabricMxTab13,
  881. fabricMx10NewMtrlGroup,
  882. fabricMx11NewMtrlGroup,
  883. fabricMx13NewMtrlGroup,
  884. initParams,
  885. cushionsMxData,
  886. fabricMxData,
  887. accessoriesMxData,
  888. bednetMxData,
  889. packagMxData,
  890. oriMxData,
  891. orderStatus,
  892. showFormula,
  893. QuoteListDrawerRef,
  894. formulaKindEnum,
  895. bednetMxRef,
  896. cushionsMxRef,
  897. accessoriesMxRef,
  898. packagMxRef,
  899. innerClothLayerMxRef,
  900. topCottonMxRef,
  901. packtypeOptions,
  902. woodpallettypeOptions,
  903. areaOptions,
  904. cabinetTypeOptions,
  905. topCottonAddList,
  906. AllFormulaRef,
  907. LjDrawerRef,
  908. cmpFormulas,
  909. cmpFormulaReplace,
  910. cmpFormulasOri,
  911. cmpFormulasBednet,
  912. cmpDiffer,
  913. subSpecsRef,
  914. columnsMx_subSpecs,
  915. diancengAreaEnum,
  916. specialProcessesMxRef,
  917. additionalCostsMxRef,
  918. specialProcessesMxData,
  919. additionalCostsMxData,
  920. specialProcessesMxInitData,
  921. additionalCostsMxInitData,
  922. specialProcessesEnum,
  923. additionalCostsEnum,
  924. isShowOriginFormulaMattress,
  925. columnsMx_subSpecs_dis,
  926. subSpecsData,
  927. funcAddMxSide,
  928. funcChaifenTab,
  929. getData_mx,
  930. dataCallback,
  931. dataCallbackMx,
  932. getMattressType,
  933. gotoSummy,
  934. gotoHisprice,
  935. getFormulakindEnum,
  936. funcPacktypeChange,
  937. dynamicRef,
  938. wf_cmp_cb,
  939. handleToImportMxInner,
  940. hanleDelMxInner,
  941. wf_add_w_butao,
  942. wf_del_w_butao,
  943. w_mattress_add_itemname_choose,
  944. wf_rtr_bednet,
  945. funcAddMtrlMx,
  946. resetMergeCellsInner,
  947. resetMergeCellsTopCotton,
  948. wf_rtr_cwdc,
  949. resetSpecialProcesses,
  950. gotoErpapi,
  951. updateSubspecsTable,
  952. autoLoadExtraData,
  953. autoLoadExtraData_chai,
  954. getAllFormulaList,
  955. setMxSpringQtyWidthAndLength,
  956. funcAddGongYi
  957. } = useHooks(t);
  958. const { toExcelQuote, toExcelQuoteNew } = useHooksCpQuote();
  959. const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
  960. const { userInfo } = useUserStore();
  961. // const toast = useToast();
  962. // const orderStatus = ref("");
  963. // const mainData = ref([]);
  964. const tabRemove: Function = inject("tabRemove") as Function;
  965. const defaultColumnsValue = ref<any>({});
  966. const mxLoading = ref(false);
  967. const drawerTitle = ref("");
  968. const bednetDrawerProps = reactive({
  969. bednetid: 0,
  970. state: "",
  971. deptid: 0,
  972. onlyView: false,
  973. dannum_type: 0
  974. });
  975. const footerMethod = ({ columns, data }: any) => {
  976. // 返回一个二维数组的表尾合计
  977. return [
  978. columns.map((column: any, columnIndex: number) => {
  979. if (columnIndex === 0) {
  980. return "合计";
  981. }
  982. if (columnIndex === 1) {
  983. return data.length;
  984. }
  985. // if ((column.field && column.field.indexOf("qty") > -1) || props.footerSumAttrs?.includes(column.field)) {
  986. if ((column.field && column.field.indexOf("qty") > -1) || (column.field && column.field.indexOf("amt") > -1)) {
  987. let count = 0;
  988. data.forEach((item: any) => {
  989. count = floatAdd(count, isNaN(Number(item[column.field])) ? 0 : Number(item[column.field]));
  990. });
  991. return count;
  992. } else if (column.field && column.field.indexOf("dannum") > -1) {
  993. let count = 0;
  994. let fieldCost = column.field.split("_");
  995. let _field = fieldCost[0] + "_cost";
  996. column.field.indexOf("dannum") > -1;
  997. data.forEach((item: any) => {
  998. if (item.hasOwnProperty(_field)) {
  999. count = floatAdd(count, item[_field]);
  1000. } else {
  1001. count = floatAdd(count, floatMul(Number(item.costamt), 1 + item[column.field]));
  1002. }
  1003. });
  1004. return count;
  1005. }
  1006. })
  1007. ];
  1008. };
  1009. /**
  1010. * @description 明细表格组件基础配置
  1011. */
  1012. const tableProps_mx = ref({
  1013. height: "auto",
  1014. align: "left",
  1015. // height: "",
  1016. minHeight: "100px",
  1017. editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
  1018. // exportConfig: {
  1019. // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
  1020. // }
  1021. editRules: {
  1022. mattress_width: [
  1023. {
  1024. validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
  1025. const { _mainData } = LjDetailRef.value;
  1026. let _value = Number(cellValue);
  1027. if (_value < 0) {
  1028. return new Error("不能小于0");
  1029. }
  1030. if (!isNaN(_value) && _value > Number(_mainData.mattress_width)) {
  1031. return new Error("不能大于床垫尺寸");
  1032. }
  1033. return true;
  1034. }
  1035. }
  1036. ],
  1037. mattress_length: [
  1038. {
  1039. validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
  1040. const { _mainData } = LjDetailRef.value;
  1041. let _value = Number(cellValue);
  1042. if (_value < 0) {
  1043. return new Error("不能小于0");
  1044. }
  1045. if (!isNaN(_value) && _value > Number(_mainData.mattress_length)) {
  1046. return new Error("不能大于床垫尺寸");
  1047. }
  1048. return true;
  1049. }
  1050. }
  1051. ]
  1052. },
  1053. keyboardConfig: {
  1054. isEdit: true,
  1055. isArrow: true,
  1056. isEnter: true,
  1057. isTab: true,
  1058. isDel: true,
  1059. isBack: true,
  1060. isEsc: true,
  1061. editMethod({ $table, row, column }) {
  1062. // 先清空原先的值
  1063. row[column.field] = "";
  1064. // 再激活编辑状态并输入新值
  1065. $table.setEditCell(row, column);
  1066. }
  1067. },
  1068. mouseConfig: {
  1069. selected: true
  1070. }
  1071. });
  1072. // const tableEventsMx = {
  1073. // "edit-activated": ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) => {
  1074. // console.log("thickness row editDisabled:>> ", row.if_inputqty, row.formulakind);
  1075. // if (column.field === "thickness") {
  1076. // return !(
  1077. // (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
  1078. // row.formulakind == 7 ||
  1079. // row.formulakind == 202
  1080. // );
  1081. // }
  1082. // },
  1083. // "edit-disabled": ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) => {
  1084. // console.log("thickness row editDisabled:>> ", row.if_inputqty, row.formulakind);
  1085. // if (column.field === "thickness") {
  1086. // return !(
  1087. // (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
  1088. // row.formulakind == 7 ||
  1089. // row.formulakind == 202
  1090. // );
  1091. // }
  1092. // }
  1093. // };
  1094. const tableProps_subSpecs = ref({
  1095. height: "auto",
  1096. align: "left",
  1097. // height: "",
  1098. minHeight: "100px",
  1099. editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
  1100. // exportConfig: {
  1101. // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
  1102. // }
  1103. keyboardConfig: {
  1104. isEdit: true,
  1105. isArrow: true,
  1106. isEnter: true,
  1107. isTab: true,
  1108. isDel: true,
  1109. isBack: true,
  1110. isEsc: true,
  1111. editMethod({ $table, row, column }) {
  1112. // 先清空原先的值
  1113. row[column.field] = "";
  1114. // 再激活编辑状态并输入新值
  1115. $table.setEditCell(row, column);
  1116. }
  1117. },
  1118. mouseConfig: {
  1119. selected: true
  1120. }
  1121. });
  1122. // const keyboardConfig = ref<any>({
  1123. // isEdit: true,
  1124. // isArrow: true,
  1125. // isEnter: true,
  1126. // isTab: true,
  1127. // isDel: true,
  1128. // isBack: true,
  1129. // isEsc: true,
  1130. // editMethod({ $table, row, column }) {
  1131. // // 先清空原先的值
  1132. // row[column.field] = "";
  1133. // // 再激活编辑状态并输入新值
  1134. // $table.setEditCell(row, column);
  1135. // }
  1136. // });
  1137. const isTabsBadge_packag = computed(() => {
  1138. let arr = [];
  1139. arr = packagMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1140. return arr.length;
  1141. });
  1142. const isTabsBadge_packag_error = computed(() => {
  1143. let arr = [];
  1144. arr = packagMxData.value.filter(t => Number(t.if_success));
  1145. return arr.length;
  1146. });
  1147. const isTabsBadge_cushions = computed(() => {
  1148. let arr = [];
  1149. arr = cushionsMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1150. return arr.length;
  1151. });
  1152. const isTabsBadge_cushions_error = computed(() => {
  1153. let arr = [];
  1154. console.log("isTabsBadge_cushions_error cushionsMxData.value:>> ", cushionsMxData.value);
  1155. arr = cushionsMxData.value.filter(t => Number(t.if_success));
  1156. return arr.length;
  1157. });
  1158. const isTabsBadge_accessories = computed(() => {
  1159. let arr = [];
  1160. arr = accessoriesMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1161. return arr.length;
  1162. });
  1163. const isTabsBadge_accessories_error = computed(() => {
  1164. let arr = [];
  1165. arr = accessoriesMxData.value.filter(t => Number(t.if_success));
  1166. return arr.length;
  1167. });
  1168. const isTabsBadge_bednet = computed(() => {
  1169. let arr = [];
  1170. const $table = bednetMxRef.value?.element;
  1171. if ($table) {
  1172. arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1173. }
  1174. return arr.length;
  1175. });
  1176. const isTabsBadge_bednet_error = computed(() => {
  1177. let arr = [];
  1178. arr = bednetMxData.value.filter(t => Number(t.if_success));
  1179. return arr.length;
  1180. });
  1181. const isTabsBadge_fabric = computed(() => {
  1182. let arr = [];
  1183. arr = fabricMxTab8.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1184. arr = arr.concat(fabricMxTab9.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1185. arr = arr.concat(fabricMxTab10.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1186. arr = arr.concat(fabricMxTab11.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1187. arr = arr.concat(fabricMxTab12.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1188. arr = arr.concat(fabricMxTab13.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1189. console.log("isTabsBadge_fabric arr :>> ", arr);
  1190. return arr.length;
  1191. });
  1192. const isTabsBadge_fabric_error = computed(() => {
  1193. let arr = [];
  1194. arr = fabricMxTab8.value.filter(t => Number(t.if_success));
  1195. arr = arr.concat(fabricMxTab9.value.filter(t => Number(t.if_success)));
  1196. arr = arr.concat(fabricMxTab10.value.filter(t => Number(t.if_success)));
  1197. arr = arr.concat(fabricMxTab11.value.filter(t => Number(t.if_success)));
  1198. arr = arr.concat(fabricMxTab12.value.filter(t => Number(t.if_success)));
  1199. arr = arr.concat(fabricMxTab13.value.filter(t => Number(t.if_success)));
  1200. return arr.length;
  1201. });
  1202. const isFilterErrorBadge = data => {
  1203. let arr = [];
  1204. arr = data.filter(t => Number(t.if_success));
  1205. return arr.length;
  1206. };
  1207. const isFilterSucessBadge = data => {
  1208. let arr = [];
  1209. arr = data.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1210. return arr.length;
  1211. };
  1212. const isQuoteListMxData = computed(() => {
  1213. let innerData = [];
  1214. if (innerClothLayerMxRef.value) {
  1215. innerData = innerClothLayerMxRef.value?.element.getTableData()?.visibleData;
  1216. }
  1217. let topCottonData = [];
  1218. if (topCottonMxRef.value) {
  1219. topCottonData = topCottonMxRef.value?.element.getTableData()?.visibleData;
  1220. }
  1221. return [
  1222. {
  1223. label: "面裥绵",
  1224. field: "tabpage_8",
  1225. replace: "面裥绵-",
  1226. data: fabricMxTab8.value
  1227. },
  1228. {
  1229. label: "底裥绵",
  1230. field: "tabpage_9",
  1231. replace: "底裥绵-",
  1232. data: fabricMxTab9.value
  1233. },
  1234. {
  1235. label: "裥大侧",
  1236. field: "tabpage_10",
  1237. replace: "大侧裥绵-",
  1238. data: fabricMxTab10.value
  1239. },
  1240. {
  1241. label: "裥小侧",
  1242. field: "tabpage_11",
  1243. replace: "小侧裥绵-",
  1244. data: fabricMxTab11.value
  1245. },
  1246. {
  1247. label: "裥V侧",
  1248. field: "tabpage_12",
  1249. replace: "V侧裥绵-",
  1250. data: fabricMxTab12.value
  1251. },
  1252. {
  1253. label: "其他工艺",
  1254. field: "tabpage_13",
  1255. replace: "V侧裥绵-",
  1256. data: fabricMxTab13.value
  1257. },
  1258. {
  1259. label: "垫层",
  1260. field: "cushions",
  1261. data: {
  1262. cushions: cushionsMxData.value,
  1263. bednet: bednetMxData.value
  1264. }
  1265. },
  1266. {
  1267. label: "辅料",
  1268. field: "accessories",
  1269. data: accessoriesMxData.value
  1270. },
  1271. {
  1272. label: "包装",
  1273. field: "packag",
  1274. data: packagMxData.value
  1275. },
  1276. {
  1277. label: "内布套",
  1278. field: "innerClothLayerMx",
  1279. data: innerData
  1280. },
  1281. {
  1282. label: "顶布裥棉",
  1283. field: "topCottonMx",
  1284. data: topCottonData
  1285. }
  1286. ];
  1287. });
  1288. /**
  1289. * @description tab 面料
  1290. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1291. */
  1292. // /**
  1293. // * @description 面料数据
  1294. // */
  1295. // const fabricMxData = ref([]);
  1296. // const fabricMxTabData = ref([]);
  1297. // const fabricMxTabs = ref("fabricMx");
  1298. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1299. /**
  1300. * @description tab 床网
  1301. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1302. */
  1303. // /**
  1304. // * @description 床网数据
  1305. // */
  1306. // const bednetMxData = ref([]);
  1307. // const getData_cushions = (params: any) => {
  1308. // console.log("getData params :>> ", params);
  1309. // let newParams: any = {};
  1310. // params.pageNum && (newParams.pageindex = params.pageNum);
  1311. // params.pageSize && (newParams.pagesize = params.pageSize);
  1312. // delete params.pageNum;
  1313. // delete params.pageSize;
  1314. // newParams.queryParams = params;
  1315. // console.log("params :>> ", params);
  1316. // newParams.dsname = "web_mattress_mx_dianceng";
  1317. // return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxBednet);
  1318. // };
  1319. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1320. /**
  1321. * @description tab 垫层
  1322. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1323. */
  1324. // /**
  1325. // * @description 垫层数据
  1326. // */
  1327. // const cushionsMxData = ref([]);
  1328. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1329. /**
  1330. * @description tab 辅料
  1331. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1332. */
  1333. // /**
  1334. // * @description 辅料数据
  1335. // */
  1336. // const accessoriesMxData = ref([]);
  1337. // const getData_bednet = (params: any) => {
  1338. // console.log("getData params :>> ", params);
  1339. // let newParams: any = {};
  1340. // params.pageNum && (newParams.pageindex = params.pageNum);
  1341. // params.pageSize && (newParams.pagesize = params.pageSize);
  1342. // delete params.pageNum;
  1343. // delete params.pageSize;
  1344. // newParams.queryParams = params;
  1345. // console.log("params :>> ", params);
  1346. // newParams.dsname = "web_mattress_mx_bednet";
  1347. // return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxAccessories);
  1348. // };
  1349. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1350. /**
  1351. * @description tab 包装
  1352. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1353. */
  1354. // /**
  1355. // * @description 包装数据
  1356. // */
  1357. // const packagMxData = ref([]);
  1358. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1359. /**
  1360. * @description tab 内布套
  1361. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1362. */
  1363. /**
  1364. * @description 内布套数据
  1365. */
  1366. // const innerClothLayerMxData = ref([]);
  1367. // const innerClothLayerMxRef = ref();
  1368. const innerClothLayerNum = computed(() => {
  1369. let arr = [];
  1370. const $table = innerClothLayerMxRef.value?.element;
  1371. if ($table) {
  1372. arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1373. }
  1374. return arr.length;
  1375. });
  1376. const innerClothLayerNum_error = computed(() => {
  1377. let arr = [];
  1378. const $table = innerClothLayerMxRef.value?.element;
  1379. if ($table) {
  1380. arr = $table.getTableData().visibleData.filter(t => Number(t.if_success));
  1381. }
  1382. return arr.length;
  1383. });
  1384. const getData_innerClothLayer = (params: any) => {
  1385. console.log("getData params :>> ", params);
  1386. let newParams: any = {};
  1387. params.pageNum && (newParams.pageindex = params.pageNum);
  1388. params.pageSize && (newParams.pagesize = params.pageSize);
  1389. delete params.pageNum;
  1390. delete params.pageSize;
  1391. newParams.queryParams = params;
  1392. newParams.queryParams.arg_formulatype = [101, 102];
  1393. console.log("params :>> ", params);
  1394. newParams.dsname = "web_mattress_mx_neibutao";
  1395. return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxInnerClothLayer);
  1396. };
  1397. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1398. /**
  1399. * @description tab 顶部裥棉
  1400. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1401. */
  1402. // const topCottonMxRef = ref();
  1403. const topCottonNum = computed(() => {
  1404. let arr = [];
  1405. const $table = topCottonMxRef.value?.element;
  1406. if ($table) {
  1407. arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1408. }
  1409. return arr.length;
  1410. });
  1411. const topCottonNum_error = computed(() => {
  1412. let arr = [];
  1413. const $table = topCottonMxRef.value?.element;
  1414. if ($table) {
  1415. arr = $table.getTableData().visibleData.filter(t => Number(t.if_success));
  1416. }
  1417. return arr.length;
  1418. });
  1419. const getData_topCotton = async (params: any) => {
  1420. if (!Object.keys(initParams.value).includes("arg_mattressid") || initParams.value.arg_mattressid == 0) return false;
  1421. let _params = { ...params, arg_formulatype: [103] };
  1422. return await getData_mx(_params);
  1423. };
  1424. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1425. /**
  1426. * @description 主副规格
  1427. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1428. */
  1429. const subSpecsNum = computed(() => {
  1430. let arr = [];
  1431. const $table = subSpecsRef.value?.element;
  1432. if ($table) {
  1433. arr = $table.getTableData().visibleData;
  1434. }
  1435. return arr.length;
  1436. });
  1437. const getData_subSpecs = (params?: any) => {
  1438. console.log("getData_subSpecs getData params :>> ", params);
  1439. let newParams: any = {};
  1440. newParams.mattressid = initParams.value.arg_mattressid;
  1441. newParams.type = orderStatus.value == "copy" ? 1 : 0;
  1442. return GetMattressSubspecs(newParams);
  1443. };
  1444. const dataCallbackSubspecs = (data: any) => {
  1445. let cols = [];
  1446. let list = data.mattresses.map((item: any, index: any) => {
  1447. let _item = {
  1448. ...item,
  1449. mattress_width: item.mattress_width,
  1450. mattress_length: item.mattress_length,
  1451. mattress_height: item.mattress_height,
  1452. mattressid: item.mattressid,
  1453. mattresscode: item.mattresscode,
  1454. mattressname: item.mattressname,
  1455. mattressrelcode: item.mattressrelcode
  1456. };
  1457. delete _item.spring_qty_width;
  1458. delete _item.spring_qty_length;
  1459. let bednetMxs = data.bednetMxs.filter((t: any) => t.mattressid == item.mattressid);
  1460. console.log("dataCallbackSubspecs bednetMxs :>> ", bednetMxs);
  1461. if (bednetMxs.length > 0) {
  1462. bednetMxs
  1463. .filter(bItem => bItem.mattressid == item.mattressid)
  1464. .map((bItem, idx) => {
  1465. _item["spring_qty_width_" + (idx + 1)] = bItem.spring_qty_width;
  1466. _item["spring_qty_length_" + (idx + 1)] = bItem.spring_qty_length;
  1467. _item["bednet_iffork_" + (idx + 1)] = bItem.bednet_iffork;
  1468. _item["bednet_fork_qty_" + (idx + 1)] = bItem.bednet_fork_qty;
  1469. });
  1470. }
  1471. let mtrlList = data.mtrllist.filter((t: any) => t.mattressid == item.mattressid);
  1472. if (mtrlList.length > 0) {
  1473. mtrlList.map((bItem, idx) => {
  1474. if (bItem.formulatype === 1) {
  1475. _item["cushions_subspecs_" + (idx + 1)] = bItem.mtrlid;
  1476. _item["cushions_subspecs_formulakind_" + (idx + 1)] = bItem.formulakind;
  1477. _item["cushions_subspecs_mtrlname_" + (idx + 1)] = bItem.mtrlname;
  1478. } else if (bItem.formulatype === 2) {
  1479. _item["accessories_subspecs_" + (idx + 1)] = bItem.mtrlid;
  1480. _item["accessories_subspecs_formulakind_" + (idx + 1)] = bItem.formulakind;
  1481. _item["accessories_subspecs_mtrlname_" + (idx + 1)] = bItem.mtrlname;
  1482. _item["accessories_subspecs_qty_" + (idx + 1)] = bItem.qty;
  1483. }
  1484. });
  1485. }
  1486. return _item;
  1487. });
  1488. console.log("list dataCallbackSubspecs:>> ", list, columnsMx_subSpecs);
  1489. // columnsMx_subSpecs_dis.value = columnsMx_subSpecs.concat(cols);
  1490. console.log("list dataCallbackSubspecs:>> ", columnsMx_subSpecs_dis.value);
  1491. return {
  1492. list
  1493. // tableinfo: { columns: columnsMx_subSpecs_dis.value }
  1494. };
  1495. };
  1496. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1497. /**
  1498. * @description 特殊工艺
  1499. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1500. */
  1501. const specialProcessesNum = computed(() => {
  1502. let arr = [];
  1503. const $table = specialProcessesMxRef.value?.element;
  1504. if ($table) {
  1505. arr = $table.getTableData().visibleData.filter(t => t.extraid && Number(t.extraid) > 0);
  1506. }
  1507. return arr.length;
  1508. });
  1509. const getData_specialProcesses = (params: any) => {
  1510. let newParams: any = {};
  1511. params.pageNum && (newParams.pageindex = params.pageNum);
  1512. params.pageSize && (newParams.pagesize = params.pageSize);
  1513. delete params.pageNum;
  1514. delete params.pageSize;
  1515. newParams.queryParams = params;
  1516. newParams.queryParams.arg_typeid = 1; // 1:特殊工艺 2:额外费用
  1517. console.log("params :>> ", params);
  1518. newParams.dsname = "web_mattress_mx_extra";
  1519. return CommonDynamicSelect(newParams);
  1520. };
  1521. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1522. /**
  1523. * @description 额外费用
  1524. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1525. */
  1526. const additionalCostsNum = computed(() => {
  1527. let arr = [];
  1528. const $table = additionalCostsMxRef.value?.element;
  1529. if ($table) {
  1530. arr = $table.getTableData().visibleData.filter(t => t.extraid && Number(t.extraid) > 0);
  1531. }
  1532. return arr.length;
  1533. });
  1534. const getData_additionalCosts = (params: any) => {
  1535. let newParams: any = {};
  1536. params.pageNum && (newParams.pageindex = params.pageNum);
  1537. params.pageSize && (newParams.pagesize = params.pageSize);
  1538. delete params.pageNum;
  1539. delete params.pageSize;
  1540. newParams.queryParams = params;
  1541. newParams.queryParams.arg_typeid = 2;
  1542. console.log("params :>> ", params);
  1543. newParams.dsname = "web_mattress_mx_extra";
  1544. return CommonDynamicSelect(newParams);
  1545. };
  1546. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1547. const detailProps = reactive<DetailProp>({
  1548. dwname: DwnameEnum.mattressQuote,
  1549. dsname: "web_mattress",
  1550. columns: columns,
  1551. // headerstatus: ["status", "ifamt_ok"],
  1552. basicDefault: {},
  1553. header: {
  1554. fieldNames: {
  1555. code: "sptcode",
  1556. codeLabel: t("table.u_spt.sptcode") + ":",
  1557. name: "name"
  1558. },
  1559. // icon: "iconclipboard",
  1560. // tabsProp: {
  1561. // scrollspy: true,
  1562. // sticky: true
  1563. // }
  1564. floatbtn: [
  1565. {
  1566. id: "oaFlow",
  1567. originLeft: 100,
  1568. originTop: 50
  1569. }
  1570. ]
  1571. },
  1572. mould: [
  1573. {
  1574. id: "fabricMx",
  1575. type: "table",
  1576. label: t("business.detail.fabric")
  1577. },
  1578. {
  1579. id: "bednetMx",
  1580. type: "table",
  1581. label: t("business.detail.bednet")
  1582. },
  1583. {
  1584. id: "cushionsMx",
  1585. type: "table",
  1586. label: t("business.detail.cushions")
  1587. },
  1588. {
  1589. id: "accessoriesMx",
  1590. type: "table",
  1591. label: t("business.detail.accessories")
  1592. },
  1593. {
  1594. id: "packagMx",
  1595. type: "table",
  1596. label: t("business.detail.packag")
  1597. },
  1598. {
  1599. id: "innerClothLayerMx",
  1600. type: "table",
  1601. label: t("business.detail.innerClothLayer"),
  1602. limited: (params: any) => {
  1603. if (!params) return true;
  1604. return !params?.if_n_butao || params?.if_n_butao == "0";
  1605. }
  1606. },
  1607. {
  1608. id: "topCottonMx",
  1609. type: "table",
  1610. label: t("business.detail.topCotton"),
  1611. limited: (params: any) => {
  1612. if (!params) return true;
  1613. return !params?.if_w_butao || params?.if_w_butao == "0";
  1614. }
  1615. },
  1616. {
  1617. id: "specialProcesses",
  1618. type: "table",
  1619. label: t("business.detail.specialProcesses")
  1620. },
  1621. {
  1622. id: "additionalCosts",
  1623. type: "table",
  1624. label: t("business.detail.additionalCosts")
  1625. },
  1626. {
  1627. id: "subSpecs",
  1628. type: "table",
  1629. label: t("business.detail.subSpecs")
  1630. }
  1631. ]
  1632. });
  1633. // const getData = (params: any) => {
  1634. // console.log("getData params :>> ", params);
  1635. // let newParams: any = {};
  1636. // params.pageNum && (newParams.pageindex = params.pageNum);
  1637. // params.pageSize && (newParams.pagesize = params.pageSize);
  1638. // delete params.pageNum;
  1639. // delete params.pageSize;
  1640. // newParams.queryParams = params;
  1641. // console.log("params :>> ", params);
  1642. // newParams.dsname = "web_mattress";
  1643. // return CommonDynamicSelect(newParams, DwnameEnum.mattressQuote);
  1644. // // return [];
  1645. // };
  1646. const currentType = ref(1);
  1647. const gotoShowFormula = (type: any) => {
  1648. currentType.value = type;
  1649. AllFormulaRef.value.open();
  1650. };
  1651. const loadingStatus = reactive({
  1652. save: false,
  1653. download: false
  1654. });
  1655. const save = async () => {
  1656. console.log("save LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
  1657. console.log("save------------ :>> ", loadingStatus.save);
  1658. console.log("save cushionsMxData :>> ", cushionsMxData.value);
  1659. try {
  1660. await LjDetailRef.value.toValidateForm();
  1661. if (!(await wf_cmp_cb())) return;
  1662. let mattress = LjDetailRef.value._mainData;
  1663. mattress.mattressid = Number(mattress.mattressid ?? 0);
  1664. mattress.xd_flag = Number(mattress.xd_flag ?? 0);
  1665. console.log("bbbbbbbbbbbbbbbbbbbb mattress :>> ", mattress);
  1666. // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
  1667. // mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
  1668. // mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
  1669. // mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
  1670. // mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
  1671. // mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
  1672. // mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
  1673. // mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
  1674. // mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
  1675. let mattressMx = [];
  1676. try {
  1677. fabricMxTabList.value.map(t => {
  1678. if (t.ref) {
  1679. console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
  1680. if (dynamicRef(t.ref) && !["specialProcessesMxRef", "additionalCostsMxRef"].includes(t.ref)) {
  1681. let $table = dynamicRef(t.ref)?.element;
  1682. $table.clearEdit();
  1683. let { visibleData } = $table.getTableData();
  1684. console.log("visibleData t.ref?.value :>> ", t.ref, visibleData);
  1685. visibleData = visibleData.map((itm, idx) => {
  1686. // 检查明细输入是否正确
  1687. let _disabled = !(
  1688. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(itm.formulakind)) ||
  1689. itm.formulakind == 202 ||
  1690. itm.formulakind == 7
  1691. );
  1692. console.log("_disabled :>> ", _disabled);
  1693. if (t.ref == "cushionsMxRef") {
  1694. _disabled = !(
  1695. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
  1696. itm.formulakind == 7 ||
  1697. itm.formulakind == 999
  1698. );
  1699. } else if (t.ref == "innerClothLayerMxRef") {
  1700. _disabled = !(
  1701. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
  1702. itm.formulakind == 202 ||
  1703. itm.formulakind == 203
  1704. );
  1705. }
  1706. console.log(
  1707. "itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0 :>> ",
  1708. _disabled,
  1709. itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0
  1710. );
  1711. if (itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0) {
  1712. throw new Error(t.label + "相关厚度输入有误,请检查");
  1713. }
  1714. itm.xu = idx + 1;
  1715. itm.mattress_width = Number(itm?.mattress_width ?? 0);
  1716. itm.mattress_length = Number(itm?.mattress_length ?? 0);
  1717. return itm;
  1718. });
  1719. mattressMx = mattressMx.concat(visibleData);
  1720. }
  1721. }
  1722. });
  1723. } catch (error) {
  1724. ElMessage.error(error.message);
  1725. return false;
  1726. }
  1727. if (orderStatus.value == "copy") {
  1728. mattress.copy_id = mattress.mattressid;
  1729. mattress.parentid = 0;
  1730. }
  1731. // 主副规格
  1732. let subspecs = [];
  1733. let $table_subspecs = subSpecsRef.value?.element;
  1734. if ($table_subspecs) {
  1735. $table_subspecs.clearEdit();
  1736. subspecs = $table_subspecs.getTableData().visibleData;
  1737. console.log("主副规格 subspecs :>> ", subspecs);
  1738. try {
  1739. // 忽略长宽高没填的明细行
  1740. subspecs = subspecs.filter(
  1741. itm => Number(itm.mattress_width) > 0 || Number(itm.mattress_length) > 0 || Number(itm.mattress_height) > 0
  1742. );
  1743. let ifHas99 = mattressMx.filter(itm => itm.formulakind == 99 && itm.mtrlid > 0);
  1744. if (ifHas99.length > 0) {
  1745. subspecs.map(itm => {
  1746. if (Number(itm.mattress_width) <= 0 || Number(itm.mattress_length) <= 0 || Number(itm.mattress_height) <= 0) {
  1747. throw new Error("主副规格相关尺寸输入有误(不能为空),请输入正数");
  1748. }
  1749. for (const key in itm) {
  1750. if (key.indexOf("spring_qty_") > -1) {
  1751. if (Number(itm[key]) <= 0) {
  1752. throw new Error("主副规格相关弹簧排列数不能为空,请检查");
  1753. }
  1754. }
  1755. }
  1756. });
  1757. }
  1758. const prefixes = [
  1759. "spring_qty_width",
  1760. "spring_qty_length",
  1761. "bednet_iffork",
  1762. "bednet_fork_qty",
  1763. "cushions_subspecs",
  1764. "accessories_subspecs"
  1765. ];
  1766. subspecs = subspecs.map(itm => {
  1767. itm.mattress_width = Number(itm.mattress_width ?? 0);
  1768. itm.mattress_length = Number(itm.mattress_length ?? 0);
  1769. itm.mattress_height = Number(mattress.mattress_height ?? 0);
  1770. itm.DynamicFields = Object.keys(itm)
  1771. .filter(key => prefixes.some(prefix => key.startsWith(prefix)))
  1772. .reduce((obj, key) => {
  1773. obj[key] = itm[key];
  1774. return obj;
  1775. }, {});
  1776. return itm;
  1777. });
  1778. } catch (error) {
  1779. ElMessage.error(error.message);
  1780. return false;
  1781. }
  1782. }
  1783. // 特殊工艺
  1784. let extraProcesses = [];
  1785. let $table_processes = specialProcessesMxRef.value?.element;
  1786. if ($table_processes) {
  1787. $table_processes.clearEdit();
  1788. console.log("$table_processes.getTableData() :>> ", $table_processes.getTableData());
  1789. extraProcesses = $table_processes.getTableData().visibleData;
  1790. extraProcesses = extraProcesses.filter(itm => Number(itm.extraid) > 0);
  1791. }
  1792. console.log("save++++extraProcesses :>> ", extraProcesses);
  1793. // 材料额外费用
  1794. let extraCosts = [];
  1795. let $table_costs = additionalCostsMxRef.value?.element;
  1796. if ($table_costs) {
  1797. $table_costs.clearEdit();
  1798. extraCosts = $table_costs.getTableData().visibleData;
  1799. extraCosts = extraCosts.filter(itm => Number(itm.extraid) > 0);
  1800. }
  1801. loadingStatus.save = true;
  1802. let _param_mf = {
  1803. mattress,
  1804. mattressMx,
  1805. // subspecs,
  1806. subspecsList: subspecs,
  1807. extraProcesses,
  1808. extraCosts
  1809. };
  1810. try {
  1811. console.log("综合 _param_mf :>> ", _param_mf);
  1812. await SaveMattress(_param_mf)
  1813. .then(res => {
  1814. ElNotification({
  1815. title: "温馨提示",
  1816. message: t("sys.api.sueccessToSave"),
  1817. type: "success"
  1818. });
  1819. if (res.mattressid) {
  1820. console.log("tabRemove route.fullPath :>> ", route.fullPath);
  1821. // tabRemove(route.fullPath);
  1822. router.replace(`/mattressQuote/detail?id=${res.mattressid}&code=${res.mattresscode}`);
  1823. } else {
  1824. router.replace("/mattressQuote");
  1825. }
  1826. setTimeout(() => {
  1827. let _msg = res.message ?? "";
  1828. if (res.message || res.mxmessage?.length) {
  1829. let defaultNum = res.message ? 1 : 0;
  1830. _msg && (_msg = "1." + _msg + "<br/>");
  1831. if (res.mxmessage?.length) {
  1832. res.mxmessage.map((itm, idx) => {
  1833. _msg += `${idx + 1 + defaultNum}. ${itm}<br/>`;
  1834. });
  1835. }
  1836. let _num = res.message ? 1 + res.mxmessage?.length : res.mxmessage?.length;
  1837. ElNotification({
  1838. title: `计算失败(${_num})`,
  1839. message: `<div style="word-wrap:break-word;word-break:break-all;">${_msg}</div>`,
  1840. dangerouslyUseHTMLString: true,
  1841. type: "warning"
  1842. });
  1843. }
  1844. }, 100);
  1845. loadingStatus.save = false;
  1846. })
  1847. .catch(error => {
  1848. console.log("error !! :>> ", error);
  1849. loadingStatus.save = false;
  1850. });
  1851. } catch (error) {
  1852. ElMessage.error(t("sys.api.operationFailed"));
  1853. }
  1854. } catch (e) {
  1855. loadingStatus.save = false;
  1856. console.log("buttonNew eee :>> ", e, loadingStatus.save);
  1857. }
  1858. };
  1859. const save_subSpecs = async () => {
  1860. try {
  1861. let mattress = LjDetailRef.value._mainData;
  1862. mattress.mattressid = Number(mattress.mattressid ?? 0);
  1863. let mattressMx = [];
  1864. try {
  1865. fabricMxTabList.value.map(t => {
  1866. if (t.ref) {
  1867. console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
  1868. if (dynamicRef(t.ref) && !["specialProcessesMxRef", "additionalCostsMxRef"].includes(t.ref)) {
  1869. let $table = dynamicRef(t.ref)?.element;
  1870. $table.clearEdit();
  1871. let { visibleData } = $table.getTableData();
  1872. console.log("visibleData t.ref?.value :>> ", t.ref, visibleData);
  1873. visibleData = visibleData.map((itm, idx) => {
  1874. // 检查明细输入是否正确
  1875. let _disabled = !(
  1876. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(itm.formulakind)) ||
  1877. itm.formulakind == 202 ||
  1878. itm.formulakind == 7
  1879. );
  1880. console.log("_disabled :>> ", _disabled);
  1881. if (t.ref == "cushionsMxRef") {
  1882. _disabled = !(
  1883. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
  1884. itm.formulakind == 7 ||
  1885. itm.formulakind == 999
  1886. );
  1887. } else if (t.ref == "innerClothLayerMxRef") {
  1888. _disabled = !(
  1889. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
  1890. itm.formulakind == 202 ||
  1891. itm.formulakind == 203
  1892. );
  1893. }
  1894. console.log(
  1895. "itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0 :>> ",
  1896. _disabled,
  1897. itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0
  1898. );
  1899. if (itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0) {
  1900. throw new Error(t.label + "相关厚度输入有误,请检查");
  1901. }
  1902. itm.xu = idx + 1;
  1903. itm.mattress_width = Number(itm?.mattress_width ?? 0);
  1904. itm.mattress_length = Number(itm?.mattress_length ?? 0);
  1905. return itm;
  1906. });
  1907. mattressMx = mattressMx.concat(visibleData);
  1908. }
  1909. }
  1910. });
  1911. } catch (error) {
  1912. ElMessage.error(error.message);
  1913. return false;
  1914. }
  1915. // 主副规格
  1916. let subspecs = [];
  1917. let $table_subspecs = subSpecsRef.value?.element;
  1918. if ($table_subspecs) {
  1919. $table_subspecs.clearEdit();
  1920. subspecs = $table_subspecs.getTableData().visibleData;
  1921. try {
  1922. // 忽略长宽高没填的明细行
  1923. subspecs = subspecs.filter(
  1924. itm => Number(itm.mattress_width) > 0 || Number(itm.mattress_length) > 0 || Number(itm.mattress_height) > 0
  1925. );
  1926. let ifHas99 = mattressMx.filter(itm => itm.formulakind == 99 && itm.mtrlid > 0);
  1927. if (ifHas99.length > 0) {
  1928. subspecs.map(itm => {
  1929. if (Number(itm.mattress_width) <= 0 || Number(itm.mattress_length) <= 0 || Number(itm.mattress_height) <= 0) {
  1930. throw new Error("主副规格相关尺寸输入有误(不能为空),请输入正数");
  1931. }
  1932. for (const key in itm) {
  1933. if (key.indexOf("spring_qty_") > -1) {
  1934. if (Number(itm[key]) <= 0) {
  1935. throw new Error("主副规格相关弹簧排列数不能为空,请检查");
  1936. }
  1937. }
  1938. }
  1939. });
  1940. }
  1941. const prefixes = [
  1942. "spring_qty_width",
  1943. "spring_qty_length",
  1944. "bednet_iffork",
  1945. "bednet_fork_qty",
  1946. "cushions_subspecs",
  1947. "accessories_subspecs"
  1948. ];
  1949. subspecs = subspecs.map(itm => {
  1950. itm.mattress_width = Number(itm.mattress_width ?? 0);
  1951. itm.mattress_length = Number(itm.mattress_length ?? 0);
  1952. itm.mattress_height = Number(mattress.mattress_height ?? 0);
  1953. itm.DynamicFields = Object.keys(itm)
  1954. .filter(key => prefixes.some(prefix => key.startsWith(prefix)))
  1955. .reduce((obj, key) => {
  1956. obj[key] = itm[key];
  1957. return obj;
  1958. }, {});
  1959. return itm;
  1960. });
  1961. } catch (error) {
  1962. ElMessage.error(error.message);
  1963. return false;
  1964. }
  1965. }
  1966. loadingStatus.save = true;
  1967. let _param_mf = {
  1968. mattress,
  1969. subspecsList: subspecs
  1970. };
  1971. try {
  1972. await SaveMattressSubSpecs(_param_mf)
  1973. .then(res => {
  1974. ElNotification({
  1975. title: "温馨提示",
  1976. message: t("sys.api.sueccessToSave"),
  1977. type: "success"
  1978. });
  1979. if (res.mattressid) {
  1980. // router.replace(`/mattressQuote/detail?id=${res.mattressid}&code=${res.mattresscode}`);
  1981. nextTick(() => {
  1982. getData_subSpecs().then(res => {
  1983. const { list } = dataCallbackSubspecs(res);
  1984. subSpecsData.value = list;
  1985. });
  1986. });
  1987. } else {
  1988. router.replace("/mattressQuote");
  1989. }
  1990. loadingStatus.save = false;
  1991. })
  1992. .catch(error => {
  1993. loadingStatus.save = false;
  1994. });
  1995. } catch (error) {
  1996. ElMessage.error(t("sys.api.operationFailed"));
  1997. }
  1998. } catch (e) {
  1999. loadingStatus.save = false;
  2000. }
  2001. };
  2002. const orderDefaultAction = [
  2003. buttonDefault({
  2004. label: t("common.cancelText"),
  2005. icon: "iconchevron-left",
  2006. limited: () => {
  2007. return !orderStatus.value;
  2008. },
  2009. clickFunc: item => {
  2010. if (route.path.indexOf("/new") > -1) {
  2011. tabRemove(route.fullPath);
  2012. router.replace("/mattressQuote");
  2013. } else {
  2014. router.replace(
  2015. `/mattressQuote/detail?id=${LjDetailRef.value._mainData.mattressid}&code=${LjDetailRef.value._mainData.mattresscode}`
  2016. );
  2017. }
  2018. }
  2019. }),
  2020. buttonNew({
  2021. label: t("common.saveText"),
  2022. icon: "iconsave-01",
  2023. loading: () => loadingStatus.save,
  2024. limited: () => !orderStatus.value,
  2025. disabledTextCallBack: data => {
  2026. if (data.parentid > 0) {
  2027. return "副规格无法编辑,请在主规格中进行";
  2028. }
  2029. return "";
  2030. },
  2031. clickFunc: () => save()
  2032. }),
  2033. buttonDefault({
  2034. label: t("common.add"),
  2035. power: 72,
  2036. limited: () => {
  2037. return !!orderStatus.value;
  2038. },
  2039. clickFunc: item => {
  2040. router.push(`/mattressQuote/new?id=0&deptid=${LjDetailRef.value._mainData?.deptid ?? 0}`);
  2041. }
  2042. }),
  2043. buttonDefault({
  2044. power: 72,
  2045. label: t("common.editText"),
  2046. limited: () => {
  2047. return !!orderStatus.value;
  2048. },
  2049. disabledTextCallBack: data => {
  2050. if (data.parentid > 0) {
  2051. return "副规格无法编辑,请在主规格中进行";
  2052. }
  2053. if (data.xd_flag == 1) {
  2054. return "已业务下单,不能修改";
  2055. }
  2056. if (data.flag == 1) {
  2057. return "单据已财核,不能修改";
  2058. }
  2059. return "";
  2060. },
  2061. clickFunc: item => {
  2062. router.replace(
  2063. `/mattressQuote/edit?id=${LjDetailRef.value._mainData.mattressid}&code=${LjDetailRef.value._mainData.mattresscode}`
  2064. );
  2065. }
  2066. }),
  2067. buttonDefault({
  2068. power: 77,
  2069. label: t("common.delText"),
  2070. limited: () => {
  2071. return !!orderStatus.value;
  2072. },
  2073. disabledTextCallBack: (data: any) => {
  2074. if (!CheckPower(77)) {
  2075. return "你没有【报价单-删除】的使用权限";
  2076. }
  2077. return "";
  2078. },
  2079. clickFunc: item => {
  2080. console.log("dellll clickFunc item :>> ", LjDetailRef.value);
  2081. ElMessageBox.confirm("是否确定要删除床垫报价单吗?", "询问", {
  2082. confirmButtonText: t("common.delText"),
  2083. cancelButtonText: "否",
  2084. type: "error"
  2085. })
  2086. .then(() => {
  2087. DelMattress({ mattressids: [Number(LjDetailRef.value._mainData.mattressid)] }).then(() => {
  2088. ElMessage.success("删除成功!");
  2089. tabRemove(route.fullPath);
  2090. router.replace("/mattressQuote");
  2091. mittBus.emit(MittEnum.MattressList);
  2092. });
  2093. })
  2094. .catch((e: TypeError) => {
  2095. console.log("e :>> ", e);
  2096. ElMessage({
  2097. type: "info",
  2098. message: "操作取消"
  2099. });
  2100. });
  2101. }
  2102. }),
  2103. // [
  2104. buttonDefault({
  2105. label: t("common.businessOrder"),
  2106. power: 94,
  2107. limited: () => {
  2108. return !!orderStatus.value;
  2109. },
  2110. disabledTextCallBack: (data: any) => {
  2111. if (!CheckPower(94)) {
  2112. return `你没有【报价单-${t("common.businessOrder")}】的使用权限`;
  2113. }
  2114. if (data.js1_flag == 1) {
  2115. return "已产品补充审核,无法操作";
  2116. }
  2117. if (data.parentid > 0) {
  2118. return "副规格无法操作,请在主规格中进行";
  2119. }
  2120. return "";
  2121. },
  2122. clickFunc: item => {
  2123. ElMessageBox.confirm("是否确定要业务下单吗?", "询问", {
  2124. confirmButtonText: "是",
  2125. cancelButtonText: "否",
  2126. type: "warning"
  2127. })
  2128. .then(() => {
  2129. let _params = {
  2130. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  2131. xd_flag: 1
  2132. };
  2133. SaveMattressAuditing(_params).then(() => {
  2134. ElMessage.success(t("sys.api.operationSuccess"));
  2135. LjDetailRef.value.refresh();
  2136. });
  2137. })
  2138. .catch((e: TypeError) => {
  2139. ElMessage({
  2140. type: "info",
  2141. message: "操作取消"
  2142. });
  2143. });
  2144. }
  2145. }),
  2146. buttonDefault({
  2147. label: t("common.businessOrderCancel"),
  2148. power: 95,
  2149. disabledTextCallBack: (data: any) => {
  2150. if (!CheckPower(95)) {
  2151. return `你没有【报价单-${t("common.businessOrderCancel")}】的使用权限`;
  2152. }
  2153. if (data.js1_flag == 1) {
  2154. return "已产品补充审核,无法操作";
  2155. }
  2156. if (data.parentid > 0) {
  2157. return "副规格无法操作,请在主规格中进行";
  2158. }
  2159. return "";
  2160. },
  2161. clickFunc: item => {
  2162. ElMessageBox.confirm(`是否确定要${t("common.businessOrderCancel")}吗?`, "询问", {
  2163. confirmButtonText: "是",
  2164. cancelButtonText: "否",
  2165. type: "warning"
  2166. })
  2167. .then(() => {
  2168. let _params = {
  2169. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  2170. xd_flag: 0
  2171. };
  2172. SaveMattressAuditing(_params).then(() => {
  2173. ElMessage.success(t("sys.api.operationSuccess"));
  2174. LjDetailRef.value.refresh();
  2175. });
  2176. })
  2177. .catch((e: TypeError) => {
  2178. ElMessage({
  2179. type: "info",
  2180. message: "操作取消"
  2181. });
  2182. });
  2183. }
  2184. }),
  2185. // ],
  2186. // [
  2187. buttonDefault({
  2188. label: t("common.auditFinance"),
  2189. power: 73,
  2190. limited: () => {
  2191. return !!orderStatus.value;
  2192. },
  2193. disabledTextCallBack: (data: any) => {
  2194. if (!CheckPower(73)) {
  2195. return `你没有【报价单-${t("common.auditFinance")}】的使用权限`;
  2196. }
  2197. if (data.parentid > 0) {
  2198. return "副规格无法操作,请在主规格中进行";
  2199. }
  2200. if (data.flag == 1) {
  2201. return "已审核";
  2202. }
  2203. return "";
  2204. },
  2205. clickFunc: item => {
  2206. ElMessageBox.confirm(`是否确定要${t("common.auditFinance")}吗?`, "询问", {
  2207. confirmButtonText: "是",
  2208. cancelButtonText: "否",
  2209. type: "warning"
  2210. })
  2211. .then(() => {
  2212. let _params = {
  2213. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  2214. flag: 1
  2215. };
  2216. SaveMattressAuditing(_params).then(() => {
  2217. ElMessage.success(t("sys.api.operationSuccess"));
  2218. LjDetailRef.value.refresh();
  2219. });
  2220. })
  2221. .catch((e: TypeError) => {
  2222. ElMessage({
  2223. type: "info",
  2224. message: "操作取消"
  2225. });
  2226. });
  2227. }
  2228. }),
  2229. buttonDefault({
  2230. label: t("common.withdrawAuditFinance"),
  2231. power: 74,
  2232. limited: () => {
  2233. return !!orderStatus.value;
  2234. },
  2235. disabledTextCallBack: (data: any) => {
  2236. if (!CheckPower(74)) {
  2237. return `你没有【报价单-${t("common.withdrawAuditFinance")}】的使用权限`;
  2238. }
  2239. if (data.parentid > 0) {
  2240. return "副规格无法操作,请在主规格中进行";
  2241. }
  2242. if (data.flag != 1) {
  2243. return "未审核";
  2244. }
  2245. return "";
  2246. },
  2247. clickFunc: item => {
  2248. ElMessageBox.confirm(`是否确定要${t("common.withdrawAuditFinance")}吗?`, "询问", {
  2249. confirmButtonText: "是",
  2250. cancelButtonText: "否",
  2251. type: "warning"
  2252. })
  2253. .then(() => {
  2254. let _params = {
  2255. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  2256. flag: 0
  2257. };
  2258. SaveMattressAuditing(_params).then(() => {
  2259. ElMessage.success(t("sys.api.operationSuccess"));
  2260. LjDetailRef.value.refresh();
  2261. });
  2262. })
  2263. .catch((e: TypeError) => {
  2264. ElMessage({
  2265. type: "info",
  2266. message: "操作取消"
  2267. });
  2268. });
  2269. }
  2270. }),
  2271. // ],
  2272. buttonDefault({
  2273. label: t("common.copyQuote"),
  2274. power: 75,
  2275. limited: () => {
  2276. return !!orderStatus.value;
  2277. },
  2278. clickFunc: item => {
  2279. let _cur = LjDetailRef.value._mainData;
  2280. router.push(`/mattressQuote/copy?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
  2281. }
  2282. }),
  2283. buttonDefault({
  2284. label: t("common.showFormula"),
  2285. disabledTextCallBack: () => {
  2286. return userInfo.usermode == 1 ? "业务员模式不可以查看!" : "";
  2287. },
  2288. clickFunc: item => gotoShowFormula(LjDetailRef.value._mainData.dannum_type)
  2289. }),
  2290. buttonDefault({
  2291. label: t("common.viewHistoricalQuotes"),
  2292. clickFunc: () => {
  2293. console.log("LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
  2294. gotoHisprice(LjDetailRef.value._mainData.mattresscode, 0, { id: LjDetailRef.value._mainData.mattressid, typeid: 1 });
  2295. }
  2296. }),
  2297. buttonDefault({
  2298. label: t("common.showQuoteList"),
  2299. clickFunc: item => {
  2300. let _data = {
  2301. data: LjDetailRef.value._mainData,
  2302. mxdata: isQuoteListMxData.value,
  2303. enumMap: LjDetailRef.value.enumMap,
  2304. fabricMx: fabricMxTabList.value,
  2305. formulakindenum: formulaKindEnum.value,
  2306. dannum_type: LjDetailRef.value._mainData.dannum_type,
  2307. formula: cmpFormulas.value,
  2308. replace: cmpFormulaReplace.value,
  2309. formula_ori: cmpFormulasOri.value,
  2310. formula_bednet: cmpFormulasBednet.value,
  2311. differ: cmpDiffer.value
  2312. };
  2313. QuoteListDrawerRef.value.show(_data);
  2314. }
  2315. }),
  2316. buttonDefault({
  2317. label: t("common.exportQuoteList"),
  2318. loading: () => loadingStatus.download,
  2319. power: 72,
  2320. clickFunc: async item => {
  2321. loadingStatus.download = true;
  2322. let _data = {
  2323. data: LjDetailRef.value._mainData,
  2324. mxdata: isQuoteListMxData.value,
  2325. enumMap: LjDetailRef.value.enumMap,
  2326. fabricMx: fabricMxTabList.value,
  2327. formulakindenum: formulaKindEnum.value,
  2328. differ: cmpDiffer.value
  2329. };
  2330. await toExcelQuote(_data, "床垫报价单_" + LjDetailRef.value._mainData.mattresscode);
  2331. loadingStatus.download = false;
  2332. }
  2333. }),
  2334. buttonDefault({
  2335. label: t("common.businessSupplement"),
  2336. power: 72,
  2337. clickFunc: item => {
  2338. let _cur = LjDetailRef.value._mainData;
  2339. let type = 1;
  2340. gotoErpapi(_cur, type);
  2341. }
  2342. }),
  2343. // buttonDefault({
  2344. // label: t("common.dataTransmission"),
  2345. // power: 72,
  2346. // clickFunc: item => {
  2347. // router.push(`/mattressQuote/new?id=0`);
  2348. // }
  2349. // })
  2350. buttonDefault({
  2351. label: t("common.back"),
  2352. clickFunc: item => {
  2353. router.push("/mattressQuote");
  2354. }
  2355. })
  2356. ];
  2357. onMounted(() => {
  2358. console.log("route onMounted:>> ", route);
  2359. console.log("route onMounted:>> ", route.params);
  2360. console.log("route onMounted:>> ", route.params.id);
  2361. if (Number(route.query?.id)) {
  2362. // 赋值主表数据
  2363. // mainData.value = res.datatable.length ? res.datatable[0] : {};
  2364. // console.log("mainData.value :>> ", mainData.value);
  2365. // 刷新数据
  2366. initParams.value.arg_mattressid = Number(route.query?.id);
  2367. console.log("detail onMounted initParams.value :>> ", initParams.value);
  2368. } else {
  2369. if (route.query?.deptid) {
  2370. defaultColumnsValue.value.deptid = Number(route.query?.deptid);
  2371. }
  2372. }
  2373. defaultColumnsValue.value.packtype = "0";
  2374. defaultColumnsValue.value.packqty = 1;
  2375. // defaultColumnsValue.value.woodpallettype = "0";
  2376. // defaultColumnsValue.value.total_cost = 0;
  2377. // defaultColumnsValue.value.nottax_factory_cost = 0;
  2378. // defaultColumnsValue.value.nottax_dept_cost = 0;
  2379. // defaultColumnsValue.value.foreign_cost = 0;
  2380. // defaultColumnsValue.value.fob = 0;
  2381. defaultColumnsValue.value.dannum_type = 2;
  2382. defaultColumnsValue.value.dannum_rate = 1;
  2383. defaultColumnsValue.value.if_moneyrate = "0";
  2384. defaultColumnsValue.value.moneyrate = "1";
  2385. defaultColumnsValue.value.taxrate = 1.07;
  2386. defaultColumnsValue.value.taxes = 1;
  2387. // defaultColumnsValue.value.flag = 0;
  2388. defaultColumnsValue.value.woodpallettype = "0";
  2389. defaultColumnsValue.value.total_hr_cost = "0";
  2390. defaultColumnsValue.value.total_material_cost = "0";
  2391. defaultColumnsValue.value.total_hr_cost = 0;
  2392. defaultColumnsValue.value.total_material_cost = 0;
  2393. defaultColumnsValue.value.total_fees_cost = 0;
  2394. defaultColumnsValue.value.total_cost = 0;
  2395. defaultColumnsValue.value.commissionrate = 0;
  2396. defaultColumnsValue.value.fob = 0;
  2397. defaultColumnsValue.value.profitrate = 0;
  2398. defaultColumnsValue.value.nottax_factory_cost = 0;
  2399. defaultColumnsValue.value.nottax_dept_cost = 0;
  2400. defaultColumnsValue.value.dept_cost = 0;
  2401. defaultColumnsValue.value.foreign_cost = 0;
  2402. defaultColumnsValue.value.diameter = 0;
  2403. defaultColumnsValue.value.area = "";
  2404. defaultColumnsValue.value.cabinet_type = "";
  2405. defaultColumnsValue.value.hrcost = 0;
  2406. defaultColumnsValue.value.biandaicost = 0;
  2407. defaultColumnsValue.value.flag = 0;
  2408. defaultColumnsValue.value.dept_profitrate_rangli = 0;
  2409. defaultColumnsValue.value.profitrate_point = 0;
  2410. defaultColumnsValue.value.chaizhuang_point = 0;
  2411. defaultColumnsValue.value.haimian_point = 0;
  2412. defaultColumnsValue.value.qr_auditingdate = "";
  2413. defaultColumnsValue.value.zhizao_amt = 0;
  2414. defaultColumnsValue.value.foreign_cost_bz = 0;
  2415. defaultColumnsValue.value.cubage = 0;
  2416. defaultColumnsValue.value.discount = 1;
  2417. defaultColumnsValue.value.butao_point = 1;
  2418. defaultColumnsValue.value.guanli_rate = 1;
  2419. defaultColumnsValue.value.if_bcp_type = 0;
  2420. defaultColumnsValue.value.if_d_chai = 0;
  2421. defaultColumnsValue.value.if_m_chai = 0;
  2422. defaultColumnsValue.value.if_m_wbutao_way = 0;
  2423. defaultColumnsValue.value.if_n_butao = 0;
  2424. defaultColumnsValue.value.if_w_butao = 0;
  2425. defaultColumnsValue.value.if_z_chai = 0;
  2426. defaultColumnsValue.value.if_zhedie_type = 0;
  2427. console.log("defaultColumnsValue.value :>> ", route.query?.deptid, defaultColumnsValue.value);
  2428. getFormulakindEnum();
  2429. getAllFormulaList();
  2430. });
  2431. /**
  2432. * @description 页面数据加载完成
  2433. */
  2434. const funcAfterMound = async (data: any) => {
  2435. console.log("onMounted detail sale start!!!! :>> ", orderStatus.value, orderStatus.value != "new", data);
  2436. if (route.fullPath.indexOf("/copy?") > -1) {
  2437. LjDetailRef.value._mainData.mattresscode = "";
  2438. LjDetailRef.value._mainData.parentid = 0;
  2439. }
  2440. if (!orderStatus.value) {
  2441. // 详情页
  2442. } else {
  2443. // 新增/编辑
  2444. tableProps_mx.value.editConfig.enabled = true;
  2445. tableProps_subSpecs.value.editConfig.enabled = true;
  2446. topCottonAddList.value = w_mattress_add_itemname_choose(4);
  2447. }
  2448. console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
  2449. if (orderStatus.value != "new") {
  2450. mxLoading.value = true;
  2451. getMattressType();
  2452. let res = await getData_mx(initParams.value);
  2453. oriMxData.value = dataCallbackMx(res);
  2454. oriMxData.value.list = oriMxData.value.list.map(t => {
  2455. t.formulakind = Number(t.formulakind);
  2456. t.thickness = Number(t.thickness);
  2457. t.qty = Number(t.qty);
  2458. return t;
  2459. });
  2460. let _params = {
  2461. mattressid: Number(initParams.value.arg_mattressid),
  2462. mattresstypeid: 0,
  2463. ifbcptype: 0,
  2464. packtype: 0
  2465. };
  2466. let resDw2 = await GetMattressImportDW2(_params);
  2467. if (resDw2) {
  2468. diancengAreaEnum.value = resDw2?.diancengarea;
  2469. specialProcessesMxData.value = resDw2?.extraEnum.filter(t => t.typeid == 1);
  2470. additionalCostsMxData.value = resDw2?.extraEnum.filter(t => t.typeid == 2);
  2471. specialProcessesEnum.value = resDw2?.extraTypeEnum.filter(t => t.typeid == 1);
  2472. additionalCostsEnum.value = resDw2?.extraTypeEnum.filter(t => t.typeid == 2);
  2473. }
  2474. console.log("funcAfterMound oriMxData.value :>> ", oriMxData.value);
  2475. funcChaifenTab();
  2476. mxLoading.value = false;
  2477. nextTick(() => {
  2478. console.log("detail onMounted subSpecsRef.value :>> ", subSpecsRef.value);
  2479. // subSpecsRef.value.refresh();
  2480. getData_subSpecs().then(res => {
  2481. const { list } = dataCallbackSubspecs(res);
  2482. subSpecsData.value = list;
  2483. console.log("detail onMounted subSpecsRef.value getData_subSpecs:>> ", res, subSpecsData.value);
  2484. updateSubspecsTable();
  2485. if (orderStatus.value == "copy") {
  2486. subSpecsData.value.forEach(t => {
  2487. setMxSpringQtyWidthAndLength({ row: t });
  2488. });
  2489. }
  2490. });
  2491. if (orderStatus.value == "copy") {
  2492. autoLoadExtraData_chai(data.if_m_chai, "if_m_chai");
  2493. autoLoadExtraData_chai(data.if_z_chai, "if_z_chai");
  2494. autoLoadExtraData_chai(data.if_d_chai, "if_d_chai");
  2495. }
  2496. gotoSummy();
  2497. });
  2498. }
  2499. };
  2500. const handleSelFabricMxNewMtrlGroup = async (target: string, item: any) => {
  2501. console.log("handleSelFabricMxNewMtrlGroup target :>> ", target, item, fabricMxTab10.value);
  2502. if (target == "tabpage_10") {
  2503. // 裥大恻
  2504. const $table = fabricMxTab10Ref.value?.element;
  2505. const { visibleData } = $table.getTableData();
  2506. let hasSame = visibleData.findIndex(t => t.sortcode == item.label);
  2507. if (hasSame > -1) {
  2508. ElMessage.error(item.label + "已存在");
  2509. return false;
  2510. }
  2511. if ($table) {
  2512. let _arr = [];
  2513. if (item.label == "普通大侧") {
  2514. $table.remove();
  2515. } else {
  2516. visibleData.map(t => {
  2517. if (t.sortcode == "普通大侧") {
  2518. _arr.push(t);
  2519. }
  2520. });
  2521. $table.remove(_arr);
  2522. }
  2523. }
  2524. let _params = {
  2525. arg_array_formulakind: [2, 42, 52, 62, 72, 82],
  2526. arg_array_formulatype: [0, 1, 2, 3]
  2527. };
  2528. await funcAddMxSide(_params, item, fabricMxTab10Ref.value);
  2529. autoLoadExtraData(fabricMxTab10Ref.value, specialProcessesMxRef.value);
  2530. } else if (target == "tabpage_11") {
  2531. // 裥小恻
  2532. const $table = fabricMxTab11Ref.value?.element;
  2533. const { visibleData } = $table.getTableData();
  2534. let hasSame = visibleData.findIndex(t => t.sortcode == item.label);
  2535. if (hasSame > -1) {
  2536. ElMessage.error(item.label + "已存在");
  2537. return false;
  2538. }
  2539. if ($table) {
  2540. let _arr = [];
  2541. visibleData.map(t => {
  2542. if (t.sortcode == "小侧1") {
  2543. _arr.push(t);
  2544. }
  2545. });
  2546. $table.remove(_arr);
  2547. }
  2548. let _params = {
  2549. arg_array_formulakind: [3, 83, 43, 53, 63, 73],
  2550. arg_array_formulatype: [0, 1, 2, 3]
  2551. };
  2552. await funcAddMxSide(_params, item, fabricMxTab11Ref.value);
  2553. } else if (target == "tabpage_13") {
  2554. // 拉手刺绣及其他工艺
  2555. const $table = fabricMxTab13Ref.value?.element;
  2556. const { visibleData } = $table.getTableData();
  2557. let _params = {
  2558. arg_array_formulatype: [0],
  2559. arg_array_not_formulakind: [
  2560. 0, 80, 40, 50, 60, 70, 1, 81, 41, 51, 61, 71, 2, 82, 42, 52, 62, 72, 3, 83, 43, 53, 63, 73, 4, 84, 44, 54, 64, 74, 9000,
  2561. 9001, 9002, 9003, 9004, 9005, 9006
  2562. ]
  2563. };
  2564. await funcAddMxSide(_params, item, fabricMxTab13Ref.value);
  2565. }
  2566. };
  2567. const handleDelFabricMxNewMtrlGroup = (target: string) => {
  2568. let sameMx = [];
  2569. let $table = null;
  2570. if (target == "tabpage_10") {
  2571. $table = fabricMxTab10Ref.value?.element;
  2572. } else if (target == "tabpage_11") {
  2573. $table = fabricMxTab11Ref.value?.element;
  2574. } else if (target == "tabpage_13") {
  2575. $table = fabricMxTab13Ref.value?.element;
  2576. }
  2577. if ($table) {
  2578. const curRow = $table.getCurrentRecord();
  2579. let { visibleData } = $table.getTableData();
  2580. if (!curRow) {
  2581. ElMessage.warning("请先选择要删除的行");
  2582. return;
  2583. }
  2584. sameMx = visibleData.filter(t => t.sortcode == curRow.sortcode);
  2585. ElMessageBox.confirm(`是否确定要删除${sameMx.length}条明细吗?`, "询问:" + sameMx[0].sortcode, {
  2586. confirmButtonText: t("common.delText"),
  2587. cancelButtonText: "否",
  2588. type: "error"
  2589. })
  2590. .then(() => {
  2591. if (target == "tabpage_10") {
  2592. let _arr = [];
  2593. let _idx = [];
  2594. visibleData.map((t, idx) => {
  2595. if (t.sortcode == sameMx[0].sortcode) {
  2596. _arr.push(t);
  2597. _idx.push(idx);
  2598. }
  2599. });
  2600. $table.remove(_arr);
  2601. fabricMxTab10.value = visibleData.filter((t, idx) => !_idx.includes(idx));
  2602. autoLoadExtraData(fabricMxTab10Ref.value, specialProcessesMxRef.value);
  2603. } else if (target == "tabpage_11") {
  2604. let _arr = [];
  2605. let _idx = [];
  2606. fabricMxTab11.value.map((t, idx) => {
  2607. if (t.sortcode == sameMx[0].sortcode) {
  2608. _arr.push(t);
  2609. _idx.push(idx);
  2610. }
  2611. });
  2612. $table.remove(_arr);
  2613. fabricMxTab11.value = visibleData.filter((t, idx) => !_idx.includes(idx));
  2614. } else if (target == "tabpage_13") {
  2615. let _arr = [];
  2616. let _idx = [];
  2617. fabricMxTab13.value.map((t, idx) => {
  2618. if (t.sortcode == sameMx[0].sortcode) {
  2619. _arr.push(t);
  2620. _idx.push(idx);
  2621. }
  2622. });
  2623. $table.remove(_arr);
  2624. fabricMxTab13.value = visibleData.filter((t, idx) => !_idx.includes(idx));
  2625. }
  2626. })
  2627. .catch((e: TypeError) => {
  2628. console.log("e :>> ", e);
  2629. ElMessage({
  2630. type: "info",
  2631. message: "操作取消"
  2632. });
  2633. });
  2634. }
  2635. };
  2636. const moveData = async ($table: any, index: number, nextIndex: number) => {
  2637. let { visibleData } = $table.getTableData();
  2638. const curRecords = $table?.getCurrentRecord();
  2639. let prevRow = visibleData[nextIndex];
  2640. visibleData[nextIndex] = visibleData[index];
  2641. visibleData[index] = prevRow;
  2642. $table.reloadData(visibleData);
  2643. await $table.setCurrentRow(curRecords);
  2644. };
  2645. const fMoveFormBednetMxToCushionsMx = ($table: any, curIdx: number, action: number) => {
  2646. let curRecords = $table?.getCurrentRecord();
  2647. let visibleData = $table.getTableData().visibleData;
  2648. const $table_cushions = dynamicRef("cushionsMxRef")?.element;
  2649. const { visibleData: visibleData_cushions } = $table_cushions.getTableData();
  2650. let currentBednetIndex = $table.getRowSeq(curRecords);
  2651. console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
  2652. let index = 1;
  2653. visibleData_cushions.map(o => {
  2654. if (Number(o.formulakind) == 999) {
  2655. if (index == currentBednetIndex) {
  2656. curRecords = o;
  2657. }
  2658. index++;
  2659. }
  2660. });
  2661. index = 1;
  2662. let oNextRecordes = visibleData[curIdx - action];
  2663. currentBednetIndex = $table.getRowSeq(oNextRecordes);
  2664. console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
  2665. let nextRecords = null;
  2666. visibleData_cushions.map(o => {
  2667. if (Number(o.formulakind) == 999) {
  2668. if (index == currentBednetIndex) {
  2669. nextRecords = o;
  2670. }
  2671. index++;
  2672. }
  2673. });
  2674. console.log("wf_rtr_cwdc table_cushions :>> ", $table_cushions.getRowSeq(curRecords), $table_cushions.getRowSeq(nextRecords));
  2675. curIdx = visibleData_cushions.findIndex(t => t === curRecords);
  2676. let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
  2677. console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
  2678. moveData($table_cushions, curIdx, nextIdx);
  2679. };
  2680. const fMoveFormCushionsMxToBednetMx = ($table: any, curIdx: number, action: number) => {
  2681. let curRecords = $table?.getCurrentRecord();
  2682. let visibleData = $table.getTableData().visibleData;
  2683. let nextIdx = -1;
  2684. let oNextRecordes = visibleData[curIdx - action];
  2685. const $table_bednet = dynamicRef("bednetMxRef")?.element;
  2686. const { visibleData: visibleData_cushions } = $table_bednet.getTableData();
  2687. let currentBednetIndex = $table.getRowSeq(curRecords);
  2688. console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
  2689. let index = -1;
  2690. curIdx = 0;
  2691. visibleData.map((o, idx) => {
  2692. if (Number(o.formulakind) == 999) {
  2693. index++;
  2694. if (idx + 1 == currentBednetIndex) {
  2695. curIdx = index;
  2696. }
  2697. }
  2698. });
  2699. index = -1;
  2700. currentBednetIndex = $table.getRowSeq(oNextRecordes);
  2701. console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
  2702. let nextRecords = null;
  2703. visibleData.map((o, idx) => {
  2704. if (Number(o.formulakind) == 999) {
  2705. index++;
  2706. if (idx + 1 == currentBednetIndex) {
  2707. nextIdx = index;
  2708. }
  2709. }
  2710. });
  2711. // console.log("wf_rtr_cwdc table_cushions :>> ", $table_bednet.getRowSeq(curRecords), $table_bednet.getRowSeq(nextRecords));
  2712. // curIdx = visibleData_cushions.findIndex(t => t === curRecords);
  2713. // let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
  2714. console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
  2715. if (curIdx > -1 && nextIdx > -1) {
  2716. moveData($table_bednet, curIdx, nextIdx);
  2717. }
  2718. };
  2719. const toMove = async (action: number, tableName: string) => {
  2720. console.log("bvtoMove action :>> ", action);
  2721. // const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
  2722. const $table = dynamicRef(tableName)?.element;
  2723. let curRecords = $table?.getCurrentRecord();
  2724. console.log("curRecords :>> ", curRecords);
  2725. console.log("$table.getTableData() :>> ", $table.getTableData());
  2726. let visibleData = $table.getTableData().visibleData;
  2727. if (!curRecords) {
  2728. ElMessage.warning("请先选择要移动的行");
  2729. return;
  2730. }
  2731. let curIdx = visibleData.findIndex(t => t === curRecords);
  2732. console.log("curIdx :>> ", curIdx);
  2733. if (action == 1) {
  2734. // 上移
  2735. if (curIdx == 0) {
  2736. ElMessage.warning("已经是第一条了");
  2737. return;
  2738. }
  2739. // let prevRow = visibleData[curIdx - 1];
  2740. // visibleData[curIdx - 1] = visibleData[curIdx];
  2741. // visibleData[curIdx] = prevRow;
  2742. // $table.reloadData(visibleData);
  2743. // await $table.setCurrentRow(curRecords);
  2744. moveData($table, curIdx, curIdx - 1);
  2745. // 床网与垫层互联
  2746. if (tableName == "bednetMxRef") {
  2747. fMoveFormBednetMxToCushionsMx($table, curIdx, action);
  2748. // const $table_cushions = dynamicRef("cushionsMxRef")?.element;
  2749. // const { visibleData: visibleData_cushions } = $table_cushions.getTableData();
  2750. // let currentBednetIndex = $table.getRowSeq(curRecords);
  2751. // console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
  2752. // let index = 1;
  2753. // visibleData_cushions.map(o => {
  2754. // if (Number(o.formulakind) == 999) {
  2755. // if (index == currentBednetIndex) {
  2756. // curRecords = o;
  2757. // }
  2758. // index++;
  2759. // }
  2760. // });
  2761. // index = 1;
  2762. // let oNextRecordes = visibleData[curIdx - 1];
  2763. // currentBednetIndex = $table.getRowSeq(oNextRecordes);
  2764. // console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
  2765. // let nextRecords = null;
  2766. // visibleData_cushions.map(o => {
  2767. // if (Number(o.formulakind) == 999) {
  2768. // if (index == currentBednetIndex) {
  2769. // nextRecords = o;
  2770. // }
  2771. // index++;
  2772. // }
  2773. // });
  2774. // console.log(
  2775. // "wf_rtr_cwdc table_cushions :>> ",
  2776. // $table_cushions.getRowSeq(curRecords),
  2777. // $table_cushions.getRowSeq(nextRecords)
  2778. // );
  2779. // curIdx = visibleData_cushions.findIndex(t => t === curRecords);
  2780. // let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
  2781. // console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
  2782. // moveData($table_cushions, curIdx, nextIdx);
  2783. } else if (tableName == "cushionsMxRef") {
  2784. fMoveFormCushionsMxToBednetMx($table, curIdx, action);
  2785. }
  2786. } else if (action == -1) {
  2787. // 下移
  2788. if (curIdx == visibleData.length - 1) {
  2789. ElMessage.warning("已经是最后一条了");
  2790. return;
  2791. }
  2792. // let nextRow = visibleData[curIdx + 1];
  2793. // visibleData[curIdx + 1] = visibleData[curIdx];
  2794. // visibleData[curIdx] = nextRow;
  2795. moveData($table, curIdx, curIdx + 1);
  2796. // $table.reloadData(visibleData);
  2797. // await $table.setCurrentRow(curRecords);
  2798. // 床网与垫层互联
  2799. if (tableName == "bednetMxRef") {
  2800. fMoveFormBednetMxToCushionsMx($table, curIdx, action);
  2801. } else if (tableName == "cushionsMxRef") {
  2802. fMoveFormCushionsMxToBednetMx($table, curIdx, action);
  2803. }
  2804. }
  2805. // 床网与主副规格互联
  2806. nextTick(() => {
  2807. updateSubspecsTable();
  2808. });
  2809. };
  2810. /**
  2811. * @description 垫层:增加明细
  2812. */
  2813. const toAddMx_cushions = async (type: number) => {
  2814. const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
  2815. const row = curRecords[0];
  2816. const { visibleData } = $table.getTableData();
  2817. let newRow;
  2818. if ($table) {
  2819. const records = {
  2820. chastr: row.chastr,
  2821. formulatype: row.formulatype,
  2822. if_mtrl: row.if_mtrl,
  2823. formulaid: row.formulaid,
  2824. sortcode: row.sortcode,
  2825. formulakind: row.formulakind,
  2826. formula: row.formula,
  2827. thickness: 0,
  2828. mtrlid: 0
  2829. };
  2830. if (type) {
  2831. // 插入
  2832. const curIndex = visibleData.findIndex(t => t._X_ROW_KEY === row._X_ROW_KEY);
  2833. // 插入数据
  2834. visibleData.splice(curIndex + 1, 0, records); // 假设 records 是要插入的新数据
  2835. $table.loadData(visibleData); // 重新加载数据
  2836. newRow = records;
  2837. } else {
  2838. // 新增
  2839. const { row } = await $table.insertAt(records, -1);
  2840. newRow = row;
  2841. }
  2842. // await $table.setEditCell(newRow, "mtrlname");
  2843. await $table.setCurrentRow(newRow);
  2844. console.log("wf_rtr_cwdc formulakind :>> ", row, row.formulakind);
  2845. if (row.formulakind == 999) {
  2846. const $table_bednet = bednetMxRef.value?.element;
  2847. if ($table_bednet) {
  2848. const { visibleData: visibleData_bednet } = $table_bednet.getTableData();
  2849. let curIndex = visibleData_bednet.length - 1;
  2850. if (type) {
  2851. curIndex = visibleData.filter(t => t.formulakind == 999).findIndex(t => t._X_ROW_KEY === row._X_ROW_KEY);
  2852. }
  2853. funcAddMtrlMx({ row: visibleData_bednet[curIndex] }, null, "bednetMxRef");
  2854. }
  2855. }
  2856. }
  2857. };
  2858. /**
  2859. * @description 垫层:删除
  2860. */
  2861. const toDelMx_cushions = () => {
  2862. const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
  2863. ElMessageBox.confirm(`是否确定要删除明细吗?`, "询问", {
  2864. confirmButtonText: t("common.delText"),
  2865. cancelButtonText: "否",
  2866. type: "error"
  2867. })
  2868. .then(() => {
  2869. if (curRecords.length == 1 && Number(curRecords[0].formulakind) == 999) {
  2870. wf_rtr_bednet(curRecords[0]);
  2871. }
  2872. $table.removeCurrentRow();
  2873. nextTick(() => {
  2874. // 床网与主副规格互联
  2875. updateSubspecsTable();
  2876. });
  2877. })
  2878. .catch((e: TypeError) => {
  2879. console.log("e :>> ", e);
  2880. ElMessage({
  2881. type: "info",
  2882. message: "操作取消"
  2883. });
  2884. });
  2885. };
  2886. const handleAddBednetMx = () => {
  2887. nextTick(() => {
  2888. console.log("LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
  2889. drawerTitle.value = "新增床网报价";
  2890. bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
  2891. bednetDrawerProps.bednetid = 0;
  2892. bednetDrawerProps.state = "new";
  2893. bednetDrawerProps.onlyView = false;
  2894. ifcopy.value = false;
  2895. LjDrawerRef.value.show(true);
  2896. });
  2897. };
  2898. const handleEditBednetMx = () => {
  2899. const $table = bednetMxRef.value?.element;
  2900. if ($table) {
  2901. const { $table, curRecords } = getCurrentRecords(bednetMxRef.value);
  2902. if (curRecords) {
  2903. const records = curRecords[0];
  2904. if (!Number(records?.mtrlid)) {
  2905. handleAddBednetMx();
  2906. } else {
  2907. nextTick(() => {
  2908. drawerTitle.value = "修改床网报价";
  2909. bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
  2910. bednetDrawerProps.bednetid = records.mtrlid;
  2911. bednetDrawerProps.dannum_type = LjDetailRef.value._mainData.dannum_type;
  2912. bednetDrawerProps.state = "edit";
  2913. bednetDrawerProps.onlyView = false;
  2914. ifcopy.value = true;
  2915. LjDrawerRef.value.show(true);
  2916. });
  2917. }
  2918. }
  2919. }
  2920. };
  2921. const autoBednetSave = async (res: any, oldBednetid: number) => {
  2922. const $table = bednetMxRef.value?.element;
  2923. let _res = res.bednet;
  2924. _res.bednet_height = res.bednet.mattress_height;
  2925. if ($table) {
  2926. const { visibleData } = $table.getTableData();
  2927. let idx = visibleData.findIndex(t => t.mtrlid == oldBednetid || oldBednetid == 0);
  2928. let _mtrlname =
  2929. _res.typename + " " + _res.bednetcode + " " + _res.mattress_width + "*" + _res.mattress_length + "*" + _res.mattress_height;
  2930. if (idx > -1) {
  2931. visibleData[idx].mtrlid = _res.bednetid;
  2932. visibleData[idx].mtrlname = _mtrlname;
  2933. visibleData[idx].price = _res.total_cost;
  2934. visibleData[idx].qty = 1;
  2935. await $table.reloadData(visibleData);
  2936. wf_rtr_cwdc(visibleData[idx], _res, "set");
  2937. } else {
  2938. let _data = cloneDeep(visibleData[0]);
  2939. let _row = {
  2940. addmx: "+",
  2941. delmx: "-",
  2942. formulatype: _data.formulatype,
  2943. if_mtrl: _data.if_mtrl,
  2944. formulaid: _data.formulaid,
  2945. sortcode: _data.sortcode,
  2946. formulakind: _data.formulakind,
  2947. formula: _data.formula,
  2948. thickness: 0,
  2949. mtrlid: _res.bednetid,
  2950. mtrlname: _mtrlname,
  2951. price: _res.total_cost,
  2952. qty: 1
  2953. };
  2954. if (visibleData.length == 1 && visibleData[0].mtrlid == 0) {
  2955. await $table.reloadData([_row]);
  2956. wf_rtr_cwdc(_row, _res, "set");
  2957. } else {
  2958. await $table.insertAt(_row, -1);
  2959. wf_rtr_cwdc(_row, _res, "add");
  2960. }
  2961. }
  2962. }
  2963. LjDrawerRef.value.hide();
  2964. };
  2965. /**
  2966. * @description 设置上次激活的标签页
  2967. * @param type 类型
  2968. * @param data 数据
  2969. */
  2970. const SetCurrentTabs = (data: any) => {
  2971. let _dwname = detailProps.dwname + "__fabric";
  2972. let _dftabs = globalStore?.detailtabs ?? {};
  2973. _dftabs[_dwname] = data.paneName;
  2974. globalStore.setGlobalState("mattresTabs", _dftabs);
  2975. };
  2976. /**
  2977. * @description 删除辅料
  2978. */
  2979. const toDelMx_accessories = () => {
  2980. const { $table, curRecords } = getCurrentRecords(accessoriesMxRef.value);
  2981. if ($table) {
  2982. if (curRecords.length) {
  2983. try {
  2984. $table.remove(curRecords);
  2985. updateSubspecsTable();
  2986. } catch (error) {
  2987. ElMessage.error(error.message);
  2988. return false;
  2989. }
  2990. }
  2991. }
  2992. };
  2993. /**
  2994. * @description 新增主副规格
  2995. */
  2996. const toAddMx_subSpecs = async () => {
  2997. const $table = subSpecsRef.value?.element;
  2998. if ($table) {
  2999. // updateSubspecsTable();
  3000. console.log("$table.getTable :>> ", $table.getTableData());
  3001. const $tableCushions = cushionsMxRef.value?.element;
  3002. let cushionsAttr = {};
  3003. // 垫层tab, 检测是否有副规格替换物料
  3004. if ($tableCushions) {
  3005. let idx = 0;
  3006. const { visibleData: visibleData_cushions } = $tableCushions.getTableData();
  3007. visibleData_cushions.map(item => {
  3008. if (item.mtrlid > 0 && item.if_subspecs == 1) {
  3009. cushionsAttr["cushions_subspecs_" + (idx + 1)] = item.mtrlid;
  3010. cushionsAttr["cushions_subspecs_formulakind_" + (idx + 1)] = item.formulakind;
  3011. cushionsAttr["cushions_subspecs_mtrlname_" + (idx + 1)] = item.mtrlname;
  3012. idx++;
  3013. }
  3014. });
  3015. }
  3016. // 辅料tab, 检测是否有副规格替换物料
  3017. const $tableAccessories = accessoriesMxRef.value?.element;
  3018. if ($tableAccessories) {
  3019. let idx = 0;
  3020. const { visibleData: visibleData_accessories } = $tableAccessories.getTableData();
  3021. visibleData_accessories.map(item => {
  3022. if (item.mtrlid > 0 && item.if_subspecs == 1) {
  3023. cushionsAttr["accessories_subspecs_" + (idx + 1)] = item.mtrlid;
  3024. cushionsAttr["accessories_subspecs_formulakind_" + (idx + 1)] = item.formulakind;
  3025. cushionsAttr["accessories_subspecs_mtrlname_" + (idx + 1)] = item.mtrlname;
  3026. idx++;
  3027. }
  3028. });
  3029. }
  3030. let records = {
  3031. mattressid: 0,
  3032. mattresscode: "",
  3033. mattress_width: 0,
  3034. mattress_length: 0,
  3035. mattress_height: LjDetailRef.value._mainData.mattress_height,
  3036. mattressname: LjDetailRef.value._mainData.mattressname,
  3037. mattressrelcode: LjDetailRef.value._mainData.mattressrelcode
  3038. // spring_qty_length: 0,
  3039. // spring_qty_width: 0
  3040. };
  3041. for (const key in cushionsAttr) {
  3042. records[key] = cushionsAttr[key];
  3043. }
  3044. const { row: newRow } = await $table.insertNextAt(records, -1);
  3045. await $table.setEditCell(newRow, "mattress_width");
  3046. await $table.setCurrentRow(newRow);
  3047. }
  3048. };
  3049. /**
  3050. * @description 删除主副规格
  3051. */
  3052. const toDelMx_subSpecs = () => {
  3053. const { $table, curRecords } = getCurrentRecords(subSpecsRef.value);
  3054. if ($table) {
  3055. if (curRecords.length) {
  3056. try {
  3057. curRecords.forEach((record: any) => {
  3058. if (orderStatus.value != "copy" && record.erp_mtrlid > 0) {
  3059. throw new Error(`该规格(${record.mattress_width}*${record.mattress_length})已生成ERP物料,不能删除`);
  3060. }
  3061. });
  3062. $table.remove(curRecords);
  3063. } catch (error) {
  3064. ElMessage.error(error.message);
  3065. return false;
  3066. }
  3067. }
  3068. }
  3069. };
  3070. /**
  3071. * @description 审核后,修改主副规格
  3072. */
  3073. const editSubSpecs = ref(false);
  3074. const toEdit_subSpecs = () => {
  3075. editSubSpecs.value = true;
  3076. tableProps_subSpecs.value.editConfig.enabled = true;
  3077. };
  3078. const toCancel_subSpecs = () => {
  3079. editSubSpecs.value = false;
  3080. subSpecsRef.value.refresh();
  3081. };
  3082. const toSave_subSpecs = async () => {
  3083. await save_subSpecs();
  3084. editSubSpecs.value = false;
  3085. };
  3086. const gotoMainMattress = () => {
  3087. if (globalStore.detailBlank) {
  3088. // 打开新的窗口
  3089. const routeUrl = router.resolve({
  3090. path: `/mattressQuote/detail`,
  3091. query: {
  3092. id: LjDetailRef.value._mainData.parentid
  3093. // code: row.mattresscode
  3094. }
  3095. });
  3096. window.open(routeUrl.href, "_blank");
  3097. } else {
  3098. router.push(`/mattressQuote/detail?id=${LjDetailRef.value._mainData.parentid}`);
  3099. }
  3100. };
  3101. const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
  3102. if (orderStatus.value || editSubSpecs.value) return false;
  3103. if (globalStore.detailBlank) {
  3104. // 打开新的窗口
  3105. const routeUrl = router.resolve({
  3106. path: `/mattressQuote/detail`,
  3107. query: {
  3108. id: row.mattressid,
  3109. code: row.mattresscode
  3110. }
  3111. });
  3112. window.open(routeUrl.href, "_blank");
  3113. } else {
  3114. router.push(`/mattressQuote/detail?id=${row.mattressid}&code=${row.mattresscode}`);
  3115. }
  3116. };
  3117. // 返回绑定的事件
  3118. const tableEvents = {
  3119. "cell-dblclick": handleDBlClickTable
  3120. };
  3121. const handleCellDblClick_bednet = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
  3122. if (!orderStatus.value && row.mtrlid > 0) {
  3123. drawerTitle.value = "床网报价详情";
  3124. // bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
  3125. bednetDrawerProps.dannum_type = LjDetailRef.value._mainData.dannum_type;
  3126. bednetDrawerProps.bednetid = row.mtrlid;
  3127. bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
  3128. bednetDrawerProps.state = "";
  3129. bednetDrawerProps.onlyView = true;
  3130. LjDrawerRef.value.show(true);
  3131. }
  3132. };
  3133. const cmpMoneyrate = computed(() => {
  3134. return LjDetailRef.value?._mainData.moneyrate ?? 0;
  3135. });
  3136. const cmpIfMoneyrate = computed(() => {
  3137. return LjDetailRef.value?._mainData.if_moneyrate ?? 0;
  3138. });
  3139. const handleExportQuote = async (ifExpandAll: any, ifShowOrigin: any, fields: any) => {
  3140. console.log("handleExportQuote ifExpandAll :>> ", ifExpandAll, ifShowOrigin);
  3141. if (ifShowOrigin) {
  3142. loadingStatus.download = true;
  3143. let _data = {
  3144. data: LjDetailRef.value._mainData,
  3145. mxdata: isQuoteListMxData.value,
  3146. enumMap: LjDetailRef.value.enumMap,
  3147. fabricMx: fabricMxTabList.value,
  3148. formulakindenum: formulaKindEnum.value,
  3149. differ: cmpDiffer.value
  3150. };
  3151. await toExcelQuote(_data, "床垫报价单_" + LjDetailRef.value._mainData.mattresscode);
  3152. loadingStatus.download = false;
  3153. } else {
  3154. loadingStatus.download = true;
  3155. // let _data = {
  3156. // data: LjDetailRef.value._mainData,
  3157. // mxdata: isQuoteListMxData.value,
  3158. // enumMap: LjDetailRef.value.enumMap,
  3159. // fabricMx: fabricMxTabList.value,
  3160. // formulakindenum: formulaKindEnum.value,
  3161. // differ: cmpDiffer.value,
  3162. // fields: fields
  3163. // };
  3164. let _data = {
  3165. data: LjDetailRef.value._mainData,
  3166. mxdata: isQuoteListMxData.value,
  3167. enumMap: LjDetailRef.value.enumMap,
  3168. fabricMx: fabricMxTabList.value,
  3169. formulakindenum: formulaKindEnum.value,
  3170. dannum_type: LjDetailRef.value._mainData.dannum_type,
  3171. formula: cmpFormulas.value,
  3172. replace: cmpFormulaReplace.value,
  3173. formula_ori: cmpFormulasOri.value,
  3174. formula_bednet: cmpFormulasBednet.value,
  3175. differ: cmpDiffer.value,
  3176. fields: fields
  3177. };
  3178. await toExcelQuoteNew(_data, "床垫报价单_" + LjDetailRef.value._mainData.mattresscode, ifExpandAll);
  3179. loadingStatus.download = false;
  3180. }
  3181. };
  3182. // const autoTabsClicks = (data: any) => {
  3183. // console.log("autoTabsClicks data :>> ", data);
  3184. // if (data.name == "subspecs") {
  3185. // updateSubspecsTable();
  3186. // }
  3187. // };
  3188. </script>
  3189. <style lang="scss">
  3190. .select-text-right {
  3191. .el-select__wrapper {
  3192. text-align: right;
  3193. }
  3194. }
  3195. .fabric-mx-tabs {
  3196. .el-tabs__content {
  3197. flex: 1;
  3198. }
  3199. .el-tab-pane {
  3200. display: flex;
  3201. flex-direction: column;
  3202. }
  3203. }
  3204. </style>