Commit 13baccc0 by 袁成

Merge branch 'develop' of ssh://nvwa.jiuqi.com.cn:2222/GFP/RBC/rbc-frontend into develop-yuancheng

parents a769d436 629849b7
......@@ -60,18 +60,36 @@ export default {
},
tempSaveAction: {
commonMessage: "暂存失败,请联系系统管理员。",
customMessageList: [
{
preMessage: "More than one row with the given identifier was found",
convertMessage: "multiBaseDataError"
},
{
preMessage: "formulaError:",
convertMessage: "backFormulaError",
}
],
getErrorBaseDataName(a) {
if (!a || !_.isString(a)) {
return "";
}
let reg = /(?<=datamodel\.).*?(?=;)/;
let targetString = a.match(reg);
return targetString ? targetString[0] : "";
},
getErrorMessage(a) {
if (!a || !_.isString(a)) {
return this.commonMessage;
}
let errorPreMessage = "";
for (let i = 0; i < this.saveAction.customMessageList.length; i++) {
if (a.indexOf(this.saveAction.customMessageList[i].preMessage) > -1) {
errorPreMessage = this.saveAction.customMessageList[i].convertMessage;
for (let i = 0; i < this.customMessageList.length; i++) {
if (a.indexOf(this.customMessageList[i].preMessage) > -1) {
errorPreMessage = this.customMessageList[i].convertMessage;
break;
}
}
return errorPreMessage === "" ? (a?a:this.commonMessage) : errorPreMessage + this.saveAction.getErrorBaseDataName(a);
return errorPreMessage === "" ? (a?a:this.commonMessage) : errorPreMessage + this.getErrorBaseDataName(a);
},
getCommonMessage(){
return this.commonMessage;
......
......@@ -3,7 +3,7 @@
<div class="suggestion-wrapper">
<div class="label">{{this.define.title}}</div>
<div class="input-wrapper">
<Input v-model="value" type="textarea" :placeholder="define.config.placeholder" :maxlength="120" />
<Input v-model="value" type="textarea" :placeholder="define.config.placeholder" :maxlength="240" />
<div class="suggestion-button-wrapper">
<ConfirmPopover
v-for="suggestion in suggestionOption"
......@@ -84,7 +84,7 @@
:ref="'input-' + row.code"
@on-blur="handleInputBlur(row)"
type="textarea"
:maxlength="120"
:maxlength="240"
/>
</template>
<template slot-scope="{ row, index }" slot="action">
......
......@@ -4305,6 +4305,22 @@ export default {
"discard": false,
"path": "通用",
"extends": {
"info": {
"param": [],
"name": "ApplyTemplateString",
"description": "1.基础数据字段,2.赋值的字段,3.模板字符串4.field+对应基础数据table5.分隔符",
"title": "基础数据赋值模板字符串",
"return": 0
}
},
"description": "1.基础数据字段,2.赋值的字段,3.模板字符串4.field+对应基础数据table5.分隔符",
"title": "基础数据赋值模板字符串",
"value": "ApplyTemplateString"
},
{
"discard": false,
"path": "通用",
"extends": {
"info": {
"param": [
......
// 子表根据基础数据带出基础数据
export default {
execute: function () {
if (arguments && arguments[0] && arguments[1]) {
const context = arguments[1]
const originField = arguments[0][0]
const targetField = arguments[0][1]
let templateString = arguments[0][2].StaticValue
let args = arguments[0][3].StaticValue
const sep = arguments[0][4] && arguments[0][4].StaticValue || ''
args = args.replace(/ /g, '')
const argList = args.split(',')
const originTableType = context.getTableType(originField.FieldTableCode)
const originTableObject = context.getSubData(originTableType.title)
const requestParam = {
pagination: false,
searchKey: "",
queryDataStructure: "ALL_WITH_REF",
stopflag: -1,
authType: "NONE"
}
const replaceMap = new Map()
const replaceTemplatePart = templateString.match(/{{.+?}}/g)
replaceTemplatePart.forEach((part) => {
replaceMap.set(part, [])
})
const getBaseDataList = (originFieldValue) => {
const promistList = []
for (let i = 0; i < argList.length; i += 2) {
promistList.push(this.getMDObject({
...requestParam,
tableName: argList[i + 1],
objectcode: originFieldValue[argList[i]],
}))
}
return Promise.all(promistList)
}
const getFormattedString = (originFieldValue, basedataObjectList, templateString) => {
const matchList = templateString.match(/`.+?`/g)
matchList.forEach((str) => {
let value = str.substring(1, str.length - 1)
value = value.split('.')
let pos = value[0].substring(1)
pos = Number(pos)
let ans
if (pos == 0) {
ans = originFieldValue
}
else {
;--pos
if (pos >= basedataObjectList.length) {
console.error(`${str}下标大于参数列表长度`)
return
}
ans = basedataObjectList[pos]
}
for (let i = 1; i < value.length; ++i) {
ans = ans[value[i]]
}
templateString = templateString.replace(str, ans)
})
return templateString
}
if (originTableObject instanceof Array) {
const getBasedataPromiseList = []
let count = 0
for (let i = 0; i < originTableObject.length; ++i) {
const originObject = originTableObject[i]
const curOriginFieldValue = originObject.getValue(originField.FieldCode)
if (!curOriginFieldValue || !curOriginFieldValue.objectcode) {
continue
}
getBasedataPromiseList.push(getBaseDataList(curOriginFieldValue).then((basedataObjectList) => {
replaceTemplatePart.forEach((templatePart) => {
const formattedString = getFormattedString(curOriginFieldValue, basedataObjectList, templatePart.substring(2, templatePart.length - 2))
replaceMap.get(templatePart)[i] = formattedString
})
}))
}
Promise.all(getBasedataPromiseList).then(() => {
for (let key of replaceMap.keys()) {
templateString = templateString.replace(key, replaceMap.get(key).filter(o => !!o).join(sep))
}
context.getMasterData().setValue(targetField.FieldTableCode + '.' + targetField.FieldCode, templateString, null, 'none')
})
}
else {
context.getMasterData().setValue(targetField.FieldTableCode + '.' + targetField.FieldCode, '', null, 'none')
}
}
},
getMDObject(param) {
return GMS.$http.post("/baseData/data/list", param).then(data => {
return data.data && data.data.rows && data.data.rows[0] || {}
}).catch((resp) => {
});
},
getResultType: function () {
return FMR.ConstDataTypes.General;
}
}
\ No newline at end of file
......@@ -176,6 +176,7 @@ import GetSubTableRows from "@/formula/GetSubTableRows"
import SubTableJointString from "@/formula/SubTableJointString"
import LoginUserIsContianRole from "@/formula/SubTableJointString"
import SubTableSetBaseData from "@/formula/SubTableSetBaseData"
import ApplyTemplateString from "@/formula/ApplyTemplateString"
import UpdateBillReferenceRelationshipFunction from "./formula/UpdateBillReferenceRelationshipFunction";
import AmountComp from "./formula/AmountComp";
import EqualsMasterAndSubField from "./formula/EqualsMasterAndSubField";
......@@ -368,6 +369,7 @@ export default {
EqualsMasterAndSubField,
SubTableHasContainField,
GetUserStaffInfo,
ApplyTemplateString,
},
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