add.vue 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090
  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(basicForm.billType)" :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="需求部门" prop="demandDept" :rules="{ required: true, message: '请选择需求部门', trigger: 'blur' }">
  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="需求计划" prop="planType" :rules="{ required: true, message: '请选择需求计划', trigger: 'blur' }">
  43. <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px" @change="changeplanType(basicForm.planType)">
  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
  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
  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-col :span="1.5">
  143. <el-form-item label="是否超需求可用周期">
  144. <el-select v-model="basicForm.isBeyondRap" disabled size="mini" style="width: 200px">
  145. <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
  146. </el-option>
  147. </el-select>
  148. </el-form-item>
  149. </el-col>
  150. </el-row>
  151. <div class="btn_grooup">
  152. <span>明细信息</span>
  153. <div>
  154. <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
  155. <el-button type="primary" size="mini" @click="delLines" v-if="!sonDisable">删行</el-button>
  156. <el-button type="primary" size="mini" v-if="!sonDisable" @click.stop="adjustPl">批量调整</el-button>
  157. <el-button type="primary" size="mini" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
  158. </div>
  159. </div>
  160. <ux-grid
  161. v-loading="loading"
  162. :data="basicForm.puDemandItemList"
  163. border
  164. :cell-style="{ borderColor: '#c0c0c0' }"
  165. :header-cell-style="{ borderColor: '#c0c0c0' }"
  166. class="exporttable"
  167. height="410"
  168. max-height="410"
  169. style="font-size: 12px;"
  170. @selection-change="handleSelectionChange"
  171. :cell-class-name="cellClassName"
  172. ref="table"
  173. :rules="tableRules"
  174. show-header-overflow="tooltip"
  175. show-overflow="tooltip"
  176. keep-source
  177. beautifyTable
  178. show-summary
  179. :summary-method="jisuan"
  180. :checkbox-config="{highlight: true, trigger: 'row'}"
  181. :edit-config="{trigger: 'click', mode: 'row'}"
  182. :validConfig="{autoPos: true}">
  183. >
  184. <ux-table-column resizable type="checkbox" fixed="left"/>
  185. <!-- <ux-table-column resizable title="序号" type="index" align="center" width="50px"/> -->
  186. <ux-table-column resizable title="行号" align="center" field="rowNo" width="50px">
  187. <template v-slot="scope">
  188. {{ scope.row.rowNo = scope.rowIndex + 1 + "0" }}
  189. </template>
  190. </ux-table-column>
  191. <ux-table-column resizable title="默认采购组织" align="center" field="purOrgName" width="100px"/>
  192. <ux-table-column resizable title="需求客户" align="center" field="demandCustomerName" width="100px"/>
  193. <ux-table-column resizable title="行状态" align="center" field="status" :formatter="hangStatus" width="100px"/>
  194. <ux-table-column resizable title="物料编码" align="center" field="materialCode" width="150px" :render-header="addRedStar" :edit-render="{autofocus: '.el-input__inner'}">
  195. <template v-slot:edit="scope">
  196. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope, scope.rowIndex)">
  197. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.rowIndex)"></el-button>
  198. </el-input>
  199. </template>
  200. </ux-table-column>
  201. <ux-table-column resizable title="物料名称" align="center" field="materialName" width="100px"/>
  202. <ux-table-column resizable title="规格" align="center" field="specification" width="50px"/>
  203. <ux-table-column resizable title="型号" align="center" field="model" width="50px"/>
  204. <ux-table-column resizable title="单位" align="center" field="unitName" width="50px"/>
  205. <ux-table-column resizable title="生产厂家/代理人" align="center" field="manufacturerName" width="100px"/>
  206. <ux-table-column resizable title="最小包装" align="center" field="minPackage" width="80px"/>
  207. <ux-table-column resizable title="月均销量" align="center" field="averageQtyMonth" width="80px"/>
  208. <ux-table-column resizable title="需求可用周期" align="center" field="demandPeriod" width="80px"/>
  209. <ux-table-column resizable title="实际(业务)需求量" align="center" field="qty" width="150px" :render-header="addRedStar" edit-render>
  210. <template v-slot:edit="scope">
  211. <el-input type="number" min="0" clearable :disabled="sonDisable" size="mini" v-model="scope.row.qty" @paste.native="pasteMe($event, scope, scope.rowIndex)"/>
  212. </template>
  213. </ux-table-column>
  214. <ux-table-column resizable title="紧急标识" align="center" field="isUrgency" width="100px" edit-render>
  215. <template v-slot:edit="scope">
  216. <el-switch
  217. v-model="scope.row.isUrgency"
  218. :disabled="sonDisable"
  219. active-value="Y"
  220. inactive-value="N"
  221. active-color="#13ce66"
  222. inactive-color="#a1a3a9">
  223. </el-switch>
  224. </template>
  225. <template v-slot="{ row }">{{ row.isUrgency == 'Y' ? '是' : '否' }}</template>
  226. </ux-table-column>
  227. <ux-table-column resizable title="收货仓库" align="center" field="deliveryWarehouseName" width="200px" edit-render>
  228. <template v-slot:edit="scope">
  229. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.rowIndex, '选择收货仓库')">
  230. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseCangKu(scope.rowIndex, 'WAREHOUSE_PARAM', true, '选择收货仓库', scope.row.puOrg)"></el-button>
  231. </el-input>
  232. </template>
  233. </ux-table-column>
  234. <ux-table-column resizable title="收货货位" align="center" field="deliveryAllocationName" width="200px" edit-render>
  235. <template v-slot:edit="scope">
  236. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clearHang(scope.rowIndex, '选择收货货位')">
  237. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.rowIndex, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
  238. </el-input>
  239. </template>
  240. </ux-table-column>
  241. <ux-table-column resizable title="业务备注" align="center" field="remark" width="150px" edit-render>
  242. <template v-slot:edit="scope">
  243. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.remark"/>
  244. </template>
  245. </ux-table-column>
  246. <ux-table-column resizable title="物料一级分类" align="center" field="materialClassifyOneName" width="100px"/>
  247. <ux-table-column resizable title="物料二级分类" align="center" field="materialClassifyTwoName" width="100px"/>
  248. <ux-table-column resizable title="物料三级分类" align="center" field="materialClassifyThreeName" width="100px"/>
  249. <ux-table-column resizable title="物料四级分类" align="center" field="materialClassifyFourName" width="100px"/>
  250. <ux-table-column resizable title="最小批量" align="center" field="minBatch" width="100px"/>
  251. <ux-table-column resizable title="最小订货量" align="center" field="minOrderQty" width="100px"/>
  252. <ux-table-column resizable title="采购员" align="center" field="buyerName" width="100px"/>
  253. <!-- <ux-table-column resizable title="采购员" align="center" field="buyer"/> -->
  254. <ux-table-column resizable title="采购周期" align="center" field="puPeriod" width="100px"/>
  255. <ux-table-column resizable title="交货日期" align="center" field="deliveryDate" width="230px" edit-render>
  256. <template v-slot:edit="scope">
  257. <el-date-picker
  258. v-model="scope.row.deliveryDate"
  259. :disabled="sonDisable"
  260. clearable
  261. type="date"
  262. size="mini"
  263. value-format="yyyy-MM-dd"
  264. :picker-options="pickerOptionsEnd"
  265. placeholder="选择日期">
  266. </el-date-picker>
  267. </template>
  268. </ux-table-column>
  269. <ux-table-column resizable title="有效期" align="center" field="expiry" width="100px"/>
  270. <ux-table-column resizable title="有效期单位" align="center" field="expiryUnit" width="100px"/>
  271. <!-- <ux-table-column resizable title="安全库存" align="center" field="safeStock" width="100px"/> -->
  272. <ux-table-column resizable title="注册人" align="center" field="registrant" width="100px"/>
  273. <!-- <ux-table-column resizable title="预留比例" align="center" field="reservedProportion" width="120px" edit-render>
  274. <template v-slot:edit="scope">
  275. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @clear="cleanYLSL(scope)">
  276. <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
  277. </el-option>
  278. </el-select>
  279. </template>
  280. </ux-table-column> -->
  281. <ux-table-column resizable title="预留周期" align="center" field="reservedPeriod" width="120px" edit-render>
  282. <template v-slot:edit="scope">
  283. <el-input type="number" min="0" clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
  284. </template>
  285. </ux-table-column>
  286. <ux-table-column resizable title="预留数量" align="center" field="reservedQty" width="120px" edit-render>
  287. <template v-slot:edit="scope">
  288. <el-input type="number" min="0" @input="scope.row.reservedQty=Math.ceil(scope.row.reservedQty)" clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedQty"></el-input>
  289. </template>
  290. </ux-table-column>
  291. <ux-table-column resizable title="集团预测分类" align="center" field="forecastClassify" width="120px"/>
  292. <ux-table-column resizable title="近一月需求" align="center" field="onemonthAvgVolume" width="100px"/>
  293. <ux-table-column resizable title="近三月需求" align="center" field="threemonthAvgVolume" width="100px"/>
  294. <ux-table-column resizable title="采购在途" align="center" field="puFreight" width="100px"/>
  295. <ux-table-column resizable title="补单标识" align="center" field="isReplenishment" width="100px" edit-render>
  296. <template v-slot:edit="scope">
  297. <el-switch
  298. v-model="scope.row.isReplenishment"
  299. disabled
  300. active-value="Y"
  301. inactive-value="N"
  302. active-color="#13ce66"
  303. inactive-color="#a1a3a9">
  304. </el-switch>
  305. </template>
  306. <template v-slot="{ row }">{{ row.isReplenishment == 'Y' ? '是' : '否' }}</template>
  307. </ux-table-column>
  308. <ux-table-column resizable title="补单供应商" align="center" field="additionalSupplierName" width="200px" :render-header="anotherRedStar" edit-render>
  309. <template v-slot:edit="scope">
  310. <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.rowIndex, '选择补单供应商')" @paste.native="pasteMe($event, scope, scope.rowIndex)">
  311. <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.rowIndex, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
  312. </el-input>
  313. </template>
  314. </ux-table-column>
  315. <ux-table-column resizable title="末级供应库存组织" align="center" field="lastStockOrgName" width="180px"></ux-table-column>
  316. <ux-table-column resizable title="末级供应仓库" align="center" field="lastWarehouseName" width="150px"/>
  317. <ux-table-column resizable title="末级供应货位" align="center" field="lastAllocationName" width="150px"/>
  318. <ux-table-column resizable title="中心仓可用量" align="center" field="centralWarehouseQty" width="120px"/>
  319. <ux-table-column resizable title="调拨状态" align="center" field="statusAllot" width="100px" edit-render>
  320. <template v-slot:edit="scope">
  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. </template>
  330. <template v-slot="{ row }">{{ row.statusAllot == 'Y' ? '是' : '否' }}</template>
  331. </ux-table-column>
  332. <ux-table-column resizable title="调拨单号" align="center" field="allotCode"></ux-table-column>
  333. <ux-table-column resizable title="调拨占有量" align="center" field="allotQty" width="100px"/>
  334. <ux-table-column resizable title="最终净需求量" align="center" field="resDemandQty" width="120px"/>
  335. <ux-table-column resizable title="关闭数量" align="center" field="closeQty" width="80px"/>
  336. <ux-table-column resizable title="最终采购执行数量" align="center" field="executeQty" width="150px">
  337. <template v-slot:edit="scope">
  338. {{ scope.row.executeQty ? scope.row.executeQty : 0 }}
  339. </template>
  340. </ux-table-column>
  341. <ux-table-column resizable title="收货地址" align="center" field="deliveryAddressName" width="200px" edit-render>
  342. <template v-slot:edit="scope">
  343. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.rowIndex, '选择收货地址')" @paste.native="pasteMe($event, scope, scope.rowIndex)">
  344. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.rowIndex, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
  345. </el-input>
  346. </template>
  347. </ux-table-column>
  348. <ux-table-column resizable title="联系人" align="center" field="contacts" width="100px"/>
  349. <ux-table-column resizable title="联系人电话" align="center" field="contactsPhone" width="150px"/>
  350. <ux-table-column resizable title="详细地址" align="center" field="address" width="150px"/>
  351. <ux-table-column resizable title="价格类型" align="center" field="priceType" width="120px" edit-render>
  352. <template v-slot:edit="scope">
  353. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.priceType">
  354. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  355. </el-option>
  356. </el-select>
  357. </template>
  358. <template v-slot="{ row }">{{ row.priceType == 'order' ? '订货价' : row.priceType == 'consignment' ? '寄售价' : row.priceType == 'adjusted' ? '调货价' : ''}}</template>
  359. </ux-table-column>
  360. <ux-table-column resizable title="是否客户指定" align="center" field="isCustomerSpecified" width="120px" edit-render>
  361. <template v-slot:edit="scope">
  362. <el-switch
  363. v-model="scope.row.isCustomerSpecified"
  364. disabled
  365. active-value="Y"
  366. inactive-value="N"
  367. active-color="#13ce66"
  368. inactive-color="#a1a3a9">
  369. </el-switch>
  370. </template>
  371. <template v-slot="{ row }">{{ row.isCustomerSpecified == 'Y' ? '是' : '否' }}</template>
  372. </ux-table-column>
  373. <!-- <ux-table-column resizable title="批号锁定标识" align="center" field="isBatchLock" width="100px">
  374. <template v-slot:edit="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. </ux-table-column> -->
  387. <ux-table-column resizable title="采购备注" align="center" field="updateCause" width="100px"/>
  388. <ux-table-column resizable title="可用量" align="center" field="availableQty" width="100px"/>
  389. <ux-table-column
  390. fixed="right"
  391. title="操作"
  392. width="100px"
  393. align="center"
  394. >
  395. <template slot-scope="scope">
  396. <el-button type="text" size="mini" :disabled="sonDisable" @click="delLine(scope.rowIndex, scope.row)">删除</el-button>
  397. </template>
  398. </ux-table-column>
  399. </ux-grid>
  400. </el-form>
  401. <div class="btn_group">
  402. <el-button type="primary" size="mini" @click="jumpOA" v-if="sonPageStu == 'check' && (row.status == '1' || row.status == '2') && basicForm.flowId">流程跳转</el-button>
  403. <el-button type="primary" size="mini" @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
  404. <el-button type="primary" size="mini" @click="editPage" v-if="sonPageStu == 'check' && row.status == '0'">编辑</el-button>
  405. <el-button type="primary" size="mini" @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
  406. <el-button type="primary" size="mini" @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
  407. <el-button size="mini" plain @click="back">返回</el-button>
  408. </div>
  409. </el-card>
  410. <Reserved v-if="dialog.config" :isVisible="dialog.config" :info="row" @updateReserved="updateReserved"/>
  411. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  412. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="false" />
  413. <!-- 批量调整参数 -->
  414. <el-dialog title="批量调整" :visible.sync="adjust.open" @close="closeEvent" width="38%">
  415. <el-row style="margin-bottom: 10px;">
  416. <el-col :span="6" class="pltzTxt">默认采购组织</el-col>
  417. <el-col :span="14">
  418. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.purOrgName" @clear="clearHang(0, 'cgzz')" @focus="chooseOrg('ORG_PARAM', true, '采购组织')">
  419. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ORG_PARAM', true, '采购组织')"></el-button>
  420. </el-input>
  421. </el-col>
  422. </el-row>
  423. <el-row style="margin-bottom: 10px;">
  424. <el-col :span="6" class="pltzTxt">价格类型</el-col>
  425. <el-col :span="14">
  426. <el-select class="pltzIpt" clearable size="mini" v-model="adjust.priceType">
  427. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  428. </el-option>
  429. </el-select>
  430. </el-col>
  431. </el-row>
  432. <el-row style="margin-bottom: 10px;">
  433. <el-col :span="6" class="pltzTxt">采购员</el-col>
  434. <el-col :span="14">
  435. <el-select class="pltzIpt" clearable size="mini" v-model="adjust.purchaseMan" @focus="chooseOrg('CONTACTS_PARAM', true, '采购员')">
  436. <el-option v-for="item in purchaseManOptions" :key="item.id" :label="item.name" :value="item.code" />
  437. </el-select>
  438. </el-col>
  439. </el-row>
  440. <el-row style="margin-bottom: 10px;">
  441. <el-col :span="6" class="pltzTxt">收货仓库</el-col>
  442. <el-col :span="14">
  443. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.warehouseName" @clear="clearHang(0, 'shck')" @focus="adjustCangku('WAREHOUSE_PARAM', true, '收货仓库', adjust.puOrg)">
  444. <el-button size="mini" slot="append" icon="el-icon-more" @click="adjustCangku('WAREHOUSE_PARAM', true, '收货仓库', adjust.puOrg)"></el-button>
  445. </el-input>
  446. </el-col>
  447. </el-row>
  448. <el-row style="margin-bottom: 10px;">
  449. <el-col :span="6" class="pltzTxt">收货货位</el-col>
  450. <el-col :span="14">
  451. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.allocationName" @clear="clearHang(0, 'shhw')" @focus="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)">
  452. <el-button size="mini" slot="append" icon="el-icon-more" @click="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)"></el-button>
  453. </el-input>
  454. </el-col>
  455. </el-row>
  456. <el-row style="margin-bottom: 10px;">
  457. <el-col :span="6" class="pltzTxt">补单供应商</el-col>
  458. <el-col :span="14">
  459. <el-input class="pltzIpt" clearable :disabled="sonDisable || BDZT" size="mini" @clear="clearHang(0, 'bdgys')" v-model="adjust.additionalSupplierName" @focus="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')">
  460. <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')"></el-button>
  461. </el-input>
  462. </el-col>
  463. </el-row>
  464. <el-row style="margin-bottom: 10px;">
  465. <el-col :span="6" class="pltzTxt">业务备注</el-col>
  466. <el-col :span="14">
  467. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.remark"/>
  468. </el-col>
  469. </el-row>
  470. <el-row style="margin-bottom: 10px;">
  471. <el-col :span="6" class="pltzTxt">收货地址</el-col>
  472. <el-col :span="14">
  473. <el-input class="pltzIpt" clearable size="mini" @clear="clearHang(0, 'shdz')" v-model="adjust.deliveryAddressName">
  474. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"></el-button>
  475. </el-input>
  476. </el-col>
  477. </el-row>
  478. <el-row style="margin-bottom: 10px;">
  479. <el-col :span="6" class="pltzTxt">收货地址编码</el-col>
  480. <el-col :span="14">
  481. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.deliveryAddress"/>
  482. </el-col>
  483. </el-row>
  484. <el-row style="margin-bottom: 10px;">
  485. <el-col :span="6" class="pltzTxt">联系人</el-col>
  486. <el-col :span="14">
  487. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.contacts"/>
  488. </el-col>
  489. </el-row>
  490. <el-row style="margin-bottom: 10px;">
  491. <el-col :span="6" class="pltzTxt">联系人电话</el-col>
  492. <el-col :span="14">
  493. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.contactsPhone"/>
  494. </el-col>
  495. </el-row>
  496. <el-row style="margin-bottom: 10px;">
  497. <el-col :span="6" class="pltzTxt">详细地址</el-col>
  498. <el-col :span="14">
  499. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.address"/>
  500. </el-col>
  501. </el-row>
  502. <div slot="footer">
  503. <el-button size="mini" type="primary" @click="confirmAdjust">确 认</el-button>
  504. <el-button size="mini" @click="adjust.open = false">取 消</el-button>
  505. </div>
  506. </el-dialog>
  507. </div>
  508. </template>
  509. <script>
  510. import Reserved from './reserved.vue'
  511. import Refers from '@/components/Refers/refers.vue'
  512. import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan, toOA, confirmSubmit } from '@/api/purchase/purchaseDemand.js'
  513. // 用于回显参照框数据
  514. import {getRefer} from '@/api/purchase/basic.js'
  515. // 明细行选择物料参照
  516. import popDialog from '@/components/PopDialog/index.vue'
  517. import ElTableInfiniteScroll from "el-table-infinite-scroll";
  518. import 'regenerator-runtime/runtime'
  519. export default {
  520. directives: {
  521. "el-table-infinite-scroll": ElTableInfiniteScroll,
  522. },
  523. name: 'addDemandList',
  524. props: ['pageStu','row', 'disable'],
  525. dicts: ['sys_processing_mode', 'sys_plan_type', 'sys_status', 'sys_bill_source', 'sys_business','sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
  526. components: {
  527. Reserved,
  528. Refers,
  529. popDialog
  530. },
  531. model: {
  532. prop: 'isList',
  533. event: 'jugislist'
  534. },
  535. data() {
  536. return {
  537. loading: true,
  538. // 不能直接改变props传来的值
  539. sonPageStu: this.pageStu,
  540. sonDisable: this.disable,
  541. // BDZT是补单供应商是否可以编辑条件
  542. BDZT: true,
  543. dialog: {
  544. config: false
  545. },
  546. basicForm: {
  547. code: '',
  548. org: '',
  549. orgName: '',
  550. demandBusinessType: '1',
  551. status: '0',
  552. customer: '',
  553. customerName: '',
  554. customerCode: '',
  555. customerPrincipal: '',
  556. demandPersonal: '',
  557. demandPersonalName: '',
  558. demandDept: '',
  559. demandDeptName: '',
  560. planType: 'ZJH',
  561. demandDate: '',
  562. source: '4',
  563. isBeyondRap: '',
  564. billType: 'ZQBH',
  565. isCustomerSpecified: 'N',
  566. isProcess: '',
  567. isMonthleyCalculate: '',
  568. createTime: this.parseTime(new Date().getTime()),
  569. remark: '',
  570. puDemandItemList: []
  571. },
  572. delDemandItemList: [],
  573. options: [{
  574. value: 'Y', label: '是',
  575. }, {
  576. value: 'N', label: '否'
  577. }],
  578. basicRules: {},
  579. tableList: [],
  580. referCondition: {
  581. type: '',
  582. isPage: true,
  583. title: '',
  584. },
  585. // referCondition: {
  586. // type: '',
  587. // isPage: true,
  588. // title: '',
  589. // },
  590. tableIndex: null,
  591. ids: [],
  592. orgOptions: [],
  593. manOptions: [],
  594. personOptions: [],
  595. deptOptions: [],
  596. customerOptions: [],
  597. pickerOptionsEnd: {
  598. disabledDate: (time) => {
  599. return time.getTime() < new Date(this.basicForm.demandDate).getTime() - 8.64e7
  600. }
  601. },
  602. isBDXQ: false,
  603. isYl: false,
  604. // 批量调整参数
  605. adjust: {
  606. open: false,
  607. puOrg: '',
  608. purOrgName: '',
  609. priceType: '',
  610. purchaseMan: '',
  611. purchaseManName: '',
  612. warehouse: '',
  613. warehouseName: '',
  614. csFlag: '',
  615. allocation: '',
  616. allocationName: '',
  617. additionalSupplier: '',
  618. additionalSupplierName: '',
  619. remark:'',
  620. deliveryAddress: '',
  621. deliveryAddressName: '',
  622. contacts: '',
  623. contactsPhone: '',
  624. address: ''
  625. },
  626. purchaseManOptions: [],
  627. sonModel: {
  628. rowNo: null,
  629. contacts: null,
  630. id: null,
  631. demandId: null,
  632. status: null,
  633. materialCategory: null,
  634. buyer: null,
  635. buyerName: null,
  636. mateiralClassifyOne: null,
  637. materialClassifyOneName: null,
  638. materialClassifyTwo: null,
  639. materialClassifyTwoName: null,
  640. materialClassifyThree: null,
  641. materialClassifyThreeName: null,
  642. materialClassifyFour: null,
  643. materialClassifyFourName: null,
  644. materialCode: null,
  645. material: null,
  646. materialName: null,
  647. classifyId: null,
  648. specification: null,
  649. unit: null,
  650. unitName: null,
  651. manufacturerName: null,
  652. registrant: null,
  653. puPeriod: null,
  654. expiryUnit: null,
  655. expiry: null,
  656. minPackage: null,
  657. minOrderQty: null,
  658. minBatch: null,
  659. safeStock: null,
  660. averageQtyMonth: null,
  661. qty: null,
  662. adjustmentPersonal: null,
  663. adjustmentTime: null,
  664. manualRegulation: null,
  665. updateCause: null,
  666. reservedProportion: null,
  667. reservedPeriod: null,
  668. reservedQty: null,
  669. demandPeriod: null,
  670. forecastClassify: null,
  671. onemonthAvgVolume: null,
  672. threemonthAvgVolume: null,
  673. puFreight: null,
  674. deliveryDate: null,
  675. isUrgency: 'N',
  676. isReplenishment: 'N',
  677. isBatchLock: 'N',
  678. isCustomerSpecified: '',
  679. remark: null,
  680. puRemark: null,
  681. lastWarehouseQty: null,
  682. resDemandQty: null,
  683. lastWarehouse: null,
  684. lastWarehouseName: null,
  685. deliveryWarehouse: null,
  686. deliveryWarehouseName: null,
  687. lastAllocation: null,
  688. lastAllocationName: null,
  689. deliveryAllocation: null,
  690. deliveryAllocationName: null,
  691. passageOn: null,
  692. puOrg: null,
  693. purOrgName: null,
  694. lastStockQty: null,
  695. superiorCenterQty: null,
  696. superiorAllotQty: null,
  697. availableQty: null,
  698. statusAllot: 'N',
  699. additionalSupplier: null,
  700. additionalSupplierName: null,
  701. periodUnit: null,
  702. demandCustomer: null,
  703. demandCustomerName: null,
  704. lastStockOrg: null,
  705. lastStockOrgName: null,
  706. superiorStockOrg: null,
  707. superiorStockOrgName: null,
  708. allotCode: null,
  709. deliveryAddress: null,
  710. deliveryAddressName: null,
  711. contacts: null,
  712. contactsPhone: null,
  713. address: null,
  714. source: null,
  715. priceType: 'order',
  716. puManagerApprover: null,
  717. puManagerApproverName: null,
  718. processTime: null,
  719. affirmer: null,
  720. tenantId: null,
  721. revision: null,
  722. createBy: null,
  723. createByName: null,
  724. createTime: null,
  725. updateBy: null,
  726. updateByName: null,
  727. updateTime: null,
  728. delFlag: 0,
  729. csFlag: 'N',
  730. // 新增字段
  731. model: null,
  732. storageCondition: null,
  733. transportationCondition: null,
  734. },
  735. // 无限滚动配置
  736. loadDisabled: true,
  737. page: 0,
  738. total: 5,
  739. // 表格校验规则
  740. tableRules: {
  741. materialCode : [{required: true, message: '物料编码必填'}],
  742. qty: [{required: true, message: '实际业务需求量必填'}],
  743. },
  744. }
  745. },
  746. created() {
  747. if(this.pageStu == 'check') {
  748. console.log('数据', this.row)
  749. this.getDetails(this.row)
  750. } else if(this.pageStu == 'edit') {
  751. this.getDetails(this.row)
  752. } else if (this.pageStu == 'add') {
  753. // 新增时判断需求日期
  754. this.dafaultDate()
  755. this.loading = false
  756. this.basicForm.demandPersonal = this.$store.state.user.name
  757. this.basicForm.demandPersonalName = this.$store.state.user.nickName
  758. this.basicForm.demandDept = this.$store.state.user.deptId
  759. this.basicForm.demandDeptName = this.$store.state.user.deptName
  760. if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  761. if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  762. }
  763. },
  764. methods: {
  765. // 默认需求日期根据当天星期几判断
  766. dafaultDate() {
  767. // 获取当前时间
  768. let date = new Date()
  769. //获取当前时间的年份转为字符串
  770. let year = date.getFullYear().toString()
  771. //获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
  772. let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString() //'04'
  773. //获取天,判断是否小于10,如果是在字符串前面拼接'0'
  774. let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString() //'12'
  775. let today = year + '-' + month + '-' + da
  776. console.log('今天日期',today)
  777. let weekDay = date.getDay()
  778. console.log('今天星期几', weekDay)
  779. // 改变需求计划的判断写这里面了
  780. if (this.basicForm.planType == 'JJXQ') {
  781. this.basicForm.demandDate = today
  782. } else {
  783. if (weekDay == 0) {this.basicForm.demandDate = this.getNextDate(today, 2)}
  784. else if (weekDay == 1) {this.basicForm.demandDate = this.getNextDate(today, 1)}
  785. else if (weekDay == 2) {this.basicForm.demandDate = today}
  786. else if (weekDay == 3) {this.basicForm.demandDate = this.getNextDate(today, 6)}
  787. else if (weekDay == 4) {this.basicForm.demandDate = this.getNextDate(today, 5)}
  788. else if (weekDay == 5) {this.basicForm.demandDate = this.getNextDate(today, 4)}
  789. else if (weekDay == 6) {this.basicForm.demandDate = this.getNextDate(today, 3)}
  790. // console.log(this.getNextDate(today, 2))
  791. }
  792. },
  793. // 获取某天日期的下一天,默认为第二天 默认输出格式为yyyy-mm-dd
  794. getNextDate(date, day = 1, format = '{y}-{m}-{d}') {
  795. if (date) {
  796. date = date.match(/\d+/g).join('-'); // 格式为2022年09月19日处理
  797. const nDate = new Date(date);
  798. nDate.setDate(nDate.getDate() + day);
  799. const formatObj = {
  800. y: nDate.getFullYear(),
  801. m: nDate.getMonth() + 1,
  802. d: nDate.getDate(),
  803. };
  804. return format.replace(/{([ymd])+}/g, (result, key) => {
  805. const value = formatObj[key];
  806. return value.toString().padStart(2, '0');
  807. });
  808. } else {
  809. console.log('date格式不正确');
  810. }
  811. },
  812. // 改变需求计划改变需求日期
  813. changeplanType(val) {
  814. this.dafaultDate()
  815. console.log(val)
  816. if (val == 'JJXQ') {
  817. this.basicForm.billType = 'JJXQ'
  818. } else {
  819. if (this.basicForm.billType == 'JJXQ') {
  820. this.basicForm.billType = ''
  821. }
  822. }
  823. if (val == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
  824. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
  825. } else {
  826. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'N'})
  827. }
  828. },
  829. // 无限滚动加载配置
  830. load() {
  831. if (this.loadDisabled) return;
  832. this.page++;
  833. if (this.page <= this.total) {
  834. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.concat(this.basicForm.puDemandItemList);
  835. }
  836. if (this.page === this.total) {
  837. this.loadDisabled = true;
  838. }
  839. },
  840. // 改变单据日期时清空子表的调拨日期
  841. changeDemandDate() {
  842. this.basicForm.puDemandItemList.forEach(item => {
  843. item.deliveryDate = null
  844. })
  845. },
  846. // 更改业务类型调整明细行内补单或紧急标识
  847. changeBillType(val) {
  848. console.log(val)
  849. if (val == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
  850. this.isBDXQ = true
  851. this.BDZT = false
  852. this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
  853. } else {
  854. this.isBDXQ = false
  855. this.BDZT = true
  856. this.basicForm.puDemandItemList.forEach(item => {
  857. item.isReplenishment = 'N'
  858. item.additionalSupplier = null
  859. item.additionalSupplierName = null
  860. })
  861. }
  862. if (val == 'JJXQ') {
  863. this.basicForm.planType = 'JJXQ'
  864. } else {
  865. if (this.basicForm.planType == 'JJXQ') {
  866. this.basicForm.planType = ''
  867. }
  868. }
  869. if (val == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
  870. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
  871. } else {
  872. this.basicForm.puDemandItemList.forEach(item => { item.isUrgency = 'N' })
  873. }
  874. },
  875. // 改变是否客户指定
  876. isCustomer() {
  877. if (this.basicForm.isCustomerSpecified == 'Y' && this.basicForm.puDemandItemList.length != 0) {
  878. this.basicForm.puDemandItemList.forEach(item => {item.isCustomerSpecified = 'Y'})
  879. } else {
  880. this.basicForm.puDemandItemList.forEach(item => {item.isCustomerSpecified = 'N'})
  881. }
  882. },
  883. hangStatus(row) {
  884. switch (row.row.status) {
  885. case '0':
  886. return '需补货'
  887. case '1':
  888. return '待计划确认'
  889. case '2':
  890. return '计划已确认'
  891. case '3':
  892. return '计划已审核'
  893. case '4':
  894. return '行关闭'
  895. case '5':
  896. return '总供应可满足'
  897. }
  898. },
  899. // 清空
  900. cleanYLSL(scope) {
  901. scope.row.reservedQty = ''
  902. scope.row.reservedPeriod = ''
  903. },
  904. copy() {
  905. this.$modal.notifySuccess("复制成功");
  906. this.sonPageStu = 'add'
  907. this.sonDisable = false
  908. // this.getDetails(this.row)
  909. this.basicForm.id = ''
  910. this.basicForm.code = ''
  911. this.basicForm.createBy = ''
  912. this.basicForm.source = '4'
  913. this.basicForm.isCustomerSpecified = 'N'
  914. this.basicForm.flowId = ''
  915. this.basicForm.demandPersonal = this.$store.state.user.name
  916. this.basicForm.demandPersonalName = this.$store.state.user.nickName
  917. this.basicForm.demandDept = this.$store.state.user.deptId
  918. this.basicForm.demandDeptName = this.$store.state.user.deptName
  919. // 复制时判断需求日期
  920. this.dafaultDate()
  921. if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  922. if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  923. this.basicForm.puDemandItemList.forEach(item => {
  924. item.status = ''
  925. item.buyerName = ''
  926. item.buyer = ''
  927. item.reservedProportion = ''
  928. item.reservedPeriod = ''
  929. item.reservedQty = ''
  930. item.averageQtyMonth = ''
  931. item.demandPeriod = ''
  932. item.forecastClassify = ''
  933. item.onemonthAvgVolume = ''
  934. item.threemonthAvgVolume = ''
  935. item.puFreight = ''
  936. item.superiorAllotQty = ''
  937. item.resDemandQty = ''
  938. item.executeQty = ''
  939. item.deliveryWarehouseName = ''
  940. item.deliveryWarehouse = ''
  941. item.deliveryAllocationName = ''
  942. item.deliveryAllocation = ''
  943. item.lastWarehouseName = ''
  944. item.lastAllocationName = ''
  945. item.availableQty = ''
  946. item.lastStockOrgName = ''
  947. item.centralWarehouseQty = ''
  948. item.allotCode = ''
  949. item.allotQty = ''
  950. item.deliveryAddress = ''
  951. item.deliveryAddressName = ''
  952. item.contacts = ''
  953. item.contactsPhone = ''
  954. item.address = ''
  955. item.statusAllot = 'N'
  956. })
  957. },
  958. editPage() {
  959. this.sonPageStu = 'edit'
  960. this.sonDisable = false
  961. },
  962. handleData() {
  963. console.log('222')
  964. // 复制新增把id,需求单号,创建人置为空,子表去掉id
  965. this.basicForm.id = ''
  966. this.basicForm.code = ''
  967. this.basicForm.createBy = ''
  968. this.basicForm.source = '4'
  969. if (this.basicForm.puDemandItemList.length !== 0) {
  970. this.basicForm.puDemandItemList.forEach(item => {
  971. if (item.id) {
  972. delete item.id
  973. }
  974. if (item.demandId) {
  975. delete item.demandId
  976. }
  977. if (item.allotCode) {
  978. delete item.allotCode
  979. }
  980. })
  981. }
  982. },
  983. async save() {
  984. if(this.basicForm.puDemandItemList.length !== 0) {
  985. this.$refs['basic'].validate((valid, obj) => {
  986. if(valid) {
  987. // 加上表格校验
  988. this.$refs.table.fullValidate().then(data=> {
  989. if(!data) {
  990. this.$modal.loading("保存中...");
  991. if(this.sonPageStu == 'add') {
  992. this.handleData()
  993. addDemand(this.basicForm).then(res => {
  994. if (res.code === 200) {
  995. this.$modal.notifySuccess(res.msg);
  996. this.$modal.closeLoading();
  997. this.back()
  998. }
  999. }).catch(err => {
  1000. // 加入定时器防止报错关不掉遮罩
  1001. setTimeout(() => {
  1002. let errorList = JSON.parse(err.message).rowList
  1003. console.log(errorList)
  1004. this.gainRed(errorList)
  1005. }, 500)
  1006. this.$modal.closeLoading();
  1007. })
  1008. } else if (this.sonPageStu == 'edit') {
  1009. let list = []
  1010. list.push(...this.basicForm.puDemandItemList, ...this.delDemandItemList)
  1011. // 深拷贝一下参数对象
  1012. let param = JSON.parse(JSON.stringify(this.basicForm))
  1013. console.log('深拷贝对象',param);
  1014. param.puDemandItemList = list
  1015. // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
  1016. editDemand(param).then(res => {
  1017. if (res.code === 200) {
  1018. this.$modal.notifySuccess(res.msg);
  1019. this.$modal.closeLoading();
  1020. this.back()
  1021. }
  1022. }).catch(err => {
  1023. // 加入定时器防止报错关不掉遮罩
  1024. setTimeout(() => {
  1025. let errorList = JSON.parse(err.message).rowList
  1026. // console.log(errorList)
  1027. this.gainRed(errorList)
  1028. },500)
  1029. this.$modal.closeLoading();
  1030. })
  1031. }
  1032. } else {
  1033. let masStr = ''
  1034. Object.values(data).forEach(errList => {
  1035. console.log('data',data)
  1036. console.log(errList)
  1037. // 将子表下标加入进入标识字段
  1038. this.basicForm.puDemandItemList.forEach((item,index) => {
  1039. item.rightIndex = index
  1040. })
  1041. console.log('所有列表', this.basicForm.puDemandItemList)
  1042. // 将校验未通过的项与整个表格数据进行过滤对比,得出校验通过的数据
  1043. let rightList = this.basicForm.puDemandItemList.filter((item, index) => {
  1044. return errList.find(item2 => {
  1045. return item2.rowIndex !== item.rightIndex
  1046. })
  1047. })
  1048. console.log('xxx',rightList)
  1049. rightList.forEach(items => {
  1050. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`)) {
  1051. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
  1052. }
  1053. })
  1054. errList.forEach(params => {
  1055. let { rowIndex, column, rules } = params
  1056. rules.forEach(rule => {
  1057. masStr += `第 ${rowIndex + 1} 行${rule.message};`
  1058. })
  1059. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${rowIndex+1})`)) {
  1060. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${rowIndex+1})`).style.background = '#f34b4bb8'
  1061. }
  1062. })
  1063. })
  1064. this.$modal.notifyError(masStr);
  1065. }
  1066. })
  1067. } else {
  1068. // 校验加弹窗
  1069. const jiaoyan = []
  1070. for(let key in obj) {
  1071. jiaoyan.push(obj[key][0].message);
  1072. }
  1073. this.$modal.notifyWarning(jiaoyan[0]);
  1074. return false
  1075. }
  1076. })
  1077. } else {
  1078. this.$modal.notifyWarning("明细信息不能为空!");
  1079. }
  1080. },
  1081. // 后端校验标红方法
  1082. gainRed(errList) {
  1083. // 将子表下标加入进入标识字段
  1084. this.basicForm.puDemandItemList.forEach((item,index) => {
  1085. item.rightIndex = index
  1086. })
  1087. console.log('所有列表', this.basicForm.puDemandItemList)
  1088. // 将校验未通过的项与整个表格数据进行过滤对比,得出校验通过的数据
  1089. let rightList = this.basicForm.puDemandItemList.filter((item, index) => {
  1090. return errList.find(item2 => {
  1091. return item2.rowIndex !== item.rightIndex
  1092. })
  1093. })
  1094. console.log('xxx',rightList)
  1095. rightList.forEach(items => {
  1096. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`)) {
  1097. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
  1098. }
  1099. })
  1100. errList.forEach(item => {
  1101. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${item/10})`)) {
  1102. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${item/10})`).style.background = '#f34b4bb8'
  1103. }
  1104. })
  1105. },
  1106. submit() {
  1107. this.$modal.loading("提交中...");
  1108. submitDemand(this.basicForm).then(res => {
  1109. if (res.code === 200) {
  1110. this.$modal.notifySuccess("提交成功");
  1111. this.$modal.closeLoading();
  1112. this.back()
  1113. }
  1114. if (res.code === 233) {
  1115. this.$modal.confirm(res.msg).then(function() {
  1116. // 确认
  1117. }).then(() => {
  1118. confirmSubmit(this.basicForm).then(res => {
  1119. if (res.code === 200) {
  1120. this.$modal.notifySuccess("提交成功");
  1121. this.$modal.closeLoading();
  1122. this.back()
  1123. }
  1124. }).catch(err => {
  1125. this.$modal.closeLoading();
  1126. })
  1127. // 取消
  1128. }).catch(() => {
  1129. this.$modal.closeLoading();
  1130. })
  1131. this.$modal.closeLoading();
  1132. }
  1133. }).catch(err => {
  1134. // 加入定时器防止报错关不掉遮罩
  1135. setTimeout(() => {
  1136. let errorList = JSON.parse(err.message).rowList
  1137. console.log(errorList)
  1138. this.gainRed(errorList)
  1139. }, 500)
  1140. this.$modal.closeLoading();
  1141. })
  1142. },
  1143. // 增行
  1144. addLine() {
  1145. const newLine = {...this.sonModel}
  1146. newLine.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1147. newLine.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1148. newLine.demandCustomer = this.basicForm.customer
  1149. newLine.demandCustomerName = this.basicForm.customerName
  1150. this.basicForm.puDemandItemList.push(newLine)
  1151. // 补单需求状态改变
  1152. if (this.basicForm.billType == 'BDXQ') {
  1153. this.BDZT = false
  1154. } else {
  1155. this.BDZT = true
  1156. }
  1157. },
  1158. delLine(index, row) {
  1159. row.delFlag = '2'
  1160. let delList = []
  1161. delList = this.basicForm.puDemandItemList.filter(item => {
  1162. return item.delFlag == '2'
  1163. })
  1164. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  1165. return item.delFlag == '0'
  1166. })
  1167. this.delDemandItemList.push(...delList)
  1168. console.log('删除的数组',this.delDemandItemList)
  1169. },
  1170. // 批量删除行
  1171. delLines() {
  1172. let delArr = this.$refs.table.getCheckboxRecords()
  1173. if (delArr.length !== 0) {
  1174. delArr.forEach(item => {
  1175. item.delFlag = '2'
  1176. })
  1177. console.log('kk',this.basicForm.puDemandItemList)
  1178. let delList = []
  1179. delList = this.basicForm.puDemandItemList.filter(item => {
  1180. return item.delFlag == '2'
  1181. })
  1182. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  1183. return item.delFlag == '0'
  1184. })
  1185. this.delDemandItemList.push(...delList)
  1186. } else {
  1187. this.$modal.notifyWarning('请至少选择一条明细!')
  1188. }
  1189. },
  1190. back() {
  1191. console.log('打印人员信息看看', this.$store.state)
  1192. this.$emit('jugislist', true)
  1193. this.$emit('refresh')
  1194. },
  1195. // 如果需要回显则调用详情接口
  1196. getDetails(row) {
  1197. getDemandDetail(row.id).then(res => {
  1198. if (res.code === 200) {
  1199. // this.basicForm = res.data
  1200. let reciveForm = res.data
  1201. let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
  1202. getDemandSonDetail(params).then(res => {
  1203. if (res.code === 200) {
  1204. reciveForm.puDemandItemList = res.data
  1205. console.log('reciveForm',reciveForm)
  1206. this.basicForm = reciveForm
  1207. if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
  1208. if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
  1209. if(this.basicForm.customerPrincipal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.customerPrincipal, '客户负责人') }
  1210. if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  1211. if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  1212. // 详情时将收货仓库id赋值给stordocId
  1213. // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
  1214. if(this.basicForm.billType == 'BDXQ') {
  1215. this.BDZT = false
  1216. this.isBDXQ = true
  1217. } else {
  1218. this.BDZT = true
  1219. this.isBDXQ = false
  1220. }
  1221. }
  1222. }).then(() => {
  1223. this.loading = false
  1224. }).catch(err => {
  1225. this.loading = false
  1226. })
  1227. }
  1228. })
  1229. },
  1230. // 单元格标红
  1231. cellClassName({row, column, rowIndex, columnIndex}) {
  1232. if(this.basicForm.isCustomerSpecified == 'N' && column.title == "需求可用周期" && Number(row.demandPeriod) > 1.5 && Number(row.qty) > Number(row.minOrderQty)) {
  1233. return 'success-row';
  1234. }
  1235. },
  1236. handleSelectionChange(selection) {
  1237. this.ids = selection.map(item =>{
  1238. return item.id
  1239. })
  1240. console.log('选中数组', this.ids)
  1241. },
  1242. rowSelect(row) {
  1243. this.$refs.table.toggleRowSelection(row);
  1244. },
  1245. // 点击预留单展示
  1246. showReserved() {
  1247. this.dialog.config = true
  1248. },
  1249. // 修改是否让页面显示与隐藏的事件
  1250. updateReserved (val) {
  1251. this.dialog.config = val
  1252. },
  1253. // 回显参照框
  1254. reBackRefer(type, id, title) {
  1255. getRefer({type: type, id: id}).then(res => {
  1256. if(type == 'ORG_PARAM') {
  1257. this.orgOptions = res.rows
  1258. }
  1259. if (type == 'CUSTOMER_PARAM') {
  1260. this.customerOptions = res.rows
  1261. }
  1262. if (type == 'CONTACTS_PARAM' && title == '需求人员') {
  1263. this.personOptions = res.rows
  1264. }
  1265. if (type == 'CONTACTS_PARAM' && title == '客户负责人') {
  1266. this.manOptions = res.rows
  1267. }
  1268. if (type == 'DEPT_PARAM') {
  1269. this.deptOptions = res.rows
  1270. }
  1271. })
  1272. },
  1273. chooseOrg(type, isPage, title) {
  1274. this.referCondition.type = type
  1275. this.referCondition.isPage = isPage
  1276. this.referCondition.title = title
  1277. this.$refs.refer.init(this.referCondition)
  1278. },
  1279. selectionsToInput(selection) {
  1280. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
  1281. this.orgOptions = selection
  1282. this.basicForm.org = selection[0].id
  1283. this.basicForm.orgName = selection[0].name
  1284. }
  1285. if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  1286. this.customerOptions = selection
  1287. this.basicForm.customer = selection[0].id
  1288. this.basicForm.customerName = selection[0].name
  1289. this.basicForm.customerCode = selection[0].code
  1290. if(this.basicForm.puDemandItemList.length !== 0) {
  1291. this.basicForm.puDemandItemList.forEach(item => {
  1292. item.demandCustomerName = this.basicForm.customerName
  1293. item.demandCustomer = this.basicForm.customer
  1294. item.status = ''
  1295. item.buyerName = ''
  1296. item.buyer = ''
  1297. item.reservedProportion = ''
  1298. item.reservedPeriod = ''
  1299. item.reservedQty = ''
  1300. item.averageQtyMonth = ''
  1301. item.demandPeriod = ''
  1302. item.forecastClassify = ''
  1303. item.onemonthAvgVolume = ''
  1304. item.threemonthAvgVolume = ''
  1305. item.puFreight = ''
  1306. item.superiorAllotQty = ''
  1307. item.resDemandQty = ''
  1308. item.executeQty = ''
  1309. item.deliveryWarehouseName = ''
  1310. item.deliveryWarehouse = ''
  1311. item.deliveryAllocationName = ''
  1312. item.deliveryAllocation = ''
  1313. item.lastWarehouseName = ''
  1314. item.lastAllocationName = ''
  1315. item.availableQty = ''
  1316. item.lastStockOrgName = ''
  1317. item.centralWarehouseQty = ''
  1318. item.allotCode = ''
  1319. item.deliveryAddress = ''
  1320. item.deliveryAddressName = ''
  1321. item.contacts = ''
  1322. item.contactsPhone = ''
  1323. item.address = ''
  1324. })
  1325. }
  1326. }
  1327. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '需求人员') {
  1328. this.personOptions = selection
  1329. this.basicForm.demandPersonal = selection[0].code
  1330. this.basicForm.demandPersonalName = selection[0].name
  1331. }
  1332. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '采购组织') {
  1333. this.adjust.puOrg = selection[0].id
  1334. this.adjust.purOrgName = selection[0].name
  1335. }
  1336. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '采购员') {
  1337. this.purchaseManOptions = selection
  1338. this.adjust.purchaseMan = selection[0].code
  1339. this.adjust.purchaseManName = selection[0].name
  1340. }
  1341. if(this.referCondition.type == 'SUPPLIER_PARAM' && this.referCondition.title == '补单供应商') {
  1342. this.adjust.additionalSupplier = selection[0].id
  1343. this.adjust.additionalSupplierName = selection[0].name
  1344. }
  1345. if(this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '收货仓库') {
  1346. this.adjust.warehouse = selection[0].id
  1347. this.adjust.warehouseName = selection[0].name
  1348. this.adjust.csFlag = selection[0].csFlag
  1349. this.adjust.allocation = ''
  1350. this.adjust.allocationName = ''
  1351. this.adjust.deliveryAddressName = ''
  1352. this.adjust.deliveryAddress = ''
  1353. this.adjust.contacts = ''
  1354. this.adjust.contactsPhone = ''
  1355. this.adjust.address = ''
  1356. // 选择完清空参数里面的组织id
  1357. this.referCondition.pkOrg = ''
  1358. }
  1359. if(this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '收货货位') {
  1360. this.adjust.allocation = selection[0].id
  1361. this.adjust.allocationName = selection[0].name
  1362. }
  1363. if(this.referCondition.type == 'ADDRESS_PARAM' && this.referCondition.title == '收货地址') {
  1364. this.adjust.deliveryAddressName = selection[0].name
  1365. this.adjust.deliveryAddress = selection[0].code
  1366. this.adjust.contacts = selection[0].contactsName
  1367. this.adjust.contactsPhone = selection[0].contactsPhone
  1368. this.adjust.address = selection[0].address
  1369. }
  1370. if(this.referCondition.type == 'DEPT_PARAM') {
  1371. this.deptOptions = selection
  1372. this.basicForm.demandDept = selection[0].id
  1373. this.basicForm.demandDeptName = selection[0].name
  1374. }
  1375. if(this.referCondition.title == '选择收货仓库') {
  1376. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
  1377. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
  1378. this.basicForm.puDemandItemList[this.tableIndex].csFlag = selection[0].csFlag
  1379. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1380. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1381. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  1382. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  1383. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  1384. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  1385. this.basicForm.puDemandItemList[this.tableIndex].address = null
  1386. // 选择完清空参数里面的组织id
  1387. this.referCondition.pkOrg = ''
  1388. }
  1389. if(this.referCondition.title == '选择收货货位') {
  1390. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
  1391. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
  1392. }
  1393. if(this.referCondition.title == '选择补单供应商') {
  1394. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].id
  1395. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
  1396. }
  1397. if(this.referCondition.title == '选择收货地址') {
  1398. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
  1399. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
  1400. this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
  1401. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
  1402. this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
  1403. }
  1404. },
  1405. // 粘贴来的数据
  1406. async pasteMe(e, scope, index) {
  1407. this.$modal.loading("正在处理数据...");
  1408. e.preventDefault() //阻止默认粘贴事件
  1409. let source = e.clipboardData.getData("Text");
  1410. console.log('scope', scope.column.property)
  1411. // 首先对源头进行解析
  1412. let rows = source.split("\r\n"); // 拆成一个数组
  1413. // 数组去除空字符串
  1414. rows = rows.filter(item => {
  1415. return item && item.trim()
  1416. })
  1417. if (rows.length < 100) {
  1418. // 粘贴物料编码
  1419. if(scope.column.property == 'materialCode') {
  1420. await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
  1421. this.$modal.closeLoading();
  1422. if (res.code === 200) {
  1423. let rowList = res.rows
  1424. let newLine = []
  1425. for (let i = 0; i<rowList.length; i++) {
  1426. let line = {...this.sonModel}
  1427. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1428. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1429. line.demandCustomer = this.basicForm.customer
  1430. line.demandCustomerName = this.basicForm.customerName
  1431. line.materialCode = rowList[i].code
  1432. line.material = rowList[i].id
  1433. line.materialName = rowList[i].name
  1434. line.classifyId = rowList[i].classifyId
  1435. line.materialClassifyOneName = rowList[i].oneClass
  1436. line.materialClassifyTwoName = rowList[i].twoClass
  1437. line.materialClassifyThreeName = rowList[i].threeClass
  1438. line.materialClassifyFourName = rowList[i].fourClass
  1439. line.specification = rowList[i].specification
  1440. line.model = rowList[i].model
  1441. line.unit = rowList[i].unitId
  1442. line.unitName = rowList[i].unitIdName
  1443. line.registrant = rowList[i].registrant
  1444. line.manufacturerName = rowList[i].manufacturerIdName
  1445. line.puPeriod = rowList[i].deliveryPeriod
  1446. line.expiry = rowList[i].usefulLife
  1447. line.expiryUnit = rowList[i].expiryUnitIdName
  1448. // line.minPackage = rowList[i].usefulLife
  1449. line.minPackage = rowList[i].minPackQty
  1450. line.minOrderQty = rowList[i].minOrderQty
  1451. line.minBatch = rowList[i].minBatchQty
  1452. line.safeStock = rowList[i].safeStock
  1453. line.purOrgName = rowList[i].purchasingOrganizationName
  1454. line.puOrg = rowList[i].purchasingOrganization
  1455. // 物料存储条件和运输条件
  1456. line.transportationCondition = rowList[i].transportationCondition
  1457. line.storageCondition = rowList[i].storageCondition
  1458. newLine.push(line)
  1459. console.log('临时数组', newLine)
  1460. }
  1461. // 删除指定下标
  1462. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1463. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  1464. }
  1465. }).then(() => {
  1466. this.$refs.table.doLayout()
  1467. }).catch(err => {
  1468. this.$modal.closeLoading();
  1469. })
  1470. // 粘贴实际业务需求量
  1471. }else if(scope.column.property == 'qty') {
  1472. console.log('复制内容:', rows)
  1473. let newLine = []
  1474. if(this.basicForm.puDemandItemList.length <= 1) {
  1475. for (let i = 0; i<rows.length; i++) {
  1476. let line = {...this.sonModel}
  1477. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1478. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1479. line.demandCustomer = this.basicForm.customer
  1480. line.demandCustomerName = this.basicForm.customerName
  1481. line.qty = rows[i]
  1482. newLine.push(line)
  1483. }
  1484. // 删除指定下标
  1485. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1486. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  1487. this.$refs.table.doLayout()
  1488. this.$modal.closeLoading();
  1489. } else {
  1490. for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
  1491. this.basicForm.puDemandItemList[i].qty = rows[j]
  1492. }
  1493. this.$refs.table.doLayout()
  1494. this.$modal.closeLoading();
  1495. }
  1496. // 粘贴补单供应商
  1497. }else if(scope.column.property == 'additionalSupplierName') {
  1498. await getRefer({ type: 'SUPPLIER_PARAM', searchList: rows }).then(res => {
  1499. this.$modal.closeLoading();
  1500. if (res.code === 200) {
  1501. let rowList = res.rows
  1502. let newLine = []
  1503. for (let i = 0; i<rowList.length; i++) {
  1504. let line = {...this.sonModel}
  1505. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1506. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1507. line.demandCustomer = this.basicForm.customer
  1508. line.demandCustomerName = this.basicForm.customerName
  1509. line.additionalSupplier = rowList[i].id
  1510. line.additionalSupplierName = rowList[i].name
  1511. newLine.push(line)
  1512. console.log('临时数组', newLine)
  1513. }
  1514. if(this.basicForm.puDemandItemList.length <= 1) {
  1515. // 删除指定下标
  1516. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1517. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  1518. } else {
  1519. for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
  1520. this.basicForm.puDemandItemList[i].additionalSupplier = newLine[j].additionalSupplier
  1521. this.basicForm.puDemandItemList[i].additionalSupplierName = newLine[j].additionalSupplierName
  1522. }
  1523. this.$refs.table.doLayout()
  1524. this.$modal.closeLoading();
  1525. }
  1526. }
  1527. }).then(() => {
  1528. this.$refs.table.doLayout()
  1529. }).catch(err => {
  1530. this.$modal.closeLoading();
  1531. })
  1532. }else if(scope.column.property == 'deliveryAddressName') {
  1533. await getRefer({ type: 'ADDRESS_PARAM', searchList: rows }).then(res => {
  1534. this.$modal.closeLoading();
  1535. if (res.code === 200) {
  1536. let rowList = res.rows
  1537. let newLine = []
  1538. for (let i = 0; i<rowList.length; i++) {
  1539. let line = {...this.sonModel}
  1540. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1541. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1542. line.demandCustomer = this.basicForm.customer
  1543. line.demandCustomerName = this.basicForm.customerName
  1544. line.deliveryAddressName = rowList[i].name
  1545. line.deliveryAddress = rowList[i].code
  1546. line.contacts = rowList[i].contactsName
  1547. line.contactsPhone = rowList[i].contactsPhone
  1548. line.address = rowList[i].address
  1549. newLine.push(line)
  1550. console.log('临时数组', newLine)
  1551. }
  1552. if(this.basicForm.puDemandItemList.length <= 1) {
  1553. // 删除指定下标
  1554. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1555. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  1556. } else {
  1557. for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
  1558. this.basicForm.puDemandItemList[i].deliveryAddressName = newLine[j].deliveryAddressName
  1559. this.basicForm.puDemandItemList[i].deliveryAddress = newLine[j].deliveryAddress
  1560. this.basicForm.puDemandItemList[i].contacts = newLine[j].contacts
  1561. this.basicForm.puDemandItemList[i].contactsPhone = newLine[j].contactsPhone
  1562. this.basicForm.puDemandItemList[i].address = newLine[j].address
  1563. }
  1564. this.$refs.table.doLayout()
  1565. this.$modal.closeLoading();
  1566. }
  1567. }
  1568. }).then(() => {
  1569. this.$refs.table.doLayout()
  1570. }).catch(err => {
  1571. this.$modal.closeLoading();
  1572. })
  1573. }
  1574. } else {
  1575. this.$modal.notifyWarning("复制长度不能超过100!");
  1576. this.$modal.closeLoading();
  1577. }
  1578. },
  1579. // 明细行选择物料编码带出数据
  1580. chooseMaterial(index) {
  1581. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
  1582. this.tableIndex = index
  1583. // 传0只展示同步NC了的物料
  1584. this.$refs.materialRefer.init(0)
  1585. },
  1586. selectMaterial(selection) {
  1587. console.log('选中的物料', selection)
  1588. if (selection.length <= 1) {
  1589. // 选择新物料时先清空行内其他信息
  1590. this.basicForm.puDemandItemList[this.tableIndex].reservedProportion = null
  1591. this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null
  1592. this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null
  1593. this.basicForm.puDemandItemList[this.tableIndex].qty = null
  1594. this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null
  1595. this.basicForm.puDemandItemList[this.tableIndex].remark = null
  1596. this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null
  1597. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = null
  1598. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = null
  1599. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1600. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1601. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = null
  1602. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = null
  1603. this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null
  1604. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  1605. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  1606. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  1607. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  1608. this.basicForm.puDemandItemList[this.tableIndex].address = null
  1609. this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
  1610. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
  1611. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
  1612. this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null
  1613. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = null
  1614. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOne = null
  1615. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwo = null
  1616. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThree = null
  1617. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFour = null
  1618. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrg = null
  1619. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrgName = null
  1620. this.basicForm.puDemandItemList[this.tableIndex].buyer = null
  1621. this.basicForm.puDemandItemList[this.tableIndex].buyerName = null
  1622. // 通过选择物料查询采购员
  1623. queryMan(selection[0].id).then(res => {
  1624. if(res.code === 200 && res.rows.length !== 0) {
  1625. this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
  1626. this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
  1627. }
  1628. })
  1629. this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
  1630. this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
  1631. this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
  1632. this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
  1633. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
  1634. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
  1635. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
  1636. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
  1637. this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
  1638. this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
  1639. this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
  1640. this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
  1641. this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
  1642. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
  1643. this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
  1644. this.basicForm.puDemandItemList[this.tableIndex].expiry = selection[0].usefulLife
  1645. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
  1646. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  1647. this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
  1648. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
  1649. this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
  1650. this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
  1651. this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
  1652. this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
  1653. // 物料存储条件和运输条件
  1654. this.basicForm.puDemandItemList[this.tableIndex].transportationCondition = selection[0].transportationCondition
  1655. this.basicForm.puDemandItemList[this.tableIndex].storageCondition = selection[0].storageCondition
  1656. // 选中骨科耗材时候的物料,需求客户不必填
  1657. } else {
  1658. console.log('xxxxx', selection)
  1659. let newLine = []
  1660. for (let i = 0;i<selection.length;i++) {
  1661. let line = {...this.sonModel}
  1662. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1663. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1664. line.demandCustomer = this.basicForm.customer
  1665. line.demandCustomerName = this.basicForm.customerName
  1666. // 通过选择物料查询采购员
  1667. queryMan(selection[i].id).then(res => {
  1668. if (res.code === 200 && res.rows.length !== 0) {
  1669. line.buyer = res.rows[0].buyer
  1670. line.buyerName = res.rows[0].buyerName
  1671. }
  1672. })
  1673. line.materialCode = selection[i].code
  1674. line.material = selection[i].id
  1675. line.materialName = selection[i].name
  1676. line.classifyId = selection[i].classifyId
  1677. line.materialClassifyOneName = selection[i].oneClass
  1678. line.materialClassifyTwoName = selection[i].twoClass
  1679. line.materialClassifyThreeName = selection[i].threeClass
  1680. line.materialClassifyFourName = selection[i].fourClass
  1681. line.specification = selection[i].specification
  1682. line.model = selection[i].model
  1683. line.unit = selection[i].unitId
  1684. line.unitName = selection[i].unitIdName
  1685. line.registrant = selection[i].registrant
  1686. line.manufacturerName = selection[i].manufacturerIdName
  1687. line.puPeriod = selection[i].deliveryPeriod
  1688. line.expiry = selection[i].usefulLife
  1689. line.expiryUnit = selection[i].expiryUnitIdName
  1690. // line.minPackage = selection[i].usefulLife
  1691. line.minPackage = selection[i].minPackQty
  1692. line.minOrderQty = selection[i].minOrderQty
  1693. line.minBatch = selection[i].minBatchQty
  1694. line.safeStock = selection[i].safeStock
  1695. line.purOrgName = selection[i].purchasingOrganizationName
  1696. line.puOrg = selection[i].purchasingOrganization
  1697. // 物料存储条件和运输条件
  1698. line.transportationCondition = selection[i].transportationCondition
  1699. line.storageCondition = selection[i].storageCondition
  1700. // this.basicForm.puDemandItemList.push(line)
  1701. newLine.push(line)
  1702. }
  1703. // 删除指定下标
  1704. this.basicForm.puDemandItemList.splice(this.tableIndex,1,...newLine)
  1705. // this.basicForm.puDemandItemList.splice(this.tableIndex,1)
  1706. }
  1707. },
  1708. // 明细行选择参照
  1709. chooseDept(index, type, isPage, title) {
  1710. this.tableIndex = index
  1711. this.referCondition.type = type
  1712. this.referCondition.isPage = isPage
  1713. this.referCondition.title = title
  1714. this.$refs.refer.init(this.referCondition)
  1715. },
  1716. // 明细行选择仓库需要先确认采购组织
  1717. chooseCangKu(index, type, isPage, title, pkOrg) {
  1718. this.tableIndex = index
  1719. this.referCondition.type = type
  1720. this.referCondition.isPage = isPage
  1721. this.referCondition.title = title
  1722. if(pkOrg) {
  1723. this.referCondition.pkOrg = pkOrg
  1724. this.$refs.refer.init(this.referCondition)
  1725. } else {
  1726. this.$modal.notifyWarning("请先确认默认采购组织");
  1727. }
  1728. },
  1729. // 明细行选择货位先确认仓库
  1730. choosehuoWei(index, type, isPage, title, stordocId) {
  1731. this.tableIndex = index
  1732. this.referCondition.type = type
  1733. this.referCondition.isPage = isPage
  1734. this.referCondition.title = title
  1735. // 选择收货货位前先选择收货仓库
  1736. if(stordocId) {
  1737. this.referCondition.stordocId = stordocId
  1738. this.$refs.refer.init(this.referCondition)
  1739. } else {
  1740. this.$modal.notifyWarning("请先选择收货仓库");
  1741. }
  1742. },
  1743. // 明细行清空收货仓库,货位,收货地址档案等
  1744. clearHang(index, title) {
  1745. if (title == '选择收货仓库') {
  1746. this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
  1747. this.basicForm.puDemandItemList[index].deliveryWarehouse = null
  1748. this.basicForm.puDemandItemList[index].csFlag = null
  1749. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1750. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1751. }
  1752. if (title == '选择收货货位') {
  1753. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1754. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1755. }
  1756. if (title == '选择收货地址') {
  1757. this.basicForm.puDemandItemList[index].deliveryAddressName = null
  1758. this.basicForm.puDemandItemList[index].deliveryAddress = null
  1759. this.basicForm.puDemandItemList[index].contacts = null
  1760. this.basicForm.puDemandItemList[index].contactsPhone = null
  1761. this.basicForm.puDemandItemList[index].address = null
  1762. }
  1763. if (title == '选择补单供应商') {
  1764. this.basicForm.puDemandItemList[index].additionalSupplierName = null
  1765. this.basicForm.puDemandItemList[index].additionalSupplier = null
  1766. }
  1767. // 清空批量调整内字段
  1768. if (title == 'cgzz') {
  1769. this.adjust.purOrgName = ''
  1770. this.adjust.puOrg = ''
  1771. this.adjust.warehouse = ''
  1772. this.adjust.warehouseName = ''
  1773. this.adjust.allocation = ''
  1774. this.adjust.allocationName = ''
  1775. }
  1776. if (title == 'shck') {
  1777. this.adjust.warehouse = ''
  1778. this.adjust.warehouseName = ''
  1779. this.adjust.allocation = ''
  1780. this.adjust.allocationName = ''
  1781. this.adjust.csFlag = ''
  1782. }
  1783. if (title == 'shhw') {
  1784. this.adjust.allocation = ''
  1785. this.adjust.allocationName = ''
  1786. }
  1787. if (title == 'bdgys') {
  1788. this.adjust.additionalSupplier = ''
  1789. this.adjust.additionalSupplierName = ''
  1790. }
  1791. if (title == 'shdz') {
  1792. this.adjust.deliveryAddressName = ''
  1793. this.adjust.deliveryAddress = ''
  1794. this.adjust.contacts = ''
  1795. this.adjust.contactsPhone = ''
  1796. this.adjust.address = ''
  1797. }
  1798. },
  1799. // 清除需求客户将明细行内也清空
  1800. cleanCustomer() {
  1801. this.basicForm.customer = ''
  1802. this.basicForm.customerName = ''
  1803. this.basicForm.customerCode = ''
  1804. if (this.basicForm.puDemandItemList.length !== 0) {
  1805. this.basicForm.puDemandItemList.forEach(item => {
  1806. item.demandCustomerName = ''
  1807. item.demandCustomer = ''
  1808. item.status = ''
  1809. item.buyerName = ''
  1810. item.buyer = ''
  1811. item.reservedProportion = ''
  1812. item.reservedPeriod = ''
  1813. item.reservedQty = ''
  1814. item.averageQtyMonth = ''
  1815. item.demandPeriod = ''
  1816. item.forecastClassify = ''
  1817. item.onemonthAvgVolume = ''
  1818. item.threemonthAvgVolume = ''
  1819. item.puFreight = ''
  1820. item.superiorAllotQty = ''
  1821. item.resDemandQty = ''
  1822. item.executeQty = ''
  1823. item.deliveryWarehouseName = ''
  1824. item.deliveryWarehouse = ''
  1825. item.deliveryAllocationName = ''
  1826. item.deliveryAllocation = ''
  1827. item.lastWarehouseName = ''
  1828. item.lastAllocationName = ''
  1829. item.availableQty = ''
  1830. item.lastStockOrgName = ''
  1831. item.centralWarehouseQty = ''
  1832. item.allotCode = ''
  1833. item.deliveryAddress = ''
  1834. item.deliveryAddressName = ''
  1835. item.contacts = ''
  1836. item.contactsPhone = ''
  1837. item.address = ''
  1838. })
  1839. }
  1840. },
  1841. // 批量调整
  1842. adjustPl() {
  1843. if(this.ids.length == 0) {
  1844. this.$modal.notifyWarning('请至少选择一项数据进行操作!')
  1845. } else {
  1846. this.adjust.open = true
  1847. }
  1848. },
  1849. // 批量调整确认
  1850. confirmAdjust() {
  1851. console.log('data', this.adjust)
  1852. if (this.adjust.csFlag == 'N' || this.adjust.csFlag == '' || this.adjust.allocationName) {
  1853. this.basicForm.puDemandItemList.forEach(item => {
  1854. this.ids.some(val => {
  1855. if(val == item.id) {
  1856. if(this.adjust.purchaseMan) {
  1857. item.buyer = this.adjust.purchaseMan
  1858. item.buyerName = this.adjust.purchaseManName
  1859. }
  1860. if(this.adjust.priceType) {
  1861. item.priceType = this.adjust.priceType
  1862. }
  1863. if(this.adjust.additionalSupplierName) {
  1864. item.additionalSupplier = this.adjust.additionalSupplier
  1865. item.additionalSupplierName = this.adjust.additionalSupplierName
  1866. }
  1867. if(this.adjust.purOrgName) {
  1868. item.purOrgName = this.adjust.purOrgName
  1869. item.puOrg = this.adjust.puOrg
  1870. item.deliveryWarehouse = this.adjust.warehouse
  1871. item.deliveryWarehouseName = this.adjust.warehouseName
  1872. item.deliveryAllocation = this.adjust.allocation
  1873. item.deliveryAllocationName = this.adjust.allocationName
  1874. item.deliveryAddressName = this.adjust.deliveryAddressName
  1875. item.deliveryAddress = this.adjust.deliveryAddress
  1876. item.contacts = this.adjust.contacts
  1877. item.contactsPhone = this.adjust.contactsPhone
  1878. item.address = this.adjust.address
  1879. }
  1880. if(this.adjust.warehouseName) {
  1881. item.deliveryWarehouse = this.adjust.warehouse
  1882. item.deliveryWarehouseName = this.adjust.warehouseName
  1883. item.csFlag = this.adjust.csFlag
  1884. item.deliveryAllocation = this.adjust.allocation
  1885. item.deliveryAllocationName = this.adjust.allocationName
  1886. }
  1887. // if(this.adjust.allocationName) {
  1888. // item.deliveryAllocation = this.adjust.allocation
  1889. // item.deliveryAllocationName = this.adjust.allocationName
  1890. // }
  1891. if(this.adjust.remark) {
  1892. item.remark = this.adjust.remark
  1893. }
  1894. if(this.adjust.deliveryAddressName) {
  1895. item.deliveryAddressName = this.adjust.deliveryAddressName
  1896. item.deliveryAddress = this.adjust.deliveryAddress
  1897. item.contacts = this.adjust.contacts
  1898. item.contactsPhone = this.adjust.contactsPhone
  1899. item.address = this.adjust.address
  1900. }
  1901. }
  1902. this.adjust.open = false
  1903. })
  1904. })
  1905. } else {
  1906. this.$modal.notifyWarning('收货仓库存在收货货位,请填写!')
  1907. }
  1908. },
  1909. // 批量调整选择仓库
  1910. adjustCangku(type, isPage, title, pkOrg) {
  1911. this.referCondition.type = type
  1912. this.referCondition.isPage = isPage
  1913. this.referCondition.title = title
  1914. if (pkOrg) {
  1915. this.referCondition.pkOrg = pkOrg
  1916. this.$refs.refer.init(this.referCondition)
  1917. } else {
  1918. this.$modal.notifyWarning("请先选择默认采购组织");
  1919. }
  1920. },
  1921. // 批量调整选择货位
  1922. adjustHuoWei(type, isPage, title, stordocId) {
  1923. this.referCondition.type = type
  1924. this.referCondition.isPage = isPage
  1925. this.referCondition.title = title
  1926. // 选择收货货位前先选择收货仓库
  1927. if (stordocId) {
  1928. this.referCondition.stordocId = stordocId
  1929. this.$refs.refer.init(this.referCondition)
  1930. } else {
  1931. this.$modal.notifyWarning("请先选择收货仓库");
  1932. }
  1933. },
  1934. // 关闭清空批量调整数据
  1935. closeEvent() {
  1936. this.adjust = {
  1937. open: false,
  1938. puOrg: '',
  1939. purOrgName: '',
  1940. priceType: '',
  1941. purchaseMan: '',
  1942. purchaseManName: '',
  1943. warehouse: '',
  1944. warehouseName: '',
  1945. csFlag: '',
  1946. allocation: '',
  1947. allocationName: '',
  1948. additionalSupplier: '',
  1949. additionalSupplierName: '',
  1950. remark: '',
  1951. deliveryAddress: '',
  1952. deliveryAddressName: '',
  1953. contacts: '',
  1954. contactsPhone: '',
  1955. address: ''
  1956. }
  1957. },
  1958. // 必选标识
  1959. addRedStar(h, { column }) {
  1960. return [
  1961. h('span', { style: 'color: #F56C6C' }, '*'),
  1962. h('span', ' ' + column.label)
  1963. ];
  1964. },
  1965. // 表格表头标星
  1966. anotherRedStar(h, { column }) {
  1967. if(this.isBDXQ) {
  1968. return [
  1969. h('span', { style: 'color: #F56C6C' }, '*'),
  1970. h('span', ' ' + column.label)
  1971. ];
  1972. } else {
  1973. return [
  1974. h('span', ' ' + column.label)
  1975. ];
  1976. }
  1977. },
  1978. // 流程跳转
  1979. jumpOA() {
  1980. toOA(this.$store.state.user.name, this.basicForm.flowId).then(res => {
  1981. if(res.code === 200) {
  1982. window.open(res.oaUrl)
  1983. }
  1984. })
  1985. },
  1986. jisuan({columns, data}) {
  1987. // console.log('生效了吗', {columns, data})
  1988. const means = [] // 合计
  1989. columns.forEach((column, columnIndex) => {
  1990. if (columnIndex === 0) {
  1991. means.push('合计')
  1992. } else {
  1993. const values = data.map(item => Number(item[column.property]));
  1994. // 合计
  1995. if (column.property === 'qty') {
  1996. means[columnIndex] = values.reduce((prev, curr) => {
  1997. const value = Number(curr);
  1998. if (!isNaN(value)) {
  1999. return prev + curr;
  2000. } else {
  2001. return prev;
  2002. }
  2003. }, 0);
  2004. // means[columnIndex] += ' 元'
  2005. // 改变了ele的合计方式,扩展了合计场景
  2006. // 你以为就只有上面这样玩吗?错啦,你还可以自定义样式哦
  2007. // means[columnIndex] = '<span style="color: red">' + means[columnIndex] + '元</span>'
  2008. means[columnIndex] = + means[columnIndex]
  2009. } else {
  2010. means[columnIndex] = '';
  2011. }
  2012. }
  2013. })
  2014. // 返回一个二维数组的表尾合计(不要平均值,你就不要在数组中添加)
  2015. return [means]
  2016. }
  2017. }
  2018. }
  2019. </script>
  2020. <style lang="scss" scoped>
  2021. .btn_group {
  2022. // width: 100%;
  2023. // margin: 20px 0;
  2024. display: flex;
  2025. justify-content: space-between;
  2026. position: absolute;
  2027. top: 10px;right: 20px;
  2028. }
  2029. .btn_grooup {
  2030. margin-bottom: 10px;
  2031. display: flex;
  2032. justify-content: space-between;
  2033. }
  2034. .hang {
  2035. margin: auto;
  2036. }
  2037. .hang ::v-deep .el-form-item__content{
  2038. margin-left: 0px !important;
  2039. }
  2040. // .el-table ::v-deep .el-form-item__error{
  2041. // padding-top: 0;
  2042. // top: 70%
  2043. // }
  2044. ::v-deep .elx-body--row .success-row {
  2045. background-color: #ff8a8a!important;
  2046. }
  2047. ::v-deep .uxbeautifyTableClass .elx-table--header-wrapper {
  2048. color: #606266;
  2049. }
  2050. .pltzTxt{
  2051. text-align: right;
  2052. font-size: medium;
  2053. padding-right: 2%;
  2054. }
  2055. .pltzIpt{
  2056. width: 90%;
  2057. }
  2058. </style>