add.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div id="checkDemandSummary">
  3. <el-card>
  4. <span>采购需求处理详情</span>
  5. <div class="btn_grooup">
  6. <el-button type="primary" size="small" @click="editLine">编辑</el-button>
  7. <el-button type="danger" size="small" v-if="!lineDisable" @click="cancelEdit">取消编辑</el-button>
  8. <el-button type="success" size="small" v-if="!lineDisable" @click="saveLine">保存</el-button>
  9. <el-button type="primary" size="small" @click="closeLine">行关闭</el-button>
  10. <el-button type="primary" size="small">重取批量</el-button>
  11. </div>
  12. <el-table
  13. :data="tableList"
  14. fit
  15. max-height="680"
  16. @selection-change="handleSelectionChange"
  17. >
  18. <el-table-column show-overflow-tooltip type="selection" width="55" />
  19. <el-table-column show-overflow-tooltip label="序号" align="center" type="index"/>
  20. <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo"/>
  21. <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" width="120px" :formatter="hangStatus"/>
  22. <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode"/>
  23. <el-table-column show-overflow-tooltip label="品名" align="center" prop="materialName" width="180"/>
  24. <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification"/>
  25. <el-table-column show-overflow-tooltip label="单位" align="center" prop="unit"/>
  26. <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturer" width="150"/>
  27. <el-table-column show-overflow-tooltip label="末级供应仓库存量" align="center" prop="lastWarehouseQty" width="150"/>
  28. <el-table-column show-overflow-tooltip label="月销量" align="center" prop="totalMonthlySales"/>
  29. <el-table-column show-overflow-tooltip label="采购周期" align="center" prop="buyPeriod"/>
  30. <el-table-column show-overflow-tooltip label="最终净需求量" align="center" prop="resDemandQty" width="150"/>
  31. <el-table-column show-overflow-tooltip label="最终采购量" align="center" prop="puQtyRes" width="150"/>
  32. <el-table-column show-overflow-tooltip label="需求客户" align="center" prop="customerName"/>
  33. <el-table-column show-overflow-tooltip label="最小订货量" align="center" prop="minOrderQty" width="150"/>
  34. <el-table-column show-overflow-tooltip label="最小包装量" align="center" prop="minPackage" width="150"/>
  35. <el-table-column show-overflow-tooltip label="最小批量" align="center" prop="minBatch" width="150"/>
  36. <el-table-column show-overflow-tooltip label="修改人" align="center" prop="updateByName" width="150"/>
  37. <el-table-column show-overflow-tooltip label="修改原因" align="center" prop="updateCause" width="150"/>
  38. <el-table-column show-overflow-tooltip label="业务备注" align="center" prop="remark" width="150"/>
  39. <el-table-column show-overflow-tooltip label="有效期" align="center" prop="expiry" width="150"/>
  40. <el-table-column show-overflow-tooltip label="要求交货日期" align="center" prop="deliveryDate" width="150"/>
  41. <el-table-column show-overflow-tooltip label="紧急标识" align="center" prop="isUrgency">
  42. <template slot-scope="scope">
  43. <el-switch
  44. v-model="scope.row.isUrgency"
  45. :disabled="lineDisable"
  46. active-value="Y"
  47. inactive-value="N"
  48. active-color="#13ce66"
  49. inactive-color="#a1a3a9">
  50. </el-switch>
  51. </template>
  52. </el-table-column>
  53. <el-table-column show-overflow-tooltip label="补单标识" align="center" prop="isReplenishment">
  54. <template slot-scope="scope">
  55. <el-switch
  56. v-model="scope.row.isReplenishment"
  57. :disabled="lineDisable"
  58. active-value="Y"
  59. inactive-value="N"
  60. active-color="#13ce66"
  61. inactive-color="#a1a3a9">
  62. </el-switch>
  63. </template>
  64. </el-table-column>
  65. <el-table-column show-overflow-tooltip label="需求单单号" align="center" prop="code" width="150"/>
  66. <el-table-column show-overflow-tooltip label="供应仓库" align="center" prop="lastWarehouseName" width="150"/>
  67. <el-table-column show-overflow-tooltip label="供应货位" align="center" prop="lastAllocationName" width="150"/>
  68. <el-table-column show-overflow-tooltip label="业务类型" align="center" prop="billType" width="150"/>
  69. <el-table-column show-overflow-tooltip label="行状态" align="center" prop="status" width="150"/>
  70. <el-table-column show-overflow-tooltip label="收货仓库" align="center" prop="deliveryWarehouseName" width="150"/>
  71. <el-table-column show-overflow-tooltip label="收货货位" align="center" prop="deliveryAllocationName" width="150"/>
  72. <el-table-column show-overflow-tooltip label="采购员" align="center" prop="buyerName" width="150"/>
  73. <el-table-column show-overflow-tooltip label="制单人" align="center" prop="billMaker" width="150"/>
  74. <el-table-column show-overflow-tooltip label="审核人员" align="center" prop="approver" width="150"/>
  75. <!-- <el-table-column show-overflow-tooltip label="请购单号" align="center" prop="code"/> -->
  76. <el-table-column show-overflow-tooltip label="品类" align="center" prop="materialCategory" width="150"/>
  77. <el-table-column show-overflow-tooltip label="注册人" align="center" prop="registrant" width="150"/>
  78. <el-table-column show-overflow-tooltip label="集团预测分类" align="center" prop="forecastClassify" width="150"/>
  79. <el-table-column show-overflow-tooltip label="修改时间" align="center" prop="updateTime" width="150"/>
  80. <el-table-column show-overflow-tooltip label="采购员编码" align="center" prop="buyer" width="150"/>
  81. <el-table-column show-overflow-tooltip label="采购组织" align="center" prop="orgName" width="150"/>
  82. <el-table-column show-overflow-tooltip label="有效期单位" align="center" prop="expiryUnit" width="150"/>
  83. <!-- <el-table-column show-overflow-tooltip label="业务部门" align="center" prop="businessDeptName"/> -->
  84. <el-table-column show-overflow-tooltip label="需求部门" align="center" prop="demandDeptName" width="150"/>
  85. <el-table-column show-overflow-tooltip label="批号锁定标识" align="center" prop="isBatchLock" width="150">
  86. <template slot-scope="scope">
  87. <el-switch
  88. v-model="scope.row.isBatchLock"
  89. :disabled="lineDisable"
  90. active-value="Y"
  91. inactive-value="N"
  92. active-color="#13ce66"
  93. inactive-color="#a1a3a9">
  94. </el-switch>
  95. </template>
  96. </el-table-column>
  97. <el-table-column show-overflow-tooltip label="采购需求单审批人" align="center" prop="approveName" width="150"/>
  98. <el-table-column show-overflow-tooltip label="需求单审批时间" align="center" prop="approverFinishTime" width="150"/>
  99. <el-table-column show-overflow-tooltip label="需求单提交时间" align="center" prop="createTime" width="150"/>
  100. <el-table-column show-overflow-tooltip label="需求单提交人" align="center" prop="createByName" width="150"/>
  101. <!-- <el-table-column show-overflow-tooltip label="处理需求时间" align="center" prop="processTime"/> -->
  102. <!-- <el-table-column show-overflow-tooltip label="处理需求人员" align="center" prop="processPersonal"/> -->
  103. <el-table-column show-overflow-tooltip label="处理确认人" align="center" prop="affirmer" width="150"/>
  104. <el-table-column show-overflow-tooltip label="处理确认时间" align="center" prop="affirmerTime" width="150"/>
  105. <!-- <el-table-column show-overflow-tooltip label="转请购时间" align="center" prop="code"/>
  106. <el-table-column show-overflow-tooltip label="转请购人员" align="center" prop="code"/> -->
  107. <el-table-column show-overflow-tooltip label="价格类型" align="center" prop="priceType" width="150" :formatter="priceClass"/>
  108. </el-table>
  109. </el-card>
  110. <div class="btn_group">
  111. <el-col :span="1.5">
  112. <el-button size="small" plain @click="back">返回</el-button>
  113. </el-col>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. import {getSummaryDetail, shutDownSummary, editSummaryMx } from '@/api/purchase/DemandSummary.js'
  119. export default {
  120. name: 'checkDemandSummary',
  121. props: ['pageStu','row', 'disable'],
  122. model: {
  123. prop: 'isList',
  124. event: 'jugislist'
  125. },
  126. data() {
  127. return{
  128. hangStatus(row) {
  129. switch (row.status) {
  130. case '0':
  131. return '需补货'
  132. case '1':
  133. return '待计划确认'
  134. case '2':
  135. return '计划已确认'
  136. case '3':
  137. return '计划已审核'
  138. case '4':
  139. return '行关闭'
  140. case '5':
  141. return '总供应可满足'
  142. }
  143. },
  144. priceClass(row) {
  145. switch (row.priceType) {
  146. case 'order':
  147. return '订货价'
  148. case 'consignment':
  149. return '寄售价'
  150. case 'adjusted':
  151. return '调货价'
  152. }
  153. },
  154. // 不能直接改变props传来的值
  155. sonPageStu: this.pageStu,
  156. sonDisable: this.disable,
  157. tableList: [],
  158. ids: [],
  159. lineDisable: true,
  160. }
  161. },
  162. created() {
  163. if(this.pageStu == 'check') {
  164. console.log('数据', this.row)
  165. this.getDetails(this.row)
  166. } else if(this.pageStu == 'edit') {
  167. this.getDetails(this.row)
  168. }
  169. },
  170. methods: {
  171. handleSelectionChange(selection) {
  172. console.log('选中', selection)
  173. this.ids = selection.map(item => item.demandItemId)
  174. console.log('选中数组', this.ids.join())
  175. },
  176. back() {
  177. this.$emit('jugislist', true)
  178. let queryParams = {
  179. pageNum: 1,
  180. pageSize: 10
  181. }
  182. this.$emit('refresh', queryParams)
  183. },
  184. // 如果需要回显则调用详情接口
  185. getDetails(row) {
  186. getSummaryDetail(row).then(res => {
  187. if (res.code === 200) {
  188. this.tableList = res.data
  189. }
  190. })
  191. },
  192. editLine() {
  193. console.log('sonList`````', this.tableList)
  194. this.lineDisable = false
  195. },
  196. cancelEdit() {
  197. this.lineDisable = true
  198. },
  199. saveLine() {
  200. editSummaryMx(this.tableList).then(res => {
  201. if (res.code === 200) {
  202. this.$modal.msgSuccess("保存成功");
  203. this.lineDisable = true
  204. this.getDetails(this.row)
  205. }
  206. })
  207. },
  208. // 行关闭
  209. closeLine() {
  210. if (this.ids.length == 0) {
  211. this.$modal.msgWarning("请选中至少一条数据");
  212. } else {
  213. let param = this.ids.join()
  214. shutDownSummary(param).then(res => {
  215. if (res.code === 200) {
  216. this.$modal.msgSuccess("操作成功");
  217. this.getDetails(this.row)
  218. }
  219. })
  220. }
  221. },
  222. }
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. .btn_group {
  227. width: 100%;
  228. margin: 20px 0;
  229. display: flex;
  230. justify-content: center;
  231. }
  232. .btn_grooup {
  233. margin-bottom: 10px;
  234. display: flex;
  235. justify-content: flex-end;
  236. }
  237. </style>