add.vue 61 KB

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