add.vue 77 KB

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