add.vue 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196
  1. <template>
  2. <div id="addDemandList">
  3. <el-card style="position: relative">
  4. <span>基本信息</span>
  5. <el-form
  6. :model="basicForm"
  7. :rules="basicRules"
  8. ref="basic"
  9. label-width="auto"
  10. :show-message="false"
  11. >
  12. <el-row :gutter="10">
  13. <el-col :span="1.5">
  14. <el-form-item
  15. label="业务类型"
  16. prop="billType"
  17. :rules="{
  18. required: true,
  19. message: '请选择业务类型',
  20. trigger: 'blur',
  21. }"
  22. >
  23. <el-select
  24. clearable
  25. v-model="basicForm.billType"
  26. @change="changeBillType(basicForm.billType)"
  27. :disabled="sonDisable"
  28. :size="size"
  29. style="width: 200px"
  30. >
  31. <el-option
  32. v-for="dict in dict.type.sys_business"
  33. :key="dict.value"
  34. :label="dict.label"
  35. :value="dict.value"
  36. >
  37. </el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="1.5">
  42. <el-form-item label="需求客户">
  43. <el-select
  44. clearable
  45. :size="size"
  46. v-model="basicForm.customer"
  47. :disabled="sonDisable"
  48. @clear="cleanCustomer"
  49. @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')"
  50. style="width: 200px"
  51. >
  52. <el-option
  53. v-for="item in customerOptions"
  54. :key="item.id"
  55. :label="item.name"
  56. :value="item.id"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="1.5">
  62. <el-form-item label="需求人员">
  63. <el-select
  64. clearable
  65. :size="size"
  66. v-model="basicForm.demandPersonal"
  67. :disabled="sonDisable"
  68. @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')"
  69. style="width: 200px"
  70. >
  71. <el-option
  72. v-for="item in personOptions"
  73. :key="item.id"
  74. :label="item.name"
  75. :value="item.code"
  76. />
  77. </el-select>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :span="1.5">
  81. <el-form-item
  82. label="需求部门"
  83. prop="demandDept"
  84. :rules="{
  85. required: true,
  86. message: '请选择需求部门',
  87. trigger: 'blur',
  88. }"
  89. >
  90. <el-select
  91. clearable
  92. v-model="basicForm.demandDept"
  93. :size="size"
  94. :disabled="sonDisable"
  95. @focus="chooseOrg('DEPT_PARAM', true, '需求部门')"
  96. style="width: 200px"
  97. >
  98. <el-option
  99. v-for="item in deptOptions"
  100. :key="item.id"
  101. :label="item.name"
  102. :value="item.id"
  103. >
  104. </el-option>
  105. </el-select>
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="1.5">
  109. <el-form-item
  110. label="需求计划"
  111. prop="planType"
  112. :rules="{
  113. required: true,
  114. message: '请选择需求计划',
  115. trigger: 'blur',
  116. }"
  117. >
  118. <el-select
  119. :disabled="sonDisable"
  120. v-model="basicForm.planType"
  121. :size="size"
  122. style="width: 200px"
  123. @change="changeplanType(basicForm.planType)"
  124. >
  125. <el-option
  126. v-for="dict in dict.type.sys_plan_type"
  127. :key="dict.value"
  128. :label="dict.label"
  129. :value="dict.value"
  130. >
  131. </el-option>
  132. </el-select>
  133. </el-form-item>
  134. </el-col>
  135. <el-col :span="1.5">
  136. <el-form-item
  137. label="需求日期"
  138. prop="demandDate"
  139. :rules="{
  140. required: true,
  141. message: '请选择需求日期',
  142. trigger: 'blur',
  143. }"
  144. >
  145. <el-date-picker
  146. v-model="basicForm.demandDate"
  147. disabled
  148. clearable
  149. type="date"
  150. value-format="yyyy-MM-dd"
  151. @change="changeDemandDate"
  152. :size="size"
  153. style="width: 200px"
  154. >
  155. </el-date-picker>
  156. </el-form-item>
  157. </el-col>
  158. <el-col :span="1.5">
  159. <el-form-item label="制单日期" prop="createTime">
  160. <el-date-picker
  161. v-model="basicForm.createTime"
  162. disabled
  163. clearable
  164. type="date"
  165. value-format="yyyy-MM-dd"
  166. :size="size"
  167. style="width: 200px"
  168. >
  169. </el-date-picker>
  170. </el-form-item>
  171. </el-col>
  172. <el-col :span="1.5">
  173. <el-form-item label="是否客户指定">
  174. <el-select
  175. clearable
  176. @change="isCustomer"
  177. v-model="basicForm.isCustomerSpecified"
  178. :disabled="sonDisable"
  179. :size="size"
  180. style="width: 200px"
  181. >
  182. <el-option
  183. v-for="item in dict.type.sys_yes_no"
  184. :key="item.value"
  185. :label="item.label"
  186. :value="item.value"
  187. >
  188. </el-option>
  189. </el-select>
  190. </el-form-item>
  191. </el-col>
  192. <el-col :span="1.5">
  193. <el-form-item label="备注">
  194. <el-input
  195. v-model.trim="basicForm.remark"
  196. :size="size"
  197. :disabled="sonDisable"
  198. clearable
  199. style="width: 200px"
  200. />
  201. </el-form-item>
  202. </el-col>
  203. <!-- <el-col :span="1.5">
  204. <el-form-item label="需求客户名称">
  205. <el-input disabled v-model="basicForm.customerName" :size="size" style="width: 200px"></el-input>
  206. </el-form-item>
  207. </el-col> -->
  208. <el-col :span="1.5">
  209. <el-form-item label="需求单号">
  210. <el-input
  211. v-model="basicForm.code"
  212. :size="size"
  213. disabled
  214. style="width: 200px"
  215. />
  216. </el-form-item>
  217. </el-col>
  218. <!-- <el-col :span="1.5">
  219. <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
  220. <el-select clearable :size="size" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
  221. <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
  222. </el-select>
  223. </el-form-item>
  224. </el-col> -->
  225. <el-col :span="1.5">
  226. <el-form-item label="单据状态">
  227. <el-select
  228. disabled
  229. v-model="basicForm.status"
  230. :size="size"
  231. style="width: 200px"
  232. >
  233. <el-option
  234. v-for="dict in dict.type.sys_status"
  235. :key="dict.value"
  236. :label="dict.label"
  237. :value="dict.value"
  238. >
  239. </el-option>
  240. </el-select>
  241. </el-form-item>
  242. </el-col>
  243. <el-col :span="1.5">
  244. <el-form-item label="客户负责人">
  245. <el-select
  246. disabled
  247. :size="size"
  248. v-model="basicForm.customerPrincipal"
  249. style="width: 200px"
  250. >
  251. <el-option
  252. v-for="item in manOptions"
  253. :key="item.id"
  254. :label="item.name"
  255. :value="item.code"
  256. />
  257. </el-select>
  258. </el-form-item>
  259. </el-col>
  260. <el-col :span="1.5">
  261. <el-form-item label="单据来源">
  262. <el-select
  263. v-model="basicForm.source"
  264. disabled
  265. :size="size"
  266. style="width: 200px"
  267. >
  268. <el-option
  269. v-for="dict in dict.type.sys_bill_source"
  270. :key="dict.value"
  271. :label="dict.label"
  272. :value="dict.value"
  273. >
  274. </el-option>
  275. </el-select>
  276. </el-form-item>
  277. </el-col>
  278. <el-col :span="1.5">
  279. <el-form-item label="是否超需求可用周期">
  280. <el-select
  281. v-model="basicForm.isBeyondRap"
  282. disabled
  283. :size="size"
  284. style="width: 200px"
  285. >
  286. <el-option
  287. v-for="item in dict.type.sys_yes_no"
  288. :key="item.value"
  289. :label="item.label"
  290. :value="item.value"
  291. >
  292. </el-option>
  293. </el-select>
  294. </el-form-item>
  295. </el-col>
  296. </el-row>
  297. <div class="btn_grooup">
  298. <span>明细信息</span>
  299. <div>
  300. <el-button
  301. type="primary"
  302. :size="size"
  303. @click="addLine"
  304. v-if="!sonDisable"
  305. >增行</el-button
  306. >
  307. <el-button
  308. type="primary"
  309. :size="size"
  310. @click="delLines"
  311. v-if="!sonDisable"
  312. >删行</el-button
  313. >
  314. <el-button
  315. type="primary"
  316. :size="size"
  317. v-if="!sonDisable"
  318. @click.stop="adjustPl"
  319. >批量调整</el-button
  320. >
  321. <el-button
  322. type="primary"
  323. :size="size"
  324. v-if="sonPageStu == 'check' || sonPageStu == 'edit'"
  325. @click="showReserved"
  326. >货权预留单</el-button
  327. >
  328. </div>
  329. </div>
  330. <ux-grid
  331. v-loading="loading"
  332. :data="basicForm.puDemandItemList"
  333. border
  334. :cell-style="{ borderColor: '#c0c0c0' }"
  335. :header-cell-style="{ borderColor: '#c0c0c0' }"
  336. class="exporttable"
  337. height="410"
  338. max-height="410"
  339. style="font-size: 12px"
  340. @selection-change="handleSelectionChange"
  341. :cell-class-name="cellClassName"
  342. ref="table"
  343. :rules="tableRules"
  344. show-header-overflow="tooltip"
  345. show-overflow="tooltip"
  346. keep-source
  347. beautifyTable
  348. show-summary
  349. :summary-method="jisuan"
  350. :checkbox-config="{ highlight: true, trigger: 'row' }"
  351. :edit-config="{ trigger: 'click', mode: 'row' }"
  352. :validConfig="{ autoPos: true }"
  353. >
  354. >
  355. <ux-table-column resizable type="checkbox" fixed="left" />
  356. <!-- <ux-table-column resizable title="序号" type="index" align="center" width="50px"/> -->
  357. <ux-table-column
  358. resizable
  359. title="行号"
  360. align="center"
  361. field="rowNo"
  362. width="50px"
  363. >
  364. <template v-slot="scope">
  365. {{ (scope.row.rowNo = scope.rowIndex + 1 + "0") }}
  366. </template>
  367. </ux-table-column>
  368. <ux-table-column
  369. resizable
  370. title="默认采购组织"
  371. align="center"
  372. field="purOrgName"
  373. width="100px"
  374. />
  375. <ux-table-column
  376. resizable
  377. title="需求客户"
  378. align="center"
  379. field="demandCustomerName"
  380. width="100px"
  381. />
  382. <ux-table-column
  383. resizable
  384. title="行状态"
  385. align="center"
  386. field="status"
  387. :formatter="hangStatus"
  388. width="100px"
  389. />
  390. <ux-table-column
  391. resizable
  392. title="物料编码"
  393. align="center"
  394. field="materialCode"
  395. width="150px"
  396. :render-header="addRedStar"
  397. :edit-render="{ autofocus: '.el-input__inner' }"
  398. >
  399. <template v-slot:edit="scope">
  400. <el-input
  401. clearable
  402. :disabled="sonDisable"
  403. :size="size"
  404. v-model="scope.row.materialCode"
  405. @paste.native="pasteMe($event, scope, scope.rowIndex)"
  406. >
  407. <el-button
  408. :size="size"
  409. :disabled="sonDisable"
  410. slot="append"
  411. icon="el-icon-more"
  412. @click="chooseMaterial(scope.rowIndex)"
  413. ></el-button>
  414. </el-input>
  415. </template>
  416. </ux-table-column>
  417. <ux-table-column
  418. resizable
  419. title="物料名称"
  420. align="center"
  421. field="materialName"
  422. width="100px"
  423. />
  424. <ux-table-column
  425. resizable
  426. title="规格"
  427. align="center"
  428. field="specification"
  429. width="50px"
  430. />
  431. <ux-table-column
  432. resizable
  433. title="型号"
  434. align="center"
  435. field="model"
  436. width="50px"
  437. />
  438. <ux-table-column
  439. resizable
  440. title="单位"
  441. align="center"
  442. field="unitName"
  443. width="50px"
  444. />
  445. <ux-table-column
  446. resizable
  447. title="生产厂家/代理人"
  448. align="center"
  449. field="manufacturerName"
  450. width="100px"
  451. />
  452. <ux-table-column
  453. resizable
  454. title="最小包装"
  455. align="center"
  456. field="minPackage"
  457. width="80px"
  458. />
  459. <ux-table-column
  460. resizable
  461. title="月均销量"
  462. align="center"
  463. field="averageQtyMonth"
  464. width="80px"
  465. />
  466. <ux-table-column
  467. resizable
  468. title="需求可用周期"
  469. align="center"
  470. field="demandPeriod"
  471. width="80px"
  472. />
  473. <ux-table-column
  474. resizable
  475. title="实际(业务)需求量"
  476. align="center"
  477. field="qty"
  478. width="150px"
  479. :render-header="addRedStar"
  480. edit-render
  481. >
  482. <template v-slot:edit="scope">
  483. <el-input
  484. type="number"
  485. min="0"
  486. clearable
  487. :disabled="sonDisable"
  488. :size="size"
  489. v-model="scope.row.qty"
  490. @paste.native="pasteMe($event, scope, scope.rowIndex)"
  491. />
  492. </template>
  493. </ux-table-column>
  494. <ux-table-column
  495. resizable
  496. title="紧急标识"
  497. align="center"
  498. field="isUrgency"
  499. width="100px"
  500. edit-render
  501. >
  502. <template v-slot:edit="scope">
  503. <el-switch
  504. v-model="scope.row.isUrgency"
  505. :disabled="sonDisable"
  506. active-value="Y"
  507. inactive-value="N"
  508. active-color="#13ce66"
  509. inactive-color="#a1a3a9"
  510. >
  511. </el-switch>
  512. </template>
  513. <template v-slot="{ row }">{{
  514. row.isUrgency == "Y" ? "是" : "否"
  515. }}</template>
  516. </ux-table-column>
  517. <ux-table-column
  518. resizable
  519. title="收货仓库"
  520. align="center"
  521. field="deliveryWarehouseName"
  522. width="200px"
  523. edit-render
  524. >
  525. <template v-slot:edit="scope">
  526. <el-input
  527. clearable
  528. :disabled="sonDisable"
  529. :size="size"
  530. v-model="scope.row.deliveryWarehouseName"
  531. @clear="clearHang(scope.rowIndex, '选择收货仓库')"
  532. >
  533. <el-button
  534. :size="size"
  535. :disabled="sonDisable"
  536. slot="append"
  537. icon="el-icon-more"
  538. @click="
  539. chooseCangKu(
  540. scope.rowIndex,
  541. 'WAREHOUSE_PARAM',
  542. true,
  543. '选择收货仓库',
  544. scope.row.puOrg
  545. )
  546. "
  547. ></el-button>
  548. </el-input>
  549. </template>
  550. </ux-table-column>
  551. <ux-table-column
  552. resizable
  553. title="收货货位"
  554. align="center"
  555. field="deliveryAllocationName"
  556. width="200px"
  557. edit-render
  558. >
  559. <template v-slot:edit="scope">
  560. <el-input
  561. clearable
  562. :disabled="sonDisable"
  563. :size="size"
  564. v-model="scope.row.deliveryAllocationName"
  565. @clear="clearHang(scope.rowIndex, '选择收货货位')"
  566. >
  567. <el-button
  568. :size="size"
  569. :disabled="sonDisable"
  570. slot="append"
  571. icon="el-icon-more"
  572. @click="
  573. choosehuoWei(
  574. scope.rowIndex,
  575. 'ALLOCATION_PARAM',
  576. true,
  577. '选择收货货位',
  578. scope.row.deliveryWarehouse
  579. )
  580. "
  581. ></el-button>
  582. </el-input>
  583. </template>
  584. </ux-table-column>
  585. <ux-table-column
  586. resizable
  587. title="业务备注"
  588. align="center"
  589. field="remark"
  590. width="150px"
  591. edit-render
  592. >
  593. <template v-slot:edit="scope">
  594. <el-input
  595. clearable
  596. :disabled="sonDisable"
  597. :size="size"
  598. v-model="scope.row.remark"
  599. />
  600. </template>
  601. </ux-table-column>
  602. <ux-table-column
  603. resizable
  604. title="物料一级分类"
  605. align="center"
  606. field="materialClassifyOneName"
  607. width="100px"
  608. />
  609. <ux-table-column
  610. resizable
  611. title="物料二级分类"
  612. align="center"
  613. field="materialClassifyTwoName"
  614. width="100px"
  615. />
  616. <ux-table-column
  617. resizable
  618. title="物料三级分类"
  619. align="center"
  620. field="materialClassifyThreeName"
  621. width="100px"
  622. />
  623. <ux-table-column
  624. resizable
  625. title="物料四级分类"
  626. align="center"
  627. field="materialClassifyFourName"
  628. width="100px"
  629. />
  630. <ux-table-column
  631. resizable
  632. title="最小批量"
  633. align="center"
  634. field="minBatch"
  635. width="100px"
  636. />
  637. <ux-table-column
  638. resizable
  639. title="最小订货量"
  640. align="center"
  641. field="minOrderQty"
  642. width="100px"
  643. />
  644. <ux-table-column
  645. resizable
  646. title="采购员"
  647. align="center"
  648. field="buyerName"
  649. width="100px"
  650. />
  651. <!-- <ux-table-column resizable title="采购员" align="center" field="buyer"/> -->
  652. <ux-table-column
  653. resizable
  654. title="采购周期"
  655. align="center"
  656. field="puPeriod"
  657. width="100px"
  658. />
  659. <ux-table-column
  660. resizable
  661. title="交货日期"
  662. align="center"
  663. field="deliveryDate"
  664. width="230px"
  665. edit-render
  666. >
  667. <template v-slot:edit="scope">
  668. <el-date-picker
  669. v-model="scope.row.deliveryDate"
  670. :disabled="sonDisable"
  671. clearable
  672. type="date"
  673. :size="size"
  674. value-format="yyyy-MM-dd"
  675. :picker-options="pickerOptionsEnd"
  676. placeholder="选择日期"
  677. >
  678. </el-date-picker>
  679. </template>
  680. </ux-table-column>
  681. <ux-table-column
  682. resizable
  683. title="有效期"
  684. align="center"
  685. field="expiry"
  686. width="100px"
  687. />
  688. <ux-table-column
  689. resizable
  690. title="有效期单位"
  691. align="center"
  692. field="expiryUnit"
  693. width="100px"
  694. />
  695. <!-- <ux-table-column resizable title="安全库存" align="center" field="safeStock" width="100px"/> -->
  696. <ux-table-column
  697. resizable
  698. title="注册人"
  699. align="center"
  700. field="registrant"
  701. width="100px"
  702. />
  703. <!-- <ux-table-column resizable title="预留比例" align="center" field="reservedProportion" width="120px" edit-render>
  704. <template v-slot:edit="scope">
  705. <el-select clearable :disabled="sonDisable" :size="size" v-model="scope.row.reservedProportion" @clear="cleanYLSL(scope)">
  706. <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
  707. </el-option>
  708. </el-select>
  709. </template>
  710. </ux-table-column> -->
  711. <!-- <ux-table-column resizable title="预留周期" align="center" field="reservedPeriod" width="120px" edit-render>
  712. <template v-slot:edit="scope">
  713. <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" clearable :disabled="sonDisable" :size="size" v-model="scope.row.reservedPeriod"></el-input>
  714. </template>
  715. </ux-table-column>
  716. <ux-table-column resizable title="预留数量" align="center" field="reservedQty" width="120px" edit-render>
  717. <template v-slot:edit="scope">
  718. <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" @input="scope.row.reservedQty=Math.ceil(scope.row.reservedQty)" clearable :disabled="sonDisable" :size="size" v-model="scope.row.reservedQty"></el-input>
  719. </template>
  720. </ux-table-column> -->
  721. <ux-table-column
  722. resizable
  723. title="集团预测分类"
  724. align="center"
  725. field="forecastClassify"
  726. width="120px"
  727. />
  728. <ux-table-column
  729. resizable
  730. title="近一月需求"
  731. align="center"
  732. field="onemonthAvgVolume"
  733. width="100px"
  734. />
  735. <ux-table-column
  736. resizable
  737. title="近三月需求"
  738. align="center"
  739. field="threemonthAvgVolume"
  740. width="100px"
  741. />
  742. <ux-table-column
  743. resizable
  744. title="采购在途"
  745. align="center"
  746. field="puFreight"
  747. width="100px"
  748. />
  749. <ux-table-column
  750. resizable
  751. title="补单标识"
  752. align="center"
  753. field="isReplenishment"
  754. width="100px"
  755. edit-render
  756. >
  757. <template v-slot:edit="scope">
  758. <el-switch
  759. v-model="scope.row.isReplenishment"
  760. disabled
  761. active-value="Y"
  762. inactive-value="N"
  763. active-color="#13ce66"
  764. inactive-color="#a1a3a9"
  765. >
  766. </el-switch>
  767. </template>
  768. <template v-slot="{ row }">{{
  769. row.isReplenishment == "Y" ? "是" : "否"
  770. }}</template>
  771. </ux-table-column>
  772. <ux-table-column
  773. resizable
  774. title="补单供应商"
  775. align="center"
  776. field="additionalSupplierName"
  777. width="200px"
  778. :render-header="anotherRedStar"
  779. edit-render
  780. >
  781. <template v-slot:edit="scope">
  782. <el-input
  783. clearable
  784. :disabled="sonDisable || BDZT"
  785. :size="size"
  786. v-model="scope.row.additionalSupplierName"
  787. @clear="clearHang(scope.rowIndex, '选择补单供应商')"
  788. @paste.native="pasteMe($event, scope, scope.rowIndex)"
  789. >
  790. <el-button
  791. :size="size"
  792. :disabled="sonDisable || BDZT"
  793. slot="append"
  794. icon="el-icon-more"
  795. @click="
  796. chooseDept(
  797. scope.rowIndex,
  798. 'SUPPLIER_PARAM',
  799. true,
  800. '选择补单供应商'
  801. )
  802. "
  803. ></el-button>
  804. </el-input>
  805. </template>
  806. </ux-table-column>
  807. <ux-table-column
  808. resizable
  809. title="末级供应库存组织"
  810. align="center"
  811. field="lastStockOrgName"
  812. width="180px"
  813. ></ux-table-column>
  814. <ux-table-column
  815. resizable
  816. title="末级供应仓库"
  817. align="center"
  818. field="lastWarehouseName"
  819. width="150px"
  820. />
  821. <ux-table-column
  822. resizable
  823. title="末级供应货位"
  824. align="center"
  825. field="lastAllocationName"
  826. width="150px"
  827. />
  828. <ux-table-column
  829. resizable
  830. title="中心仓可用量"
  831. align="center"
  832. field="centralWarehouseQty"
  833. width="120px"
  834. />
  835. <ux-table-column
  836. resizable
  837. title="调拨状态"
  838. align="center"
  839. field="statusAllot"
  840. width="100px"
  841. edit-render
  842. >
  843. <template v-slot:edit="scope">
  844. <el-switch
  845. v-model="scope.row.statusAllot"
  846. :disabled="sonDisable"
  847. active-value="Y"
  848. inactive-value="N"
  849. active-color="#13ce66"
  850. inactive-color="#a1a3a9"
  851. >
  852. </el-switch>
  853. </template>
  854. <template v-slot="{ row }">{{
  855. row.statusAllot == "Y" ? "是" : "否"
  856. }}</template>
  857. </ux-table-column>
  858. <ux-table-column
  859. resizable
  860. title="调拨单号"
  861. align="center"
  862. field="allotCode"
  863. ></ux-table-column>
  864. <ux-table-column
  865. resizable
  866. title="调拨占有量"
  867. align="center"
  868. field="allotQty"
  869. width="100px"
  870. />
  871. <ux-table-column
  872. resizable
  873. title="最终净需求量"
  874. align="center"
  875. field="resDemandQty"
  876. width="120px"
  877. />
  878. <ux-table-column
  879. resizable
  880. title="关闭数量"
  881. align="center"
  882. field="closeQty"
  883. width="80px"
  884. />
  885. <ux-table-column
  886. resizable
  887. title="最终采购执行数量"
  888. align="center"
  889. field="executeQty"
  890. width="150px"
  891. >
  892. <template v-slot:edit="scope">
  893. {{ scope.row.executeQty ? scope.row.executeQty : 0 }}
  894. </template>
  895. </ux-table-column>
  896. <ux-table-column
  897. resizable
  898. title="收货地址"
  899. align="center"
  900. field="deliveryAddressName"
  901. width="200px"
  902. edit-render
  903. >
  904. <template v-slot:edit="scope">
  905. <el-input
  906. clearable
  907. :disabled="sonDisable"
  908. :size="size"
  909. v-model="scope.row.deliveryAddressName"
  910. @clear="clearHang(scope.rowIndex, '选择收货地址')"
  911. @paste.native="pasteMe($event, scope, scope.rowIndex)"
  912. >
  913. <el-button
  914. :size="size"
  915. :disabled="sonDisable"
  916. slot="append"
  917. icon="el-icon-more"
  918. @click="
  919. chooseDept(
  920. scope.rowIndex,
  921. 'ADDRESS_PARAM',
  922. true,
  923. '选择收货地址'
  924. )
  925. "
  926. ></el-button>
  927. </el-input>
  928. </template>
  929. </ux-table-column>
  930. <ux-table-column
  931. resizable
  932. title="联系人"
  933. align="center"
  934. field="contacts"
  935. width="100px"
  936. />
  937. <ux-table-column
  938. resizable
  939. title="联系人电话"
  940. align="center"
  941. field="contactsPhone"
  942. width="150px"
  943. />
  944. <ux-table-column
  945. resizable
  946. title="详细地址"
  947. align="center"
  948. field="address"
  949. width="150px"
  950. />
  951. <ux-table-column
  952. resizable
  953. title="价格类型"
  954. align="center"
  955. field="priceType"
  956. width="120px"
  957. edit-render
  958. >
  959. <template v-slot:edit="scope">
  960. <el-select
  961. clearable
  962. :disabled="sonDisable"
  963. :size="size"
  964. v-model="scope.row.priceType"
  965. >
  966. <el-option
  967. v-for="dict in dict.type.sys_price_type"
  968. :key="dict.value"
  969. :label="dict.label"
  970. :value="dict.value"
  971. >
  972. </el-option>
  973. </el-select>
  974. </template>
  975. <template v-slot="{ row }">{{
  976. row.priceType == "order"
  977. ? "订货价"
  978. : row.priceType == "consignment"
  979. ? "寄售价"
  980. : row.priceType == "adjusted"
  981. ? "调货价"
  982. : ""
  983. }}</template>
  984. </ux-table-column>
  985. <ux-table-column
  986. resizable
  987. title="是否客户指定"
  988. align="center"
  989. field="isCustomerSpecified"
  990. width="120px"
  991. edit-render
  992. >
  993. <template v-slot:edit="scope">
  994. <el-switch
  995. v-model="scope.row.isCustomerSpecified"
  996. disabled
  997. active-value="Y"
  998. inactive-value="N"
  999. active-color="#13ce66"
  1000. inactive-color="#a1a3a9"
  1001. >
  1002. </el-switch>
  1003. </template>
  1004. <template v-slot="{ row }">{{
  1005. row.isCustomerSpecified == "Y" ? "是" : "否"
  1006. }}</template>
  1007. </ux-table-column>
  1008. <!-- <ux-table-column resizable title="批号锁定标识" align="center" field="isBatchLock" width="100px">
  1009. <template v-slot:edit="scope">
  1010. <el-form-item class="hang">
  1011. <el-switch
  1012. v-model="scope.row.isBatchLock"
  1013. :disabled="sonDisable"
  1014. active-value="Y"
  1015. inactive-value="N"
  1016. active-color="#13ce66"
  1017. inactive-color="#a1a3a9">
  1018. </el-switch>
  1019. </el-form-item>
  1020. </template>
  1021. </ux-table-column> -->
  1022. <ux-table-column
  1023. resizable
  1024. title="采购备注"
  1025. align="center"
  1026. field="updateCause"
  1027. width="100px"
  1028. />
  1029. <ux-table-column
  1030. resizable
  1031. title="可用量"
  1032. align="center"
  1033. field="availableQty"
  1034. width="100px"
  1035. />
  1036. <ux-table-column
  1037. fixed="right"
  1038. title="操作"
  1039. width="100px"
  1040. align="center"
  1041. >
  1042. <template slot-scope="scope">
  1043. <el-button
  1044. type="text"
  1045. :size="size"
  1046. :disabled="sonDisable"
  1047. @click="delLine(scope.rowIndex, scope.row)"
  1048. >删除</el-button
  1049. >
  1050. </template>
  1051. </ux-table-column>
  1052. </ux-grid>
  1053. </el-form>
  1054. <div class="btn_group">
  1055. <el-button
  1056. type="primary"
  1057. :size="size"
  1058. @click="jumpOA"
  1059. v-if="
  1060. sonPageStu == 'check' &&
  1061. (row.status == '1' || row.status == '2') &&
  1062. basicForm.flowId
  1063. "
  1064. >流程跳转</el-button
  1065. >
  1066. <el-button
  1067. type="primary"
  1068. :size="size"
  1069. @click="copy"
  1070. v-if="sonPageStu == 'check'"
  1071. >复制</el-button
  1072. >
  1073. <el-button
  1074. type="primary"
  1075. :size="size"
  1076. @click="editPage"
  1077. v-if="sonPageStu == 'check' && row.status == '0'"
  1078. >编辑</el-button
  1079. >
  1080. <el-button
  1081. type="primary"
  1082. :size="size"
  1083. @click="save"
  1084. v-if="sonPageStu == 'add' || sonPageStu == 'edit'"
  1085. >保存</el-button
  1086. >
  1087. <el-button
  1088. type="primary"
  1089. :size="size"
  1090. @click="submit"
  1091. v-if="
  1092. sonPageStu == 'check' && (row.status == '0' || row.status == '3')
  1093. "
  1094. >提交</el-button
  1095. >
  1096. <el-button :size="size" plain @click="back">返回</el-button>
  1097. </div>
  1098. </el-card>
  1099. <Reserved
  1100. v-if="dialog.config"
  1101. :isVisible="dialog.config"
  1102. :info="row"
  1103. @updateReserved="updateReserved"
  1104. />
  1105. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true" />
  1106. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="false" />
  1107. <!-- 批量调整参数 -->
  1108. <el-dialog
  1109. title="批量调整"
  1110. :visible.sync="adjust.open"
  1111. @close="closeEvent"
  1112. width="38%"
  1113. >
  1114. <el-row style="margin-bottom: 10px">
  1115. <el-col :span="6" class="pltzTxt">默认采购组织</el-col>
  1116. <el-col :span="14">
  1117. <el-input
  1118. class="pltzIpt"
  1119. clearable
  1120. :size="size"
  1121. v-model="adjust.purOrgName"
  1122. @clear="clearHang(0, 'cgzz')"
  1123. @focus="chooseOrg('ORG_PARAM', true, '采购组织')"
  1124. >
  1125. <el-button
  1126. :size="size"
  1127. slot="append"
  1128. icon="el-icon-more"
  1129. @click="chooseOrg('ORG_PARAM', true, '采购组织')"
  1130. ></el-button>
  1131. </el-input>
  1132. </el-col>
  1133. </el-row>
  1134. <el-row style="margin-bottom: 10px">
  1135. <el-col :span="6" class="pltzTxt">价格类型</el-col>
  1136. <el-col :span="14">
  1137. <el-select
  1138. class="pltzIpt"
  1139. clearable
  1140. :size="size"
  1141. v-model="adjust.priceType"
  1142. >
  1143. <el-option
  1144. v-for="dict in dict.type.sys_price_type"
  1145. :key="dict.value"
  1146. :label="dict.label"
  1147. :value="dict.value"
  1148. >
  1149. </el-option>
  1150. </el-select>
  1151. </el-col>
  1152. </el-row>
  1153. <el-row style="margin-bottom: 10px">
  1154. <el-col :span="6" class="pltzTxt">采购员</el-col>
  1155. <el-col :span="14">
  1156. <el-select
  1157. class="pltzIpt"
  1158. clearable
  1159. :size="size"
  1160. v-model="adjust.purchaseMan"
  1161. @focus="chooseOrg('CONTACTS_PARAM', true, '采购员')"
  1162. >
  1163. <el-option
  1164. v-for="item in purchaseManOptions"
  1165. :key="item.id"
  1166. :label="item.name"
  1167. :value="item.code"
  1168. />
  1169. </el-select>
  1170. </el-col>
  1171. </el-row>
  1172. <el-row style="margin-bottom: 10px">
  1173. <el-col :span="6" class="pltzTxt">收货仓库</el-col>
  1174. <el-col :span="14">
  1175. <el-input
  1176. class="pltzIpt"
  1177. clearable
  1178. :size="size"
  1179. v-model="adjust.warehouseName"
  1180. @clear="clearHang(0, 'shck')"
  1181. @focus="
  1182. adjustCangku('WAREHOUSE_PARAM', true, '收货仓库', adjust.puOrg)
  1183. "
  1184. >
  1185. <el-button
  1186. :size="size"
  1187. slot="append"
  1188. icon="el-icon-more"
  1189. @click="
  1190. adjustCangku('WAREHOUSE_PARAM', true, '收货仓库', adjust.puOrg)
  1191. "
  1192. ></el-button>
  1193. </el-input>
  1194. </el-col>
  1195. </el-row>
  1196. <el-row style="margin-bottom: 10px">
  1197. <el-col :span="6" class="pltzTxt">收货货位</el-col>
  1198. <el-col :span="14">
  1199. <el-input
  1200. class="pltzIpt"
  1201. clearable
  1202. :size="size"
  1203. v-model="adjust.allocationName"
  1204. @clear="clearHang(0, 'shhw')"
  1205. @focus="
  1206. adjustHuoWei(
  1207. 'ALLOCATION_PARAM',
  1208. true,
  1209. '收货货位',
  1210. adjust.warehouse
  1211. )
  1212. "
  1213. >
  1214. <el-button
  1215. :size="size"
  1216. slot="append"
  1217. icon="el-icon-more"
  1218. @click="
  1219. adjustHuoWei(
  1220. 'ALLOCATION_PARAM',
  1221. true,
  1222. '收货货位',
  1223. adjust.warehouse
  1224. )
  1225. "
  1226. ></el-button>
  1227. </el-input>
  1228. </el-col>
  1229. </el-row>
  1230. <el-row style="margin-bottom: 10px">
  1231. <el-col :span="6" class="pltzTxt">补单供应商</el-col>
  1232. <el-col :span="14">
  1233. <el-input
  1234. class="pltzIpt"
  1235. clearable
  1236. :disabled="sonDisable || BDZT"
  1237. :size="size"
  1238. @clear="clearHang(0, 'bdgys')"
  1239. v-model="adjust.additionalSupplierName"
  1240. @focus="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')"
  1241. >
  1242. <el-button
  1243. :size="size"
  1244. :disabled="sonDisable || BDZT"
  1245. slot="append"
  1246. icon="el-icon-more"
  1247. @click="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')"
  1248. ></el-button>
  1249. </el-input>
  1250. </el-col>
  1251. </el-row>
  1252. <el-row style="margin-bottom: 10px">
  1253. <el-col :span="6" class="pltzTxt">业务备注</el-col>
  1254. <el-col :span="14">
  1255. <el-input
  1256. class="pltzIpt"
  1257. clearable
  1258. :size="size"
  1259. v-model="adjust.remark"
  1260. />
  1261. </el-col>
  1262. </el-row>
  1263. <el-row style="margin-bottom: 10px">
  1264. <el-col :span="6" class="pltzTxt">收货地址</el-col>
  1265. <el-col :span="14">
  1266. <el-input
  1267. class="pltzIpt"
  1268. clearable
  1269. :size="size"
  1270. @clear="clearHang(0, 'shdz')"
  1271. v-model="adjust.deliveryAddressName"
  1272. >
  1273. <el-button
  1274. :size="size"
  1275. slot="append"
  1276. icon="el-icon-more"
  1277. @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"
  1278. ></el-button>
  1279. </el-input>
  1280. </el-col>
  1281. </el-row>
  1282. <el-row style="margin-bottom: 10px">
  1283. <el-col :span="6" class="pltzTxt">收货地址编码</el-col>
  1284. <el-col :span="14">
  1285. <el-input
  1286. class="pltzIpt"
  1287. disabled
  1288. clearable
  1289. :size="size"
  1290. v-model="adjust.deliveryAddress"
  1291. />
  1292. </el-col>
  1293. </el-row>
  1294. <el-row style="margin-bottom: 10px">
  1295. <el-col :span="6" class="pltzTxt">联系人</el-col>
  1296. <el-col :span="14">
  1297. <el-input
  1298. class="pltzIpt"
  1299. disabled
  1300. clearable
  1301. :size="size"
  1302. v-model="adjust.contacts"
  1303. />
  1304. </el-col>
  1305. </el-row>
  1306. <el-row style="margin-bottom: 10px">
  1307. <el-col :span="6" class="pltzTxt">联系人电话</el-col>
  1308. <el-col :span="14">
  1309. <el-input
  1310. class="pltzIpt"
  1311. disabled
  1312. clearable
  1313. :size="size"
  1314. v-model="adjust.contactsPhone"
  1315. />
  1316. </el-col>
  1317. </el-row>
  1318. <el-row style="margin-bottom: 10px">
  1319. <el-col :span="6" class="pltzTxt">详细地址</el-col>
  1320. <el-col :span="14">
  1321. <el-input
  1322. class="pltzIpt"
  1323. disabled
  1324. clearable
  1325. :size="size"
  1326. v-model="adjust.address"
  1327. />
  1328. </el-col>
  1329. </el-row>
  1330. <div slot="footer">
  1331. <el-button :size="size" type="primary" @click="confirmAdjust"
  1332. >确 认</el-button
  1333. >
  1334. <el-button :size="size" @click="adjust.open = false">取 消</el-button>
  1335. </div>
  1336. </el-dialog>
  1337. </div>
  1338. </template>
  1339. <script>
  1340. import {
  1341. addDemand,
  1342. getDemandDetail,
  1343. getDemandSonDetail,
  1344. editDemand,
  1345. submitDemand,
  1346. queryMan,
  1347. toOA,
  1348. confirmSubmit,
  1349. } from "@/api/purchase/purchaseDemand.js";
  1350. // 用于回显参照框数据
  1351. import { getRefer } from "@/api/purchase/basic.js";
  1352. import ElTableInfiniteScroll from "el-table-infinite-scroll";
  1353. import "regenerator-runtime/runtime";
  1354. export default {
  1355. directives: {
  1356. "el-table-infinite-scroll": ElTableInfiniteScroll,
  1357. },
  1358. name: "addDemandList",
  1359. props: ["pageStu", "row", "disable"],
  1360. dicts: [
  1361. "sys_yes_no",
  1362. "sys_processing_mode",
  1363. "sys_plan_type",
  1364. "sys_status",
  1365. "sys_bill_source",
  1366. "sys_business",
  1367. "sys_reserve_ratio",
  1368. "sys_period_unit",
  1369. "sys_price_type",
  1370. ],
  1371. components: {
  1372. Reserved: () => import("./reserved/index.vue"),
  1373. Refers: () => import("@/components/Refers/refers.vue"),
  1374. popDialog: () => import("@/components/PopDialog/index.vue"),
  1375. },
  1376. model: {
  1377. prop: "isList",
  1378. event: "jugislist",
  1379. },
  1380. data() {
  1381. return {
  1382. size: "mini",
  1383. loading: true,
  1384. // 不能直接改变props传来的值
  1385. sonPageStu: this.pageStu,
  1386. sonDisable: this.disable,
  1387. // BDZT是补单供应商是否可以编辑条件
  1388. BDZT: true,
  1389. dialog: {
  1390. config: false,
  1391. },
  1392. basicForm: {
  1393. code: "",
  1394. org: "",
  1395. orgName: "",
  1396. demandBusinessType: "1",
  1397. status: "0",
  1398. customer: "",
  1399. customerName: "",
  1400. customerCode: "",
  1401. customerPrincipal: "",
  1402. demandPersonal: "",
  1403. demandPersonalName: "",
  1404. demandDept: "",
  1405. demandDeptName: "",
  1406. planType: "ZJH",
  1407. demandDate: "",
  1408. source: "4",
  1409. isBeyondRap: "",
  1410. billType: "ZQBH",
  1411. isCustomerSpecified: "N",
  1412. isProcess: "",
  1413. isMonthleyCalculate: "",
  1414. createTime: this.parseTime(new Date().getTime()),
  1415. remark: "",
  1416. puDemandItemList: [],
  1417. },
  1418. delDemandItemList: [],
  1419. basicRules: {},
  1420. tableList: [],
  1421. referCondition: {
  1422. type: "",
  1423. isPage: true,
  1424. title: "",
  1425. },
  1426. // referCondition: {
  1427. // type: '',
  1428. // isPage: true,
  1429. // title: '',
  1430. // },
  1431. tableIndex: null,
  1432. ids: [],
  1433. orgOptions: [],
  1434. manOptions: [],
  1435. personOptions: [],
  1436. deptOptions: [],
  1437. customerOptions: [],
  1438. pickerOptionsEnd: {
  1439. disabledDate: (time) => {
  1440. return (
  1441. time.getTime() <
  1442. new Date(this.basicForm.demandDate).getTime() - 8.64e7
  1443. );
  1444. },
  1445. },
  1446. isBDXQ: false,
  1447. isYl: false,
  1448. // 批量调整参数
  1449. adjust: {
  1450. open: false,
  1451. puOrg: "",
  1452. purOrgName: "",
  1453. priceType: "",
  1454. purchaseMan: "",
  1455. purchaseManName: "",
  1456. warehouse: "",
  1457. warehouseName: "",
  1458. csFlag: "",
  1459. allocation: "",
  1460. allocationName: "",
  1461. additionalSupplier: "",
  1462. additionalSupplierName: "",
  1463. remark: "",
  1464. deliveryAddress: "",
  1465. deliveryAddressName: "",
  1466. contacts: "",
  1467. contactsPhone: "",
  1468. address: "",
  1469. },
  1470. purchaseManOptions: [],
  1471. sonModel: {
  1472. rowNo: null,
  1473. contacts: null,
  1474. id: null,
  1475. demandId: null,
  1476. status: null,
  1477. materialCategory: null,
  1478. buyer: null,
  1479. buyerName: null,
  1480. mateiralClassifyOne: null,
  1481. materialClassifyOneName: null,
  1482. materialClassifyTwo: null,
  1483. materialClassifyTwoName: null,
  1484. materialClassifyThree: null,
  1485. materialClassifyThreeName: null,
  1486. materialClassifyFour: null,
  1487. materialClassifyFourName: null,
  1488. materialCode: null,
  1489. material: null,
  1490. materialName: null,
  1491. classifyId: null,
  1492. specification: null,
  1493. unit: null,
  1494. unitName: null,
  1495. manufacturerName: null,
  1496. registrant: null,
  1497. puPeriod: null,
  1498. expiryUnit: null,
  1499. expiry: null,
  1500. minPackage: null,
  1501. minOrderQty: null,
  1502. minBatch: null,
  1503. safeStock: null,
  1504. averageQtyMonth: null,
  1505. qty: null,
  1506. adjustmentPersonal: null,
  1507. adjustmentTime: null,
  1508. manualRegulation: null,
  1509. updateCause: null,
  1510. reservedProportion: null,
  1511. reservedPeriod: null,
  1512. reservedQty: null,
  1513. demandPeriod: null,
  1514. forecastClassify: null,
  1515. onemonthAvgVolume: null,
  1516. threemonthAvgVolume: null,
  1517. puFreight: null,
  1518. deliveryDate: null,
  1519. isUrgency: "N",
  1520. isReplenishment: "N",
  1521. isBatchLock: "N",
  1522. isCustomerSpecified: "",
  1523. remark: null,
  1524. puRemark: null,
  1525. lastWarehouseQty: null,
  1526. resDemandQty: null,
  1527. lastWarehouse: null,
  1528. lastWarehouseName: null,
  1529. deliveryWarehouse: null,
  1530. deliveryWarehouseName: null,
  1531. lastAllocation: null,
  1532. lastAllocationName: null,
  1533. deliveryAllocation: null,
  1534. deliveryAllocationName: null,
  1535. passageOn: null,
  1536. puOrg: null,
  1537. purOrgName: null,
  1538. lastStockQty: null,
  1539. superiorCenterQty: null,
  1540. superiorAllotQty: null,
  1541. availableQty: null,
  1542. statusAllot: "N",
  1543. additionalSupplier: null,
  1544. additionalSupplierName: null,
  1545. periodUnit: null,
  1546. demandCustomer: null,
  1547. demandCustomerName: null,
  1548. lastStockOrg: null,
  1549. lastStockOrgName: null,
  1550. superiorStockOrg: null,
  1551. superiorStockOrgName: null,
  1552. allotCode: null,
  1553. deliveryAddress: null,
  1554. deliveryAddressName: null,
  1555. contacts: null,
  1556. contactsPhone: null,
  1557. address: null,
  1558. source: null,
  1559. priceType: "order",
  1560. puManagerApprover: null,
  1561. puManagerApproverName: null,
  1562. processTime: null,
  1563. affirmer: null,
  1564. tenantId: null,
  1565. revision: null,
  1566. createBy: null,
  1567. createByName: null,
  1568. createTime: null,
  1569. updateBy: null,
  1570. updateByName: null,
  1571. updateTime: null,
  1572. delFlag: 0,
  1573. csFlag: "N",
  1574. // 新增字段
  1575. model: null,
  1576. storageCondition: null,
  1577. transportationCondition: null,
  1578. },
  1579. // 无限滚动配置
  1580. loadDisabled: true,
  1581. page: 0,
  1582. total: 5,
  1583. // 表格校验规则
  1584. tableRules: {
  1585. materialCode: [{ required: true, message: "物料编码必填" }],
  1586. qty: [{ required: true, message: "实际业务需求量必填" }],
  1587. },
  1588. };
  1589. },
  1590. created() {
  1591. if (this.pageStu == "check") {
  1592. this.getDetails(this.row);
  1593. } else if (this.pageStu == "edit") {
  1594. this.getDetails(this.row);
  1595. } else if (this.pageStu == "add") {
  1596. // 新增时判断需求日期
  1597. this.dafaultDate();
  1598. this.loading = false;
  1599. this.basicForm.demandPersonal = this.$store.state.user.name;
  1600. this.basicForm.demandPersonalName = this.$store.state.user.nickName;
  1601. this.basicForm.demandDept = this.$store.state.user.deptId;
  1602. this.basicForm.demandDeptName = this.$store.state.user.deptName;
  1603. if (this.basicForm.demandPersonal) {
  1604. this.reBackRefer(
  1605. "CONTACTS_PARAM",
  1606. this.basicForm.demandPersonal,
  1607. "需求人员"
  1608. );
  1609. }
  1610. if (this.basicForm.demandDept) {
  1611. this.reBackRefer("DEPT_PARAM", this.basicForm.demandDept);
  1612. }
  1613. }
  1614. },
  1615. methods: {
  1616. // 默认需求日期根据当天星期几判断
  1617. dafaultDate() {
  1618. // 获取当前时间
  1619. let date = new Date();
  1620. //获取当前时间的年份转为字符串
  1621. let year = date.getFullYear().toString();
  1622. //获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
  1623. let month =
  1624. date.getMonth() + 1 < 10
  1625. ? "0" + (date.getMonth() + 1).toString()
  1626. : (date.getMonth() + 1).toString(); //'04'
  1627. //获取天,判断是否小于10,如果是在字符串前面拼接'0'
  1628. let da =
  1629. date.getDate() < 10
  1630. ? "0" + date.getDate().toString()
  1631. : date.getDate().toString(); //'12'
  1632. let today = year + "-" + month + "-" + da;
  1633. // console.log("今天日期", today);
  1634. let weekDay = date.getDay();
  1635. // console.log("今天星期几", weekDay);
  1636. // 改变需求计划的判断写这里面了
  1637. if (this.basicForm.planType == "JJXQ") {
  1638. this.basicForm.demandDate = today;
  1639. } else {
  1640. if (weekDay == 0) {
  1641. this.basicForm.demandDate = this.getNextDate(today, 2);
  1642. } else if (weekDay == 1) {
  1643. this.basicForm.demandDate = this.getNextDate(today, 1);
  1644. } else if (weekDay == 2) {
  1645. this.basicForm.demandDate = today;
  1646. } else if (weekDay == 3) {
  1647. this.basicForm.demandDate = this.getNextDate(today, 6);
  1648. } else if (weekDay == 4) {
  1649. this.basicForm.demandDate = this.getNextDate(today, 5);
  1650. } else if (weekDay == 5) {
  1651. this.basicForm.demandDate = this.getNextDate(today, 4);
  1652. } else if (weekDay == 6) {
  1653. this.basicForm.demandDate = this.getNextDate(today, 3);
  1654. }
  1655. // console.log(this.getNextDate(today, 2))
  1656. }
  1657. },
  1658. // 获取某天日期的下一天,默认为第二天 默认输出格式为yyyy-mm-dd
  1659. getNextDate(date, day = 1, format = "{y}-{m}-{d}") {
  1660. if (date) {
  1661. date = date.match(/\d+/g).join("-"); // 格式为2022年09月19日处理
  1662. const nDate = new Date(date);
  1663. nDate.setDate(nDate.getDate() + day);
  1664. const formatObj = {
  1665. y: nDate.getFullYear(),
  1666. m: nDate.getMonth() + 1,
  1667. d: nDate.getDate(),
  1668. };
  1669. return format.replace(/{([ymd])+}/g, (result, key) => {
  1670. const value = formatObj[key];
  1671. return value.toString().padStart(2, "0");
  1672. });
  1673. } else {
  1674. console.log("date格式不正确");
  1675. }
  1676. },
  1677. // 改变需求计划改变需求日期
  1678. changeplanType(val) {
  1679. this.dafaultDate();
  1680. console.log(val);
  1681. if (val == "JJXQ") {
  1682. this.basicForm.billType = "JJXQ";
  1683. } else {
  1684. if (this.basicForm.billType == "JJXQ") {
  1685. this.basicForm.billType = "";
  1686. }
  1687. }
  1688. if (val == "JJXQ" && this.basicForm.puDemandItemList.length != 0) {
  1689. this.basicForm.puDemandItemList.forEach((item) => {
  1690. item.isUrgency = "Y";
  1691. });
  1692. } else {
  1693. this.basicForm.puDemandItemList.forEach((item) => {
  1694. item.isUrgency = "N";
  1695. });
  1696. }
  1697. },
  1698. // 无限滚动加载配置
  1699. load() {
  1700. if (this.loadDisabled) return;
  1701. this.page++;
  1702. if (this.page <= this.total) {
  1703. this.basicForm.puDemandItemList =
  1704. this.basicForm.puDemandItemList.concat(
  1705. this.basicForm.puDemandItemList
  1706. );
  1707. }
  1708. if (this.page === this.total) {
  1709. this.loadDisabled = true;
  1710. }
  1711. },
  1712. // 改变单据日期时清空子表的调拨日期
  1713. changeDemandDate() {
  1714. this.basicForm.puDemandItemList.forEach((item) => {
  1715. item.deliveryDate = null;
  1716. });
  1717. },
  1718. // 更改业务类型调整明细行内补单或紧急标识
  1719. changeBillType(val) {
  1720. if (val == "BDXQ" && this.basicForm.puDemandItemList.length != 0) {
  1721. this.isBDXQ = true;
  1722. this.BDZT = false;
  1723. this.basicForm.puDemandItemList.forEach((item) => {
  1724. item.isReplenishment = "Y";
  1725. });
  1726. } else {
  1727. this.isBDXQ = false;
  1728. this.BDZT = true;
  1729. this.basicForm.puDemandItemList.forEach((item) => {
  1730. item.isReplenishment = "N";
  1731. item.additionalSupplier = null;
  1732. item.additionalSupplierName = null;
  1733. });
  1734. }
  1735. if (val == "JJXQ") {
  1736. this.basicForm.planType = "JJXQ";
  1737. // 判断需求日期
  1738. this.dafaultDate();
  1739. } else {
  1740. if (this.basicForm.planType == "JJXQ") {
  1741. this.basicForm.planType = "";
  1742. }
  1743. }
  1744. if (val == "JJXQ" && this.basicForm.puDemandItemList.length != 0) {
  1745. this.basicForm.puDemandItemList.forEach((item) => {
  1746. item.isUrgency = "Y";
  1747. });
  1748. } else {
  1749. this.basicForm.puDemandItemList.forEach((item) => {
  1750. item.isUrgency = "N";
  1751. });
  1752. }
  1753. },
  1754. // 改变是否客户指定
  1755. isCustomer() {
  1756. if (
  1757. this.basicForm.isCustomerSpecified == "Y" &&
  1758. this.basicForm.puDemandItemList.length != 0
  1759. ) {
  1760. this.basicForm.puDemandItemList.forEach((item) => {
  1761. item.isCustomerSpecified = "Y";
  1762. });
  1763. } else {
  1764. this.basicForm.puDemandItemList.forEach((item) => {
  1765. item.isCustomerSpecified = "N";
  1766. });
  1767. }
  1768. },
  1769. hangStatus(row) {
  1770. switch (row.row.status) {
  1771. case "0":
  1772. return "需补货";
  1773. case "1":
  1774. return "待计划确认";
  1775. case "2":
  1776. return "计划已确认";
  1777. case "3":
  1778. return "计划已审核";
  1779. case "4":
  1780. return "行关闭";
  1781. case "5":
  1782. return "总供应可满足";
  1783. }
  1784. },
  1785. // 清空
  1786. cleanYLSL(scope) {
  1787. scope.row.reservedQty = "";
  1788. scope.row.reservedPeriod = "";
  1789. },
  1790. copy() {
  1791. this.$modal.notifySuccess("复制成功");
  1792. this.sonPageStu = "add";
  1793. this.sonDisable = false;
  1794. // this.getDetails(this.row)
  1795. this.basicForm.id = "";
  1796. this.basicForm.code = "";
  1797. this.basicForm.createBy = "";
  1798. this.basicForm.source = "4";
  1799. this.basicForm.isCustomerSpecified = "N";
  1800. this.basicForm.flowId = "";
  1801. this.basicForm.demandPersonal = this.$store.state.user.name;
  1802. this.basicForm.demandPersonalName = this.$store.state.user.nickName;
  1803. this.basicForm.demandDept = this.$store.state.user.deptId;
  1804. this.basicForm.demandDeptName = this.$store.state.user.deptName;
  1805. // 复制时判断需求日期
  1806. this.dafaultDate();
  1807. if (this.basicForm.demandPersonal) {
  1808. this.reBackRefer(
  1809. "CONTACTS_PARAM",
  1810. this.basicForm.demandPersonal,
  1811. "需求人员"
  1812. );
  1813. }
  1814. if (this.basicForm.demandDept) {
  1815. this.reBackRefer("DEPT_PARAM", this.basicForm.demandDept);
  1816. }
  1817. this.basicForm.puDemandItemList.forEach((item) => {
  1818. item.status = "";
  1819. item.buyerName = "";
  1820. item.buyer = "";
  1821. item.reservedProportion = "";
  1822. item.reservedPeriod = "";
  1823. item.reservedQty = "";
  1824. item.averageQtyMonth = "";
  1825. item.demandPeriod = "";
  1826. item.forecastClassify = "";
  1827. item.onemonthAvgVolume = "";
  1828. item.threemonthAvgVolume = "";
  1829. item.puFreight = "";
  1830. item.superiorAllotQty = "";
  1831. item.resDemandQty = "";
  1832. item.executeQty = "";
  1833. item.deliveryWarehouseName = "";
  1834. item.deliveryWarehouse = "";
  1835. item.deliveryAllocationName = "";
  1836. item.deliveryAllocation = "";
  1837. item.lastWarehouseName = "";
  1838. item.lastAllocationName = "";
  1839. item.availableQty = "";
  1840. item.lastStockOrgName = "";
  1841. item.centralWarehouseQty = "";
  1842. item.allotCode = "";
  1843. item.allotQty = "";
  1844. item.deliveryAddress = "";
  1845. item.deliveryAddressName = "";
  1846. item.contacts = "";
  1847. item.contactsPhone = "";
  1848. item.address = "";
  1849. item.statusAllot = "N";
  1850. });
  1851. },
  1852. editPage() {
  1853. this.sonPageStu = "edit";
  1854. this.sonDisable = false;
  1855. },
  1856. handleData() {
  1857. // 复制新增把id,需求单号,创建人置为空,子表去掉id
  1858. this.basicForm.id = "";
  1859. this.basicForm.code = "";
  1860. this.basicForm.createBy = "";
  1861. this.basicForm.source = "4";
  1862. if (this.basicForm.puDemandItemList.length !== 0) {
  1863. this.basicForm.puDemandItemList.forEach((item) => {
  1864. if (item.id) {
  1865. delete item.id;
  1866. }
  1867. if (item.demandId) {
  1868. delete item.demandId;
  1869. }
  1870. if (item.allotCode) {
  1871. delete item.allotCode;
  1872. }
  1873. });
  1874. }
  1875. },
  1876. async save() {
  1877. if (this.basicForm.puDemandItemList.length !== 0) {
  1878. this.$refs["basic"].validate((valid, obj) => {
  1879. if (valid) {
  1880. // 加上表格校验
  1881. this.$refs.table.fullValidate().then((data) => {
  1882. if (!data) {
  1883. this.$modal.loading("保存中...");
  1884. if (this.sonPageStu == "add") {
  1885. this.handleData();
  1886. addDemand(this.basicForm)
  1887. .then((res) => {
  1888. if (res.code === 200) {
  1889. this.$modal.notifySuccess(res.msg);
  1890. this.$modal.closeLoading();
  1891. this.back();
  1892. }
  1893. })
  1894. .catch((err) => {
  1895. // 加入定时器防止报错关不掉遮罩
  1896. setTimeout(() => {
  1897. let errorList = JSON.parse(err.message).rowList;
  1898. console.log(errorList);
  1899. this.gainRed(errorList);
  1900. }, 500);
  1901. this.$modal.closeLoading();
  1902. });
  1903. } else if (this.sonPageStu == "edit") {
  1904. let list = [];
  1905. list.push(
  1906. ...this.basicForm.puDemandItemList,
  1907. ...this.delDemandItemList
  1908. );
  1909. // 深拷贝一下参数对象
  1910. let param = JSON.parse(JSON.stringify(this.basicForm));
  1911. param.puDemandItemList = list;
  1912. // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
  1913. editDemand(param)
  1914. .then((res) => {
  1915. if (res.code === 200) {
  1916. this.$modal.notifySuccess(res.msg);
  1917. this.$modal.closeLoading();
  1918. this.back();
  1919. }
  1920. })
  1921. .catch((err) => {
  1922. // 加入定时器防止报错关不掉遮罩
  1923. setTimeout(() => {
  1924. let errorList = JSON.parse(err.message).rowList;
  1925. // console.log(errorList)
  1926. this.gainRed(errorList);
  1927. }, 500);
  1928. this.$modal.closeLoading();
  1929. });
  1930. }
  1931. } else {
  1932. let masStr = "";
  1933. Object.values(data).forEach((errList) => {
  1934. // 将子表下标加入进入标识字段
  1935. this.basicForm.puDemandItemList.forEach((item, index) => {
  1936. item.rightIndex = index;
  1937. });
  1938. console.log("所有列表", this.basicForm.puDemandItemList);
  1939. // 将校验未通过的项与整个表格数据进行过滤对比,得出校验通过的数据
  1940. let rightList = this.basicForm.puDemandItemList.filter(
  1941. (item, index) => {
  1942. return errList.find((item2) => {
  1943. return item2.rowIndex !== item.rightIndex;
  1944. });
  1945. }
  1946. );
  1947. rightList.forEach((items) => {
  1948. if (
  1949. this.$refs.table.$el.querySelector(
  1950. `.elx-body--row:nth-of-type(${items.rightIndex + 1})`
  1951. )
  1952. ) {
  1953. this.$refs.table.$el.querySelector(
  1954. `.elx-body--row:nth-of-type(${items.rightIndex + 1})`
  1955. ).style.background = "";
  1956. }
  1957. });
  1958. errList.forEach((params) => {
  1959. let { rowIndex, column, rules } = params;
  1960. rules.forEach((rule) => {
  1961. masStr += `第 ${rowIndex + 1} 行${rule.message};`;
  1962. });
  1963. if (
  1964. this.$refs.table.$el.querySelector(
  1965. `.elx-body--row:nth-of-type(${rowIndex + 1})`
  1966. )
  1967. ) {
  1968. this.$refs.table.$el.querySelector(
  1969. `.elx-body--row:nth-of-type(${rowIndex + 1})`
  1970. ).style.background = "#f34b4bb8";
  1971. }
  1972. });
  1973. });
  1974. this.$modal.notifyError(masStr);
  1975. }
  1976. });
  1977. } else {
  1978. // 校验加弹窗
  1979. const jiaoyan = [];
  1980. for (let key in obj) {
  1981. jiaoyan.push(obj[key][0].message);
  1982. }
  1983. this.$modal.notifyWarning(jiaoyan[0]);
  1984. return false;
  1985. }
  1986. });
  1987. } else {
  1988. this.$modal.notifyWarning("明细信息不能为空!");
  1989. }
  1990. },
  1991. // 后端校验标红方法
  1992. gainRed(errList) {
  1993. // 将子表下标加入进入标识字段
  1994. this.basicForm.puDemandItemList.forEach((item, index) => {
  1995. item.rightIndex = index;
  1996. });
  1997. console.log("所有列表", this.basicForm.puDemandItemList);
  1998. // 将校验未通过的项与整个表格数据进行过滤对比,得出校验通过的数据
  1999. let rightList = this.basicForm.puDemandItemList.filter((item, index) => {
  2000. return errList.find((item2) => {
  2001. return item2.rowIndex !== item.rightIndex;
  2002. });
  2003. });
  2004. rightList.forEach((items) => {
  2005. if (
  2006. this.$refs.table.$el.querySelector(
  2007. `.elx-body--row:nth-of-type(${items.rightIndex + 1})`
  2008. )
  2009. ) {
  2010. this.$refs.table.$el.querySelector(
  2011. `.elx-body--row:nth-of-type(${items.rightIndex + 1})`
  2012. ).style.background = "";
  2013. }
  2014. });
  2015. errList.forEach((item) => {
  2016. if (
  2017. this.$refs.table.$el.querySelector(
  2018. `.elx-body--row:nth-of-type(${item / 10})`
  2019. )
  2020. ) {
  2021. this.$refs.table.$el.querySelector(
  2022. `.elx-body--row:nth-of-type(${item / 10})`
  2023. ).style.background = "#f34b4bb8";
  2024. }
  2025. });
  2026. },
  2027. submit() {
  2028. this.$modal.loading("提交中...");
  2029. submitDemand(this.basicForm)
  2030. .then((res) => {
  2031. if (res.code === 200) {
  2032. this.$modal.notifySuccess("提交成功");
  2033. this.$modal.closeLoading();
  2034. this.back();
  2035. }
  2036. if (res.code === 233) {
  2037. this.$modal
  2038. .confirm(res.msg)
  2039. .then(function () {
  2040. // 确认
  2041. })
  2042. .then(() => {
  2043. confirmSubmit(this.basicForm)
  2044. .then((res) => {
  2045. if (res.code === 200) {
  2046. this.$modal.notifySuccess("提交成功");
  2047. this.$modal.closeLoading();
  2048. this.back();
  2049. }
  2050. })
  2051. .catch((err) => {
  2052. this.$modal.closeLoading();
  2053. });
  2054. // 取消
  2055. })
  2056. .catch(() => {
  2057. this.$modal.closeLoading();
  2058. });
  2059. this.$modal.closeLoading();
  2060. }
  2061. })
  2062. .catch((err) => {
  2063. // 加入定时器防止报错关不掉遮罩
  2064. setTimeout(() => {
  2065. let errorList = JSON.parse(err.message).rowList;
  2066. console.log(errorList);
  2067. this.gainRed(errorList);
  2068. }, 500);
  2069. this.$modal.closeLoading();
  2070. });
  2071. },
  2072. // 增行
  2073. addLine() {
  2074. const newLine = { ...this.sonModel };
  2075. newLine.isUrgency = this.basicForm.billType == "JJXQ" ? "Y" : "N";
  2076. newLine.isReplenishment = this.basicForm.billType == "BDXQ" ? "Y" : "N";
  2077. newLine.demandCustomer = this.basicForm.customer;
  2078. newLine.demandCustomerName = this.basicForm.customerName;
  2079. this.basicForm.puDemandItemList.push(newLine);
  2080. // 补单需求状态改变
  2081. if (this.basicForm.billType == "BDXQ") {
  2082. this.BDZT = false;
  2083. } else {
  2084. this.BDZT = true;
  2085. }
  2086. },
  2087. delLine(index, row) {
  2088. row.delFlag = "2";
  2089. let delList = [];
  2090. delList = this.basicForm.puDemandItemList.filter((item) => {
  2091. return item.delFlag == "2";
  2092. });
  2093. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(
  2094. (item) => {
  2095. return item.delFlag == "0";
  2096. }
  2097. );
  2098. this.delDemandItemList.push(...delList);
  2099. console.log("删除的数组", this.delDemandItemList);
  2100. },
  2101. // 批量删除行
  2102. delLines() {
  2103. let delArr = this.$refs.table.getCheckboxRecords();
  2104. if (delArr.length !== 0) {
  2105. delArr.forEach((item) => {
  2106. item.delFlag = "2";
  2107. });
  2108. let delList = [];
  2109. delList = this.basicForm.puDemandItemList.filter((item) => {
  2110. return item.delFlag == "2";
  2111. });
  2112. this.basicForm.puDemandItemList =
  2113. this.basicForm.puDemandItemList.filter((item) => {
  2114. return item.delFlag == "0";
  2115. });
  2116. this.delDemandItemList.push(...delList);
  2117. } else {
  2118. this.$modal.notifyWarning("请至少选择一条明细!");
  2119. }
  2120. },
  2121. back() {
  2122. this.$emit("jugislist", true);
  2123. this.$emit("refresh");
  2124. },
  2125. // 如果需要回显则调用详情接口
  2126. getDetails(row) {
  2127. getDemandDetail(row.id).then((res) => {
  2128. if (res.code === 200) {
  2129. // this.basicForm = res.data
  2130. let reciveForm = res.data;
  2131. let params = { ...{ id: row.id }, ...{ pageNum: 1, pageSize: 10 } };
  2132. getDemandSonDetail(params)
  2133. .then((res) => {
  2134. if (res.code === 200) {
  2135. reciveForm.puDemandItemList = res.data;
  2136. console.log("reciveForm", reciveForm);
  2137. this.basicForm = reciveForm;
  2138. if (this.basicForm.org) {
  2139. this.reBackRefer("ORG_PARAM", this.basicForm.org);
  2140. }
  2141. if (this.basicForm.customer) {
  2142. this.reBackRefer("CUSTOMER_PARAM", this.basicForm.customer);
  2143. }
  2144. if (this.basicForm.customerPrincipal) {
  2145. this.reBackRefer(
  2146. "CONTACTS_PARAM",
  2147. this.basicForm.customerPrincipal,
  2148. "客户负责人"
  2149. );
  2150. }
  2151. if (this.basicForm.demandPersonal) {
  2152. this.reBackRefer(
  2153. "CONTACTS_PARAM",
  2154. this.basicForm.demandPersonal,
  2155. "需求人员"
  2156. );
  2157. }
  2158. if (this.basicForm.demandDept) {
  2159. this.reBackRefer("DEPT_PARAM", this.basicForm.demandDept);
  2160. }
  2161. // 详情时将收货仓库id赋值给stordocId
  2162. // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
  2163. if (this.basicForm.billType == "BDXQ") {
  2164. this.BDZT = false;
  2165. this.isBDXQ = true;
  2166. } else {
  2167. this.BDZT = true;
  2168. this.isBDXQ = false;
  2169. }
  2170. }
  2171. })
  2172. .then(() => {
  2173. this.loading = false;
  2174. })
  2175. .catch((err) => {
  2176. this.loading = false;
  2177. });
  2178. }
  2179. });
  2180. },
  2181. // 单元格标红
  2182. cellClassName({ row, column, rowIndex, columnIndex }) {
  2183. if (
  2184. this.basicForm.isCustomerSpecified == "N" &&
  2185. column.title == "需求可用周期" &&
  2186. Number(row.demandPeriod) > 1.5 &&
  2187. Number(row.qty) > Number(row.minOrderQty)
  2188. ) {
  2189. return "success-row";
  2190. }
  2191. },
  2192. handleSelectionChange(selection) {
  2193. this.ids = selection.map((item) => {
  2194. return item.id;
  2195. });
  2196. console.log("选中数组", this.ids);
  2197. },
  2198. rowSelect(row) {
  2199. this.$refs.table.toggleRowSelection(row);
  2200. },
  2201. // 点击预留单展示
  2202. showReserved() {
  2203. this.dialog.config = true;
  2204. },
  2205. // 修改是否让页面显示与隐藏的事件
  2206. updateReserved(val) {
  2207. this.dialog.config = val;
  2208. },
  2209. // 回显参照框
  2210. reBackRefer(type, id, title) {
  2211. getRefer({ type: type, id: id }).then((res) => {
  2212. if (type == "ORG_PARAM") {
  2213. this.orgOptions = res.rows;
  2214. }
  2215. if (type == "CUSTOMER_PARAM") {
  2216. this.customerOptions = res.rows;
  2217. }
  2218. if (type == "CONTACTS_PARAM" && title == "需求人员") {
  2219. this.personOptions = res.rows;
  2220. }
  2221. if (type == "CONTACTS_PARAM" && title == "客户负责人") {
  2222. this.manOptions = res.rows;
  2223. }
  2224. if (type == "DEPT_PARAM") {
  2225. this.deptOptions = res.rows;
  2226. }
  2227. });
  2228. },
  2229. chooseOrg(type, isPage, title) {
  2230. this.referCondition.type = type;
  2231. this.referCondition.isPage = isPage;
  2232. this.referCondition.title = title;
  2233. this.$refs.refer.init(this.referCondition);
  2234. },
  2235. selectionsToInput(selection) {
  2236. if (
  2237. this.referCondition.type == "ORG_PARAM" &&
  2238. this.referCondition.title == "选择组织"
  2239. ) {
  2240. this.orgOptions = selection;
  2241. this.basicForm.org = selection[0].id;
  2242. this.basicForm.orgName = selection[0].name;
  2243. }
  2244. if (
  2245. this.referCondition.type == "CUSTOMER_PARAM" &&
  2246. this.referCondition.title == "选择客户"
  2247. ) {
  2248. this.customerOptions = selection;
  2249. this.basicForm.customer = selection[0].id;
  2250. this.basicForm.customerName = selection[0].name;
  2251. this.basicForm.customerCode = selection[0].code;
  2252. if (this.basicForm.puDemandItemList.length !== 0) {
  2253. this.basicForm.puDemandItemList.forEach((item) => {
  2254. item.demandCustomerName = this.basicForm.customerName;
  2255. item.demandCustomer = this.basicForm.customer;
  2256. item.status = "";
  2257. item.buyerName = "";
  2258. item.buyer = "";
  2259. item.reservedProportion = "";
  2260. item.reservedPeriod = "";
  2261. item.reservedQty = "";
  2262. item.averageQtyMonth = "";
  2263. item.demandPeriod = "";
  2264. item.forecastClassify = "";
  2265. item.onemonthAvgVolume = "";
  2266. item.threemonthAvgVolume = "";
  2267. item.puFreight = "";
  2268. item.superiorAllotQty = "";
  2269. item.resDemandQty = "";
  2270. item.executeQty = "";
  2271. item.deliveryWarehouseName = "";
  2272. item.deliveryWarehouse = "";
  2273. item.deliveryAllocationName = "";
  2274. item.deliveryAllocation = "";
  2275. item.lastWarehouseName = "";
  2276. item.lastAllocationName = "";
  2277. item.availableQty = "";
  2278. item.lastStockOrgName = "";
  2279. item.centralWarehouseQty = "";
  2280. item.allotCode = "";
  2281. item.deliveryAddress = "";
  2282. item.deliveryAddressName = "";
  2283. item.contacts = "";
  2284. item.contactsPhone = "";
  2285. item.address = "";
  2286. });
  2287. }
  2288. }
  2289. if (
  2290. this.referCondition.type == "CONTACTS_PARAM" &&
  2291. this.referCondition.title == "需求人员"
  2292. ) {
  2293. this.personOptions = selection;
  2294. this.basicForm.demandPersonal = selection[0].code;
  2295. this.basicForm.demandPersonalName = selection[0].name;
  2296. }
  2297. if (
  2298. this.referCondition.type == "ORG_PARAM" &&
  2299. this.referCondition.title == "采购组织"
  2300. ) {
  2301. this.adjust.puOrg = selection[0].id;
  2302. this.adjust.purOrgName = selection[0].name;
  2303. }
  2304. if (
  2305. this.referCondition.type == "CONTACTS_PARAM" &&
  2306. this.referCondition.title == "采购员"
  2307. ) {
  2308. this.purchaseManOptions = selection;
  2309. this.adjust.purchaseMan = selection[0].code;
  2310. this.adjust.purchaseManName = selection[0].name;
  2311. }
  2312. if (
  2313. this.referCondition.type == "SUPPLIER_PARAM" &&
  2314. this.referCondition.title == "补单供应商"
  2315. ) {
  2316. this.adjust.additionalSupplier = selection[0].id;
  2317. this.adjust.additionalSupplierName = selection[0].name;
  2318. }
  2319. if (
  2320. this.referCondition.type == "WAREHOUSE_PARAM" &&
  2321. this.referCondition.title == "收货仓库"
  2322. ) {
  2323. this.adjust.warehouse = selection[0].id;
  2324. this.adjust.warehouseName = selection[0].name;
  2325. this.adjust.csFlag = selection[0].csFlag;
  2326. this.adjust.allocation = "";
  2327. this.adjust.allocationName = "";
  2328. this.adjust.deliveryAddressName = "";
  2329. this.adjust.deliveryAddress = "";
  2330. this.adjust.contacts = "";
  2331. this.adjust.contactsPhone = "";
  2332. this.adjust.address = "";
  2333. // 选择完清空参数里面的组织id
  2334. this.referCondition.pkOrg = "";
  2335. }
  2336. if (
  2337. this.referCondition.type == "ALLOCATION_PARAM" &&
  2338. this.referCondition.title == "收货货位"
  2339. ) {
  2340. this.adjust.allocation = selection[0].id;
  2341. this.adjust.allocationName = selection[0].name;
  2342. }
  2343. if (
  2344. this.referCondition.type == "ADDRESS_PARAM" &&
  2345. this.referCondition.title == "收货地址"
  2346. ) {
  2347. this.adjust.deliveryAddressName = selection[0].name;
  2348. this.adjust.deliveryAddress = selection[0].code;
  2349. this.adjust.contacts = selection[0].contactsName;
  2350. this.adjust.contactsPhone = selection[0].contactsPhone;
  2351. this.adjust.address = selection[0].address;
  2352. }
  2353. if (this.referCondition.type == "DEPT_PARAM") {
  2354. this.deptOptions = selection;
  2355. this.basicForm.demandDept = selection[0].id;
  2356. this.basicForm.demandDeptName = selection[0].name;
  2357. }
  2358. if (this.referCondition.title == "选择收货仓库") {
  2359. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse =
  2360. selection[0].id;
  2361. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName =
  2362. selection[0].name;
  2363. this.basicForm.puDemandItemList[this.tableIndex].csFlag =
  2364. selection[0].csFlag;
  2365. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation =
  2366. null;
  2367. this.basicForm.puDemandItemList[
  2368. this.tableIndex
  2369. ].deliveryAllocationName = null;
  2370. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName =
  2371. null;
  2372. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null;
  2373. this.basicForm.puDemandItemList[this.tableIndex].contacts = null;
  2374. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null;
  2375. this.basicForm.puDemandItemList[this.tableIndex].address = null;
  2376. // 选择完清空参数里面的组织id
  2377. this.referCondition.pkOrg = "";
  2378. }
  2379. if (this.referCondition.title == "选择收货货位") {
  2380. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation =
  2381. selection[0].id;
  2382. this.basicForm.puDemandItemList[
  2383. this.tableIndex
  2384. ].deliveryAllocationName = selection[0].name;
  2385. }
  2386. if (this.referCondition.title == "选择补单供应商") {
  2387. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier =
  2388. selection[0].id;
  2389. this.basicForm.puDemandItemList[
  2390. this.tableIndex
  2391. ].additionalSupplierName = selection[0].name;
  2392. }
  2393. if (this.referCondition.title == "选择收货地址") {
  2394. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName =
  2395. selection[0].name;
  2396. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress =
  2397. selection[0].id;
  2398. this.basicForm.puDemandItemList[this.tableIndex].contacts =
  2399. selection[0].contactsName;
  2400. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone =
  2401. selection[0].contactsPhone;
  2402. this.basicForm.puDemandItemList[this.tableIndex].address =
  2403. selection[0].address;
  2404. }
  2405. },
  2406. // 粘贴来的数据
  2407. async pasteMe(e, scope, index) {
  2408. this.$modal.loading("正在处理数据...");
  2409. e.preventDefault(); //阻止默认粘贴事件
  2410. let source = e.clipboardData.getData("Text");
  2411. console.log("scope", scope.column.property);
  2412. // 首先对源头进行解析
  2413. let rows = source.split("\r\n"); // 拆成一个数组
  2414. // 数组去除空字符串
  2415. rows = rows.filter((item) => {
  2416. return item && item.trim();
  2417. });
  2418. if (rows.length < 100) {
  2419. // 粘贴物料编码
  2420. if (scope.column.property == "materialCode") {
  2421. await getRefer({ type: "MATERIAL_PARAM", materialCodeList: rows })
  2422. .then((res) => {
  2423. this.$modal.closeLoading();
  2424. if (res.code === 200) {
  2425. let rowList = res.rows;
  2426. let newLine = [];
  2427. for (let i = 0; i < rowList.length; i++) {
  2428. let line = { ...this.sonModel };
  2429. line.isUrgency =
  2430. this.basicForm.billType == "JJXQ" ? "Y" : "N";
  2431. line.isReplenishment =
  2432. this.basicForm.billType == "BDXQ" ? "Y" : "N";
  2433. line.demandCustomer = this.basicForm.customer;
  2434. line.demandCustomerName = this.basicForm.customerName;
  2435. line.materialCode = rowList[i].code;
  2436. line.material = rowList[i].id;
  2437. line.materialName = rowList[i].name;
  2438. line.classifyId = rowList[i].classifyId;
  2439. line.materialClassifyOneName = rowList[i].oneClass;
  2440. line.materialClassifyTwoName = rowList[i].twoClass;
  2441. line.materialClassifyThreeName = rowList[i].threeClass;
  2442. line.materialClassifyFourName = rowList[i].fourClass;
  2443. line.specification = rowList[i].specification;
  2444. line.model = rowList[i].model;
  2445. line.unit = rowList[i].unitId;
  2446. line.unitName = rowList[i].unitIdName;
  2447. line.registrant = rowList[i].registrant;
  2448. line.manufacturerName = rowList[i].manufacturerIdName;
  2449. line.puPeriod = rowList[i].deliveryPeriod;
  2450. line.expiry = rowList[i].usefulLife;
  2451. line.expiryUnit = rowList[i].expiryUnitIdName;
  2452. // line.minPackage = rowList[i].usefulLife
  2453. line.minPackage = rowList[i].minPackQty;
  2454. line.minOrderQty = rowList[i].minOrderQty;
  2455. line.minBatch = rowList[i].minBatchQty;
  2456. line.safeStock = rowList[i].safeStock;
  2457. line.purOrgName = rowList[i].purchasingOrganizationName;
  2458. line.puOrg = rowList[i].purchasingOrganization;
  2459. // 物料存储条件和运输条件
  2460. line.transportationCondition =
  2461. rowList[i].transportationCondition;
  2462. line.storageCondition = rowList[i].storageCondition;
  2463. newLine.push(line);
  2464. console.log("临时数组", newLine);
  2465. }
  2466. // 删除指定下标
  2467. this.basicForm.puDemandItemList.splice(
  2468. index,
  2469. this.basicForm.puDemandItemList.length - index,
  2470. ...newLine
  2471. );
  2472. this.$modal.notifySuccess("共粘贴" + rowList.length + "条数据");
  2473. }
  2474. })
  2475. .then(() => {
  2476. this.$refs.table.doLayout();
  2477. })
  2478. .catch((err) => {
  2479. this.$modal.closeLoading();
  2480. });
  2481. // 粘贴实际业务需求量
  2482. } else if (scope.column.property == "qty") {
  2483. console.log("复制内容:", rows);
  2484. let newLine = [];
  2485. if (this.basicForm.puDemandItemList.length <= 1) {
  2486. for (let i = 0; i < rows.length; i++) {
  2487. let line = { ...this.sonModel };
  2488. line.isUrgency = this.basicForm.billType == "JJXQ" ? "Y" : "N";
  2489. line.isReplenishment =
  2490. this.basicForm.billType == "BDXQ" ? "Y" : "N";
  2491. line.demandCustomer = this.basicForm.customer;
  2492. line.demandCustomerName = this.basicForm.customerName;
  2493. line.qty = rows[i];
  2494. newLine.push(line);
  2495. }
  2496. // 删除指定下标
  2497. this.basicForm.puDemandItemList.splice(
  2498. index,
  2499. this.basicForm.puDemandItemList.length - index,
  2500. ...newLine
  2501. );
  2502. this.$modal.notifySuccess("共粘贴" + rows.length + "条数据");
  2503. this.$refs.table.doLayout();
  2504. this.$modal.closeLoading();
  2505. } else {
  2506. for (
  2507. let i = index, j = 0;
  2508. i < this.basicForm.puDemandItemList.length;
  2509. i++, j++
  2510. ) {
  2511. this.basicForm.puDemandItemList[i].qty = rows[j];
  2512. }
  2513. this.$refs.table.doLayout();
  2514. this.$modal.closeLoading();
  2515. }
  2516. // 粘贴补单供应商
  2517. } else if (scope.column.property == "additionalSupplierName") {
  2518. await getRefer({ type: "SUPPLIER_PARAM", searchList: rows })
  2519. .then((res) => {
  2520. this.$modal.closeLoading();
  2521. if (res.code === 200) {
  2522. let rowList = res.rows;
  2523. let newLine = [];
  2524. for (let i = 0; i < rowList.length; i++) {
  2525. let line = { ...this.sonModel };
  2526. line.isUrgency =
  2527. this.basicForm.billType == "JJXQ" ? "Y" : "N";
  2528. line.isReplenishment =
  2529. this.basicForm.billType == "BDXQ" ? "Y" : "N";
  2530. line.demandCustomer = this.basicForm.customer;
  2531. line.demandCustomerName = this.basicForm.customerName;
  2532. line.additionalSupplier = rowList[i].id;
  2533. line.additionalSupplierName = rowList[i].name;
  2534. newLine.push(line);
  2535. console.log("临时数组", newLine);
  2536. }
  2537. if (this.basicForm.puDemandItemList.length <= 1) {
  2538. // 删除指定下标
  2539. this.basicForm.puDemandItemList.splice(
  2540. index,
  2541. this.basicForm.puDemandItemList.length - index,
  2542. ...newLine
  2543. );
  2544. this.$modal.notifySuccess(
  2545. "共粘贴" + rowList.length + "条数据"
  2546. );
  2547. } else {
  2548. for (
  2549. let i = index, j = 0;
  2550. i < this.basicForm.puDemandItemList.length;
  2551. i++, j++
  2552. ) {
  2553. this.basicForm.puDemandItemList[i].additionalSupplier =
  2554. newLine[j].additionalSupplier;
  2555. this.basicForm.puDemandItemList[i].additionalSupplierName =
  2556. newLine[j].additionalSupplierName;
  2557. }
  2558. this.$refs.table.doLayout();
  2559. this.$modal.closeLoading();
  2560. }
  2561. }
  2562. })
  2563. .then(() => {
  2564. this.$refs.table.doLayout();
  2565. })
  2566. .catch((err) => {
  2567. this.$modal.closeLoading();
  2568. });
  2569. } else if (scope.column.property == "deliveryAddressName") {
  2570. await getRefer({ type: "ADDRESS_PARAM", searchList: rows })
  2571. .then((res) => {
  2572. this.$modal.closeLoading();
  2573. if (res.code === 200) {
  2574. let rowList = res.rows;
  2575. let newLine = [];
  2576. for (let i = 0; i < rowList.length; i++) {
  2577. let line = { ...this.sonModel };
  2578. line.isUrgency =
  2579. this.basicForm.billType == "JJXQ" ? "Y" : "N";
  2580. line.isReplenishment =
  2581. this.basicForm.billType == "BDXQ" ? "Y" : "N";
  2582. line.demandCustomer = this.basicForm.customer;
  2583. line.demandCustomerName = this.basicForm.customerName;
  2584. line.deliveryAddressName = rowList[i].name;
  2585. line.deliveryAddress = rowList[i].code;
  2586. line.contacts = rowList[i].contactsName;
  2587. line.contactsPhone = rowList[i].contactsPhone;
  2588. line.address = rowList[i].address;
  2589. newLine.push(line);
  2590. console.log("临时数组", newLine);
  2591. }
  2592. if (this.basicForm.puDemandItemList.length <= 1) {
  2593. // 删除指定下标
  2594. this.basicForm.puDemandItemList.splice(
  2595. index,
  2596. this.basicForm.puDemandItemList.length - index,
  2597. ...newLine
  2598. );
  2599. this.$modal.notifySuccess(
  2600. "共粘贴" + rowList.length + "条数据"
  2601. );
  2602. } else {
  2603. for (
  2604. let i = index, j = 0;
  2605. i < this.basicForm.puDemandItemList.length;
  2606. i++, j++
  2607. ) {
  2608. this.basicForm.puDemandItemList[i].deliveryAddressName =
  2609. newLine[j].deliveryAddressName;
  2610. this.basicForm.puDemandItemList[i].deliveryAddress =
  2611. newLine[j].deliveryAddress;
  2612. this.basicForm.puDemandItemList[i].contacts =
  2613. newLine[j].contacts;
  2614. this.basicForm.puDemandItemList[i].contactsPhone =
  2615. newLine[j].contactsPhone;
  2616. this.basicForm.puDemandItemList[i].address =
  2617. newLine[j].address;
  2618. }
  2619. this.$refs.table.doLayout();
  2620. this.$modal.closeLoading();
  2621. }
  2622. }
  2623. })
  2624. .then(() => {
  2625. this.$refs.table.doLayout();
  2626. })
  2627. .catch((err) => {
  2628. this.$modal.closeLoading();
  2629. });
  2630. }
  2631. } else {
  2632. this.$modal.notifyWarning("复制长度不能超过100!");
  2633. this.$modal.closeLoading();
  2634. }
  2635. },
  2636. // 明细行选择物料编码带出数据
  2637. chooseMaterial(index) {
  2638. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index);
  2639. this.tableIndex = index;
  2640. // 传0只展示同步NC了的物料
  2641. this.$refs.materialRefer.init(0);
  2642. },
  2643. selectMaterial(selection) {
  2644. console.log("选中的物料", selection);
  2645. if (selection.length <= 1) {
  2646. // 选择新物料时先清空行内其他信息
  2647. this.basicForm.puDemandItemList[this.tableIndex].reservedProportion =
  2648. null;
  2649. this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null;
  2650. this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null;
  2651. this.basicForm.puDemandItemList[this.tableIndex].qty = null;
  2652. this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null;
  2653. this.basicForm.puDemandItemList[this.tableIndex].remark = null;
  2654. this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null;
  2655. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse =
  2656. null;
  2657. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName =
  2658. null;
  2659. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation =
  2660. null;
  2661. this.basicForm.puDemandItemList[
  2662. this.tableIndex
  2663. ].deliveryAllocationName = null;
  2664. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier =
  2665. null;
  2666. this.basicForm.puDemandItemList[
  2667. this.tableIndex
  2668. ].additionalSupplierName = null;
  2669. this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null;
  2670. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName =
  2671. null;
  2672. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null;
  2673. this.basicForm.puDemandItemList[this.tableIndex].contacts = null;
  2674. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null;
  2675. this.basicForm.puDemandItemList[this.tableIndex].address = null;
  2676. this.basicForm.puDemandItemList[this.tableIndex].priceType = "order";
  2677. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName =
  2678. null;
  2679. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null;
  2680. this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null;
  2681. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName =
  2682. null;
  2683. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOne =
  2684. null;
  2685. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwo =
  2686. null;
  2687. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThree =
  2688. null;
  2689. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFour =
  2690. null;
  2691. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrg = null;
  2692. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrgName =
  2693. null;
  2694. this.basicForm.puDemandItemList[this.tableIndex].buyer = null;
  2695. this.basicForm.puDemandItemList[this.tableIndex].buyerName = null;
  2696. // 通过选择物料查询采购员
  2697. queryMan(selection[0].id).then((res) => {
  2698. if (res.code === 200 && res.rows.length !== 0) {
  2699. this.basicForm.puDemandItemList[this.tableIndex].buyer =
  2700. res.rows[0].buyer;
  2701. this.basicForm.puDemandItemList[this.tableIndex].buyerName =
  2702. res.rows[0].buyerName;
  2703. }
  2704. });
  2705. this.basicForm.puDemandItemList[this.tableIndex].materialCode =
  2706. selection[0].code;
  2707. this.basicForm.puDemandItemList[this.tableIndex].material =
  2708. selection[0].id;
  2709. this.basicForm.puDemandItemList[this.tableIndex].materialName =
  2710. selection[0].name;
  2711. this.basicForm.puDemandItemList[this.tableIndex].classifyId =
  2712. selection[0].classifyId;
  2713. this.basicForm.puDemandItemList[
  2714. this.tableIndex
  2715. ].materialClassifyOneName = selection[0].oneClass;
  2716. this.basicForm.puDemandItemList[
  2717. this.tableIndex
  2718. ].materialClassifyTwoName = selection[0].twoClass;
  2719. this.basicForm.puDemandItemList[
  2720. this.tableIndex
  2721. ].materialClassifyThreeName = selection[0].threeClass;
  2722. this.basicForm.puDemandItemList[
  2723. this.tableIndex
  2724. ].materialClassifyFourName = selection[0].fourClass;
  2725. this.basicForm.puDemandItemList[this.tableIndex].specification =
  2726. selection[0].specification;
  2727. this.basicForm.puDemandItemList[this.tableIndex].model =
  2728. selection[0].model;
  2729. this.basicForm.puDemandItemList[this.tableIndex].unit =
  2730. selection[0].unitId;
  2731. this.basicForm.puDemandItemList[this.tableIndex].unitName =
  2732. selection[0].unitIdName;
  2733. this.basicForm.puDemandItemList[this.tableIndex].registrant =
  2734. selection[0].registrant;
  2735. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName =
  2736. selection[0].manufacturerIdName;
  2737. this.basicForm.puDemandItemList[this.tableIndex].puPeriod =
  2738. selection[0].deliveryPeriod;
  2739. this.basicForm.puDemandItemList[this.tableIndex].expiry =
  2740. selection[0].usefulLife;
  2741. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit =
  2742. selection[0].expiryUnitIdName;
  2743. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  2744. this.basicForm.puDemandItemList[this.tableIndex].minPackage =
  2745. selection[0].minPackQty;
  2746. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty =
  2747. selection[0].minOrderQty;
  2748. this.basicForm.puDemandItemList[this.tableIndex].minBatch =
  2749. selection[0].minBatchQty;
  2750. this.basicForm.puDemandItemList[this.tableIndex].safeStock =
  2751. selection[0].safeStock;
  2752. this.basicForm.puDemandItemList[this.tableIndex].purOrgName =
  2753. selection[0].purchasingOrganizationName;
  2754. this.basicForm.puDemandItemList[this.tableIndex].puOrg =
  2755. selection[0].purchasingOrganization;
  2756. // 物料存储条件和运输条件
  2757. this.basicForm.puDemandItemList[
  2758. this.tableIndex
  2759. ].transportationCondition = selection[0].transportationCondition;
  2760. this.basicForm.puDemandItemList[this.tableIndex].storageCondition =
  2761. selection[0].storageCondition;
  2762. // 选中骨科耗材时候的物料,需求客户不必填
  2763. } else {
  2764. let newLine = [];
  2765. for (let i = 0; i < selection.length; i++) {
  2766. let line = { ...this.sonModel };
  2767. line.isUrgency = this.basicForm.billType == "JJXQ" ? "Y" : "N";
  2768. line.isReplenishment = this.basicForm.billType == "BDXQ" ? "Y" : "N";
  2769. line.demandCustomer = this.basicForm.customer;
  2770. line.demandCustomerName = this.basicForm.customerName;
  2771. // 通过选择物料查询采购员
  2772. queryMan(selection[i].id).then((res) => {
  2773. if (res.code === 200 && res.rows.length !== 0) {
  2774. line.buyer = res.rows[0].buyer;
  2775. line.buyerName = res.rows[0].buyerName;
  2776. }
  2777. });
  2778. line.materialCode = selection[i].code;
  2779. line.material = selection[i].id;
  2780. line.materialName = selection[i].name;
  2781. line.classifyId = selection[i].classifyId;
  2782. line.materialClassifyOneName = selection[i].oneClass;
  2783. line.materialClassifyTwoName = selection[i].twoClass;
  2784. line.materialClassifyThreeName = selection[i].threeClass;
  2785. line.materialClassifyFourName = selection[i].fourClass;
  2786. line.specification = selection[i].specification;
  2787. line.model = selection[i].model;
  2788. line.unit = selection[i].unitId;
  2789. line.unitName = selection[i].unitIdName;
  2790. line.registrant = selection[i].registrant;
  2791. line.manufacturerName = selection[i].manufacturerIdName;
  2792. line.puPeriod = selection[i].deliveryPeriod;
  2793. line.expiry = selection[i].usefulLife;
  2794. line.expiryUnit = selection[i].expiryUnitIdName;
  2795. // line.minPackage = selection[i].usefulLife
  2796. line.minPackage = selection[i].minPackQty;
  2797. line.minOrderQty = selection[i].minOrderQty;
  2798. line.minBatch = selection[i].minBatchQty;
  2799. line.safeStock = selection[i].safeStock;
  2800. line.purOrgName = selection[i].purchasingOrganizationName;
  2801. line.puOrg = selection[i].purchasingOrganization;
  2802. // 物料存储条件和运输条件
  2803. line.transportationCondition = selection[i].transportationCondition;
  2804. line.storageCondition = selection[i].storageCondition;
  2805. // this.basicForm.puDemandItemList.push(line)
  2806. newLine.push(line);
  2807. }
  2808. // 删除指定下标
  2809. this.basicForm.puDemandItemList.splice(this.tableIndex, 1, ...newLine);
  2810. // this.basicForm.puDemandItemList.splice(this.tableIndex,1)
  2811. }
  2812. },
  2813. // 明细行选择参照
  2814. chooseDept(index, type, isPage, title) {
  2815. this.tableIndex = index;
  2816. this.referCondition.type = type;
  2817. this.referCondition.isPage = isPage;
  2818. this.referCondition.title = title;
  2819. this.$refs.refer.init(this.referCondition);
  2820. },
  2821. // 明细行选择仓库需要先确认采购组织
  2822. chooseCangKu(index, type, isPage, title, pkOrg) {
  2823. this.tableIndex = index;
  2824. this.referCondition.type = type;
  2825. this.referCondition.isPage = isPage;
  2826. this.referCondition.title = title;
  2827. if (pkOrg) {
  2828. this.referCondition.pkOrg = pkOrg;
  2829. this.$refs.refer.init(this.referCondition);
  2830. } else {
  2831. this.$modal.notifyWarning("请先确认默认采购组织");
  2832. }
  2833. },
  2834. // 明细行选择货位先确认仓库
  2835. choosehuoWei(index, type, isPage, title, stordocId) {
  2836. this.tableIndex = index;
  2837. this.referCondition.type = type;
  2838. this.referCondition.isPage = isPage;
  2839. this.referCondition.title = title;
  2840. // 选择收货货位前先选择收货仓库
  2841. if (stordocId) {
  2842. this.referCondition.stordocId = stordocId;
  2843. this.$refs.refer.init(this.referCondition);
  2844. } else {
  2845. this.$modal.notifyWarning("请先选择收货仓库");
  2846. }
  2847. },
  2848. // 明细行清空收货仓库,货位,收货地址档案等
  2849. clearHang(index, title) {
  2850. if (title == "选择收货仓库") {
  2851. this.basicForm.puDemandItemList[index].deliveryWarehouseName = null;
  2852. this.basicForm.puDemandItemList[index].deliveryWarehouse = null;
  2853. this.basicForm.puDemandItemList[index].csFlag = null;
  2854. this.basicForm.puDemandItemList[index].deliveryAllocationName = null;
  2855. this.basicForm.puDemandItemList[index].deliveryAllocation = null;
  2856. }
  2857. if (title == "选择收货货位") {
  2858. this.basicForm.puDemandItemList[index].deliveryAllocationName = null;
  2859. this.basicForm.puDemandItemList[index].deliveryAllocation = null;
  2860. }
  2861. if (title == "选择收货地址") {
  2862. this.basicForm.puDemandItemList[index].deliveryAddressName = null;
  2863. this.basicForm.puDemandItemList[index].deliveryAddress = null;
  2864. this.basicForm.puDemandItemList[index].contacts = null;
  2865. this.basicForm.puDemandItemList[index].contactsPhone = null;
  2866. this.basicForm.puDemandItemList[index].address = null;
  2867. }
  2868. if (title == "选择补单供应商") {
  2869. this.basicForm.puDemandItemList[index].additionalSupplierName = null;
  2870. this.basicForm.puDemandItemList[index].additionalSupplier = null;
  2871. }
  2872. // 清空批量调整内字段
  2873. if (title == "cgzz") {
  2874. this.adjust.purOrgName = "";
  2875. this.adjust.puOrg = "";
  2876. this.adjust.warehouse = "";
  2877. this.adjust.warehouseName = "";
  2878. this.adjust.allocation = "";
  2879. this.adjust.allocationName = "";
  2880. }
  2881. if (title == "shck") {
  2882. this.adjust.warehouse = "";
  2883. this.adjust.warehouseName = "";
  2884. this.adjust.allocation = "";
  2885. this.adjust.allocationName = "";
  2886. this.adjust.csFlag = "";
  2887. }
  2888. if (title == "shhw") {
  2889. this.adjust.allocation = "";
  2890. this.adjust.allocationName = "";
  2891. }
  2892. if (title == "bdgys") {
  2893. this.adjust.additionalSupplier = "";
  2894. this.adjust.additionalSupplierName = "";
  2895. }
  2896. if (title == "shdz") {
  2897. this.adjust.deliveryAddressName = "";
  2898. this.adjust.deliveryAddress = "";
  2899. this.adjust.contacts = "";
  2900. this.adjust.contactsPhone = "";
  2901. this.adjust.address = "";
  2902. }
  2903. },
  2904. // 清除需求客户将明细行内也清空
  2905. cleanCustomer() {
  2906. this.basicForm.customer = "";
  2907. this.basicForm.customerName = "";
  2908. this.basicForm.customerCode = "";
  2909. if (this.basicForm.puDemandItemList.length !== 0) {
  2910. this.basicForm.puDemandItemList.forEach((item) => {
  2911. item.demandCustomerName = "";
  2912. item.demandCustomer = "";
  2913. item.status = "";
  2914. item.buyerName = "";
  2915. item.buyer = "";
  2916. item.reservedProportion = "";
  2917. item.reservedPeriod = "";
  2918. item.reservedQty = "";
  2919. item.averageQtyMonth = "";
  2920. item.demandPeriod = "";
  2921. item.forecastClassify = "";
  2922. item.onemonthAvgVolume = "";
  2923. item.threemonthAvgVolume = "";
  2924. item.puFreight = "";
  2925. item.superiorAllotQty = "";
  2926. item.resDemandQty = "";
  2927. item.executeQty = "";
  2928. item.deliveryWarehouseName = "";
  2929. item.deliveryWarehouse = "";
  2930. item.deliveryAllocationName = "";
  2931. item.deliveryAllocation = "";
  2932. item.lastWarehouseName = "";
  2933. item.lastAllocationName = "";
  2934. item.availableQty = "";
  2935. item.lastStockOrgName = "";
  2936. item.centralWarehouseQty = "";
  2937. item.allotCode = "";
  2938. item.deliveryAddress = "";
  2939. item.deliveryAddressName = "";
  2940. item.contacts = "";
  2941. item.contactsPhone = "";
  2942. item.address = "";
  2943. });
  2944. }
  2945. },
  2946. // 批量调整
  2947. adjustPl() {
  2948. if (this.ids.length == 0) {
  2949. this.$modal.notifyWarning("请至少选择一项数据进行操作!");
  2950. } else {
  2951. this.adjust.open = true;
  2952. }
  2953. },
  2954. // 批量调整确认
  2955. confirmAdjust() {
  2956. console.log("data", this.adjust);
  2957. if (
  2958. this.adjust.csFlag == "N" ||
  2959. this.adjust.csFlag == "" ||
  2960. this.adjust.allocationName
  2961. ) {
  2962. this.basicForm.puDemandItemList.forEach((item) => {
  2963. this.ids.some((val) => {
  2964. if (val == item.id) {
  2965. if (this.adjust.purchaseMan) {
  2966. item.buyer = this.adjust.purchaseMan;
  2967. item.buyerName = this.adjust.purchaseManName;
  2968. }
  2969. if (this.adjust.priceType) {
  2970. item.priceType = this.adjust.priceType;
  2971. }
  2972. if (this.adjust.additionalSupplierName) {
  2973. item.additionalSupplier = this.adjust.additionalSupplier;
  2974. item.additionalSupplierName =
  2975. this.adjust.additionalSupplierName;
  2976. }
  2977. if (this.adjust.purOrgName) {
  2978. item.purOrgName = this.adjust.purOrgName;
  2979. item.puOrg = this.adjust.puOrg;
  2980. item.deliveryWarehouse = this.adjust.warehouse;
  2981. item.deliveryWarehouseName = this.adjust.warehouseName;
  2982. item.deliveryAllocation = this.adjust.allocation;
  2983. item.deliveryAllocationName = this.adjust.allocationName;
  2984. item.deliveryAddressName = this.adjust.deliveryAddressName;
  2985. item.deliveryAddress = this.adjust.deliveryAddress;
  2986. item.contacts = this.adjust.contacts;
  2987. item.contactsPhone = this.adjust.contactsPhone;
  2988. item.address = this.adjust.address;
  2989. }
  2990. if (this.adjust.warehouseName) {
  2991. item.deliveryWarehouse = this.adjust.warehouse;
  2992. item.deliveryWarehouseName = this.adjust.warehouseName;
  2993. item.csFlag = this.adjust.csFlag;
  2994. item.deliveryAllocation = this.adjust.allocation;
  2995. item.deliveryAllocationName = this.adjust.allocationName;
  2996. }
  2997. // if(this.adjust.allocationName) {
  2998. // item.deliveryAllocation = this.adjust.allocation
  2999. // item.deliveryAllocationName = this.adjust.allocationName
  3000. // }
  3001. if (this.adjust.remark) {
  3002. item.remark = this.adjust.remark;
  3003. }
  3004. if (this.adjust.deliveryAddressName) {
  3005. item.deliveryAddressName = this.adjust.deliveryAddressName;
  3006. item.deliveryAddress = this.adjust.deliveryAddress;
  3007. item.contacts = this.adjust.contacts;
  3008. item.contactsPhone = this.adjust.contactsPhone;
  3009. item.address = this.adjust.address;
  3010. }
  3011. }
  3012. this.adjust.open = false;
  3013. });
  3014. });
  3015. } else {
  3016. this.$modal.notifyWarning("收货仓库存在收货货位,请填写!");
  3017. }
  3018. },
  3019. // 批量调整选择仓库
  3020. adjustCangku(type, isPage, title, pkOrg) {
  3021. this.referCondition.type = type;
  3022. this.referCondition.isPage = isPage;
  3023. this.referCondition.title = title;
  3024. if (pkOrg) {
  3025. this.referCondition.pkOrg = pkOrg;
  3026. this.$refs.refer.init(this.referCondition);
  3027. } else {
  3028. this.$modal.notifyWarning("请先选择默认采购组织");
  3029. }
  3030. },
  3031. // 批量调整选择货位
  3032. adjustHuoWei(type, isPage, title, stordocId) {
  3033. this.referCondition.type = type;
  3034. this.referCondition.isPage = isPage;
  3035. this.referCondition.title = title;
  3036. // 选择收货货位前先选择收货仓库
  3037. if (stordocId) {
  3038. this.referCondition.stordocId = stordocId;
  3039. this.$refs.refer.init(this.referCondition);
  3040. } else {
  3041. this.$modal.notifyWarning("请先选择收货仓库");
  3042. }
  3043. },
  3044. // 关闭清空批量调整数据
  3045. closeEvent() {
  3046. this.adjust = {
  3047. open: false,
  3048. puOrg: "",
  3049. purOrgName: "",
  3050. priceType: "",
  3051. purchaseMan: "",
  3052. purchaseManName: "",
  3053. warehouse: "",
  3054. warehouseName: "",
  3055. csFlag: "",
  3056. allocation: "",
  3057. allocationName: "",
  3058. additionalSupplier: "",
  3059. additionalSupplierName: "",
  3060. remark: "",
  3061. deliveryAddress: "",
  3062. deliveryAddressName: "",
  3063. contacts: "",
  3064. contactsPhone: "",
  3065. address: "",
  3066. };
  3067. },
  3068. // 必选标识
  3069. addRedStar(h, { column }) {
  3070. return [
  3071. h("span", { style: "color: #F56C6C" }, "*"),
  3072. h("span", " " + column.label),
  3073. ];
  3074. },
  3075. // 表格表头标星
  3076. anotherRedStar(h, { column }) {
  3077. if (this.isBDXQ) {
  3078. return [
  3079. h("span", { style: "color: #F56C6C" }, "*"),
  3080. h("span", " " + column.label),
  3081. ];
  3082. } else {
  3083. return [h("span", " " + column.label)];
  3084. }
  3085. },
  3086. // 流程跳转
  3087. jumpOA() {
  3088. toOA(this.$store.state.user.name, this.basicForm.flowId).then((res) => {
  3089. if (res.code === 200) {
  3090. window.open(res.oaUrl);
  3091. }
  3092. });
  3093. },
  3094. jisuan({ columns, data }) {
  3095. const means = []; // 合计
  3096. columns.forEach((column, columnIndex) => {
  3097. if (columnIndex === 0) {
  3098. means.push("合计");
  3099. } else {
  3100. const values = data.map((item) => Number(item[column.property]));
  3101. // 合计
  3102. if (column.property === "qty") {
  3103. means[columnIndex] = values.reduce((prev, curr) => {
  3104. const value = Number(curr);
  3105. if (!isNaN(value)) {
  3106. return prev + curr;
  3107. } else {
  3108. return prev;
  3109. }
  3110. }, 0);
  3111. // means[columnIndex] += ' 元'
  3112. // 改变了ele的合计方式,扩展了合计场景
  3113. // 你以为就只有上面这样玩吗?错啦,你还可以自定义样式哦
  3114. // means[columnIndex] = '<span style="color: red">' + means[columnIndex] + '元</span>'
  3115. means[columnIndex] = +means[columnIndex];
  3116. } else {
  3117. means[columnIndex] = "";
  3118. }
  3119. }
  3120. });
  3121. // 返回一个二维数组的表尾合计(不要平均值,你就不要在数组中添加)
  3122. return [means];
  3123. },
  3124. },
  3125. };
  3126. </script>
  3127. <style lang="scss" scoped>
  3128. .btn_group {
  3129. // width: 100%;
  3130. // margin: 20px 0;
  3131. display: flex;
  3132. justify-content: space-between;
  3133. position: absolute;
  3134. top: 10px;
  3135. right: 20px;
  3136. }
  3137. .btn_grooup {
  3138. margin-bottom: 10px;
  3139. display: flex;
  3140. justify-content: space-between;
  3141. }
  3142. .hang {
  3143. margin: auto;
  3144. }
  3145. .hang ::v-deep .el-form-item__content {
  3146. margin-left: 0px !important;
  3147. }
  3148. // .el-table ::v-deep .el-form-item__error{
  3149. // padding-top: 0;
  3150. // top: 70%
  3151. // }
  3152. ::v-deep .elx-body--row .success-row {
  3153. background-color: #ff8a8a !important;
  3154. }
  3155. ::v-deep .uxbeautifyTableClass .elx-table--header-wrapper {
  3156. color: #606266;
  3157. }
  3158. .pltzTxt {
  3159. text-align: right;
  3160. font-size: medium;
  3161. padding-right: 2%;
  3162. }
  3163. .pltzIpt {
  3164. width: 90%;
  3165. }
  3166. ::v-deep .el-form-item {
  3167. margin-bottom: 8px;
  3168. }
  3169. </style>