Commit 59067845 by zhangzhen

细节优化

parent dfcad55f
......@@ -119,6 +119,11 @@ export const getList = (params,pageData) => {
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) => {
let url = `/service/S_SC_RW_06`
......
......@@ -228,7 +228,7 @@
countData:{}
};
},
onLoad(option) {
onShow() {
this.pageData.offset = 0;
this.onLoading();
},
......
......@@ -93,7 +93,18 @@
placeholder="请输入任务数量"
border="surround"
: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>
</view>
<view class="flex-col">
......@@ -111,7 +122,31 @@
<u--input
placeholder="请输入报工数量"
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>
</view>
......@@ -125,7 +160,6 @@
</view>
</view>
</view>
</view>
<view class="flex-col content-part-1">
......@@ -149,6 +183,7 @@
} from "@/utils/tools.js";
import moment from "@/common/moment.js";
import {
getList2,
orderSave
} from "@/api/product-order.js";
......@@ -163,19 +198,47 @@
queryData: {},
minDate: moment().subtract(1,'M').format("YYYY-MM-DD"),
fileList: [],
id:'',
tipShow:false
};
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptDataFromOpenerPage', (data) => {
this.orderInfo = {
...data.data,
registerDate: data.data.registerDate? data.data.registerDate : moment().format("YYYY-MM-DD"),
finishQuantity: ''
};
})
onLoad(option) {
if(option && option.id){
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 = {
...rows[0],
quantity: rows[0].unregisterQuantity,
weight: Number(rows[0].unregisterQuantity)*Number(rows[0].singleWeight)
};
}
}
})
},
// 删除图片
deletePic(event) {
this.fileList.splice(event.index, 1)
......@@ -214,6 +277,13 @@
this.show2 = true;
},
onOpenTip(){
if(Number(this.orderInfo.quantity) > Number(this.orderInfo.unregisterQuantity) && !this.orderInfo.exceedReason){
uni.showToast({
icon:"none",
title:"请输入超报原因"
})
return
}
this.show = true;
},
onCancel(){
......@@ -231,9 +301,23 @@
title:"提交中..."
})
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"),
quantity: this.orderInfo.finishQuantity,
docId: this.fileList && this.fileList.length? this.fileList.map(item=>item.id).join():''
}).then(res=>{
if(res.data.__sys__.status===0){
......
......@@ -7,23 +7,26 @@
</view>
</block>
<block slot="content">
<text class="text-white">生产报工</text>
<text class="text-white">报工详情</text>
</block>
</cu-custom>
<view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}">
</view>
<view class="data-content title-view">
<view v-if="orderInfo" class="data-content title-view">
<view class="part-3">
<view class="content-item">
<view class="header-title" @tap="onNavTo">
<view class="header-title">
<image src="../../static/icon5.png" mode="widthFix"></image>
<view class="flex-between">
<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="cuIcon-right"></text>
</view>
<view v-else class="">
</view>
</view>
</view>
......@@ -41,11 +44,11 @@
:class="orderInfo.status==1?'text-red':'text-gray'">{{statusEnum[orderInfo.status]}}</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">{{orderInfo.taskCode}}</text>
</view>
</view> -->
<view class="flex-row">
<text class="text-gray part-1">公司名称</text>
<text class="text-gray part-2">:</text>
......@@ -62,29 +65,37 @@
<text class="text-title">{{orderInfo.planEndDate}}</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.taskWeight)}}</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.quantity}}</text>
<text class="text-title">{{orderInfo.taskQuantity}}</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-title">{{orderInfo.finishQuantity}}</text>
<text class="text-title">{{Number(orderInfo.registeredWeight)}}</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-title">{{orderInfo.finishQuantity >= orderInfo.quantity? '已完工':'未完工'}}</text>
<text class="text-title">{{orderInfo.registeredQuantity}}</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>
......@@ -105,27 +116,15 @@
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.planEndDate}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">报工数量</text>
<text class="text-gray part-2">:</text>
<text class="text-blue text-bold text-xl">{{item.quantity}}</text>
</view>
<view class="flex-row">
<view class="flex-1 flex-row">
<text class="text-gray">完工数量:</text>
<text class="text-blue text-bold text-xl margin-left-sm">{{item.passQuantity}}</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>
<text class="text-gray part-1">报工重量</text>
<text class="text-gray part-2">:</text>
<text class="text-blue text-bold text-xl">{{Number(item.quantity)*Number(item.singleWeight)}}</text>
</view>
<view v-if="item.imgList && item.imgList.length" class="flex-col">
......@@ -139,21 +138,19 @@
</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">
<text class="text-gray part-1">报工日期</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.createdTime}}</text>
</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 v-if="projectDataList.length <= 0" class="empty-box">
<u-empty text="暂无数据" textColor='#C1C1C1' width="120">
</u-empty>
......@@ -176,14 +173,12 @@
import moment from "@/common/moment.js";
import {
getParamsList,
getSubList
getSubList,
getList2
} from "@/api/product-order.js";
import {
getImgInfoList
} from "@/api/index.js";
import {
getList
} from "@/api/inspection.js";
export default {
data() {
......@@ -191,10 +186,6 @@
assetsPath: config.assetsPath,
projectDataList: [],
statusBarHeight: uni.getStorageSync("statusHeight") || 0,
status: 'nomore ',
loadingText: '努力加载中',
loadmoreText: '上划加载',
nomoreText: '到底啦',
showText: false,
target: 60,
modelVale: 100,
......@@ -207,10 +198,6 @@
form: {},
factoryIndex: 0,
factoryList: [],
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
startTimeStamp: 0,
endTimeStamp: 0,
factoryEnum: {},
orderInfo: '',
tabList: [{
......@@ -233,143 +220,83 @@
queryData: {},
pageData: {
showCount: "true",
limit: 20,
limit: 500,
offset: 0
},
};
},
onLoad(option) {
if (option.id) {
this.queryData.taskId = option.id;
if (uni.getStorageSync(this.queryData.taskId)) {
this.orderInfo = uni.getStorageSync(this.queryData.taskId)
}
this.queryData.id = option.id;
}
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptDataFromOpenerPage', (data) => {
uni.setStorageSync(this.queryData.taskId, data.data)
this.orderInfo = data.data;
})
},
onShow() {
this.pageData.offset = 0;
this.onGetList();
},
onReachBottom() {
if (this.status == 'loadmore') {
this.pageData.offset += 1;
this.onGetList();
}
this.onGetList()
},
methods: {
onFactoryChange(e) {
this.factoryIndex = e.target.value;
this.pageData.offset = 0;
this.onGetList();
},
onBack() {
uni.redirectTo({
url: "/pages/product-order/list"
})
},
onLoading() {
getParamsList().then(res => {
this.factoryList = toJsonData(res.data.__blocks__.factory_record_block_id.rows, res.data
.__blocks__.factory_record_block_id.meta.columns).map(item => {
this.factoryEnum[item.valueField] = item.textField;
return {
label: item.textField,
value: item.valueField
onGetList() {
uni.showLoading({
title: "加载中"
})
getList2({
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()
}
})
this.$forceUpdate();
this.onGetList();
}
})
},
onGetList() {
onGetSubList() {
uni.showLoading({
title: "加载中"
})
getList(this.queryData, this.pageData).then(res => {
getSubList({
taskId: this.queryData.id
},this.pageData).then(res => {
uni.hideLoading();
let list = [];
let list2 = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns).map(item=>{
let createdTime =item.createdTime? item.createdTime.split(''):[];
return {
...item,
createdTime:createdTime.length>=13? `${createdTime[0]}${createdTime[1]}${createdTime[2]}${createdTime[3]}/${createdTime[4]}${createdTime[5]}/${createdTime[6]}${createdTime[7]} ${createdTime[8]}${createdTime[9]}:${createdTime[10]}${createdTime[11]}:${createdTime[12]}${createdTime[13]}` :''
}
})
list2.forEach(async item=>{
let imgDatas = await getImgInfoList({
matId: item.id,
bizType: "SCBG"
if(res.data.__sys__.status ===0){
let list = [];
let list2 = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns).map(item=>{
let createdTime =item.createdTime? item.createdTime.split(''):[];
return {
...item,
createdTime:createdTime.length>=13? `${createdTime[0]}${createdTime[1]}${createdTime[2]}${createdTime[3]}/${createdTime[4]}${createdTime[5]}/${createdTime[6]}${createdTime[7]} ${createdTime[8]}${createdTime[9]}:${createdTime[10]}${createdTime[11]}:${createdTime[12]}${createdTime[13]}` :''
}
})
let imgList = toJsonData(imgDatas.data.__blocks__.result.rows, imgDatas.data.__blocks__.result.meta.columns)
list.push({
...item,
imgList : imgList.length? imgList.map(val=>{
return {
url: this.assetsPath+"/hggp/file/download/docId/"+val.docId
}
}):[]
})
})
if (this.pageData.offset == 0) {
list2.forEach(async item=>{
let imgDatas = await getImgInfoList({
matId: item.id,
bizType: "SCBG"
})
let imgList = toJsonData(imgDatas.data.__blocks__.result.rows, imgDatas.data.__blocks__.result.meta.columns)
list.push({
...item,
imgList : imgList.length? imgList.map(val=>{
return {
url: this.assetsPath+"/hggp/file/download/docId/"+val.docId
}
}):[]
})
})
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() {
uni.navigateTo({
url: `/pages/product-order/edit`,
success: (res) => {
res.eventChannel.emit('acceptDataFromOpenerPage', {
data: this.orderInfo
})
}
url: `/pages/product-order/edit?id=${this.queryData.id}`
})
},
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){
uni.previewImage({
urls:urls.map(item=> item.url),
......
......@@ -54,9 +54,9 @@
<view class="header-title">
<image src="../../static/icon5.png" mode="widthFix"></image>
<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">
<text class="">明细</text>
<text class="">详情</text>
<text class="cuIcon-right"></text>
</view>
......@@ -322,10 +322,7 @@
},
onNavToOrderInfo(val){
uni.navigateTo({
url:`/pages/product-order/index?id=`+val.id,
success: (res) => {
res.eventChannel.emit('acceptDataFromOpenerPage', { data: val})
}
url:`/pages/product-order/index?id=`+val.id
})
}
}
......
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