|
@@ -8,24 +8,24 @@ export function setReportData(obj, line = 6) {
|
|
|
const newObj = { ...obj }
|
|
|
const setDomInfo = (arr) => {
|
|
|
arr &&
|
|
|
- arr.length &&
|
|
|
- arr.forEach((elm) => {
|
|
|
- elm.domKey = uuid10(4)
|
|
|
- domKeys.indexOf(elm.domKey) < 0 && domKeys.push(elm.domKey)
|
|
|
- if (elm.hasOwnProperty('content') && elm.content.length) {
|
|
|
- elm.content.forEach((item) => {
|
|
|
- item.domKey = uuid10(4)
|
|
|
- domKeys.indexOf(item.domKey) < 0 && domKeys.push(elm.domKey)
|
|
|
- if (item.type.search(/Table|TableAndRichText/) > -1) {
|
|
|
- setTableHeader(item.tableHeaders)
|
|
|
- item.tableRows = arrToObj(item.tableRows, item.tableHeaders)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- if (elm.hasOwnProperty('children') && elm.children.length) {
|
|
|
- setDomInfo(elm.children)
|
|
|
- }
|
|
|
- })
|
|
|
+ arr.length &&
|
|
|
+ arr.forEach((elm) => {
|
|
|
+ elm.domKey = uuid10(4)
|
|
|
+ domKeys.indexOf(elm.domKey) < 0 && domKeys.push(elm.domKey)
|
|
|
+ if (elm.hasOwnProperty('content') && elm.content.length) {
|
|
|
+ elm.content.forEach((item) => {
|
|
|
+ item.domKey = uuid10(4)
|
|
|
+ domKeys.indexOf(item.domKey) < 0 && domKeys.push(elm.domKey)
|
|
|
+ if (item.type.search(/Table|TableAndRichText/) > -1) {
|
|
|
+ setTableHeader(item.tableHeaders)
|
|
|
+ item.tableRows = arrToObj(item.tableRows, item.tableHeaders)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (elm.hasOwnProperty('children') && elm.children.length) {
|
|
|
+ setDomInfo(elm.children)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
if (newObj && newObj.children && newObj.children.length) {
|
|
|
setDomInfo(newObj.children)
|
|
@@ -42,20 +42,20 @@ export function reportDataBack(obj) {
|
|
|
const newObj = { ...obj }
|
|
|
const setOldData = (arr) => {
|
|
|
arr &&
|
|
|
- arr.length &&
|
|
|
- arr.forEach((elm) => {
|
|
|
- const { content, children } = elm
|
|
|
- if (content && content.length) {
|
|
|
- content.forEach((item) => {
|
|
|
- if (item.type.search(/Table|TableAndRichText/) > -1) {
|
|
|
- item.tableRows = objToArr(item.tableRows, item.tableHeaders)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- if (children && children.length) {
|
|
|
- setOldData(children)
|
|
|
- }
|
|
|
- })
|
|
|
+ arr.length &&
|
|
|
+ arr.forEach((elm) => {
|
|
|
+ const { content, children } = elm
|
|
|
+ if (content && content.length) {
|
|
|
+ content.forEach((item) => {
|
|
|
+ if (item.type.search(/Table|TableAndRichText/) > -1) {
|
|
|
+ item.tableRows = objToArr(item.tableRows, item.tableHeaders)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (children && children.length) {
|
|
|
+ setOldData(children)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
if (newObj && newObj.children && newObj.children.length) {
|
|
|
setOldData(newObj.children)
|
|
@@ -111,16 +111,14 @@ export function arrToObj(arr, headerList) {
|
|
|
export function analyticFeedbackToObj(obj) {
|
|
|
const newObj = _.cloneDeep(obj)
|
|
|
newObj &&
|
|
|
- newObj.analyticContents &&
|
|
|
- _.isArray(newObj.analyticContents) &&
|
|
|
- newObj.analyticContents.forEach((elm) => {
|
|
|
- _.isArray(elm.improvementItems) &&
|
|
|
- elm.improvementItems.forEach((item) => {
|
|
|
- item.personInCharge = item.personInCharge
|
|
|
- .replace(/\[|\]|'/g, '')
|
|
|
- .split(',')
|
|
|
- })
|
|
|
+ newObj.analyticContents &&
|
|
|
+ _.isArray(newObj.analyticContents) &&
|
|
|
+ newObj.analyticContents.forEach((elm) => {
|
|
|
+ _.isArray(elm.improvementItems) &&
|
|
|
+ elm.improvementItems.forEach((item) => {
|
|
|
+ item.personInCharge = item.personInCharge ? strToArr(item.personInCharge) : []
|
|
|
})
|
|
|
+ })
|
|
|
return newObj
|
|
|
}
|
|
|
|
|
@@ -164,14 +162,14 @@ export function objToArr(obj, tableHeaders) {
|
|
|
export function analyticFeedbackToArr(obj) {
|
|
|
const newObj = _.cloneDeep(obj)
|
|
|
newObj &&
|
|
|
- newObj.analyticContents &&
|
|
|
- _.isArray(newObj.analyticContents) &&
|
|
|
- newObj.analyticContents.forEach((elm) => {
|
|
|
- _.isArray(elm.improvementItems) &&
|
|
|
- elm.improvementItems.forEach((item) => {
|
|
|
- item.personInCharge = `[${item.personInCharge.toString()}]`
|
|
|
- })
|
|
|
+ newObj.analyticContents &&
|
|
|
+ _.isArray(newObj.analyticContents) &&
|
|
|
+ newObj.analyticContents.forEach((elm) => {
|
|
|
+ _.isArray(elm.improvementItems) &&
|
|
|
+ elm.improvementItems.forEach((item) => {
|
|
|
+ item.personInCharge = JSON.stringify(item.personInCharge)
|
|
|
})
|
|
|
+ })
|
|
|
return newObj
|
|
|
}
|
|
|
// 对字符串进行处理,支持正则
|
|
@@ -198,21 +196,22 @@ export function ret(arr) {
|
|
|
}
|
|
|
|
|
|
// 根据操作对象唯一标识,查询该对象数据
|
|
|
-export function findDomKey(obj, domKey) {}
|
|
|
+export function findDomKey(obj, domKey) {
|
|
|
+}
|
|
|
|
|
|
// 设置部门数据
|
|
|
export function setDeptArch(data) {
|
|
|
const run = (arr) => {
|
|
|
arr &&
|
|
|
- arr.length &&
|
|
|
- arr.forEach((elm) => {
|
|
|
- if (elm.children.length) {
|
|
|
- run(elm.children)
|
|
|
- }
|
|
|
- if (!elm.children.length) {
|
|
|
- elm.children = null
|
|
|
- }
|
|
|
- })
|
|
|
+ arr.length &&
|
|
|
+ arr.forEach((elm) => {
|
|
|
+ if (elm.children.length) {
|
|
|
+ run(elm.children)
|
|
|
+ }
|
|
|
+ if (!elm.children.length) {
|
|
|
+ elm.children = null
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
run(data)
|
|
|
}
|