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.

238 lines
8.2 KiB

  1. <template>
  2. <div class="mod-config yzz">
  3. <!-- 查询表单 - rqrq -->
  4. <el-form :inline="true" label-position="top" class="query-form">
  5. <el-form-item label="工厂编码">
  6. <el-input v-model="queryData.site" style="width: 120px" placeholder="请输入工厂编码"></el-input>
  7. </el-form-item>
  8. <el-form-item label="条码号">
  9. <el-input v-model="queryData.searchSerialNo" style="width: 150px" placeholder="请输入条码号"></el-input>
  10. </el-form-item>
  11. <el-form-item label="操作类型">
  12. <el-select v-model="queryData.searchOperationType" style="width: 140px" clearable placeholder="请选择">
  13. <el-option label="全部" value=""></el-option>
  14. <el-option label="扫入" value="扫入"></el-option>
  15. <el-option label="扫出" value="扫出"></el-option>
  16. <el-option label="调用栈板" value="调用栈板"></el-option>
  17. <el-option label="自动分拣" value="自动分拣"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="操作者">
  21. <el-input v-model="queryData.searchOperator" style="width: 120px" placeholder="请输入操作者"></el-input>
  22. </el-form-item>
  23. <el-form-item label="任务号">
  24. <el-input v-model="queryData.searchTaskNo" style="width: 150px" placeholder="请输入任务号"></el-input>
  25. </el-form-item>
  26. <el-form-item label="开始时间">
  27. <el-date-picker
  28. v-model="queryData.startDate"
  29. type="datetime"
  30. value-format="yyyy-MM-dd HH:mm:ss"
  31. style="width: 160px"
  32. placeholder="请选择开始时间">
  33. </el-date-picker>
  34. </el-form-item>
  35. <el-form-item label="结束时间">
  36. <el-date-picker
  37. v-model="queryData.endDate"
  38. type="datetime"
  39. value-format="yyyy-MM-dd HH:mm:ss"
  40. style="width: 160px"
  41. placeholder="请选择结束时间">
  42. </el-date-picker>
  43. </el-form-item>
  44. <el-form-item label=" ">
  45. <el-button type="primary" @click="searchTable()" class="yzzButtonAn">查询</el-button>
  46. <el-button @click="resetQuery()" class="yzzButtonAn">重置</el-button>
  47. </el-form-item>
  48. </el-form>
  49. <!-- 主表格 - rqrq -->
  50. <el-table
  51. :height="height"
  52. :data="dataList"
  53. border
  54. highlight-current-row
  55. v-loading="dataListLoading"
  56. style="width: 100%;">
  57. <el-table-column prop="id" header-align="center" align="center" min-width="50" label="ID"></el-table-column>
  58. <el-table-column prop="serialNo" header-align="center" align="center" min-width="150" label="条码号" show-overflow-tooltip></el-table-column>
  59. <el-table-column prop="site" header-align="center" align="center" min-width="80" label="站点"></el-table-column>
  60. <el-table-column prop="operationType" header-align="center" align="center" min-width="100" label="操作类型">
  61. <template slot-scope="scope">
  62. <span :style="getOperationTypeStyle(scope.row.operationType)">
  63. {{ scope.row.operationType || '-' }}
  64. </span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="operationReason" header-align="center" align="left" min-width="200" label="操作原因" show-overflow-tooltip></el-table-column>
  68. <el-table-column prop="fieldName" header-align="center" align="center" min-width="120" label="字段名" show-overflow-tooltip></el-table-column>
  69. <el-table-column prop="oldValue" header-align="center" align="center" min-width="100" label="旧值" show-overflow-tooltip></el-table-column>
  70. <el-table-column prop="newValue" header-align="center" align="center" min-width="100" label="新值" show-overflow-tooltip></el-table-column>
  71. <el-table-column prop="operator" header-align="center" align="center" min-width="100" label="操作者"></el-table-column>
  72. <el-table-column prop="operationTime" header-align="center" align="center" min-width="160" label="操作时间">
  73. <template slot-scope="scope">
  74. {{ formatDate(scope.row.operationTime) }}
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="taskNo" header-align="center" align="center" min-width="150" label="关联任务" show-overflow-tooltip></el-table-column>
  78. <el-table-column prop="remark" header-align="center" align="center" min-width="150" label="备注" show-overflow-tooltip></el-table-column>
  79. </el-table>
  80. <!-- 分页 - rqrq -->
  81. <el-pagination
  82. @size-change="sizeChangeHandle"
  83. @current-change="currentChangeHandle"
  84. :current-page="pageIndex"
  85. :page-sizes="[20, 50, 100, 1000]"
  86. :page-size="pageSize"
  87. :total="totalPage"
  88. layout="total, sizes, prev, pager, next, jumper">
  89. </el-pagination>
  90. </div>
  91. </template>
  92. <script>
  93. import { searchHandlingUnitOperationLogList } from "@/api/warehouse/handlingUnitOperationLog.js"
  94. export default {
  95. data() {
  96. return {
  97. // 页面状态 - rqrq
  98. height: 500,
  99. dataListLoading: false,
  100. // 数据列表 - rqrq
  101. dataList: [],
  102. // 查询条件 - rqrq
  103. queryData: {
  104. site: this.$store.state.user.site,
  105. searchSerialNo: '',
  106. searchOperationType: '',
  107. searchOperator: '',
  108. searchTaskNo: '',
  109. startDate: '',
  110. endDate: ''
  111. },
  112. // 分页信息 - rqrq
  113. pageIndex: 1,
  114. pageSize: 20,
  115. totalPage: 0
  116. }
  117. },
  118. mounted() {
  119. this.$nextTick(() => {
  120. this.height = window.innerHeight - 220
  121. })
  122. // 加载初始数据 - rqrq
  123. this.getDataList()
  124. },
  125. methods: {
  126. // 查询表格数据 - rqrq
  127. searchTable() {
  128. this.pageIndex = 1
  129. this.getDataList()
  130. },
  131. // 获取数据列表 - rqrq
  132. getDataList() {
  133. this.dataListLoading = true
  134. const params = {
  135. ...this.queryData,
  136. page: this.pageIndex,
  137. limit: this.pageSize
  138. }
  139. searchHandlingUnitOperationLogList(params).then(({data}) => {
  140. this.dataListLoading = false
  141. if (data && data.code === 0) {
  142. this.dataList = data.page.list || []
  143. this.pageIndex = data.page.currPage
  144. this.totalPage = data.page.totalCount
  145. } else {
  146. this.dataList = []
  147. this.$message.error(data.msg || '查询失败')
  148. }
  149. }).catch(() => {
  150. this.dataListLoading = false
  151. this.dataList = []
  152. this.$message.error('查询失败,请稍后重试')
  153. })
  154. },
  155. // 重置查询条件 - rqrq
  156. resetQuery() {
  157. this.queryData = {
  158. site: this.$store.state.user.site,
  159. searchSerialNo: '',
  160. searchOperationType: '',
  161. searchOperator: '',
  162. searchTaskNo: '',
  163. startDate: '',
  164. endDate: ''
  165. }
  166. this.searchTable()
  167. },
  168. // 每页数变化 - rqrq
  169. sizeChangeHandle(val) {
  170. this.pageSize = val
  171. this.pageIndex = 1
  172. this.getDataList()
  173. },
  174. // 当前页变化 - rqrq
  175. currentChangeHandle(val) {
  176. this.pageIndex = val
  177. this.getDataList()
  178. },
  179. // 获取操作类型样式(加粗+颜色)- rqrq
  180. getOperationTypeStyle(type) {
  181. // 扫入是绿色、扫出是蓝色、调用栈板是蓝色 - rqrq
  182. const colorMap = {
  183. '扫入': '#67C23A', // 绿色
  184. '扫出': '#409EFF', // 蓝色
  185. '调用栈板': '#409EFF', // 蓝色
  186. '自动分拣': '#E6A23C' // 橙色
  187. }
  188. return {
  189. fontWeight: 'bold',
  190. color: colorMap[type] || '#606266' // 默认灰色
  191. }
  192. },
  193. // 格式化日期 - rqrq
  194. formatDate(dateStr) {
  195. if (!dateStr) return ''
  196. const date = new Date(dateStr)
  197. const year = date.getFullYear()
  198. const month = String(date.getMonth() + 1).padStart(2, '0')
  199. const day = String(date.getDate()).padStart(2, '0')
  200. const hours = String(date.getHours()).padStart(2, '0')
  201. const minutes = String(date.getMinutes()).padStart(2, '0')
  202. const seconds = String(date.getSeconds()).padStart(2, '0')
  203. if (hours === '00' && minutes === '00' && seconds === '00') {
  204. return `${year}-${month}-${day}`
  205. }
  206. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  207. }
  208. }
  209. }
  210. </script>
  211. <style scoped>
  212. .query-form {
  213. margin-top: 1px;
  214. margin-left: 0px;
  215. }
  216. </style>