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.

254 lines
10 KiB

​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <template>
  2. <div class="mod-config yzz">
  3. <el-form :inline="true" label-position="top" class="query-form">
  4. <!-- <el-form-item label="工厂编码">-->
  5. <!-- <el-input v-model="queryData.site" style="width: 120px" disabled></el-input>-->
  6. <!-- </el-form-item>-->
  7. <el-form-item label="条码号">
  8. <el-input v-model="queryData.searchSerialNo" style="width: 150px" placeholder="请输入条码号"></el-input>
  9. </el-form-item>
  10. <el-form-item label="操作类型">
  11. <el-select v-model="queryData.searchOperationType" style="width: 140px" clearable placeholder="请选择">
  12. <el-option label="全部" value=""></el-option>
  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 v-model="queryData.startDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" style="width: 170px" placeholder="请选择开始时间"></el-date-picker>
  28. </el-form-item>
  29. <el-form-item label="结束时间">
  30. <el-date-picker v-model="queryData.endDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" style="width: 170px" placeholder="请选择结束时间"></el-date-picker>
  31. </el-form-item>
  32. <el-form-item label=" ">
  33. <el-button type="primary" @click="searchTable()">查询</el-button>
  34. <el-button @click="resetQuery()">重置</el-button>
  35. <!-- 导出当前筛选条件下的主表全部数据,分页位置保持不变 - rqrq -->
  36. <download-excel
  37. :fields="fields()"
  38. :data="exportData"
  39. type="xls"
  40. :name="exportName"
  41. :header="exportHeader"
  42. :footer="exportFooter"
  43. :fetch="createExportData"
  44. :before-generate="startDownload"
  45. :before-finish="finishDownload"
  46. :disabled="exportLoading"
  47. :class="{ 'is-disabled': exportLoading }"
  48. :style="{ pointerEvents: exportLoading ? 'none' : 'auto' }"
  49. :worksheet="$t('warehouse.common.exportWorksheet')"
  50. class="el-button el-button--primary el-button--medium">
  51. {{ $t('warehouse.common.download') }}
  52. </download-excel>
  53. </el-form-item>
  54. </el-form>
  55. <el-table :height="height" :data="dataList" border highlight-current-row v-loading="dataListLoading" style="width: 100%;">
  56. <el-table-column prop="id" label="ID" min-width="60" header-align="center" align="center"></el-table-column>
  57. <el-table-column prop="serialNo" label="条码号" min-width="150" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  58. <!-- <el-table-column prop="site" label="工厂" min-width="80" header-align="center" align="center"></el-table-column>-->
  59. <el-table-column prop="operationType" label="操作类型" min-width="100" header-align="center" align="center">
  60. <template slot-scope="scope">
  61. <span :style="getOperationTypeStyle(scope.row.operationType)">{{ scope.row.operationType || '-' }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="operationReason" label="操作原因" min-width="200" header-align="center" align="left" show-overflow-tooltip></el-table-column>
  65. <el-table-column prop="fieldName" label="字段名" min-width="120" header-align="center" align="center"></el-table-column>
  66. <el-table-column prop="oldValue" label="旧值" min-width="100" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  67. <el-table-column prop="newValue" label="新值" min-width="100" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  68. <el-table-column prop="operator" label="操作者" min-width="100" header-align="center" align="center"></el-table-column>
  69. <el-table-column prop="operationTime" label="操作时间" min-width="160" header-align="center" align="center">
  70. <template slot-scope="scope">{{ formatDate(scope.row.operationTime) }}</template>
  71. </el-table-column>
  72. <el-table-column prop="taskNo" label="关联任务" min-width="150" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  73. <el-table-column prop="remark" label="备注" min-width="150" header-align="center" align="center" show-overflow-tooltip></el-table-column>
  74. </el-table>
  75. <el-pagination
  76. @size-change="sizeChangeHandle"
  77. @current-change="currentChangeHandle"
  78. :current-page="pageIndex"
  79. :page-sizes="[20, 50, 100, 1000]"
  80. :page-size="pageSize"
  81. :total="totalPage"
  82. layout="total, sizes, prev, pager, next, jumper">
  83. </el-pagination>
  84. </div>
  85. </template>
  86. <script>
  87. import { haiAnSearchHandlingUnitOperationLogList } from '@/api/haianWarehouse/handlingUnitOperationLog.js'
  88. export default {
  89. name: 'handlingUnitOperationLog54',
  90. data() {
  91. return {
  92. // 主表导出文件名、字段和防重复状态,按页面筛选条件拉取数据 - rqrq
  93. exportData: [],
  94. exportName: '海安条码操作日志' + this.dayjs().format('YYYYMMDDHHmmss'),
  95. exportHeader: ['海安条码操作日志'],
  96. exportFooter: [],
  97. exportLoading: false,
  98. height: 500,
  99. dataListLoading: false,
  100. dataList: [],
  101. queryData: {
  102. site: this.$store.state.user.site,
  103. searchSerialNo: '',
  104. searchOperationType: '',
  105. searchOperator: '',
  106. searchTaskNo: '',
  107. startDate: '',
  108. endDate: ''
  109. },
  110. pageIndex: 1,
  111. pageSize: 20,
  112. totalPage: 0
  113. }
  114. },
  115. mounted() {
  116. this.$nextTick(() => {
  117. this.height = window.innerHeight - 220
  118. })
  119. this.getDataList()
  120. },
  121. methods: {
  122. // 按主表当前筛选条件请求全部数据;site显式传入,查询失败不生成旧数据文件 - rqrq
  123. async createExportData () {
  124. if (this.exportLoading) return []
  125. this.exportLoading = true
  126. try {
  127. const queryParams = {
  128. ...this.queryData,
  129. site: this.$store.state.user.site,
  130. page: 1,
  131. limit: 999999
  132. }
  133. // 复用主表列表接口,页码固定为1且容量覆盖当前筛选结果;失败时提示用户 - rqrq
  134. const { data } = await haiAnSearchHandlingUnitOperationLogList(queryParams)
  135. if (data && data.code === 0) {
  136. return ((data.page && data.page.list) || []).map(item => ({ ...item, operationTime: this.formatDate(item.operationTime) }))
  137. }
  138. this.$alert((data && data.msg) || '导出失败', '错误')
  139. return []
  140. } catch (error) {
  141. this.$message.error('导出失败,请稍后重试')
  142. return []
  143. } finally {
  144. this.exportLoading = false
  145. }
  146. },
  147. // 下载组件钩子保留与标签查询页一致的调用方式 - rqrq
  148. startDownload () {},
  149. finishDownload () {},
  150. // 导出字段与主表可见字段保持一致,字段来源于页面列配置 - rqrq
  151. fields () {
  152. return {
  153. 'ID': 'id',
  154. '条码号': 'serialNo',
  155. '操作类型': 'operationType',
  156. '操作原因': 'operationReason',
  157. '字段名': 'fieldName',
  158. '旧值': 'oldValue',
  159. '新值': 'newValue',
  160. '操作者': 'operator',
  161. '操作时间': 'operationTime',
  162. '关联任务': 'taskNo',
  163. '备注': 'remark'
  164. }
  165. },
  166. searchTable() {
  167. this.pageIndex = 1
  168. this.getDataList()
  169. },
  170. // 查询日志时统一覆盖site为当前登录工厂,避免人为清空导致跨厂查询 - rqrq
  171. getDataList() {
  172. this.dataListLoading = true
  173. const params = {
  174. ...this.queryData,
  175. site: this.$store.state.user.site,
  176. page: this.pageIndex,
  177. limit: this.pageSize
  178. }
  179. haiAnSearchHandlingUnitOperationLogList(params).then(({ data }) => {
  180. if (data && data.code === 0) {
  181. this.dataList = data.page.list || []
  182. this.pageIndex = data.page.currPage
  183. this.totalPage = data.page.totalCount
  184. } else {
  185. this.dataList = []
  186. this.$alert(data.msg || '查询失败', '错误', { confirmButtonText: '确定' })
  187. }
  188. }).catch(() => {
  189. this.dataList = []
  190. this.$alert('查询失败,请稍后重试', '错误', { confirmButtonText: '确定' })
  191. }).finally(() => {
  192. this.dataListLoading = false
  193. })
  194. },
  195. resetQuery() {
  196. this.queryData = {
  197. site: this.$store.state.user.site,
  198. searchSerialNo: '',
  199. searchOperationType: '',
  200. searchOperator: '',
  201. searchTaskNo: '',
  202. startDate: '',
  203. endDate: ''
  204. }
  205. this.searchTable()
  206. },
  207. sizeChangeHandle(val) {
  208. this.pageSize = val
  209. this.pageIndex = 1
  210. this.getDataList()
  211. },
  212. currentChangeHandle(val) {
  213. this.pageIndex = val
  214. this.getDataList()
  215. },
  216. getOperationTypeStyle(type) {
  217. const colorMap = {
  218. '扫入': '#67C23A',
  219. '扫出': '#409EFF',
  220. '调用栈板': '#409EFF',
  221. '自动分拣': '#E6A23C',
  222. '自动扣账': '#F56C6C'
  223. }
  224. return {
  225. fontWeight: 'bold',
  226. color: colorMap[type] || '#606266'
  227. }
  228. },
  229. formatDate(dateStr) {
  230. if (!dateStr) return ''
  231. const date = new Date(dateStr)
  232. const year = date.getFullYear()
  233. const month = String(date.getMonth() + 1).padStart(2, '0')
  234. const day = String(date.getDate()).padStart(2, '0')
  235. const hours = String(date.getHours()).padStart(2, '0')
  236. const minutes = String(date.getMinutes()).padStart(2, '0')
  237. const seconds = String(date.getSeconds()).padStart(2, '0')
  238. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  239. }
  240. }
  241. }
  242. </script>
  243. <style scoped>
  244. .query-form {
  245. margin-top: 1px;
  246. margin-left: 0px;
  247. }
  248. </style>