doway-coms 2.3.1 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doway-coms",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -1007,96 +1007,135 @@ export default {
1007
1007
  vm.$refs.pupupGridView.loadData(vm.searchRows)
1008
1008
  vm.gridPagerConfig.total = responseData.otherContent.totalRows
1009
1009
  }
1010
- if (repeatRowInfo.field) {
1011
- //设置重复值
1012
- XEUtils.arrayEach(vm.searchRows, (item) => {
1013
- if (
1014
- XEUtils.arrayIndexOf(
1015
- repeatRowInfo.values,
1016
- item[repeatRowInfo.field]
1017
- ) > -1
1018
- ) {
1019
- item['sysRepeat'] = true
1020
- }
1021
- })
1022
- }
1023
- // 若当前表格内只有一行,则不进行判断
1024
- if (vm.propTableData.length == 1) {
1025
- return
1026
- }
1027
- // 设置字段sysRepeat后,所定字段的值全部相同则不可选择
1028
- let fieldNames = vm.columns
1010
+ //本身结果集会返回sysRepeat为true的数据,所以处理数据的时候不能默认设置成false,会把后台返回的数据重置掉
1011
+ //查询下拉显示列配置成sysRepeat的列字段名称
1012
+ let repeatCols = vm.columns
1029
1013
  .filter((x) => x.sysRepeat)
1030
1014
  .map((y) => {
1031
1015
  return {
1032
1016
  field: y.field,
1033
1017
  linkField: y.linkField,
1034
1018
  }
1019
+ });
1020
+ //添加当前行关联值
1021
+ XEUtils.arrayEach(vm.contrasts, (loopItem)=>{
1022
+ repeatCols.push({
1023
+ isCurrentRow:true,
1024
+ linkField:loopItem
1035
1025
  })
1036
- if (fieldNames.length) {
1037
- vm.searchRows.forEach((info) => {
1038
- // 当一次创建多行时,过滤需特定字段不可为空的
1039
- // 获取数组对象,根据选定字段,过滤选定字段都为空的
1040
- let tempArr = vm.propTableData.filter((currentInfo) => {
1041
- let tempD = []
1042
- fieldNames.forEach((z) => {
1043
- // 字段的值若为null、undefined,记录过滤掉
1044
- if (!currentInfo[z.linkField]) {
1045
- tempD.push(true)
1046
- }
1047
- })
1048
- return tempD.length !== fieldNames.length
1049
- })
1050
- let arr = []
1051
- // 分为有参查询和无参查询
1052
- if (tempExp.expressions.length && fieldNames.length == 1) {
1053
- for (let j = 0; j < fieldNames.length; j++) {
1054
- let mapArr = tempArr.map(
1055
- (item) => item[fieldNames[j].linkField]
1056
- )
1057
- let setArr = new Set(mapArr)
1058
- if (setArr.size < mapArr.length) {
1059
- arr.push(true)
1060
- }
1061
- }
1062
- if (fieldNames.length === arr.length) {
1063
- info.sysRepeat = true
1064
- }
1065
- } else {
1066
- tempArr.forEach((item) => {
1067
- // 接口字段可能和表字段field不一致,linkField一致
1068
- for (let j = 0; j < fieldNames.length; j++) {
1069
- if (
1070
- info[fieldNames[j].field] == item[fieldNames[j].linkField]
1071
- ) {
1072
- arr.push(true)
1073
- }
1074
- }
1075
- if (fieldNames.length === arr.length) {
1076
- info.sysRepeat = true
1077
- }
1078
- })
1079
- }
1080
- if (info.sysRepeat && this.contrasts.length) {
1081
- let flag = 0
1082
- XEUtils.arrayEach(this.propTableData, (item) => {
1083
- if (item[this.field] === info[this.field]) {
1084
- XEUtils.arrayEach(this.contrasts, (loop) => {
1085
- if (
1086
- item[loop] === this.row[loop] &&
1087
- item.id !== this.row.id
1088
- ) {
1089
- flag++
1026
+ })
1027
+ if(repeatCols.length>0 && vm.propTableData.length>1){
1028
+ //设置是否重复
1029
+ XEUtils.arrayEach(vm.searchRows,(loopItem)=>{
1030
+ if(loopItem.sysRepeat===true) return
1031
+ //循环弹出查询返回的数据是否已经存在于表格中
1032
+ loopItem.sysRepeat = XEUtils.some(vm.propTableData,(loopTableItem)=>{
1033
+ for(let i=0;i<repeatCols.length;i++){
1034
+ let tempRepeatColInfo = repeatCols[i]
1035
+ //弹出数据列值
1036
+ let tempPopupRowColValue =tempRepeatColInfo.isCurrentRow===true?vm.row[tempRepeatColInfo.linkField]:
1037
+ loopItem[tempRepeatColInfo.field]
1038
+ //表格数据列值
1039
+ let tempTableRowColValue = loopTableItem[tempRepeatColInfo.linkField]
1040
+ if(tempPopupRowColValue!==tempTableRowColValue){
1041
+ //只有有一个不一致,就返回false
1042
+ return false
1043
+ }
1090
1044
  }
1091
- })
1092
- }
1093
- })
1094
- if (flag === this.contrasts.length) {
1095
- info.sysRepeat = true
1096
- }
1097
- }
1045
+ return true
1046
+ })
1098
1047
  })
1099
1048
  }
1049
+ // if (repeatRowInfo.field) {
1050
+ // //设置重复值
1051
+ // XEUtils.arrayEach(vm.searchRows, (item) => {
1052
+ // if (
1053
+ // XEUtils.arrayIndexOf(
1054
+ // repeatRowInfo.values,
1055
+ // item[repeatRowInfo.field]
1056
+ // ) > -1
1057
+ // ) {
1058
+ // item['sysRepeat'] = true
1059
+ // }
1060
+ // })
1061
+ // }
1062
+ // 若当前表格内只有一行,则不进行判断
1063
+ // if (vm.propTableData.length == 1) {
1064
+ // return
1065
+ // }
1066
+ // 设置字段sysRepeat后,所定字段的值全部相同则不可选择
1067
+ // let fieldNames = vm.columns
1068
+ // .filter((x) => x.sysRepeat)
1069
+ // .map((y) => {
1070
+ // return {
1071
+ // field: y.field,
1072
+ // linkField: y.linkField,
1073
+ // }
1074
+ // })
1075
+ // if (fieldNames.length) {
1076
+ // vm.searchRows.forEach((info) => {
1077
+ // // 当一次创建多行时,过滤需特定字段不可为空的
1078
+ // // 获取数组对象,根据选定字段,过滤选定字段都为空的
1079
+ // let tempArr = vm.propTableData.filter((currentInfo) => {
1080
+ // let tempD = []
1081
+ // fieldNames.forEach((z) => {
1082
+ // // 字段的值若为null、undefined,记录过滤掉
1083
+ // if (!currentInfo[z.linkField]) {
1084
+ // tempD.push(true)
1085
+ // }
1086
+ // })
1087
+ // return tempD.length !== fieldNames.length
1088
+ // })
1089
+ // let arr = []
1090
+ // // 分为有参查询和无参查询
1091
+ // if (tempExp.expressions.length && fieldNames.length == 1) {
1092
+ // for (let j = 0; j < fieldNames.length; j++) {
1093
+ // let mapArr = tempArr.map(
1094
+ // (item) => item[fieldNames[j].linkField]
1095
+ // )
1096
+ // let setArr = new Set(mapArr)
1097
+ // if (setArr.size < mapArr.length) {
1098
+ // arr.push(true)
1099
+ // }
1100
+ // }
1101
+ // if (fieldNames.length === arr.length) {
1102
+ // info.sysRepeat = true
1103
+ // }
1104
+ // } else {
1105
+ // tempArr.forEach((item) => {
1106
+ // // 接口字段可能和表字段field不一致,linkField一致
1107
+ // for (let j = 0; j < fieldNames.length; j++) {
1108
+ // if (
1109
+ // info[fieldNames[j].field] == item[fieldNames[j].linkField]
1110
+ // ) {
1111
+ // arr.push(true)
1112
+ // }
1113
+ // }
1114
+ // if (fieldNames.length === arr.length) {
1115
+ // info.sysRepeat = true
1116
+ // }
1117
+ // })
1118
+ // }
1119
+ // if (info.sysRepeat && this.contrasts.length) {
1120
+ // let flag = 0
1121
+ // XEUtils.arrayEach(this.propTableData, (item) => {
1122
+ // if (item[this.field] === info[this.field]) {
1123
+ // XEUtils.arrayEach(this.contrasts, (loop) => {
1124
+ // if (
1125
+ // item[loop] === this.row[loop] &&
1126
+ // item.id !== this.row.id
1127
+ // ) {
1128
+ // flag++
1129
+ // }
1130
+ // })
1131
+ // }
1132
+ // })
1133
+ // if (flag === this.contrasts.length) {
1134
+ // info.sysRepeat = true
1135
+ // }
1136
+ // }
1137
+ // })
1138
+ // }
1100
1139
  })
1101
1140
  .catch((error) => {
1102
1141
  console.error(error)