add.vue 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. <template>
  2. <div id="addDemandList">
  3. <span>基本信息</span>
  4. <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto">
  5. <el-row :gutter="10">
  6. <el-col :span="1.5">
  7. <el-form-item label="编码">
  8. <el-input
  9. v-model="basicForm.code"
  10. size="small"
  11. disabled
  12. style="width: 200px"
  13. />
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="1.5">
  17. <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
  18. <el-select clearable size="small" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
  19. <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
  20. </el-select>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-form-item label="需求处理方式">
  25. <el-select disabled v-model="basicForm.demandBusinessType" size="small" style="width: 200px">
  26. <el-option v-for="dict in dict.type.sys_processing_mode" :key="dict.value" :label="dict.label" :value="dict.value">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-form-item label="单据状态">
  33. <el-select disabled v-model="basicForm.status" size="small" style="width: 200px">
  34. <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="1.5">
  40. <el-form-item label="需求客户">
  41. <el-select clearable size="small" v-model="basicForm.customer" :disabled="sonDisable" @clear="cleanCustomer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
  42. <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
  43. </el-select>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-form-item label="需求客户名称">
  48. <el-input disabled v-model="basicForm.customerName" size="small" style="width: 200px"></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="1.5">
  52. <el-form-item label="客户负责人">
  53. <el-input disabled v-model="basicForm.customerPrincipal" size="small" style="width: 200px"></el-input>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-form-item label="需求人员">
  58. <el-select clearable size="small" v-model="basicForm.demandPersonal" :disabled="sonDisable" @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')" style="width: 200px">
  59. <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
  60. </el-select>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-form-item label="需求部门">
  65. <el-select clearable v-model="basicForm.demandDept" size="small" :disabled="sonDisable" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
  66. <el-option
  67. v-for="item in deptOptions"
  68. :key="item.id"
  69. :label="item.name"
  70. :value="item.id">
  71. </el-option>
  72. </el-select>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
  77. <el-date-picker
  78. v-model="basicForm.demandDate"
  79. :disabled="sonDisable"
  80. clearable
  81. type="date"
  82. value-format="yyyy-MM-dd"
  83. @change="changeDemandDate"
  84. size="small"
  85. style="width: 200px"
  86. >
  87. </el-date-picker>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="1.5">
  91. <el-form-item label="单据来源">
  92. <el-select v-model="basicForm.source" disabled size="small" style="width: 200px">
  93. <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
  94. </el-option>
  95. </el-select>
  96. </el-form-item>
  97. </el-col>
  98. <el-col :span="1.5">
  99. <el-form-item label="业务类型">
  100. <el-select clearable v-model="basicForm.billType" @change="changeBillType" :disabled="sonDisable" size="small" style="width: 200px">
  101. <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
  102. </el-option>
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="1.5">
  107. <el-form-item label="是否客户指定">
  108. <el-select clearable v-model="basicForm.isSpeical" :disabled="sonDisable" size="small" style="width: 200px">
  109. <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
  110. </el-option>
  111. </el-select>
  112. </el-form-item>
  113. </el-col>
  114. <!-- <el-col :span="1.5">
  115. <el-form-item label="是否处理需求">
  116. <el-input
  117. v-model="basicForm.isProcess"
  118. size="small"
  119. placeholder=""
  120. clearable
  121. style="width: 200px"
  122. />
  123. </el-form-item>
  124. </el-col> -->
  125. <el-col :span="1.5">
  126. <el-form-item label="备注">
  127. <el-input
  128. v-model.trim="basicForm.remark"
  129. size="small"
  130. :disabled="sonDisable"
  131. clearable
  132. style="width: 200px"
  133. />
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <span>明细信息</span>
  138. <el-card>
  139. <div class="btn_grooup">
  140. <el-button type="primary" size="small" @click="addLine" v-if="!sonDisable">增行</el-button>
  141. <el-button type="primary" size="small" v-if="!sonDisable">批量调整</el-button>
  142. <el-button type="primary" size="small" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
  143. </div>
  144. <el-table
  145. :data="basicForm.puDemandItemList"
  146. fit
  147. max-height="300"
  148. @selection-change="handleSelectionChange"
  149. >
  150. <el-table-column show-overflow-tooltip type="selection"/>
  151. <el-table-column show-overflow-tooltip label="序号" type="index" align="center"/>
  152. <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" :formatter="hangStatus" width="150px"/>
  153. <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo" />
  154. <!-- <el-table-column show-overflow-tooltip label="业务部门名称" align="center" width="180px"/> -->
  155. <!-- <el-table-column show-overflow-tooltip label="业务部门" align="center" width="180px"/> -->
  156. <el-table-column show-overflow-tooltip label="需求客户" align="center" prop="demandCustomerName" width="200px"/>
  157. <el-table-column show-overflow-tooltip label="一级品类" align="center" prop="materialClassifyOneName" width="180px">
  158. <template slot-scope="scope">
  159. <el-form-item class="hang">
  160. <el-input readonly size="small" v-model="scope.row.materialClassifyOneName"/>
  161. </el-form-item>
  162. </template>
  163. </el-table-column>
  164. <el-table-column show-overflow-tooltip label="二级品类" align="center" prop="materialClassifyTwoName" width="180px">
  165. <template slot-scope="scope">
  166. <el-form-item class="hang">
  167. <el-input readonly size="small" v-model="scope.row.materialClassifyTwoName"/>
  168. </el-form-item>
  169. </template>
  170. </el-table-column>
  171. <el-table-column show-overflow-tooltip label="三级品类" align="center" prop="materialClassifyThreeName" width="180px">
  172. <template slot-scope="scope">
  173. <el-form-item class="hang">
  174. <el-input readonly size="small" v-model="scope.row.materialClassifyThreeName"/>
  175. </el-form-item>
  176. </template>
  177. </el-table-column>
  178. <el-table-column show-overflow-tooltip label="四级品类" align="center" prop="materialClassifyFourName" width="180px">
  179. <template slot-scope="scope">
  180. <el-form-item class="hang">
  181. <el-input readonly size="small" v-model="scope.row.materialClassifyFourName"/>
  182. </el-form-item>
  183. </template>
  184. </el-table-column>
  185. <el-table-column show-overflow-tooltip label="采购员名称" align="center" prop="buyerName" width="120px"/>
  186. <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyer"/>
  187. <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="230px">
  188. <template slot-scope="scope">
  189. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'materialCode'" :rules="{ required: true, message: '请选择物料编码', trigger: 'blur' }">
  190. <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.materialCode" @focus="chooseMaterial(scope.$index)">
  191. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
  192. </el-input>
  193. </el-form-item>
  194. </template>
  195. </el-table-column>
  196. <el-table-column show-overflow-tooltip label="物料名称" align="center" prop="materialName" width="230px" />
  197. <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification" />
  198. <el-table-column show-overflow-tooltip label="型号" align="center" prop="model"/>
  199. <el-table-column show-overflow-tooltip label="单位" align="center" prop="unitName"/>
  200. <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturerName" width="230px"/>
  201. <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant" width="150px"/>
  202. <el-table-column show-overflow-tooltip label="采购周期" align="center" prop="puPeriod" width="150px">
  203. <template slot-scope="scope">
  204. <el-form-item class="hang">
  205. <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.puPeriod"/>
  206. </el-form-item>
  207. </template>
  208. </el-table-column>
  209. <el-table-column show-overflow-tooltip label="有效期" align="center" prop="expiry" width="120px"/>
  210. <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="expiryUnit" width="120px"/>
  211. <el-table-column show-overflow-tooltip label="最小包装" align="center" prop="minPackage" width="120px"/>
  212. <el-table-column show-overflow-tooltip label="最小订货量" align="center" prop="minOrderQty" width="120px"/>
  213. <el-table-column show-overflow-tooltip label="最小批量" align="center" prop="minBatch" width="120px"/>
  214. <el-table-column show-overflow-tooltip label="安全库存" align="center" prop="safeStock" width="120px">
  215. <template slot-scope="scope">
  216. <el-form-item class="hang">
  217. <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.safeStock"/>
  218. </el-form-item>
  219. </template>
  220. </el-table-column>
  221. <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
  222. <template slot-scope="scope">
  223. <el-form-item class="hang">
  224. <el-select clearable :disabled="sonDisable" size="small" v-model="scope.row.reservedProportion" @change="getYLSL(scope)">
  225. <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
  226. </el-option>
  227. </el-select>
  228. <!-- <el-input v-model="scope.row.reservedProportion"/> -->
  229. </el-form-item>
  230. </template>
  231. </el-table-column>
  232. <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
  233. <template slot-scope="scope">
  234. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'reservedPeriod'" :rules="{ required: isYl, message: '请填写预留周期', trigger: 'blur' }">
  235. <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
  236. </el-form-item>
  237. </template>
  238. </el-table-column>
  239. <el-table-column show-overflow-tooltip label="预留数量" align="center" prop="reservedQty" width="150px">
  240. <template slot-scope="scope">
  241. <el-form-item class="hang">
  242. <el-input readonly size="small" v-model="scope.row.reservedQty"/>
  243. </el-form-item>
  244. </template>
  245. </el-table-column>
  246. <el-table-column show-overflow-tooltip label="月均销量" align="center" prop="averageQtyMonth" width="120px"/>
  247. <el-table-column show-overflow-tooltip label="实际(业务)需求量" align="center" prop="qty" width="120px">
  248. <template slot-scope="scope">
  249. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'qty'" :rules="{ required: true, message: '请填写实际(业务)需求量', trigger: 'blur' }">
  250. <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty" @input="getYLSL(scope)"/>
  251. </el-form-item>
  252. </template>
  253. </el-table-column>
  254. <el-table-column show-overflow-tooltip label="需求可用周期" align="center" prop="demandPeriod" width="120px"/>
  255. <el-table-column show-overflow-tooltip label="集团预测分类" align="center" prop="forecastClassify" width="120px"/>
  256. <el-table-column show-overflow-tooltip label="近一月需求" align="center" prop="onemonthAvgVolume" width="120px"/>
  257. <el-table-column show-overflow-tooltip label="近三月需求" align="center" prop="threemonthAvgVolume" width="120px"/>
  258. <el-table-column show-overflow-tooltip label="交货日期" align="center" prop="deliveryDate" width="230px">
  259. <template slot-scope="scope">
  260. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'deliveryDate'" :rules="{ required: true, message: '请填写交货日期', trigger: 'blur' }">
  261. <el-date-picker
  262. v-model="scope.row.deliveryDate"
  263. :readonly="sonDisable"
  264. clearable
  265. type="date"
  266. size="small"
  267. value-format="yyyy-MM-dd"
  268. :picker-options="pickerOptionsEnd"
  269. placeholder="选择日期">
  270. </el-date-picker>
  271. </el-form-item>
  272. </template>
  273. </el-table-column>
  274. <el-table-column show-overflow-tooltip label="补单标识" align="center" prop="isReplenishment" width="100px">
  275. <template slot-scope="scope">
  276. <el-form-item class="hang">
  277. <el-switch
  278. v-model="scope.row.isReplenishment"
  279. disabled
  280. active-value="Y"
  281. inactive-value="N"
  282. active-color="#13ce66"
  283. inactive-color="#a1a3a9">
  284. </el-switch>
  285. </el-form-item>
  286. </template>
  287. </el-table-column>
  288. <el-table-column show-overflow-tooltip label="批号锁定标识" align="center" prop="isBatchLock" width="100px">
  289. <template slot-scope="scope">
  290. <el-form-item class="hang">
  291. <el-switch
  292. v-model="scope.row.isBatchLock"
  293. :disabled="sonDisable"
  294. active-value="Y"
  295. inactive-value="N"
  296. active-color="#13ce66"
  297. inactive-color="#a1a3a9">
  298. </el-switch>
  299. </el-form-item>
  300. </template>
  301. </el-table-column>
  302. <el-table-column show-overflow-tooltip label="业务备注" align="center" prop="remark" width="150px">
  303. <template slot-scope="scope">
  304. <el-form-item class="hang">
  305. <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.remark"/>
  306. </el-form-item>
  307. </template>
  308. </el-table-column>
  309. <el-table-column show-overflow-tooltip label="采购备注" align="center" prop="puRemark" width="150px"/>
  310. <!-- <el-table-column show-overflow-tooltip label="末级供应仓库存量" align="center" prop="lastWarehouseQty" /> -->
  311. <el-table-column show-overflow-tooltip label="调拨占有量" align="center" prop="superiorAllotQty" width="150px"/>
  312. <el-table-column show-overflow-tooltip label="最终净需求量" align="center" prop="resDemandQty" width="150px">
  313. <template slot-scope="scope">
  314. <el-form-item class="hang">
  315. <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.resDemandQty"/>
  316. </el-form-item>
  317. </template>
  318. </el-table-column>
  319. <el-table-column show-overflow-tooltip label="最终采购执行数量" align="center" prop="executeQty" width="150px">
  320. <template slot-scope="scope">
  321. {{scope.row.executeQty ? scope.row.executeQty : 0 }}
  322. </template>
  323. </el-table-column>
  324. <el-table-column show-overflow-tooltip label="收货仓库" align="center" prop="deliveryWarehouseName" width="200px">
  325. <template slot-scope="scope">
  326. <el-form-item class="hang">
  327. <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.$index, '选择收货仓库')" @focus="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')">
  328. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'WAREHOUSE_PARAM', true, '选择收货仓库')"></el-button>
  329. </el-input>
  330. </el-form-item>
  331. </template>
  332. </el-table-column>
  333. <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="200px">
  334. <template slot-scope="scope">
  335. <el-form-item class="hang">
  336. <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryAllocationName" @clear="clearHang(scope.$index, '选择收货货位')" @focus="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)">
  337. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.$index, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
  338. </el-input>
  339. </el-form-item>
  340. </template>
  341. </el-table-column>
  342. <!-- <el-table-column show-overflow-tooltip label="收货货位编码" align="center" prop="deliveryAllocation" width="200px"/> -->
  343. <el-table-column show-overflow-tooltip label="末级供应仓库" align="center" prop="lastWarehouseName" width="200px"/>
  344. <el-table-column show-overflow-tooltip label="末级供应货位" align="center" prop="lastAllocationName" width="200px"/>
  345. <el-table-column show-overflow-tooltip label="紧急标识" align="center" prop="isUrgency" width="100px">
  346. <template slot-scope="scope">
  347. <el-form-item class="hang">
  348. <el-switch
  349. v-model="scope.row.isUrgency"
  350. disabled
  351. active-value="Y"
  352. inactive-value="N"
  353. active-color="#13ce66"
  354. inactive-color="#a1a3a9">
  355. </el-switch>
  356. </el-form-item>
  357. </template>
  358. </el-table-column>
  359. <el-table-column show-overflow-tooltip label="默认采购组织" align="center" prop="purOrgName" width="200px"/>yu
  360. <el-table-column show-overflow-tooltip label="默认采购组织编码" align="center" prop="puOrg" width="200px"/>
  361. <!-- <el-table-column show-overflow-tooltip label="末级供应调拨待入量" align="center" prop="lastStockQty" width="150px"/> -->
  362. <!-- <el-table-column show-overflow-tooltip label="上级供应中心现存量" align="center" prop="superiorCenterQty" width="200px"/> -->
  363. <!-- <el-table-column show-overflow-tooltip label="上级库存被调拨占用量" align="center" prop="superiorAllotQty" width="200px"/> -->
  364. <el-table-column show-overflow-tooltip label="可用量" align="center" prop="availableQty"/>
  365. <el-table-column show-overflow-tooltip label="调拨状态" align="center" prop="statusAllot" width="100px">
  366. <template slot-scope="scope">
  367. <el-form-item class="hang">
  368. <el-switch
  369. v-model="scope.row.statusAllot"
  370. :disabled="sonDisable"
  371. active-value="Y"
  372. inactive-value="N"
  373. active-color="#13ce66"
  374. inactive-color="#a1a3a9">
  375. </el-switch>
  376. </el-form-item>
  377. </template>
  378. </el-table-column>
  379. <el-table-column show-overflow-tooltip label="补单供应商编码" align="center" prop="additionalSupplier" width="200px">
  380. <template slot-scope="scope">
  381. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplier'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
  382. <el-input clearable :disabled="sonDisable || BDZT" size="small" v-model="scope.row.additionalSupplier" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
  383. <el-button size="small" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
  384. </el-input>
  385. </el-form-item>
  386. </template>
  387. </el-table-column>
  388. <el-table-column show-overflow-tooltip label="补单供应商名称" align="center" prop="additionalSupplierName" width="200px">
  389. <template slot-scope="scope">
  390. <el-form-item class="hang">
  391. <el-input readonly size="small" v-model="scope.row.additionalSupplierName"/>
  392. </el-form-item>
  393. </template>
  394. </el-table-column>
  395. <!-- <el-table-column show-overflow-tooltip label="周期单位" align="center" prop="periodUnit" width="150px">
  396. <template slot-scope="scope">
  397. <el-form-item class="hang">
  398. <el-select clearable :disabled="sonDisable" size="small" v-model="scope.row.periodUnit">
  399. <el-option v-for=" dict in dict.type.sys_period_unit" :key="dict.value" :label="dict.label" :value="dict.value">
  400. </el-option>
  401. </el-select>
  402. </el-form-item>
  403. </template>
  404. </el-table-column> -->
  405. <el-table-column show-overflow-tooltip label="末级供应库存组织" align="center" prop="superiorStockOrgName" width="200px"></el-table-column>
  406. <el-table-column show-overflow-tooltip label="中心仓可用量" align="center" prop="centralWarehouseQty" width="200px"/>
  407. <el-table-column show-overflow-tooltip label="调拨单号" align="center" prop="allotCode"></el-table-column>
  408. <el-table-column show-overflow-tooltip label="收货地址" align="center" prop="deliveryAddressName" width="200px">
  409. <template slot-scope="scope">
  410. <el-form-item class="hang">
  411. <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.$index, '选择收货地址')" @focus="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')">
  412. <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
  413. </el-input>
  414. </el-form-item>
  415. </template>
  416. </el-table-column>
  417. <!-- <el-table-column show-overflow-tooltip label="收货地址编码" align="center" prop="deliveryAddress" width="200px"></el-table-column> -->
  418. <el-table-column show-overflow-tooltip label="联系人" align="center" prop="contacts"/>
  419. <el-table-column show-overflow-tooltip label="联系人电话" align="center" prop="contactsPhone" width="200px"/>
  420. <el-table-column show-overflow-tooltip label="详细地址" align="center" prop="address" width="200px"/>
  421. <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="150px">
  422. <template slot-scope="scope">
  423. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'priceType'" :rules="{ required: true, message: '请选择价格类型', trigger: 'blur' }">
  424. <el-select clearable :disabled="sonDisable" size="small" v-model="scope.row.priceType">
  425. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  426. </el-option>
  427. </el-select>
  428. <!-- <el-input v-model="scope.row.periodUnit"/> -->
  429. </el-form-item>
  430. </template>
  431. </el-table-column>
  432. <el-table-column
  433. fixed="right"
  434. label="操作"
  435. align="center"
  436. >
  437. <template slot-scope="scope">
  438. <el-button type="text" size="small" :disabled="sonDisable" @click="delLine(scope.$index, scope.row)">删除</el-button>
  439. </template>
  440. </el-table-column>
  441. </el-table>
  442. </el-card>
  443. </el-form>
  444. <div class="btn_group">
  445. <el-col :span="1.5">
  446. <el-button type="primary" size="small" plain @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
  447. </el-col>
  448. <el-col :span="1.5">
  449. <el-button type="primary" size="small" plain @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
  450. </el-col>
  451. <el-col :span="1.5" style="margin: 0 10px;">
  452. <el-button type="primary" size="small" plain @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
  453. </el-col>
  454. <el-col :span="1.5">
  455. <el-button size="small" plain @click="back">返回</el-button>
  456. </el-col>
  457. <Reserved v-if="dialog.config" :isVisible="dialog.config" :info="row" @updateReserved="updateReserved"/>
  458. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  459. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="true" />
  460. </div>
  461. </div>
  462. </template>
  463. <script>
  464. import Reserved from './reserved.vue'
  465. import Refers from '@/components/Refers/refers.vue'
  466. import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan } from '@/api/purchase/purchaseDemand.js'
  467. // 用于回显参照框数据
  468. import {getRefer} from '@/api/purchase/basic.js'
  469. // 明细行选择物料参照
  470. import popDialog from '@/components/PopDialog/index.vue'
  471. export default {
  472. name: 'addDemandList',
  473. props: ['pageStu','row', 'disable'],
  474. dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business','sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
  475. components: {
  476. Reserved,
  477. Refers,
  478. popDialog
  479. },
  480. model: {
  481. prop: 'isList',
  482. event: 'jugislist'
  483. },
  484. data() {
  485. return {
  486. // 不能直接改变props传来的值
  487. sonPageStu: this.pageStu,
  488. sonDisable: this.disable,
  489. // BDZT是补单供应商是否可以编辑条件
  490. BDZT: true,
  491. dialog: {
  492. config: false
  493. },
  494. basicForm: {
  495. code: '',
  496. org: '',
  497. orgName: '',
  498. demandBusinessType: '1',
  499. status: '0',
  500. customer: '',
  501. customerName: '',
  502. customerCode: '',
  503. customerPrincipal: '',
  504. demandPersonal: '',
  505. demandDept: '',
  506. demandDate: '',
  507. source: '4',
  508. billType: 'ZQBH',
  509. isSpeical: '',
  510. isProcess: '',
  511. isMonthleyCalculate: '',
  512. remark: '',
  513. puDemandItemList: []
  514. },
  515. options: [{
  516. value: 'Y', label: '是',
  517. }, {
  518. value: 'N', label: '否'
  519. }],
  520. basicRules: {},
  521. tableList: [],
  522. referCondition: {
  523. type: '',
  524. isPage: true,
  525. title: '',
  526. },
  527. // referCondition: {
  528. // type: '',
  529. // isPage: true,
  530. // title: '',
  531. // },
  532. tableIndex: null,
  533. orgOptions: [],
  534. personOptions: [],
  535. deptOptions: [],
  536. customerOptions: [],
  537. pickerOptionsEnd: {
  538. disabledDate: (time) => {
  539. let beginDateVal = this.basicForm.demandDate;
  540. if (beginDateVal) {
  541. return (
  542. time.getTime() <
  543. new Date(beginDateVal).getTime() - 8.64e7
  544. );
  545. }
  546. }
  547. },
  548. isBDXQ: false,
  549. isYl: false
  550. }
  551. },
  552. created() {
  553. if(this.pageStu == 'check') {
  554. console.log('数据', this.row)
  555. this.getDetails(this.row)
  556. } else if(this.pageStu == 'edit') {
  557. this.getDetails(this.row)
  558. }
  559. },
  560. methods: {
  561. // 改变单据日期时清空子表的调拨日期
  562. changeDemandDate() {
  563. this.basicForm.puDemandItemList.forEach(item => {
  564. item.deliveryDate = null
  565. })
  566. },
  567. // 更改业务类型调整明细行内补单或紧急标识
  568. changeBillType() {
  569. if (this.basicForm.billType == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
  570. this.isBDXQ = true
  571. this.BDZT = false
  572. this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
  573. } else {
  574. this.isBDXQ = false
  575. this.BDZT = true
  576. this.basicForm.puDemandItemList.forEach(item => {
  577. item.isReplenishment = 'N'
  578. item.additionalSupplier = null
  579. item.additionalSupplierName = null
  580. })
  581. }
  582. if (this.basicForm.billType == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
  583. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
  584. } else {
  585. this.basicForm.puDemandItemList.forEach(item => { item.isUrgency = 'N' })
  586. }
  587. },
  588. hangStatus(row) {
  589. switch (row.status) {
  590. case '0':
  591. return '需补货'
  592. case '1':
  593. return '待计划确认'
  594. case '2':
  595. return '计划已确认'
  596. case '3':
  597. return '计划已审核'
  598. case '4':
  599. return '行关闭'
  600. case '5':
  601. return '总供应可满足'
  602. }
  603. },
  604. // 获取预留数量
  605. getYLSL(scope) {
  606. scope.row.reservedQty = Math.ceil(scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty)
  607. // 如果选择预留比例,预留周期必填
  608. if(scope.row.reservedQty && scope.row.reservedQty !== 0) {
  609. this.isYl = true
  610. } else {
  611. this.isYl = false
  612. }
  613. },
  614. copy() {
  615. this.$modal.msgSuccess("复制成功");
  616. this.sonPageStu = 'add'
  617. this.sonDisable = false
  618. this.getDetails(this.row)
  619. this.basicForm.id = ''
  620. this.basicForm.code = ''
  621. this.basicForm.createBy = ''
  622. },
  623. handleData() {
  624. console.log('222')
  625. // 复制新增把id,编码,创建人置为空,子表去掉id
  626. this.basicForm.id = ''
  627. this.basicForm.code = ''
  628. this.basicForm.createBy = ''
  629. if (this.basicForm.puDemandItemList.length !== 0) {
  630. this.basicForm.puDemandItemList.forEach(item => {
  631. if (item.id) {
  632. delete item.id
  633. }
  634. if (item.demandId) {
  635. delete item.demandId
  636. }
  637. })
  638. }
  639. },
  640. async save() {
  641. if(this.basicForm.puDemandItemList.length !== 0) {
  642. this.$refs['basic'].validate((valid) => {
  643. if(valid) {
  644. if(this.sonPageStu == 'add') {
  645. this.handleData()
  646. addDemand(this.basicForm).then(res => {
  647. console.log(333)
  648. if (res.code === 200) {
  649. this.$modal.msgSuccess("保存成功");
  650. this.$emit('jugislist', true)
  651. let queryParams = {
  652. pageNum: 1,
  653. pageSize: 10
  654. }
  655. this.$emit('refresh', queryParams)
  656. }
  657. })
  658. } else if (this.sonPageStu == 'edit') {
  659. editDemand(this.basicForm).then(res => {
  660. if (res.code === 200) {
  661. this.$modal.msgSuccess("编辑成功");
  662. this.back()
  663. }
  664. })
  665. }
  666. }
  667. })
  668. } else {
  669. this.$modal.msgWarning("明细信息不能为空!");
  670. }
  671. },
  672. submit() {
  673. submitDemand(this.basicForm).then(res => {
  674. if (res.code === 200) {
  675. this.$modal.msgSuccess("提交成功");
  676. this.back()
  677. }
  678. })
  679. },
  680. // 增行
  681. addLine() {
  682. const newLine = {
  683. contacts: null,
  684. id: null,
  685. demandId: null,
  686. status: null,
  687. businessDept: null,
  688. businessDeptName: null,
  689. materialCategory: null,
  690. buyer: null,
  691. buyerName: null,
  692. mateiralClassifyOne: null,
  693. materialClassifyOneName: null,
  694. materialClassifyTwo: null,
  695. materialClassifyTwoName: null,
  696. materialClassifyThree: null,
  697. materialClassifyThreeName: null,
  698. materialClassifyFour: null,
  699. materialClassifyFourName: null,
  700. materialCode: null,
  701. material: null,
  702. materialName: null,
  703. classifyId: null,
  704. specification: null,
  705. unit: null,
  706. unitName: null,
  707. manufacturerName: null,
  708. registrant: null,
  709. puPeriod: null,
  710. expiryUnit: null,
  711. expiry: null,
  712. minPackage: null,
  713. minOrderQty: null,
  714. minBatch: null,
  715. safeStock: null,
  716. averageQtyMonth: null,
  717. qty: null,
  718. adjustmentPersonal: null,
  719. adjustmentTime: null,
  720. manualRegulation: null,
  721. updateCause: null,
  722. reservedProportion: null,
  723. reservedPeriod: null,
  724. reservedQty: null,
  725. demandPeriod: null,
  726. forecastClassify: null,
  727. onemonthAvgVolume: null,
  728. threemonthAvgVolume: null,
  729. deliveryDate: null,
  730. isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
  731. isReplenishment: this.basicForm.billType == 'BDXQ'? 'Y': 'N',
  732. isBatchLock: 'N',
  733. remark: null,
  734. puRemark: null,
  735. lastWarehouseQty: null,
  736. resDemandQty: null,
  737. lastWarehouse: null,
  738. lastWarehouseName: null,
  739. deliveryWarehouse: null,
  740. deliveryWarehouseName: null,
  741. lastAllocation: null,
  742. lastAllocationName: null,
  743. deliveryAllocation: null,
  744. deliveryAllocationName: null,
  745. passageOn: null,
  746. puOrg: null,
  747. purOrgName: null,
  748. lastStockQty: null,
  749. superiorCenterQty: null,
  750. superiorAllotQty: null,
  751. availableQty: null,
  752. statusAllot: 'N',
  753. additionalSupplier: null,
  754. additionalSupplierName: null,
  755. periodUnit: null,
  756. demandCustomer: this.basicForm.customer,
  757. demandCustomerName: this.basicForm.customerName,
  758. businessDept: this.basicForm.demandDept,
  759. businessDeptName: null,
  760. lastStockOrg: null,
  761. lastStockOrgName: null,
  762. superiorStockOrg: null,
  763. superiorStockOrgName: null,
  764. allotCode: null,
  765. deliveryAddress: null,
  766. deliveryAddressName: null,
  767. contacts: null,
  768. contactsPhone: null,
  769. address: null,
  770. source: null,
  771. priceType: 'order',
  772. puManagerApprover: null,
  773. puManagerApproverName: null,
  774. processTime: null,
  775. affirmer: null,
  776. tenantId: null,
  777. revision: null,
  778. createBy: null,
  779. createByName: null,
  780. createTime: null,
  781. updateBy: null,
  782. updateByName: null,
  783. updateTime: null,
  784. delFlag: 0,
  785. // 新增字段
  786. model: null,
  787. storageCondition: null,
  788. transportationCondition: null,
  789. }
  790. this.basicForm.puDemandItemList.push(newLine)
  791. // 补单需求状态改变
  792. if (this.basicForm.billType == 'BDXQ') {
  793. this.BDZT = false
  794. } else {
  795. this.BDZT = true
  796. }
  797. },
  798. delLine(index) {
  799. console.log('删除行:', index)
  800. // this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  801. // return item.id !== row.id
  802. // })
  803. this.basicForm.puDemandItemList.splice(index,1)
  804. },
  805. back() {
  806. this.$emit('jugislist', true)
  807. // let queryParams = {
  808. // pageNum: 1,
  809. // pageSize: 10
  810. // }
  811. // this.$emit('refresh', queryParams)
  812. },
  813. // 如果需要回显则调用详情接口
  814. getDetails(row) {
  815. getDemandDetail(row.id).then(res => {
  816. if (res.code === 200) {
  817. // this.basicForm = res.data
  818. let reciveForm = res.data
  819. let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
  820. getDemandSonDetail(params).then(res => {
  821. if (res.code === 200) {
  822. reciveForm.puDemandItemList = res.data
  823. console.log('reciveForm',reciveForm)
  824. this.basicForm = reciveForm
  825. if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
  826. if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
  827. if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal) }
  828. if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  829. // 详情时将收货仓库id赋值给stordocId
  830. // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
  831. if(this.basicForm.billType == 'BDXQ') {
  832. this.BDZT = false
  833. this.isBDXQ = true
  834. } else {
  835. this.BDZT = true
  836. this.isBDXQ = false
  837. }
  838. }
  839. })
  840. }
  841. })
  842. },
  843. handleSelectionChange() {},
  844. // 点击预留单展示
  845. showReserved() {
  846. this.dialog.config = true
  847. },
  848. // 修改是否让页面显示与隐藏的事件
  849. updateReserved (val) {
  850. this.dialog.config = val
  851. },
  852. // 回显参照框
  853. reBackRefer(type, id) {
  854. getRefer({type: type, id: id}).then(res => {
  855. if(type == 'ORG_PARAM') {
  856. this.orgOptions = res.rows
  857. }
  858. if (type == 'CUSTOMER_PARAM') {
  859. this.customerOptions = res.rows
  860. }
  861. if (type == 'CONTACTS_PARAM') {
  862. this.personOptions = res.rows
  863. }
  864. if (type == 'DEPT_PARAM') {
  865. this.deptOptions = res.rows
  866. }
  867. })
  868. },
  869. chooseOrg(type, isPage, title) {
  870. this.referCondition.type = type
  871. this.referCondition.isPage = isPage
  872. this.referCondition.title = title
  873. this.$refs.refer.init(this.referCondition)
  874. },
  875. selectionsToInput(selection) {
  876. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
  877. this.orgOptions = selection
  878. this.basicForm.org = selection[0].id
  879. this.basicForm.orgName = selection[0].name
  880. }
  881. if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  882. this.customerOptions = selection
  883. this.basicForm.customer = selection[0].id
  884. this.basicForm.customerName = selection[0].name
  885. this.basicForm.customerCode = selection[0].code
  886. if(this.basicForm.puDemandItemList.length !== 0) {
  887. this.basicForm.puDemandItemList.forEach(item => {
  888. item.demandCustomerName = this.basicForm.customerName
  889. item.demandCustomer = this.basicForm.customer
  890. })
  891. }
  892. }
  893. if(this.referCondition.type == 'CONTACTS_PARAM') {
  894. this.personOptions = selection
  895. this.basicForm.demandPersonal = selection[0].code
  896. }
  897. if(this.referCondition.type == 'DEPT_PARAM') {
  898. this.deptOptions = selection
  899. this.basicForm.demandDept = selection[0].id
  900. }
  901. // if(this.referCondition.type == 'DEPT_PARAM') {
  902. // this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
  903. // this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
  904. // }
  905. if(this.referCondition.title == '选择收货仓库') {
  906. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
  907. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
  908. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  909. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  910. }
  911. if(this.referCondition.title == '选择收货货位') {
  912. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
  913. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
  914. }
  915. if(this.referCondition.title == '选择补单供应商') {
  916. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].code
  917. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
  918. }
  919. if(this.referCondition.title == '选择收货地址') {
  920. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
  921. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
  922. this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
  923. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
  924. this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
  925. }
  926. },
  927. // 明细行选择物料编码带出数据
  928. chooseMaterial(index) {
  929. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
  930. this.tableIndex = index
  931. // 传0只展示同步NC了的物料
  932. this.$refs.materialRefer.init(0)
  933. },
  934. selectMaterial(selection) {
  935. console.log('选中的物料', selection)
  936. // 选择新物料时先清空行内其他信息
  937. this.basicForm.puDemandItemList[this.tableIndex].reservedProportion = null
  938. this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null
  939. this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null
  940. this.basicForm.puDemandItemList[this.tableIndex].qty = null
  941. this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null
  942. this.basicForm.puDemandItemList[this.tableIndex].remark = null
  943. this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null
  944. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = null
  945. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = null
  946. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  947. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  948. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = null
  949. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = null
  950. this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null
  951. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  952. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  953. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  954. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  955. this.basicForm.puDemandItemList[this.tableIndex].address = null
  956. this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
  957. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
  958. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
  959. this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null
  960. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = null
  961. // 通过选择物料查询采购员
  962. queryMan(selection[0].id).then(res => {
  963. if(res.code === 200 && res.rows.length !== 0) {
  964. this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
  965. this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
  966. }
  967. })
  968. this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].businessDepartment
  969. this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].businessDepartmentName
  970. this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
  971. this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
  972. this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
  973. this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
  974. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
  975. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
  976. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
  977. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
  978. this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
  979. this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
  980. this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
  981. this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
  982. this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
  983. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
  984. this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
  985. this.basicForm.puDemandItemList[this.tableIndex].expiry = selection[0].usefulLife
  986. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
  987. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  988. this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
  989. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
  990. this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
  991. this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
  992. this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
  993. this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
  994. // 物料存储条件和运输条件
  995. this.basicForm.puDemandItemList[this.tableIndex].transportationCondition = selection[0].transportationCondition
  996. this.basicForm.puDemandItemList[this.tableIndex].storageCondition = selection[0].storageCondition
  997. // 选中骨科耗材时候的物料,需求客户不必填
  998. },
  999. // 明细行选择业务部门参照带出业务部门数据
  1000. chooseDept(index, type, isPage, title) {
  1001. this.tableIndex = index
  1002. this.referCondition.type = type
  1003. this.referCondition.isPage = isPage
  1004. this.referCondition.title = title
  1005. this.$refs.refer.init(this.referCondition)
  1006. },
  1007. // 明细行选择业务部门参照带出业务部门数据
  1008. choosehuoWei(index, type, isPage, title, stordocId) {
  1009. this.tableIndex = index
  1010. this.referCondition.type = type
  1011. this.referCondition.isPage = isPage
  1012. this.referCondition.title = title
  1013. // 选择收货货位前先选择收货仓库
  1014. if(stordocId) {
  1015. this.referCondition.stordocId = stordocId
  1016. this.$refs.refer.init(this.referCondition)
  1017. } else {
  1018. this.$modal.msgWarning("请先选择收货仓库");
  1019. }
  1020. },
  1021. // 明细行清空收货仓库,货位,收货地址档案等
  1022. clearHang(index, title) {
  1023. if (title == '选择收货仓库') {
  1024. this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
  1025. this.basicForm.puDemandItemList[index].deliveryWarehouse = null
  1026. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1027. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1028. }
  1029. if (title == '选择收货货位') {
  1030. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1031. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1032. }
  1033. if (title == '选择收货地址') {
  1034. this.basicForm.puDemandItemList[index].deliveryAddressName = null
  1035. this.basicForm.puDemandItemList[index].deliveryAddress = null
  1036. this.basicForm.puDemandItemList[index].contacts = null
  1037. this.basicForm.puDemandItemList[index].contactsPhone = null
  1038. this.basicForm.puDemandItemList[index].address = null
  1039. }
  1040. if (title == '选择补单供应商') {
  1041. this.basicForm.puDemandItemList[index].additionalSupplierName = null
  1042. this.basicForm.puDemandItemList[index].additionalSupplier = null
  1043. }
  1044. },
  1045. // 清除需求客户将明细行内也清空
  1046. cleanCustomer() {
  1047. this.basicForm.customer = ''
  1048. this.basicForm.customerName = ''
  1049. if (this.basicForm.puDemandItemList.length !== 0) {
  1050. this.basicForm.puDemandItemList.forEach(item => {
  1051. item.demandCustomerName = ''
  1052. item.demandCustomer = ''
  1053. })
  1054. }
  1055. },
  1056. }
  1057. }
  1058. </script>
  1059. <style lang="scss" scoped>
  1060. .btn_group {
  1061. width: 100%;
  1062. margin: 20px 0;
  1063. display: flex;
  1064. justify-content: center;
  1065. }
  1066. .btn_grooup {
  1067. margin-bottom: 10px;
  1068. display: flex;
  1069. justify-content: flex-end;
  1070. }
  1071. .hang {
  1072. margin: auto;
  1073. }
  1074. .hang ::v-deep .el-form-item__content{
  1075. margin-left: 0px !important;
  1076. }
  1077. </style>