add.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <div id="checkDemandSummary">
  3. <el-card style="position: relative;">
  4. <span>采购需求处理详情</span>
  5. <div class="btn_grooup">
  6. <el-button type="primary" size="mini" @click="editLine">编辑</el-button>
  7. <el-button type="danger" size="mini" v-if="!lineDisable" @click="cancelEdit">取消编辑</el-button>
  8. <el-button type="success" size="mini" v-if="!lineDisable" @click="saveLine">保存</el-button>
  9. <el-button type="primary" size="mini" v-if="lineDisable" @click="closeLine">行关闭</el-button>
  10. <el-button type="primary" size="mini" v-if="lineDisable" @click="reloadBatch">重取批量</el-button>
  11. </div>
  12. <el-table
  13. v-loading="loading"
  14. :data="tableList"
  15. fit
  16. :cell-style="{ borderColor: '#c0c0c0' }"
  17. :header-cell-style="{ borderColor: '#c0c0c0' }"
  18. class="exporttable"
  19. border
  20. highlight-current-row
  21. max-height="580"
  22. style="font-size: 12px;"
  23. @selection-change="handleSelectionChange"
  24. @row-click="rowSelect"
  25. ref="table"
  26. >
  27. <el-table-column show-overflow-tooltip type="selection" fixed="left"/>
  28. <el-table-column show-overflow-tooltip label="默认采购组织" align="center" prop="orgName" width="250px">
  29. <template slot-scope="scope">
  30. <el-input clearable :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.orgName" @clear="clean(scope.row, '默认采购组织')" @focus="chooseMxHW(scope.$index, 'ORG_PARAM', true, '默认采购组织')">
  31. <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ORG_PARAM', true, '默认采购组织')"></el-button>
  32. </el-input>
  33. </template>
  34. </el-table-column>
  35. <el-table-column show-overflow-tooltip label="需求单号" align="center" prop="code" width="100"/>
  36. <!-- <el-table-column show-overflow-tooltip label="序号" align="center" type="index" width="55" fixed="left"/> -->
  37. <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo">
  38. <template slot-scope="scope">
  39. {{ scope.$index + 1 + '0' }}
  40. </template>
  41. </el-table-column>
  42. <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="120"/>
  43. <el-table-column show-overflow-tooltip label="品名" align="center" prop="materialName" width="120"/>
  44. <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification"/>
  45. <el-table-column show-overflow-tooltip label="单位" align="center" prop="unit"/>
  46. <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturerName" width="120"/>
  47. <!-- <el-table-column show-overflow-tooltip label="末级供应仓库存量" align="center" prop="lastWarehouseQty" width="150"/> -->
  48. <el-table-column show-overflow-tooltip label="月销量" align="center" prop="totalMonthlySales"/>
  49. <el-table-column show-overflow-tooltip label="采购周期" align="center" prop="puPeriod"/>
  50. <el-table-column show-overflow-tooltip label="最终净需求量" align="center" prop="resDemandQty" width="100">
  51. <template slot-scope="scope">
  52. {{scope.row.resDemandQty ? parseFloat(scope.row.resDemandQty).toFixed(0) : '0'}}
  53. </template>
  54. </el-table-column>
  55. <el-table-column show-overflow-tooltip label="最终采购量" align="center" prop="puQtyRes" width="120">
  56. <template slot-scope="scope">
  57. <el-input clearable type="number" min="0" size="mini" :disabled="scope.row.status !== '1' || lineDisable" v-model="scope.row.puQtyRes"/>
  58. </template>
  59. </el-table-column>
  60. <el-table-column show-overflow-tooltip label="需求客户" align="center" prop="customerName" width="100"/>
  61. <el-table-column show-overflow-tooltip label="最小订货量" align="center" prop="minOrderQty" width="100">
  62. <template slot-scope="scope">
  63. {{scope.row.minOrderQty ? parseFloat(scope.row.minOrderQty).toFixed(0) : '0'}}
  64. </template>
  65. </el-table-column>
  66. <el-table-column show-overflow-tooltip label="最小包装量" align="center" prop="minPackage" width="100"/>
  67. <el-table-column show-overflow-tooltip label="最小批量" align="center" prop="minBatch" width="100">
  68. <template slot-scope="scope">
  69. {{scope.row.minBatch ? parseFloat(scope.row.minBatch).toFixed(0) : '0'}}
  70. </template>
  71. </el-table-column>
  72. <el-table-column show-overflow-tooltip label="修改人" align="center" prop="updateByName" width="100"/>
  73. <el-table-column show-overflow-tooltip label="修改原因" align="center" prop="updateCause" width="150">
  74. <template slot-scope="scope">
  75. <el-input clearable size="mini" :disabled="scope.row.status !== '1' || lineDisable" v-model="scope.row.updateCause"/>
  76. </template>
  77. </el-table-column>
  78. <el-table-column show-overflow-tooltip label="业务备注" align="center" prop="remark" width="150"/>
  79. <el-table-column show-overflow-tooltip label="有效期" align="center" prop="expiry" width="150"/>
  80. <el-table-column show-overflow-tooltip label="要求交货日期" align="center" prop="deliveryDate" width="120"/>
  81. <el-table-column show-overflow-tooltip label="紧急标识" align="center" prop="isUrgency">
  82. <template slot-scope="scope">
  83. <el-switch
  84. v-model="scope.row.isUrgency"
  85. :disabled="scope.row.status !== '1' || lineDisable"
  86. active-value="Y"
  87. inactive-value="N"
  88. active-color="#13ce66"
  89. inactive-color="#a1a3a9">
  90. </el-switch>
  91. </template>
  92. </el-table-column>
  93. <el-table-column show-overflow-tooltip label="补单标识" align="center" prop="isReplenishment">
  94. <template slot-scope="scope">
  95. <el-switch
  96. v-model="scope.row.isReplenishment"
  97. :disabled="scope.row.status !== '1' || lineDisable"
  98. active-value="Y"
  99. inactive-value="N"
  100. @change="clean(scope.row, '选择补单供应商')"
  101. active-color="#13ce66"
  102. inactive-color="#a1a3a9">
  103. </el-switch>
  104. </template>
  105. </el-table-column>
  106. <el-table-column show-overflow-tooltip label="补单供应商" align="center" prop="additionalSupplierName" width="200px">
  107. <template slot-scope="scope">
  108. <el-input clearable :disabled="scope.row.isReplenishment == 'N' || lineDisable" size="mini" v-model="scope.row.additionalSupplierName" @clear="clean(scope.row, '选择补单供应商')" @focus="chooseMxHW(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
  109. <el-button size="mini" :disabled="scope.row.isReplenishment == 'N' || lineDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
  110. </el-input>
  111. </template>
  112. </el-table-column>
  113. <el-table-column show-overflow-tooltip label="供应仓库" align="center" prop="lastWarehouseName" width="100"/>
  114. <el-table-column show-overflow-tooltip label="供应货位" align="center" prop="lastAllocationName" width="120"/>
  115. <el-table-column show-overflow-tooltip label="业务类型" align="center" prop="billType" width="120" :formatter="formatterBillType"/>
  116. <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" width="100px" :formatter="hangStatus"/>
  117. <el-table-column show-overflow-tooltip label="收货仓库" align="center" prop="deliveryWarehouseName" width="200">
  118. <template slot-scope="scope">
  119. <el-input clearable :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clean(scope.row, '收货仓库')" @focus="chooseMxCK(scope.$index, 'WAREHOUSE_PARAM', true, '收货仓库', scope.row.org)">
  120. <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseMxCK(scope.$index, 'WAREHOUSE_PARAM', true, '收货仓库', scope.row.org)"></el-button>
  121. </el-input>
  122. </template>
  123. </el-table-column>
  124. <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="200">
  125. <template slot-scope="scope">
  126. <el-input clearable :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clean(scope.row, '收货货位')" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '收货货位', scope.row.deliveryWarehouse)">
  127. <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '收货货位', scope.row.deliveryWarehouse)"></el-button>
  128. </el-input>
  129. </template>
  130. </el-table-column>
  131. <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyerName" width="100"/>
  132. <el-table-column show-overflow-tooltip label="制单人" align="center" prop="billMaker" width="100"/>
  133. <el-table-column show-overflow-tooltip label="审核人员" align="center" prop="approver" width="100"/>
  134. <!-- <el-table-column show-overflow-tooltip label="请购单号" align="center" prop="code"/> -->
  135. <el-table-column show-overflow-tooltip label="品类" align="center" prop="materialCategory" width="100"/>
  136. <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant" width="100"/>
  137. <el-table-column show-overflow-tooltip label="集团预测分类" align="center" prop="forecastClassify" width="120"/>
  138. <el-table-column show-overflow-tooltip label="修改时间" align="center" prop="updateTime" width="140"/>
  139. <el-table-column show-overflow-tooltip label="采购员编码" align="center" prop="buyer" width="100"/>
  140. <!-- <el-table-column show-overflow-tooltip label="采购组织" align="center" prop="orgName" width="150"/> -->
  141. <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="expiryUnit" width="100"/>
  142. <!-- <el-table-column show-overflow-tooltip label="业务部门" align="center" prop="businessDeptName"/> -->
  143. <el-table-column show-overflow-tooltip label="需求部门" align="center" prop="demandDeptName" width="150"/>
  144. <el-table-column show-overflow-tooltip label="批号锁定标识" align="center" prop="isBatchLock" width="120">
  145. <template slot-scope="scope">
  146. <el-switch
  147. v-model="scope.row.isBatchLock"
  148. :disabled="scope.row.status !== '1' || lineDisable"
  149. active-value="Y"
  150. inactive-value="N"
  151. active-color="#13ce66"
  152. inactive-color="#a1a3a9">
  153. </el-switch>
  154. </template>
  155. </el-table-column>
  156. <el-table-column show-overflow-tooltip label="采购需求单审批人" align="center" prop="approveName" width="140"/>
  157. <el-table-column show-overflow-tooltip label="需求单审批时间" align="center" prop="approverFinishTime" width="120"/>
  158. <el-table-column show-overflow-tooltip label="需求单提交时间" align="center" prop="createTime" width="120"/>
  159. <el-table-column show-overflow-tooltip label="需求单提交人" align="center" prop="createByName" width="120"/>
  160. <!-- <el-table-column show-overflow-tooltip label="处理需求时间" align="center" prop="processTime"/> -->
  161. <!-- <el-table-column show-overflow-tooltip label="处理需求人员" align="center" prop="processPersonal"/> -->
  162. <el-table-column show-overflow-tooltip label="处理确认人" align="center" prop="affirmerName" width="100"/>
  163. <el-table-column show-overflow-tooltip label="处理确认时间" align="center" prop="affirmerTime" width="120"/>
  164. <!-- <el-table-column show-overflow-tooltip label="转请购时间" align="center" prop="code"/>
  165. <el-table-column show-overflow-tooltip label="转请购人员" align="center" prop="code"/> -->
  166. <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="100" :formatter="priceClass"/>
  167. </el-table>
  168. <div class="btn_group">
  169. <el-col :span="1.5">
  170. <el-button size="mini" plain @click="back" v-if="lineDisable">返回</el-button>
  171. </el-col>
  172. </div>
  173. </el-card>
  174. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  175. </div>
  176. </template>
  177. <script>
  178. import Refers from '@/components/Refers/refers.vue'
  179. import {getSummaryDetail, shutDownSummary, editSummaryMx, reloadBatch } from '@/api/purchase/DemandSummary.js'
  180. export default {
  181. name: 'checkDemandSummary',
  182. components: {
  183. Refers
  184. },
  185. props: ['pageStu','row', 'disable', 'query'],
  186. model: {
  187. prop: 'isList',
  188. event: 'jugislist'
  189. },
  190. data() {
  191. return{
  192. loading: true,
  193. hangStatus(row) {
  194. switch (row.status) {
  195. case '0':
  196. return '需补货'
  197. case '1':
  198. return '待计划确认'
  199. case '2':
  200. return '计划已确认'
  201. case '3':
  202. return '计划已审核'
  203. case '4':
  204. return '行关闭'
  205. case '5':
  206. return '总供应可满足'
  207. }
  208. },
  209. priceClass(row) {
  210. switch (row.priceType) {
  211. case 'order':
  212. return '订货价'
  213. case 'consignment':
  214. return '寄售价'
  215. case 'adjusted':
  216. return '调货价'
  217. }
  218. },
  219. formatterBillType(row) {
  220. switch (row.billType) {
  221. case 'ZQBH':
  222. return '周期备货'
  223. case 'FXXQ':
  224. return '分销需求'
  225. case 'TSXQ':
  226. return '特殊采购需求'
  227. case 'BDXQ':
  228. return '补单需求'
  229. case 'JJXQ':
  230. return '紧急需求单'
  231. case 'XPXQ':
  232. return '新品需求'
  233. case 'HZBM':
  234. return '合作部门需求'
  235. case 'DZBH':
  236. return '大宗备货'
  237. case 'XZCG':
  238. return '行政类采购'
  239. }
  240. },
  241. // 不能直接改变props传来的值
  242. sonPageStu: this.pageStu,
  243. sonDisable: this.disable,
  244. tableList: [],
  245. ids: [],
  246. lineDisable: true,
  247. tableIndex: '',
  248. referCondition: {
  249. type: '',
  250. isPage: true,
  251. title: ''
  252. }
  253. }
  254. },
  255. created() {
  256. if(this.pageStu == 'check') {
  257. console.log('数据', this.row)
  258. let param = JSON.parse(JSON.stringify(this.query))
  259. param.sumFlag = this.row.sumFlag
  260. this.getDetails(param)
  261. }
  262. },
  263. methods: {
  264. handleSelectionChange(selection) {
  265. console.log('选中', selection)
  266. this.ids = selection.map(item => item.demandItemId)
  267. console.log('选中数组', this.ids.join())
  268. },
  269. rowSelect(row) {
  270. this.$refs.table.toggleRowSelection(row);
  271. },
  272. back() {
  273. this.$emit('jugislist', true)
  274. // let queryParams = {
  275. // pageNum: 1,
  276. // pageSize: 10
  277. // }
  278. this.$emit('refresh')
  279. },
  280. // 如果需要回显则调用详情接口
  281. getDetails(row) {
  282. row.demandItemId = this.row.demandItemId
  283. getSummaryDetail(row).then(res => {
  284. if (res.code === 200) {
  285. this.tableList = res.data
  286. }
  287. }).then(() => {
  288. this.loading = false
  289. this.tableList.forEach(item => {
  290. if(item.puQtyRes) {
  291. item.puQtyRes = parseFloat(item.puQtyRes).toFixed(0)
  292. }
  293. })
  294. }).catch(err => {
  295. this.loading = false
  296. })
  297. },
  298. editLine() {
  299. console.log('sonList`````', this.tableList)
  300. this.lineDisable = false
  301. },
  302. cancelEdit() {
  303. this.lineDisable = true
  304. let param = JSON.parse(JSON.stringify(this.query))
  305. param.sumFlag = this.row.sumFlag
  306. this.getDetails(param)
  307. },
  308. saveLine() {
  309. editSummaryMx(this.tableList).then(res => {
  310. if (res.code === 200) {
  311. this.$modal.notifySuccess("保存成功");
  312. this.lineDisable = true
  313. let param = JSON.parse(JSON.stringify(this.query))
  314. param.sumFlag = this.row.sumFlag
  315. this.getDetails(param)
  316. }
  317. })
  318. },
  319. // 行关闭
  320. closeLine() {
  321. if (this.ids.length == 0) {
  322. this.$modal.notifyWarning("请选中至少一条数据");
  323. } else {
  324. this.$modal.confirm('是否确定关闭?').then(function () {
  325. }).then(() => {
  326. let param = this.ids.join()
  327. shutDownSummary(param).then(res => {
  328. if (res.code === 200) {
  329. this.$modal.notifySuccess("操作成功");
  330. let param = JSON.parse(JSON.stringify(this.query))
  331. param.sumFlag = this.row.sumFlag
  332. this.getDetails(param)
  333. }
  334. })
  335. }).catch(() => {})
  336. }
  337. },
  338. // 重取批量
  339. reloadBatch() {
  340. this.$modal.confirm('是否更新明细的最小包装量,最小订货量,最小批量?').then(function () {}).then(() => {
  341. let param = this.tableList.map(item => { return item.demandItemId })
  342. reloadBatch(param).then(res => {
  343. if (res.code === 200) {
  344. this.$modal.notifySuccess("操作成功");
  345. let params = JSON.parse(JSON.stringify(this.query))
  346. params.sumFlag = this.row.sumFlag
  347. params.demandItemId = this.row.demandItemId
  348. this.getDetails(params)
  349. }
  350. })
  351. }).catch(() =>{})
  352. },
  353. // 明细行选择货位
  354. chooseMxHW(index, type, isPage, title, stordocId) {
  355. this.tableIndex = index
  356. this.referCondition.type = type
  357. this.referCondition.isPage = isPage
  358. this.referCondition.title = title
  359. this.referCondition.stordocId = stordocId
  360. this.$refs.refer.init(this.referCondition)
  361. },
  362. // 明细行选择仓库
  363. chooseMxCK(index, type, isPage, title, orgId) {
  364. this.tableIndex = index
  365. this.referCondition.type = type
  366. this.referCondition.isPage = isPage
  367. this.referCondition.title = title
  368. this.referCondition.pkOrg = orgId
  369. this.$refs.refer.init(this.referCondition)
  370. },
  371. selectionsToInput(selection) {
  372. if (this.referCondition.title == '收货货位') {
  373. this.tableList[this.tableIndex].deliveryAllocationName = selection[0].name
  374. this.tableList[this.tableIndex].deliveryAllocation = selection[0].id
  375. }
  376. if (this.referCondition.title == '收货仓库') {
  377. this.tableList[this.tableIndex].deliveryWarehouseName = selection[0].name
  378. this.tableList[this.tableIndex].deliveryWarehouse = selection[0].id
  379. this.tableList[this.tableIndex].deliveryAllocation = ''
  380. this.tableList[this.tableIndex].deliveryAllocationName = ''
  381. }
  382. if (this.referCondition.title == '选择补单供应商') {
  383. this.tableList[this.tableIndex].additionalSupplierName = selection[0].name
  384. this.tableList[this.tableIndex].additionalSupplier = selection[0].id
  385. }
  386. if (this.referCondition.title == '默认采购组织') {
  387. this.tableList[this.tableIndex].org = selection[0].id
  388. this.tableList[this.tableIndex].orgName = selection[0].name
  389. this.tableList[this.tableIndex].deliveryWarehouse = ''
  390. this.tableList[this.tableIndex].deliveryWarehouseName = ''
  391. this.tableList[this.tableIndex].deliveryAllocation = ''
  392. this.tableList[this.tableIndex].deliveryAllocationName = ''
  393. }
  394. },
  395. // 清空选中的货位
  396. clean(row, title) {
  397. if (title == '收货仓库') {
  398. row.deliveryWarehouse = ''
  399. row.deliveryWarehouseName = ''
  400. row.deliveryAllocation = ''
  401. row.deliveryAllocationName = ''
  402. }
  403. if (title == '收货货位') {
  404. row.deliveryAllocation = ''
  405. row.deliveryAllocationName = ''
  406. }
  407. if (title == '选择补单供应商') {
  408. row.additionalSupplier = ''
  409. row.additionalSupplierName = ''
  410. }
  411. if (title == '默认采购组织') {
  412. row.org = ''
  413. row.orgName = ''
  414. row.deliveryWarehouse = ''
  415. row.deliveryWarehouseName = ''
  416. row.deliveryAllocation = ''
  417. row.deliveryAllocationName = ''
  418. }
  419. }
  420. }
  421. }
  422. </script>
  423. <style lang="scss" scoped>
  424. .btn_group {
  425. // width: 100%;
  426. // margin: 20px 0;
  427. display: flex;
  428. // justify-content: center;
  429. position: absolute;
  430. top: 10px;right: 20px;
  431. }
  432. .btn_grooup {
  433. margin-top: 10px;
  434. margin-bottom: 10px;
  435. display: flex;
  436. justify-content: flex-end;
  437. }
  438. ::v-deep .el-table__row > td {
  439. border-right: none;
  440. }
  441. </style>