add.vue 80 KB

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