Files
pad-hl-hcx-new/pages/management/TaskOperate.vue

299 lines
8.1 KiB
Vue
Raw Normal View History

2023-03-23 14:13:31 +08:00
<template>
<view class="content">
2023-04-13 16:39:35 +08:00
<nav-bar title="任务管理"></nav-bar>
2023-03-23 14:13:31 +08:00
<view class="search-confirm-wrap">
<view class="search-wrap">
2023-04-06 13:49:09 +08:00
<view class="search-item">
<label class="search-label">生产区域</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
2023-04-07 15:54:30 +08:00
<view class="search-item">
<label class="search-label">任务类型</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index3" :localdata="options3" @change="selectChange3"></uni-data-select>
</view>
</view>
2023-03-23 14:13:31 +08:00
<view class="search-item">
<label class="search-label">状态</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<view class="search-item">
<label class="search-label">指令号</label>
<view class="filter_input_wraper">
2023-03-28 17:45:18 +08:00
<input type="text" class="search-input-l" placeholder="指令号、MES号" v-model="instNum">
2023-03-23 14:13:31 +08:00
</view>
</view>
<view class="search-item">
2023-04-06 13:49:09 +08:00
<label class="search-label">任务描述</label>
2023-03-23 14:13:31 +08:00
<view class="filter_input_wraper">
2023-04-06 18:57:35 +08:00
<input type="text" class="search-input-l" placeholder="任务描述" v-model="taskName">
2023-03-23 14:13:31 +08:00
</view>
</view>
<view class="search-item">
<label class="search-label">条码</label>
<view class="filter_input_wraper">
<search-box
2023-03-28 10:42:14 +08:00
placeholder="入箱条码、出箱条码"
2023-03-28 17:45:18 +08:00
v-model="val1"
2023-03-23 14:13:31 +08:00
/>
</view>
</view>
<view class="search-item">
<label class="search-label">起点</label>
<view class="filter_input_wraper">
2023-03-28 17:45:18 +08:00
<input type="text" class="search-input-l" placeholder="起始点位、起始设备" v-model="startPoint">
2023-03-23 14:13:31 +08:00
</view>
</view>
<view class="search-item">
<label class="search-label">终点</label>
<view class="filter_input_wraper">
2023-03-28 17:45:18 +08:00
<input type="text" class="search-input-l" placeholder="目的点位、目的设备" v-model="endPoint">
2023-03-23 14:13:31 +08:00
</view>
</view>
<view class="search-item">
<label class="search-label">开始日期</label>
<view class="filter_input_wraper">
2023-03-28 17:45:18 +08:00
<input type="text" class="search-input-l" v-model="startDate" @click="open1">
2023-03-23 14:13:31 +08:00
</view>
</view>
<view class="search-item">
<label class="search-label">结束日期</label>
<view class="filter_input_wraper">
2023-03-28 17:45:18 +08:00
<input type="text" class="search-input-l" v-model="endDate" @click="open2">
2023-03-23 14:13:31 +08:00
</view>
</view>
</view>
<view class="confirm-button-wrap">
<button class="confirm-button" @tap="toSearch()">查询</button>
2023-03-30 16:14:01 +08:00
<button class="confirm-button" :disabled="disabled" @tap="toSure('8')">取消</button>
<button class="confirm-button" :disabled="disabled" @tap="toSure('7')">完成</button>
<button class="confirm-button" :disabled="disabled" @tap="toSure('5')">重发</button>
2023-03-23 14:13:31 +08:00
</view>
</view>
<view class="grid-wrap">
<table class="grid-table">
<thead>
<tr>
<th>选择</th>
2023-04-06 13:49:09 +08:00
<th>任务编号</th>
<th>任务类型</th>
<th>任务描述</th>
2023-03-24 17:33:28 +08:00
<th>起点设备</th>
<th>目的设备</th>
2023-04-06 13:49:09 +08:00
<th>料箱码</th>
2023-03-24 17:33:28 +08:00
<th>状态</th>
<th>物料编码</th>
<th>创建时间</th>
2023-03-23 14:13:31 +08:00
</tr>
</thead>
<tbody>
<tr v-for="e in dataList" :key="e.instruct_uuid" @click="toRadio(e)">
<td>
<view class="iconfont icon-check" :class="{'icon-checked': pkId === e.instruct_uuid}"></view>
</td>
2023-03-24 17:33:28 +08:00
<td>{{e.instructoperate_num}}</td>
2023-04-06 13:49:09 +08:00
<td>{{e.task_type}}</td>
<td>{{e.task_name}}</td>
2023-03-30 16:14:01 +08:00
<td>{{e.startpoint_code}}</td>
<td>{{e.nextpoint_code}}</td>
2023-03-30 16:48:50 +08:00
<td>{{e.vehicle_code}}</td>
2023-03-24 17:33:28 +08:00
<td>{{e.status_name}}</td>
<td>{{e.processmaterial_code}}</td>
<td>{{e.create_time}}</td>
2023-03-23 14:13:31 +08:00
</tr>
</tbody>
</table>
</view>
2023-03-30 11:26:17 +08:00
<uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/>
2023-03-23 18:48:14 +08:00
<view>
<uni-calendar
ref="calendar1"
:insert="false"
2023-03-30 11:26:17 +08:00
:date="startDate"
2023-03-23 18:48:14 +08:00
@confirm="confirm1"
/>
</view>
<view>
<uni-calendar
ref="calendar2"
:insert="false"
2023-03-30 11:26:17 +08:00
:date="endDate"
2023-03-23 18:48:14 +08:00
@confirm="confirm2"
/>
</view>
2023-03-23 14:13:31 +08:00
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2023-04-07 15:54:30 +08:00
import {instStatusQuery, instPageQuery, instOperation, taskType} from '@/utils/getData1.js'
2023-05-10 10:49:00 +08:00
import {dateFtt} from '@/utils/utils.js'
2023-03-23 14:13:31 +08:00
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
2023-03-30 11:26:17 +08:00
page: 1,
2023-03-23 14:13:31 +08:00
options1: [],
index1: '',
2023-04-06 13:49:09 +08:00
options2: [{text: 'A1', value: 'A1'}, {text: 'A2', value: 'A2'}],
index2: 'A1',
2023-04-07 15:54:30 +08:00
options3: [],
index3: '',
2023-03-28 17:45:18 +08:00
startDate: dateFtt(new Date()),
endDate: dateFtt(new Date(new Date().setDate(new Date().getDate() + 1))),
instNum: '',
2023-04-06 13:49:09 +08:00
taskName: '',
2023-03-28 17:45:18 +08:00
startPoint: '',
endPoint: '',
2023-03-23 14:13:31 +08:00
val1: '',
dataList: [],
pkId: '',
2023-03-30 11:26:17 +08:00
disabled: false,
reload: false,
status: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
totalCount: 0,
pageNum: 1,
2023-04-03 09:32:06 +08:00
pageSize: 100
2023-03-23 14:13:31 +08:00
};
},
2023-03-30 11:26:17 +08:00
created() {
this._instStatusQuery()
2023-04-07 15:54:30 +08:00
this._taskType()
2023-03-30 11:26:17 +08:00
},
2023-03-23 14:13:31 +08:00
methods: {
2023-03-23 18:48:14 +08:00
open1(){
this.$refs.calendar1.open()
},
confirm1(e) {
2023-03-30 11:26:17 +08:00
var compare = Date.parse(new Date(e.fulldate)) - Date.parse(new Date(this.endDate))
if (compare < 0) {
this.startDate = e.fulldate
}
2023-03-23 18:48:14 +08:00
},
open2(){
this.$refs.calendar2.open()
},
confirm2(e) {
2023-03-30 11:26:17 +08:00
var compare = Date.parse(new Date(e.fulldate)) - Date.parse(new Date(this.startDate))
if (compare > 0) {
this.endDate = e.fulldate
}
2023-03-23 18:48:14 +08:00
},
2023-03-23 14:13:31 +08:00
/** 选择器1 */
selectChange1(e) {
this.index1 = e
},
2023-04-07 15:54:30 +08:00
/** 选择器2 */
2023-04-06 13:49:09 +08:00
selectChange2(e) {
this.index2 = e
},
2023-04-07 15:54:30 +08:00
/** 选择器2 */
selectChange3(e) {
this.index3 = e
},
2023-03-30 11:26:17 +08:00
async _instStatusQuery (id) {
let res = await instStatusQuery(id)
2023-03-30 16:14:01 +08:00
this.options1 = [...res]
2023-03-30 11:26:17 +08:00
},
2023-04-07 15:54:30 +08:00
async _taskType (id) {
let res = await taskType(id)
this.options3 = [...res]
},
2023-03-23 14:13:31 +08:00
toSearch () {
2023-03-30 11:26:17 +08:00
this.dataList = []
this.pageNum = 1
this._instPageQuery()
2023-03-23 14:13:31 +08:00
},
2023-03-30 11:26:17 +08:00
/** 初始化查询 */
async _instPageQuery () {
let form = {
2023-03-30 16:48:50 +08:00
page: this.pageNum + '',
size: this.pageSize + '',
2023-03-30 11:26:17 +08:00
status: this.index1,
inst_num: this.instNum,
2023-04-06 13:49:09 +08:00
task_name: this.taskName,
2023-04-07 15:54:30 +08:00
task_type: this.index3,
2023-04-06 18:57:35 +08:00
product_area: this.index2,
2023-03-30 11:26:17 +08:00
vehicle_code: this.val1,
start_point: this.startPoint,
end_point: this.endPoint,
start_date: this.startDate || '',
end_date: this.endDate || ''
}
let res = await instPageQuery(form)
2023-03-30 16:48:50 +08:00
this.totalCount = res.size
if (res.size > 0) {
2023-03-30 16:14:01 +08:00
const dataMap = res.content
2023-03-30 11:26:17 +08:00
this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap)
this.reload = false
} else {
this.dataList = []
}
if (this.totalCount == this.dataList.length) {
this.reload = false
this.status = 'noMore'
}
},
onReachBottom () {
if (this.totalCount > this.dataList.length) {
this.status = 'loading'
setTimeout(() => {
this.pageNum++
this._instPageQuery()
}, 1000)
} else { //停止加载
this.status = 'noMore'
}
2023-03-23 14:13:31 +08:00
},
2023-03-30 16:48:50 +08:00
async toSure (type) {
2023-03-23 14:13:31 +08:00
this.disabled = true
if (!this.pkId) {
uni.showToast({
title: '请选择',
icon: 'none'
})
this.disabled = false
return
}
2023-03-30 16:48:50 +08:00
try {
2023-04-03 08:56:06 +08:00
let res = await instOperation(this.pkId, type)
2023-03-30 16:48:50 +08:00
this.disabled = false
this.toSearch()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
2023-03-23 14:13:31 +08:00
},
toRadio (e) {
this.pkId = this.pkId === e.instruct_uuid ? '' : e.instruct_uuid
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.grid-wrap
2023-03-30 16:48:50 +08:00
height: auto
overflow: auto
2023-04-07 18:11:42 +08:00
height: calc(100% - 387px); /** 42+ 15*9+ 35*6 */
2023-03-30 16:58:41 +08:00
/deep/ .uni-calendar-item__weeks-box-item
height: 40px !important
2023-03-23 14:13:31 +08:00
</style>