Commit 21834119 by zhangzhen

细节优化

parent b2850a19
......@@ -50,6 +50,39 @@ const setParamsData = (data = {}) => {
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) => {
let url = `/service/S_XS_105`
......@@ -139,6 +172,12 @@ export const getUserByCompanyCode = (data) => {
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 @@
}
},
onBack() {
uni.redirectTo({
url:"/pages/product-order/list"
})
uni.navigateBack();
},
onOpenCalendar(){
this.show2 = true;
......@@ -236,7 +234,7 @@
taskId: this.orderInfo.id,
registerDate: this.orderInfo.registerDate || moment().format("YYYY-MM-DD"),
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=>{
if(res.data.__sys__.status===0){
uni.showToast({
......
......@@ -24,12 +24,12 @@
<text class="">报工</text>
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<view class="flex-col content-box">
<view class="flex-between">
<view class="flex-row">
<text class="text-gray part-1">所属工序</text>
......@@ -37,7 +37,8 @@
<text class="text-title">{{orderInfo.processName}}</text>
</view>
<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 class="flex-row">
......@@ -55,75 +56,96 @@
<text class="text-gray part-2">:</text>
<text class="text-title">{{orderInfo.projName}}</text>
</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.planEndDate}}</text>
</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.quantity}}</text>
</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.finishQuantity}}</text>
</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.finishQuantity >= orderInfo.quantity? '已完工':'未完工'}}</text>
<text
class="text-title">{{orderInfo.finishQuantity >= orderInfo.quantity? '已完工':'未完工'}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="padding-sm">
<text class="text-title text-bold text-lg">报工明细</text>
</view>
<view class="flex-col data-content" >
<view class="padding-sm">
<text class="text-title text-bold text-lg">报工明细</text>
</view>
<view class="flex-col data-content">
<view class="flex-col part-3">
<view v-for="(item,k) in projectDataList" :key="k" class="content-item">
<view class="flex-col content-box">
<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">{{item.productName}}({{item.processName}})</text>
</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">{{item.planEndDate}}</text>
</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-blue text-bold text-xl">{{item.quantity}}</text>
</view>
<view class="flex-row">
<view class="flex-1 flex-row">
<text class="text-gray">完工数量:</text>
<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>
</view>
</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 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 @@
</template>
<script>
import config from "@/config/index.config";
import {
pathToBase64,
base64ToPath
......@@ -151,14 +174,22 @@
toJsonData
} from "@/utils/tools.js";
import moment from "@/common/moment.js";
import { getParamsList,getSubList } from "@/api/product-order.js";
import {
getParamsList,
getSubList
} from "@/api/product-order.js";
import {
getImgInfoList
} from "@/api/index.js";
import {
getList
} from "@/api/inspection.js";
import { getList } from "@/api/inspection.js";
export default {
data() {
return {
projectDataList:[],
assetsPath: config.assetsPath,
projectDataList: [],
statusBarHeight: uni.getStorageSync("statusHeight") || 0,
status: 'nomore ',
loadingText: '努力加载中',
......@@ -170,20 +201,19 @@
value: 0,
title: '生产领料',
eChartData: [],
current:0,
current: 0,
formData: {},
//不良品类
form: {},
factoryIndex:0,
factoryList:[],
factoryIndex: 0,
factoryList: [],
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
startTimeStamp:0,
endTimeStamp:0,
factoryEnum:{},
orderInfo:'',
tabList: [
{
startTimeStamp: 0,
endTimeStamp: 0,
factoryEnum: {},
orderInfo: '',
tabList: [{
name: '全部',
value: ''
},
......@@ -196,31 +226,31 @@
value: 1
}
],
statusEnum:{
1:"未质检",
2:"已质检"
statusEnum: {
1: "未质检",
2: "已质检"
},
queryData: {},
pageData:{
pageData: {
showCount: "true",
limit:20,
offset:0
limit: 20,
offset: 0
},
};
},
onLoad(option) {
if(option.id){
if (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)
}
}
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('acceptDataFromOpenerPage', (data) => {
uni.setStorageSync(this.queryData.taskId,data.data)
uni.setStorageSync(this.queryData.taskId, data.data)
this.orderInfo = data.data;
})
},
onShow() {
this.pageData.offset = 0;
......@@ -233,21 +263,21 @@
}
},
methods: {
onFactoryChange(e){
onFactoryChange(e) {
this.factoryIndex = e.target.value;
this.pageData.offset = 0;
this.onGetList();
},
onBack(){
onBack() {
uni.redirectTo({
url:"/pages/product-order/list"
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
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
......@@ -262,14 +292,38 @@
title: "加载中"
})
getList(this.queryData, this.pageData).then(res => {
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) {
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 {
......@@ -289,30 +343,38 @@
this.pageData.offset = 0;
// this.onGetList();
},
onNavTo(){
onNavTo() {
uni.navigateTo({
url:`/pages/product-order/edit`,
url: `/pages/product-order/edit`,
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.floatBoxStatus = true
this.floatTop = e.changedTouches[0].clientY-25+'px';
this.floatLeft = e.changedTouches[0].clientX-25+'px';
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';
onMoveFloat(e) {
this.floatTop = e.changedTouches[0].clientY - 25 + 'px';
this.floatLeft = e.changedTouches[0].clientX - 25 + 'px';
},
onEndFloat(e){
onEndFloat(e) {
this.endTimeStamp = moment().valueOf();
this.floatBoxStatus = false
},
onPreview(urls,i){
uni.previewImage({
urls:urls.map(item=> item.url),
current:i
})
}
}
}
......@@ -323,35 +385,39 @@
}
</style>
<style lang="scss" scoped>
.overview-view{
.overview-view {
display: flex;
flex-direction: row;
padding: 20upx 0;
background: #ffffff;
border-bottom: 2px solid rgba(226, 226, 226, 0.6);
.part-1{
.part-1 {
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
align-items: center;
.text-black{
.text-black {
margin-top: 10upx;
}
}
.line{
.line {
display: flex;
width: 2px;
height: 100upx;
background-color: rgba(226, 226, 226, 0.6);
}
}
.page-content-box{
.page-content-box {
width: 100vw;
height: 100vh;
overflow: hidden;
}
.cu-form-group {
picker {
padding-right: 0;
......@@ -472,13 +538,16 @@
margin-top: -20upx;
background-color: #ffffff;
padding: 24upx;
.flex-row{
.flex-row {
margin: 6upx 0;
.part-1{
.part-1 {
width: 180upx;
text-align-last: justify;
}
.part-2{
.part-2 {
margin-right: 24upx;
}
}
......@@ -587,24 +656,45 @@
}
}
}
.title-view{
.title-view {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
padding: 0;
margin: 0;
.part-3{
.part-3 {
width: 100%;
padding-bottom: 0;
.content-item{
.content-item {
width: 100%;
padding: 0;
.content-box{
.content-box {
box-shadow: 0 0 0 transparent;
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>
\ 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