add.vue 72 KB

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