add.vue 19 KB

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