detail.vue 104 KB

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