Commit e747a22e by Joey

feat(@gms/gms-plugin-billexpand): 增加公式

parent 2b04601e
......@@ -2097,6 +2097,45 @@ export default {
"title": "通过code获取指定基础数据项",
"value": "GetMDByCode"
},
{
"discard": false,
"path": "通用",
"extends": {
"info": {
"param": [
],
"name": "GetOwnProperty",
"description": "GetOwnProperty",
"title": "GetOwnProperty",
"return": 0
}
},
"description": "GetOwnProperty",
"title": "GetOwnProperty",
"value": "GetOwnProperty"
},
{
"discard": false,
"path": "通用",
"extends": {
"info": {
"param": [
],
"name": "GetMDByObjectcode",
"description": "GetMDByObjectcode",
"title": "GetMDByObjectcode",
"return": 0
}
},
"description": "GetMDByObjectcode",
"title": "GetMDByObjectcode",
"value": "GetMDByObjectcode"
},
{
"discard": false,
"path": "通用",
......
// 通过code获取指定基础数据项(当前版本)
import { getValue } from './util'
export default {
execute: async function () {
if (arguments && arguments[0] && arguments[0][0] && arguments[0][1] && arguments[1]) {
let
tablename = arguments[0][0].StaticValue//基础数据表名
, mdcodeArg = arguments[0][1]//基础数据code
, context = arguments[1];
let mdcode = await getValue(mdcodeArg)
let mdObject = await this.getMDObject(tablename, mdcode);
return mdObject;
} else {
GAMS.Common.messagePrompt('GetMDByCode公式:参数配置有误');
return '';
}
},
getResultType: function () {
return FMR.ConstDataTypes.General;
},
// 获取基础数据
getMDObject(name, code) {
let param = {
"limit": 1,
"offset": 0,
"pagination": true,
"tableName": name,
"objectcode": code,//按code和name过滤
"queryDataStructure": "ALL"//返回的接口类型
}
return new Promise((resolve, reject) => {
let promise = GMS.$http.post("/baseData/data/list", param);
promise
.then((data) => {
if (data.data && data.data.rows && data.data.rows.length > 0) {
resolve(data.data.rows[0]);
} else {
resolve([]);
}
})
.catch((error) => {
resolve([]);
});
});
}
}
\ No newline at end of file
// 通过code前几位获取指定基础数据项(当前版本)
import { getValue } from './util'
export default {
execute:async function(){
console.log("通过code前几位获取指定基础数据项");
......@@ -8,12 +10,7 @@ export default {
,mdcodeArg = arguments[0][1]//基础数据code
,num =arguments[0][2].StaticValue
,context = arguments[1];
let mdcode = ""
if(mdcodeArg instanceof BillDataNode){
mdcode = arguments[0][1].getResult().Value
}else if(mdcodeArg instanceof StaticDataNode ){
mdcode = arguments[0][1].StaticValue
}
let mdcode = await getValue(mdcodeArg)
let lastCode = mdcode.substring(0,Number(num))
let mdObject = await this.getMDObject(tablename,lastCode);
return mdObject;
......
import { getValue } from './util'
export default {
execute: async function () {
if (arguments && arguments[0] && arguments[0][0] && arguments[0][1] && arguments[1]) {
let
resultArg = arguments[0][0]
, key = arguments[0][1].StaticValue
, context = arguments[1];
let result = await getValue(resultArg)
if (!(typeof result == 'object')) return null
return result[key]
} else {
return '';
}
},
getResultType: function () {
return FMR.ConstDataTypes.General;
},
}
\ No newline at end of file
......@@ -28,10 +28,6 @@ export default {
context.setSubFocus(oldIndex)
}
focusData[arguments[0][0].FieldCode]._field_old_value_ = focusData[arguments[0][0].FieldCode].value
// focusData.ZJ._field_old_value_ = focusData.ZJ.value
// focusData.RZRQ._field_old_value_ = focusData.RZRQ.value
// focusData.LDRQ._field_old_value_ = focusData.LDRQ.value
// targetSubField.dynamicNodeFactory.methodJson.SetFieldData('', linkId, data.cSontent, '')
focusData[targetSubField.FieldCode]._field_old_value_ = focusData[targetSubField.FieldCode].value = data.rows[0]
if (oldIndex !== newIndex) {
context.setSubFocus(newIndex)
......
export async function getValue(obj) {
let result = ''
if (obj instanceof FunctionNode) {
let funcResult = obj.getResult()
if (funcResult instanceof AbstractData) {
result = await funcResult.Value
}
}
else if (obj instanceof BillDataNode) {
result = obj.getResult().Value
}
else if (obj instanceof StaticDataNode) {
result = obj.StaticValue
}
return result
}
......@@ -161,6 +161,8 @@ import AmountComp from "./formula/AmountComp";
import SubTableHasContainField from "./formula/SubTableHasContainField";
import SetSubFieldsByBaseData from "./formula/SetSubFieldsByBaseData";
import SubTableSetData from "./formula/SubTableSetData";
import GetOwnProperty from "./formula/GetOwnProperty";
import GetMDByObjectcode from "./formula/GetMDByObjectcode";
export default {
actions: {
updateFieldAction,
......@@ -323,7 +325,9 @@ export default {
SubTableHasContainField,
ApplyTemplateString,
SubTableSetData,
...GeneralImportFile
GetMDByObjectcode,
GetOwnProperty,
...GeneralImportFile,
},
routes : {
showPrint: {
......
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