detail.vue 106 KB

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