add.vue 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345
  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 type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.puPeriod"></el-input>
  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 type="number" min="0" clearable :readonly="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
  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 type="number" min="0" readonly size="mini" v-model="scope.row.reservedQty"></el-input>
  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 type="number" min="0" 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 type="number" min="0" 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="additionalSupplierName" width="200px">
  387. <template slot-scope="scope">
  388. <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplierName'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
  389. <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @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.back()
  760. }
  761. })
  762. } else if (this.sonPageStu == 'edit') {
  763. let list = []
  764. list.push(...this.basicForm.puDemandItemList, ...this.delDemandItemList)
  765. // 深拷贝一下参数对象
  766. let param = JSON.parse(JSON.stringify(this.basicForm))
  767. console.log('深拷贝对象',param);
  768. param.puDemandItemList = list
  769. // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
  770. editDemand(param).then(res => {
  771. if (res.code === 200) {
  772. this.$modal.msgSuccess("编辑成功");
  773. this.back()
  774. }
  775. })
  776. }
  777. }
  778. })
  779. } else {
  780. this.$modal.msgWarning("明细信息不能为空!");
  781. }
  782. },
  783. submit() {
  784. this.$modal.loading("提交中...");
  785. submitDemand(this.basicForm).then(res => {
  786. if (res.code === 200) {
  787. this.$modal.msgSuccess("提交成功");
  788. this.$modal.closeLoading();
  789. this.back()
  790. }
  791. }).catch(err => {
  792. this.$modal.closeLoading();
  793. })
  794. },
  795. // 增行
  796. addLine() {
  797. const newLine = {
  798. contacts: null,
  799. id: null,
  800. demandId: null,
  801. status: null,
  802. businessDept: null,
  803. businessDeptName: null,
  804. materialCategory: null,
  805. buyer: null,
  806. buyerName: null,
  807. mateiralClassifyOne: null,
  808. materialClassifyOneName: null,
  809. materialClassifyTwo: null,
  810. materialClassifyTwoName: null,
  811. materialClassifyThree: null,
  812. materialClassifyThreeName: null,
  813. materialClassifyFour: null,
  814. materialClassifyFourName: null,
  815. materialCode: null,
  816. material: null,
  817. materialName: null,
  818. classifyId: null,
  819. specification: null,
  820. unit: null,
  821. unitName: null,
  822. manufacturerName: null,
  823. registrant: null,
  824. puPeriod: null,
  825. expiryUnit: null,
  826. expiry: null,
  827. minPackage: null,
  828. minOrderQty: null,
  829. minBatch: null,
  830. safeStock: null,
  831. averageQtyMonth: null,
  832. qty: null,
  833. adjustmentPersonal: null,
  834. adjustmentTime: null,
  835. manualRegulation: null,
  836. updateCause: null,
  837. reservedProportion: null,
  838. reservedPeriod: null,
  839. reservedQty: null,
  840. demandPeriod: null,
  841. forecastClassify: null,
  842. onemonthAvgVolume: null,
  843. threemonthAvgVolume: null,
  844. deliveryDate: null,
  845. isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
  846. isReplenishment: this.basicForm.billType == 'BDXQ'? 'Y': 'N',
  847. isBatchLock: 'N',
  848. remark: null,
  849. puRemark: null,
  850. lastWarehouseQty: null,
  851. resDemandQty: null,
  852. lastWarehouse: null,
  853. lastWarehouseName: null,
  854. deliveryWarehouse: null,
  855. deliveryWarehouseName: null,
  856. lastAllocation: null,
  857. lastAllocationName: null,
  858. deliveryAllocation: null,
  859. deliveryAllocationName: null,
  860. passageOn: null,
  861. puOrg: null,
  862. purOrgName: null,
  863. lastStockQty: null,
  864. superiorCenterQty: null,
  865. superiorAllotQty: null,
  866. availableQty: null,
  867. statusAllot: 'N',
  868. additionalSupplier: null,
  869. additionalSupplierName: null,
  870. periodUnit: null,
  871. demandCustomer: this.basicForm.customer,
  872. demandCustomerName: this.basicForm.customerName,
  873. businessDept: this.basicForm.demandDept,
  874. businessDeptName: null,
  875. lastStockOrg: null,
  876. lastStockOrgName: null,
  877. superiorStockOrg: null,
  878. superiorStockOrgName: null,
  879. allotCode: null,
  880. deliveryAddress: null,
  881. deliveryAddressName: null,
  882. contacts: null,
  883. contactsPhone: null,
  884. address: null,
  885. source: null,
  886. priceType: 'order',
  887. puManagerApprover: null,
  888. puManagerApproverName: null,
  889. processTime: null,
  890. affirmer: null,
  891. tenantId: null,
  892. revision: null,
  893. createBy: null,
  894. createByName: null,
  895. createTime: null,
  896. updateBy: null,
  897. updateByName: null,
  898. updateTime: null,
  899. delFlag: 0,
  900. // 新增字段
  901. model: null,
  902. storageCondition: null,
  903. transportationCondition: null,
  904. }
  905. this.basicForm.puDemandItemList.push(newLine)
  906. // 补单需求状态改变
  907. if (this.basicForm.billType == 'BDXQ') {
  908. this.BDZT = false
  909. } else {
  910. this.BDZT = true
  911. }
  912. },
  913. delLine(index, row) {
  914. console.log('删除行:', index)
  915. console.log('改变行:', row)
  916. // this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  917. // return item.id !== row.id
  918. // })
  919. row.delFlag = '2'
  920. // this.basicForm.puDemandItemList.splice(index,1)
  921. let delList = []
  922. delList = this.basicForm.puDemandItemList.filter(item => {
  923. return item.delFlag == '2'
  924. })
  925. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  926. return item.delFlag == '0'
  927. })
  928. this.delDemandItemList.push(...delList)
  929. console.log('删除的数组',this.delDemandItemList)
  930. },
  931. back() {
  932. this.$emit('jugislist', true)
  933. // let queryParams = {
  934. // pageNum: 1,
  935. // pageSize: 10
  936. // }
  937. this.$emit('refresh')
  938. },
  939. // 如果需要回显则调用详情接口
  940. getDetails(row) {
  941. getDemandDetail(row.id).then(res => {
  942. if (res.code === 200) {
  943. // this.basicForm = res.data
  944. let reciveForm = res.data
  945. let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
  946. getDemandSonDetail(params).then(res => {
  947. if (res.code === 200) {
  948. reciveForm.puDemandItemList = res.data
  949. console.log('reciveForm',reciveForm)
  950. this.basicForm = reciveForm
  951. if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
  952. if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
  953. if(this.basicForm.customerPrincipal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.customerPrincipal, '客户负责人') }
  954. if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  955. if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  956. // 详情时将收货仓库id赋值给stordocId
  957. // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
  958. if(this.basicForm.billType == 'BDXQ') {
  959. this.BDZT = false
  960. this.isBDXQ = true
  961. } else {
  962. this.BDZT = true
  963. this.isBDXQ = false
  964. }
  965. }
  966. })
  967. }
  968. })
  969. },
  970. handleSelectionChange(selection) {
  971. this.ids = selection.map(item =>{
  972. return item.id
  973. })
  974. console.log('选中数组', this.ids)
  975. },
  976. // 点击预留单展示
  977. showReserved() {
  978. this.dialog.config = true
  979. },
  980. // 修改是否让页面显示与隐藏的事件
  981. updateReserved (val) {
  982. this.dialog.config = val
  983. },
  984. // 回显参照框
  985. reBackRefer(type, id, title) {
  986. getRefer({type: type, id: id}).then(res => {
  987. if(type == 'ORG_PARAM') {
  988. this.orgOptions = res.rows
  989. }
  990. if (type == 'CUSTOMER_PARAM') {
  991. this.customerOptions = res.rows
  992. }
  993. if (type == 'CONTACTS_PARAM' && title == '需求人员') {
  994. this.personOptions = res.rows
  995. }
  996. if (type == 'CONTACTS_PARAM' && title == '客户负责人') {
  997. this.manOptions = res.rows
  998. }
  999. if (type == 'DEPT_PARAM') {
  1000. this.deptOptions = res.rows
  1001. }
  1002. })
  1003. },
  1004. chooseOrg(type, isPage, title) {
  1005. this.referCondition.type = type
  1006. this.referCondition.isPage = isPage
  1007. this.referCondition.title = title
  1008. this.$refs.refer.init(this.referCondition)
  1009. },
  1010. selectionsToInput(selection) {
  1011. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
  1012. this.orgOptions = selection
  1013. this.basicForm.org = selection[0].id
  1014. this.basicForm.orgName = selection[0].name
  1015. }
  1016. if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  1017. this.customerOptions = selection
  1018. this.basicForm.customer = selection[0].id
  1019. this.basicForm.customerName = selection[0].name
  1020. this.basicForm.customerCode = selection[0].code
  1021. if(this.basicForm.puDemandItemList.length !== 0) {
  1022. this.basicForm.puDemandItemList.forEach(item => {
  1023. item.demandCustomerName = this.basicForm.customerName
  1024. item.demandCustomer = this.basicForm.customer
  1025. })
  1026. }
  1027. }
  1028. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '需求人员') {
  1029. this.personOptions = selection
  1030. this.basicForm.demandPersonal = selection[0].code
  1031. }
  1032. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '采购员') {
  1033. this.purchaseManOptions = selection
  1034. this.adjust.purchaseMan = selection[0].code
  1035. this.adjust.purchaseManName = selection[0].name
  1036. }
  1037. if(this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '收货仓库') {
  1038. this.adjust.warehouse = selection[0].id
  1039. this.adjust.warehouseName = selection[0].name
  1040. this.adjust.allocation = ''
  1041. this.adjust.allocationName = ''
  1042. }
  1043. if(this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '收货货位') {
  1044. this.adjust.allocation = selection[0].id
  1045. this.adjust.allocationName = selection[0].name
  1046. }
  1047. if(this.referCondition.type == 'ADDRESS_PARAM' && this.referCondition.title == '收货地址') {
  1048. this.adjust.deliveryAddressName = selection[0].name
  1049. this.adjust.deliveryAddress = selection[0].code
  1050. this.adjust.contacts = selection[0].contactsName
  1051. this.adjust.contactsPhone = selection[0].contactsPhone
  1052. this.adjust.address = selection[0].address
  1053. }
  1054. if(this.referCondition.type == 'DEPT_PARAM') {
  1055. this.deptOptions = selection
  1056. this.basicForm.demandDept = selection[0].id
  1057. }
  1058. // if(this.referCondition.type == 'DEPT_PARAM') {
  1059. // this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].code
  1060. // this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].name
  1061. // }
  1062. if(this.referCondition.title == '选择收货仓库') {
  1063. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
  1064. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
  1065. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1066. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1067. }
  1068. if(this.referCondition.title == '选择收货货位') {
  1069. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
  1070. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
  1071. }
  1072. if(this.referCondition.title == '选择补单供应商') {
  1073. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].id
  1074. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
  1075. }
  1076. if(this.referCondition.title == '选择收货地址') {
  1077. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
  1078. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
  1079. this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
  1080. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
  1081. this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
  1082. }
  1083. },
  1084. // 明细行选择物料编码带出数据
  1085. chooseMaterial(index) {
  1086. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
  1087. this.tableIndex = index
  1088. // 传0只展示同步NC了的物料
  1089. this.$refs.materialRefer.init(0)
  1090. },
  1091. selectMaterial(selection) {
  1092. console.log('选中的物料', selection)
  1093. // 选择新物料时先清空行内其他信息
  1094. this.basicForm.puDemandItemList[this.tableIndex].reservedProportion = null
  1095. this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null
  1096. this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null
  1097. this.basicForm.puDemandItemList[this.tableIndex].qty = null
  1098. this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null
  1099. this.basicForm.puDemandItemList[this.tableIndex].remark = null
  1100. this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null
  1101. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = null
  1102. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = null
  1103. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1104. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1105. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = null
  1106. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = null
  1107. this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null
  1108. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  1109. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  1110. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  1111. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  1112. this.basicForm.puDemandItemList[this.tableIndex].address = null
  1113. this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
  1114. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
  1115. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
  1116. this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null
  1117. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = null
  1118. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOne = null
  1119. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwo = null
  1120. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThree = null
  1121. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFour = null
  1122. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrg = null
  1123. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrgName = null
  1124. // 通过选择物料查询采购员
  1125. queryMan(selection[0].id).then(res => {
  1126. if(res.code === 200 && res.rows.length !== 0) {
  1127. this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
  1128. this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
  1129. }
  1130. })
  1131. this.basicForm.puDemandItemList[this.tableIndex].businessDept = selection[0].businessDepartment
  1132. this.basicForm.puDemandItemList[this.tableIndex].businessDeptName = selection[0].businessDepartmentName
  1133. this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
  1134. this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
  1135. this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
  1136. this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
  1137. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
  1138. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
  1139. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
  1140. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
  1141. this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
  1142. this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
  1143. this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
  1144. this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
  1145. this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
  1146. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
  1147. this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
  1148. this.basicForm.puDemandItemList[this.tableIndex].expiry = selection[0].usefulLife
  1149. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
  1150. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  1151. this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
  1152. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
  1153. this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
  1154. this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
  1155. this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
  1156. this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
  1157. // 物料存储条件和运输条件
  1158. this.basicForm.puDemandItemList[this.tableIndex].transportationCondition = selection[0].transportationCondition
  1159. this.basicForm.puDemandItemList[this.tableIndex].storageCondition = selection[0].storageCondition
  1160. // 选中骨科耗材时候的物料,需求客户不必填
  1161. },
  1162. // 明细行选择业务部门参照带出业务部门数据
  1163. chooseDept(index, type, isPage, title) {
  1164. this.tableIndex = index
  1165. this.referCondition.type = type
  1166. this.referCondition.isPage = isPage
  1167. this.referCondition.title = title
  1168. this.$refs.refer.init(this.referCondition)
  1169. },
  1170. // 明细行选择业务部门参照带出业务部门数据
  1171. choosehuoWei(index, type, isPage, title, stordocId) {
  1172. this.tableIndex = index
  1173. this.referCondition.type = type
  1174. this.referCondition.isPage = isPage
  1175. this.referCondition.title = title
  1176. // 选择收货货位前先选择收货仓库
  1177. if(stordocId) {
  1178. this.referCondition.stordocId = stordocId
  1179. this.$refs.refer.init(this.referCondition)
  1180. } else {
  1181. this.$modal.msgWarning("请先选择收货仓库");
  1182. }
  1183. },
  1184. // 明细行清空收货仓库,货位,收货地址档案等
  1185. clearHang(index, title) {
  1186. if (title == '选择收货仓库') {
  1187. this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
  1188. this.basicForm.puDemandItemList[index].deliveryWarehouse = null
  1189. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1190. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1191. }
  1192. if (title == '选择收货货位') {
  1193. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1194. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1195. }
  1196. if (title == '选择收货地址') {
  1197. this.basicForm.puDemandItemList[index].deliveryAddressName = null
  1198. this.basicForm.puDemandItemList[index].deliveryAddress = null
  1199. this.basicForm.puDemandItemList[index].contacts = null
  1200. this.basicForm.puDemandItemList[index].contactsPhone = null
  1201. this.basicForm.puDemandItemList[index].address = null
  1202. }
  1203. if (title == '选择补单供应商') {
  1204. this.basicForm.puDemandItemList[index].additionalSupplierName = null
  1205. this.basicForm.puDemandItemList[index].additionalSupplier = null
  1206. }
  1207. },
  1208. // 清除需求客户将明细行内也清空
  1209. cleanCustomer() {
  1210. this.basicForm.customer = ''
  1211. this.basicForm.customerName = ''
  1212. this.basicForm.customerCode = ''
  1213. if (this.basicForm.puDemandItemList.length !== 0) {
  1214. this.basicForm.puDemandItemList.forEach(item => {
  1215. item.demandCustomerName = ''
  1216. item.demandCustomer = ''
  1217. })
  1218. }
  1219. },
  1220. // 批量调整
  1221. adjustPl() {
  1222. if(this.ids.length == 0) {
  1223. this.$modal.msgWarning('请至少选择一项数据进行操作!')
  1224. } else {
  1225. this.adjust.open = true
  1226. }
  1227. },
  1228. // 批量调整确认
  1229. confirmAdjust() {
  1230. console.log('data', this.adjust)
  1231. this.basicForm.puDemandItemList.forEach(item => {
  1232. this.ids.some(val => {
  1233. if(val == item.id) {
  1234. if(this.adjust.purchaseMan) {
  1235. item.buyer = this.adjust.purchaseMan
  1236. item.buyerName = this.adjust.purchaseManName
  1237. }
  1238. if(this.adjust.priceType) {
  1239. item.priceType = this.adjust.priceType
  1240. }
  1241. if(this.adjust.warehouseName) {
  1242. item.deliveryWarehouse = this.adjust.warehouse
  1243. item.deliveryWarehouseName = this.adjust.warehouseName
  1244. item.deliveryAllocation = this.adjust.allocation
  1245. item.deliveryAllocationName = this.adjust.allocationName
  1246. }
  1247. // if(this.adjust.allocationName) {
  1248. // item.deliveryAllocation = this.adjust.allocation
  1249. // item.deliveryAllocationName = this.adjust.allocationName
  1250. // }
  1251. if(this.adjust.remark) {
  1252. item.remark = this.adjust.remark
  1253. }
  1254. if(this.adjust.deliveryAddressName) {
  1255. item.deliveryAddressName = this.adjust.deliveryAddressName
  1256. item.deliveryAddress = this.adjust.deliveryAddress
  1257. item.contacts = this.adjust.contacts
  1258. item.contactsPhone = this.adjust.contactsPhone
  1259. item.address = this.adjust.address
  1260. }
  1261. }
  1262. this.adjust.open = false
  1263. })
  1264. })
  1265. },
  1266. // 批量调整选择货位
  1267. adjustHuoWei(type, isPage, title, stordocId) {
  1268. this.referCondition.type = type
  1269. this.referCondition.isPage = isPage
  1270. this.referCondition.title = title
  1271. // 选择收货货位前先选择收货仓库
  1272. if (stordocId) {
  1273. this.referCondition.stordocId = stordocId
  1274. this.$refs.refer.init(this.referCondition)
  1275. } else {
  1276. this.$modal.msgWarning("请先选择收货仓库");
  1277. }
  1278. },
  1279. // 关闭清空批量调整数据
  1280. closeEvent() {
  1281. this.adjust = {
  1282. open: false,
  1283. priceType: '',
  1284. purchaseMan: '',
  1285. purchaseManName: '',
  1286. warehouse: '',
  1287. warehouseName: '',
  1288. allocation: '',
  1289. allocationName: '',
  1290. remark: '',
  1291. deliveryAddress: '',
  1292. deliveryAddressName: '',
  1293. contacts: '',
  1294. contactsPhone: '',
  1295. address: ''
  1296. }
  1297. },
  1298. }
  1299. }
  1300. </script>
  1301. <style lang="scss" scoped>
  1302. .btn_group {
  1303. width: 100%;
  1304. margin: 20px 0;
  1305. display: flex;
  1306. justify-content: center;
  1307. }
  1308. .btn_grooup {
  1309. margin-bottom: 10px;
  1310. display: flex;
  1311. justify-content: flex-end;
  1312. }
  1313. .hang {
  1314. margin: auto;
  1315. }
  1316. .hang ::v-deep .el-form-item__content{
  1317. margin-left: 0px !important;
  1318. }
  1319. </style>