Commit 4b48e871 by 潘际乾

获取请求参数的函数getRequestDataFn提取至commonProcess

parent df69cb12
......@@ -13,25 +13,25 @@ export default {
return Api.post(this.declareParams.trnName+"/init",{params})
},
save(params){
return Api.post(this.declareParams.trnName+"/saveData", Utils.getRequestDataFn.call(this, params))
return Api.post(this.declareParams.trnName+"/saveData", this.wrapper(params))
},
exeuteCheck(rulePath,params){
return Api.post(this.declareParams.trnName+"/executeCheck/"+rulePath, Utils.getRequestDataFn.call(this, params))
return Api.post(this.declareParams.trnName+"/executeCheck/"+rulePath, this.wrapper(params))
},
executeDefault(rulePath,params)
{
return Api.post(this.declareParams.trnName+"/executeDefault/"+rulePath, Utils.getRequestDataFn.call(this, params))
return Api.post(this.declareParams.trnName+"/executeDefault/"+rulePath, this.wrapper(params))
},
executeRule(rulePath,params)
{
return Api.post(this.declareParams.trnName+"/executeRule/"+rulePath, Utils.getRequestDataFn.call(this, params))
return Api.post(this.declareParams.trnName+"/executeRule/"+rulePath, this.wrapper(params))
},
async checkAll(params){
const res = await Api.post(this.declareParams.trnName+"/checkAll", Utils.getRequestDataFn.call(this, params))
const res = await Api.post(this.declareParams.trnName+"/checkAll", this.wrapper(params))
return res
},
pedding(params){
return Api.post(this.declareParams.trnName+"/pending", Utils.getRequestDataFn.call(this, params))
return Api.post(this.declareParams.trnName+"/pending", this.wrapper(params))
},
async restoreDisplay()
{
......@@ -43,7 +43,7 @@ export default {
},
executeNotify(params)
{
return Api.post(this.declareParams.trnName+"/executeNotify", Utils.getRequestDataFn.call(this, params))
return Api.post(this.declareParams.trnName+"/executeNotify", this.wrapper(params))
},
}
}
\ No newline at end of file
......@@ -97,6 +97,26 @@ export default {
return "blur";
},
/**
* 以函数形式获取model(请求参数),保证取到的是最新赋值的
* @param {any} params 参数
* @returns
*/
wrapper(params) {
params = params || {}
const fn = async () => {
const that = this;
const data = await new Promise(resolve => {
// 保证前一次请求结果赋值VO完成
setTimeout(() => {
const d = Utils.flatObject(that.model)
resolve(d)
}, 0)
})
return {...data, params}
}
return fn;
},
/**
* 更新Model
* @param {any} data model数据
*/
......
......@@ -5,7 +5,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("sptsel/usfmod_shwflt", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("sptsel/usfmod_shwflt", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -19,7 +19,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("sptsel/butypt", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("sptsel/butypt", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -33,7 +33,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("sptsel/dlmft", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("sptsel/dlmft", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -47,7 +47,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("sptsel/dlaxq", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("sptsel/dlaxq", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -61,7 +61,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("sptsel/butimg", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("sptsel/butimg", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......
......@@ -11,7 +11,7 @@ export default {
that.$refs.inftrnps.stmData.data = res.data.trncorco_trnstm.rows;
this.model.trncorco.trnstm = res.data.trncorco_trnstm;
})
// let rtnmsg = await Api.post("trnrel/executeRule/searow", Utils.getRequestDataFn.call(this))
// let rtnmsg = await Api.post("trnrel/executeRule/searow", this.wrapper())
// if (rtnmsg.respCode == "AAAAAA") {
// //TODO 处理数据逻辑
// this.stmData.data = rtnmsg.data.trncorco_trnstm.rows;
......@@ -36,7 +36,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/seactr", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/seactr", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -51,7 +51,7 @@ export default {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/searow", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/searow", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -65,7 +65,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/dsp", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/dsp", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -79,7 +79,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/imgmod_newimg", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/imgmod_newimg", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -93,7 +93,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/imgmod_newhisimg", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/imgmod_newhisimg", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -107,7 +107,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/diacon_butdia", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/diacon_butdia", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -121,7 +121,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/imgmod_hisimg", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/imgmod_hisimg", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -139,7 +139,7 @@ export default {
that.model.trncorco.selinr = {
"rows": that.multipleSelection.map(idx => that.model.trncorco.trnstm.rows[idx])
}
const data = Utils.getRequestDataFn.call(this)
const data = this.wrapper()
let rtnmsg = await Api.post("/trnrel/executeRule/relrow", data)
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -169,7 +169,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/printe", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/printe", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -183,7 +183,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/reprow", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/reprow", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -200,7 +200,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
// if (!valid)
// return;
let rtnmsg = await Api.post("trnrel/rejrow", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/rejrow", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
// var cacheFileName = rtnmsg.data.cacheFileName;
......@@ -231,7 +231,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/relcor", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/relcor", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -245,7 +245,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/exi", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/exi", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -260,7 +260,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/recpan_det", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/recpan_det", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -274,7 +274,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/syswrn_butshw", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/syswrn_butshw", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -288,7 +288,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/recpan_notmap", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/recpan_notmap", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -302,7 +302,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/recpan_butspt", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/recpan_butspt", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -316,7 +316,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/recpan_inc", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/recpan_inc", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -330,7 +330,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/recpan_butord", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/recpan_butord", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -344,7 +344,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/imgmod_image", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/imgmod_image", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -358,7 +358,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/recpan_incben", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/recpan_incben", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......@@ -372,7 +372,7 @@ export default {
this.root.$refs.modelForm.validate(async valid => {
if (!valid)
return;
let rtnmsg = await Api.post("trnrel/inftxt_buttxmsel", Utils.getRequestDataFn.call(this))
let rtnmsg = await Api.post("trnrel/inftxt_buttxmsel", this.wrapper())
if (rtnmsg.respCode == "AAAAAA") {
//TODO 处理数据逻辑
......
......@@ -142,22 +142,6 @@ export default class Utils {
return output.join('');
}
static getRequestDataFn(params) {
params = params||{}
const fn = async () => {
const that = this;
const data = await new Promise(resolve => {
// 保证前一次请求结果赋值VO完成
setTimeout(() => {
const d = Utils.flatObject(that.model)
resolve(d)
}, 0)
})
return {...data, params}
}
return fn;
}
static positioningErrorMsg(fieldErrors, formFields) {
let firstErrorItem = null
for (let i = 0; i < formFields.length; i++) {
......
......@@ -360,39 +360,36 @@ import Utils from "~/utils/index"
export default {
inject: ['root'],
props: ["model", "codes"],
components: { SetpanDialog },
data() {
return {
dialogVisible2: false,
dialog2: {
feetxtinf:"",
feetxt:"",
},
index: 0,
data:[]
};
},
methods: {
...Event,
dispDefault(){
Api.post("cptopn/executeDefault/mac",Utils.getRequestDataFn.call(this)).then(res=>{
Utils.copyValueFromVO(this.model, res.data)
props: ["model", "codes"],
components: { SetpanDialog },
data() {
return {
dialogVisible2: false,
dialog2: {
feetxtinf:"",
feetxt:"",
},
index: 0,
data:[]
};
},
methods: {
...Event,
dispDefault(){
this.executeDefault("mac").then(res=>{
Utils.copyValueFromVO(this.model, res.data)
})
},
detail2(index, row) {
Api.post("cptopn/executeRule/det",Utils.getRequestDataFn.call(this)).then(res=>{
this.dialogVisible2 = true;
this.index = index;
this.dialog2 = row
})
this.executeRule("det").then(res=>{
this.dialogVisible2 = true;
this.index = index;
this.dialog2 = row
})
},
},
created: function () {},
},
created: function () {},
};
</script>
<style>
......
......@@ -147,8 +147,7 @@ export default {
this.model.didgrp.rec.tenmaxday = 0;
this.model.didgrp.blk.defdet = "";
}
const arg = Utils.getRequestDataFn.call(this);
Api.post("ditopn/executeCheck/didgrp.rec.avbby", arg).then(
this.executeCheck("didgrp.rec.avbby").then(
(res) => {
if (res.respCode == "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
......@@ -157,8 +156,7 @@ export default {
);
},
recTenmaxdayEvent(){
const arg = Utils.getRequestDataFn.call(this);
Api.post("ditopn/executeDefault/didgrp.rec.tenmaxday", arg).then(
this.executeDefault("didgrp.rec.tenmaxday").then(
(res) => {
if (res.respCode = "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
......
......@@ -528,16 +528,14 @@ export default {
this.centerDialogVisible = false;
console.log(this.model);
this.model.trnmod.trndoc.doceot.splice(this.index, 1, this.dialog);
let res = Api.post(
"ditopn/executeRule/trnmod.trndoc.doccur.butaddok",
Utils.getRequestDataFn.call(this)
);
if(res.data.respCode=="AAAAAA"){
//TODO
}else{
this.$notify.error({ title: '错误', message: '服务请求失败!' });
}
this.executeRule("trnmod.trndoc.doccur.butaddok").then(res => {
if(res.data.respCode=="AAAAAA"){
//TODO
}else{
this.$notify.error({ title: '错误', message: '服务请求失败!' });
}
})
},
},
created: function () {},
......
......@@ -734,8 +734,7 @@ export default {
}
},
nom1CurEvent(){
const data = Utils.flatObject(this.model);
Api.post("ditopn/executeDefault/didgrp.cbs.nom1.cur", Utils.getRequestDataFn.call(this)).then(
this.executeDefault("didgrp.cbs.nom1.cur").then(
(res) => {
if (res.respCode = "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
......
......@@ -433,26 +433,26 @@ export default {
},
// 第二个表格
detail1(index, row) {
Api.post("ditopn/executeDefault/det",Utils.getRequestDataFn.call(this)).then(res=>{
this.executeDefault("det").then(res=>{
this.dialogVisible = true;
this.dialog = row;
this.index = index;
this.dialog = row;
this.index = index;
})
},
dispDefault(){
Api.post("ditopn/executeDefault/mac",Utils.getRequestDataFn.call(this)).then(res=>{
Utils.copyValueFromVO(this.model, res.data)
this.executeDefault("mac").then(res=>{
Utils.copyValueFromVO(this.model, res.data)
})
},
// 第三个表格
detail2(index, row) {
Api.post("ditopn/executeRule/det",Utils.getRequestDataFn.call(this)).then(res=>{
this.dialogVisible2 = true;
this.index = index;
this.dialog2 = row
})
this.executeRule("det").then(res=>{
this.dialogVisible2 = true;
this.index = index;
this.dialog2 = row
})
},
},
created: function () {},
......
......@@ -147,8 +147,7 @@ export default {
this.model.didgrp.rec.tenmaxday = 0;
this.model.didgrp.blk.defdet = "";
}
const arg = Utils.getRequestDataFn.call(this);
Api.post("ditopn/executeCheck/didgrp.rec.avbby", arg).then(
this.executeCheck("didgrp.rec.avbby").then(
(res) => {
if (res.respCode == "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
......@@ -157,8 +156,7 @@ export default {
);
},
recTenmaxdayEvent(){
const arg = Utils.getRequestDataFn.call(this);
Api.post("ditopn/executeDefault/didgrp.rec.tenmaxday", arg).then(
this.executeDefault("didgrp.rec.tenmaxday").then(
(res) => {
if (res.respCode = "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
......
......@@ -528,16 +528,14 @@ export default {
this.centerDialogVisible = false;
console.log(this.model);
this.model.trnmod.trndoc.doceot.splice(this.index, 1, this.dialog);
let res = Api.post(
"ditopn/executeRule/trnmod.trndoc.doccur.butaddok",
Utils.getRequestDataFn.call(this)
);
if(res.data.respCode=="AAAAAA"){
//TODO
this.executeRule("trnmod.trndoc.doccur.butaddok").then(res => {
if(res.data.respCode=="AAAAAA"){
//TODO
}else{
this.$notify.error({ title: '错误', message: '服务请求失败!' });
}
}else{
this.$notify.error({ title: '错误', message: '服务请求失败!' });
}
})
},
},
created: function () {},
......
......@@ -713,8 +713,7 @@ export default {
}
},
nom1CurEvent(){
const data = Utils.flatObject(this.model);
Api.post("ditopn/executeDefault/didgrp.cbs.nom1.cur", Utils.getRequestDataFn.call(this)).then(
this.executeDefault("didgrp.cbs.nom1.cur").then(
(res) => {
if (res.respCode = "AAAAAA"){
Utils.copyValueFromVO(this.model, res.data);
......
......@@ -432,26 +432,26 @@ export default {
},
// 第二个表格
detail1(index, row) {
Api.post("ditopn/executeDefault/det",Utils.getRequestDataFn.call(this)).then(res=>{
this.executeDefault("det").then(res=>{
this.dialogVisible = true;
this.dialog = row;
this.index = index;
this.dialog = row;
this.index = index;
})
},
dispDefault(){
Api.post("ditopn/executeDefault/mac",Utils.getRequestDataFn.call(this)).then(res=>{
Utils.copyValueFromVO(this.model, res.data)
this.executeDefault("mac").then(res=>{
Utils.copyValueFromVO(this.model, res.data)
})
},
// 第三个表格
detail2(index, row) {
Api.post("ditopn/executeRule/det",Utils.getRequestDataFn.call(this)).then(res=>{
this.dialogVisible2 = true;
this.index = index;
this.dialog2 = row
})
this.executeRule("det").then(res=>{
this.dialogVisible2 = true;
this.index = index;
this.dialog2 = row
})
},
},
created: function () {},
......
......@@ -194,7 +194,7 @@ export default {
console.log("进入office交易");
if(1) return
let rtnmsg = await Api.post("office/init",Utils.getRequestDataFn.call(this, {}))
let rtnmsg = await this.init()
console.log(rtnmsg)
if(rtnmsg.code == SUCCESS)
{
......
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