Commit e7f6f9de by qiaoyanqi

复制单据加忽略字段

parent d5d8caf5
......@@ -6,14 +6,23 @@ export default {
let name = GMS.$hideContainer.addComponent(addInfoModal, {}, function (c) {
component = c;
c.bill = bill;
c.selectBill = bill.curForm.name;
if(!param.param.viewName){
GAMS.Common.messagePrompt('请在设计期配置复制的模板名称。');
}
c.selectBill = param.param.viewName;
let obj = bill.getBuillData(param.param);
if (obj.id) {
c.billId = obj.id;
//添加忽略字段,如果出现有引用关系的字段,需要置为空,不然会出问题
let ignoreTempFields = 'id,billCode,billState,flowState,BILLSTATEAUDIT,SHLLDEFINE,SHLLID,SQDH,';
if ('ignoreFields' in param.param && param.param.ignoreFields.length > 0) {
ignoreTempFields += param.param.ignoreFields
}
c.ignoreFields = ignoreTempFields.split(',');
c.modal_visible = true;
setTimeout(() => {
c.getNewBillId();
}, 1000)
c.modal_visible = true;
} else {
GAMS.Common.messagePrompt('请在单据中录入数据');
}
......
......@@ -64,6 +64,7 @@ export default {
bill: null,
data: {},
selectBill: "",
ignoreFields:[],
};
},
created() {},
......@@ -71,7 +72,8 @@ export default {
props: {},
methods: {
getNewBillId() {
let billdefine=this.bill.curForm.content.billdefine;
let that = this;
let billdefine= this.bill.curForm.content.billdefine;
GAMS.Util.invokeServer({
path: "/gms/bill/newed/" + billdefine,
type: "GET",
......@@ -79,15 +81,30 @@ export default {
})
.then(
function (data, textStatus, response) {
this.$refs.copyRefs.context.bill.getMasterData().setValue('id', data.content.id ? data.content.id : GAMS.Util.newId());
this.$refs.copyRefs.context.bill.getMasterData().setValue("billCode",data.content.billCode);
let tableObj = this.$refs.copyRefs.context.bill.getAllSubData();
for(let i in tableObj){
tableObj[i].forEach(element => {
element.setValue('id', '');
});
}
console.log(tableObj);
that.$nextTick(() => {
//需要考虑其他忽略的字段
//处理主表忽略字段置为空 id取一个新值
that.$refs.copyRefs.context.bill.getMasterData().setValue('id', data.content.id ? data.content.id : GAMS.Util.newId());
that.$refs.copyRefs.context.bill.getMasterData().setValue("billCode",data.content.billCode);
that.ignoreFields.forEach(v=> {
if(v && (v!='id'||v!='billCode')){
that.$refs.copyRefs.context.bill.getMasterData().setValue(v,null);
}
})
//处理子表忽略字段置为空
let tableObj = that.$refs.copyRefs.context.bill.getAllSubData();
if(tableObj){
for(let i in tableObj){
tableObj[i].forEach(element => {
that.ignoreFields.forEach(v=> {
if(v){
element.setValue(v, null);
}
})
});
}
}
})
}.bind(this)
)
.catch((XMLHttpRequest, textStatus, errorThrown) => {});
......
......@@ -1125,16 +1125,10 @@ export default {
"param": [
{
"isRequired": false,
"type": "Boolean",
"title": "启用自动忽略字段",
"key": "isAutoIgnoreField"
},
{
"isRequired": false,
"title": "自定义忽略字段",
"key": "ignoreFields",
"type": "String",
},
}
]
},
"description": "",
......@@ -1167,7 +1161,20 @@ export default {
"discard": false,
"path": "单据/复制单据",
"extends": {
"param": []
"param": [
{
"isRequired": false,
"title": "自定义忽略字段",
"key": "ignoreFields",
"type": "String",
},
{
"ref": "bill",
"type": "metaData",
"title": "选择复制单据",
"key": "viewName"
}
]
},
"description": "",
"title": "复制单据[copyBillAction]",
......
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