index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <!--采购历史-->
  2. <!--2019年6月23日 19:44:56 by jlx-->
  3. <template>
  4. <div class="pur-dialog">
  5. <WinseaContentModal v-model='dialogFormVisible'
  6. :title="$t('cg.purchaseHistory.history')">
  7. <!-- <ws-dialog :title="$t('cg.purchaseHistory.history')"
  8. :visible.sync="dialogFormVisible"
  9. style="min-width:1000px;"> -->
  10. <!-- 备件start -->
  11. <div v-if="showType == 'parityDetail' || !showType">
  12. <BaseRow>
  13. <BaseCol :span="10"
  14. style="text-align: left;">
  15. {{ $t('cg.cgsparedetail.spName') }}{{$t('common.colon')}}
  16. {{partRow.spName}}
  17. </BaseCol>
  18. <BaseCol :span="5"
  19. style="text-align: left;">
  20. {{ $t('cg.cgsparedetail.spCode') }}{{$t('common.colon')}}
  21. {{ $ph(partRow.spCode)}}
  22. </BaseCol>
  23. <BaseCol :span="6"
  24. style="text-align: left;">
  25. {{ $t('cg.cgsparedetail.specification') }}{{$t('common.colon')}}
  26. {{$ph(partRow.drawNumber)}}
  27. </BaseCol>
  28. <BaseCol :span="3"
  29. style="text-align: left;">
  30. {{ $t('cg.cgsparedetail.measurementUnit') }}{{$t('common.colon')}}
  31. {{$ph(partRow.measurementUnit)}}
  32. </BaseCol>
  33. </BaseRow>
  34. </div>
  35. <!-- 备件end -->
  36. <!-- 物料start -->
  37. <div v-if="showType == 'parityDetailMa'">
  38. <BaseRow>
  39. <BaseCol :span="24"
  40. style="text-align: left;">{{ $t('cg.cgsmadetail.maTypeName') }}{{$t('common.colon')}}{{
  41. deviceRow.spName
  42. }}</BaseCol>
  43. </BaseRow>
  44. </div>
  45. <!-- 物料end -->
  46. <!-- 海图start -->
  47. <div v-if="showType == 'parityDetailMap'">
  48. <BaseRow>
  49. <BaseCol :span="24"
  50. style="text-align: left;">{{ $t('cg.cgsmadetail.maTypeName') }}{{$t('common.colon')}}{{
  51. deviceRow.spName
  52. }}</BaseCol>
  53. </BaseRow>
  54. </div>
  55. <!-- 海图end -->
  56. <ws-normal-table :data="Info"
  57. height="300"
  58. :empty-text="$t('common.empty')"
  59. highlight-current-row>
  60. <ws-table-column type="index"
  61. :label="$t('cg.pSparepart.sparepartList.spId')"
  62. width="50" />
  63. <!--供货商-->
  64. <ws-table-column prop="vendorName"
  65. :label="$t('cg.purchaseHistory.vendorName')"
  66. width="160" />
  67. <!-- 采购数量 -->
  68. <ws-table-column prop="verifyQuantity"
  69. width="120"
  70. :label="$t('cg.purchaseHistory.purchaseQuantity')" />
  71. <!-- 定价 -->
  72. <ws-table-column prop="unitPrice"
  73. width="80"
  74. :label="$t('cg.purchaseHistory.unitPrice')">
  75. <template slot-scope="scope">
  76. <span>{{
  77. scope.row.unitPrice
  78. ? scope.row.unitPrice.toFixed(2)
  79. : scope.row.unitPrice
  80. }}</span>
  81. </template>
  82. </ws-table-column>
  83. <!-- 小计 -->
  84. <ws-table-column prop="subtotal"
  85. width="120"
  86. :label="$t('cg.purchaseHistory.subtotal')">
  87. <template slot-scope="scope">
  88. <span>{{
  89. scope.row.subtotal
  90. ? scope.row.subtotal.toFixed(2)
  91. : scope.row.subtotal
  92. }}</span>
  93. </template>
  94. </ws-table-column>
  95. <!-- 币种 -->
  96. <ws-table-column prop="currencyId"
  97. width="80"
  98. :label="$t('cg.purchaseHistory.currencyType')" />
  99. <!-- 采购单号 -->
  100. <ws-table-column prop="purchaseNo"
  101. :label="$t('cg.purchaseHistory.sparepartNo')" />
  102. <!-- 采购日期 -->
  103. <ws-table-column width="120"
  104. prop="makeDate"
  105. :label="$t('cg.purchaseHistory.purDate')" />
  106. </ws-normal-table>
  107. <!-- 列表-页码 -->
  108. <pagination style="padding-right: 40px;"
  109. v-show="total > 0"
  110. :total="total"
  111. :page.sync="listQuery.currentPage"
  112. :limit.sync="listQuery.pageSize"
  113. @pagination="getlistbyWhere" />
  114. <div slot="footer"
  115. class="dialog-footer">
  116. <ws-button @click="dialogFormVisible = false">{{
  117. $t('tagsView.close')
  118. }}</ws-button>
  119. </div>
  120. </WinseaContentModal>
  121. <!-- </ws-dialog> -->
  122. <!-- 弹出页面-新增修改 -->
  123. </div>
  124. </template>
  125. <script>
  126. import Pagination from '@/components/Pagination'
  127. import { selectHistory, getTypeList } from '@/model/procurement/spare'
  128. import { selectHistoryMa } from '@/model/procurement/material'
  129. import { selectHistoryMap } from '@/model/procurement/map'
  130. export default {
  131. name: 'purHistory',
  132. components: {
  133. Pagination
  134. },
  135. props: ['showType'],
  136. data () {
  137. return {
  138. dialogFormVisible: false,
  139. loading: false,
  140. Info: [],
  141. // 查询总条数
  142. total: 10,
  143. // 查询数据结构
  144. listQuery: {
  145. compId: localStorage.getItem('ws-pf_compId'), // 公司ID
  146. currentPage: 1, // 当前页码
  147. pageSize: 10 // 一页记录数
  148. },
  149. deviceRow: {},
  150. partRow: {},
  151. // 币种
  152. currencyList: null,
  153. language: ''
  154. }
  155. },
  156. created () {
  157. this.language = this.$store.getters.language
  158. },
  159. methods: {
  160. // 数据请求
  161. getlistbyWhere () {
  162. if (this.showType == 'parityDetail' || !this.showType) {
  163. // 备件数据查询
  164. const queryModel = {
  165. compId: this.listQuery.compId, // 公司ID
  166. currentPage: this.listQuery.currentPage, // 当前页码
  167. pageSize: this.listQuery.pageSize, // 一页记录数
  168. spId: this.partRow.spId,
  169. }
  170. selectHistory(queryModel).toPromise().then(() => this.getDateSet)
  171. } else if (this.showType == 'parityDetailMa') {
  172. // 物料数据查询
  173. const queryModel = {
  174. compId: this.listQuery.compId, // 公司ID
  175. currentPage: this.listQuery.currentPage, // 当前页码
  176. pageSize: this.listQuery.pageSize, // 一页记录数
  177. maId: this.partRow.spId,
  178. }
  179. selectHistoryMa(queryModel).toPromise().then(this.getDateSet)
  180. } else if (this.showType == 'parityDetailMap') {
  181. // 海图数据查询
  182. const queryModel = {
  183. compId: this.listQuery.compId, // 公司ID
  184. currentPage: this.listQuery.currentPage, // 当前页码
  185. pageSize: this.listQuery.pageSize, // 一页记录数
  186. mcId: this.partRow.spId,
  187. }
  188. selectHistoryMap(queryModel).toPromise().then(() => this.getDateSet)
  189. }
  190. },
  191. // 请求后设置返回值
  192. getDateSet (succ) {
  193. this.Info = succ.records
  194. this.setTypeList()
  195. this.total = succ.total
  196. this.listQuery.currentPage = succ.current
  197. this.listQuery.pageSize = succ.size
  198. },
  199. // 金额获取
  200. setTypeList () {
  201. getTypeList({
  202. compId: this.listQuery.compId,
  203. constCode: 'CURRENCY'
  204. }).toPromise().then(response => {
  205. this.currencyList = response
  206. for (const k in this.Info) {
  207. this.Info[k].subtotal =
  208. this.Info[k].verifyQuantity * this.Info[k].unitPrice
  209. for (const c in this.currencyList) {
  210. if (this.currencyList[c].parameterKey === this.Info[k].currencyId) {
  211. this.Info[k].currencyId =
  212. this.language === 'en'
  213. ? this.currencyList[c].parameterValueEn
  214. : this.currencyList[c].parameterValue
  215. }
  216. }
  217. }
  218. this.currencyList.reverse()
  219. this.currencyList.reverse()
  220. })
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang="scss" scoped>
  226. .pur-dialog {
  227. ::v-deep .el-dialog {
  228. min-width: 1000px;
  229. }
  230. .el-row {
  231. margin-bottom: 10px;
  232. border: 0px solid red;
  233. }
  234. }
  235. </style>