250 lines
		
	
	
		
			7.6 KiB
		
	
	
	
		
			Vue
		
	
	
			
		
		
	
	
			250 lines
		
	
	
		
			7.6 KiB
		
	
	
	
		
			Vue
		
	
	
<template>
 | 
						||
  <div class="app-container">
 | 
						||
    <!--工具栏-->
 | 
						||
    <div class="head-container">
 | 
						||
      <label class="el-form-item-label">物料编码</label>
 | 
						||
      <el-select v-model="query.itemCode" placeholder="物料编码" filterable clearable style="width: 170px;"
 | 
						||
                 class="filter-item">
 | 
						||
        <el-option
 | 
						||
          @keyup.enter.native="crud.toQuery"
 | 
						||
          v-for="item in this.items"
 | 
						||
          :key="item.code"
 | 
						||
          :label="item.code"
 | 
						||
          :value="item.code"
 | 
						||
        >
 | 
						||
          <span style="float: left">{{ item.code }}</span>
 | 
						||
          <span style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</span>
 | 
						||
        </el-option>
 | 
						||
      </el-select>
 | 
						||
 | 
						||
      <label class="el-form-item-label">物料名称</label>
 | 
						||
      <el-input v-model="query.itemName" clearable placeholder="物料名称" style="width: 170px;" class="filter-item"
 | 
						||
                @keyup.enter.native="crud.toQuery"
 | 
						||
      />
 | 
						||
 | 
						||
      <label class="el-form-item-label">任务状态</label>
 | 
						||
      <el-select
 | 
						||
        v-model="query.taskStatus"
 | 
						||
        clearable
 | 
						||
        size="small"
 | 
						||
        placeholder="任务状态"
 | 
						||
        class="filter-item"
 | 
						||
        style="width: 150px"
 | 
						||
        @change="crud.toQuery"
 | 
						||
      >
 | 
						||
        <el-option
 | 
						||
          v-for="item in dict.task_status"
 | 
						||
          :key="item.id"
 | 
						||
          :label="item.label"
 | 
						||
          :value="item.value"
 | 
						||
        />
 | 
						||
      </el-select>
 | 
						||
 | 
						||
      <label class="el-form-item-label">日期</label>
 | 
						||
      <date-range-picker v-model="query.createTime" class="date-item" style="width: 100px"/>
 | 
						||
 | 
						||
      <div>
 | 
						||
        <label class="el-form-item-label">原点位</label>
 | 
						||
        <el-input v-model="query.srcPointCode" clearable placeholder="原点位" style="width: 185px;" class="filter-item"
 | 
						||
                  @keyup.enter.native="crud.toQuery"
 | 
						||
        />
 | 
						||
        <label class="el-form-item-label">目标点位</label>
 | 
						||
        <el-input v-model="query.dstPointCode" clearable placeholder="目标点位" style="width: 170px;"
 | 
						||
                  class="filter-item" @keyup.enter.native="crud.toQuery"
 | 
						||
        />
 | 
						||
        <rrOperation :crud="crud"/>
 | 
						||
      </div>
 | 
						||
 | 
						||
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
 | 
						||
      <crudOperation :permission="permission" :tableKey="this.$options.name"/>
 | 
						||
      <!--表单组件-->
 | 
						||
 | 
						||
      <!--表格渲染-->
 | 
						||
      <el-table ref="table" height="60vh" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;"
 | 
						||
                @selection-change="crud.selectionChangeHandler"
 | 
						||
      >
 | 
						||
        <el-table-column type="selection" width="55"/>
 | 
						||
        <el-table-column prop="xh" type="index" :index="indexMethod" label="序号"/>
 | 
						||
        <el-table-column :show-overflow-tooltip="true" prop="itemCode" label="物料编码">
 | 
						||
          <template slot-scope="scope">
 | 
						||
            <div>{{ scope.row.item.code }}</div>
 | 
						||
          </template>
 | 
						||
        </el-table-column>
 | 
						||
        <el-table-column :show-overflow-tooltip="true" prop="itemName" label="物料名称">
 | 
						||
          <template slot-scope="scope">
 | 
						||
            <div>{{ scope.row.item.name }}</div>
 | 
						||
          </template>
 | 
						||
        </el-table-column>
 | 
						||
        <el-table-column prop="srcStockCode" label="容器编码"/>
 | 
						||
        <el-table-column prop="itemKey.orderNumber" label="箱号"/>
 | 
						||
        <el-table-column prop="srcPointCode" label="原点位"/>
 | 
						||
        <el-table-column prop="dstPointCode" label="目标点位"/>
 | 
						||
 | 
						||
        <el-table-column
 | 
						||
          prop="taskStatus"
 | 
						||
          label="任务状态"
 | 
						||
          width="100"
 | 
						||
          :filters="[
 | 
						||
          { text: '待执行', value: 'OPEN' },
 | 
						||
          { text: '执行中', value: 'ATCALL' },
 | 
						||
          { text: '顶升', value: 'UP_CONTAINER' },
 | 
						||
          { text: '已到站', value: 'ARRIVED' },
 | 
						||
          { text: '已完成', value: 'FINISH' },
 | 
						||
          { text: '任务取消', value: 'CANCEL' }
 | 
						||
          ]"
 | 
						||
          :filter-method="filterTag"
 | 
						||
          filter-placement="bottom-end"
 | 
						||
        >
 | 
						||
          <template slot-scope="scope">
 | 
						||
            <el-tag
 | 
						||
              :type="getStatusType(scope.row.taskStatus)"
 | 
						||
              disable-transitions
 | 
						||
            >
 | 
						||
              {{ dict.label.task_status[scope.row.taskStatus] }}
 | 
						||
            </el-tag>
 | 
						||
          </template>
 | 
						||
        </el-table-column>
 | 
						||
        <el-table-column prop="planQty" label="计划数量"/>
 | 
						||
        <el-table-column prop="moveQty" label="移位数量"/>
 | 
						||
        <el-table-column prop="createTime" label="创建时间"/>
 | 
						||
      </el-table>
 | 
						||
      <!--分页组件-->
 | 
						||
      <div style="float: right;">
 | 
						||
        <pagination/>
 | 
						||
      </div>
 | 
						||
    </div>
 | 
						||
  </div>
 | 
						||
</template>
 | 
						||
 | 
						||
<script>
 | 
						||
import crudTask from '@/api/task'
 | 
						||
import crudItem from '@/api/item'
 | 
						||
import CRUD, {presenter, header, form, crud} from '@crud/crud'
 | 
						||
import rrOperation from '@crud/RR.operation'
 | 
						||
import crudOperation from '@crud/CRUD.operation'
 | 
						||
import udOperation from '@crud/UD.operation'
 | 
						||
import pagination from '@crud/Pagination'
 | 
						||
import DateRangePicker from '@/components/DateRangePicker/index.vue'
 | 
						||
 | 
						||
const defaultForm = {
 | 
						||
  id: null,
 | 
						||
  itemId: null,
 | 
						||
  itemKeyId: null,
 | 
						||
  billCode: null,
 | 
						||
  taskType: null,
 | 
						||
  asnDetailId: null,
 | 
						||
  moveDetailId: null,
 | 
						||
  waveDetailId: null,
 | 
						||
  pickDetailId: null,
 | 
						||
  srcStockId: null,
 | 
						||
  dstStockId: null,
 | 
						||
  srcPointId: null,
 | 
						||
  dstPointId: null,
 | 
						||
  srcStockCode: null,
 | 
						||
  dstStockCode: null,
 | 
						||
  srcPointCode: null,
 | 
						||
  dstPointCode: null,
 | 
						||
  invStatus: null,
 | 
						||
  taskStatus: null,
 | 
						||
  beSkip: null,
 | 
						||
  beBack: null,
 | 
						||
  planQty: null,
 | 
						||
  moveQty: null,
 | 
						||
  putCode: null,
 | 
						||
  invId: null,
 | 
						||
  deptId: null,
 | 
						||
  createBy: null,
 | 
						||
  updateBy: null,
 | 
						||
  createTime: null,
 | 
						||
  updateTime: null
 | 
						||
}
 | 
						||
export default {
 | 
						||
  name: 'asnTask',
 | 
						||
  components: {DateRangePicker, pagination, crudOperation, rrOperation, udOperation},
 | 
						||
  mixins: [presenter(), header(), form(defaultForm), crud()],
 | 
						||
  dicts: ['task_status'],
 | 
						||
  cruds() {
 | 
						||
    return CRUD({
 | 
						||
        query: {taskType: ['ASN']},
 | 
						||
        title: '入库任务',
 | 
						||
        url: 'api/task',
 | 
						||
        idField: 'id',
 | 
						||
        sort: 'id,desc',
 | 
						||
        crudMethod: {...crudTask},
 | 
						||
        optShow: {
 | 
						||
          add: false,
 | 
						||
          edit: false,
 | 
						||
          del: false,
 | 
						||
          reset: true,
 | 
						||
          download: true
 | 
						||
        },
 | 
						||
        queryOnPresenterCreated: true
 | 
						||
      }
 | 
						||
    )
 | 
						||
  },
 | 
						||
  data() {
 | 
						||
    return {
 | 
						||
      permission: {
 | 
						||
        add: ['admin', 'task:add'],
 | 
						||
        edit: ['admin', 'task:edit'],
 | 
						||
        del: ['admin', 'task:del']
 | 
						||
      },
 | 
						||
      rules: {},
 | 
						||
      queryTypeOptions: [
 | 
						||
        {key: 'itemCode', display_name: '物料代码'},
 | 
						||
        {key: 'itemName', display_name: '物料名称'},
 | 
						||
        {key: 'taskStatus', display_name: '任务状态'},
 | 
						||
        {key: 'srcPointCode', display_name: '源点位编码'},
 | 
						||
        {key: 'dstPointCode', display_name: '目标点位编码'}
 | 
						||
      ],
 | 
						||
      items: []
 | 
						||
    }
 | 
						||
  },
 | 
						||
  mounted() {
 | 
						||
    //初始化数据
 | 
						||
    this.getItem()
 | 
						||
  },
 | 
						||
  methods: {
 | 
						||
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
 | 
						||
    [CRUD.HOOK.beforeRefresh]() {
 | 
						||
      return true
 | 
						||
    },
 | 
						||
    indexMethod(index) {
 | 
						||
      return index * 1 + 1
 | 
						||
    },
 | 
						||
    //物料数据
 | 
						||
    getItem() {
 | 
						||
      crudItem.queryItemAll({enabled: true}).then(res => {
 | 
						||
        this.items = res
 | 
						||
      }).catch(e => {
 | 
						||
        this.crud.notify('物料加载失败', CRUD.NOTIFICATION_TYPE.ERROR)
 | 
						||
      })
 | 
						||
    },
 | 
						||
    getStatusType(status) {
 | 
						||
      switch (this.dict.label.task_status[status]) {
 | 
						||
        case '待执行':
 | 
						||
          return 'info'
 | 
						||
        case '执行中':
 | 
						||
          return 'warning'
 | 
						||
        case '顶升':
 | 
						||
          return 'primary'
 | 
						||
        case '已完成':
 | 
						||
        case '已到站':
 | 
						||
          return 'success'
 | 
						||
        case '任务取消':
 | 
						||
          return 'danger'
 | 
						||
        default:
 | 
						||
          return ''
 | 
						||
      }
 | 
						||
    },
 | 
						||
    filterTag(value, row) {
 | 
						||
      return row.taskStatus === value
 | 
						||
    }
 | 
						||
  }
 | 
						||
}
 | 
						||
</script>
 | 
						||
 | 
						||
<style scoped>
 | 
						||
 | 
						||
</style>
 |