main
chenshuichuan 2 years ago
parent d8ffff6bd9
commit 90dc46c2a1

@ -1,7 +1,7 @@
// 应用全局配置 // 应用全局配置
const config = { const config = {
// baseUrl: 'http://47.106.185.127:48080',127.0.0.1 // baseUrl: 'http://47.106.185.127:48080',127.0.0.1
baseUrl: 'http://47.106.185.127:48080', baseUrl: 'http://127.0.0.1:48080',
// 应用信息 // 应用信息
appInfo: { appInfo: {
// 应用名称 // 应用名称

@ -15,14 +15,14 @@
<uni-forms-item label="备注" name="remark"> <uni-forms-item label="备注" name="remark">
<uni-easyinput v-model="formData.remark" placeholder="" /> <uni-easyinput v-model="formData.remark" placeholder="" />
</uni-forms-item> </uni-forms-item>
<uni-group title="card 模式" mode="card" v-for="(item,index) in formData.productList" :key="item.id" <uni-group title="card 模式" mode="card" v-for="(item,index) in formData.feedingRecordDetails" :key="item.id"
:name="['productList',index,'value']"> :name="['feedingRecordDetails',index,'value']">
<template v-slot:title> <template v-slot:title>
<view class="uni-group-title"> <view class="uni-group-title">
<uni-row> <uni-row>
<uni-col :span="18"> <uni-col :span="18">
<uni-forms-item label="原料" required name="itemId"> <uni-forms-item label="原料" required name="itemId">
<uni-data-select placement="top" v-model="formData.productList[index].itemId" :localdata="itemList"></uni-data-select> <uni-data-select placement="top" v-model="formData.feedingRecordDetails[index].itemId" :localdata="itemList"></uni-data-select>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="6" align="center"> <uni-col :span="6" align="center">
@ -32,10 +32,10 @@
</view> </view>
</template> </template>
<uni-forms-item label="单位" required name="unitId"> <uni-forms-item label="单位" required name="unitId">
<uni-data-select v-model="formData.productList[index].unitId" :localdata="unitList"></uni-data-select> <uni-data-select v-model="formData.feedingRecordDetails[index].unitId" :localdata="unitList"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="数量" required name="weight"> <uni-forms-item label="数量" required name="weight">
<uni-easyinput type="number" v-model="formData.productList[index].weight"/> <uni-easyinput type="number" v-model="formData.feedingRecordDetails[index].weight"/>
</uni-forms-item> </uni-forms-item>
</uni-group> </uni-group>
@ -67,15 +67,15 @@ export default {
id: undefined, id: undefined,
feedingPipeline: undefined, feedingPipeline: undefined,
feedingType: undefined, feedingType: undefined,
weight: undefined, weight: 0,
remark: undefined, remark: undefined,
productList: [] feedingRecordDetails: []
}, },
// //
customRules: { customRules: {
feedingPipeline: {rules: [{required: true, errorMessage: '姓名不能为空'}]}, feedingPipeline: {rules: [{required: true, errorMessage: '姓名不能为空'}]},
feedingType: {rules: [{required: true, errorMessage: '工位不能为空'}]}, feedingType: {rules: [{required: true, errorMessage: '工位不能为空'}]},
productList: {rules: [ feedingRecordDetails: {rules: [
{format: 'array', errorMessage: '产品列表格式错误'}, {format: 'array', errorMessage: '产品列表格式错误'},
{validateFunction: function(rule, value, data, callback) { {validateFunction: function(rule, value, data, callback) {
if (value.length < 2) { if (value.length < 2) {
@ -105,10 +105,10 @@ export default {
submit(ref) { submit(ref) {
this.$refs[ref].validate().then(res => { this.$refs[ref].validate().then(res => {
var ok = 1; var ok = 1;
if(this.formData.productList && this.formData.productList.length > 0) { if(this.formData.feedingRecordDetails && this.formData.feedingRecordDetails.length > 0) {
for (let i = 0; i < this.formData.productList.length; i++) { for (let i = 0; i < this.formData.feedingRecordDetails.length; i++) {
if(!this.formData.productList[i].itemId || this.formData.productList[i].itemId==='' if(!this.formData.feedingRecordDetails[i].itemId || this.formData.feedingRecordDetails[i].itemId===''
|| !this.formData.productList[i].weight|| this.formData.productList[i].weight <= 0) { || !this.formData.feedingRecordDetails[i].weight|| this.formData.feedingRecordDetails[i].weight <= 0) {
ok = 0; ok = 0;
uni.showToast({ uni.showToast({
title: `原料信息不能为空!`, title: `原料信息不能为空!`,
@ -135,7 +135,7 @@ export default {
handleTypeChange(e){ handleTypeChange(e){
this.formData.feedingType =e.detail.value; this.formData.feedingType =e.detail.value;
if(this.formData.feedingType === 'wet' || this.formData.feedingType==='dry'){ if(this.formData.feedingType === 'wet' || this.formData.feedingType==='dry'){
this.formData.productList = [] this.formData.feedingRecordDetails = []
} }
}, },
getItemList() { getItemList() {
@ -147,7 +147,7 @@ export default {
}) })
}, },
add() { add() {
this.formData.productList.push({ this.formData.feedingRecordDetails.push({
id: Date.now(), id: Date.now(),
itemId: undefined, itemId: undefined,
unitId: 3, unitId: 3,
@ -155,8 +155,8 @@ export default {
}) })
}, },
del(id) { del(id) {
let index = this.formData.productList.findIndex(v => v.id === id) let index = this.formData.feedingRecordDetails.findIndex(v => v.id === id)
this.formData.productList.splice(index, 1) this.formData.feedingRecordDetails.splice(index, 1)
} }
} }
} }

@ -0,0 +1,323 @@
<template>
<view class="container">
<uni-card :is-shadow="false" is-full>
<text class="uni-h6">如个人无法填报请寻找主管代为报工</text>
</uni-card>
<view class="example">
<!-- 自定义表单校验 -->
<uni-forms ref="customForm" :rules="customRules" labelWidth="60px" :modelValue="customFormData">
<uni-forms-item label="工序" required name="orgType">
<uni-data-checkbox disabled v-model="customFormData.orgType" :localdata="processTypes()" @change="handleOrgTypeChange" />
</uni-forms-item>
<uni-forms-item label="班别" required name="groupType">
<uni-data-checkbox disabled v-model="customFormData.groupType" :localdata="groupTypes()" />
</uni-forms-item>
<uni-forms-item label="日期" required name="reportDateString">
<uni-datetime-picker disabled v-model="customFormData.reportDateString" type="date" :clear-icon="true" @change="maskClick" />
</uni-forms-item>
<uni-forms-item label="工位" required name="orgId">
<uni-data-select disabled v-model="customFormData.orgId" :localdata="orgIdList"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="计时时段" name="reportTime">
<uni-easyinput disabled type="text" v-model="customFormData.reportTime" placeholder="如:8:00-12:00" />
</uni-forms-item>
<uni-forms-item label="总计时/h" required name="totalTime">
<uni-easyinput disabled type="number" v-model="customFormData.totalTime" placeholder="" />
</uni-forms-item>
<uni-group title="card 模式" mode="card" v-for="(item,index) in customFormData.produceReportDetails" :key="item.id"
:name="['produceReportDetails',index,'value']">
<template v-slot:title>
<view class="uni-group-title">
<uni-row>
<uni-col :span="20">
<uni-forms-item label="产品" required name="planId">
<uni-data-select disabled v-model="customFormData.produceReportDetails[index].planId" :localdata="planProductList"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="4" align="center">
<!-- <button class="button" size="mini" type="warn" @click="del(item.id)"></button>-->
<!-- <uni-icons type="trash" size="25" color="red" @click="del(item.id)"></uni-icons>-->
</uni-col>
</uni-row>
</view>
</template>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="成品数" required name="qualityNumber">
<uni-easyinput disabled type="number" v-model="customFormData.produceReportDetails[index].qualityNumber" @change="changeNumber(item.id)"/>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="废品数" name="wasteNumber">
<uni-easyinput disabled type="number" v-model="customFormData.produceReportDetails[index].wasteNumber" @change="changeNumber(item.id)"/>
</uni-forms-item>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="总数" name="totalNumber">
<uni-easyinput disabled v-model="customFormData.produceReportDetails[index].totalNumber" placeholder="" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="成品率%" required name="qualityRate">
<uni-easyinput disabled type="number" v-model="customFormData.produceReportDetails[index].qualityRate" />
</uni-forms-item>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="打包数" name="packageNumber">
<uni-easyinput disabled type="number" v-model="customFormData.produceReportDetails[index].packageNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="备注" name="remark">
<uni-easyinput disabled type="text" v-model="customFormData.produceReportDetails[index].remark" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-group>
</uni-forms>
<view class="button-group">
<!-- <button type="primary" size="mini" @click="add">-->
<!-- <uni-icons type="plus" size="15"></uni-icons>-->
<!-- 新增产品-->
<!-- </button>-->
<button type="primary" size="mini" @click="handleBack"></button>
</view>
</view>
</view>
</template>
<script>
import useUserStore from "@/store/modules/user";
import {processTypes, groupTypes} from "@/api/system/dict/data";
import {getOrgList, getProductList, createReport, getPlanProductList} from "@/api/mes/organization"
import {getCurrentDate, timestampToTime} from "@/utils/dateUtil"
import {showConfirm} from "@/utils/common";
import tab from "@/plugins/tab";
import modal from "@/plugins/modal";
import {getById, getDetailByReportId, update} from "@/api/mes/report";
const userStore = useUserStore()
export default {
components: {},
data() {
return {
//
customFormData: {
id: undefined,
name: userStore.name,
userId: userStore.userId,
orgId: undefined,
orgType: undefined,
reportTime: undefined,
totalTime: 0,
reportStatus: undefined,
remark: undefined,
groupType: undefined,
reportType: undefined,
reportDateString: getCurrentDate(),
reportDate: undefined,
produceReportDetails: []
},
//
customRules: {
userId: {rules: [{required: true, errorMessage: '姓名不能为空'}]},
orgId: {rules: [{required: true, errorMessage: '工位不能为空'}]},
orgType: {rules: [{required: true, errorMessage: '工序不能为空'}]},
reportDateString: {rules: [{required: true, errorMessage: '报工日期不能为空'}]},
totalTime: {rules: [{required: true, errorMessage: '总计时不能为空'},
{format: 'number', errorMessage: '总计时格式错误,应填计时小时数'}]},
groupType: {rules: [{required: true, errorMessage: '班别不能为空'}]},
produceReportDetails: {rules: [
{format: 'array', errorMessage: '产品列表格式错误'},
{validateFunction: function(rule, value, data, callback) {
if (value.length < 2) {
callback('产品信息不能为空')
}
return true
}
}]
}
},
orgIdList:[],
planProductList:[],
updateId: undefined
}
},
computed: {
},
onLoad() {
this.getOrgIdList()
// this.getPlanProductList()
this.updateId = tab.getParams()
if(this.updateId){
this.disableEnable = true
//
getById(this.updateId).then(response => {
this.customFormData = response.data
this.customFormData.reportDateString = timestampToTime(this.customFormData.reportDate)
getDetailByReportId(this.updateId).then(res => {
this.customFormData.produceReportDetails = res.data
})
this.getPlanProductList()
})
}
},
onReady() {
//
this.$refs.customForm.setRules(this.customRules)
},
methods: {
processTypes() {
return processTypes
},
groupTypes() {
return groupTypes
},
submit(ref) {
if(this.customFormData.reportDateString.length<11)this.customFormData.reportDateString+=' 00:00:00';
this.customFormData.reportType = '个人';
console.log(this.customFormData);
this.$refs[ref].validate().then(res => {
var ok = 1;
if(this.customFormData.produceReportDetails && this.customFormData.produceReportDetails.length > 0) {
for (let i = 0; i < this.customFormData.produceReportDetails.length; i++) {
if(!this.customFormData.produceReportDetails[i].planId || this.customFormData.produceReportDetails[i].planId===''
|| !this.customFormData.produceReportDetails[i].qualityNumber|| this.customFormData.produceReportDetails[i].qualityNumber <= 0) {
ok = 0;
uni.showToast({
title: `产品信息不能为空!`,
icon: 'error'
})
break;
}
}
}
if(ok===1){
showConfirm("确认保存生产报工单吗?").then(res => {
if (res.confirm) {
if(this.updateId){
this.customFormData.id = this.updateId
update(this.customFormData).then(response => {
modal.msgSuccess("修改成功")
tab.navigateBack()
})
}else {
this.customFormData.id = null
createReport(this.customFormData).then(response => {
modal.msgSuccess("保存成功")
tab.switchTab('/pages/report')
})
}
}
})
}
}).catch(err => {
console.log('err', err);
})
},
maskClick(e){
this.customFormData.reportDateString =e
this.getOrgIdList()
},
getOrgIdList() {
let data = {
'orgType': this.customFormData.orgType,
'reportDate': this.customFormData.reportDateString+" 00:00:00",
'groupType': this.customFormData.groupType
}
getOrgList(data).then(response => {
this.orgIdList = response.data;
if(!this.orgIdList || this.orgIdList.length===0){
uni.showToast({
title: '日期:'+this.customFormData.reportDateString+`未查询到工位安排!`,
icon: 'error'
})
}
else if(this.orgIdList.length===1){
this.customFormData.orgId = this.orgIdList[0].value
}
})
},
getPlanProductList() {
if(this.customFormData.orgType)
getPlanProductList(this.customFormData.orgType).then(response => {
this.planProductList = response.data;
if(!this.planProductList || this.orgIdList.planProductList===0){}
})
},
add() {
if(this.customFormData.orgType){
this.customFormData.produceReportDetails.push({
id: Date.now(),
productId: undefined,
planId: undefined,
qualityNumber: 0,
wasteNumber: 0,
totalNumber: 0,
qualityRate:0,
packageNumber: 0,
remark: ''
})
}else{
uni.showToast({
title: `请先选择工序!`,
icon: 'error'
})
}
},
del(id) {
let index = this.customFormData.produceReportDetails.findIndex(v => v.id === id)
this.customFormData.produceReportDetails.splice(index, 1)
},
changeNumber(id){
let index = this.customFormData.produceReportDetails.findIndex(v => v.id === id)
if(!this.customFormData.produceReportDetails[index].qualityNumber)
this.customFormData.produceReportDetails[index].qualityNumber=0;
if(!this.customFormData.produceReportDetails[index].wasteNumber)
this.customFormData.produceReportDetails[index].wasteNumber=0;
this.customFormData.produceReportDetails[index].totalNumber =
Number(this.customFormData.produceReportDetails[index].qualityNumber) + Number(this.customFormData.produceReportDetails[index].wasteNumber);
this.customFormData.produceReportDetails[index].qualityRate =
(Number(this.customFormData.produceReportDetails[index].qualityNumber)*100/Number(this.customFormData.produceReportDetails[index].totalNumber)).toFixed(2);
},
handleOrgTypeChange(e){
console.log(e)
this.getPlanProductList()
},
handleBack(){
tab.navigateBack()
}
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
.uni-group-title{
padding-top: 5px;
background-color: #f4c7c7;
}
</style>

@ -19,20 +19,20 @@
<uni-forms-item v-if="customFormData.userId && customFormData.reportDateString" label="工位" required name="orgId"> <uni-forms-item v-if="customFormData.userId && customFormData.reportDateString" label="工位" required name="orgId">
<uni-data-select v-model="customFormData.orgId" :localdata="orgIdList" :disabled="disableEnable" ></uni-data-select> <uni-data-select v-model="customFormData.orgId" :localdata="orgIdList" :disabled="disableEnable" ></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="计时段" name="reportTime"> <uni-forms-item label="计时段" name="reportTime">
<uni-easyinput type="text" v-model="customFormData.reportTime" placeholder="如:8:00-12:00" /> <uni-easyinput type="text" v-model="customFormData.reportTime" placeholder="如:8:00-12:00" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="/h" required name="totalTime"> <uni-forms-item label="计时/h" required name="totalTime">
<uni-easyinput type="number" v-model="customFormData.totalTime" placeholder="" /> <uni-easyinput type="number" v-model="customFormData.totalTime" placeholder="" />
</uni-forms-item> </uni-forms-item>
<uni-group title="card 模式" mode="card" v-for="(item,index) in customFormData.productList" :key="item.id" <uni-group title="card 模式" mode="card" v-for="(item,index) in customFormData.produceReportDetails" :key="item.id"
:name="['productList',index,'value']"> :name="['produceReportDetails',index,'value']">
<template v-slot:title> <template v-slot:title>
<view class="uni-group-title"> <view class="uni-group-title">
<uni-row> <uni-row>
<uni-col :span="20"> <uni-col :span="20">
<uni-forms-item label="产品" required name="planId"> <uni-forms-item label="产品" required name="planId">
<uni-data-select v-model="customFormData.productList[index].planId" :localdata="planProductList" @change="handleProductChange"></uni-data-select> <uni-data-select v-model="customFormData.produceReportDetails[index].planId" :localdata="planProductList" @change="handleProductChange"></uni-data-select>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="4" align="center"> <uni-col :span="4" align="center">
@ -44,36 +44,36 @@
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="成品数" required name="qualityNumber"> <uni-forms-item label="成品数" required name="qualityNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].qualityNumber" @change="changeNumber(item.id)"/> <uni-easyinput type="number" v-model="customFormData.produceReportDetails[index].qualityNumber" @change="changeNumber(item.id)"/>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="废品数" name="wasteNumber"> <uni-forms-item label="废品数" name="wasteNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].wasteNumber" @change="changeNumber(item.id)"/> <uni-easyinput type="number" v-model="customFormData.produceReportDetails[index].wasteNumber" @change="changeNumber(item.id)"/>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="总数" name="totalNumber"> <uni-forms-item label="总数" name="totalNumber">
<uni-easyinput disabled v-model="customFormData.productList[index].totalNumber" placeholder="" /> <uni-easyinput disabled v-model="customFormData.produceReportDetails[index].totalNumber" placeholder="" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="成品率%" required name="qualityRate"> <uni-forms-item label="成品率%" required name="qualityRate">
<uni-easyinput disabled type="number" v-model="customFormData.productList[index].qualityRate" /> <uni-easyinput disabled type="number" v-model="customFormData.produceReportDetails[index].qualityRate" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="打包数" name="packageNumber"> <uni-forms-item label="打包数" name="packageNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].packageNumber" /> <uni-easyinput type="number" v-model="customFormData.produceReportDetails[index].packageNumber" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="备注" name="remark"> <uni-forms-item label="备注" name="remark">
<uni-easyinput type="text" v-model="customFormData.productList[index].remark" /> <uni-easyinput type="text" v-model="customFormData.produceReportDetails[index].remark" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
@ -124,7 +124,7 @@ export default {
reportType: undefined, reportType: undefined,
reportDateString: getCurrentDate(), reportDateString: getCurrentDate(),
reportDate: undefined, reportDate: undefined,
productList: [] produceReportDetails: []
}, },
// //
customRules: { customRules: {
@ -135,7 +135,7 @@ export default {
totalTime: {rules: [{required: true, errorMessage: '计件时间不能为空'}, totalTime: {rules: [{required: true, errorMessage: '计件时间不能为空'},
{format: 'number', errorMessage: '计件时间格式错误,应填计件小时数'}]}, {format: 'number', errorMessage: '计件时间格式错误,应填计件小时数'}]},
groupType: {rules: [{required: true, errorMessage: '班别不能为空'}]}, groupType: {rules: [{required: true, errorMessage: '班别不能为空'}]},
productList: {rules: [ produceReportDetails: {rules: [
{format: 'array', errorMessage: '产品列表格式错误'}, {format: 'array', errorMessage: '产品列表格式错误'},
{validateFunction: function(rule, value, data, callback) { {validateFunction: function(rule, value, data, callback) {
console.log('value:'+value) console.log('value:'+value)
@ -167,11 +167,16 @@ export default {
getById(this.updateId).then(response => { getById(this.updateId).then(response => {
this.customFormData = response.data this.customFormData = response.data
this.customFormData.reportDateString = timestampToTime(this.customFormData.reportDate) this.customFormData.reportDateString = timestampToTime(this.customFormData.reportDate)
// this.getOrgIdList() //
this.getOrgIdList()
//
this.getPlanProductList()
getDetailByReportId(this.updateId).then(res => { getDetailByReportId(this.updateId).then(res => {
this.customFormData.productList = res.data this.customFormData.produceReportDetails = res.data
}) })
}) })
} }
}, },
onReady() { onReady() {
@ -187,10 +192,10 @@ export default {
console.log(this.customFormData); console.log(this.customFormData);
this.$refs[ref].validate().then(res => { this.$refs[ref].validate().then(res => {
var ok = 1; var ok = 1;
if(this.customFormData.productList && this.customFormData.productList.length > 0) { if(this.customFormData.produceReportDetails && this.customFormData.produceReportDetails.length > 0) {
for (let i = 0; i < this.customFormData.productList.length; i++) { for (let i = 0; i < this.customFormData.produceReportDetails.length; i++) {
if(!this.customFormData.productList[i].planId || this.customFormData.productList[i].planId==='' if(!this.customFormData.produceReportDetails[i].planId || this.customFormData.produceReportDetails[i].planId===''
|| !this.customFormData.productList[i].qualityNumber|| this.customFormData.productList[i].qualityNumber <= 0) { || !this.customFormData.produceReportDetails[i].qualityNumber|| this.customFormData.produceReportDetails[i].qualityNumber <= 0) {
ok = 0; ok = 0;
uni.showToast({ uni.showToast({
title: `产品信息不能为空!`, title: `产品信息不能为空!`,
@ -229,7 +234,6 @@ export default {
this.getOrgIdList() this.getOrgIdList()
}, },
getOrgIdList() { getOrgIdList() {
this.customFormData.orgId = undefined
let dateStr = this.customFormData.reportDateString.length < 11 ? let dateStr = this.customFormData.reportDateString.length < 11 ?
this.customFormData.reportDateString+" 00:00:00": this.customFormData.reportDateString; this.customFormData.reportDateString+" 00:00:00": this.customFormData.reportDateString;
let data = { let data = {
@ -246,6 +250,7 @@ export default {
icon: 'error' icon: 'error'
}) })
} }
if(this.updateId){}
else if(this.orgIdList.length===1){ else if(this.orgIdList.length===1){
this.customFormData.orgId = this.orgIdList[0].value this.customFormData.orgId = this.orgIdList[0].value
} }
@ -265,7 +270,7 @@ export default {
}, },
add() { add() {
if(this.customFormData.orgType){ if(this.customFormData.orgType){
this.customFormData.productList.push({ this.customFormData.produceReportDetails.push({
id: Date.now(), id: Date.now(),
productId: undefined, productId: undefined,
planId: undefined, planId: undefined,
@ -284,20 +289,20 @@ export default {
} }
}, },
del(id) { del(id) {
let index = this.customFormData.productList.findIndex(v => v.id === id) let index = this.customFormData.produceReportDetails.findIndex(v => v.id === id)
this.customFormData.productList.splice(index, 1) this.customFormData.produceReportDetails.splice(index, 1)
}, },
changeNumber(id){ changeNumber(id){
let index = this.customFormData.productList.findIndex(v => v.id === id) let index = this.customFormData.produceReportDetails.findIndex(v => v.id === id)
if(!this.customFormData.productList[index].qualityNumber) if(!this.customFormData.produceReportDetails[index].qualityNumber)
this.customFormData.productList[index].qualityNumber=0; this.customFormData.produceReportDetails[index].qualityNumber=0;
if(!this.customFormData.productList[index].wasteNumber) if(!this.customFormData.produceReportDetails[index].wasteNumber)
this.customFormData.productList[index].wasteNumber=0; this.customFormData.produceReportDetails[index].wasteNumber=0;
this.customFormData.productList[index].totalNumber = this.customFormData.produceReportDetails[index].totalNumber =
Number(this.customFormData.productList[index].qualityNumber) + Number(this.customFormData.productList[index].wasteNumber); Number(this.customFormData.produceReportDetails[index].qualityNumber) + Number(this.customFormData.produceReportDetails[index].wasteNumber);
this.customFormData.productList[index].qualityRate = this.customFormData.produceReportDetails[index].qualityRate =
(Number(this.customFormData.productList[index].qualityNumber)*100/Number(this.customFormData.productList[index].totalNumber)).toFixed(2); (Number(this.customFormData.produceReportDetails[index].qualityNumber)*100/Number(this.customFormData.produceReportDetails[index].totalNumber)).toFixed(2);
}, },
handleUserChange(e){ handleUserChange(e){
this.customFormData.userId = e this.customFormData.userId = e

@ -18,23 +18,23 @@
<uni-forms-item label="工位" required name="orgId"> <uni-forms-item label="工位" required name="orgId">
<uni-data-select v-model="customFormData.orgId" :localdata="orgIdList"></uni-data-select> <uni-data-select v-model="customFormData.orgId" :localdata="orgIdList"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="计时段" name="reportTime"> <uni-forms-item label="计时段" name="reportTime">
<uni-easyinput type="text" v-model="customFormData.reportTime" placeholder="如:8:00-12:00" /> <uni-easyinput type="text" v-model="customFormData.reportTime" placeholder="如:8:00-12:00" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="/h" required name="totalTime"> <uni-forms-item label="计时/h" required name="totalTime">
<uni-easyinput type="number" v-model="customFormData.totalTime" placeholder="" /> <uni-easyinput type="number" v-model="customFormData.totalTime" placeholder="" />
</uni-forms-item> </uni-forms-item>
<uni-group title="card 模式" mode="card" v-for="(item,index) in customFormData.productList" :key="item.id" <uni-group title="card 模式" mode="card" v-for="(item,index) in customFormData.produceReportDetails" :key="item.id"
:name="['productList',index,'value']"> :name="['produceReportDetails',index,'value']">
<template v-slot:title> <template v-slot:title>
<view class="uni-group-title"> <view class="uni-group-title">
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="20">
<uni-forms-item label="产品" required name="planId"> <uni-forms-item label="产品" required name="planId">
<uni-data-select v-model="customFormData.productList[index].planId" :localdata="planProductList"></uni-data-select> <uni-data-select v-model="customFormData.produceReportDetails[index].planId" :localdata="planProductList"></uni-data-select>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12" align="center"> <uni-col :span="4" align="center">
<!-- <button class="button" size="mini" type="warn" @click="del(item.id)"></button>--> <!-- <button class="button" size="mini" type="warn" @click="del(item.id)"></button>-->
<uni-icons type="trash" size="25" color="red" @click="del(item.id)"></uni-icons> <uni-icons type="trash" size="25" color="red" @click="del(item.id)"></uni-icons>
</uni-col> </uni-col>
@ -44,36 +44,36 @@
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="成品数" required name="qualityNumber"> <uni-forms-item label="成品数" required name="qualityNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].qualityNumber" @change="changeNumber(item.id)"/> <uni-easyinput type="number" v-model="customFormData.produceReportDetails[index].qualityNumber" @change="changeNumber(item.id)"/>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="废品数" name="wasteNumber"> <uni-forms-item label="废品数" name="wasteNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].wasteNumber" @change="changeNumber(item.id)"/> <uni-easyinput type="number" v-model="customFormData.produceReportDetails[index].wasteNumber" @change="changeNumber(item.id)"/>
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="总数" name="totalNumber"> <uni-forms-item label="总数" name="totalNumber">
<uni-easyinput disabled v-model="customFormData.productList[index].totalNumber" placeholder="" /> <uni-easyinput disabled v-model="customFormData.produceReportDetails[index].totalNumber" placeholder="" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="成品率%" required name="qualityRate"> <uni-forms-item label="成品率%" required name="qualityRate">
<uni-easyinput disabled type="number" v-model="customFormData.productList[index].qualityRate" /> <uni-easyinput disabled type="number" v-model="customFormData.produceReportDetails[index].qualityRate" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row> <uni-row>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="打包数" name="packageNumber"> <uni-forms-item label="打包数" name="packageNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].packageNumber" /> <uni-easyinput type="number" v-model="customFormData.produceReportDetails[index].packageNumber" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
<uni-col :span="12"> <uni-col :span="12">
<uni-forms-item label="备注" name="remark"> <uni-forms-item label="备注" name="remark">
<uni-easyinput type="text" v-model="customFormData.productList[index].remark" /> <uni-easyinput type="text" v-model="customFormData.produceReportDetails[index].remark" />
</uni-forms-item> </uni-forms-item>
</uni-col> </uni-col>
</uni-row> </uni-row>
@ -95,10 +95,11 @@
import useUserStore from "@/store/modules/user"; import useUserStore from "@/store/modules/user";
import {processTypes, groupTypes} from "@/api/system/dict/data"; import {processTypes, groupTypes} from "@/api/system/dict/data";
import {getOrgList, getProductList, createReport, getPlanProductList} from "@/api/mes/organization" import {getOrgList, getProductList, createReport, getPlanProductList} from "@/api/mes/organization"
import {getCurrentDate} from "@/utils/dateUtil" import {getCurrentDate, timestampToTime} from "@/utils/dateUtil"
import {showConfirm} from "@/utils/common"; import {showConfirm} from "@/utils/common";
import tab from "@/plugins/tab"; import tab from "@/plugins/tab";
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
import {getById, getDetailByReportId, update} from "@/api/mes/report";
const userStore = useUserStore() const userStore = useUserStore()
export default { export default {
components: {}, components: {},
@ -119,7 +120,7 @@ export default {
reportType: undefined, reportType: undefined,
reportDateString: getCurrentDate(), reportDateString: getCurrentDate(),
reportDate: undefined, reportDate: undefined,
productList: [] produceReportDetails: []
}, },
// //
customRules: { customRules: {
@ -127,10 +128,10 @@ export default {
orgId: {rules: [{required: true, errorMessage: '工位不能为空'}]}, orgId: {rules: [{required: true, errorMessage: '工位不能为空'}]},
orgType: {rules: [{required: true, errorMessage: '工序不能为空'}]}, orgType: {rules: [{required: true, errorMessage: '工序不能为空'}]},
reportDateString: {rules: [{required: true, errorMessage: '报工日期不能为空'}]}, reportDateString: {rules: [{required: true, errorMessage: '报工日期不能为空'}]},
totalTime: {rules: [{required: true, errorMessage: '不能为空'}, totalTime: {rules: [{required: true, errorMessage: '计时不能为空'},
{format: 'number', errorMessage: '计件时间格式错误,应填计件小时数'}]}, {format: 'number', errorMessage: '总计时格式错误,应填计时小时数'}]},
groupType: {rules: [{required: true, errorMessage: '班别不能为空'}]}, groupType: {rules: [{required: true, errorMessage: '班别不能为空'}]},
productList: {rules: [ produceReportDetails: {rules: [
{format: 'array', errorMessage: '产品列表格式错误'}, {format: 'array', errorMessage: '产品列表格式错误'},
{validateFunction: function(rule, value, data, callback) { {validateFunction: function(rule, value, data, callback) {
if (value.length < 2) { if (value.length < 2) {
@ -142,7 +143,8 @@ export default {
} }
}, },
orgIdList:[], orgIdList:[],
planProductList:[] planProductList:[],
updateId: undefined
} }
}, },
computed: { computed: {
@ -150,6 +152,20 @@ export default {
onLoad() { onLoad() {
this.getOrgIdList() this.getOrgIdList()
// this.getPlanProductList() // this.getPlanProductList()
this.updateId = tab.getParams()
if(this.updateId){
this.disableEnable = true
//
getById(this.updateId).then(response => {
this.customFormData = response.data
this.customFormData.reportDateString = timestampToTime(this.customFormData.reportDate)
getDetailByReportId(this.updateId).then(res => {
this.customFormData.produceReportDetails = res.data
})
this.getPlanProductList()
})
}
}, },
onReady() { onReady() {
// //
@ -168,10 +184,10 @@ export default {
console.log(this.customFormData); console.log(this.customFormData);
this.$refs[ref].validate().then(res => { this.$refs[ref].validate().then(res => {
var ok = 1; var ok = 1;
if(this.customFormData.productList && this.customFormData.productList.length > 0) { if(this.customFormData.produceReportDetails && this.customFormData.produceReportDetails.length > 0) {
for (let i = 0; i < this.customFormData.productList.length; i++) { for (let i = 0; i < this.customFormData.produceReportDetails.length; i++) {
if(!this.customFormData.productList[i].planId || this.customFormData.productList[i].planId==='' if(!this.customFormData.produceReportDetails[i].planId || this.customFormData.produceReportDetails[i].planId===''
|| !this.customFormData.productList[i].qualityNumber|| this.customFormData.productList[i].qualityNumber <= 0) { || !this.customFormData.produceReportDetails[i].qualityNumber|| this.customFormData.produceReportDetails[i].qualityNumber <= 0) {
ok = 0; ok = 0;
uni.showToast({ uni.showToast({
title: `产品信息不能为空!`, title: `产品信息不能为空!`,
@ -184,11 +200,20 @@ export default {
if(ok===1){ if(ok===1){
showConfirm("确认保存生产报工单吗?").then(res => { showConfirm("确认保存生产报工单吗?").then(res => {
if (res.confirm) { if (res.confirm) {
if(this.updateId){
this.customFormData.id = this.updateId
update(this.customFormData).then(response => {
modal.msgSuccess("修改成功")
tab.navigateBack()
})
}else {
this.customFormData.id = null
createReport(this.customFormData).then(response => { createReport(this.customFormData).then(response => {
modal.msgSuccess("保存成功") modal.msgSuccess("保存成功")
tab.switchTab('/pages/report') tab.switchTab('/pages/report')
}) })
} }
}
}) })
} }
}).catch(err => { }).catch(err => {
@ -227,7 +252,7 @@ export default {
}, },
add() { add() {
if(this.customFormData.orgType){ if(this.customFormData.orgType){
this.customFormData.productList.push({ this.customFormData.produceReportDetails.push({
id: Date.now(), id: Date.now(),
productId: undefined, productId: undefined,
planId: undefined, planId: undefined,
@ -246,20 +271,20 @@ export default {
} }
}, },
del(id) { del(id) {
let index = this.customFormData.productList.findIndex(v => v.id === id) let index = this.customFormData.produceReportDetails.findIndex(v => v.id === id)
this.customFormData.productList.splice(index, 1) this.customFormData.produceReportDetails.splice(index, 1)
}, },
changeNumber(id){ changeNumber(id){
let index = this.customFormData.productList.findIndex(v => v.id === id) let index = this.customFormData.produceReportDetails.findIndex(v => v.id === id)
if(!this.customFormData.productList[index].qualityNumber) if(!this.customFormData.produceReportDetails[index].qualityNumber)
this.customFormData.productList[index].qualityNumber=0; this.customFormData.produceReportDetails[index].qualityNumber=0;
if(!this.customFormData.productList[index].wasteNumber) if(!this.customFormData.produceReportDetails[index].wasteNumber)
this.customFormData.productList[index].wasteNumber=0; this.customFormData.produceReportDetails[index].wasteNumber=0;
this.customFormData.productList[index].totalNumber = this.customFormData.produceReportDetails[index].totalNumber =
Number(this.customFormData.productList[index].qualityNumber) + Number(this.customFormData.productList[index].wasteNumber); Number(this.customFormData.produceReportDetails[index].qualityNumber) + Number(this.customFormData.produceReportDetails[index].wasteNumber);
this.customFormData.productList[index].qualityRate = this.customFormData.produceReportDetails[index].qualityRate =
(Number(this.customFormData.productList[index].qualityNumber)*100/Number(this.customFormData.productList[index].totalNumber)).toFixed(2); (Number(this.customFormData.produceReportDetails[index].qualityNumber)*100/Number(this.customFormData.produceReportDetails[index].totalNumber)).toFixed(2);
}, },
handleOrgTypeChange(e){ handleOrgTypeChange(e){
console.log(e) console.log(e)

@ -51,6 +51,12 @@
"navigationBarTitleText": "浏览文本" "navigationBarTitleText": "浏览文本"
} }
}, },
{
"path": "pages/template",
"style": {
"navigationBarTitleText": "模板"
}
},
{ {
"path": "pages/report", "path": "pages/report",
"style": { "style": {
@ -69,6 +75,12 @@
"navigationBarTitleText": "生产报工" "navigationBarTitleText": "生产报工"
} }
}, },
{
"path": "ViewForm",
"style": {
"navigationBarTitleText": "报工详情"
}
},
{ {
"path": "replaceForm", "path": "replaceForm",
"style": { "style": {
@ -303,6 +315,12 @@
"selectedIconPath": "static/images/tabbar/work_.png", "selectedIconPath": "static/images/tabbar/work_.png",
"text": "投料" "text": "投料"
}, },
{
"pagePath": "pages/template",
"iconPath": "static/images/tabbar/work.png",
"selectedIconPath": "static/images/tabbar/work_.png",
"text": "模板"
},
{ {
"pagePath": "pages/mine", "pagePath": "pages/mine",
"iconPath": "static/images/tabbar/mine.png", "iconPath": "static/images/tabbar/mine.png",

@ -7,16 +7,16 @@
<el-collapse-item v-for="(item, index) in startList" :name="item.id"> <el-collapse-item v-for="(item, index) in startList" :name="item.id">
<template #title> <template #title>
<el-icon><Tickets /></el-icon> <el-icon><Tickets /></el-icon>
<el-text type="success">{{item.code}}</el-text>- <el-text size="large">{{item.productName}}</el-text>&nbsp;/&nbsp;
<el-text size="large">{{item.productName}}</el-text> <el-text type="success">计划数:{{ item.planNumber }}</el-text>
</template> </template>
<el-row> <el-row>
<el-col :span="8">
<el-text type="success">{{item.code}}</el-text>-
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text> <el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text>
</el-col> </el-col>
<el-col :span="8">
<el-text type="success">计划数:{{ item.planNumber }}</el-text>
</el-col>
<el-col v-if="auth.hasPermi('mes:plan:update')" :span="4"> <el-col v-if="auth.hasPermi('mes:plan:update')" :span="4">
<el-button type="success" plain @click="updatePlan(item.id, item.code,'end')">完工</el-button> <el-button type="success" plain @click="updatePlan(item.id, item.code,'end')">完工</el-button>
</el-col> </el-col>
@ -49,16 +49,16 @@
<el-collapse-item v-for="(item, index) in paigongList" :name="item.id"> <el-collapse-item v-for="(item, index) in paigongList" :name="item.id">
<template #title> <template #title>
<el-icon><Tickets /></el-icon> <el-icon><Tickets /></el-icon>
<el-text type="success">{{item.code}}</el-text>- <el-text size="large">{{item.productName}}</el-text>&nbsp;/&nbsp;
<el-text size="large">{{item.productName}}</el-text> <el-text type="success">计划数:{{ item.planNumber }}</el-text>
</template> </template>
<el-row> <el-row>
<el-col :span="8">
<el-text type="success">{{item.code}}</el-text>-
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text> <el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text>
</el-col> </el-col>
<el-col :span="8">
<el-text type="success">计划数:{{ item.planNumber }}</el-text>
</el-col>
<el-col v-if="auth.hasPermi('mes:plan:update')" :span="4"> <el-col v-if="auth.hasPermi('mes:plan:update')" :span="4">
<el-button type="info" plain @click="updatePlan(item.id,item.code, 'start')">开工</el-button> <el-button type="info" plain @click="updatePlan(item.id,item.code, 'start')">开工</el-button>
</el-col> </el-col>
@ -77,16 +77,16 @@
<el-collapse-item v-for="(item, index) in planList" :name="item.id"> <el-collapse-item v-for="(item, index) in planList" :name="item.id">
<template #title> <template #title>
<el-icon><Tickets /></el-icon> <el-icon><Tickets /></el-icon>
<el-text type="success">{{item.code}}</el-text>- <el-text size="large">{{item.productName}}</el-text>&nbsp;/&nbsp;
<el-text size="large">{{item.productName}}</el-text> <el-text type="success">计划数:{{ item.planNumber }}</el-text>
</template> </template>
<el-row> <el-row>
<el-col :span="8">
<el-text type="success">{{item.code}}</el-text>-
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text> <el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text>
</el-col> </el-col>
<el-col :span="8">
<el-text type="success">计划数:{{ item.planNumber }}</el-text>
</el-col>
<el-col v-if="auth.hasPermi('mes:plan:update')" :span="4"> <el-col v-if="auth.hasPermi('mes:plan:update')" :span="4">
<el-button type="primary" plain>派工</el-button> <el-button type="primary" plain>派工</el-button>
</el-col> </el-col>
@ -105,16 +105,16 @@
<el-collapse-item v-for="(item, index) in pauseList" :name="item.id"> <el-collapse-item v-for="(item, index) in pauseList" :name="item.id">
<template #title> <template #title>
<el-icon><Tickets /></el-icon> <el-icon><Tickets /></el-icon>
<el-text type="success">{{item.code}}</el-text>- <el-text size="large">{{item.productName}}</el-text>&nbsp;/&nbsp;
<el-text size="large">{{item.productName}}</el-text> <el-text type="success">计划数:{{ item.planNumber }}</el-text>
</template> </template>
<el-row> <el-row>
<el-col :span="8">
<el-text type="success">{{item.code}}</el-text>-
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text> <el-text type="success">计划开始:{{ timestampToTime(item.planStartTime) }}</el-text>
</el-col> </el-col>
<el-col :span="8">
<el-text type="success">计划数:{{ item.planNumber }}</el-text>
</el-col>
<el-col v-if="auth.hasPermi('mes:plan:update')" :span="4"> <el-col v-if="auth.hasPermi('mes:plan:update')" :span="4">
<el-button type="success" plain @click="updatePlan(item.id,item.code, 'end')">完工</el-button> <el-button type="success" plain @click="updatePlan(item.id,item.code, 'end')">完工</el-button>
</el-col> </el-col>

@ -49,8 +49,8 @@ const captchaEnabled = ref(false); // 是否开启验证码
const globalConfig = ref(config); const globalConfig = ref(config);
const loginForm = ref({ const loginForm = ref({
tenantName: '内蒙必硕', tenantName: '内蒙必硕',
username: "admin", username: "",
password: "admin123", password: "",
captchaVerification: '', captchaVerification: '',
rememberMe: '', rememberMe: '',
code: '', code: '',

@ -21,8 +21,9 @@
<!-- 自定义 footer--> <!-- 自定义 footer-->
<template v-slot:footer> <template v-slot:footer>
<el-button v-if="item.reportStatus === 0" type="primary" size="small" :icon="Edit" circle @click="editOrAddReport(item.id)"/> <el-button v-if="item.reportStatus === 0" type="primary" size="small" :icon="Edit" circle @click="editOrAddReport(item.id)"/>
<el-button v-if="item.reportStatus === 0" type="success" size="small" :icon="Check" circle @click="updateReport(item.id)"/> <el-button v-if="item.reportStatus === 0" type="success" size="small" :icon="Check" circle @click="updateReport(item.id,1,'提交')"/>
<el-button v-if="item.reportStatus < 2" type="danger" size="small" :icon="Delete" circle @click="deleteReport(item.id)"/> <el-button v-if="item.reportStatus === 0" type="danger" size="small" :icon="Delete" circle @click="deleteReport(item.id)"/>
<el-button v-if="item.reportStatus >= 1" type="primary" size="small" :icon="View" circle @click="handleView(item.id)"/>
</template> </template>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
@ -65,10 +66,11 @@
</template> </template>
<!-- 自定义 footer--> <!-- 自定义 footer-->
<template v-slot:footer> <template v-slot:footer>
<el-button v-if="item.reportStatus === 0" type="primary" size="small" :icon="Edit" circle @click="addReplaceReport(item.id)"/> <el-button v-if="item.reportStatus < 2" type="primary" size="small" :icon="Edit" circle @click="addReplaceReport(item.id)"/>
<el-button v-if="item.reportStatus === 0" type="success" size="small" :icon="Promotion" circle @click="updateReport(item.id,1,'提交')"/> <el-button v-if="item.reportStatus === 0" type="success" size="small" :icon="Promotion" circle @click="updateReport(item.id,1,'提交')"/>
<el-button v-if="item.reportStatus === 1" type="success" size="small" :icon="Check" circle @click="updateReport(item.id,2,'通过')"/> <el-button v-if="item.reportStatus === 1" type="success" size="small" :icon="Check" circle @click="updateReport(item.id,2,'通过')"/>
<el-button v-if="item.reportStatus < 2" type="danger" size="small" :icon="Delete" circle @click="deleteReport(item.id)"/> <el-button v-if="item.reportStatus < 2" type="danger" size="small" :icon="Delete" circle @click="deleteReport(item.id)"/>
</template> </template>
</uni-list-item> </uni-list-item>
</uni-list> </uni-list>
@ -130,7 +132,7 @@
<script> <script>
import {getMyList, getOtherList, getById, updateStatus,deleteByReportId } from "@/api/mes/report"; import {getMyList, getOtherList, getById, updateStatus,deleteByReportId } from "@/api/mes/report";
import {Check, Delete, Edit,Promotion,Close} from '@element-plus/icons-vue' import {Check, Delete, Edit,Promotion,Close,View} from '@element-plus/icons-vue'
import tab from "@/plugins/tab"; import tab from "@/plugins/tab";
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
import auth from "@/plugins/auth"; import auth from "@/plugins/auth";
@ -145,10 +147,12 @@ export default {
Promotion() {return Promotion}, Promotion() {return Promotion},
Close() {return Close}, Close() {return Close},
Edit() {return Edit}, Edit() {return Edit},
Check() {return Check} Check() {return Check},
View() {return View}
}, },
data() { data() {
return { return {
currentPaneName: '',
loading: false, loading: false,
reportList: [], reportList: [],
otherReportList: [], otherReportList: [],
@ -178,7 +182,18 @@ export default {
this.loading = false this.loading = false
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log('refresh'); //
if(this.currentPaneName==='third'){
this.getOtherReportList()
}
//
else if(this.currentPaneName==='second'){
this.getReplaceReportList();
}
else {
//
this.getList();
}
setTimeout(function () { setTimeout(function () {
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, 1000); }, 1000);
@ -189,7 +204,7 @@ export default {
}, },
handleTabClick(tab) { handleTabClick(tab) {
this.loading = true this.loading = true
console.log(tab.paneName) this.currentPaneName=tab.paneName
// //
if(tab.paneName==='third'){ if(tab.paneName==='third'){
this.getOtherReportList() this.getOtherReportList()
@ -263,7 +278,7 @@ export default {
}, },
editOrAddReport(id){ editOrAddReport(id){
if(id===null || id===undefined)tab.navigateTo('/page_report/reportForm') if(id===null || id===undefined)tab.navigateTo('/page_report/reportForm')
else tab.navigateTo("",id) else tab.navigateTo('/page_report/reportForm',id)
}, },
addReplaceReport(id){ addReplaceReport(id){
if(id===null || id===undefined)tab.navigateTo('/page_report/replaceForm') if(id===null || id===undefined)tab.navigateTo('/page_report/replaceForm')
@ -286,8 +301,10 @@ export default {
// //
this.getReplaceReportList() this.getReplaceReportList()
this.loading = false this.loading = false
},
handleView(id){
tab.navigateTo('/page_report/ViewForm',id)
} }
} }
}; };

@ -8,14 +8,12 @@
<el-collapse-item v-for="(item, index) in finishList" :name="item.id" @click="handleFinishClick(item.id,index)"> <el-collapse-item v-for="(item, index) in finishList" :name="item.id" @click="handleFinishClick(item.id,index)">
<template #title> <template #title>
<el-icon><Tickets /></el-icon> <el-icon><Tickets /></el-icon>
<el-text type="success">{{timestampToTime(item.feedingTime)}}</el-text>- <el-text type="success">{{timestampToTime(item.feedingTime)}}</el-text>&nbsp;/&nbsp;
<el-text size="large">{{item.feedingRecordCode}}</el-text>- <el-text type="warning">{{ findTextByValue(pipelineTypes, item.feedingPipeline)}}</el-text>&nbsp;/&nbsp;
<el-text type="warning">{{ findTextByValue(pipelineTypes, item.feedingPipeline)}}</el-text> <el-text type="info">{{findTextByValue(feedingTypes, item.feedingType) }}</el-text>
</template> </template>
<el-text size="large">{{item.feedingRecordCode}}</el-text>
<el-row> <el-row>
<el-col :span="6">投料类型:
<el-text type="warning">{{findTextByValue(feedingTypes, item.feedingType) }}</el-text>
</el-col>
<el-col :span="8">记录人: <el-col :span="8">记录人:
<el-text type="success">{{ item.userName }}</el-text> <el-text type="success">{{ item.userName }}</el-text>
</el-col> </el-col>
@ -42,14 +40,12 @@
<el-collapse-item v-for="(item, index) in draftList" :name="item.id" @click="handleDraftClick(item.id,index)"> <el-collapse-item v-for="(item, index) in draftList" :name="item.id" @click="handleDraftClick(item.id,index)">
<template #title> <template #title>
<el-icon><Tickets /></el-icon> <el-icon><Tickets /></el-icon>
<el-text type="success">{{timestampToTime(item.feedingTime)}}</el-text>- <el-text type="success">{{timestampToTime(item.feedingTime)}}</el-text>&nbsp;/&nbsp;
<el-text size="large">{{item.feedingRecordCode}}</el-text>- <el-text type="warning">{{ findTextByValue(pipelineTypes, item.feedingPipeline)}}</el-text>&nbsp;/&nbsp;
<el-text type="warning">{{ findTextByValue(pipelineTypes, item.feedingPipeline)}}</el-text> <el-text type="info">{{findTextByValue(feedingTypes, item.feedingType) }}</el-text>
</template> </template>
<el-text size="large">{{item.feedingRecordCode}}</el-text>
<el-row> <el-row>
<el-col :span="6">投料类型:
<el-text type="warning">{{findTextByValue(feedingTypes, item.feedingType) }}</el-text>
</el-col>
<el-col :span="8">记录人: <el-col :span="8">记录人:
<el-text type="success">{{ item.userName }}</el-text> <el-text type="success">{{ item.userName }}</el-text>
</el-col> </el-col>
@ -76,7 +72,7 @@
</el-row> </el-row>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
<uni-fab ref="fab" :pattern="pattern" @fabClick="handleAdd" /> <uni-fab v-if="auth.hasPermi('mes:feeding-record:create')" ref="fab" :pattern="pattern" @fabClick="handleAdd" />
</view> </view>
</template> </template>
@ -89,7 +85,7 @@ import {Tickets} from "@element-plus/icons-vue";
import modal from "@/plugins/modal"; import modal from "@/plugins/modal";
import tab from "@/plugins/tab"; import tab from "@/plugins/tab";
import {showConfirm} from "@/utils/common"; import {showConfirm} from "@/utils/common";
import auth from "@/plugins/auth";
// //
const finishList = ref([]); const finishList = ref([]);

Loading…
Cancel
Save