detail.vue 98 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949
  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. });
  926. const footerMethod = ({ columns, data }: any) => {
  927. // 返回一个二维数组的表尾合计
  928. return [
  929. columns.map((column: any, columnIndex: number) => {
  930. if (columnIndex === 0) {
  931. return "合计";
  932. }
  933. if (columnIndex === 1) {
  934. return data.length;
  935. }
  936. // if ((column.field && column.field.indexOf("qty") > -1) || props.footerSumAttrs?.includes(column.field)) {
  937. if ((column.field && column.field.indexOf("qty") > -1) || (column.field && column.field.indexOf("amt") > -1)) {
  938. let count = 0;
  939. data.forEach((item: any) => {
  940. count = floatAdd(count, isNaN(Number(item[column.field])) ? 0 : Number(item[column.field]));
  941. });
  942. return count;
  943. } else if (column.field && column.field.indexOf("dannum") > -1) {
  944. let count = 0;
  945. data.forEach((item: any) => {
  946. count = floatAdd(count, floatMul(Number(item.costamt), 1 + item[column.field]));
  947. });
  948. return count;
  949. }
  950. })
  951. ];
  952. };
  953. /**
  954. * @description 明细表格组件基础配置
  955. */
  956. const tableProps_mx = ref({
  957. height: "auto",
  958. align: "left",
  959. // height: "",
  960. minHeight: "100px",
  961. editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
  962. // exportConfig: {
  963. // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
  964. // }
  965. editRules: {
  966. mattress_width: [
  967. {
  968. validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
  969. const { _mainData } = LjDetailRef.value;
  970. let _value = Number(cellValue);
  971. if (_value < 0) {
  972. return new Error("不能小于0");
  973. }
  974. if (!isNaN(_value) && _value > Number(_mainData.mattress_width)) {
  975. return new Error("不能大于床垫尺寸");
  976. }
  977. return true;
  978. }
  979. }
  980. ],
  981. mattress_length: [
  982. {
  983. validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
  984. const { _mainData } = LjDetailRef.value;
  985. let _value = Number(cellValue);
  986. if (_value < 0) {
  987. return new Error("不能小于0");
  988. }
  989. if (!isNaN(_value) && _value > Number(_mainData.mattress_length)) {
  990. return new Error("不能大于床垫尺寸");
  991. }
  992. return true;
  993. }
  994. }
  995. ]
  996. },
  997. keyboardConfig: {
  998. isEdit: true,
  999. isArrow: true,
  1000. isEnter: true,
  1001. isTab: true,
  1002. isDel: true,
  1003. isBack: true,
  1004. isEsc: true,
  1005. editMethod({ $table, row, column }) {
  1006. // 先清空原先的值
  1007. row[column.field] = "";
  1008. // 再激活编辑状态并输入新值
  1009. $table.setEditCell(row, column);
  1010. }
  1011. },
  1012. mouseConfig: {
  1013. selected: true
  1014. }
  1015. });
  1016. // const tableEventsMx = {
  1017. // "edit-activated": ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) => {
  1018. // console.log("thickness row editDisabled:>> ", row.if_inputqty, row.formulakind);
  1019. // if (column.field === "thickness") {
  1020. // return !(
  1021. // (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
  1022. // row.formulakind == 7 ||
  1023. // row.formulakind == 202
  1024. // );
  1025. // }
  1026. // },
  1027. // "edit-disabled": ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex }) => {
  1028. // console.log("thickness row editDisabled:>> ", row.if_inputqty, row.formulakind);
  1029. // if (column.field === "thickness") {
  1030. // return !(
  1031. // (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
  1032. // row.formulakind == 7 ||
  1033. // row.formulakind == 202
  1034. // );
  1035. // }
  1036. // }
  1037. // };
  1038. const tableProps_subSpecs = ref({
  1039. height: "auto",
  1040. align: "left",
  1041. // height: "",
  1042. minHeight: "100px",
  1043. editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
  1044. // exportConfig: {
  1045. // filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
  1046. // }
  1047. keyboardConfig: {
  1048. isEdit: true,
  1049. isArrow: true,
  1050. isEnter: true,
  1051. isTab: true,
  1052. isDel: true,
  1053. isBack: true,
  1054. isEsc: true,
  1055. editMethod({ $table, row, column }) {
  1056. // 先清空原先的值
  1057. row[column.field] = "";
  1058. // 再激活编辑状态并输入新值
  1059. $table.setEditCell(row, column);
  1060. }
  1061. },
  1062. mouseConfig: {
  1063. selected: true
  1064. }
  1065. });
  1066. // const keyboardConfig = ref<any>({
  1067. // isEdit: true,
  1068. // isArrow: true,
  1069. // isEnter: true,
  1070. // isTab: true,
  1071. // isDel: true,
  1072. // isBack: true,
  1073. // isEsc: true,
  1074. // editMethod({ $table, row, column }) {
  1075. // // 先清空原先的值
  1076. // row[column.field] = "";
  1077. // // 再激活编辑状态并输入新值
  1078. // $table.setEditCell(row, column);
  1079. // }
  1080. // });
  1081. const isTabsBadge_packag = computed(() => {
  1082. let arr = [];
  1083. arr = packagMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1084. return arr.length;
  1085. });
  1086. const isTabsBadge_packag_error = computed(() => {
  1087. let arr = [];
  1088. arr = packagMxData.value.filter(t => Number(t.if_success));
  1089. return arr.length;
  1090. });
  1091. const isTabsBadge_cushions = computed(() => {
  1092. let arr = [];
  1093. arr = cushionsMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1094. return arr.length;
  1095. });
  1096. const isTabsBadge_cushions_error = computed(() => {
  1097. let arr = [];
  1098. console.log("isTabsBadge_cushions_error cushionsMxData.value:>> ", cushionsMxData.value);
  1099. arr = cushionsMxData.value.filter(t => Number(t.if_success));
  1100. return arr.length;
  1101. });
  1102. const isTabsBadge_accessories = computed(() => {
  1103. let arr = [];
  1104. arr = accessoriesMxData.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1105. return arr.length;
  1106. });
  1107. const isTabsBadge_accessories_error = computed(() => {
  1108. let arr = [];
  1109. arr = accessoriesMxData.value.filter(t => Number(t.if_success));
  1110. return arr.length;
  1111. });
  1112. const isTabsBadge_bednet = computed(() => {
  1113. let arr = [];
  1114. const $table = bednetMxRef.value?.element;
  1115. if ($table) {
  1116. arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1117. }
  1118. return arr.length;
  1119. });
  1120. const isTabsBadge_bednet_error = computed(() => {
  1121. let arr = [];
  1122. arr = bednetMxData.value.filter(t => Number(t.if_success));
  1123. return arr.length;
  1124. });
  1125. const isTabsBadge_fabric = computed(() => {
  1126. let arr = [];
  1127. arr = fabricMxTab8.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1128. arr = arr.concat(fabricMxTab9.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1129. arr = arr.concat(fabricMxTab10.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1130. arr = arr.concat(fabricMxTab11.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1131. arr = arr.concat(fabricMxTab12.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1132. arr = arr.concat(fabricMxTab13.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
  1133. console.log("isTabsBadge_fabric arr :>> ", arr);
  1134. return arr.length;
  1135. });
  1136. const isTabsBadge_fabric_error = computed(() => {
  1137. let arr = [];
  1138. arr = fabricMxTab8.value.filter(t => Number(t.if_success));
  1139. arr = arr.concat(fabricMxTab9.value.filter(t => Number(t.if_success)));
  1140. arr = arr.concat(fabricMxTab10.value.filter(t => Number(t.if_success)));
  1141. arr = arr.concat(fabricMxTab11.value.filter(t => Number(t.if_success)));
  1142. arr = arr.concat(fabricMxTab12.value.filter(t => Number(t.if_success)));
  1143. arr = arr.concat(fabricMxTab13.value.filter(t => Number(t.if_success)));
  1144. return arr.length;
  1145. });
  1146. const isFilterErrorBadge = data => {
  1147. let arr = [];
  1148. arr = data.filter(t => Number(t.if_success));
  1149. return arr.length;
  1150. };
  1151. const isFilterSucessBadge = data => {
  1152. let arr = [];
  1153. arr = data.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1154. return arr.length;
  1155. };
  1156. const isQuoteListMxData = computed(() => {
  1157. return [
  1158. {
  1159. label: "面裥绵",
  1160. field: "tabpage_8",
  1161. replace: "面裥绵-",
  1162. data: fabricMxTab8.value
  1163. },
  1164. {
  1165. label: "底裥绵",
  1166. field: "tabpage_9",
  1167. replace: "底裥绵-",
  1168. data: fabricMxTab9.value
  1169. },
  1170. {
  1171. label: "裥大侧",
  1172. field: "tabpage_10",
  1173. replace: "大侧裥绵-",
  1174. data: fabricMxTab10.value
  1175. },
  1176. {
  1177. label: "裥小侧",
  1178. field: "tabpage_11",
  1179. replace: "小侧裥绵-",
  1180. data: fabricMxTab11.value
  1181. },
  1182. {
  1183. label: "裥V侧",
  1184. field: "tabpage_12",
  1185. replace: "V侧裥绵-",
  1186. data: fabricMxTab12.value
  1187. },
  1188. {
  1189. label: "其他工艺",
  1190. field: "tabpage_13",
  1191. replace: "V侧裥绵-",
  1192. data: fabricMxTab13.value
  1193. },
  1194. {
  1195. label: "垫层",
  1196. field: "cushions",
  1197. data: {
  1198. cushions: cushionsMxData.value,
  1199. bednet: bednetMxData.value
  1200. }
  1201. },
  1202. {
  1203. label: "辅料",
  1204. field: "accessories",
  1205. data: accessoriesMxData.value
  1206. },
  1207. {
  1208. label: "包装",
  1209. field: "packag",
  1210. data: packagMxData.value
  1211. }
  1212. ];
  1213. });
  1214. /**
  1215. * @description tab 面料
  1216. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1217. */
  1218. // /**
  1219. // * @description 面料数据
  1220. // */
  1221. // const fabricMxData = ref([]);
  1222. // const fabricMxTabData = ref([]);
  1223. // const fabricMxTabs = ref("fabricMx");
  1224. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1225. /**
  1226. * @description tab 床网
  1227. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1228. */
  1229. // /**
  1230. // * @description 床网数据
  1231. // */
  1232. // const bednetMxData = ref([]);
  1233. // const getData_cushions = (params: any) => {
  1234. // console.log("getData params :>> ", params);
  1235. // let newParams: any = {};
  1236. // params.pageNum && (newParams.pageindex = params.pageNum);
  1237. // params.pageSize && (newParams.pagesize = params.pageSize);
  1238. // delete params.pageNum;
  1239. // delete params.pageSize;
  1240. // newParams.queryParams = params;
  1241. // console.log("params :>> ", params);
  1242. // newParams.dsname = "web_mattress_mx_dianceng";
  1243. // return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxBednet);
  1244. // };
  1245. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1246. /**
  1247. * @description tab 垫层
  1248. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1249. */
  1250. // /**
  1251. // * @description 垫层数据
  1252. // */
  1253. // const cushionsMxData = ref([]);
  1254. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1255. /**
  1256. * @description tab 辅料
  1257. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1258. */
  1259. // /**
  1260. // * @description 辅料数据
  1261. // */
  1262. // const accessoriesMxData = ref([]);
  1263. // const getData_bednet = (params: any) => {
  1264. // console.log("getData params :>> ", params);
  1265. // let newParams: any = {};
  1266. // params.pageNum && (newParams.pageindex = params.pageNum);
  1267. // params.pageSize && (newParams.pagesize = params.pageSize);
  1268. // delete params.pageNum;
  1269. // delete params.pageSize;
  1270. // newParams.queryParams = params;
  1271. // console.log("params :>> ", params);
  1272. // newParams.dsname = "web_mattress_mx_bednet";
  1273. // return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxAccessories);
  1274. // };
  1275. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1276. /**
  1277. * @description tab 包装
  1278. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1279. */
  1280. // /**
  1281. // * @description 包装数据
  1282. // */
  1283. // const packagMxData = ref([]);
  1284. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1285. /**
  1286. * @description tab 内布套
  1287. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1288. */
  1289. /**
  1290. * @description 内布套数据
  1291. */
  1292. // const innerClothLayerMxData = ref([]);
  1293. // const innerClothLayerMxRef = ref();
  1294. const innerClothLayerNum = computed(() => {
  1295. let arr = [];
  1296. const $table = innerClothLayerMxRef.value?.element;
  1297. if ($table) {
  1298. arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1299. }
  1300. return arr.length;
  1301. });
  1302. const innerClothLayerNum_error = computed(() => {
  1303. let arr = [];
  1304. const $table = innerClothLayerMxRef.value?.element;
  1305. if ($table) {
  1306. arr = $table.getTableData().visibleData.filter(t => Number(t.if_success));
  1307. }
  1308. return arr.length;
  1309. });
  1310. const getData_innerClothLayer = (params: any) => {
  1311. console.log("getData params :>> ", params);
  1312. let newParams: any = {};
  1313. params.pageNum && (newParams.pageindex = params.pageNum);
  1314. params.pageSize && (newParams.pagesize = params.pageSize);
  1315. delete params.pageNum;
  1316. delete params.pageSize;
  1317. newParams.queryParams = params;
  1318. newParams.queryParams.arg_formulatype = [101, 102];
  1319. console.log("params :>> ", params);
  1320. newParams.dsname = "web_mattress_mx_neibutao";
  1321. return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMxInnerClothLayer);
  1322. };
  1323. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1324. /**
  1325. * @description tab 顶部裥棉
  1326. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1327. */
  1328. // const topCottonMxRef = ref();
  1329. const topCottonNum = computed(() => {
  1330. let arr = [];
  1331. const $table = topCottonMxRef.value?.element;
  1332. if ($table) {
  1333. arr = $table.getTableData().visibleData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
  1334. }
  1335. return arr.length;
  1336. });
  1337. const topCottonNum_error = computed(() => {
  1338. let arr = [];
  1339. const $table = topCottonMxRef.value?.element;
  1340. if ($table) {
  1341. arr = $table.getTableData().visibleData.filter(t => Number(t.if_success));
  1342. }
  1343. return arr.length;
  1344. });
  1345. const getData_topCotton = async (params: any) => {
  1346. if (!Object.keys(initParams.value).includes("arg_mattressid") || initParams.value.arg_mattressid == 0) return false;
  1347. let _params = { ...params, arg_formulatype: [103] };
  1348. return await getData_mx(_params);
  1349. };
  1350. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1351. /**
  1352. * @description 主副规格
  1353. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1354. */
  1355. const subSpecsNum = computed(() => {
  1356. let arr = [];
  1357. const $table = subSpecsRef.value?.element;
  1358. if ($table) {
  1359. arr = $table.getTableData().visibleData;
  1360. }
  1361. return arr.length;
  1362. });
  1363. const getData_subSpecs = (params: any) => {
  1364. console.log("getData_subSpecs getData params :>> ", params);
  1365. let newParams: any = {};
  1366. params.pageNum && (newParams.pageindex = params.pageNum);
  1367. params.pageSize && (newParams.pagesize = params.pageSize);
  1368. delete params.pageNum;
  1369. delete params.pageSize;
  1370. newParams.queryParams = params;
  1371. console.log("params :>> ", params);
  1372. newParams.dsname = "web_mattress_subspecs";
  1373. return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteSubspecs);
  1374. };
  1375. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1376. /**
  1377. * @description 特殊工艺
  1378. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1379. */
  1380. const specialProcessesNum = computed(() => {
  1381. let arr = [];
  1382. const $table = specialProcessesMxRef.value?.element;
  1383. if ($table) {
  1384. arr = $table.getTableData().visibleData.filter(t => t.extraid && Number(t.extraid) > 0);
  1385. }
  1386. return arr.length;
  1387. });
  1388. const getData_specialProcesses = (params: any) => {
  1389. console.log("getData_subSpecs getData params :>> ", params);
  1390. let newParams: any = {};
  1391. params.pageNum && (newParams.pageindex = params.pageNum);
  1392. params.pageSize && (newParams.pagesize = params.pageSize);
  1393. delete params.pageNum;
  1394. delete params.pageSize;
  1395. newParams.queryParams = params;
  1396. newParams.queryParams.arg_typeid = 1; // 1:特殊工艺 2:额外费用
  1397. console.log("params :>> ", params);
  1398. newParams.dsname = "web_mattress_mx_extra";
  1399. return CommonDynamicSelect(newParams);
  1400. };
  1401. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1402. /**
  1403. * @description 额外费用
  1404. * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
  1405. */
  1406. const additionalCostsNum = computed(() => {
  1407. let arr = [];
  1408. const $table = additionalCostsMxRef.value?.element;
  1409. if ($table) {
  1410. arr = $table.getTableData().visibleData.filter(t => t.extraid && Number(t.extraid) > 0);
  1411. }
  1412. return arr.length;
  1413. });
  1414. const getData_additionalCosts = (params: any) => {
  1415. console.log("getData_subSpecs getData params :>> ", params);
  1416. let newParams: any = {};
  1417. params.pageNum && (newParams.pageindex = params.pageNum);
  1418. params.pageSize && (newParams.pagesize = params.pageSize);
  1419. delete params.pageNum;
  1420. delete params.pageSize;
  1421. newParams.queryParams = params;
  1422. newParams.queryParams.arg_typeid = 2;
  1423. console.log("params :>> ", params);
  1424. newParams.dsname = "web_mattress_mx_extra";
  1425. return CommonDynamicSelect(newParams);
  1426. };
  1427. /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
  1428. const detailProps = reactive<DetailProp>({
  1429. dwname: DwnameEnum.mattressQuote,
  1430. columns: columns,
  1431. // headerstatus: ["status", "ifamt_ok"],
  1432. basicDefault: {},
  1433. header: {
  1434. fieldNames: {
  1435. code: "sptcode",
  1436. codeLabel: t("table.u_spt.sptcode") + ":",
  1437. name: "name"
  1438. },
  1439. // icon: "iconclipboard",
  1440. // tabsProp: {
  1441. // scrollspy: true,
  1442. // sticky: true
  1443. // }
  1444. floatbtn: [
  1445. {
  1446. id: "oaFlow",
  1447. originLeft: 100,
  1448. originTop: 50
  1449. }
  1450. ]
  1451. },
  1452. mould: [
  1453. {
  1454. id: "fabricMx",
  1455. type: "table",
  1456. label: t("business.detail.fabric")
  1457. },
  1458. {
  1459. id: "bednetMx",
  1460. type: "table",
  1461. label: t("business.detail.bednet")
  1462. },
  1463. {
  1464. id: "cushionsMx",
  1465. type: "table",
  1466. label: t("business.detail.cushions")
  1467. },
  1468. {
  1469. id: "accessoriesMx",
  1470. type: "table",
  1471. label: t("business.detail.accessories")
  1472. },
  1473. {
  1474. id: "packagMx",
  1475. type: "table",
  1476. label: t("business.detail.packag")
  1477. },
  1478. {
  1479. id: "innerClothLayerMx",
  1480. type: "table",
  1481. label: t("business.detail.innerClothLayer"),
  1482. limited: (params: any) => {
  1483. if (!params) return true;
  1484. return !params?.if_n_butao || params?.if_n_butao == "0";
  1485. }
  1486. },
  1487. {
  1488. id: "topCottonMx",
  1489. type: "table",
  1490. label: t("business.detail.topCotton"),
  1491. limited: (params: any) => {
  1492. if (!params) return true;
  1493. return !params?.if_w_butao || params?.if_w_butao == "0";
  1494. }
  1495. },
  1496. {
  1497. id: "specialProcesses",
  1498. type: "table",
  1499. label: t("business.detail.specialProcesses")
  1500. },
  1501. {
  1502. id: "additionalCosts",
  1503. type: "table",
  1504. label: t("business.detail.additionalCosts")
  1505. },
  1506. {
  1507. id: "subSpecs",
  1508. type: "table",
  1509. label: t("business.detail.subSpecs")
  1510. }
  1511. ]
  1512. });
  1513. const getData = (params: any) => {
  1514. console.log("getData params :>> ", params);
  1515. let newParams: any = {};
  1516. params.pageNum && (newParams.pageindex = params.pageNum);
  1517. params.pageSize && (newParams.pagesize = params.pageSize);
  1518. delete params.pageNum;
  1519. delete params.pageSize;
  1520. newParams.queryParams = params;
  1521. console.log("params :>> ", params);
  1522. newParams.dsname = "web_mattress";
  1523. return CommonDynamicSelect(newParams, DwnameEnum.mattressQuote);
  1524. // return [];
  1525. };
  1526. const gotoShowFormula = (data: any) => {
  1527. AllFormulaRef.value.open({
  1528. dannum_type: data.type,
  1529. formula: cmpFormulas.value,
  1530. replace: cmpFormulaReplace.value,
  1531. formula_ori: cmpFormulasOri.value,
  1532. formula_bednet: cmpFormulasBednet.value,
  1533. differ: cmpDiffer.value
  1534. });
  1535. };
  1536. const loadingStatus = reactive({
  1537. save: false,
  1538. download: false
  1539. });
  1540. const save = async () => {
  1541. console.log("save LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
  1542. console.log("save------------ :>> ", loadingStatus.save);
  1543. console.log("save cushionsMxData :>> ", cushionsMxData.value);
  1544. try {
  1545. await LjDetailRef.value.toValidateForm();
  1546. if (!(await wf_cmp_cb())) return;
  1547. let mattress = LjDetailRef.value._mainData;
  1548. mattress.mattressid = Number(mattress.mattressid ?? 0);
  1549. mattress.xd_flag = Number(mattress.xd_flag ?? 0);
  1550. console.log("bbbbbbbbbbbbbbbbbbbb mattress :>> ", mattress);
  1551. // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
  1552. // mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
  1553. // mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
  1554. // mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
  1555. // mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
  1556. // mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
  1557. // mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
  1558. // mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
  1559. // mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
  1560. let mattressMx = [];
  1561. try {
  1562. fabricMxTabList.value.map(t => {
  1563. if (t.ref) {
  1564. console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
  1565. if (dynamicRef(t.ref) && !["specialProcessesMxRef", "additionalCostsMxRef"].includes(t.ref)) {
  1566. let $table = dynamicRef(t.ref)?.element;
  1567. $table.clearEdit();
  1568. let { visibleData } = $table.getTableData();
  1569. console.log("visibleData t.ref?.value :>> ", t.ref, visibleData);
  1570. visibleData = visibleData.map((itm, idx) => {
  1571. // 检查明细输入是否正确
  1572. let _disabled = !(
  1573. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(itm.formulakind)) ||
  1574. itm.formulakind == 202 ||
  1575. itm.formulakind == 7
  1576. );
  1577. console.log("_disabled :>> ", _disabled);
  1578. if (t.ref == "cushionsMxRef") {
  1579. _disabled = !(
  1580. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
  1581. itm.formulakind == 7 ||
  1582. itm.formulakind == 999
  1583. );
  1584. } else if (t.ref == "innerClothLayerMxRef") {
  1585. _disabled = !(
  1586. (itm.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(itm.formulakind)) ||
  1587. itm.formulakind == 202 ||
  1588. itm.formulakind == 203
  1589. );
  1590. }
  1591. console.log(
  1592. "itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0 :>> ",
  1593. _disabled,
  1594. itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0
  1595. );
  1596. if (itm.mtrlid > 0 && !_disabled && Number(itm.thickness) <= 0) {
  1597. throw new Error(t.label + "相关厚度输入有误,请检查");
  1598. }
  1599. itm.xu = idx + 1;
  1600. return itm;
  1601. });
  1602. mattressMx = mattressMx.concat(visibleData);
  1603. }
  1604. }
  1605. });
  1606. } catch (error) {
  1607. ElMessage.error(error.message);
  1608. return false;
  1609. }
  1610. if (orderStatus.value == "copy") {
  1611. mattress.copy_id = mattress.mattressid;
  1612. }
  1613. // 主副规格
  1614. let subspecs = [];
  1615. let $table_subspecs = subSpecsRef.value.element;
  1616. if ($table_subspecs) {
  1617. $table_subspecs.clearEdit();
  1618. subspecs = $table_subspecs.getTableData().visibleData;
  1619. try {
  1620. // 忽略长宽高没填的明细行
  1621. subspecs = subspecs.filter(
  1622. itm => Number(itm.mattress_width) <= 0 && Number(itm.mattress_length) <= 0 && Number(itm.mattress_height) <= 0
  1623. );
  1624. subspecs.map(itm => {
  1625. if (Number(itm.mattress_width) <= 0 || Number(itm.mattress_length) <= 0 || Number(itm.mattress_height) <= 0) {
  1626. throw new Error("主副规格相关尺寸输入有误,请检查");
  1627. }
  1628. });
  1629. } catch (error) {
  1630. ElMessage.error(error.message);
  1631. return false;
  1632. }
  1633. }
  1634. // 特殊工艺
  1635. let extraProcesses = [];
  1636. let $table_processes = specialProcessesMxRef.value.element;
  1637. if ($table_processes) {
  1638. $table_processes.clearEdit();
  1639. console.log("$table_processes.getTableData() :>> ", $table_processes.getTableData());
  1640. extraProcesses = $table_processes.getTableData().visibleData;
  1641. extraProcesses = extraProcesses.filter(itm => Number(itm.extraid) > 0);
  1642. }
  1643. console.log("save++++extraProcesses :>> ", extraProcesses);
  1644. // 其他额外费用
  1645. let extraCosts = [];
  1646. let $table_costs = additionalCostsMxRef.value.element;
  1647. if ($table_costs) {
  1648. $table_costs.clearEdit();
  1649. extraCosts = $table_costs.getTableData().visibleData;
  1650. extraCosts = extraCosts.filter(itm => Number(itm.extraid) > 0);
  1651. }
  1652. loadingStatus.save = true;
  1653. let _param_mf = {
  1654. mattress,
  1655. mattressMx,
  1656. subspecs,
  1657. extraProcesses,
  1658. extraCosts
  1659. };
  1660. try {
  1661. console.log("综合 _param_mf :>> ", _param_mf);
  1662. await SaveMattress(_param_mf)
  1663. .then(res => {
  1664. ElNotification({
  1665. title: "温馨提示",
  1666. message: t("sys.api.sueccessToSave"),
  1667. type: "success"
  1668. });
  1669. if (res.mattressid) {
  1670. console.log("tabRemove route.fullPath :>> ", route.fullPath);
  1671. tabRemove(route.fullPath);
  1672. router.push(`/mattressQuote/detail?id=${res.mattressid}&code=${res.mattresscode}`);
  1673. } else {
  1674. router.replace("/mattressQuote");
  1675. }
  1676. setTimeout(() => {
  1677. let _msg = res.message ?? "";
  1678. if (res.message || res.mxmessage?.length) {
  1679. let defaultNum = res.message ? 1 : 0;
  1680. _msg && (_msg = "1." + _msg + "<br/>");
  1681. if (res.mxmessage?.length) {
  1682. res.mxmessage.map((itm, idx) => {
  1683. _msg += `${idx + 1 + defaultNum}. ${itm}<br/>`;
  1684. });
  1685. }
  1686. let _num = res.message ? 1 + res.mxmessage?.length : res.mxmessage?.length;
  1687. ElNotification({
  1688. title: `计算失败(${_num})`,
  1689. message: `<div style="word-wrap:break-word;word-break:break-all;">${_msg}</div>`,
  1690. dangerouslyUseHTMLString: true,
  1691. type: "warning"
  1692. });
  1693. }
  1694. }, 100);
  1695. loadingStatus.save = false;
  1696. })
  1697. .catch(error => {
  1698. console.log("error !! :>> ", error);
  1699. loadingStatus.save = false;
  1700. });
  1701. } catch (error) {
  1702. ElMessage.error(t("sys.api.operationFailed"));
  1703. }
  1704. } catch (e) {
  1705. loadingStatus.save = false;
  1706. console.log("buttonNew eee :>> ", e, loadingStatus.save);
  1707. }
  1708. };
  1709. const orderDefaultAction = [
  1710. buttonDefault({
  1711. label: t("common.cancelText"),
  1712. icon: "iconchevron-left",
  1713. limited: () => {
  1714. return !orderStatus.value;
  1715. },
  1716. clickFunc: item => {
  1717. if (route.path.indexOf("/new") > -1) {
  1718. tabRemove(route.fullPath);
  1719. router.replace("/mattressQuote");
  1720. } else {
  1721. router.replace(
  1722. `/mattressQuote/detail?id=${LjDetailRef.value._mainData.mattressid}&code=${LjDetailRef.value._mainData.mattresscode}`
  1723. );
  1724. }
  1725. }
  1726. }),
  1727. buttonNew({
  1728. label: t("common.saveText"),
  1729. icon: "iconsave-01",
  1730. loading: () => loadingStatus.save,
  1731. limited: () => !orderStatus.value,
  1732. clickFunc: () => save()
  1733. }),
  1734. buttonDefault({
  1735. label: t("common.add"),
  1736. power: 72,
  1737. limited: () => {
  1738. return !!orderStatus.value;
  1739. },
  1740. clickFunc: item => {
  1741. router.push(`/mattressQuote/new?id=0&deptid=${LjDetailRef.value._mainData?.deptid ?? 0}`);
  1742. }
  1743. }),
  1744. buttonDefault({
  1745. power: 72,
  1746. label: t("common.editText"),
  1747. limited: () => {
  1748. return !!orderStatus.value;
  1749. },
  1750. disabledTextCallBack: data => {
  1751. if (data.parentid > 0) {
  1752. return "副规格无法编辑,请在主规格中进行";
  1753. }
  1754. if (data.flag == 1) {
  1755. return "单据已审核,不能修改";
  1756. }
  1757. return "";
  1758. },
  1759. clickFunc: item => {
  1760. router.replace(
  1761. `/mattressQuote/edit?id=${LjDetailRef.value._mainData.mattressid}&code=${LjDetailRef.value._mainData.mattresscode}`
  1762. );
  1763. }
  1764. }),
  1765. buttonDefault({
  1766. power: 77,
  1767. label: t("common.delText"),
  1768. limited: () => {
  1769. return !!orderStatus.value;
  1770. },
  1771. disabledTextCallBack: (data: any) => {
  1772. if (!CheckPower(77)) {
  1773. return "你没有【报价单-删除】的使用权限";
  1774. }
  1775. return "";
  1776. },
  1777. clickFunc: item => {
  1778. console.log("dellll clickFunc item :>> ", LjDetailRef.value);
  1779. ElMessageBox.confirm("是否确定要删除床垫报价单吗?", "询问", {
  1780. confirmButtonText: t("common.delText"),
  1781. cancelButtonText: "否",
  1782. type: "error"
  1783. })
  1784. .then(() => {
  1785. DelMattress({ mattressids: [Number(LjDetailRef.value._mainData.mattressid)] }).then(() => {
  1786. ElMessage.success("删除成功!");
  1787. tabRemove(route.fullPath);
  1788. router.replace("/mattressQuote");
  1789. mittBus.emit(MittEnum.MattressList);
  1790. });
  1791. })
  1792. .catch((e: TypeError) => {
  1793. console.log("e :>> ", e);
  1794. ElMessage({
  1795. type: "info",
  1796. message: "操作取消"
  1797. });
  1798. });
  1799. }
  1800. }),
  1801. [
  1802. buttonDefault({
  1803. label: t("common.businessOrder"),
  1804. power: 94,
  1805. limited: () => {
  1806. return !!orderStatus.value;
  1807. },
  1808. disabledTextCallBack: (data: any) => {
  1809. if (!CheckPower(94)) {
  1810. return `你没有【报价单-${t("common.businessOrder")}】的使用权限`;
  1811. }
  1812. if (data.parentid > 0) {
  1813. return "副规格无法操作,请在主规格中进行";
  1814. }
  1815. return "";
  1816. },
  1817. clickFunc: item => {
  1818. ElMessageBox.confirm("是否确定要业务下单吗?", "询问", {
  1819. confirmButtonText: "是",
  1820. cancelButtonText: "否",
  1821. type: "warning"
  1822. })
  1823. .then(() => {
  1824. let _params = {
  1825. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  1826. xd_flag: 1
  1827. };
  1828. SaveMattressAuditing(_params).then(() => {
  1829. ElMessage.success(t("sys.api.operationSuccess"));
  1830. LjDetailRef.value.refresh();
  1831. });
  1832. })
  1833. .catch((e: TypeError) => {
  1834. ElMessage({
  1835. type: "info",
  1836. message: "操作取消"
  1837. });
  1838. });
  1839. }
  1840. }),
  1841. buttonDefault({
  1842. label: t("common.businessOrderCancel"),
  1843. power: 95,
  1844. limited: () => {
  1845. return !!orderStatus.value;
  1846. },
  1847. disabledTextCallBack: (data: any) => {
  1848. if (!CheckPower(95)) {
  1849. return `你没有【报价单-${t("common.businessOrderCancel")}】的使用权限`;
  1850. }
  1851. if (data.parentid > 0) {
  1852. return "副规格无法操作,请在主规格中进行";
  1853. }
  1854. return "";
  1855. },
  1856. clickFunc: item => {
  1857. ElMessageBox.confirm(`是否确定要${t("common.businessOrderCancel")}吗?`, "询问", {
  1858. confirmButtonText: "是",
  1859. cancelButtonText: "否",
  1860. type: "warning"
  1861. })
  1862. .then(() => {
  1863. let _params = {
  1864. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  1865. xd_flag: 0
  1866. };
  1867. SaveMattressAuditing(_params).then(() => {
  1868. ElMessage.success(t("sys.api.operationSuccess"));
  1869. LjDetailRef.value.refresh();
  1870. });
  1871. })
  1872. .catch((e: TypeError) => {
  1873. ElMessage({
  1874. type: "info",
  1875. message: "操作取消"
  1876. });
  1877. });
  1878. }
  1879. })
  1880. ],
  1881. [
  1882. buttonDefault({
  1883. label: t("common.auditFinance"),
  1884. power: 73,
  1885. limited: () => {
  1886. return !!orderStatus.value;
  1887. },
  1888. disabledTextCallBack: (data: any) => {
  1889. if (!CheckPower(73)) {
  1890. return `你没有【报价单-${t("common.auditFinance")}】的使用权限`;
  1891. }
  1892. if (data.parentid > 0) {
  1893. return "副规格无法操作,请在主规格中进行";
  1894. }
  1895. if (data.flag == 1) {
  1896. return "已审核";
  1897. }
  1898. return "";
  1899. },
  1900. clickFunc: item => {
  1901. ElMessageBox.confirm(`是否确定要${t("common.auditFinance")}吗?`, "询问", {
  1902. confirmButtonText: "是",
  1903. cancelButtonText: "否",
  1904. type: "warning"
  1905. })
  1906. .then(() => {
  1907. let _params = {
  1908. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  1909. flag: 1
  1910. };
  1911. SaveMattressAuditing(_params).then(() => {
  1912. ElMessage.success(t("sys.api.operationSuccess"));
  1913. LjDetailRef.value.refresh();
  1914. });
  1915. })
  1916. .catch((e: TypeError) => {
  1917. ElMessage({
  1918. type: "info",
  1919. message: "操作取消"
  1920. });
  1921. });
  1922. }
  1923. }),
  1924. buttonDefault({
  1925. label: t("common.withdrawAuditFinance"),
  1926. power: 74,
  1927. limited: () => {
  1928. return !!orderStatus.value;
  1929. },
  1930. disabledTextCallBack: (data: any) => {
  1931. if (!CheckPower(74)) {
  1932. return `你没有【报价单-${t("common.withdrawAuditFinance")}】的使用权限`;
  1933. }
  1934. if (data.parentid > 0) {
  1935. return "副规格无法操作,请在主规格中进行";
  1936. }
  1937. if (data.flag != 1) {
  1938. return "未审核";
  1939. }
  1940. return "";
  1941. },
  1942. clickFunc: item => {
  1943. ElMessageBox.confirm(`是否确定要${t("common.withdrawAuditFinance")}吗?`, "询问", {
  1944. confirmButtonText: "是",
  1945. cancelButtonText: "否",
  1946. type: "warning"
  1947. })
  1948. .then(() => {
  1949. let _params = {
  1950. mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
  1951. flag: 0
  1952. };
  1953. SaveMattressAuditing(_params).then(() => {
  1954. ElMessage.success(t("sys.api.operationSuccess"));
  1955. LjDetailRef.value.refresh();
  1956. });
  1957. })
  1958. .catch((e: TypeError) => {
  1959. ElMessage({
  1960. type: "info",
  1961. message: "操作取消"
  1962. });
  1963. });
  1964. }
  1965. })
  1966. ],
  1967. buttonDefault({
  1968. label: t("common.copyQuote"),
  1969. power: 75,
  1970. limited: () => {
  1971. return !!orderStatus.value;
  1972. },
  1973. clickFunc: item => {
  1974. let _cur = LjDetailRef.value._mainData;
  1975. router.push(`/mattressQuote/copy?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
  1976. }
  1977. }),
  1978. buttonDefault({
  1979. label: t("common.showFormula"),
  1980. disabledTextCallBack: () => {
  1981. return userInfo.usermode == 1 ? "业务员模式不可以查看!" : "";
  1982. },
  1983. clickFunc: item => gotoShowFormula({ type: LjDetailRef.value._mainData.dannum_type })
  1984. }),
  1985. buttonDefault({
  1986. label: t("common.viewHistoricalQuotes"),
  1987. clickFunc: () => {
  1988. console.log("LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
  1989. gotoHisprice(0, { id: LjDetailRef.value._mainData.mattressid, typeid: 1 });
  1990. }
  1991. }),
  1992. buttonDefault({
  1993. label: t("common.showQuoteList"),
  1994. clickFunc: item => {
  1995. let _data = {
  1996. data: LjDetailRef.value._mainData,
  1997. mxdata: isQuoteListMxData.value,
  1998. enumMap: LjDetailRef.value.enumMap,
  1999. fabricMx: fabricMxTabList.value,
  2000. formulakindenum: formulaKindEnum.value,
  2001. dannum_type: LjDetailRef.value._mainData.dannum_type,
  2002. formula: cmpFormulas.value,
  2003. replace: cmpFormulaReplace.value,
  2004. formula_ori: cmpFormulasOri.value,
  2005. formula_bednet: cmpFormulasBednet.value,
  2006. differ: cmpDiffer.value
  2007. };
  2008. QuoteListDrawerRef.value.show(_data);
  2009. }
  2010. }),
  2011. buttonDefault({
  2012. label: t("common.exportQuoteList"),
  2013. loading: () => loadingStatus.download,
  2014. power: 72,
  2015. clickFunc: async item => {
  2016. loadingStatus.download = true;
  2017. let _data = {
  2018. data: LjDetailRef.value._mainData,
  2019. mxdata: isQuoteListMxData.value,
  2020. enumMap: LjDetailRef.value.enumMap,
  2021. fabricMx: fabricMxTabList.value,
  2022. formulakindenum: formulaKindEnum.value,
  2023. differ: cmpDiffer.value
  2024. };
  2025. await toExcelQuote(_data, "床垫报价单_" + LjDetailRef.value._mainData.mattresscode);
  2026. loadingStatus.download = false;
  2027. }
  2028. }),
  2029. // buttonDefault({
  2030. // label: t("common.dataTransmission"),
  2031. // power: 72,
  2032. // clickFunc: item => {
  2033. // router.push(`/mattressQuote/new?id=0`);
  2034. // }
  2035. // })
  2036. buttonDefault({
  2037. label: t("common.back"),
  2038. clickFunc: item => {
  2039. router.push("/mattressQuote");
  2040. }
  2041. })
  2042. ];
  2043. onMounted(() => {
  2044. console.log("route onMounted:>> ", route);
  2045. console.log("route onMounted:>> ", route.params);
  2046. console.log("route onMounted:>> ", route.params.id);
  2047. if (Number(route.query?.id)) {
  2048. // 赋值主表数据
  2049. // mainData.value = res.datatable.length ? res.datatable[0] : {};
  2050. // console.log("mainData.value :>> ", mainData.value);
  2051. // 刷新数据
  2052. initParams.value.arg_mattressid = Number(route.query?.id);
  2053. console.log("detail onMounted initParams.value :>> ", initParams.value);
  2054. } else {
  2055. if (route.query?.deptid) {
  2056. defaultColumnsValue.value.deptid = Number(route.query?.deptid);
  2057. }
  2058. }
  2059. defaultColumnsValue.value.packtype = "0";
  2060. defaultColumnsValue.value.packqty = 1;
  2061. // defaultColumnsValue.value.woodpallettype = "0";
  2062. // defaultColumnsValue.value.total_cost = 0;
  2063. // defaultColumnsValue.value.nottax_factory_cost = 0;
  2064. // defaultColumnsValue.value.nottax_dept_cost = 0;
  2065. // defaultColumnsValue.value.foreign_cost = 0;
  2066. // defaultColumnsValue.value.fob = 0;
  2067. defaultColumnsValue.value.dannum_type = 2;
  2068. defaultColumnsValue.value.dannum_rate = 1;
  2069. defaultColumnsValue.value.if_moneyrate = "0";
  2070. defaultColumnsValue.value.moneyrate = "1";
  2071. defaultColumnsValue.value.taxrate = 1.07;
  2072. defaultColumnsValue.value.taxes = 1;
  2073. // defaultColumnsValue.value.flag = 0;
  2074. defaultColumnsValue.value.woodpallettype = "0";
  2075. defaultColumnsValue.value.total_hr_cost = "0";
  2076. defaultColumnsValue.value.total_material_cost = "0";
  2077. defaultColumnsValue.value.total_hr_cost = 0;
  2078. defaultColumnsValue.value.total_material_cost = 0;
  2079. defaultColumnsValue.value.total_fees_cost = 0;
  2080. defaultColumnsValue.value.total_cost = 0;
  2081. defaultColumnsValue.value.commissionrate = 0;
  2082. defaultColumnsValue.value.fob = 0;
  2083. defaultColumnsValue.value.profitrate = 0;
  2084. defaultColumnsValue.value.nottax_factory_cost = 0;
  2085. defaultColumnsValue.value.nottax_dept_cost = 0;
  2086. defaultColumnsValue.value.dept_cost = 0;
  2087. defaultColumnsValue.value.foreign_cost = 0;
  2088. defaultColumnsValue.value.diameter = 0;
  2089. defaultColumnsValue.value.area = "";
  2090. defaultColumnsValue.value.cabinet_type = "";
  2091. defaultColumnsValue.value.hrcost = 0;
  2092. defaultColumnsValue.value.biandaicost = 0;
  2093. defaultColumnsValue.value.flag = 0;
  2094. defaultColumnsValue.value.dept_profitrate_rangli = 0;
  2095. defaultColumnsValue.value.profitrate_point = 0;
  2096. defaultColumnsValue.value.chaizhuang_point = 0;
  2097. defaultColumnsValue.value.haimian_point = 0;
  2098. defaultColumnsValue.value.qr_auditingdate = "";
  2099. defaultColumnsValue.value.zhizao_amt = 0;
  2100. defaultColumnsValue.value.foreign_cost_bz = 0;
  2101. defaultColumnsValue.value.cubage = 0;
  2102. defaultColumnsValue.value.discount = 1;
  2103. defaultColumnsValue.value.butao_point = 1;
  2104. defaultColumnsValue.value.guanli_rate = 1;
  2105. defaultColumnsValue.value.if_bcp_type = 0;
  2106. defaultColumnsValue.value.if_d_chai = 0;
  2107. defaultColumnsValue.value.if_m_chai = 0;
  2108. defaultColumnsValue.value.if_m_wbutao_way = 0;
  2109. defaultColumnsValue.value.if_n_butao = 0;
  2110. defaultColumnsValue.value.if_w_butao = 0;
  2111. defaultColumnsValue.value.if_z_chai = 0;
  2112. defaultColumnsValue.value.if_zhedie_type = 0;
  2113. console.log("defaultColumnsValue.value :>> ", route.query?.deptid, defaultColumnsValue.value);
  2114. getFormulakindEnum();
  2115. });
  2116. /**
  2117. * @description 页面数据加载完成
  2118. */
  2119. const funcAfterMound = async () => {
  2120. console.log("onMounted detail sale start!!!! :>> ", orderStatus.value, orderStatus.value != "new");
  2121. if (!orderStatus.value) {
  2122. // 详情页
  2123. } else {
  2124. // 新增/编辑
  2125. tableProps_mx.value.editConfig.enabled = true;
  2126. tableProps_subSpecs.value.editConfig.enabled = true;
  2127. topCottonAddList.value = w_mattress_add_itemname_choose(4);
  2128. }
  2129. console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
  2130. if (orderStatus.value != "new") {
  2131. mxLoading.value = true;
  2132. getMattressType();
  2133. let res = await getData_mx(initParams.value);
  2134. oriMxData.value = dataCallbackMx(res);
  2135. oriMxData.value.list = oriMxData.value.list.map(t => {
  2136. t.formulakind = Number(t.formulakind);
  2137. t.thickness = Number(t.thickness);
  2138. t.qty = Number(t.qty);
  2139. return t;
  2140. });
  2141. let _params = {
  2142. mattressid: Number(initParams.value.arg_mattressid),
  2143. mattresstypeid: 0,
  2144. ifbcptype: 0,
  2145. packtype: 0
  2146. };
  2147. let resDw2 = await GetMattressImportDW2(_params);
  2148. if (resDw2) {
  2149. diancengAreaEnum.value = resDw2?.diancengarea;
  2150. specialProcessesMxData.value = resDw2?.extraEnum.filter(t => t.typeid == 1);
  2151. additionalCostsMxData.value = resDw2?.extraEnum.filter(t => t.typeid == 2);
  2152. specialProcessesEnum.value = resDw2?.extraTypeEnum.filter(t => t.typeid == 1);
  2153. additionalCostsEnum.value = resDw2?.extraTypeEnum.filter(t => t.typeid == 2);
  2154. }
  2155. console.log("funcAfterMound oriMxData.value :>> ", oriMxData.value);
  2156. funcChaifenTab();
  2157. mxLoading.value = false;
  2158. nextTick(() => {
  2159. console.log("detail onMounted subSpecsRef.value :>> ", subSpecsRef.value);
  2160. subSpecsRef.value.refresh();
  2161. gotoSummy(8000);
  2162. });
  2163. }
  2164. };
  2165. const handleSelFabricMxNewMtrlGroup = async (target: string, item: any) => {
  2166. console.log("handleSelFabricMxNewMtrlGroup target :>> ", target, item, fabricMxTab10.value);
  2167. if (target == "tabpage_10") {
  2168. // 裥大恻
  2169. const $table = fabricMxTab10Ref.value.element;
  2170. const { visibleData } = $table.getTableData();
  2171. let hasSame = visibleData.findIndex(t => t.sortcode == item.label);
  2172. if (hasSame > -1) {
  2173. ElMessage.error(item.label + "已存在");
  2174. return false;
  2175. }
  2176. if ($table) {
  2177. let _arr = [];
  2178. if (item.label == "普通大侧") {
  2179. $table.remove();
  2180. } else {
  2181. visibleData.map(t => {
  2182. if (t.sortcode == "普通大侧") {
  2183. _arr.push(t);
  2184. }
  2185. });
  2186. $table.remove(_arr);
  2187. }
  2188. }
  2189. let _params = {
  2190. arg_array_formulakind: [2, 42, 52, 62, 72, 82],
  2191. arg_array_formulatype: [0, 1, 2, 3]
  2192. };
  2193. await funcAddMxSide(_params, item, fabricMxTab10Ref.value);
  2194. autoLoadExtraData(fabricMxTab10Ref.value, specialProcessesMxRef.value);
  2195. } else if (target == "tabpage_11") {
  2196. // 裥小恻
  2197. const $table = fabricMxTab11Ref.value.element;
  2198. const { visibleData } = $table.getTableData();
  2199. let hasSame = visibleData.findIndex(t => t.sortcode == item.label);
  2200. if (hasSame > -1) {
  2201. ElMessage.error(item.label + "已存在");
  2202. return false;
  2203. }
  2204. if ($table) {
  2205. let _arr = [];
  2206. visibleData.map(t => {
  2207. if (t.sortcode == "小侧1") {
  2208. _arr.push(t);
  2209. }
  2210. });
  2211. $table.remove(_arr);
  2212. }
  2213. let _params = {
  2214. arg_array_formulakind: [3, 83, 43, 53, 63, 73],
  2215. arg_array_formulatype: [0, 1, 2, 3]
  2216. };
  2217. await funcAddMxSide(_params, item, fabricMxTab11Ref.value);
  2218. }
  2219. };
  2220. /**
  2221. * @description 判断目前选择的拼接数据量,自动导入修改特殊工艺费用
  2222. */
  2223. const autoLoadExtraData = (tableRef?: any, targetRef?: any) => {
  2224. //计算拼侧数量
  2225. const $table = tableRef.element;
  2226. const { visibleData } = $table.getTableData();
  2227. const $tableTarget = targetRef.element;
  2228. const { visibleData: tgVisibleData } = $tableTarget.getTableData();
  2229. let arr = [];
  2230. // 收集拼侧,并去重
  2231. visibleData.map(t => arr.push(t.sortcode));
  2232. arr = Array.from(new Set(arr));
  2233. //
  2234. let _remove = [];
  2235. tgVisibleData.map(t => {
  2236. if (t.extraid == 1) {
  2237. _remove.push(t);
  2238. }
  2239. });
  2240. $tableTarget.remove(_remove);
  2241. if (!arr.includes("普通大侧")) {
  2242. let result = [];
  2243. result = result.concat(computedExtraSizeNum(specialProcessesMxData.value, arr, "上下"));
  2244. result = result.concat(computedExtraSizeNum(specialProcessesMxData.value, arr, "左右"));
  2245. console.log("autoLoadExtraData result :>> ", result);
  2246. if (result.length) {
  2247. let _arr = [];
  2248. let _mattressId = LjDetailRef.value._mainData.mattressid;
  2249. result.map(o => {
  2250. let _itm = {
  2251. mattressid: _mattressId,
  2252. mattressmxid: 0,
  2253. extraid: o.extraid,
  2254. // extratypename: "",
  2255. extraname: o.extramxname,
  2256. price: o.price,
  2257. qty: o.qty,
  2258. dscrp: o.dscrp,
  2259. inputtype: o.inputtype,
  2260. typeid: o.typeid
  2261. };
  2262. _arr.push(_itm);
  2263. });
  2264. $tableTarget.insertAt(_arr, -1);
  2265. }
  2266. }
  2267. };
  2268. /**
  2269. * @description 计算拼侧数量
  2270. */
  2271. const computedExtraSizeNum = (enumarr: any, arr: any, key: string) => {
  2272. console.log("computedExtraSizeNum specialProcessesEnum.value :>> ", enumarr);
  2273. let extraArr = enumarr.filter(item => item.typeid == 1 && item.extraid == 1 && item.extramxname.includes(key));
  2274. let arrNum = arr.filter(item => item.includes(key)).length;
  2275. let result = [];
  2276. extraArr.forEach(o => {
  2277. // 判断名称中出现的数量
  2278. try {
  2279. const checker = new Function("value", `return ${text2Formula(o.extramxname)};`);
  2280. if (checker(arrNum)) {
  2281. result.push(o);
  2282. }
  2283. } catch (error) {
  2284. console.log("error :>> ", error);
  2285. ElMessage.error(`${t("sys.api.operationFailed")}特殊工艺名称: ${error}`);
  2286. }
  2287. });
  2288. return result;
  2289. };
  2290. const handleDelFabricMxNewMtrlGroup = (target: string) => {
  2291. let sameMx = [];
  2292. let $table = null;
  2293. if (target == "tabpage_10") {
  2294. $table = fabricMxTab10Ref.value.element;
  2295. } else if (target == "tabpage_11") {
  2296. $table = fabricMxTab11Ref.value.element;
  2297. }
  2298. if ($table) {
  2299. const curRow = $table.getCurrentRecord();
  2300. let { visibleData } = $table.getTableData();
  2301. if (!curRow) {
  2302. ElMessage.warning("请先选择要删除的行");
  2303. return;
  2304. }
  2305. sameMx = visibleData.filter(t => t.sortcode == curRow.sortcode);
  2306. ElMessageBox.confirm(`是否确定要删除${sameMx.length}条明细吗?`, "询问:" + sameMx[0].sortcode, {
  2307. confirmButtonText: t("common.delText"),
  2308. cancelButtonText: "否",
  2309. type: "error"
  2310. })
  2311. .then(() => {
  2312. if (target == "tabpage_10") {
  2313. let _arr = [];
  2314. let _idx = [];
  2315. visibleData.map((t, idx) => {
  2316. if (t.sortcode == sameMx[0].sortcode) {
  2317. _arr.push(t);
  2318. _idx.push(idx);
  2319. }
  2320. });
  2321. $table.remove(_arr);
  2322. fabricMxTab10.value = visibleData.filter((t, idx) => !_idx.includes(idx));
  2323. autoLoadExtraData(fabricMxTab10Ref.value, specialProcessesMxRef.value);
  2324. } else if (target == "tabpage_11") {
  2325. let _arr = [];
  2326. let _idx = [];
  2327. fabricMxTab11.value.map((t, idx) => {
  2328. if (t.sortcode == sameMx[0].sortcode) {
  2329. _arr.push(t);
  2330. _idx.push(idx);
  2331. }
  2332. });
  2333. $table.remove(_arr);
  2334. fabricMxTab11.value = visibleData.filter((t, idx) => !_idx.includes(idx));
  2335. }
  2336. })
  2337. .catch((e: TypeError) => {
  2338. console.log("e :>> ", e);
  2339. ElMessage({
  2340. type: "info",
  2341. message: "操作取消"
  2342. });
  2343. });
  2344. }
  2345. };
  2346. const moveData = async ($table: any, index: number, nextIndex: number) => {
  2347. let { visibleData } = $table.getTableData();
  2348. const curRecords = $table?.getCurrentRecord();
  2349. let prevRow = visibleData[nextIndex];
  2350. visibleData[nextIndex] = visibleData[index];
  2351. visibleData[index] = prevRow;
  2352. $table.reloadData(visibleData);
  2353. await $table.setCurrentRow(curRecords);
  2354. };
  2355. const fMoveFormBednetMxToCushionsMx = ($table: any, curIdx: number, action: number) => {
  2356. let curRecords = $table?.getCurrentRecord();
  2357. let visibleData = $table.getTableData().visibleData;
  2358. const $table_cushions = dynamicRef("cushionsMxRef")?.element;
  2359. const { visibleData: visibleData_cushions } = $table_cushions.getTableData();
  2360. let currentBednetIndex = $table.getRowSeq(curRecords);
  2361. console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
  2362. let index = 1;
  2363. visibleData_cushions.map(o => {
  2364. if (Number(o.formulakind) == 999) {
  2365. if (index == currentBednetIndex) {
  2366. curRecords = o;
  2367. }
  2368. index++;
  2369. }
  2370. });
  2371. index = 1;
  2372. let oNextRecordes = visibleData[curIdx - action];
  2373. currentBednetIndex = $table.getRowSeq(oNextRecordes);
  2374. console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
  2375. let nextRecords = null;
  2376. visibleData_cushions.map(o => {
  2377. if (Number(o.formulakind) == 999) {
  2378. if (index == currentBednetIndex) {
  2379. nextRecords = o;
  2380. }
  2381. index++;
  2382. }
  2383. });
  2384. console.log("wf_rtr_cwdc table_cushions :>> ", $table_cushions.getRowSeq(curRecords), $table_cushions.getRowSeq(nextRecords));
  2385. curIdx = visibleData_cushions.findIndex(t => t === curRecords);
  2386. let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
  2387. console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
  2388. moveData($table_cushions, curIdx, nextIdx);
  2389. };
  2390. const fMoveFormCushionsMxToBednetMx = ($table: any, curIdx: number, action: number) => {
  2391. let curRecords = $table?.getCurrentRecord();
  2392. let visibleData = $table.getTableData().visibleData;
  2393. let nextIdx = -1;
  2394. let oNextRecordes = visibleData[curIdx - action];
  2395. const $table_bednet = dynamicRef("bednetMxRef")?.element;
  2396. const { visibleData: visibleData_cushions } = $table_bednet.getTableData();
  2397. let currentBednetIndex = $table.getRowSeq(curRecords);
  2398. console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
  2399. let index = -1;
  2400. curIdx = 0;
  2401. visibleData.map((o, idx) => {
  2402. if (Number(o.formulakind) == 999) {
  2403. index++;
  2404. if (idx + 1 == currentBednetIndex) {
  2405. curIdx = index;
  2406. }
  2407. }
  2408. });
  2409. index = -1;
  2410. currentBednetIndex = $table.getRowSeq(oNextRecordes);
  2411. console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
  2412. let nextRecords = null;
  2413. visibleData.map((o, idx) => {
  2414. if (Number(o.formulakind) == 999) {
  2415. index++;
  2416. if (idx + 1 == currentBednetIndex) {
  2417. nextIdx = index;
  2418. }
  2419. }
  2420. });
  2421. // console.log("wf_rtr_cwdc table_cushions :>> ", $table_bednet.getRowSeq(curRecords), $table_bednet.getRowSeq(nextRecords));
  2422. // curIdx = visibleData_cushions.findIndex(t => t === curRecords);
  2423. // let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
  2424. console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
  2425. if (curIdx > -1 && nextIdx > -1) {
  2426. moveData($table_bednet, curIdx, nextIdx);
  2427. }
  2428. };
  2429. const toMove = async (action: number, tableName: string) => {
  2430. console.log("bvtoMove action :>> ", action);
  2431. // const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
  2432. const $table = dynamicRef(tableName)?.element;
  2433. let curRecords = $table?.getCurrentRecord();
  2434. console.log("curRecords :>> ", curRecords);
  2435. console.log("$table.getTableData() :>> ", $table.getTableData());
  2436. let visibleData = $table.getTableData().visibleData;
  2437. if (!curRecords) {
  2438. ElMessage.warning("请先选择要移动的行");
  2439. return;
  2440. }
  2441. let curIdx = visibleData.findIndex(t => t === curRecords);
  2442. console.log("curIdx :>> ", curIdx);
  2443. if (action == 1) {
  2444. // 上移
  2445. if (curIdx == 0) {
  2446. ElMessage.warning("已经是第一条了");
  2447. return;
  2448. }
  2449. // let prevRow = visibleData[curIdx - 1];
  2450. // visibleData[curIdx - 1] = visibleData[curIdx];
  2451. // visibleData[curIdx] = prevRow;
  2452. // $table.reloadData(visibleData);
  2453. // await $table.setCurrentRow(curRecords);
  2454. moveData($table, curIdx, curIdx - 1);
  2455. // 床网与垫层互联
  2456. if (tableName == "bednetMxRef") {
  2457. fMoveFormBednetMxToCushionsMx($table, curIdx, action);
  2458. // const $table_cushions = dynamicRef("cushionsMxRef")?.element;
  2459. // const { visibleData: visibleData_cushions } = $table_cushions.getTableData();
  2460. // let currentBednetIndex = $table.getRowSeq(curRecords);
  2461. // console.log("wf_rtr_cwdc cur currentBednetIndex:>> ", currentBednetIndex);
  2462. // let index = 1;
  2463. // visibleData_cushions.map(o => {
  2464. // if (Number(o.formulakind) == 999) {
  2465. // if (index == currentBednetIndex) {
  2466. // curRecords = o;
  2467. // }
  2468. // index++;
  2469. // }
  2470. // });
  2471. // index = 1;
  2472. // let oNextRecordes = visibleData[curIdx - 1];
  2473. // currentBednetIndex = $table.getRowSeq(oNextRecordes);
  2474. // console.log("wf_rtr_cwdc next currentBednetIndex:>> ", currentBednetIndex);
  2475. // let nextRecords = null;
  2476. // visibleData_cushions.map(o => {
  2477. // if (Number(o.formulakind) == 999) {
  2478. // if (index == currentBednetIndex) {
  2479. // nextRecords = o;
  2480. // }
  2481. // index++;
  2482. // }
  2483. // });
  2484. // console.log(
  2485. // "wf_rtr_cwdc table_cushions :>> ",
  2486. // $table_cushions.getRowSeq(curRecords),
  2487. // $table_cushions.getRowSeq(nextRecords)
  2488. // );
  2489. // curIdx = visibleData_cushions.findIndex(t => t === curRecords);
  2490. // let nextIdx = visibleData_cushions.findIndex(t => t === nextRecords);
  2491. // console.log("wf_rtr_cwdc curIdx, nextIdx :>> ", curIdx, nextIdx);
  2492. // moveData($table_cushions, curIdx, nextIdx);
  2493. } else if (tableName == "cushionsMxRef") {
  2494. fMoveFormCushionsMxToBednetMx($table, curIdx, action);
  2495. }
  2496. } else if (action == -1) {
  2497. // 下移
  2498. if (curIdx == visibleData.length - 1) {
  2499. ElMessage.warning("已经是最后一条了");
  2500. return;
  2501. }
  2502. // let nextRow = visibleData[curIdx + 1];
  2503. // visibleData[curIdx + 1] = visibleData[curIdx];
  2504. // visibleData[curIdx] = nextRow;
  2505. moveData($table, curIdx, curIdx + 1);
  2506. // $table.reloadData(visibleData);
  2507. // await $table.setCurrentRow(curRecords);
  2508. // 床网与垫层互联
  2509. if (tableName == "bednetMxRef") {
  2510. fMoveFormBednetMxToCushionsMx($table, curIdx, action);
  2511. } else if (tableName == "cushionsMxRef") {
  2512. fMoveFormCushionsMxToBednetMx($table, curIdx, action);
  2513. }
  2514. }
  2515. };
  2516. /**
  2517. * @description 垫层:增加明细
  2518. */
  2519. const toAddMx_cushions = async (type: number) => {
  2520. const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
  2521. const row = curRecords[0];
  2522. const { visibleData } = $table.getTableData();
  2523. let newRow;
  2524. if ($table) {
  2525. const records = {
  2526. chastr: row.chastr,
  2527. formulatype: row.formulatype,
  2528. if_mtrl: row.if_mtrl,
  2529. formulaid: row.formulaid,
  2530. sortcode: row.sortcode,
  2531. formulakind: row.formulakind,
  2532. formula: row.formula,
  2533. thickness: 0,
  2534. mtrlid: 0
  2535. };
  2536. if (type) {
  2537. // 插入
  2538. const curIndex = visibleData.findIndex(t => t._X_ROW_KEY === row._X_ROW_KEY);
  2539. // 插入数据
  2540. visibleData.splice(curIndex + 1, 0, records); // 假设 records 是要插入的新数据
  2541. $table.loadData(visibleData); // 重新加载数据
  2542. newRow = records;
  2543. } else {
  2544. // 新增
  2545. const { row } = await $table.insertAt(records, -1);
  2546. newRow = row;
  2547. }
  2548. // await $table.setEditCell(newRow, "mtrlname");
  2549. await $table.setCurrentRow(newRow);
  2550. console.log("wf_rtr_cwdc formulakind :>> ", row, row.formulakind);
  2551. if (row.formulakind == 999) {
  2552. const $table_bednet = bednetMxRef.value.element;
  2553. if ($table_bednet) {
  2554. const { visibleData: visibleData_bednet } = $table_bednet.getTableData();
  2555. let curIndex = visibleData_bednet.length - 1;
  2556. if (type) {
  2557. curIndex = visibleData.filter(t => t.formulakind == 999).findIndex(t => t._X_ROW_KEY === row._X_ROW_KEY);
  2558. }
  2559. funcAddMtrlMx({ row: visibleData_bednet[curIndex] }, null, "bednetMxRef");
  2560. }
  2561. }
  2562. }
  2563. };
  2564. /**
  2565. * @description 垫层:删除
  2566. */
  2567. const toDelMx_cushions = () => {
  2568. ElMessageBox.confirm(`是否确定要删除明细吗?`, "询问", {
  2569. confirmButtonText: t("common.delText"),
  2570. cancelButtonText: "否",
  2571. type: "error"
  2572. })
  2573. .then(() => {
  2574. const $table = cushionsMxRef.value.element;
  2575. $table.removeCurrentRow();
  2576. })
  2577. .catch((e: TypeError) => {
  2578. console.log("e :>> ", e);
  2579. ElMessage({
  2580. type: "info",
  2581. message: "操作取消"
  2582. });
  2583. });
  2584. };
  2585. const handleAddBednetMx = () => {
  2586. nextTick(() => {
  2587. console.log("LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
  2588. drawerTitle.value = "新增床网报价";
  2589. bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
  2590. bednetDrawerProps.bednetid = 0;
  2591. bednetDrawerProps.state = "new";
  2592. bednetDrawerProps.onlyView = false;
  2593. LjDrawerRef.value.show(true);
  2594. });
  2595. };
  2596. const handleEditBednetMx = () => {
  2597. const $table = bednetMxRef.value.element;
  2598. if ($table) {
  2599. const { $table, curRecords } = getCurrentRecords(bednetMxRef.value);
  2600. if (curRecords) {
  2601. const records = curRecords[0];
  2602. if (!Number(records?.mtrlid)) {
  2603. handleAddBednetMx();
  2604. } else {
  2605. nextTick(() => {
  2606. drawerTitle.value = "修改床网报价";
  2607. bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
  2608. bednetDrawerProps.bednetid = records.mtrlid;
  2609. bednetDrawerProps.state = "edit";
  2610. bednetDrawerProps.onlyView = false;
  2611. LjDrawerRef.value.show(true);
  2612. });
  2613. }
  2614. }
  2615. }
  2616. };
  2617. const autoBednetSave = async (res: any) => {
  2618. const $table = bednetMxRef.value.element;
  2619. let _res = res.bednet;
  2620. _res.bednet_height = res.bednet.mattress_height;
  2621. if ($table) {
  2622. const { visibleData } = $table.getTableData();
  2623. let idx = visibleData.findIndex(t => t.mtrlid == _res.bednetid || t.mtrlid == 0);
  2624. let _mtrlname =
  2625. _res.typename + " " + _res.bednetcode + " " + _res.mattress_width + "*" + _res.mattress_length + "*" + _res.mattress_height;
  2626. if (idx > -1) {
  2627. visibleData[idx].mtrlid = _res.bednetid;
  2628. visibleData[idx].mtrlname = _mtrlname;
  2629. visibleData[idx].price = _res.nottax_factory_cost;
  2630. visibleData[idx].qty = 1;
  2631. await $table.reloadData(visibleData);
  2632. wf_rtr_cwdc(visibleData[idx], _res, "set");
  2633. } else {
  2634. let _data = cloneDeep(visibleData[0]);
  2635. let _row = {
  2636. addmx: "+",
  2637. delmx: "-",
  2638. formulatype: _data.formulatype,
  2639. if_mtrl: _data.if_mtrl,
  2640. formulaid: _data.formulaid,
  2641. sortcode: _data.sortcode,
  2642. formulakind: _data.formulakind,
  2643. formula: _data.formula,
  2644. thickness: 0,
  2645. mtrlid: _res.bednetid,
  2646. mtrlname: _mtrlname,
  2647. price: _res.nottax_factory_cost,
  2648. qty: 1
  2649. };
  2650. await $table.insertAt(_row, -1);
  2651. wf_rtr_cwdc(_row, _res, "add");
  2652. }
  2653. }
  2654. LjDrawerRef.value.hide();
  2655. };
  2656. /**
  2657. * @description 设置上次激活的标签页
  2658. * @param type 类型
  2659. * @param data 数据
  2660. */
  2661. const SetCurrentTabs = (data: any) => {
  2662. let _dwname = detailProps.dwname + "__fabric";
  2663. let _dftabs = globalStore?.detailtabs ?? {};
  2664. _dftabs[_dwname] = data.paneName;
  2665. globalStore.setGlobalState("mattresTabs", _dftabs);
  2666. };
  2667. /**
  2668. * @description 新增主副规格
  2669. */
  2670. const toAddMx_subSpecs = async () => {
  2671. const $table = subSpecsRef.value.element;
  2672. if ($table) {
  2673. let records = {
  2674. mattressid: 0,
  2675. mattresscode: "",
  2676. mattress_width: "",
  2677. mattress_length: "",
  2678. mattress_height: ""
  2679. };
  2680. const { row: newRow } = await $table.insertNextAt(records, -1);
  2681. await $table.setEditCell(newRow, "mattress_width");
  2682. await $table.setCurrentRow(newRow);
  2683. }
  2684. };
  2685. /**
  2686. * @description 删除主副规格
  2687. */
  2688. const toDelMx_subSpecs = () => {
  2689. const { $table, curRecords } = getCurrentRecords(subSpecsRef.value);
  2690. if ($table) {
  2691. $table.remove(curRecords);
  2692. }
  2693. };
  2694. /**
  2695. * @description 审核后,修改主副规格
  2696. */
  2697. const editSubSpecs = ref(false);
  2698. const toEdit_subSpecs = () => {
  2699. editSubSpecs.value = true;
  2700. tableProps_subSpecs.value.editConfig.enabled = true;
  2701. };
  2702. const toCancel_subSpecs = () => {
  2703. editSubSpecs.value = false;
  2704. subSpecsRef.value.refresh();
  2705. };
  2706. const toSave_subSpecs = async () => {
  2707. await save();
  2708. editSubSpecs.value = false;
  2709. };
  2710. const gotoMainMattress = () => {
  2711. if (globalStore.detailBlank) {
  2712. // 打开新的窗口
  2713. const routeUrl = router.resolve({
  2714. path: `/mattressQuote/detail`,
  2715. query: {
  2716. id: LjDetailRef.value._mainData.parentid
  2717. // code: row.mattresscode
  2718. }
  2719. });
  2720. window.open(routeUrl.href, "_blank");
  2721. } else {
  2722. router.push(`/mattressQuote/detail?id=${LjDetailRef.value._mainData.parentid}`);
  2723. }
  2724. };
  2725. const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
  2726. if (orderStatus.value || editSubSpecs.value) return false;
  2727. if (globalStore.detailBlank) {
  2728. // 打开新的窗口
  2729. const routeUrl = router.resolve({
  2730. path: `/mattressQuote/detail`,
  2731. query: {
  2732. id: row.mattressid,
  2733. code: row.mattresscode
  2734. }
  2735. });
  2736. window.open(routeUrl.href, "_blank");
  2737. } else {
  2738. router.push(`/mattressQuote/detail?id=${row.mattressid}&code=${row.mattresscode}`);
  2739. }
  2740. };
  2741. // 返回绑定的事件
  2742. const tableEvents = {
  2743. "cell-dblclick": handleDBlClickTable
  2744. };
  2745. const handleCellDblClick_bednet = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
  2746. console.log("handleCellDblClick_bednet row :>> ", row);
  2747. if (!orderStatus.value && row.mtrlid > 0) {
  2748. drawerTitle.value = "床网报价详情";
  2749. // bednetDrawerProps.deptid = LjDetailRef.value._mainData.deptid;
  2750. bednetDrawerProps.bednetid = row.mtrlid;
  2751. bednetDrawerProps.state = "";
  2752. bednetDrawerProps.onlyView = true;
  2753. LjDrawerRef.value.show(true);
  2754. }
  2755. };
  2756. </script>
  2757. <style lang="scss">
  2758. .select-text-right {
  2759. .el-select__wrapper {
  2760. text-align: right;
  2761. }
  2762. }
  2763. .fabric-mx-tabs {
  2764. .el-tabs__content {
  2765. flex: 1;
  2766. }
  2767. .el-tab-pane {
  2768. display: flex;
  2769. flex-direction: column;
  2770. }
  2771. }
  2772. </style>