add.vue 13 KB

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