add.vue 22 KB

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