Files

245 lines
8.4 KiB
Vue
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="content">
<view class="list-card">
<view class="list-card-Info">
<view class="list-card-Info-item">工单信息</view>
</view>
<view class="list-card-Info-detil">
<view class="list-card-Info-detil-item-report">
<text>产品代码:</text>
<text>{{resourceReportInfo.ProductNO}}</text>
</view>
<view class="list-card-Info-detil-item-report">
<text>产品名称:</text>
<text>{{resourceReportInfo.ProductName}}</text>
</view>
</view>
<view class="list-card-Info-detil">
<view class="list-card-Info-detil-item-report">
<text>工序代码:</text>
<text>{{resourceReportInfo.FProcessNO}}</text>
</view>
<view class="list-card-Info-detil-item-report">
<text>工序名称:</text>
<text>{{resourceReportInfo.FProcessName}}</text>
</view>
</view>
<view class="list-card-Info-detil">
<view class="list-card-Info-detil-item-report">
<text>资源代码:</text>
<text>{{resourceReportInfo.ResourcesNO}}</text>
</view>
<view class="list-card-Info-detil-item-report">
<text>工序流转卡:</text>
<text>{{resourceReportInfo.FFlowCardNO}}</text>
</view>
</view>
</view>
<view class="list-card">
<view class="search">
<input class="search-input" v-model="searchInput" @confirm="searchFile"
placeholder="搜索" placeholder-class="search-placeholder" style="text-align: center;"></input>
<!-- <image class="search-img" src="../../../static/report/scan_gray.png" @click="searchFile"></image> -->
</view>
<view class="list-card-Info">
<view class="list-card-Info-item" style="margin-top: 50rpx;">过程标准文件</view>
</view>
<view class="file-content">
<uni-grid :column="4" :show-border="false" :square="false">
<uni-grid-item v-for="(item ,index) in proStandardFile" :key="index">
<view class="grid-item-box">
<image class="image" src="../../../static/report/file.png" @click="showPdf(item,index,'proStandardFile')"/>
<span class="text-name">{{item.FFILENAME}}</span>
<span class="text-time">{{item.FDate}}</span>
<!-- <span class="text-RMA"></span> -->
</view>
</uni-grid-item>
</uni-grid>
</view>
<view class="list-card-Info">
<view class="list-card-Info-item" style="margin-top: 50rpx;">控制计划</view>
</view>
<view class="file-content">
<uni-grid :column="4" :show-border="false" :square="false">
<uni-grid-item v-for="(item ,index) in controlPlanFile" :key="index">
<view class="grid-item-box">
<image class="image" src="../../../static/report/file.png" @click="showPdf(item,index,'controlPlanFile')">
<span class="text-name">{{item.FFILENAME}}</span>
<span class="text-time">{{item.FDate}}</span>
</view>
</uni-grid-item>
</uni-grid>
</view>
<view class="list-card-Info">
<view class="list-card-Info-item" style="margin-top: 50rpx;">异常控制文件</view>
</view>
<view class="file-content">
<uni-grid :column="4" :show-border="false" :square="false">
<uni-grid-item v-for="(item ,index) in abnormalControlFile" :key="index">
<view class="grid-item-box">
<image class="image" src="../../../static/report/file.png" @click="showPdf(item,index,'abnormalControlFile')"/>
<span class="text-name">{{item.FFILENAME}}</span>
<span class="text-time">{{item.FDate}}</span>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</view>
</template>
<script>
import uniGrid from '@/components/uni-grid/uni-grid.vue';
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue';
import errorUtil from '@/common/errorutil.js';
import Vue from 'vue';
var commonUtil = require('../../../common/util.js');
import {
mapState,
mapMutations
} from 'vuex';
export default {
components: {
},
data() {
return {
productID:'',
searchInput:'',
resourceReportInfo:[],
abnormalControlFile:[],
controlPlanFile:[],
proStandardFile:[],
pdfUrl:''
}
},
onLoad() {
this.productID = uni.getStorageSync('currProductID');
this.resourceReportInfo = uni.getStorageSync('currresourceReportInfo');
this.getAssignDocument(0);
},
methods: {
showPdf: function(item,index,type) {
let _self = this;
let FFileName = '';
let FBillNO = '';
if(type == 'proStandardFile'){
FFileName = item.FFILENAME;
FBillNO = item.FBILLNO;
this.DownAssignDocument(0,FFileName,FBillNO);
}
if(type == 'controlPlanFile'){
FFileName = item.FFILENAME;
FBillNO = item.FBILLNO;
this.DownAssignDocument(0,FFileName,FBillNO);
}
if(type == 'abnormalControlFile'){
FFileName = item.FFILENAME;
FBillNO = item.FBILLNO;
this.DownAssignDocument(0,FFileName,FBillNO);
}
},
//获取作业文档
searchFile(){
this.getAssignDocument(0)
},
getAssignDocument(count){
let _self = this;
let params;
this.$request.get('/Inspection/GetAssignDocument',{
params:{
FItemID:this.productID,
FName:this.searchInput,
FProcessID:this.resourceReportInfo.FProcessID
}
}).then(res => {
let data = res;
if(data.abnormalControlFile.length>0){
data.abnormalControlFile.forEach(function(el){
el.FDate = commonUtil.removeLetter(el.FDate);
el.FDate = el.FDate.substr(0,10) + " " + el.FDate.substr(10 ,8);
})
}
if(data.controlPlanFile.length>0){
data.controlPlanFile.forEach(function(el){
el.FDate = commonUtil.removeLetter(el.FDate);
el.FDate = el.FDate.substr(0,10) + " " + el.FDate.substr(10 ,8);
})
}
if(data.proStandardFile.length>0){
data.proStandardFile.forEach(function(el){
el.FDate = commonUtil.removeLetter(el.FDate);
el.FDate = el.FDate.substr(0,10) + " " + el.FDate.substr(10 ,8);
})
}
this.abnormalControlFile = data.abnormalControlFile;
this.controlPlanFile = data.controlPlanFile;
this.proStandardFile = data.proStandardFile;
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
//下载作业文档并查看
DownAssignDocument(count,FFileName,FBillNO){
let _self = this;
let requestParams;
requestParams = {
"FBillNO":FBillNO,
"FFileName":FFileName
};
this.$request.get('/Inspection/DownAssignDocument',{
params:requestParams
}).then(res => {
// debugger
let data = res;
this.pdfUrl = data.fullFilePath;
uni.downloadFile({
url: _self.pdfUrl,
success: function(res) {
debugger
var filePath = res.tempFilePath;
if (!filePath) return
uni.openDocument({
filePath: filePath,
success: function(res) {
console.log('打开文档成功');
}
});
}
});
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
}
}
</script>
<style>
page{background-color: #F7F7F7;}
.search{justify-content: space-between;}
.search-placeholder{text-align: center;}
.search-type-select{flex-grow: 1;}
.list-card-Info{margin: 0 32rpx;}
.list-card-Info-detil{display: flex;flex-direction: row;align-items: center;
margin: 20rpx 32rpx 0 32rpx;width: 100%;}
.list-card-Info-detil-item-report{font-size: 28rpx;width: 50%;}
.list-card-Info-item{font-size: 32rpx;font-family: PingFangSC, PingFangSC-Semibold;font-weight: 600;text-align: left;color: #000000;}
.file-content{margin: 0 32rpx;padding: 0rpx 0 50rpx 0;border-bottom: 1px solid #f0f0f0;}
.image{width: 75px;height: 80px;flex-shrink: 0;}
.grid-item-box{display: flex;flex-direction: column;align-items: center;margin-top: 50rpx;}
.text-name{text-align: center;font-size: 14px;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: rgba(60,60,67,0.85);}
.text-time{text-align: center;font-size: 10px;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: rgba(60,60,67,0.50);}
.text-RMA{text-align: center;font-size: 10px;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: rgba(60,60,67,0.50);}
</style>