add.vue 76 KB

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