add.vue 61 KB

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