cloud-web-corejs 1.0.54-dev.370 → 1.0.54-dev.372

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.
@@ -113,6 +113,11 @@ export default {
113
113
  onCellDblclick: (param) => {
114
114
  this.checkWithSubmit(param);
115
115
  },
116
+ otherConfig: {
117
+ onFilter: () => {
118
+ this.checkRows = [];
119
+ },
120
+ },
116
121
  config: {
117
122
  checkboxConfig: {
118
123
  checkStrictly: true,
@@ -165,7 +165,7 @@
165
165
  :parent-widget="widget"
166
166
  :columnConfig="obj.column.params.columnConfig"
167
167
  :subFormRowIndex="obj.rowIndex"
168
- :formItemProp="getColumnProp(widget, obj)"
168
+ :formItemProp="getColumnProp(obj)"
169
169
  :subFormRowId="obj.row._X_ROW_KEY"
170
170
  :tableParam="obj"
171
171
  >
@@ -211,7 +211,7 @@
211
211
  :columnConfig="obj.column.params.columnConfig"
212
212
  :subFormRowIndex="obj.rowIndex"
213
213
  :subFormRowId="obj.row._X_ROW_KEY"
214
- :formItemProp="getColumnProp(widget, obj, true)"
214
+ :formItemProp="getColumnProp(obj, true)"
215
215
  :tableParam="obj"
216
216
  >
217
217
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
@@ -1051,6 +1051,7 @@ modules = {
1051
1051
  searchColumns: searchColumns,
1052
1052
  isQueryAllPage,
1053
1053
  vform: true,
1054
+ ...(dataTableConfig.otherConfig || {}),
1054
1055
  config: {
1055
1056
  height: height,
1056
1057
  showFooter,
@@ -1896,26 +1897,84 @@ modules = {
1896
1897
  return { columnSelectedWidget, columnEditFields };
1897
1898
  },
1898
1899
  getColumnProp2(fieldWidget, obj) {
1900
+ let isQueryTable = this.widget.options.isQueryTable || false;
1901
+ let rowWidget = this.getRowWidget(obj, fieldWidget)
1902
+ let required = rowWidget.options.required || false;
1903
+
1899
1904
  let fieldKeyName = this.getFieldKeyName(this.widget);
1900
- let property = this.getFieldKeyName(fieldWidget);
1901
- if (this.isVabsearchFlagWidget(fieldWidget)) {
1902
- property = fieldWidget.options.vabSearchName || property;
1905
+ let property = this.getFieldKeyName(rowWidget);
1906
+ if (this.isVabsearchFlagWidget(rowWidget)) {
1907
+ property = rowWidget.options.vabSearchName || property;
1903
1908
  }
1904
1909
  let rowIndex = Math.max(obj.rowIndex, 0);
1905
1910
 
1906
1911
  let propName = fieldKeyName + "." + rowIndex + "." + property;
1912
+ if (isQueryTable && !required) {
1913
+ propName = "false";
1914
+ }
1907
1915
  return propName;
1908
1916
  },
1909
- getColumnProp(widget, obj, isEdit) {
1910
- if (!widget) {
1911
- return "false";
1917
+ validateCheckRow(){
1918
+ let $grid = this.getGridTable();
1919
+ let checkRows = $grid.getCheckboxRecords(true);
1920
+ if(checkRows.length == 0){
1921
+ this.$message({
1922
+ message: '请选择要操作的行',
1923
+ type: 'warning'
1924
+ });
1925
+ return false;
1912
1926
  }
1913
- /*if(isEdit){
1914
- return "false"
1915
- }*/
1916
- let isQueryTable = this.widget.options.isQueryTable || false;
1917
- if (isEdit || !isQueryTable) {
1918
- let sourceWidgetId = isEdit
1927
+ const fieldsToValidate = [];
1928
+ let tableColumns = this.widget.options.tableColumns;
1929
+ checkRows.forEach(row => {
1930
+ let fieldSchema = this.fieldSchemaMap[row._X_ROW_KEY];
1931
+ tableColumns.forEach(column => {
1932
+ if(column.widget){
1933
+ let widget = fieldSchema[column.widget.id]
1934
+ let required = widget.options.required || false;
1935
+ if(required){
1936
+ let propName = this.getColumnWidgetProp(widget, row);
1937
+ fieldsToValidate.push(propName)
1938
+ }
1939
+ }
1940
+ if(column.widgetList){
1941
+ column.widgetList.forEach(itemWidget=>{
1942
+ let widget = fieldSchema[itemWidget.id]
1943
+ let required = widget.options.required || false;
1944
+ if(required){
1945
+ let propName = this.getColumnWidgetProp(widget, row);
1946
+ fieldsToValidate.push(propName)
1947
+ }
1948
+ })
1949
+
1950
+ }
1951
+ })
1952
+ })
1953
+ let formRef = this.getFormRef();
1954
+ let renderForm = formRef.$refs.renderForm;
1955
+ let hasError = false;
1956
+ renderForm.validateField(fieldsToValidate, errors => {
1957
+ if (!hasError && errors) {
1958
+ this.$message.error(errors)
1959
+ hasError = true;
1960
+ }
1961
+ });
1962
+ return !hasError;
1963
+ },
1964
+ getColumnWidgetProp(widget, row){
1965
+ if(!widget)return
1966
+ let $grid = this.getGridTable();
1967
+ let rowIndex = $grid.getRowIndex(row);
1968
+ let fieldKeyName = this.getFieldKeyName(this.widget);
1969
+ let property = this.getFieldKeyName(widget);
1970
+ if (this.isVabsearchFlagWidget(widget)) {
1971
+ property = widget.options.vabSearchName || property;
1972
+ }
1973
+ let propName = fieldKeyName + "." + rowIndex + "." + property;
1974
+ return propName;
1975
+ },
1976
+ getColumnProp(obj, isEdit) {
1977
+ let sourceWidgetId = isEdit
1919
1978
  ? obj.column.params.editWidget.id
1920
1979
  : obj.column.params.widget.id;
1921
1980
  if (!this.fieldSchemaMap[obj.row._X_ROW_KEY]) return "false";
@@ -1924,8 +1983,11 @@ modules = {
1924
1983
  if (!fieldWidget) {
1925
1984
  return "false";
1926
1985
  }
1986
+ let isQueryTable = this.widget.options.isQueryTable || false;
1927
1987
 
1928
- let fieldKeyName = this.getFieldKeyName(widget);
1988
+ let required = fieldWidget.options.required || false;
1989
+ if (isEdit || !isQueryTable || required) {
1990
+ let fieldKeyName = this.getFieldKeyName(this.widget);
1929
1991
  let rowIndex = Math.max(obj.rowIndex, 0);
1930
1992
 
1931
1993
  let property = this.getFieldKeyName(fieldWidget);
@@ -1937,18 +1999,6 @@ modules = {
1937
1999
  property = fieldWidget.options.vabSearchName || property;
1938
2000
  }
1939
2001
  let propName = fieldKeyName + "." + rowIndex + "." + property;
1940
- /* let lineWidget = !isEdit
1941
- ? obj.column.params.widget
1942
- : obj.column.params.editWidget;
1943
- if (!lineWidget) {
1944
- return "false";
1945
- } */
1946
- /* if (this.isVabsearchFlagWidget(lineWidget)) {
1947
- let fieldName =
1948
- lineWidget.options.vabSearchName ||
1949
- this.getFieldKeyName(lineWidget);
1950
- propName = fieldKeyName + "." + rowIndex + "." + fieldName;
1951
- } */
1952
2002
  return propName;
1953
2003
  } else {
1954
2004
  return "false";
@@ -12,7 +12,8 @@ tMixins = {
12
12
  data() {
13
13
  return {
14
14
  checkRows: [],
15
- fieldKey: 'id'
15
+ fieldKey: 'id',
16
+ defaultTableRefName: "table-m1"
16
17
  }
17
18
  },
18
19
  methods: {
@@ -31,6 +32,10 @@ tMixins = {
31
32
  if (this.$attrs.fieldKey) {
32
33
  this.fieldKey = this.$attrs.fieldKey;
33
34
  }
35
+
36
+ if (this.$attrs.tableRef) {
37
+ this.defaultTableRefName = this.$attrs.tableRef;
38
+ }
34
39
  let checkRows;
35
40
  if (this.selectMulti) {
36
41
  checkRows = this.rows || [];
@@ -53,7 +58,6 @@ tMixins = {
53
58
  let row = obj.row;
54
59
  let that = this;
55
60
  let $table1 = obj.$table;
56
- let $table2 = this.$refs['table-m2'];
57
61
 
58
62
  if (selectMulti) {
59
63
  let rows = this.checkRows;
@@ -82,28 +86,32 @@ tMixins = {
82
86
  this.checkRows.push(obj.row);
83
87
  }
84
88
 
85
- if (obj.checked) {
89
+ let checkStrictly = $table1.$options.propsData?.checkboxConfig?.checkStrictly;
90
+ if(checkStrictly){
91
+ if (obj.checked) {
86
92
 
87
- // let ay = $table1.getTableData().fullData;
88
- // let aRows = this.findAllRows(ay);
89
- let aRows = $table1.getTableData().visibleData;
93
+ // let ay = $table1.getTableData().fullData;
94
+ // let aRows = this.findAllRows(ay);
95
+ let aRows = $table1.getTableData().visibleData;
90
96
 
91
- let cRows = $table1.getCheckboxRecords();
92
- if (aRows.length == cRows.length) {
93
- $table1.setAllCheckboxRow(true);
97
+ let cRows = $table1.getCheckboxRecords();
98
+ if (aRows.length == cRows.length) {
99
+ $table1.setAllCheckboxRow(true);
100
+ } else {
101
+ $table1.setAllCheckboxRow(false);
102
+ }
94
103
  } else {
95
104
  $table1.setAllCheckboxRow(false);
96
105
  }
97
- } else {
98
- $table1.setAllCheckboxRow(false);
99
106
  }
107
+
100
108
  },
101
109
  clearTable1Select(index) {
102
110
  let fieldKey = this.fieldKey;
103
111
  let selectMulti = this.selectMulti;
104
112
  let row = this.checkRows[index];
105
113
  var rowid = row[fieldKey];
106
- let $grid1 = this.$refs['table-m1'];
114
+ let $grid1 = this.$refs[this.defaultTableRefName];
107
115
 
108
116
  // let rows = $grid1.getTableData().fullData;
109
117
  let rows = $grid1.getTableData().visibleData;
@@ -114,7 +122,10 @@ tMixins = {
114
122
  $grid1.clearCheckboxRow();
115
123
  }
116
124
  this.checkRows.splice(index, 1);
117
- if (row2) $grid1.setAllCheckboxRow(false);
125
+ let checkStrictly = $grid1.$options.propsData?.checkboxConfig?.checkStrictly;
126
+ if(checkStrictly){
127
+ if (row2) $grid1.setAllCheckboxRow(false);
128
+ }
118
129
  },
119
130
  checkAll(res) {
120
131
  let fieldKey = this.fieldKey;
@@ -154,10 +165,13 @@ tMixins = {
154
165
  })
155
166
  },
156
167
  clearChecked() {
157
- let $grid1 = this.$refs['table-m1'];
168
+ let $grid1 = this.$refs[this.defaultTableRefName];
158
169
  $grid1.clearCheckboxRow();
159
170
  this.checkRows = [];
160
171
  },
172
+ _clearChecked() {
173
+ this.clearChecked();
174
+ },
161
175
  findTreeRowById(rows, rowid) {
162
176
  let fieldKey = this.fieldKey;
163
177
  for (let i = 0; i < rows.length; i++) {
@@ -189,7 +203,7 @@ tMixins = {
189
203
  return newRows;
190
204
  },
191
205
  searchEvent(option) {
192
- let target = "table-m1";
206
+ let target = this.defaultTableRefName;
193
207
  let formKey = "formData";
194
208
  if (option && !option.preventDefault) {
195
209
  if (option.target) {
@@ -202,7 +216,7 @@ tMixins = {
202
216
  this.$refs[target].commitProxy('reload');
203
217
  },
204
218
  resetEvent(option) {
205
- let target = "table-m1";
219
+ let target = this.defaultTableRefName;
206
220
  let formKey = "formData";
207
221
  if (option && !option.preventDefault) {
208
222
  if (option.target) {
@@ -118,6 +118,7 @@
118
118
  :visiable.sync="showUserDialog1"
119
119
  @confirm="confirmUserDialog1"
120
120
  :multi="false"
121
+ :param="{ enabled: null }"
121
122
  />
122
123
  <userDialog
123
124
  v-if="showUserDialog2"
@@ -112,6 +112,7 @@
112
112
  :visiable.sync="showUserDialog1"
113
113
  @confirm="confirmUserDialog1"
114
114
  :multi="false"
115
+ :param="{ enabled: null }"
115
116
  />
116
117
  <userDialog
117
118
  v-if="showUserDialog2"