#
Junjie
2025-02-14 ac4341ea6b66ae02427d39d35f41d42d78b2eb2e
zy-asrs-admin/src/views/task/taskLog/index.vue
@@ -1,7 +1,7 @@
<script setup>
import { getCurrentInstance, ref, computed, reactive } from 'vue';
import { useRouter } from "vue-router";
import { get, post, postBlob } from '@/utils/request.js'
import { get, post, postBlob, postForm } from '@/utils/request.js'
import { message, Modal } from 'ant-design-vue';
import { logout } from '@/config.js';
import EditView from './edit.vue'
@@ -16,8 +16,21 @@
let currentPage = 1;
let pageSize = 10;
const searchInput = ref("")
const searchParam = ref({
  taskNo: null,
  taskSts: null,
  taskType: null,
  originLoc: null,
  targetLoc: null,
  barcode: null,
})
const editChild = ref(null)
const showTaskDetlChild = ref(null)
const state = reactive({
  selectedRowKeys: [],
  loading: false,
});
let tableData = ref([]);
getPage();
@@ -143,10 +156,7 @@
  },
];
const state = reactive({
  selectedRowKeys: [],
  loading: false,
});
const hasSelected = computed(() => state.selectedRowKeys.length > 0);
const start = () => {
  state.loading = true;
@@ -162,15 +172,20 @@
};
function getPage() {
  state.loading = true;
  post('/api/taskLog/page', {
    current: currentPage,
    pageSize: pageSize,
    condition: searchInput.value
    condition: searchInput.value,
    _param: searchParam.value,
  }).then((resp) => {
    let result = resp.data;
    if (result.code == 200) {
      let data = result.data;
      tableData.value = data;
      state.loading = false;
    } else if (result.code === 401) {
      message.error(result.msg);
      logout()
@@ -212,7 +227,10 @@
}
const handleExport = async (intl) => {
  postBlob('/api/taskLog/export', {}).then(result => {
  postBlob('/api/taskLog/export', {
    condition: searchInput.value,
    _param: searchParam.value,
  }).then(result => {
    const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
    window.location.href = window.URL.createObjectURL(blob);
    return true;
@@ -239,6 +257,23 @@
  showTaskDetlChild.value.taskId = record.id;
}
const taskStsQueryList = ref(null);
taskStsQuery();
function taskStsQuery() {
  postForm('/api/taskSts/query', {}).then(resp => {
    let result = resp.data;
    taskStsQueryList.value = result.data;
  })
}
const taskTypeQueryList = ref(null);
taskTypeQuery();
function taskTypeQuery() {
  postForm('/api/taskType/query', {}).then(resp => {
    let result = resp.data;
    taskTypeQueryList.value = result.data;
  })
}
</script>
<script>
@@ -251,17 +286,39 @@
  <div>
    <EditView ref="editChild" @tableReload="handleTableReload" />
    <div class="table-header">
      <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')"
        style="width: 200px;" @search="onSearch" />
      <div>
        <a-input v-model:value="searchParam.taskNo" :placeholder="formatMessage('page.task.taskNo.input', '请输入任务编号')"
          style="width: 140px;margin-right: 10px;" />
        <a-select v-model:value="searchParam.taskSts"
          :placeholder="formatMessage('page.task.taskSts.select', '请选择任务状态')" style="width: 140px;margin-right: 10px;"
          show-search allowClear :options="taskStsQueryList" optionFilterProp="label" optionLabelProp="label">
        </a-select>
        <a-select v-model:value="searchParam.taskType"
          :placeholder="formatMessage('page.task.taskType.select', '请选择任务类型')" style="width: 140px;margin-right: 10px;"
          show-search allowClear :options="taskTypeQueryList" optionFilterProp="label" optionLabelProp="label">
        </a-select>
        <a-input v-model:value="searchParam.originLoc"
          :placeholder="formatMessage('page.task.originLoc.input', '请输入源库位')"
          style="width: 140px;margin-right: 10px;" />
        <a-input v-model:value="searchParam.targetLoc"
          :placeholder="formatMessage('page.task.targetLoc.input', '请输入目标库位')"
          style="width: 140px;margin-right: 10px;" />
        <a-input v-model:value="searchParam.barcode" :placeholder="formatMessage('page.task.barcode.input', '请输入托盘码')"
          style="width: 140px;margin-right: 10px;" />
        <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')"
          style="width: 200px;" @search="onSearch" />
      </div>
      <div class="table-header-right">
        <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button>
        <!-- <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button> -->
        <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button>
      </div>
    </div>
    <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
      :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
      :pagination="{ total: tableData.total, onChange: onPageChange }"
      :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn">
      :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn"
      :loading="state.loading">
      <template #bodyCell="{ column, text, record }">
        <template v-if="column.dataIndex === 'oper'">
          <div style="display: flex;justify-content: space-evenly;">