plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

270 lines
7.8 KiB

  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  4. <el-form-item :label="'库位编码'">
  5. <el-input v-model="searchData.locationId" clearable style="width: 120px"></el-input>
  6. </el-form-item>
  7. <el-form-item :label="'库位名称'">
  8. <el-input v-model="searchData.locationName" clearable style="width: 210px"></el-input>
  9. </el-form-item>
  10. <el-form-item :label="'仓库'">
  11. <el-input v-model="searchData.warehouseId" clearable style="width: 210px"></el-input>
  12. </el-form-item>
  13. <el-form-item :label="'库位类型'">
  14. <el-select clearable v-model="searchData.locationType" style="width: 120px">
  15. <el-option label="Picking" value="Picking"></el-option>
  16. <el-option label="Arrival" value="Arrival"></el-option>
  17. <el-option label="Floor stock" value="Floor stock"></el-option>
  18. <el-option label="Shipment" value="Shipment"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item :label="' '">
  22. <el-button type="primary" @click="getDataList()">查询</el-button>
  23. <download-excel
  24. :fields="fields()"
  25. :data="exportData"
  26. type="xls"
  27. :name="exportName"
  28. :header="exportHeader"
  29. :footer="exportFooter"
  30. :fetch="createExportData"
  31. :before-generate="startDownload"
  32. :before-finish="finishDownload"
  33. worksheet="导出信息"
  34. class="el-button el-button--primary el-button--medium">
  35. {{ "导出" }}
  36. </download-excel>
  37. </el-form-item>
  38. </el-form>
  39. <el-table
  40. :height="height"
  41. :data="dataList"
  42. border
  43. style="width: 100%;">
  44. <el-table-column
  45. v-for="(item,index) in columnList" :key="index"
  46. :sortable="item.columnSortable"
  47. :prop="item.columnProp"
  48. :header-align="item.headerAlign"
  49. :show-overflow-tooltip="item.showOverflowTooltip"
  50. :align="item.align"
  51. :fixed="item.fixed==''?false:item.fixed"
  52. :min-width="item.columnWidth"
  53. :label="item.columnLabel">
  54. <template slot-scope="scope">
  55. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  56. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <!-- 分页栏 -->
  61. <el-pagination style="margin-top: 0px"
  62. @size-change="sizeChangeHandle"
  63. @current-change="currentChangeHandle"
  64. :current-page="pageIndex"
  65. :page-sizes="[20, 50, 100, 200, 500]"
  66. :page-size="pageSize"
  67. :total="totalPage"
  68. layout="total, sizes, prev, pager, next, jumper">
  69. </el-pagination>
  70. </div>
  71. </template>
  72. <script>
  73. import {
  74. locationInformationSearch, // 库位信息列表查询
  75. } from '@/api/part/partInformation.js'
  76. import Chooselist from '@/views/modules/common/Chooselist'
  77. export default {
  78. components: {
  79. Chooselist
  80. },
  81. watch: {
  82. searchData: {
  83. deep: true,
  84. handler: function (newV, oldV) {
  85. this.searchData.locationId = this.searchData.locationId.toUpperCase()
  86. }
  87. },
  88. },
  89. data () {
  90. return {
  91. // 导出
  92. exportData: [],
  93. exportName: '库位' + this.dayjs().format('YYYYMMDDHHmmss'),
  94. exportHeader: ['库位'],
  95. exportFooter: [],
  96. resultList: [],
  97. // ======== 行高 ========
  98. height: 200,
  99. // ======== 分页 ========
  100. pageIndex: 1,
  101. pageSize: 50,
  102. totalPage: 0,
  103. // 条件查询
  104. searchData: {
  105. site: this.$store.state.user.site,
  106. locationId: '',
  107. locationName: '',
  108. warehouseId: '',
  109. locationType: '',
  110. active: '',
  111. page: 1,
  112. limit: 10
  113. },
  114. // ======== 数据列表 ========
  115. dataList: [],
  116. // 展示列集
  117. columnList: [
  118. {
  119. userId: this.$store.state.user.name,
  120. functionId: 104009,
  121. serialNumber: '104009Table1LocationId',
  122. tableId: "104009Table1",
  123. tableName: "库位信息表",
  124. columnProp: 'locationId',
  125. headerAlign: "center",
  126. align: "left",
  127. columnLabel: '库位编码',
  128. columnHidden: false,
  129. columnImage: false,
  130. columnSortable: false,
  131. sortLv: 0,
  132. status: true,
  133. fixed: '',
  134. columnWidth: 120
  135. },
  136. {
  137. userId: this.$store.state.user.name,
  138. functionId: 104009,
  139. serialNumber: '104009Table1LocationName',
  140. tableId: "104009Table1",
  141. tableName: "库位信息表",
  142. columnProp: 'locationName',
  143. headerAlign: "center",
  144. align: "left",
  145. columnLabel: '库位名称',
  146. columnHidden: false,
  147. columnImage: false,
  148. columnSortable: false,
  149. sortLv: 0,
  150. status: true,
  151. fixed: '',
  152. columnWidth: 200
  153. },
  154. {
  155. userId: this.$store.state.user.name,
  156. functionId: 104009,
  157. serialNumber: '104009Table1WarehouseId',
  158. tableId: "104009Table1",
  159. tableName: "库位信息表",
  160. columnProp: 'warehouseId',
  161. headerAlign: "center",
  162. align: "left",
  163. columnLabel: '仓库编码',
  164. columnHidden: false,
  165. columnImage: false,
  166. columnSortable: false,
  167. sortLv: 0,
  168. status: true,
  169. fixed: '',
  170. columnWidth: 120
  171. },
  172. {
  173. userId: this.$store.state.user.name,
  174. functionId: 104009,
  175. serialNumber: '104009Table1LocationType',
  176. tableId: "104009Table1",
  177. tableName: "库位信息表",
  178. columnProp: 'locationType',
  179. headerAlign: "center",
  180. align: "left",
  181. columnLabel: '库位类型',
  182. columnHidden: false,
  183. columnImage: false,
  184. columnSortable: false,
  185. sortLv: 0,
  186. status: true,
  187. fixed: '',
  188. columnWidth: 100
  189. },
  190. ],
  191. }
  192. },
  193. mounted () {
  194. this.$nextTick(() => {
  195. this.height = window.innerHeight - 170
  196. })
  197. },
  198. created () {
  199. this.getDataList()
  200. },
  201. methods: {
  202. // 每页数
  203. sizeChangeHandle (val) {
  204. this.pageSize = val
  205. this.pageIndex = 1
  206. this.getDataList()
  207. },
  208. // 当前页
  209. currentChangeHandle (val) {
  210. this.pageIndex = val
  211. this.getDataList()
  212. },
  213. // 获取数据列表
  214. getDataList () {
  215. this.searchData.limit = this.pageSize
  216. this.searchData.page = this.pageIndex
  217. locationInformationSearch(this.searchData).then(({data}) => {
  218. if (data.code === 0) {
  219. this.dataList = data.page.list
  220. this.pageIndex = data.page.currPage
  221. this.pageSize = data.page.pageSize
  222. this.totalPage = data.page.totalCount
  223. }
  224. })
  225. },
  226. //导出excel
  227. async createExportData() {
  228. this.searchData.limit = -1
  229. this.searchData.page = 1
  230. await locationInformationSearch(this.searchData).then(({data}) => {
  231. this.exportList= data.page.list
  232. })
  233. return this.exportList
  234. },
  235. startDownload() {},
  236. finishDownload() {},
  237. fields() {
  238. let json = "{"
  239. this.columnList.forEach((item, index) => {
  240. if (index == this.columnList.length - 1) {
  241. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  242. } else {
  243. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  244. }
  245. })
  246. json += "}"
  247. let s = eval("(" + json + ")")
  248. return s
  249. },
  250. // 导出 end
  251. }
  252. }
  253. </script>
  254. <style scoped lang="scss">
  255. /deep/ .customer-tab .el-tabs__content {
  256. padding: 0px !important;
  257. height: 459px;
  258. }
  259. </style>