Commit 878ed045 by fukai

修改

parent f703822e
<template> <template>
<div class="bus-button"> <div class="bus-button">
<c-button type="primary" v-onclick="save">提交</c-button> <c-button type="primary" v-on:click="save">提交</c-button>
<c-button type="primary" v-onclick="pedding">暂存</c-button> <c-button type="primary" v-on:click="pedding">暂存</c-button>
<c-button type="primary" v-onclick="check">校核</c-button> <c-button type="primary" v-on:click="check">校核</c-button>
<c-button v-onclick="exit">退出</c-button> <c-button v-on:click="exit">退出</c-button>
</div> </div>
</template> </template>
<script> <script>
import commonApi from "~/mixin/commonApi"
export default { export default {
props:["parent"], props:["$pntvm"],
data(){ data(){
return{
}
}, },
methods:{ methods:{
save(){ async save(){
console.log(123)
let vm = this.getVM();
let result = await vm.save()
console.log(result)
}, },
pedding(){ async pedding(){
let result = await this.getVM().pedding()
console.log(result)
}, },
check(){ async check(){
let result = await this.getVM().checkAll()
if(result.respCode != SUCCESS)
{
this.$notify.error({title: '错误',message: result.respMsg});
}
}, },
exit(){ exit(){
this.$history.push("/home")
},
getVM(){
return this.$pntvm
} }
} }
} }
......
...@@ -13,7 +13,7 @@ import store from "./store" ...@@ -13,7 +13,7 @@ import store from "./store"
import CustomComponent from "./components" import CustomComponent from "./components"
import VueFunc from "./utils/vuefunc" import VueFunc from "./utils/vuefunc"
window.SUCCESS="00000" window.SUCCESS="AAAAAA"
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(CustomComponent) Vue.use(CustomComponent)
......
import Api from "~/service/Api"
import Utils from "../utils"
export default {
data(){
return {}
},
methods:{
init(params){
params = params||{}
return Api.post(this.declareParams.trnName+"/init",{params})
},
save(params){
params = params||{}
let data = Utils.flatObject(this.model)
return Api.post(this.declareParams.trnName+"/saveData",{...data,params})
},
exeuteCheck(rulePath,params){
params = params||{}
let data = Utils.flatObject(this.model)
return Api.post(this.declareParams.trnName+"/executeCheck/"+rulePath,{...data,params})
},
executeDefault(rulePath,params)
{
params = params||{}
let data = Utils.flatObject(this.model)
return Api.post(this.declareParams.trnName+"/default/"+rulePath,{...data,params})
},
executeRule(rulePath,params)
{
params = params||{}
let data = Utils.flatObject(this.model)
return Api.post(this.declareParams.trnName+"/executeRule/"+rulePath,{...data,params})
},
checkAll(params){
params = params||{}
let data = Utils.flatObject(this.model)
return Api.post(this.declareParams.trnName+"/checkAll",{...data,params})
},
pedding(params){
params = params||{}
let data = Utils.flatObject(this.model)
return Api.post(this.declareParams.trnName+"/pending",{...data,params})
}
}
}
\ No newline at end of file
export default{
data(){
return {
version:"1.0",
trnName:"",
}
},
computed:{
declareParams(){
return {
version:this.version,
trnName:this.trnName,
}
}
}
}
\ No newline at end of file
import commonDeclare from "./commonDeclare"
import commonApi from "./commonApi"
export default { export default {
mixins: [], mixins: [commonApi,commonDeclare],
data: function () { data: function () {
return { return {
} }
......
...@@ -10,6 +10,9 @@ const instance = axios.create({ ...@@ -10,6 +10,9 @@ const instance = axios.create({
method: 'post', method: 'post',
}); });
const CODE_KEY = "respCode"
const MESSAGE_KEY = "respMsg"
export default class Api export default class Api
{ {
static pget(url,data) static pget(url,data)
...@@ -72,11 +75,11 @@ export default class Api ...@@ -72,11 +75,11 @@ export default class Api
}) })
.then(response=>{ .then(response=>{
const {data} = response; const {data} = response;
if(data && data.code != SUCCESS) if(data && data[CODE_KEY] != SUCCESS)
{ {
console.log("错误码:"+data.code+" 错误信息:"+data.message) console.log("错误码:"+data[CODE_KEY]+" 错误信息:"+data[MESSAGE_KEY])
} }
if(data && data.code == 'L0003'){ if(data && data[CODE_KEY] == 'L0003'){
window.sessionStorage.removeItem("token") window.sessionStorage.removeItem("token")
window.sessionStorage.removeItem("userId") window.sessionStorage.removeItem("userId")
MessageBox.alert({ MessageBox.alert({
...@@ -98,17 +101,17 @@ export default class Api ...@@ -98,17 +101,17 @@ export default class Api
console.log(error.response.data); console.log(error.response.data);
console.log(error.response.status); console.log(error.response.status);
console.log(error.response.headers); console.log(error.response.headers);
resolve({retcod:'500',retmsg:error.response.status}); resolve({[CODE_KEY]:'500',[MESSAGE_KEY]:error.response.status});
} else if (error.request) { } else if (error.request) {
// The request was made but no response was received // The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js // http.ClientRequest in node.js
console.log(error.request); console.log(error.request);
resolve({retcod:'501'}); resolve({[CODE_KEY]:'501'});
} else { } else {
// Something happened in setting up the request that triggered an Error // Something happened in setting up the request that triggered an Error
console.log('Error', error.message); console.log('Error', error.message);
resolve({retcod:'502',retmsg:error.message}); resolve({[CODE_KEY]:'502',[MESSAGE_KEY]:error.message});
} }
console.log(error.config); console.log(error.config);
}); });
......
...@@ -85,13 +85,14 @@ ...@@ -85,13 +85,14 @@
</el-tabs> </el-tabs>
<c-bus-button></c-bus-button> <c-bus-button :$pntvm="this"></c-bus-button>
</el-form> </el-form>
</div> </div>
</c-page> </c-page>
</template> </template>
<script> <script>
import Api from "~/service/Api" import Api from "~/service/Api"
import Utils from "~/utils/index"
import CodeTable from "~/config/CodeTable" import CodeTable from "~/config/CodeTable"
import Ditopn from "~/model/Ditopn" import Ditopn from "~/model/Ditopn"
import CommonProcess from "~/mixin/CommonProcess" import CommonProcess from "~/mixin/CommonProcess"
...@@ -142,6 +143,7 @@ export default { ...@@ -142,6 +143,7 @@ export default {
}, },
data(){ data(){
return { return {
trnName:"ditopn",
model:new Ditopn().data, model:new Ditopn().data,
checkRules: Check, checkRules: Check,
defaultRules: Default, defaultRules: Default,
...@@ -164,11 +166,11 @@ export default { ...@@ -164,11 +166,11 @@ export default {
}, },
created:async function(){ created:async function(){
console.log("进入ditopn交易"); console.log("进入ditopn交易");
let rtnmsg = await Api.post("ditopn/init",{params:{}}) let rtnmsg = await this.init()
if(rtnmsg.retcod == SUCCESS) if(rtnmsg.respCode == SUCCESS)
{ {
//TODO 处理数据逻辑 //更新数据
Utils.copyValueFromVO(this.model,rtnmsg.data)
} }
else else
{ {
......
...@@ -59,7 +59,7 @@ module.exports = (options = {}) => ({ ...@@ -59,7 +59,7 @@ module.exports = (options = {}) => ({
port: 8010, port: 8010,
proxy: { proxy: {
'/gjjs/': { '/gjjs/': {
target: 'http://127.0.0.1:8070', target: 'http://127.0.0.1:8081',
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/gjjs': '/gjjs' '^/gjjs': '/gjjs'
......
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