add.vue 45 KB

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