Commit fc97fca8 by qiaoyanqi

上张下张抽取出去一个js 多页签 刷新单据,需要判断是否是当前页签

parent 76168405
import {setQueryIndex} from '../query-actions/util/queryTag.js';
export default {
execute(context, param) {
GMS.queryObject.index=-1;//上张下张用
setQueryIndex(-1);//上张下张用
// 新建单据状态设置为可编辑,单据id为空
GMS.vbus.$emit('change-form-state', {state: '', billId: null})
},
......
import {setQueryIndex} from '../query-actions/util/queryTag.js';
export default {
execute(bill, param) {
GMS.$hideContainer.$Modal.confirm({
......@@ -21,7 +22,7 @@ export default {
if (data.status == 200 && data.data.code == 0) {
GMS.$hideContainer.$Modal.remove();
GMS.$hideContainer.$Message.success('删除成功');
GMS.queryObject.index=-1;//上张下张用
setQueryIndex(-1);//上张下张用 ,删除成功后,跳转到新建界面
GMS.vbus.$emit('change-form-state', {state: '', billId: null})
} else {
GMS.$hideContainer.$Modal.remove();
......
import { compareData } from "../components-control/util/dataChange.js";
import {setQueryIndex , getQueryIndex ,getQuerySet} from '../query-actions/util/queryTag.js';
export default {
execute(bill, param) {
// 首张、上张、下张、末张
......@@ -6,7 +7,9 @@ export default {
if (param.name.split('_action_gams')) {
actionName = param.name.split('_action_gams')[1];
}
let flag = compareData(GMS.oldBillData, bill.getBuillData());
let curTagId = window.nros.context.getCurrTag();
let oldObj = curTagId && GMS.oldBillDataMap[curTagId]?GMS.oldBillDataMap[curTagId]:GMS.oldBillData;
let flag = compareData(oldObj, bill.getBuillData()) || bill.getGlobalParam("noRunTimeFormula");
if (flag) {
this.getOtherPage(actionName);
} else {
......@@ -25,38 +28,33 @@ export default {
}
},
async getOtherPage(action) {
let page = GMS.queryObject.currentDataQueryConditionSet.page;
let index =
GMS.queryObject.index == -1
? GMS.queryObject.index
: (page.pageNum - 1) * page.size + GMS.queryObject.index;
const queryCondition = getQuerySet();
let page = queryCondition.page;
let index = getQueryIndex() == -1? getQueryIndex() : (page.pageNum - 1) * page.size + getQueryIndex();
const url = `/rbc/bill/move/${action.toUpperCase()}/${index}`;
const { data } = await window.GMS.$http.post(
url,
GMS.queryObject.currentDataQueryConditionSet
queryCondition
);
if (data) {
console.log(data.data.id);
if (data.data && data.data.id) {
if (action == "down") {
GMS.queryObject.index++;
setQueryIndex('add');
} else if (action == "upward") {//上张不能无限减小
if(GMS.queryObject.index>0){
GMS.queryObject.index--;
}else{
GMS.queryObject.index = 0;
}
setQueryIndex('min');
} else if (action == "first") {
GMS.queryObject.index = 0;
setQueryIndex(0);
} else if (action == "last") {
GMS.queryObject.index = data.data.count - 1;
setQueryIndex(data.data.count - 1);
}
let state = 'readOnly';
let curTagId = window.nros.context.getCurrTag();
if (
window.osConfig.appOpenMode &&
window.osConfig.appOpenMode == "apploader"
) {
GMS.$hideContainer.$portalAPI.emit("resetBillData", data.data.id,state);
GMS.$hideContainer.$portalAPI.emit("resetBillData", data.data.id,state,curTagId);
} else {
GMS.vbus.$emit("resetBillData", data.data.id,state);
}
......
import errorMessageUtil from "./util/errorMessageUtil";
import {initIndexZero} from '../query-actions/util/queryTag.js';
export default {
execute: function (bill, param) {
if (bill) {
......@@ -110,12 +111,7 @@ export default {
bill.getMasterData().setValue("recver", response.data.content.billData.recver);
bill.getMasterData().setValue("billCode", response.data.content.billData.billCode);
const id = response.data.content.billData.id;
//处理上张下张
if (GMS.queryObject) {
if(GMS.queryObject.index==-1){
GMS.queryObject.index=0;
}
}
initIndexZero();//处理上张下张
GMS.vbus.$Message.success("保存成功");
if (param.param && param.param.isApprove) {
GMS.vbus.$emit('change-form-state', { state: ''})
......
import errorMessageUtil from "./util/errorMessageUtil";
import {minusIndex} from '../query-actions/util/queryTag.js';
export default {
execute: function (bill, param) {
if (param && param.param && param.param.budgetcontrol) {
......@@ -79,9 +79,7 @@ export default {
bill.setControlsSate(param["_control_name_"], 'enable', true)
if (code === 200) {
const id = data.content.billData.id;
if(GMS.queryObject){
GMS.queryObject.index = GMS.queryObject.index*1 - 1;//上张下张用
}
minusIndex();//上张下张用
GMS.$hideContainer.$Message.success('提交成功');
GMS.vbus.$emit("workflow-state-change", 90)
} else if (code === 201) {
......
import errorMessageUtil from "./util/errorMessageUtil";
import {initIndexZero} from '../query-actions/util/queryTag.js';
/**
* 暂存按钮
* 不触发校验公式 调用已有保存逻辑
......@@ -100,10 +100,7 @@ export default {
bill.getMasterData().setValue("recver", response.data.content.billData.recver);
bill.getMasterData().setValue("billCode", response.data.content.billData.billCode);
const id = response.data.content.billData.id;
//处理上张下张
if(GMS.queryObject.index==-1){
GMS.queryObject.index=0;
}
initIndexZero();//处理上张下张
GMS.vbus.$Message.success("暂存成功");
GMS.vbus.$emit('change-form-state', {state: 'readOnly', billId: id})
GMS.vbus.$emit("saveSuccess", buidData, param);
......
import typesBill from "../components-control/typesBill.vue";
import {getUUID} from './util/lib.js'
import {setQueryTag} from './util/queryTag.js';
export default {
execute(context, param) {
GMS.queryObject = {//上张下张用
currentDataQueryConditionSet: context.currentDataQueryConditionSet,
index: -1,
templateName:param.viewName,
isReadOnly:false
}
const uuid = getUUID();
setQueryTag(context.currentDataQueryConditionSet,-1,param.viewName,uuid);//上张下张用
let templateName = null;
if (Object.prototype.toString.call(param) === "[object Array]") {
templateName = param[0];
......@@ -20,7 +17,7 @@ export default {
) {
GMS.$hideContainer.$portalAPI.emit(
"open-new-page", //打开一个新的页签
getUUID(),
uuid,
"runner-bill-form",
{
templateName: templateName,
......
import typesBill from "../components-control/typesBill.vue";
import { getUUID } from "./util/lib.js";
import {setQueryTag} from './util/queryTag.js';
export default {
execute(context, param) {
GMS.queryObject = {//上张下张用
currentDataQueryConditionSet: context.currentDataQueryConditionSet,
index: context.selects[0]._index||(context.selects[0]._serialIndex)*1-1,
templateName:param.viewName,
isReadOnly:false
}
const uuid = getUUID();
let index = context.selects[0]._index||(context.selects[0]._serialIndex)*1-1;
setQueryTag(context.currentDataQueryConditionSet,index,param.viewName,uuid);//上张下张用
GMS.vbus.$off("cacheEcho");
let templateName = param.viewName;
let billId = context.selects[0][param.billId];
......@@ -17,7 +16,7 @@ export default {
) {
GMS.$hideContainer.$portalAPI.emit(
"open-new-page", //打开一个新的页签
getUUID(),
uuid,
"runner-bill-form",
{
templateName: templateName,
......
import typesBill from "../components-control/typesBill.vue";
import { getUUID } from "./util/lib.js";
import {setQueryTag} from './util/queryTag.js';
export default {
execute(context, param) {
if (!param.billId || !param.viewName || !param.taskId) {
context.dom.$Message.info("请配置跳转页面的参数");
return;
}
const billState = param.canEdit? '': 'readOnly'
GMS.queryObject = {//上张下张用
currentDataQueryConditionSet: context.currentDataQueryConditionSet,
index: context.selects[0]._index||(context.selects[0]._serialIndex)*1-1,
templateName:param.viewName,
isReadOnly:true
}
const uuid = getUUID();
const billState = param.canEdit ? '': 'readOnly'
let index = context.selects[0]._index||(context.selects[0]._serialIndex)*1-1;
setQueryTag(context.currentDataQueryConditionSet,index,param.viewName,uuid);//上张下张用
let templateName = param.viewName;
let billId = context.selects[0][param.billId];
window.GMS.workflowTaskId = context.selects[0][param.taskId]
......@@ -22,7 +20,7 @@ export default {
) {
GMS.$hideContainer.$portalAPI.emit(
"open-new-page", //打开一个新的页签
getUUID(),
uuid,
"runner-bill-form",
{
templateName: templateName,
......
import typesBill from '../components-control/typesBill.vue';
import { getUUID } from "./util/lib.js";
import {setQueryTag} from './util/queryTag.js';
export default {
execute(context, param) {
console.log(11111, context, param)
if (!param.billId || !param.viewName) {
context.dom.$Message.info("请配置跳转页面的参数");
return;
}
GMS.queryObject = {//上张下张用
currentDataQueryConditionSet: context.currentDataQueryConditionSet,
index: context.selects[0]._index||(context.selects[0]._serialIndex)*1-1,
templateName: context.selects[0][param.viewName],
isReadOnly: true,
}
const uuid = getUUID();
const templateName = context.selects[0][param.viewName];
const index = context.selects[0]._index||(context.selects[0]._serialIndex)*1-1;
setQueryTag(context.currentDataQueryConditionSet,index,templateName,uuid);//上张下张用
if (
window.osConfig.appOpenMode &&
window.osConfig.appOpenMode == "apploader"
) {
GMS.$hideContainer.$portalAPI.emit(
"open-new-page", //打开一个新的页签
getUUID(),
uuid,
"runner-bill-form",
{
templateName: context.selects[0][param.viewName],
templateName: templateName,
id: context.selects[0][param.billId],
state: 'readOnly',
hideButtonGroup: param.hideButton? true: false
......@@ -34,7 +33,7 @@ export default {
);
} else {
GMS.$hideContainer.addComponent(typesBill, {}, function (c) {
c.templateName = context.selects[0][param.viewName];
c.templateName = templateName;
c.billId = context.selects[0][param.billId];
c.init = true;
c.modal_visible = true;
......
import typesBill from "../components-control/typesBill.vue";
import { getUUID } from "./util/lib.js";
import {setQueryTag} from './util/queryTag.js';
export default {
execute(context, param) {
if (!param.billId || !param.viewName) {
context.dom.$Message.info("请配置跳转页面的参数");
return;
}
GMS.queryObject = {//上张下张用
currentDataQueryConditionSet: context.currentDataQueryConditionSet,
index: context.selects[0]._index||(context.selects[0]._serialIndex)*1-1,
templateName:param.viewName,
isReadOnly:true
}
let templateName = param.viewName;
const templateName = param.viewName;
const index = context.selects[0]._index||(context.selects[0]._serialIndex)*1-1;
const uuid = getUUID();
setQueryTag(context.currentDataQueryConditionSet,index,templateName,uuid);//上张下张用
let billId = context.selects[0][param.billId];
if (
window.osConfig.appOpenMode &&
......@@ -20,7 +18,7 @@ export default {
) {
GMS.$hideContainer.$portalAPI.emit(
"open-new-page", //打开一个新的页签
getUUID(),
uuid,
"runner-bill-form",
{
templateName: templateName,
......
/**
* 查询列表点击操作按钮,记录当前行信息,用于上张、下张
* @author qiaoyanqi
* @date 2022-03-11
*/
//window.nros.context.getCurrTag() || "router"; //如果是页签形式的话,就需要记录每个页签的情况,如果是路由模式,只记录一种即可。
/**
*
* @param {object} querySet -查询条件
* @param {number} index -下标
* @param {string} templateName - 单据子表
* @param {string} uuid - 打开单据的uuid
*/
export function setQueryTag(querySet, index, templateName,uuid) {
let curTagId = uuid || 'router';
if(!GMS.queryObject){
GMS.queryObject = {};
}
GMS.queryObject[curTagId] = {
//上张下张用
currentDataQueryConditionSet: querySet,
index: index,
templateName: templateName,
};
}
//获取查询条件
export function getQuerySet() {
let curTagId = window.nros.context.getCurrTag() || "router";
return GMS.queryObject && GMS.queryObject[curTagId].currentDataQueryConditionSet;
console.log('没有获取到查询条件');
}
//获取下标
export function getQueryIndex() {
let curTagId = window.nros.context.getCurrTag() || "router";
return GMS.queryObject && GMS.queryObject[curTagId].index;
console.log('没有获取到下标');
}
//给下标赋值
export function setQueryIndex(index) {
let curTagId = window.nros.context.getCurrTag() || "router";
if(GMS.queryObject){
if (index == "add") {
GMS.queryObject[curTagId].index++;
} else if (index == "min") {
GMS.queryObject[curTagId].index = getQueryIndex() > 0?GMS.queryObject[curTagId].index--:0;
} else {
GMS.queryObject[curTagId].index = index;
}
}
}
//如果index为-1的话,设置为0
export function initIndexZero() {
let curTagId = window.nros.context.getCurrTag() || "router";
if (GMS.queryObject && getQueryIndex() == -1) {
GMS.queryObject[curTagId].index = 0;
}
}
//下标减一
export function minusIndex() {
let curTagId = window.nros.context.getCurrTag() || "router";
if (GMS.queryObject) {
GMS.queryObject[curTagId].index = getQueryIndex() * 1 - 1; //上张下张用
}
}
......@@ -110,7 +110,10 @@ export default {
GMS.oldBillDataMap[this.curTagId] = bill.getBuillData()
}, 100);
},
changeData(billId,state) {
changeData(billId,state,curTagId) {
if(curTagId!=this.curTagId){
return
}
this.init = false;
this.$nextTick(() => {
this.type = 'load';
......
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