|
@@ -65,6 +65,23 @@ export const checkSelectedLabel = (selectArr, arr) => {
|
|
|
const concatIds = new Set(selectArrIds.concat(arrIds))
|
|
|
return !(concatIds.size === (arrIds.length + selectArrIds.length))
|
|
|
}
|
|
|
+/**
|
|
|
+ * 判断数组内的每一项是否有与obj相等的
|
|
|
+ * @param {Array} list
|
|
|
+ * @param {Object} obj
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+export const isTextEqual = (list, obj) => {
|
|
|
+ let flag = false
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ if (_.isEqual(list[i], obj)) {
|
|
|
+ flag = true
|
|
|
+ break
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return flag
|
|
|
+}
|
|
|
/**
|
|
|
* 获取文档的纯文本
|
|
|
* @param {Object} file
|
|
@@ -113,13 +130,15 @@ export const formatSemanticFile = (file,selectArr)=>{
|
|
|
item.ishasThisLabel = item.isThisLabelArr.length ? true : false
|
|
|
item.isSelectLabel = checkSelectedLabel(selectArr, item.isHistoryLabelArr) ||
|
|
|
checkSelectedLabel(selectArr, item.isOtherLabelArr)||checkSelectedLabel(selectArr,item.isThisLabelArr)
|
|
|
- if(item.IsPart===1){
|
|
|
- textAreaList.push(
|
|
|
- {...item,
|
|
|
- ...{
|
|
|
- startOffset:item.StartIndex,
|
|
|
- endOffset:item.EndIndex
|
|
|
- }})
|
|
|
+ if (item.IsPart === 1) {
|
|
|
+ const tempObj = {
|
|
|
+ ...item,
|
|
|
+ ...{
|
|
|
+ startOffset: item.StartIndex,
|
|
|
+ endOffset: item.EndIndex
|
|
|
+ }
|
|
|
+ }
|
|
|
+ !isTextEqual(textAreaList, tempObj) && textAreaList.push(tempObj)
|
|
|
}
|
|
|
return item
|
|
|
})
|