Commit 21834119 by zhangzhen

细节优化

parent b2850a19
...@@ -50,6 +50,39 @@ const setParamsData = (data = {}) => { ...@@ -50,6 +50,39 @@ const setParamsData = (data = {}) => {
return paramsData return paramsData
} }
const setResultData = (data={}) => {
let obj = {}
for (let i in data) {
if (data[i] !== '') {
obj[i] = data[i]
}
}
let paramsData = {
"__version__": "2.0",
"__sys__": {},
"__blocks__": {
"result": {
"attr": {},
"meta": {
"columns": []
},
"rows": []
}
}
}
let keyList = Object.keys(obj);
keyList.forEach((item, index) => {
paramsData.__blocks__.result.meta.columns.push({
pos: index,
name: item
})
})
paramsData.__blocks__.result.rows.push(Object.values(obj));
return paramsData
}
// 登录 // 登录
export const login = (data) => { export const login = (data) => {
let url = `/service/S_XS_105` let url = `/service/S_XS_105`
...@@ -139,6 +172,12 @@ export const getUserByCompanyCode = (data) => { ...@@ -139,6 +172,12 @@ export const getUserByCompanyCode = (data) => {
return http.post(url, d) return http.post(url, d)
} }
export const getImgInfoList = (data) => {
let url = `/service/S_XC_IMG`;
let d = setParamsData(data)
return http.post(url, d)
}
//上传文件 //上传文件
......
...@@ -208,9 +208,7 @@ ...@@ -208,9 +208,7 @@
} }
}, },
onBack() { onBack() {
uni.redirectTo({ uni.navigateBack();
url:"/pages/product-order/list"
})
}, },
onOpenCalendar(){ onOpenCalendar(){
this.show2 = true; this.show2 = true;
...@@ -236,7 +234,7 @@ ...@@ -236,7 +234,7 @@
taskId: this.orderInfo.id, taskId: this.orderInfo.id,
registerDate: this.orderInfo.registerDate || moment().format("YYYY-MM-DD"), registerDate: this.orderInfo.registerDate || moment().format("YYYY-MM-DD"),
quantity: this.orderInfo.finishQuantity, quantity: this.orderInfo.finishQuantity,
matId: 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){
uni.showToast({ uni.showToast({
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
<text class="text-title">{{orderInfo.processName}}</text> <text class="text-title">{{orderInfo.processName}}</text>
</view> </view>
<view class=""> <view class="">
<text :class="orderInfo.status==1?'text-red':'text-gray'">{{statusEnum[orderInfo.status]}}</text> <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">
...@@ -73,7 +74,8 @@ ...@@ -73,7 +74,8 @@
<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 >= orderInfo.quantity? '已完工':'未完工'}}</text> <text
class="text-title">{{orderInfo.finishQuantity >= orderInfo.quantity? '已完工':'未完工'}}</text>
</view> </view>
</view> </view>
...@@ -89,7 +91,7 @@ ...@@ -89,7 +91,7 @@
<view class="padding-sm"> <view class="padding-sm">
<text class="text-title text-bold text-lg">报工明细</text> <text class="text-title text-bold text-lg">报工明细</text>
</view> </view>
<view class="flex-col data-content" > <view class="flex-col data-content">
<view class="flex-col part-3"> <view class="flex-col part-3">
<view v-for="(item,k) in projectDataList" :key="k" class="content-item"> <view v-for="(item,k) in projectDataList" :key="k" class="content-item">
<view class="flex-col content-box"> <view class="flex-col content-box">
...@@ -103,6 +105,9 @@ ...@@ -103,6 +105,9 @@
<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>
...@@ -122,6 +127,23 @@ ...@@ -122,6 +127,23 @@
<text class="text-blue text-bold text-xl margin-left-sm">{{item.unpassQuantity}}</text> <text class="text-blue text-bold text-xl margin-left-sm">{{item.unpassQuantity}}</text>
</view> </view>
</view> </view>
<view v-if="item.imgList && item.imgList.length" class="flex-col">
<view class="flex-row-center">
<text class="text-gray part-1">图片展示</text>
<text class="text-gray part-2">:</text>
</view>
<view class="img-list-box">
<view v-for="(val,i) in item.imgList" :key="i" class="img-item-box" @tap="onPreview(item.imgList,i)">
<image class="img" :src="val.url" mode="scaleToFill"></image>
</view>
</view>
</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>
...@@ -143,6 +165,7 @@ ...@@ -143,6 +165,7 @@
</template> </template>
<script> <script>
import config from "@/config/index.config";
import { import {
pathToBase64, pathToBase64,
base64ToPath base64ToPath
...@@ -151,14 +174,22 @@ ...@@ -151,14 +174,22 @@
toJsonData toJsonData
} from "@/utils/tools.js"; } from "@/utils/tools.js";
import moment from "@/common/moment.js"; import moment from "@/common/moment.js";
import { getParamsList,getSubList } from "@/api/product-order.js"; import {
getParamsList,
import { getList } from "@/api/inspection.js"; getSubList
} from "@/api/product-order.js";
import {
getImgInfoList
} from "@/api/index.js";
import {
getList
} from "@/api/inspection.js";
export default { export default {
data() { data() {
return { return {
projectDataList:[], assetsPath: config.assetsPath,
projectDataList: [],
statusBarHeight: uni.getStorageSync("statusHeight") || 0, statusBarHeight: uni.getStorageSync("statusHeight") || 0,
status: 'nomore ', status: 'nomore ',
loadingText: '努力加载中', loadingText: '努力加载中',
...@@ -170,20 +201,19 @@ ...@@ -170,20 +201,19 @@
value: 0, value: 0,
title: '生产领料', title: '生产领料',
eChartData: [], eChartData: [],
current:0, current: 0,
formData: {}, formData: {},
//不良品类 //不良品类
form: {}, form: {},
factoryIndex:0, factoryIndex: 0,
factoryList:[], factoryList: [],
innerHeight: window.innerHeight, innerHeight: window.innerHeight,
innerWidth: window.innerWidth, innerWidth: window.innerWidth,
startTimeStamp:0, startTimeStamp: 0,
endTimeStamp:0, endTimeStamp: 0,
factoryEnum:{}, factoryEnum: {},
orderInfo:'', orderInfo: '',
tabList: [ tabList: [{
{
name: '全部', name: '全部',
value: '' value: ''
}, },
...@@ -196,28 +226,28 @@ ...@@ -196,28 +226,28 @@
value: 1 value: 1
} }
], ],
statusEnum:{ statusEnum: {
1:"未质检", 1: "未质检",
2:"已质检" 2: "已质检"
}, },
queryData: {}, queryData: {},
pageData:{ pageData: {
showCount: "true", showCount: "true",
limit:20, limit: 20,
offset:0 offset: 0
}, },
}; };
}, },
onLoad(option) { onLoad(option) {
if(option.id){ if (option.id) {
this.queryData.taskId = option.id; this.queryData.taskId = option.id;
if(uni.getStorageSync(this.queryData.taskId)){ if (uni.getStorageSync(this.queryData.taskId)) {
this.orderInfo = uni.getStorageSync(this.queryData.taskId) this.orderInfo = uni.getStorageSync(this.queryData.taskId)
} }
} }
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptDataFromOpenerPage', (data) => { eventChannel.on('acceptDataFromOpenerPage', (data) => {
uni.setStorageSync(this.queryData.taskId,data.data) uni.setStorageSync(this.queryData.taskId, data.data)
this.orderInfo = data.data; this.orderInfo = data.data;
}) })
...@@ -233,21 +263,21 @@ ...@@ -233,21 +263,21 @@
} }
}, },
methods: { methods: {
onFactoryChange(e){ onFactoryChange(e) {
this.factoryIndex = e.target.value; this.factoryIndex = e.target.value;
this.pageData.offset = 0; this.pageData.offset = 0;
this.onGetList(); this.onGetList();
}, },
onBack(){ onBack() {
uni.redirectTo({ uni.redirectTo({
url:"/pages/product-order/list" url: "/pages/product-order/list"
}) })
}, },
onLoading() { onLoading() {
getParamsList().then(res=>{ getParamsList().then(res => {
this.factoryList = toJsonData(res.data.__blocks__.factory_record_block_id.rows, res.data
this.factoryList = toJsonData(res.data.__blocks__.factory_record_block_id.rows,res.data.__blocks__.factory_record_block_id.meta.columns).map(item=>{ .__blocks__.factory_record_block_id.meta.columns).map(item => {
this.factoryEnum[item.valueField] = item.textField this.factoryEnum[item.valueField] = item.textField;
return { return {
label: item.textField, label: item.textField,
value: item.valueField value: item.valueField
...@@ -262,14 +292,38 @@ ...@@ -262,14 +292,38 @@
title: "加载中" title: "加载中"
}) })
getList(this.queryData, this.pageData).then(res => { getList(this.queryData, this.pageData).then(res => {
uni.hideLoading(); uni.hideLoading();
let list = toJsonData(res.data.__blocks__.result.rows,res.data.__blocks__.result.meta.columns) 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"
})
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) { if (this.pageData.offset == 0) {
this.projectDataList = list this.projectDataList = list
} else { } else {
this.projectDataList = [...this.projectDataList, ...list] this.projectDataList = [...this.projectDataList, ...list]
} }
console.log(this.projectDataList,99999)
if (this.projectDataList.length < res.data.__blocks__.result.attr.count) { if (this.projectDataList.length < res.data.__blocks__.result.attr.count) {
this.status = "loadmore" this.status = "loadmore"
} else { } else {
...@@ -289,30 +343,38 @@ ...@@ -289,30 +343,38 @@
this.pageData.offset = 0; this.pageData.offset = 0;
// this.onGetList(); // this.onGetList();
}, },
onNavTo(){ onNavTo() {
uni.navigateTo({ uni.navigateTo({
url:`/pages/product-order/edit`, url: `/pages/product-order/edit`,
success: (res) => { success: (res) => {
res.eventChannel.emit('acceptDataFromOpenerPage', { data: this.orderInfo}) res.eventChannel.emit('acceptDataFromOpenerPage', {
data: this.orderInfo
})
} }
}) })
}, },
onStartFloat(e){ onStartFloat(e) {
this.startTimeStamp = moment().valueOf(); this.startTimeStamp = moment().valueOf();
this.floatBoxStatus = true this.floatBoxStatus = true
this.floatTop = e.changedTouches[0].clientY-25+'px'; this.floatTop = e.changedTouches[0].clientY - 25 + 'px';
this.floatLeft = e.changedTouches[0].clientX-25+'px'; this.floatLeft = e.changedTouches[0].clientX - 25 + 'px';
}, },
onMoveFloat(e){ onMoveFloat(e) {
this.floatTop = e.changedTouches[0].clientY-25+'px'; this.floatTop = e.changedTouches[0].clientY - 25 + 'px';
this.floatLeft = e.changedTouches[0].clientX-25+'px'; this.floatLeft = e.changedTouches[0].clientX - 25 + 'px';
}, },
onEndFloat(e){ onEndFloat(e) {
this.endTimeStamp = moment().valueOf(); this.endTimeStamp = moment().valueOf();
this.floatBoxStatus = false this.floatBoxStatus = false
},
onPreview(urls,i){
uni.previewImage({
urls:urls.map(item=> item.url),
current:i
})
} }
} }
} }
...@@ -323,35 +385,39 @@ ...@@ -323,35 +385,39 @@
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.overview-view {
.overview-view{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 20upx 0; padding: 20upx 0;
background: #ffffff; background: #ffffff;
border-bottom: 2px solid rgba(226, 226, 226, 0.6); border-bottom: 2px solid rgba(226, 226, 226, 0.6);
.part-1{
.part-1 {
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.text-black{
.text-black {
margin-top: 10upx; margin-top: 10upx;
} }
} }
.line{
.line {
display: flex; display: flex;
width: 2px; width: 2px;
height: 100upx; height: 100upx;
background-color: rgba(226, 226, 226, 0.6); background-color: rgba(226, 226, 226, 0.6);
} }
} }
.page-content-box{
.page-content-box {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
} }
.cu-form-group { .cu-form-group {
picker { picker {
padding-right: 0; padding-right: 0;
...@@ -472,13 +538,16 @@ ...@@ -472,13 +538,16 @@
margin-top: -20upx; margin-top: -20upx;
background-color: #ffffff; background-color: #ffffff;
padding: 24upx; padding: 24upx;
.flex-row{
.flex-row {
margin: 6upx 0; margin: 6upx 0;
.part-1{
.part-1 {
width: 180upx; width: 180upx;
text-align-last: justify; text-align-last: justify;
} }
.part-2{
.part-2 {
margin-right: 24upx; margin-right: 24upx;
} }
} }
...@@ -587,24 +656,45 @@ ...@@ -587,24 +656,45 @@
} }
} }
} }
.title-view{
.title-view {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
width: 100%; width: 100%;
padding: 0; padding: 0;
margin: 0; margin: 0;
.part-3{
.part-3 {
width: 100%; width: 100%;
padding-bottom: 0; padding-bottom: 0;
.content-item{
.content-item {
width: 100%; width: 100%;
padding: 0; padding: 0;
.content-box{
.content-box {
box-shadow: 0 0 0 transparent; box-shadow: 0 0 0 transparent;
border-radius: 0; border-radius: 0;
} }
} }
} }
} }
.img-list-box{
display: flex;
flex-wrap: wrap;
width: 100%;
.img-item-box{
display: flex;
justify-content: center;
align-items: center;
width: 33.33%;
height: 26vw;
.img{
display: block;
width: 90%;
height: 90%;
}
}
}
</style> </style>
\ No newline at end of file
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