Index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索模块 -->
  4. <div class="filter-container">
  5. <span>
  6. <span>{{$t("machining.searchForm.offset.workpieceName")}}:</span>
  7. <el-input v-model="queryParams.model.workpieceName" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>
  8. </span>
  9. <span style="margin-left: 10px;">
  10. <span>{{$t("machining.searchForm.offset.orderNo")}}:</span>
  11. <el-input v-model="queryParams.model.orderNo" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>
  12. </span>
  13. <span style="margin-left: 10px;">
  14. <span>{{$t("machining.searchForm.offset.workpieceId")}}:</span>
  15. <el-input v-model="queryParams.model.workpieceId" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>
  16. </span>
  17. <span style="margin-left: 10px;">
  18. <span>{{$t("machining.searchForm.offset.createTime")}}:</span>
  19. <!-- <el-input v-model="queryParams.model.createTime" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>-->
  20. <el-date-picker
  21. v-model="queryParams.model.createTime"
  22. type="datetime"
  23. format="yyyy-MM-dd"
  24. value-format="yyyy-MM-dd"
  25. style="width: 20%;"
  26. />
  27. </span>
  28. <span style="margin-left: 10px;">
  29. <el-button plain type="primary" icon="el-icon-search" size="medium" @click="search">
  30. {{ $t("table.search") }}
  31. </el-button>
  32. <el-button plain type="warning" icon="el-icon-refresh" size="medium" @click="reset">
  33. {{ $t("table.reset") }}
  34. </el-button>
  35. </span>
  36. </div>
  37. <!-- 列表数据 -->
  38. <el-table
  39. :key="tableKey"
  40. ref="table"
  41. v-loading="loading"
  42. :data="tableData.records"
  43. border
  44. fit
  45. row-key="id"
  46. style="width: 100%;margin-top:50px;"
  47. >
  48. <!-- 序号 -->
  49. <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
  50. <!-- 序号 -->
  51. <el-table-column :label='$t("common.serialNo")' width="55px" align="center">
  52. <template slot-scope="scope">
  53. <div>
  54. {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
  55. </div>
  56. </template>
  57. </el-table-column>
  58. <!-- 订单编号 -->
  59. <el-table-column prop="orderNo" :label='$t("machining.table.qualityResult.orderNo")' :show-overflow-tooltip="true"></el-table-column>
  60. <!-- '零件名称 -->
  61. <el-table-column prop="workpieceName" :label='$t("machining.table.qualityResult.workpieceName")' :show-overflow-tooltip="true"></el-table-column>
  62. <!-- 零件编号 -->
  63. <el-table-column prop="uniqueCode" :label='$t("machining.table.qualityResult.uniqueCode")' :show-overflow-tooltip="true"></el-table-column>
  64. <!-- 工序名称 -->
  65. <el-table-column prop="procedureName" :label='$t("machining.table.qualityResult.procedureName")' :show-overflow-tooltip="true"></el-table-column>
  66. <!-- X -->
  67. <el-table-column prop="okFlag" :label='$t("machining.table.qualityResult.okFlag")' :show-overflow-tooltip="true"></el-table-column>
  68. <!-- Y -->
  69. <el-table-column prop="measuringReport" :label='$t("machining.table.qualityResult.measuringReport")' :show-overflow-tooltip="true"></el-table-column>
  70. <!-- 所属计划 -->
  71. <el-table-column prop="createTime" :label='$t("machining.table.qualityResult.createTime")' :show-overflow-tooltip="true"></el-table-column>
  72. <!-- 操作 -->
  73. <el-table-column
  74. :label="$t('table.operation')"
  75. fixed="right"
  76. align="center"
  77. column-key="operation"
  78. width="80px"
  79. >
  80. <template slot-scope="{ row }">
  81. <el-tooltip class="item" :content="$t('machining.common.downloadReport')" effect="dark" placement="top-start">
  82. <i
  83. class="el-icon-view table-operation"
  84. style="color: #87d068"
  85. @click ="downloadReport(row)"
  86. />
  87. </el-tooltip>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <pagination
  92. v-show="tableData.total > 0"
  93. :limit.sync="queryParams.size"
  94. :page.sync="queryParams.current"
  95. :total="Number(tableData.total)"
  96. @pagination="fetch"
  97. />
  98. </div>
  99. </template>
  100. <script>
  101. // 【分页】组件
  102. import Pagination from "@/components/Pagination"
  103. // 【不合格产品管理】-API
  104. import measuringOffsetMgrApi from "@/api/machiningClient/measuringOffsetMgr"
  105. // 共通函数
  106. import { downloadFile, initQueryParams } from '@/utils/commons'
  107. export default {
  108. name: "measuringOffsetMgr",
  109. directives: { },
  110. components: { Pagination },
  111. props: {
  112. },
  113. data () {
  114. return {
  115. tableKey: 0,
  116. queryParams: initQueryParams({
  117. }),
  118. selection: [],
  119. loading: false,
  120. tableData: {
  121. total: 0
  122. }
  123. }
  124. },
  125. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  126. created() {
  127. // 加载列表数据
  128. this.fetch()
  129. },
  130. computed: {
  131. currentUser () {
  132. return this.$store.state.account.user
  133. }
  134. },
  135. mounted () {
  136. },
  137. methods: {
  138. search () {
  139. this.fetch({
  140. ...this.queryParams
  141. })
  142. },
  143. reset () {
  144. this.queryParams = initQueryParams({})
  145. this.$refs.table.clearSort()
  146. this.$refs.table.clearFilter()
  147. this.search()
  148. },
  149. downloadReport (row) {
  150. this.queryParams.id = row.workpieceId
  151. measuringOffsetMgrApi.download(this.queryParams).then(response => {
  152. downloadFile(response)
  153. })
  154. },
  155. fetch (params = {}) {
  156. this.loading = true
  157. this.queryParams.current = params.current ? params.current : this.queryParams.current
  158. this.queryParams.size = params.size ? params.size : this.queryParams.size
  159. console.log(this.queryParams.model.workpieceName)
  160. measuringOffsetMgrApi.getList(this.queryParams).then(response => {
  161. const res = response.data
  162. if (res.isSuccess) {
  163. this.tableData = res.data
  164. }
  165. }).finally(() => this.loading = false)
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped></style>