Commit 169085a6 authored by 张锡奇's avatar 张锡奇

send

parent 1913572c
......@@ -52,10 +52,9 @@ Http.install = function (Vue) {
* @returns {Promise}
*/
Vue.prototype.apiPost = function (url, data, toast = false,header) {
if(!!header && JSON.stringify(header) != "{}"){
AsInst.defaults.headers.common['iProject'] = header.iProject;
for(let x in header){
AsInst.defaults.headers.common[x] = header[x];
}
if (toast && typeof (toast) === 'boolean') {
loading();
} else if (toast && typeof (toast) === 'string') {
......@@ -96,8 +95,8 @@ Http.install = function (Vue) {
loading(toast);
}
return new Promise((resolve, reject) => {
if(!!header && JSON.stringify(header) != "{}"){
AsInst.defaults.headers.common['iProjectId'] = header.iProject;
for(let x in header){
AsInst.defaults.headers.common[x] = header[x];
}
AsInst.get(url, {
params: data
......
......@@ -33,7 +33,13 @@ Vue.prototype.$echarts = echarts
function getAbsolutePath () {
let path = location.pathname
// return path.substring(0, path.lastIndexOf('/') + 1)
return "/apiproxy/huansi/hszh_report/main"
let base;
if(path.indexOf('/apiproxy/huansi/hszh_report') != -1){
base = '/apiproxy/huansi/hszh_report/main';
}else{
base = '/main';
}
return base;
}
const router = new VueRouter({
mode:'history',
......
......@@ -37,7 +37,7 @@ let routes = [
path:'/main',
children:[
{
path:'/sales',
path:'/sales/:iProjectId',
name:'chartMmcolorsale',
component:()=> import('@/view/chart/sales/index.vue'),
meta:{
......@@ -53,7 +53,7 @@ let routes = [
}
},
{
path:'/custom',
path:'/custom/:iProjectId',
name:'chartCustom',
component:()=> import('@/view/chart/custom/index.vue'),
meta:{
......@@ -69,7 +69,7 @@ let routes = [
}
},
{
path:'/income',
path:'/income/:iProjectId',
name:'chartIncome',
component:()=> import('@/view/chart/income/index.vue'),
meta:{
......@@ -77,7 +77,7 @@ let routes = [
}
},
{
path:'/salesStatistics',
path:'/salesStatistics/:iProjectId',
name:'chartStatistics',
component:()=> import('@/view/chart/sales/statistics.vue'),
meta:{
......@@ -92,8 +92,8 @@ let routes = [
path:'/main',
children:[
{
path:'/specimin/:iProjectId/:sMaterialNo',
name:'specimin',
path:'/specimen/:iProjectId/:sMaterialNo',
name:'specimen',
component:()=> import('@/view/specimen/index.vue'),
meta:{
title: '样品信息'
......
......@@ -5,7 +5,7 @@ const app = {
state: {
userInfo:{},
chartHearData:{},
iProject:5599
iProjectId:5599
},
mutations: {
getUserInfo(state,obj){
......@@ -15,7 +15,7 @@ const app = {
state.chartHearData = obj;
},
setIproject(state,data){
state.iProject = data;
state.iProjectId = data;
}
},
actions: {
......
......@@ -68,7 +68,7 @@ export default {
computed:{
...mapState({
chartHearData:state => state.app.chartHearData,
iProject:state => state.app.iProject
iProjectId:state => state.app.iProjectId
})
},
mounted(){
......@@ -84,13 +84,13 @@ export default {
async getPbcustomerDtl(){
let result = await this.request('getPbcustomerDtl',{
params:this.chartHearData
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.value=typeof result=='object'&&result.length>0&&result||[]
},
async getPbsalesDtl(){
let result= await this.request('getPbsalesDtl',{
params:this.chartHearData
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.value=typeof result=='object'&&result.length>0&&result||[]
},
setChart(){
......
......@@ -63,7 +63,7 @@ export default {
dBeginDate:Util.dateFormat(new Date(),'yyyy-MM-01'),
dEndDate:Util.dateFormat(new Date(),'yyyy-MM-dd'),
},
iProject:5599,
iProjectId:5599,
myChart1:null,
myChart2:null,
......@@ -86,8 +86,8 @@ export default {
// this.initChart(this.myChart2,'myChart2');
this.iProject = this.$route.query.id||window.location.search.slice(1)
this.$store.dispatch('setIproject',this.iProject);
this.iProjectId = this.$route.params.iProjectId;
this.$store.dispatch('setIproject',this.iProjectId);
await this.getPbcustomer();
await this.getPbsales();
......@@ -156,7 +156,7 @@ export default {
async getPbcustomer(){
let result = await this.request('getPbcustomer',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.pbcustomer = typeof result=='object'&&result.length>0&&result.map(v=>{
v.name=`${v.sCustomerName||''}\n${v.sCustomerNo||''}`
return v
......@@ -166,7 +166,7 @@ export default {
async getPbsales(){
let result= await this.request('getPbsales',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.pbsales = typeof result=='object'&&result.length>0&&result.map(v=>{
v.name=`${v.sSalesName||''}\n${v.sSalesNo||''}`
return v
......
......@@ -63,7 +63,7 @@ export default {
dBeginDate:Util.dateFormat(new Date(),'yyyy-MM-01'),
dEndDate:Util.dateFormat(new Date(),'yyyy-MM-dd'),
},
iProject:5599,
iProjectId:5599,
toUrl:{
"myChart20":"/shopVersion/pages/form/revenue",
"myChart21":"/shopVersion/pages/form/expenditure",
......@@ -90,8 +90,8 @@ export default {
})
})
this.iProject = this.$route.query.id||window.location.search.slice(1)
this.$store.dispatch('setIproject',this.iProject);
this.iProjectId = this.$route.params.iProjectId;
this.$store.dispatch('setIproject',this.iProjectId);
await this.getPayable();
await this.getReceivepay();
......@@ -150,14 +150,14 @@ export default {
async getPayable(){
let result = await this.request('getPayable',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.payable = result;
this.drawLine1('myChart1');
},
async getReceivepay(){
let result= await this.request('getReceivepay',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.receivepay = result;
this.drawLine2('myChart2');
},
......
......@@ -71,7 +71,7 @@ export default {
computed:{
...mapState({
chartHearData:state => state.app.chartHearData,
iProject:state => state.app.iProject
iProjectId:state => state.app.iProjectId
})
},
mounted(){
......@@ -82,18 +82,19 @@ export default {
this.myChart.setOption(options);
this.myChart.resize()
});
console.log(this.iProjectId)
},
methods:{
async getMmcolorsaledtltop(){
let result = await this.request('getMmcolorsaledtltop',{
params:this.chartHearData
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.value=typeof result=='object'&&result.length>0&&result||[]
},
async getMmsaledtltop(){
let result= await this.request('getMmsaledtltop',{
params:this.chartHearData
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.value=typeof result=='object'&&result.length>0&&result||[]
},
setChart(){
......
......@@ -64,7 +64,7 @@ export default {
dEndDate:Util.dateFormat(new Date(),'yyyy-MM-dd'),
},
timer:null,
iProject:5599,
iProjectId:5599,
i:0,
myChart1:null,
myChart2:null
......@@ -75,8 +75,9 @@ export default {
this.myChart2 = this.$echarts.init(document.getElementById('myChart2'))
this.initChart(this.myChart1,'myChart1');
this.initChart(this.myChart2,'myChart2');
this.iProject = window.location.search.slice(1,window.location.search.length)
this.$store.dispatch('setIproject',this.iProject);
this.iProjectId = this.$route.params.iProjectId;
this.$store.dispatch('setIproject',this.iProjectId);
await this.getMmcolorsaletop();
await this.getMmsaletop();
......@@ -95,14 +96,14 @@ export default {
async getMmcolorsaletop(){
let result = await this.request('getMmcolorsaletop',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.mmcolorsaletop = result;
this.setChart(this.myChart1,'myChart1')
},
async getMmsaletop(){
let result= await this.request('getMmsaletop',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.mmsaletop = result;
this.setChart(this.myChart2,'myChart2')
},
......@@ -242,6 +243,7 @@ export default {
let index = param.dataIndex;
let data = {};
if(id == 'myChart1'){
console.log(that.pbcustomer)
data = Object.assign(that.pbcustomer[index],{type:'pbcustomer'})
}else{
data = Object.assign(that.pbsales[index],{type:'pbsales'});
......
......@@ -106,7 +106,7 @@ export default {
dBeginDate:Util.dateFormat(new Date(),'yyyy-MM-01'),
dEndDate:Util.dateFormat(new Date(),'yyyy-MM-dd'),
},
iProject:5599,
iProjectId:5599,
chartData:{
set3:[],
set4:{
......@@ -153,8 +153,9 @@ export default {
})
})
this.iProject=this.$route.query.id||window.location.search.slice(1)
this.$store.dispatch('setIproject',this.iProject);
this.iProjectId= this.$route.params.iProjectId;
console.log(this.$route)
this.$store.dispatch('setIproject',this.iProjectId);
this.searchData()
this.global.$on('searchData',()=>{
this.searchData()
......@@ -220,7 +221,7 @@ export default {
dStartDate:this.search.dBeginDate,
dEndDate:this.search.dEndDate
}
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
Object.assign(this.chartData,{
nOrderSameRatio:Math.round((value.set1&&value.set1[0]&&value.set1[0].nOrderSameRatio||0)*100)/100,
nOrderRingRatio:Math.round((value.set2&&value.set2[0]&&value.set2[0].nOrderRingRatio||0)*100)/100,
......@@ -238,14 +239,14 @@ export default {
async chart2Data(){
var value=await this.request('getMmcolorsaletop',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.chartData.set5=typeof value=='object'&&value.length>0&&value||[]
this.chartData.set5.forEach(v=>v.type='mmcolorsaletop')
var value=await this.request('getMmsaletop',{
params:this.search
},true,{iProject:this.iProject})
},true,{iProjectId:this.iProjectId})
this.chartData.set6=typeof value=='object'&&value.length>0&&value||[]
this.chartData.set6.forEach(v=>v.type='mmsaletop')
......
......@@ -18,7 +18,7 @@
display: block;
max-width: 100%;
}
#imageView .imageBox li img[data-v-cc57528a]{
#imageView .imageBox li img{
height:auto !important;
}
#imageView .imageBox li{
......@@ -43,25 +43,26 @@
justify-content: center;
align-items: center;
background: #eef4fe;
position: relative;
// position: relative;
}
img{
height:200px;
width:100%;
}
img:after {
content: "";
display: inline-block;
position: absolute;
z-index: 2;
top: 0;
left: calc(50% - 100px);
width: 200px;
height: 200px;
background: url("../../assets/imgErr.png") no-repeat;
background-position: center;
background-size: contain;
background-color: #fff;
}
// img:after {
// content: "";
// display: inline-block;
// position: absolute;
// z-index: 2;
// top: 0;
// left: calc(50% - 100px);
// width: 200px;
// height: 200px;
// background: url("../../assets/imgErr.png") no-repeat;
// background-position: center;
// background-size: contain;
// background-color: #fff;
// }
}
.info{
.content{
......@@ -77,24 +78,30 @@
background: white;
border-top:1px solid #eef4fe;
.img{
position: relative;
min-height:50px;
}
img:after {
content: "";
display: inline-block;
position: absolute;
z-index: 2;
top: 0;
left: 0;
// position: relative;
display: flex;
justify-content: center;
align-items: center;
img{
width: 100%;
height: 50px;
background: url("../../assets/imgErr.png") no-repeat;
background-position: center;
background-size: contain;
background-color: #fff;
max-height:50px;
}
}
// img:after {
// content: "";
// display: inline-block;
// position: absolute;
// z-index: 2;
// top: 0;
// left: 0;
// width: 100%;
// height: 50px;
// background: url("../../assets/imgErr.png") no-repeat;
// background-position: center;
// background-size: contain;
// background-color: #fff;
// }
}
}
</style>
......@@ -116,19 +123,20 @@
</div>
</transition>
<div class="hdrImg">
<img v-for="(item, index) in hdr_src" :src="item" @click="selectImg('hdr',index)" :key="index"/>
<img v-for="(item, index) in hdr_src" v-if="!hdr.isErr" @error="error(item,index,'hdr')" :src="item" @click="selectImg('hdr',index)" :key="index"/>
<img v-else src="../../assets/imgErr.png"/>
</div>
<div class="info">
<h3>参数</h3>
<div class="content">
<div class="left">
<p>产品编号:{{hdr.sMaterialNo}}</p>
<p>幅宽:{{hdr.sWidth}}</p>
<p>产品名称:{{hdr.sMaterialName}}</p>
<p>规格:{{hdr.sSpecification}}</p>
<p>成分:{{hdr.sComponent}}</p>
</div>
<div class="right">
<p>产品名称:{{hdr.sMaterialName}}</p>
<p>幅宽:{{hdr.sWidth}}</p>
<p>克重:{{hdr.sGMWT}}</p>
</div>
</div>
......@@ -142,7 +150,8 @@
<v-layout row wrap>
<v-flex xs3 v-for="(item, index) in dtl_src" :key="index">
<div class="img">
<img :src="item" @click="selectImg('dtl',index)" />
<img :src="item" @error="error(item,index,'dtl')" v-if="!dtl[index].isErr" @click="selectImg('dtl',index)" />
<img v-else src="../../assets/imgErr.png"/>
</div>
<div style="border:1px solid #ddd;border-top:0;height:20px;font-size:12px;">
{{dtl[index].sColorNo}}
......@@ -156,12 +165,9 @@
</template>
<script>
import imageView from 'vue-imageview'
import imageView from 'vue-imageview'
import Util from '@/libs/util.js'
function nofind(e){
console.log(e,11)
}
export default {
name: 'specimen',
data () {
......@@ -180,25 +186,34 @@ export default {
},
async mounted(){
this.iProjectId = this.$route.params.iProjectId;
this.sMaterialNo = this.$route.params.sMaterialNo;
this.$route.params.sMaterialNo.split('.').map((x,y) => {
this.sMaterialNo += String.fromCharCode(x)
})
await this.getSpeciminHdr();
await this.getSpeciminDtl();
},
components:{
'image-view': imageView
},
methods:{
error(item,index,type){
if(type == 'hdr'){
this.$set(this.hdr,'isErr',true)
}else{
this.$set(this.dtl[index],'isErr',true)
}
},
async getSpeciminHdr(){
let result = await this.request('getSpeciminHdr',{
data:[
{key: "url", value: "sMaterialName"},
{key: "searchname", value: this.sMaterialNo}
]
},true,{iProject:this.iProject});
},true,{iProjectId:this.iProjectId,sUserName:'huansi'});
if(this.hdr.length <= 0) return false;
this.hdr = result[0];
this.hdr.isErr = false;
this.hdr_src.push(`https://weixin.huansi.net/apiproxy/huansi/Mall/mmmaterial/image_click/?iProjectId=${this.iProjectId}&iIden=${this.hdr.iIden}&m=${Math.random() / 9999}`)
},
async getSpeciminDtl(){
......@@ -207,11 +222,18 @@ export default {
{key: "url", value: "getDetail"},
{key: "iIden", value: this.hdr.iIden}
]
},true,{iProject:this.iProject});
},true,{iProjectId:this.iProjectId});
result.map(x=>{
x.tCreateTime = x.tCreateTime.replace(/-/g,'/').split('.')[0];
})
let data = result.sort((x,y)=>{
return new Date(x.tCreateTime).getTime() - new Date(y.tCreateTime).getTime();
})
data.map(x=>{
x.isErr = false;
this.dtl_src.push(`https://weixin.huansi.net/apiproxy/huansi/Mall/mmmaterial/image_click/?iProjectId=${this.iProjectId}&iIden=${x.iIden}&m=${Math.random() / 9999}`)
})
this.dtl = result;
this.dtl = data;
},
showImgView (type) {
if(type == 'hdr'){
......
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