@tongfun/tf-widget 0.1.26 → 0.1.27

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.
@@ -26,7 +26,7 @@
26
26
  </div>
27
27
 
28
28
  <!-- 搜索输入框 -->
29
- <TListSearch ref="tListSearchRef" class="common-table-buttons-search" @search="handleSuggestMultiCondition($event)" />
29
+ <TListSearch ref="tListSearchRef" class="common-table-buttons-search" @search="handleSuggestMultiCondition($event,false)" />
30
30
  </div>
31
31
  <!--过滤方案-->
32
32
  <Tplan ref="TplanRef" :fields-option="tableLayout" @change="handlePlanConditionChange" />
@@ -48,7 +48,7 @@
48
48
  </div>
49
49
  <template v-slot:title>
50
50
  <div class="common-title">
51
- <TListSearch class="common-table-buttons-search" @search="handleSuggestMultiCondition($event,true)" />
51
+ <TListSearch class="common-table-buttons-search" @search="handleSuggestMultiCondition($event,false)" />
52
52
  </div>
53
53
  </template>
54
54
  <span slot="footer" class="dialog-footer basic-selector-footer">
@@ -136,6 +136,7 @@ export default {
136
136
  await this.getTableLayout()
137
137
  }
138
138
  loading.close()
139
+ this.searchSuggestCondition = []
139
140
  this.getTableData()
140
141
  this.dialogVisible = true
141
142
  },
@@ -176,15 +177,20 @@ export default {
176
177
  this.$emit('delete')
177
178
  }
178
179
  },
179
- // 获取搜索建议
180
- // 此时的搜索建议也需要对限定范围条件进行拼接
180
+ /**
181
+ * 基础资料空间搜索建议
182
+ * 在没有打开基础资料弹窗之前,根据用户的输入提供选项
183
+ * @param queryString
184
+ * @param callback
185
+ * @returns {Promise<void>}
186
+ */
181
187
  async getAdvice (queryString, callback) {
182
- this.tableLayout.length === 0 && (await this.getTableLayout())
188
+ !this.tableLayout.length && (await this.getTableLayout())
183
189
  let record = []
184
- if (!/^\s*$/g.test(queryString)) {
185
- this.handleSuggestMultiCondition(queryString, false)
186
- record = await this.getTableData(true, false)
187
- }
190
+ this.handleSuggestMultiCondition(queryString, true)
191
+ record = /^\s*$/g.test(queryString)
192
+ ? []
193
+ : await this.getTableData(true, false)
188
194
  callback(record)
189
195
  },
190
196
  // 搜索建议的显示格式
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tongfun/tf-widget",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "tf-widget",
5
5
  "main": "lib/tf-widget.umd.js",
6
6
  "private": false,
@@ -12,7 +12,7 @@
12
12
  "lint": "vue-cli-service lint",
13
13
  "lib": "vue-cli-service build --target lib --name tf-widget --dest lib src/index.js",
14
14
  "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\"",
15
- "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch package -C -e js,vue,less --debug -x \"npm run lib && yalc push\" "
15
+ "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch package -e js,vue,less --debug -x \"npm run lib && yalc push\" "
16
16
  },
17
17
  "dependencies": {
18
18
  "axios": "^0.21.1",
@@ -225,22 +225,25 @@ export default {
225
225
  },
226
226
  /**
227
227
  * 处理条件变更和重新获取数据的逻辑
228
- * @param {boolean} queryString 用户输入的内容
229
- * @param {boolean} isList 分为两个场景,1:列表和弹窗中输入框 2:弹窗未打开之前的如输入框中搜索建议
228
+ * 基础资料搜索建议和列表页面右上角的搜索输入框的条件处理
229
+ * @param {string} queryString 用户输入的内容
230
+ * @param {boolean} inputMode 输入框模式:true,否则是列表模式,输入框模式不进行数据查询
230
231
  */
231
- // 基础资料搜索建议和列表页面右上角的搜索输入框的条件处理
232
- handleSuggestMultiCondition (queryString, isList = true) {
232
+ handleSuggestMultiCondition (queryString, inputMode = true) {
233
233
  const conditionMultiList = []
234
234
  for (const item of this.suggestFieldList) {
235
235
  conditionMultiList.push(this.createMultiCondition(item, queryString, false, false))
236
236
  }
237
237
  this.searchSuggestCondition = conditionMultiList
238
238
  // todo: 列表和弹窗 还有一个子分类,弹窗不进行合计调用
239
- !isList
240
- ? this.getTableData(true, false)
241
- : this.queryType === 'LIST'
242
- ? this.getTableData(false, true)
243
- : this.getTableData(false, false)
239
+ if (inputMode) {
240
+ return
241
+ }
242
+ // 处于列表中,还是处于基础资料的弹窗中,不同的地方在于,列表会进行合计,弹窗则会仅仅筛选已经审核的数据
243
+ // 以上逻辑在后端,前端仅仅需要传querytype的参数
244
+ this.queryType === 'LIST'
245
+ ? this.getTableData(false, true)
246
+ : this.getTableData(false, false)
244
247
  },
245
248
  /**
246
249
  * 创建一个高级过滤条件