236 lines
5.5 KiB
Vue
236 lines
5.5 KiB
Vue
<template>
|
|
<view>
|
|
<!-- 工单列表 -->
|
|
<view class="query-card">
|
|
<uni-forms style="width: 100%" ref="form">
|
|
<uni-forms-item label="日期">
|
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="query.dateTime" />
|
|
</uni-forms-item>
|
|
<!-- <uni-forms-item label="线别">
|
|
<uni-data-select v-model="query.lineCode" :localdata="lineOptions" :clear="false"></uni-data-select>
|
|
</uni-forms-item> -->
|
|
<uni-forms-item label="组别">
|
|
<uni-data-select v-model="query.groupCode" :localdata="groupOptions" :clear="false"></uni-data-select>
|
|
</uni-forms-item>
|
|
<button type="primary" plain @click="getList()">
|
|
<uni-icons color="#2979ff" type="search" size="18"></uni-icons>
|
|
查询工单
|
|
</button>
|
|
</uni-forms>
|
|
</view>
|
|
<uni-segmented-control :current="current" activeColor="#007aff" :values="selectItems" @clickItem="onClickSelect" />
|
|
<scroll-view class="scroll-view" scroll-y="true">
|
|
<uni-list style="width: 100%">
|
|
<uni-list-item
|
|
:class="getWorkOrderClass(item)"
|
|
v-for="(item, index) in dataList"
|
|
:key="index"
|
|
:title="item.title"
|
|
:note="item.note"
|
|
:rightText="item.rightText"
|
|
link
|
|
@click="onListItemClick(item)"
|
|
></uni-list-item>
|
|
</uni-list>
|
|
</scroll-view>
|
|
<view class="bottom-box">
|
|
<button type="primary" @click="scanToReport">
|
|
<uni-icons color="#fff" type="scan" size="18"></uni-icons>
|
|
修改报工
|
|
</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
// 基础数据
|
|
import { getAllRoute, getAllGroup, getWorkOrderList } from '@/api/workorder/index.js';
|
|
// 工单信息
|
|
// import { getReportWorkOrderList,getWorkOrderStatusList } from '@/api/workorder/proreportwork.js';
|
|
import { tansParams } from '@/utils/common';
|
|
export default {
|
|
data() {
|
|
return {
|
|
// 查询条件
|
|
query: {
|
|
lineCode: '',
|
|
groupCode: '1',
|
|
status: 1,
|
|
dateTime: this.$dayjs().format('YYYY-MM-DD')
|
|
},
|
|
current: 0,
|
|
selectItems: ['未开始', '进行中', '已完成'],
|
|
value: '',
|
|
// 线别
|
|
lineOptions: [],
|
|
// 组别
|
|
groupOptions: [],
|
|
// 工单
|
|
dataList: [],
|
|
workOrderSelect: '',
|
|
sessionKey: '_WorkorderSearch'
|
|
};
|
|
},
|
|
created() {
|
|
this.init();
|
|
},
|
|
onShow: function () {
|
|
this.getSessionStorage();
|
|
this.current = this.query.status - 1;
|
|
//this.getList();
|
|
},
|
|
methods: {
|
|
init() {
|
|
// 初始化数据
|
|
this.getSelectOptions();
|
|
},
|
|
getWorkOrderClass(item) {
|
|
if (item.status === 1) {
|
|
return '';
|
|
}
|
|
if (item.status === 2) {
|
|
return 'bg-blue';
|
|
}
|
|
if (item.status === 3) {
|
|
return 'bg-green';
|
|
}
|
|
},
|
|
onClickSelect(e) {
|
|
this.query.status = e.currentIndex + 1;
|
|
this.getList();
|
|
},
|
|
async getSelectOptions() {
|
|
uni.showLoading();
|
|
const res1 = await getAllRoute();
|
|
if (res1.code === 200) {
|
|
this.lineOptions = res1.data.map((item) => {
|
|
return {
|
|
id: item.id,
|
|
text: `${item.name}`,
|
|
value: `${item.code}`
|
|
};
|
|
});
|
|
}
|
|
|
|
const res2 = await getAllGroup();
|
|
if (res2.code === 200) {
|
|
this.groupOptions = res2.data.map((item) => {
|
|
return {
|
|
id: item.id,
|
|
text: `${item.groupName}`,
|
|
value: `${item.groupCode}`
|
|
};
|
|
});
|
|
}
|
|
|
|
uni.hideLoading();
|
|
},
|
|
setSessionStorage(query) {
|
|
try {
|
|
const _query = JSON.stringify(query);
|
|
return uni.setStorageSync(this.sessionKey, _query);
|
|
} catch (e) {
|
|
return;
|
|
}
|
|
},
|
|
getSessionStorage() {
|
|
try {
|
|
const _query = JSON.parse(uni.getStorageSync(this.sessionKey));
|
|
if (_query != '' && _query != null) {
|
|
this.query = _query;
|
|
}
|
|
} catch (e) {
|
|
return;
|
|
}
|
|
},
|
|
// 获取数据
|
|
getList() {
|
|
this.dataList = [];
|
|
const params = {
|
|
group_code: this.query.groupCode,
|
|
status: this.query.status,
|
|
handleDate: this.query.dateTime
|
|
};
|
|
getWorkOrderList(params).then((res) => {
|
|
let that = this;
|
|
if (res.code === 200) {
|
|
this.setSessionStorage(this.query);
|
|
this.dataList = res.data.map((item) => {
|
|
let statusStr = that.getWorkOrderStatus(item.status);
|
|
return {
|
|
id: item.id,
|
|
workOrderInfo: item,
|
|
status: item.status,
|
|
title: `${item.fkWorkorder} -- ${statusStr}`,
|
|
note: `${item.productionName} ${item.productionCode}`,
|
|
rightText: `${item.finishedNum ?? 0} 扫码报工`
|
|
};
|
|
});
|
|
}
|
|
});
|
|
},
|
|
getWorkOrderStatus(status = 0) {
|
|
try {
|
|
const list = ['', '未开始', '进行中', '已完成'];
|
|
return list[status * 1];
|
|
} catch (e) {
|
|
return '';
|
|
}
|
|
},
|
|
WorkOrderStatusColor(status) {
|
|
const list = ['', '未开始', '已开始', '已完成'];
|
|
const colorList = ['#fff', '#8f939c', '#2979ff', '#18bc37'];
|
|
return colorList[status * 1];
|
|
},
|
|
// 工单点击
|
|
onListItemClick(item) {
|
|
const params = item.workOrderInfo;
|
|
uni.navigateTo({
|
|
url: '/pages/produceManagement/checkLabel/checkLabel?' + tansParams(params)
|
|
});
|
|
},
|
|
// 扫码报工
|
|
scanToReport() {
|
|
const params = this.query;
|
|
uni.navigateTo({
|
|
url: '/pages/produceManagement/scanWorkOrder/scanWorkOrder?' + tansParams(params)
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.content {
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.query-card {
|
|
background-color: #fff;
|
|
padding: 10px;
|
|
}
|
|
.row {
|
|
background-color: #fff;
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.card-box {
|
|
width: 100%;
|
|
}
|
|
.scroll-view {
|
|
height: 800rpx;
|
|
padding-bottom: 40rpx;
|
|
}
|
|
.bg-blue {
|
|
background-color: rgb(197.7, 225.9, 255) !important;
|
|
}
|
|
.bg-green {
|
|
background-color: rgb(209.4, 236.7, 195.9) !important;
|
|
}
|
|
</style> |