detail.vue 105 KB

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