Commit 59067845 by zhangzhen

细节优化

parent dfcad55f
...@@ -119,6 +119,11 @@ export const getList = (params,pageData) => { ...@@ -119,6 +119,11 @@ export const getList = (params,pageData) => {
return http.post(url, d) return http.post(url, d)
} }
export const getList2 = (params,pageData) => {
let url = `/service/S_SC_RW_02`
let d = setParamsData(params,pageData)
return http.post(url, d)
}
export const getSubList = (params,pageData) => { export const getSubList = (params,pageData) => {
let url = `/service/S_SC_RW_06` let url = `/service/S_SC_RW_06`
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
countData:{} countData:{}
}; };
}, },
onLoad(option) { onShow() {
this.pageData.offset = 0; this.pageData.offset = 0;
this.onLoading(); this.onLoading();
}, },
......
...@@ -93,7 +93,18 @@ ...@@ -93,7 +93,18 @@
placeholder="请输入任务数量" placeholder="请输入任务数量"
border="surround" border="surround"
:disabled="true" :disabled="true"
v-model="orderInfo.quantity" v-model="orderInfo.taskQuantity"
></u--input>
</view>
<view class="flex-col">
<view class="margin-sm">
<text class="text-black text-title text-lg">任务重量:</text>
</view>
<u--input
placeholder="请输入任务数量"
border="surround"
:disabled="true"
v-model="orderInfo.taskWeight"
></u--input> ></u--input>
</view> </view>
<view class="flex-col"> <view class="flex-col">
...@@ -111,7 +122,31 @@ ...@@ -111,7 +122,31 @@
<u--input <u--input
placeholder="请输入报工数量" placeholder="请输入报工数量"
border="surround" border="surround"
v-model="orderInfo.finishQuantity" v-model="orderInfo.quantity"
@change="onChange"
></u--input>
</view>
<view class="flex-col">
<view class="margin-sm">
<text class="text-black text-title text-lg">报工重量:</text>
</view>
<u--input
placeholder="请输入报工重量"
border="surround"
:disabled="true"
v-model="orderInfo.weight"
></u--input>
</view>
<view v-if="tipShow" class="flex-col">
<view class="margin-sm">
<text class="text-red">*</text>
<text class="text-black text-title text-lg">超报原因:</text>
</view>
<u--input
placeholder="请输入超报原因"
border="surround"
v-model="orderInfo.exceedReason"
></u--input> ></u--input>
</view> </view>
...@@ -125,7 +160,6 @@ ...@@ -125,7 +160,6 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="flex-col content-part-1"> <view class="flex-col content-part-1">
...@@ -149,6 +183,7 @@ ...@@ -149,6 +183,7 @@
} from "@/utils/tools.js"; } from "@/utils/tools.js";
import moment from "@/common/moment.js"; import moment from "@/common/moment.js";
import { import {
getList2,
orderSave orderSave
} from "@/api/product-order.js"; } from "@/api/product-order.js";
...@@ -163,19 +198,47 @@ ...@@ -163,19 +198,47 @@
queryData: {}, queryData: {},
minDate: moment().subtract(1,'M').format("YYYY-MM-DD"), minDate: moment().subtract(1,'M').format("YYYY-MM-DD"),
fileList: [], fileList: [],
id:'',
tipShow:false
}; };
}, },
onLoad() { onLoad(option) {
const eventChannel = this.getOpenerEventChannel(); if(option && option.id){
eventChannel.on('acceptDataFromOpenerPage', (data) => { this.id = option.id
this.onLoading()
}
},
methods: {
onChange(e){
console.log(e,99999)
this.orderInfo.weight = e*Number(this.orderInfo.singleWeight);
if(e > Number(this.orderInfo.unregisterQuantity)){
this.tipShow = true
}else{
this.tipShow = false
this.orderInfo.exceedReason = ''
}
},
onLoading(){
uni.showLoading({
title: "加载中"
})
getList2({
taskId:this.id
}).then(res => {
uni.hideLoading();
if(res.data.__sys__.status === 0){
let rows = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns)
if(rows&&rows.length){
this.orderInfo = { this.orderInfo = {
...data.data, ...rows[0],
registerDate: data.data.registerDate? data.data.registerDate : moment().format("YYYY-MM-DD"), quantity: rows[0].unregisterQuantity,
finishQuantity: '' weight: Number(rows[0].unregisterQuantity)*Number(rows[0].singleWeight)
}; };
}
}
}) })
}, },
methods: {
// 删除图片 // 删除图片
deletePic(event) { deletePic(event) {
this.fileList.splice(event.index, 1) this.fileList.splice(event.index, 1)
...@@ -214,6 +277,13 @@ ...@@ -214,6 +277,13 @@
this.show2 = true; this.show2 = true;
}, },
onOpenTip(){ onOpenTip(){
if(Number(this.orderInfo.quantity) > Number(this.orderInfo.unregisterQuantity) && !this.orderInfo.exceedReason){
uni.showToast({
icon:"none",
title:"请输入超报原因"
})
return
}
this.show = true; this.show = true;
}, },
onCancel(){ onCancel(){
...@@ -231,9 +301,23 @@ ...@@ -231,9 +301,23 @@
title:"提交中..." title:"提交中..."
}) })
orderSave({ orderSave({
taskId: this.orderInfo.id, taskId: this.id,
productCode: this.orderInfo.productCode,
productName: this.orderInfo.productName,
spec: this.orderInfo.spec,
length: this.orderInfo.length,
singleWeight: this.orderInfo.singleWeight,
taskQuantity: this.orderInfo.taskQuantity,
taskWeight: this.orderInfo.taskWeight,
processName:this.orderInfo.processName,
registeredQuantity: this.orderInfo.taskQuantity - this.orderInfo.unregisterQuantity,
registeredWeight: this.orderInfo.registeredWeight,
unregisterQuantity: this.orderInfo.unregisterQuantity,
unregisterWeight: this.orderInfo.unregisterWeight,
groupName: this.orderInfo.groupCode,
quantity: this.orderInfo.quantity,
exceedReason: this.orderInfo.exceedReason||' ',
registerDate: this.orderInfo.registerDate || moment().format("YYYY-MM-DD"), registerDate: this.orderInfo.registerDate || moment().format("YYYY-MM-DD"),
quantity: this.orderInfo.finishQuantity,
docId: this.fileList && this.fileList.length? this.fileList.map(item=>item.id).join():'' docId: this.fileList && this.fileList.length? this.fileList.map(item=>item.id).join():''
}).then(res=>{ }).then(res=>{
if(res.data.__sys__.status===0){ if(res.data.__sys__.status===0){
......
...@@ -7,23 +7,26 @@ ...@@ -7,23 +7,26 @@
</view> </view>
</block> </block>
<block slot="content"> <block slot="content">
<text class="text-white">生产报工</text> <text class="text-white">报工详情</text>
</block> </block>
</cu-custom> </cu-custom>
<view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}"> <view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}">
</view> </view>
<view class="data-content title-view"> <view v-if="orderInfo" class="data-content title-view">
<view class="part-3"> <view class="part-3">
<view class="content-item"> <view class="content-item">
<view class="header-title" @tap="onNavTo"> <view class="header-title">
<image src="../../static/icon5.png" mode="widthFix"></image> <image src="../../static/icon5.png" mode="widthFix"></image>
<view class="flex-between"> <view class="flex-between">
<text class="text-black text-bold">{{orderInfo.productName|| ''}}</text> <text class="text-black text-bold">{{orderInfo.productName|| ''}}</text>
<view class="text-blue margin-right"> <view v-if="Number(orderInfo.unregisterQuantity)>0" class="text-blue margin-right" @tap="onNavTo">
<text class="">报工</text> <text class="">报工</text>
<text class="cuIcon-right"></text> <text class="cuIcon-right"></text>
</view> </view>
<view v-else class="">
</view>
</view> </view>
</view> </view>
...@@ -41,11 +44,11 @@ ...@@ -41,11 +44,11 @@
:class="orderInfo.status==1?'text-red':'text-gray'">{{statusEnum[orderInfo.status]}}</text> :class="orderInfo.status==1?'text-red':'text-gray'">{{statusEnum[orderInfo.status]}}</text>
</view> </view>
</view> </view>
<view class="flex-row"> <!-- <view class="flex-row">
<text class="text-gray part-1">任务单号</text> <text class="text-gray part-1">任务单号</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">{{orderInfo.taskCode}}</text> <text class="text-title">{{orderInfo.taskCode}}</text>
</view> </view> -->
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">公司名称</text> <text class="text-gray part-1">公司名称</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
...@@ -62,29 +65,37 @@ ...@@ -62,29 +65,37 @@
<text class="text-title">{{orderInfo.planEndDate}}</text> <text class="text-title">{{orderInfo.planEndDate}}</text>
</view> </view>
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">任务重量</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{Number(orderInfo.taskWeight)}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">任务数量</text> <text class="text-gray part-1">任务数量</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">{{orderInfo.quantity}}</text> <text class="text-title">{{orderInfo.taskQuantity}}</text>
</view> </view>
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">完工数</text> <text class="text-gray part-1">已报工重</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">{{orderInfo.finishQuantity}}</text> <text class="text-title">{{Number(orderInfo.registeredWeight)}}</text>
</view> </view>
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">完成状态</text> <text class="text-gray part-1">已报工数量</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text <text class="text-title">{{orderInfo.registeredQuantity}}</text>
class="text-title">{{orderInfo.finishQuantity >= orderInfo.quantity? '已完工':'未完工'}}</text> </view>
<view class="flex-row">
<text class="text-gray part-1">待报工数量</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{orderInfo.unregisterQuantity}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">待报工重量</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{Number(orderInfo.unregisterWeight)}}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
...@@ -105,27 +116,15 @@ ...@@ -105,27 +116,15 @@
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">{{item.planEndDate}}</text> <text class="text-title">{{item.planEndDate}}</text>
</view> </view>
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">报工数量</text> <text class="text-gray part-1">报工数量</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-blue text-bold text-xl">{{item.quantity}}</text> <text class="text-blue text-bold text-xl">{{item.quantity}}</text>
</view> </view>
<view class="flex-row"> <view class="flex-row">
<view class="flex-1 flex-row"> <text class="text-gray part-1">报工重量</text>
<text class="text-gray">完工数量:</text> <text class="text-gray part-2">:</text>
<text class="text-blue text-bold text-xl margin-left-sm">{{item.passQuantity}}</text> <text class="text-blue text-bold text-xl">{{Number(item.quantity)*Number(item.singleWeight)}}</text>
</view>
<view class="flex-1 flex-row">
<text class="text-gray">任务数量:</text>
<text class="text-blue text-bold text-xl margin-left-sm">{{orderInfo.quantity}}</text>
</view>
<view class="flex-1 flex-row">
<text class="text-gray">不合格数量:</text>
<text class="text-blue text-bold text-xl margin-left-sm">{{item.unpassQuantity}}</text>
</view>
</view> </view>
<view v-if="item.imgList && item.imgList.length" class="flex-col"> <view v-if="item.imgList && item.imgList.length" class="flex-col">
...@@ -139,19 +138,17 @@ ...@@ -139,19 +138,17 @@
</view> </view>
</view> </view>
</view> </view>
<view v-if="item.exceedReason && item.exceedReason.length>=2" class="flex-row">
<text class="text-gray part-1">超报原因</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.exceedReason}}</text>
</view>
<view class="flex-row"> <view class="flex-row">
<text class="text-gray part-1">报工日期</text> <text class="text-gray part-1">报工日期</text>
<text class="text-gray part-2">:</text> <text class="text-gray part-2">:</text>
<text class="text-title">{{item.createdTime}}</text> <text class="text-title">{{item.createdTime}}</text>
</view> </view>
</view> </view>
</view>
<view v-if="projectDataList.length" style="padding: 12px 6% 0;">
<u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view> </view>
<view v-if="projectDataList.length <= 0" class="empty-box"> <view v-if="projectDataList.length <= 0" class="empty-box">
...@@ -176,14 +173,12 @@ ...@@ -176,14 +173,12 @@
import moment from "@/common/moment.js"; import moment from "@/common/moment.js";
import { import {
getParamsList, getParamsList,
getSubList getSubList,
getList2
} from "@/api/product-order.js"; } from "@/api/product-order.js";
import { import {
getImgInfoList getImgInfoList
} from "@/api/index.js"; } from "@/api/index.js";
import {
getList
} from "@/api/inspection.js";
export default { export default {
data() { data() {
...@@ -191,10 +186,6 @@ ...@@ -191,10 +186,6 @@
assetsPath: config.assetsPath, assetsPath: config.assetsPath,
projectDataList: [], projectDataList: [],
statusBarHeight: uni.getStorageSync("statusHeight") || 0, statusBarHeight: uni.getStorageSync("statusHeight") || 0,
status: 'nomore ',
loadingText: '努力加载中',
loadmoreText: '上划加载',
nomoreText: '到底啦',
showText: false, showText: false,
target: 60, target: 60,
modelVale: 100, modelVale: 100,
...@@ -207,10 +198,6 @@ ...@@ -207,10 +198,6 @@
form: {}, form: {},
factoryIndex: 0, factoryIndex: 0,
factoryList: [], factoryList: [],
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
startTimeStamp: 0,
endTimeStamp: 0,
factoryEnum: {}, factoryEnum: {},
orderInfo: '', orderInfo: '',
tabList: [{ tabList: [{
...@@ -233,66 +220,51 @@ ...@@ -233,66 +220,51 @@
queryData: {}, queryData: {},
pageData: { pageData: {
showCount: "true", showCount: "true",
limit: 20, limit: 500,
offset: 0 offset: 0
}, },
}; };
}, },
onLoad(option) { onLoad(option) {
if (option.id) { if (option.id) {
this.queryData.taskId = option.id; this.queryData.id = option.id;
if (uni.getStorageSync(this.queryData.taskId)) {
this.orderInfo = uni.getStorageSync(this.queryData.taskId)
} }
}
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptDataFromOpenerPage', (data) => {
uni.setStorageSync(this.queryData.taskId, data.data)
this.orderInfo = data.data;
})
}, },
onShow() { onShow() {
this.pageData.offset = 0; this.onGetList()
this.onGetList();
},
onReachBottom() {
if (this.status == 'loadmore') {
this.pageData.offset += 1;
this.onGetList();
}
}, },
methods: { methods: {
onFactoryChange(e) {
this.factoryIndex = e.target.value;
this.pageData.offset = 0;
this.onGetList();
},
onBack() { onBack() {
uni.redirectTo({ uni.redirectTo({
url: "/pages/product-order/list" url: "/pages/product-order/list"
}) })
}, },
onLoading() { onGetList() {
getParamsList().then(res => { uni.showLoading({
this.factoryList = toJsonData(res.data.__blocks__.factory_record_block_id.rows, res.data title: "加载中"
.__blocks__.factory_record_block_id.meta.columns).map(item => {
this.factoryEnum[item.valueField] = item.textField;
return {
label: item.textField,
value: item.valueField
}
}) })
this.$forceUpdate(); getList2({
this.onGetList(); taskId:this.queryData.id
}).then(res => {
if(res.data.__sys__.status === 0){
let rows = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns)
if(rows&&rows.length){
this.orderInfo = rows[0];
console.log(res,9999)
this.onGetSubList()
}
}
}) })
}, },
onGetList() { onGetSubList() {
uni.showLoading({ uni.showLoading({
title: "加载中" title: "加载中"
}) })
getList(this.queryData, this.pageData).then(res => { getSubList({
taskId: this.queryData.id
},this.pageData).then(res => {
uni.hideLoading(); uni.hideLoading();
if(res.data.__sys__.status ===0){
let list = []; let list = [];
let list2 = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns).map(item=>{ let list2 = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns).map(item=>{
let createdTime =item.createdTime? item.createdTime.split(''):[]; let createdTime =item.createdTime? item.createdTime.split(''):[];
...@@ -316,59 +288,14 @@ ...@@ -316,59 +288,14 @@
}):[] }):[]
}) })
}) })
if (this.pageData.offset == 0) {
this.projectDataList = list this.projectDataList = list
} else {
this.projectDataList = [...this.projectDataList, ...list]
}
console.log(this.projectDataList,99999)
if (this.projectDataList.length < res.data.__blocks__.result.attr.count) {
this.status = "loadmore"
} else {
this.status = 'nomore'
} }
}) })
}, },
onChange(e) {
},
onSearchByName() {
this.pageData.offset = 0;
this.onGetList();
},
onChangeTab(e) {
this.current = e.index;
this.pageData.offset = 0;
// this.onGetList();
},
onNavTo() { onNavTo() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product-order/edit`, url: `/pages/product-order/edit?id=${this.queryData.id}`
success: (res) => {
res.eventChannel.emit('acceptDataFromOpenerPage', {
data: this.orderInfo
}) })
}
})
},
onStartFloat(e) {
this.startTimeStamp = moment().valueOf();
this.floatBoxStatus = true
this.floatTop = e.changedTouches[0].clientY - 25 + 'px';
this.floatLeft = e.changedTouches[0].clientX - 25 + 'px';
},
onMoveFloat(e) {
this.floatTop = e.changedTouches[0].clientY - 25 + 'px';
this.floatLeft = e.changedTouches[0].clientX - 25 + 'px';
},
onEndFloat(e) {
this.endTimeStamp = moment().valueOf();
this.floatBoxStatus = false
}, },
onPreview(urls,i){ onPreview(urls,i){
uni.previewImage({ uni.previewImage({
......
...@@ -54,9 +54,9 @@ ...@@ -54,9 +54,9 @@
<view class="header-title"> <view class="header-title">
<image src="../../static/icon5.png" mode="widthFix"></image> <image src="../../static/icon5.png" mode="widthFix"></image>
<view class="flex-between"> <view class="flex-between">
<text class="text-black text-bold">{{item.productName|| ''}}</text> <text class="text-black text-bold">{{item.productName|| ''}}-{{item.productCode}}</text>
<view class="text-blue"> <view class="text-blue">
<text class="">明细</text> <text class="">详情</text>
<text class="cuIcon-right"></text> <text class="cuIcon-right"></text>
</view> </view>
...@@ -322,10 +322,7 @@ ...@@ -322,10 +322,7 @@
}, },
onNavToOrderInfo(val){ onNavToOrderInfo(val){
uni.navigateTo({ uni.navigateTo({
url:`/pages/product-order/index?id=`+val.id, url:`/pages/product-order/index?id=`+val.id
success: (res) => {
res.eventChannel.emit('acceptDataFromOpenerPage', { data: val})
}
}) })
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment