add.vue 19 KB

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