add.vue 107 KB

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