detail.vue 98 KB

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