add.vue 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636
  1. <template>
  2. <div id="addDemandList">
  3. <el-card>
  4. <span>基本信息</span>
  5. <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto">
  6. <el-row :gutter="10">
  7. <el-col :span="1.5">
  8. <el-form-item label="编码">
  9. <el-input
  10. v-model="basicForm.code"
  11. size="mini"
  12. disabled
  13. style="width: 200px"
  14. />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="1.5">
  18. <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
  19. <el-select clearable size="mini" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
  20. <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
  21. </el-select>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="1.5">
  25. <el-form-item label="需求处理方式">
  26. <el-select disabled v-model="basicForm.demandBusinessType" size="mini" style="width: 200px">
  27. <el-option v-for="dict in dict.type.sys_processing_mode" :key="dict.value" :label="dict.label" :value="dict.value">
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="1.5">
  33. <el-form-item label="单据状态">
  34. <el-select disabled v-model="basicForm.status" size="mini" style="width: 200px">
  35. <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-form-item label="需求客户">
  42. <el-select clearable size="mini" v-model="basicForm.customer" :disabled="sonDisable" @clear="cleanCustomer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
  43. <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
  44. </el-select>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-form-item label="需求客户名称">
  49. <el-input disabled v-model="basicForm.customerName" size="mini" style="width: 200px"></el-input>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-form-item label="客户负责人">
  54. <el-select disabled size="mini" v-model="basicForm.customerPrincipal" style="width: 200px">
  55. <el-option v-for="item in manOptions" :key="item.id" :label="item.name" :value="item.code"/>
  56. </el-select>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="1.5">
  60. <el-form-item label="需求人员">
  61. <el-select clearable size="mini" v-model="basicForm.demandPersonal" :disabled="sonDisable" @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')" style="width: 200px">
  62. <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-form-item label="需求部门">
  68. <el-select clearable v-model="basicForm.demandDept" size="mini" :disabled="sonDisable" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
  69. <el-option
  70. v-for="item in deptOptions"
  71. :key="item.id"
  72. :label="item.name"
  73. :value="item.id">
  74. </el-option>
  75. </el-select>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="1.5">
  79. <el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
  80. <el-date-picker
  81. v-model="basicForm.demandDate"
  82. :disabled="sonDisable"
  83. clearable
  84. type="date"
  85. value-format="yyyy-MM-dd"
  86. @change="changeDemandDate"
  87. size="mini"
  88. style="width: 200px"
  89. >
  90. </el-date-picker>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="1.5">
  94. <el-form-item label="单据来源">
  95. <el-select v-model="basicForm.source" disabled size="mini" style="width: 200px">
  96. <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
  97. </el-option>
  98. </el-select>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :span="1.5">
  102. <el-form-item label="业务类型" prop="billType" :rules="{ required: true, message: '请选择业务类型', trigger: 'blur' }">
  103. <el-select clearable v-model="basicForm.billType" @change="changeBillType" :disabled="sonDisable" size="mini" style="width: 200px">
  104. <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
  105. </el-option>
  106. </el-select>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="1.5">
  110. <el-form-item label="是否客户指定">
  111. <el-select clearable v-model="basicForm.isSpeical" :disabled="sonDisable" size="mini" style="width: 200px">
  112. <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
  113. </el-option>
  114. </el-select>
  115. </el-form-item>
  116. </el-col>
  117. <!-- <el-col :span="1.5">
  118. <el-form-item label="是否处理需求">
  119. <el-input
  120. v-model="basicForm.isProcess"
  121. size="mini"
  122. placeholder=""
  123. clearable
  124. style="width: 200px"
  125. />
  126. </el-form-item>
  127. </el-col> -->
  128. <el-col :span="1.5">
  129. <el-form-item label="备注">
  130. <el-input
  131. v-model.trim="basicForm.remark"
  132. size="mini"
  133. :disabled="sonDisable"
  134. clearable
  135. style="width: 200px"
  136. />
  137. </el-form-item>
  138. </el-col>
  139. </el-row>
  140. <span>明细信息</span>
  141. <div class="btn_grooup">
  142. <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
  143. <el-button type="primary" size="mini" v-if="!sonDisable" @click="adjustPl">批量调整</el-button>
  144. <el-button type="primary" size="mini" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
  145. </div>
  146. <el-table
  147. :data="basicForm.puDemandItemList"
  148. fit
  149. max-height="300"
  150. style="font-size: 12px;"
  151. @selection-change="handleSelectionChange"
  152. :cell-class-name="cellClassName"
  153. >
  154. <el-table-column show-overflow-tooltip type="selection"/>
  155. <el-table-column show-overflow-tooltip label="序号" type="index" align="center"/>
  156. <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" :formatter="hangStatus" width="150px"/>
  157. <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo">
  158. <template slot-scope="scope">
  159. {{scope.$index + 1 + '0'}}
  160. </template>
  161. </el-table-column>
  162. <!-- <el-table-column show-overflow-tooltip label="业务部门名称" align="center" width="180px"/> -->
  163. <!-- <el-table-column show-overflow-tooltip label="业务部门" align="center" width="180px"/> -->
  164. <el-table-column show-overflow-tooltip label="需求客户" align="center" prop="demandCustomerName" width="200px"/>
  165. <el-table-column show-overflow-tooltip label="一级品类" align="center" prop="materialClassifyOneName" width="180px">
  166. <template slot-scope="scope">
  167. <el-form-item class="hang">
  168. <el-input readonly size="mini" v-model="scope.row.materialClassifyOneName"/>
  169. </el-form-item>
  170. </template>
  171. </el-table-column>
  172. <el-table-column show-overflow-tooltip label="二级品类" align="center" prop="materialClassifyTwoName" width="180px">
  173. <template slot-scope="scope">
  174. <el-form-item class="hang">
  175. <el-input readonly size="mini" v-model="scope.row.materialClassifyTwoName"/>
  176. </el-form-item>
  177. </template>
  178. </el-table-column>
  179. <el-table-column show-overflow-tooltip label="三级品类" align="center" prop="materialClassifyThreeName" width="180px">
  180. <template slot-scope="scope">
  181. <el-form-item class="hang">
  182. <el-input readonly size="mini" v-model="scope.row.materialClassifyThreeName"/>
  183. </el-form-item>
  184. </template>
  185. </el-table-column>
  186. <el-table-column show-overflow-tooltip label="四级品类" align="center" prop="materialClassifyFourName" width="180px">
  187. <template slot-scope="scope">
  188. <el-form-item class="hang">
  189. <el-input readonly size="mini" v-model="scope.row.materialClassifyFourName"/>
  190. </el-form-item>
  191. </template>
  192. </el-table-column>
  193. <el-table-column show-overflow-tooltip label="采购员名称" align="center" prop="buyerName" width="120px"/>
  194. <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyer"/>
  195. <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="230px">
  196. <template slot-scope="scope">
  197. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'materialCode'" :rules="{ required: true, message: '请选择物料编码', trigger: 'blur' }">
  198. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope, scope.$index)">
  199. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
  200. </el-input>
  201. </el-form-item>
  202. </template>
  203. </el-table-column>
  204. <el-table-column show-overflow-tooltip label="物料名称" align="center" prop="materialName" width="230px" />
  205. <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification" />
  206. <el-table-column show-overflow-tooltip label="型号" align="center" prop="model"/>
  207. <el-table-column show-overflow-tooltip label="单位" align="center" prop="unitName"/>
  208. <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturerName" width="230px"/>
  209. <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant" width="150px"/>
  210. <el-table-column show-overflow-tooltip label="采购周期" align="center" prop="puPeriod" width="150px">
  211. <template slot-scope="scope">
  212. <el-form-item class="hang">
  213. <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.puPeriod"></el-input>
  214. </el-form-item>
  215. </template>
  216. </el-table-column>
  217. <el-table-column show-overflow-tooltip label="有效期" align="center" prop="expiry" width="120px"/>
  218. <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="expiryUnit" width="120px"/>
  219. <el-table-column show-overflow-tooltip label="最小包装" align="center" prop="minPackage" width="120px"/>
  220. <el-table-column show-overflow-tooltip label="最小订货量" align="center" prop="minOrderQty" width="120px"/>
  221. <el-table-column show-overflow-tooltip label="最小批量" align="center" prop="minBatch" width="120px"/>
  222. <el-table-column show-overflow-tooltip label="安全库存" align="center" prop="safeStock" width="120px">
  223. <template slot-scope="scope">
  224. <el-form-item class="hang">
  225. <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.safeStock"/>
  226. </el-form-item>
  227. </template>
  228. </el-table-column>
  229. <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
  230. <template slot-scope="scope">
  231. <el-form-item class="hang">
  232. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @change="getYLSL(scope)" @clear="cleanYLSL(scope)">
  233. <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
  234. </el-option>
  235. </el-select>
  236. <!-- <el-input v-model="scope.row.reservedProportion"/> -->
  237. </el-form-item>
  238. </template>
  239. </el-table-column>
  240. <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
  241. <template slot-scope="scope">
  242. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'reservedPeriod'" :rules="{ required: scope.row.reservedProportion && scope.row.reservedProportion !== '' , message: '请填写预留周期', trigger: 'blur' }">
  243. <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
  244. </el-form-item>
  245. </template>
  246. </el-table-column>
  247. <el-table-column show-overflow-tooltip label="预留数量" align="center" prop="reservedQty" width="150px">
  248. <template slot-scope="scope">
  249. <el-form-item class="hang">
  250. <el-input type="number" min="0" readonly size="mini" v-model="scope.row.reservedQty"></el-input>
  251. </el-form-item>
  252. </template>
  253. </el-table-column>
  254. <el-table-column show-overflow-tooltip label="月均销量" align="center" prop="averageQtyMonth" width="120px"/>
  255. <el-table-column show-overflow-tooltip label="实际(业务)需求量" align="center" prop="qty" width="120px">
  256. <template slot-scope="scope">
  257. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'qty'" :rules="{ required: true, message: '请填写实际(业务)需求量', trigger: 'blur' }">
  258. <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.qty" @input="getYLSL(scope)"/>
  259. </el-form-item>
  260. </template>
  261. </el-table-column>
  262. <el-table-column show-overflow-tooltip label="需求可用周期" align="center" prop="demandPeriod" width="120px"/>
  263. <el-table-column show-overflow-tooltip label="集团预测分类" align="center" prop="forecastClassify" width="120px"/>
  264. <el-table-column show-overflow-tooltip label="近一月需求" align="center" prop="onemonthAvgVolume" width="120px"/>
  265. <el-table-column show-overflow-tooltip label="近三月需求" align="center" prop="threemonthAvgVolume" width="120px"/>
  266. <el-table-column show-overflow-tooltip label="采购在途" align="center" prop="puFreight" width="120px"/>
  267. <el-table-column show-overflow-tooltip label="交货日期" align="center" prop="deliveryDate" width="230px">
  268. <template slot-scope="scope">
  269. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'deliveryDate'" :rules="{ required: true, message: '请填写交货日期', trigger: 'blur' }">
  270. <el-date-picker
  271. v-model="scope.row.deliveryDate"
  272. :readonly="sonDisable"
  273. clearable
  274. type="date"
  275. size="mini"
  276. value-format="yyyy-MM-dd"
  277. :picker-options="pickerOptionsEnd"
  278. placeholder="选择日期">
  279. </el-date-picker>
  280. </el-form-item>
  281. </template>
  282. </el-table-column>
  283. <el-table-column show-overflow-tooltip label="补单标识" align="center" prop="isReplenishment" width="100px">
  284. <template slot-scope="scope">
  285. <el-form-item class="hang">
  286. <el-switch
  287. v-model="scope.row.isReplenishment"
  288. disabled
  289. active-value="Y"
  290. inactive-value="N"
  291. active-color="#13ce66"
  292. inactive-color="#a1a3a9">
  293. </el-switch>
  294. </el-form-item>
  295. </template>
  296. </el-table-column>
  297. <el-table-column show-overflow-tooltip label="批号锁定标识" align="center" prop="isBatchLock" width="100px">
  298. <template slot-scope="scope">
  299. <el-form-item class="hang">
  300. <el-switch
  301. v-model="scope.row.isBatchLock"
  302. :disabled="sonDisable"
  303. active-value="Y"
  304. inactive-value="N"
  305. active-color="#13ce66"
  306. inactive-color="#a1a3a9">
  307. </el-switch>
  308. </el-form-item>
  309. </template>
  310. </el-table-column>
  311. <el-table-column show-overflow-tooltip label="业务备注" align="center" prop="remark" width="150px">
  312. <template slot-scope="scope">
  313. <el-form-item class="hang">
  314. <el-input clearable :readonly="sonDisable" size="mini" v-model="scope.row.remark"/>
  315. </el-form-item>
  316. </template>
  317. </el-table-column>
  318. <el-table-column show-overflow-tooltip label="采购备注" align="center" prop="puRemark" width="150px"/>
  319. <!-- <el-table-column show-overflow-tooltip label="末级供应仓库存量" align="center" prop="lastWarehouseQty" /> -->
  320. <el-table-column show-overflow-tooltip label="调拨占有量" align="center" prop="allotQty" width="150px"/>
  321. <el-table-column show-overflow-tooltip label="最终净需求量" align="center" prop="resDemandQty" width="150px">
  322. <template slot-scope="scope">
  323. <el-form-item class="hang">
  324. <el-input type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.resDemandQty"/>
  325. </el-form-item>
  326. </template>
  327. </el-table-column>
  328. <el-table-column show-overflow-tooltip label="最终采购执行数量" align="center" prop="executeQty" width="150px">
  329. <template slot-scope="scope">
  330. {{scope.row.executeQty ? scope.row.executeQty : 0 }}
  331. </template>
  332. </el-table-column>
  333. <el-table-column show-overflow-tooltip label="收货仓库" align="center" prop="deliveryWarehouseName" width="200px">
  334. <template slot-scope="scope">
  335. <el-form-item class="hang">
  336. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.$index, '选择收货仓库')" @focus="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')">
  337. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')"></el-button>
  338. </el-input>
  339. </el-form-item>
  340. </template>
  341. </el-table-column>
  342. <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="200px">
  343. <template slot-scope="scope">
  344. <el-form-item class="hang">
  345. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clearHang(scope.$index, '选择收货货位')" @focus="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)">
  346. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
  347. </el-input>
  348. </el-form-item>
  349. </template>
  350. </el-table-column>
  351. <!-- <el-table-column show-overflow-tooltip label="收货货位编码" align="center" prop="deliveryAllocation" width="200px"/> -->
  352. <el-table-column show-overflow-tooltip label="末级供应仓库" align="center" prop="lastWarehouseName" width="200px"/>
  353. <el-table-column show-overflow-tooltip label="末级供应货位" align="center" prop="lastAllocationName" width="200px"/>
  354. <el-table-column show-overflow-tooltip label="紧急标识" align="center" prop="isUrgency" width="100px">
  355. <template slot-scope="scope">
  356. <el-form-item class="hang">
  357. <el-switch
  358. v-model="scope.row.isUrgency"
  359. disabled
  360. active-value="Y"
  361. inactive-value="N"
  362. active-color="#13ce66"
  363. inactive-color="#a1a3a9">
  364. </el-switch>
  365. </el-form-item>
  366. </template>
  367. </el-table-column>
  368. <el-table-column show-overflow-tooltip label="默认采购组织" align="center" prop="purOrgName" width="200px"/>yu
  369. <el-table-column show-overflow-tooltip label="默认采购组织编码" align="center" prop="puOrg" width="200px"/>
  370. <!-- <el-table-column show-overflow-tooltip label="末级供应调拨待入量" align="center" prop="lastStockQty" width="150px"/> -->
  371. <!-- <el-table-column show-overflow-tooltip label="上级供应中心现存量" align="center" prop="superiorCenterQty" width="200px"/> -->
  372. <!-- <el-table-column show-overflow-tooltip label="上级库存被调拨占用量" align="center" prop="superiorAllotQty" width="200px"/> -->
  373. <el-table-column show-overflow-tooltip label="可用量" align="center" prop="availableQty"/>
  374. <el-table-column show-overflow-tooltip label="调拨状态" align="center" prop="statusAllot" width="100px">
  375. <template slot-scope="scope">
  376. <el-form-item class="hang">
  377. <el-switch
  378. v-model="scope.row.statusAllot"
  379. :disabled="sonDisable"
  380. active-value="Y"
  381. inactive-value="N"
  382. active-color="#13ce66"
  383. inactive-color="#a1a3a9">
  384. </el-switch>
  385. </el-form-item>
  386. </template>
  387. </el-table-column>
  388. <el-table-column show-overflow-tooltip label="补单供应商" align="center" prop="additionalSupplierName" width="200px">
  389. <template slot-scope="scope">
  390. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplierName'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
  391. <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
  392. <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
  393. </el-input>
  394. </el-form-item>
  395. </template>
  396. </el-table-column>
  397. <!-- <el-table-column show-overflow-tooltip label="补单供应商名称" align="center" prop="additionalSupplierName" width="200px">
  398. <template slot-scope="scope">
  399. <el-form-item class="hang">
  400. <el-input readonly size="mini" v-model="scope.row.additionalSupplierName"/>
  401. </el-form-item>
  402. </template>
  403. </el-table-column> -->
  404. <!-- <el-table-column show-overflow-tooltip label="周期单位" align="center" prop="periodUnit" width="150px">
  405. <template slot-scope="scope">
  406. <el-form-item class="hang">
  407. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.periodUnit">
  408. <el-option v-for=" dict in dict.type.sys_period_unit" :key="dict.value" :label="dict.label" :value="dict.value">
  409. </el-option>
  410. </el-select>
  411. </el-form-item>
  412. </template>
  413. </el-table-column> -->
  414. <el-table-column show-overflow-tooltip label="末级供应库存组织" align="center" prop="lastStockOrgName" width="200px"></el-table-column>
  415. <el-table-column show-overflow-tooltip label="中心仓可用量" align="center" prop="centralWarehouseQty" width="200px"/>
  416. <el-table-column show-overflow-tooltip label="调拨单号" align="center" prop="allotCode"></el-table-column>
  417. <el-table-column show-overflow-tooltip label="收货地址" align="center" prop="deliveryAddressName" width="200px">
  418. <template slot-scope="scope">
  419. <el-form-item class="hang">
  420. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.$index, '选择收货地址')" @focus="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')">
  421. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
  422. </el-input>
  423. </el-form-item>
  424. </template>
  425. </el-table-column>
  426. <!-- <el-table-column show-overflow-tooltip label="收货地址编码" align="center" prop="deliveryAddress" width="200px"></el-table-column> -->
  427. <el-table-column show-overflow-tooltip label="联系人" align="center" prop="contacts"/>
  428. <el-table-column show-overflow-tooltip label="联系人电话" align="center" prop="contactsPhone" width="200px"/>
  429. <el-table-column show-overflow-tooltip label="详细地址" align="center" prop="address" width="200px"/>
  430. <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="150px">
  431. <template slot-scope="scope">
  432. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'priceType'" :rules="{ required: true, message: '请选择价格类型', trigger: 'blur' }">
  433. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.priceType">
  434. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  435. </el-option>
  436. </el-select>
  437. <!-- <el-input v-model="scope.row.periodUnit"/> -->
  438. </el-form-item>
  439. </template>
  440. </el-table-column>
  441. <el-table-column
  442. fixed="right"
  443. label="操作"
  444. align="center"
  445. >
  446. <template slot-scope="scope">
  447. <el-button type="text" size="mini" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除</el-button>
  448. </template>
  449. </el-table-column>
  450. </el-table>
  451. </el-form>
  452. </el-card>
  453. <div class="btn_group">
  454. <el-col :span="1.5">
  455. <el-button type="primary" size="mini" plain @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
  456. </el-col>
  457. <el-col :span="1.5">
  458. <el-button type="primary" size="mini" plain @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
  459. </el-col>
  460. <el-col :span="1.5" style="margin: 0 10px;">
  461. <el-button type="primary" size="mini" plain @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
  462. </el-col>
  463. <el-col :span="1.5">
  464. <el-button size="mini" plain @click="back">返回</el-button>
  465. </el-col>
  466. <Reserved v-if="dialog.config" :isVisible="dialog.config" :info="row" @updateReserved="updateReserved"/>
  467. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  468. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="true" />
  469. </div>
  470. <!-- 批量调整参数 -->
  471. <el-dialog title="批量调整" :visible.sync="adjust.open" @close="closeEvent" width="400px">
  472. <el-row style="margin-bottom: 10px;">
  473. <el-col :span="6">价格类型</el-col>
  474. <el-col :span="14">
  475. <el-select clearable size="mini" v-model="adjust.priceType">
  476. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  477. </el-option>
  478. </el-select>
  479. </el-col>
  480. </el-row>
  481. <el-row style="margin-bottom: 10px;">
  482. <el-col :span="6">采购员</el-col>
  483. <el-col :span="14">
  484. <el-select clearable size="mini" v-model="adjust.purchaseMan" @focus="chooseOrg('CONTACTS_PARAM', true, '采购员')">
  485. <el-option v-for="item in purchaseManOptions" :key="item.id" :label="item.name" :value="item.code" />
  486. </el-select>
  487. </el-col>
  488. </el-row>
  489. <el-row style="margin-bottom: 10px;">
  490. <el-col :span="6">收货仓库</el-col>
  491. <el-col :span="14">
  492. <el-input clearable size="mini" v-model="adjust.warehouseName" @focus="chooseOrg('WAREHOUSE_PARAM', true, '收货仓库')">
  493. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('WAREHOUSE_PARAM', true, '收货仓库')"></el-button>
  494. </el-input>
  495. </el-col>
  496. </el-row>
  497. <el-row style="margin-bottom: 10px;">
  498. <el-col :span="6">收货货位</el-col>
  499. <el-col :span="14">
  500. <el-input clearable size="mini" v-model="adjust.allocationName" @focus="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)">
  501. <el-button size="mini" slot="append" icon="el-icon-more" @click="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)"></el-button>
  502. </el-input>
  503. </el-col>
  504. </el-row>
  505. <el-row style="margin-bottom: 10px;">
  506. <el-col :span="6">业务备注</el-col>
  507. <el-col :span="14">
  508. <el-input clearable size="mini" v-model="adjust.remark"/>
  509. </el-col>
  510. </el-row>
  511. <el-row style="margin-bottom: 10px;">
  512. <el-col :span="6">收货地址</el-col>
  513. <el-col :span="14">
  514. <el-input clearable size="mini" v-model="adjust.deliveryAddressName" @focus="chooseOrg('ADDRESS_PARAM', true, '收货地址')">
  515. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"></el-button>
  516. </el-input>
  517. </el-col>
  518. </el-row>
  519. <el-row style="margin-bottom: 10px;">
  520. <el-col :span="6">收货地址编码</el-col>
  521. <el-col :span="14">
  522. <el-input disabled clearable size="mini" v-model="adjust.deliveryAddress"/>
  523. </el-col>
  524. </el-row>
  525. <el-row style="margin-bottom: 10px;">
  526. <el-col :span="6">联系人</el-col>
  527. <el-col :span="14">
  528. <el-input disabled clearable size="mini" v-model="adjust.contacts"/>
  529. </el-col>
  530. </el-row>
  531. <el-row style="margin-bottom: 10px;">
  532. <el-col :span="6">联系人电话</el-col>
  533. <el-col :span="14">
  534. <el-input disabled clearable size="mini" v-model="adjust.contactsPhone"/>
  535. </el-col>
  536. </el-row>
  537. <el-row style="margin-bottom: 10px;">
  538. <el-col :span="6">详细地址</el-col>
  539. <el-col :span="14">
  540. <el-input disabled clearable size="mini" v-model="adjust.address"/>
  541. </el-col>
  542. </el-row>
  543. <div slot="footer">
  544. <el-button size="mini" type="primary" @click="confirmAdjust">确 认</el-button>
  545. <el-button size="mini" @click="adjust.open = false">取 消</el-button>
  546. </div>
  547. </el-dialog>
  548. </div>
  549. </template>
  550. <script>
  551. import Reserved from './reserved.vue'
  552. import Refers from '@/components/Refers/refers.vue'
  553. import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan } from '@/api/purchase/purchaseDemand.js'
  554. // 用于回显参照框数据
  555. import {getRefer} from '@/api/purchase/basic.js'
  556. // 明细行选择物料参照
  557. import popDialog from '@/components/PopDialog/index.vue'
  558. export default {
  559. name: 'addDemandList',
  560. props: ['pageStu','row', 'disable'],
  561. dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business','sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
  562. components: {
  563. Reserved,
  564. Refers,
  565. popDialog
  566. },
  567. model: {
  568. prop: 'isList',
  569. event: 'jugislist'
  570. },
  571. data() {
  572. return {
  573. // 不能直接改变props传来的值
  574. sonPageStu: this.pageStu,
  575. sonDisable: this.disable,
  576. // BDZT是补单供应商是否可以编辑条件
  577. BDZT: true,
  578. dialog: {
  579. config: false
  580. },
  581. basicForm: {
  582. code: '',
  583. org: '',
  584. orgName: '',
  585. demandBusinessType: '1',
  586. status: '0',
  587. customer: '',
  588. customerName: '',
  589. customerCode: '',
  590. customerPrincipal: '',
  591. demandPersonal: '',
  592. demandDept: '',
  593. demandDate: '',
  594. source: '4',
  595. billType: 'ZQBH',
  596. isSpeical: '',
  597. isProcess: '',
  598. isMonthleyCalculate: '',
  599. remark: '',
  600. puDemandItemList: []
  601. },
  602. delDemandItemList: [],
  603. options: [{
  604. value: 'Y', label: '是',
  605. }, {
  606. value: 'N', label: '否'
  607. }],
  608. basicRules: {},
  609. tableList: [],
  610. referCondition: {
  611. type: '',
  612. isPage: true,
  613. title: '',
  614. },
  615. // referCondition: {
  616. // type: '',
  617. // isPage: true,
  618. // title: '',
  619. // },
  620. tableIndex: null,
  621. ids: [],
  622. orgOptions: [],
  623. manOptions: [],
  624. personOptions: [],
  625. deptOptions: [],
  626. customerOptions: [],
  627. pickerOptionsEnd: {
  628. disabledDate: (time) => {
  629. return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000
  630. }
  631. },
  632. isBDXQ: false,
  633. isYl: false,
  634. // 批量调整参数
  635. adjust: {
  636. open: false,
  637. priceType: '',
  638. purchaseMan: '',
  639. purchaseManName: '',
  640. warehouse: '',
  641. warehouseName: '',
  642. allocation: '',
  643. allocationName: '',
  644. remark:'',
  645. deliveryAddress: '',
  646. deliveryAddressName: '',
  647. contacts: '',
  648. contactsPhone: '',
  649. address: ''
  650. },
  651. purchaseManOptions: []
  652. }
  653. },
  654. created() {
  655. if(this.pageStu == 'check') {
  656. console.log('数据', this.row)
  657. this.getDetails(this.row)
  658. } else if(this.pageStu == 'edit') {
  659. this.getDetails(this.row)
  660. }
  661. },
  662. methods: {
  663. // 改变单据日期时清空子表的调拨日期
  664. changeDemandDate() {
  665. this.basicForm.puDemandItemList.forEach(item => {
  666. item.deliveryDate = null
  667. })
  668. },
  669. // 更改业务类型调整明细行内补单或紧急标识
  670. changeBillType() {
  671. if (this.basicForm.billType == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
  672. this.isBDXQ = true
  673. this.BDZT = false
  674. this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
  675. } else {
  676. this.isBDXQ = false
  677. this.BDZT = true
  678. this.basicForm.puDemandItemList.forEach(item => {
  679. item.isReplenishment = 'N'
  680. item.additionalSupplier = null
  681. item.additionalSupplierName = null
  682. })
  683. }
  684. if (this.basicForm.billType == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
  685. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
  686. } else {
  687. this.basicForm.puDemandItemList.forEach(item => { item.isUrgency = 'N' })
  688. }
  689. },
  690. hangStatus(row) {
  691. switch (row.status) {
  692. case '0':
  693. return '需补货'
  694. case '1':
  695. return '待计划确认'
  696. case '2':
  697. return '计划已确认'
  698. case '3':
  699. return '计划已审核'
  700. case '4':
  701. return '行关闭'
  702. case '5':
  703. return '总供应可满足'
  704. }
  705. },
  706. // 获取预留数量
  707. getYLSL(scope) {
  708. if (scope.row.reservedProportion) {
  709. scope.row.reservedQty = Math.ceil(scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty)
  710. }
  711. // 如果选择预留比例,预留周期必填
  712. // if(scope.row.reservedQty && scope.row.reservedQty !== 0) {
  713. // this.isYl = true
  714. // } else {
  715. // this.isYl = false
  716. // }
  717. },
  718. // 清空
  719. cleanYLSL(scope) {
  720. scope.row.reservedQty = ''
  721. scope.row.reservedPeriod = ''
  722. },
  723. copy() {
  724. this.$modal.msgSuccess("复制成功");
  725. this.sonPageStu = 'add'
  726. this.sonDisable = false
  727. // this.getDetails(this.row)
  728. this.basicForm.id = ''
  729. this.basicForm.code = ''
  730. this.basicForm.createBy = ''
  731. this.basicForm.source = '4'
  732. this.basicForm.puDemandItemList.forEach(item => {
  733. item.status = ''
  734. item.buyerName = ''
  735. item.buyer = ''
  736. item.reservedProportion = ''
  737. item.reservedPeriod = ''
  738. item.reservedQty = ''
  739. item.averageQtyMonth = ''
  740. item.demandPeriod = ''
  741. item.forecastClassify = ''
  742. item.onemonthAvgVolume = ''
  743. item.threemonthAvgVolume = ''
  744. item.puFreight = ''
  745. item.superiorAllotQty = ''
  746. item.resDemandQty = ''
  747. item.executeQty = ''
  748. item.deliveryWarehouseName = ''
  749. item.deliveryWarehouse = ''
  750. item.deliveryAllocationName = ''
  751. item.deliveryAllocation = ''
  752. item.lastWarehouseName = ''
  753. item.lastAllocationName = ''
  754. item.availableQty = ''
  755. item.lastStockOrgName = ''
  756. item.centralWarehouseQty = ''
  757. item.allotCode = ''
  758. item.allotQty = ''
  759. item.deliveryAddress = ''
  760. item.deliveryAddressName = ''
  761. item.contacts = ''
  762. item.contactsPhone = ''
  763. item.address = ''
  764. })
  765. },
  766. handleData() {
  767. console.log('222')
  768. // 复制新增把id,编码,创建人置为空,子表去掉id
  769. this.basicForm.id = ''
  770. this.basicForm.code = ''
  771. this.basicForm.createBy = ''
  772. this.basicForm.source = '4'
  773. if (this.basicForm.puDemandItemList.length !== 0) {
  774. this.basicForm.puDemandItemList.forEach(item => {
  775. if (item.id) {
  776. delete item.id
  777. }
  778. if (item.demandId) {
  779. delete item.demandId
  780. }
  781. if (item.allotCode) {
  782. delete item.allotCode
  783. }
  784. })
  785. }
  786. },
  787. async save() {
  788. if(this.basicForm.puDemandItemList.length !== 0) {
  789. this.$refs['basic'].validate((valid) => {
  790. if(valid) {
  791. this.$modal.loading("保存中...");
  792. if(this.sonPageStu == 'add') {
  793. this.handleData()
  794. addDemand(this.basicForm).then(res => {
  795. console.log(333)
  796. if (res.code === 200) {
  797. this.$modal.msgSuccess("保存成功");
  798. this.$modal.closeLoading();
  799. this.back()
  800. }
  801. }).catch(err => {
  802. this.$modal.closeLoading();
  803. })
  804. } else if (this.sonPageStu == 'edit') {
  805. let list = []
  806. list.push(...this.basicForm.puDemandItemList, ...this.delDemandItemList)
  807. // 深拷贝一下参数对象
  808. let param = JSON.parse(JSON.stringify(this.basicForm))
  809. console.log('深拷贝对象',param);
  810. param.puDemandItemList = list
  811. // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
  812. editDemand(param).then(res => {
  813. if (res.code === 200) {
  814. this.$modal.msgSuccess("编辑成功");
  815. this.$modal.closeLoading();
  816. this.back()
  817. }
  818. }).catch(err => {
  819. this.$modal.closeLoading();
  820. })
  821. }
  822. }
  823. })
  824. } else {
  825. this.$modal.msgWarning("明细信息不能为空!");
  826. }
  827. },
  828. submit() {
  829. this.$modal.loading("提交中...");
  830. submitDemand(this.basicForm).then(res => {
  831. if (res.code === 200) {
  832. this.$modal.msgSuccess("提交成功");
  833. this.$modal.closeLoading();
  834. this.back()
  835. }
  836. }).catch(err => {
  837. this.$modal.closeLoading();
  838. })
  839. },
  840. // 增行
  841. addLine() {
  842. const newLine = {
  843. contacts: null,
  844. id: null,
  845. demandId: null,
  846. status: null,
  847. businessDept: null,
  848. businessDeptName: null,
  849. materialCategory: null,
  850. buyer: null,
  851. buyerName: null,
  852. mateiralClassifyOne: null,
  853. materialClassifyOneName: null,
  854. materialClassifyTwo: null,
  855. materialClassifyTwoName: null,
  856. materialClassifyThree: null,
  857. materialClassifyThreeName: null,
  858. materialClassifyFour: null,
  859. materialClassifyFourName: null,
  860. materialCode: null,
  861. material: null,
  862. materialName: null,
  863. classifyId: null,
  864. specification: null,
  865. unit: null,
  866. unitName: null,
  867. manufacturerName: null,
  868. registrant: null,
  869. puPeriod: null,
  870. expiryUnit: null,
  871. expiry: null,
  872. minPackage: null,
  873. minOrderQty: null,
  874. minBatch: null,
  875. safeStock: null,
  876. averageQtyMonth: null,
  877. qty: null,
  878. adjustmentPersonal: null,
  879. adjustmentTime: null,
  880. manualRegulation: null,
  881. updateCause: null,
  882. reservedProportion: null,
  883. reservedPeriod: null,
  884. reservedQty: null,
  885. demandPeriod: null,
  886. forecastClassify: null,
  887. onemonthAvgVolume: null,
  888. threemonthAvgVolume: null,
  889. puFreight: null,
  890. deliveryDate: null,
  891. isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
  892. isReplenishment: this.basicForm.billType == 'BDXQ'? 'Y': 'N',
  893. isBatchLock: 'N',
  894. remark: null,
  895. puRemark: null,
  896. lastWarehouseQty: null,
  897. resDemandQty: null,
  898. lastWarehouse: null,
  899. lastWarehouseName: null,
  900. deliveryWarehouse: null,
  901. deliveryWarehouseName: null,
  902. lastAllocation: null,
  903. lastAllocationName: null,
  904. deliveryAllocation: null,
  905. deliveryAllocationName: null,
  906. passageOn: null,
  907. puOrg: null,
  908. purOrgName: null,
  909. lastStockQty: null,
  910. superiorCenterQty: null,
  911. superiorAllotQty: null,
  912. availableQty: null,
  913. statusAllot: 'N',
  914. additionalSupplier: null,
  915. additionalSupplierName: null,
  916. periodUnit: null,
  917. demandCustomer: this.basicForm.customer,
  918. demandCustomerName: this.basicForm.customerName,
  919. businessDept: this.basicForm.demandDept,
  920. businessDeptName: null,
  921. lastStockOrg: null,
  922. lastStockOrgName: null,
  923. superiorStockOrg: null,
  924. superiorStockOrgName: null,
  925. allotCode: null,
  926. deliveryAddress: null,
  927. deliveryAddressName: null,
  928. contacts: null,
  929. contactsPhone: null,
  930. address: null,
  931. source: null,
  932. priceType: 'order',
  933. puManagerApprover: null,
  934. puManagerApproverName: null,
  935. processTime: null,
  936. affirmer: null,
  937. tenantId: null,
  938. revision: null,
  939. createBy: null,
  940. createByName: null,
  941. createTime: null,
  942. updateBy: null,
  943. updateByName: null,
  944. updateTime: null,
  945. delFlag: 0,
  946. // 新增字段
  947. model: null,
  948. storageCondition: null,
  949. transportationCondition: null,
  950. }
  951. this.basicForm.puDemandItemList.push(newLine)
  952. // 补单需求状态改变
  953. if (this.basicForm.billType == 'BDXQ') {
  954. this.BDZT = false
  955. } else {
  956. this.BDZT = true
  957. }
  958. },
  959. delLine(index, row) {
  960. console.log('删除行:', index)
  961. console.log('改变行:', row)
  962. // this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  963. // return item.id !== row.id
  964. // })
  965. row.delFlag = '2'
  966. // this.basicForm.puDemandItemList.splice(index,1)
  967. let delList = []
  968. delList = this.basicForm.puDemandItemList.filter(item => {
  969. return item.delFlag == '2'
  970. })
  971. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  972. return item.delFlag == '0'
  973. })
  974. this.delDemandItemList.push(...delList)
  975. console.log('删除的数组',this.delDemandItemList)
  976. },
  977. back() {
  978. this.$emit('jugislist', true)
  979. // let queryParams = {
  980. // pageNum: 1,
  981. // pageSize: 10
  982. // }
  983. this.$emit('refresh')
  984. },
  985. // 如果需要回显则调用详情接口
  986. getDetails(row) {
  987. getDemandDetail(row.id).then(res => {
  988. if (res.code === 200) {
  989. // this.basicForm = res.data
  990. let reciveForm = res.data
  991. let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
  992. getDemandSonDetail(params).then(res => {
  993. if (res.code === 200) {
  994. reciveForm.puDemandItemList = res.data
  995. console.log('reciveForm',reciveForm)
  996. this.basicForm = reciveForm
  997. if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
  998. if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
  999. if(this.basicForm.customerPrincipal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.customerPrincipal, '客户负责人') }
  1000. if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  1001. if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  1002. // 详情时将收货仓库id赋值给stordocId
  1003. // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
  1004. if(this.basicForm.billType == 'BDXQ') {
  1005. this.BDZT = false
  1006. this.isBDXQ = true
  1007. } else {
  1008. this.BDZT = true
  1009. this.isBDXQ = false
  1010. }
  1011. }
  1012. })
  1013. }
  1014. })
  1015. },
  1016. // 单元格标红
  1017. cellClassName({row, column, rowIndex, columnIndex}) {
  1018. if(this.basicForm.isSpeical == 'N' && column.label == '需求可用周期' && Number(row.demandPeriod) > 1.5 && Number(row.demandPeriod) > Number(row.minOrderQty)) {
  1019. return 'success-row';
  1020. }
  1021. },
  1022. handleSelectionChange(selection) {
  1023. this.ids = selection.map(item =>{
  1024. return item.id
  1025. })
  1026. console.log('选中数组', this.ids)
  1027. },
  1028. // 点击预留单展示
  1029. showReserved() {
  1030. this.dialog.config = true
  1031. },
  1032. // 修改是否让页面显示与隐藏的事件
  1033. updateReserved (val) {
  1034. this.dialog.config = val
  1035. },
  1036. // 回显参照框
  1037. reBackRefer(type, id, title) {
  1038. getRefer({type: type, id: id}).then(res => {
  1039. if(type == 'ORG_PARAM') {
  1040. this.orgOptions = res.rows
  1041. }
  1042. if (type == 'CUSTOMER_PARAM') {
  1043. this.customerOptions = res.rows
  1044. }
  1045. if (type == 'CONTACTS_PARAM' && title == '需求人员') {
  1046. this.personOptions = res.rows
  1047. }
  1048. if (type == 'CONTACTS_PARAM' && title == '客户负责人') {
  1049. this.manOptions = res.rows
  1050. }
  1051. if (type == 'DEPT_PARAM') {
  1052. this.deptOptions = res.rows
  1053. }
  1054. })
  1055. },
  1056. chooseOrg(type, isPage, title) {
  1057. this.referCondition.type = type
  1058. this.referCondition.isPage = isPage
  1059. this.referCondition.title = title
  1060. this.$refs.refer.init(this.referCondition)
  1061. },
  1062. selectionsToInput(selection) {
  1063. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
  1064. this.orgOptions = selection
  1065. this.basicForm.org = selection[0].id
  1066. this.basicForm.orgName = selection[0].name
  1067. }
  1068. if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  1069. this.customerOptions = selection
  1070. this.basicForm.customer = selection[0].id
  1071. this.basicForm.customerName = selection[0].name
  1072. this.basicForm.customerCode = selection[0].code
  1073. if(this.basicForm.puDemandItemList.length !== 0) {
  1074. this.basicForm.puDemandItemList.forEach(item => {
  1075. item.demandCustomerName = this.basicForm.customerName
  1076. item.demandCustomer = this.basicForm.customer
  1077. item.status = ''
  1078. item.buyerName = ''
  1079. item.buyer = ''
  1080. item.reservedProportion = ''
  1081. item.reservedPeriod = ''
  1082. item.reservedQty = ''
  1083. item.averageQtyMonth = ''
  1084. item.demandPeriod = ''
  1085. item.forecastClassify = ''
  1086. item.onemonthAvgVolume = ''
  1087. item.threemonthAvgVolume = ''
  1088. item.puFreight = ''
  1089. item.superiorAllotQty = ''
  1090. item.resDemandQty = ''
  1091. item.executeQty = ''
  1092. item.deliveryWarehouseName = ''
  1093. item.deliveryWarehouse = ''
  1094. item.deliveryAllocationName = ''
  1095. item.deliveryAllocation = ''
  1096. item.lastWarehouseName = ''
  1097. item.lastAllocationName = ''
  1098. item.availableQty = ''
  1099. item.lastStockOrgName = ''
  1100. item.centralWarehouseQty = ''
  1101. item.allotCode = ''
  1102. item.deliveryAddress = ''
  1103. item.deliveryAddressName = ''
  1104. item.contacts = ''
  1105. item.contactsPhone = ''
  1106. item.address = ''
  1107. })
  1108. }
  1109. }
  1110. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '需求人员') {
  1111. this.personOptions = selection
  1112. this.basicForm.demandPersonal = selection[0].code
  1113. }
  1114. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '采购员') {
  1115. this.purchaseManOptions = selection
  1116. this.adjust.purchaseMan = selection[0].code
  1117. this.adjust.purchaseManName = selection[0].name
  1118. }
  1119. if(this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '收货仓库') {
  1120. this.adjust.warehouse = selection[0].id
  1121. this.adjust.warehouseName = selection[0].name
  1122. this.adjust.allocation = ''
  1123. this.adjust.allocationName = ''
  1124. }
  1125. if(this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '收货货位') {
  1126. this.adjust.allocation = selection[0].id
  1127. this.adjust.allocationName = selection[0].name
  1128. }
  1129. if(this.referCondition.type == 'ADDRESS_PARAM' && this.referCondition.title == '收货地址') {
  1130. this.adjust.deliveryAddressName = selection[0].name
  1131. this.adjust.deliveryAddress = selection[0].id
  1132. this.adjust.contacts = selection[0].contactsName
  1133. this.adjust.contactsPhone = selection[0].contactsPhone
  1134. this.adjust.address = selection[0].address
  1135. }
  1136. if(this.referCondition.type == 'DEPT_PARAM') {
  1137. this.deptOptions = selection
  1138. this.basicForm.demandDept = selection[0].id
  1139. }
  1140. // if(this.referCondition.type == 'DEPT_PARAM') {
  1141. // this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
  1142. // this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
  1143. // }
  1144. if(this.referCondition.title == '选择收货仓库') {
  1145. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
  1146. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
  1147. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1148. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1149. }
  1150. if(this.referCondition.title == '选择收货货位') {
  1151. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
  1152. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
  1153. }
  1154. if(this.referCondition.title == '选择补单供应商') {
  1155. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].id
  1156. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
  1157. }
  1158. if(this.referCondition.title == '选择收货地址') {
  1159. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
  1160. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].id
  1161. this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
  1162. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
  1163. this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
  1164. }
  1165. },
  1166. // 粘贴来的数据
  1167. async pasteMe(e, scope, index) {
  1168. this.$modal.loading("正在处理数据...");
  1169. e.preventDefault() //阻止默认粘贴事件
  1170. let source = e.clipboardData.getData("Text");
  1171. console.log('scope', scope.column.property)
  1172. console.log('eee:', source)
  1173. // 首先对源头进行解析
  1174. let rows = source.split("\r\n"); // 拆成一个数组
  1175. // 数组去除空字符串
  1176. rows = rows.filter(item => {
  1177. return item && item.trim()
  1178. })
  1179. console.log('复制的数组',rows);
  1180. console.log('列表的数组',this.basicForm.puDemandItemList)
  1181. if (rows.length < 1000) {
  1182. await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
  1183. if (res.code === 200) {
  1184. let rowList = res.rows
  1185. for (let i = 0; i<rowList.length; i++) {
  1186. let line = {
  1187. contacts: null,
  1188. id: null,
  1189. demandId: null,
  1190. status: null,
  1191. businessDept: null,
  1192. businessDeptName: null,
  1193. materialCategory: null,
  1194. buyer: null,
  1195. buyerName: null,
  1196. mateiralClassifyOne: null,
  1197. materialClassifyOneName: null,
  1198. materialClassifyTwo: null,
  1199. materialClassifyTwoName: null,
  1200. materialClassifyThree: null,
  1201. materialClassifyThreeName: null,
  1202. materialClassifyFour: null,
  1203. materialClassifyFourName: null,
  1204. materialCode: null,
  1205. material: null,
  1206. materialName: null,
  1207. classifyId: null,
  1208. specification: null,
  1209. unit: null,
  1210. unitName: null,
  1211. manufacturerName: null,
  1212. registrant: null,
  1213. puPeriod: null,
  1214. expiryUnit: null,
  1215. expiry: null,
  1216. minPackage: null,
  1217. minOrderQty: null,
  1218. minBatch: null,
  1219. safeStock: null,
  1220. averageQtyMonth: null,
  1221. qty: null,
  1222. adjustmentPersonal: null,
  1223. adjustmentTime: null,
  1224. manualRegulation: null,
  1225. updateCause: null,
  1226. reservedProportion: null,
  1227. reservedPeriod: null,
  1228. reservedQty: null,
  1229. demandPeriod: null,
  1230. forecastClassify: null,
  1231. onemonthAvgVolume: null,
  1232. threemonthAvgVolume: null,
  1233. puFreight: null,
  1234. deliveryDate: null,
  1235. isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
  1236. isReplenishment: this.basicForm.billType == 'BDXQ' ? 'Y' : 'N',
  1237. isBatchLock: 'N',
  1238. remark: null,
  1239. puRemark: null,
  1240. lastWarehouseQty: null,
  1241. resDemandQty: null,
  1242. lastWarehouse: null,
  1243. lastWarehouseName: null,
  1244. deliveryWarehouse: null,
  1245. deliveryWarehouseName: null,
  1246. lastAllocation: null,
  1247. lastAllocationName: null,
  1248. deliveryAllocation: null,
  1249. deliveryAllocationName: null,
  1250. passageOn: null,
  1251. puOrg: null,
  1252. purOrgName: null,
  1253. lastStockQty: null,
  1254. superiorCenterQty: null,
  1255. superiorAllotQty: null,
  1256. availableQty: null,
  1257. statusAllot: 'N',
  1258. additionalSupplier: null,
  1259. additionalSupplierName: null,
  1260. periodUnit: null,
  1261. demandCustomer: this.basicForm.customer,
  1262. demandCustomerName: this.basicForm.customerName,
  1263. businessDept: this.basicForm.demandDept,
  1264. businessDeptName: null,
  1265. lastStockOrg: null,
  1266. lastStockOrgName: null,
  1267. superiorStockOrg: null,
  1268. superiorStockOrgName: null,
  1269. allotCode: null,
  1270. deliveryAddress: null,
  1271. deliveryAddressName: null,
  1272. contacts: null,
  1273. contactsPhone: null,
  1274. address: null,
  1275. source: null,
  1276. priceType: 'order',
  1277. puManagerApprover: null,
  1278. puManagerApproverName: null,
  1279. processTime: null,
  1280. affirmer: null,
  1281. tenantId: null,
  1282. revision: null,
  1283. createBy: null,
  1284. createByName: null,
  1285. createTime: null,
  1286. updateBy: null,
  1287. updateByName: null,
  1288. updateTime: null,
  1289. delFlag: 0,
  1290. // 新增字段
  1291. model: null,
  1292. storageCondition: null,
  1293. transportationCondition: null,
  1294. }
  1295. line.businessDept = rowList[i].businessDepartment
  1296. line.businessDeptName = rowList[i].businessDepartmentName
  1297. line.materialCode = rowList[i].code
  1298. line.material = rowList[i].id
  1299. line.materialName = rowList[i].name
  1300. line.classifyId = rowList[i].classifyId
  1301. line.materialClassifyOneName = rowList[i].oneClass
  1302. line.materialClassifyTwoName = rowList[i].twoClass
  1303. line.materialClassifyThreeName = rowList[i].threeClass
  1304. line.materialClassifyFourName = rowList[i].fourClass
  1305. line.specification = rowList[i].specification
  1306. line.model = rowList[i].model
  1307. line.unit = rowList[i].unitId
  1308. line.unitName = rowList[i].unitIdName
  1309. line.registrant = rowList[i].registrant
  1310. line.manufacturerName = rowList[i].manufacturerIdName
  1311. line.puPeriod = rowList[i].deliveryPeriod
  1312. line.expiry = rowList[i].usefulLife
  1313. line.expiryUnit = rowList[i].expiryUnitIdName
  1314. // line.minPackage = rowList[i].usefulLife
  1315. line.minPackage = rowList[i].minPackQty
  1316. line.minOrderQty = rowList[i].minOrderQty
  1317. line.minBatch = rowList[i].minBatchQty
  1318. line.safeStock = rowList[i].safeStock
  1319. line.purOrgName = rowList[i].purchasingOrganizationName
  1320. line.puOrg = rowList[i].purchasingOrganization
  1321. // 物料存储条件和运输条件
  1322. line.transportationCondition = rowList[i].transportationCondition
  1323. line.storageCondition = rowList[i].storageCondition
  1324. this.basicForm.puDemandItemList.push(line)
  1325. // console.log('临时数组', line)
  1326. }
  1327. this.$modal.msgSuccess("共粘贴" + rowList.length + '条数据');
  1328. }
  1329. }).catch(err => {
  1330. this.$modal.closeLoading();
  1331. })
  1332. this.$modal.closeLoading();
  1333. console.log('列表', this.basicForm.puDemandItemList)
  1334. } else {
  1335. this.$modal.msgWarning("复制长度不能超过1000!");
  1336. }
  1337. },
  1338. // 明细行选择物料编码带出数据
  1339. chooseMaterial(index) {
  1340. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
  1341. this.tableIndex = index
  1342. // 传0只展示同步NC了的物料
  1343. this.$refs.materialRefer.init(0)
  1344. },
  1345. selectMaterial(selection) {
  1346. console.log('选中的物料', selection)
  1347. // 选择新物料时先清空行内其他信息
  1348. this.basicForm.puDemandItemList[this.tableIndex].reservedProportion = null
  1349. this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null
  1350. this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null
  1351. this.basicForm.puDemandItemList[this.tableIndex].qty = null
  1352. this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null
  1353. this.basicForm.puDemandItemList[this.tableIndex].remark = null
  1354. this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null
  1355. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = null
  1356. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = null
  1357. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1358. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1359. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = null
  1360. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = null
  1361. this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null
  1362. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  1363. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  1364. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  1365. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  1366. this.basicForm.puDemandItemList[this.tableIndex].address = null
  1367. this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
  1368. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
  1369. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
  1370. this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null
  1371. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = null
  1372. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOne = null
  1373. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwo = null
  1374. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThree = null
  1375. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFour = null
  1376. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrg = null
  1377. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrgName = null
  1378. // 通过选择物料查询采购员
  1379. queryMan(selection[0].id).then(res => {
  1380. if(res.code === 200 && res.rows.length !== 0) {
  1381. this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
  1382. this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
  1383. }
  1384. })
  1385. this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].businessDepartment
  1386. this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].businessDepartmentName
  1387. this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
  1388. this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
  1389. this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
  1390. this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
  1391. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
  1392. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
  1393. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
  1394. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
  1395. this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
  1396. this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
  1397. this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
  1398. this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
  1399. this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
  1400. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
  1401. this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
  1402. this.basicForm.puDemandItemList[this.tableIndex].expiry = selection[0].usefulLife
  1403. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
  1404. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  1405. this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
  1406. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
  1407. this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
  1408. this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
  1409. this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
  1410. this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
  1411. // 物料存储条件和运输条件
  1412. this.basicForm.puDemandItemList[this.tableIndex].transportationCondition = selection[0].transportationCondition
  1413. this.basicForm.puDemandItemList[this.tableIndex].storageCondition = selection[0].storageCondition
  1414. // 选中骨科耗材时候的物料,需求客户不必填
  1415. },
  1416. // 明细行选择业务部门参照带出业务部门数据
  1417. chooseDept(index, type, isPage, title) {
  1418. this.tableIndex = index
  1419. this.referCondition.type = type
  1420. this.referCondition.isPage = isPage
  1421. this.referCondition.title = title
  1422. this.$refs.refer.init(this.referCondition)
  1423. },
  1424. // 明细行选择业务部门参照带出业务部门数据
  1425. choosehuoWei(index, type, isPage, title, stordocId) {
  1426. this.tableIndex = index
  1427. this.referCondition.type = type
  1428. this.referCondition.isPage = isPage
  1429. this.referCondition.title = title
  1430. // 选择收货货位前先选择收货仓库
  1431. if(stordocId) {
  1432. this.referCondition.stordocId = stordocId
  1433. this.$refs.refer.init(this.referCondition)
  1434. } else {
  1435. this.$modal.msgWarning("请先选择收货仓库");
  1436. }
  1437. },
  1438. // 明细行清空收货仓库,货位,收货地址档案等
  1439. clearHang(index, title) {
  1440. if (title == '选择收货仓库') {
  1441. this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
  1442. this.basicForm.puDemandItemList[index].deliveryWarehouse = null
  1443. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1444. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1445. }
  1446. if (title == '选择收货货位') {
  1447. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1448. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1449. }
  1450. if (title == '选择收货地址') {
  1451. this.basicForm.puDemandItemList[index].deliveryAddressName = null
  1452. this.basicForm.puDemandItemList[index].deliveryAddress = null
  1453. this.basicForm.puDemandItemList[index].contacts = null
  1454. this.basicForm.puDemandItemList[index].contactsPhone = null
  1455. this.basicForm.puDemandItemList[index].address = null
  1456. }
  1457. if (title == '选择补单供应商') {
  1458. this.basicForm.puDemandItemList[index].additionalSupplierName = null
  1459. this.basicForm.puDemandItemList[index].additionalSupplier = null
  1460. }
  1461. },
  1462. // 清除需求客户将明细行内也清空
  1463. cleanCustomer() {
  1464. this.basicForm.customer = ''
  1465. this.basicForm.customerName = ''
  1466. this.basicForm.customerCode = ''
  1467. if (this.basicForm.puDemandItemList.length !== 0) {
  1468. this.basicForm.puDemandItemList.forEach(item => {
  1469. item.demandCustomerName = ''
  1470. item.demandCustomer = ''
  1471. item.status = ''
  1472. item.buyerName = ''
  1473. item.buyer = ''
  1474. item.reservedProportion = ''
  1475. item.reservedPeriod = ''
  1476. item.reservedQty = ''
  1477. item.averageQtyMonth = ''
  1478. item.demandPeriod = ''
  1479. item.forecastClassify = ''
  1480. item.onemonthAvgVolume = ''
  1481. item.threemonthAvgVolume = ''
  1482. item.puFreight = ''
  1483. item.superiorAllotQty = ''
  1484. item.resDemandQty = ''
  1485. item.executeQty = ''
  1486. item.deliveryWarehouseName = ''
  1487. item.deliveryWarehouse = ''
  1488. item.deliveryAllocationName = ''
  1489. item.deliveryAllocation = ''
  1490. item.lastWarehouseName = ''
  1491. item.lastAllocationName = ''
  1492. item.availableQty = ''
  1493. item.lastStockOrgName = ''
  1494. item.centralWarehouseQty = ''
  1495. item.allotCode = ''
  1496. item.deliveryAddress = ''
  1497. item.deliveryAddressName = ''
  1498. item.contacts = ''
  1499. item.contactsPhone = ''
  1500. item.address = ''
  1501. })
  1502. }
  1503. },
  1504. // 批量调整
  1505. adjustPl() {
  1506. if(this.ids.length == 0) {
  1507. this.$modal.msgWarning('请至少选择一项数据进行操作!')
  1508. } else {
  1509. this.adjust.open = true
  1510. }
  1511. },
  1512. // 批量调整确认
  1513. confirmAdjust() {
  1514. console.log('data', this.adjust)
  1515. this.basicForm.puDemandItemList.forEach(item => {
  1516. this.ids.some(val => {
  1517. if(val == item.id) {
  1518. if(this.adjust.purchaseMan) {
  1519. item.buyer = this.adjust.purchaseMan
  1520. item.buyerName = this.adjust.purchaseManName
  1521. }
  1522. if(this.adjust.priceType) {
  1523. item.priceType = this.adjust.priceType
  1524. }
  1525. if(this.adjust.warehouseName) {
  1526. item.deliveryWarehouse = this.adjust.warehouse
  1527. item.deliveryWarehouseName = this.adjust.warehouseName
  1528. item.deliveryAllocation = this.adjust.allocation
  1529. item.deliveryAllocationName = this.adjust.allocationName
  1530. }
  1531. // if(this.adjust.allocationName) {
  1532. // item.deliveryAllocation = this.adjust.allocation
  1533. // item.deliveryAllocationName = this.adjust.allocationName
  1534. // }
  1535. if(this.adjust.remark) {
  1536. item.remark = this.adjust.remark
  1537. }
  1538. if(this.adjust.deliveryAddressName) {
  1539. item.deliveryAddressName = this.adjust.deliveryAddressName
  1540. item.deliveryAddress = this.adjust.deliveryAddress
  1541. item.contacts = this.adjust.contacts
  1542. item.contactsPhone = this.adjust.contactsPhone
  1543. item.address = this.adjust.address
  1544. }
  1545. }
  1546. this.adjust.open = false
  1547. })
  1548. })
  1549. },
  1550. // 批量调整选择货位
  1551. adjustHuoWei(type, isPage, title, stordocId) {
  1552. this.referCondition.type = type
  1553. this.referCondition.isPage = isPage
  1554. this.referCondition.title = title
  1555. // 选择收货货位前先选择收货仓库
  1556. if (stordocId) {
  1557. this.referCondition.stordocId = stordocId
  1558. this.$refs.refer.init(this.referCondition)
  1559. } else {
  1560. this.$modal.msgWarning("请先选择收货仓库");
  1561. }
  1562. },
  1563. // 关闭清空批量调整数据
  1564. closeEvent() {
  1565. this.adjust = {
  1566. open: false,
  1567. priceType: '',
  1568. purchaseMan: '',
  1569. purchaseManName: '',
  1570. warehouse: '',
  1571. warehouseName: '',
  1572. allocation: '',
  1573. allocationName: '',
  1574. remark: '',
  1575. deliveryAddress: '',
  1576. deliveryAddressName: '',
  1577. contacts: '',
  1578. contactsPhone: '',
  1579. address: ''
  1580. }
  1581. },
  1582. }
  1583. }
  1584. </script>
  1585. <style lang="scss" scoped>
  1586. .btn_group {
  1587. width: 100%;
  1588. margin: 20px 0;
  1589. display: flex;
  1590. justify-content: center;
  1591. }
  1592. .btn_grooup {
  1593. margin-bottom: 10px;
  1594. display: flex;
  1595. justify-content: flex-end;
  1596. }
  1597. .hang {
  1598. margin: auto;
  1599. }
  1600. .hang ::v-deep .el-form-item__content{
  1601. margin-left: 0px !important;
  1602. }
  1603. .el-table ::v-deep .el-form-item__error{
  1604. padding-top: 0;
  1605. top: 70%
  1606. }
  1607. .el-table ::v-deep .success-row {
  1608. background: #f11616;
  1609. }
  1610. </style>