add.vue 77 KB

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