vue2-client 1.8.80 → 1.8.82

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/package.json +1 -1
  3. package/src/base-client/components/common/XForm/XFormItem.vue +36 -22
  4. package/src/base-client/components/index.js +0 -6
  5. package/src/pages/DynamicStatistics/ChartSelector.vue +20 -6
  6. package/src/pages/DynamicStatistics/DynamicTable.vue +4 -1
  7. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +3 -1
  8. package/src/pages/DynamicStatistics/SearchBar.vue +65 -17
  9. package/src/pages/DynamicStatistics/index.vue +9 -0
  10. package/src/router/async/router.map.js +0 -2
  11. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +0 -669
  12. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +0 -1014
  13. package/src/base-client/components/common/CreateQuery/index.js +0 -3
  14. package/src/base-client/components/common/CreateQuery/index.md +0 -42
  15. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +0 -452
  16. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +0 -511
  17. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +0 -3
  18. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +0 -42
  19. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +0 -149
  20. package/src/base-client/components/common/FormGroupEdit/index.js +0 -3
  21. package/src/base-client/components/common/FormGroupEdit/index.md +0 -43
  22. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +0 -166
  23. package/src/base-client/components/common/FormGroupQuery/index.js +0 -3
  24. package/src/base-client/components/common/FormGroupQuery/index.md +0 -43
  25. package/src/config/CreateQueryConfig.js +0 -322
  26. package/src/pages/CreateQueryPage.vue +0 -160
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.8.82 -2024-3-7 @江超**
5
+ - 删除过时组件
6
+ - XFormItem的下拉框数据源现在支持从配置中心获取了
7
+ - 待解决:XTable显示来自配置中心的字典徽标
8
+
4
9
  **1.8.79 -2024-3-6 @江超**
5
10
  - 增加实体保存的方法
6
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.80",
3
+ "version": "1.8.82",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -35,17 +35,25 @@
35
35
  <template v-if="attr.keys">
36
36
  <a-select-option
37
37
  v-for="(item,index) in attr.keys"
38
- :key="index"
38
+ :key="index.value"
39
39
  :value="item.value">
40
40
  {{ item.label }}
41
41
  </a-select-option>
42
42
  </template>
43
43
  <template v-else>
44
- <template v-if="attr.keyName.indexOf('logic@') !== -1">
44
+ <template v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1">
45
45
  <a-select-option
46
46
  v-for="(item,index) in option"
47
- :key="index"
48
- :value="item.value">{{ item.label }}
47
+ :key="index.value"
48
+ :value="item.value">
49
+ <template v-if="attr.keyName.indexOf('config@') !== -1 && item.status">
50
+ <!-- 徽标(badge) -->
51
+ <a-badge v-if="item.status !== 'gary'" :color="item.status" :text="item.label"/>
52
+ <a-badge v-else color="#D9D9D9" :text="item.label"/>
53
+ </template>
54
+ <template v-else>
55
+ {{ item.label }}
56
+ </template>
49
57
  </a-select-option>
50
58
  </template>
51
59
  <template v-else>
@@ -111,7 +119,7 @@
111
119
  </a-select-option>
112
120
  </template>
113
121
  <template v-else>
114
- <template v-if="attr.keyName.indexOf('logic@') !== -1">
122
+ <template v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1">
115
123
  <a-select-option
116
124
  v-for="(item,index) in option"
117
125
  :key="index"
@@ -163,7 +171,7 @@
163
171
  </a-radio>
164
172
  </template>
165
173
  <template v-else>
166
- <template v-if="attr.keyName.indexOf('logic@') !== -1">
174
+ <template v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1">
167
175
  <a-radio v-for="(item,index) in option" :key="index" :value="item.value">
168
176
  {{ item.label }}
169
177
  </a-radio>
@@ -313,7 +321,7 @@ import AddressSearchCombobox from '@vue2-client/base-client/components/common/Ad
313
321
  import Upload from '@vue2-client/base-client/components/common/Upload'
314
322
  import moment from 'moment'
315
323
  import XTreeSelect from '@vue2-client/base-client/components/common/XForm/XTreeSelect'
316
- import { runLogic } from '@vue2-client/services/api/common'
324
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
317
325
 
318
326
  export default {
319
327
  name: 'XFormItem',
@@ -428,26 +436,32 @@ export default {
428
436
  }
429
437
  }
430
438
  if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
431
- this.getData({}, res => {
432
- this.option = res
433
- if (this.attr.type === 'treeSelect') {
434
- this.$refs.xTreeSelect.init({
435
- option: this.option,
436
- form: this.form,
437
- queryType: this.attr.queryType,
438
- name: this.attr.name,
439
- model: this.attr.model,
440
- mode: this.mode,
441
- disabled: this.disabled
442
- })
443
- } else if (this.attr.type === 'radio') {
444
- this.initRadioValue()
445
- }
439
+ this.getData({}, res => this.getDataCallback(res))
440
+ } else if (this.attr.keyName && this.attr.keyName.indexOf('config@') !== -1) {
441
+ const configName = this.attr.keyName.substring(7)
442
+ getConfigByName(configName, this.serviceName, res => {
443
+ this.getDataCallback(res.value)
446
444
  })
447
445
  } else {
448
446
  this.initRadioValue()
449
447
  }
450
448
  },
449
+ getDataCallback (res) {
450
+ this.option = res
451
+ if (this.attr.type === 'treeSelect') {
452
+ this.$refs.xTreeSelect.init({
453
+ option: this.option,
454
+ form: this.form,
455
+ queryType: this.attr.queryType,
456
+ name: this.attr.name,
457
+ model: this.attr.model,
458
+ mode: this.mode,
459
+ disabled: this.disabled
460
+ })
461
+ } else if (this.attr.type === 'radio') {
462
+ this.initRadioValue()
463
+ }
464
+ },
451
465
  initRadioValue () {
452
466
  const model = this.attr.model
453
467
  if (this.mode === '新增/修改' && this.attr.type === 'radio' && !this.form[model]) {
@@ -10,12 +10,8 @@ import XCard from './common/XCard'
10
10
  import XBadge from './common/XBadge'
11
11
  import Upload from './common/Upload'
12
12
  import JSONToTree from './common/JSONToTree'
13
- import FormGroupEdit from './common/FormGroupEdit'
14
- import FormGroupQuery from './common/FormGroupQuery'
15
13
  import AddressSearchCombobox from './common/AddressSearchCombobox'
16
14
  import AmapMarker from './common/AmapMarker'
17
- // import CreateQuery from './common/CreateQuery'
18
- // import CreateSimpleFormQuery from './common/CreateSimpleFormQuery'
19
15
  import PersonSetting from './common/PersonSetting'
20
16
  import XFormTable from './common/XFormTable'
21
17
  import XStepView from './common/XStepView'
@@ -34,8 +30,6 @@ export default {
34
30
  XBadge,
35
31
  Upload,
36
32
  JSONToTree,
37
- FormGroupEdit,
38
- FormGroupQuery,
39
33
  AddressSearchCombobox,
40
34
  AmapMarker,
41
35
  // CreateQuery,
@@ -88,19 +88,33 @@ export default {
88
88
  },
89
89
  initializeOptions () {
90
90
  if (this.rawData.length > 0) {
91
- const firstRow = this.rawData[0]
92
- this.groupOptions = Object.keys(firstRow).filter(key => typeof firstRow[key] === 'string' ||
91
+ const row = this.rawData[0]
92
+ this.groupOptions = Object.keys(row).filter(key => typeof row[key] === 'string' ||
93
93
  this.isYearArray(this.rawData, key))
94
- this.valueOptions = Object.keys(firstRow).filter(key => typeof firstRow[key] === 'number' &&
95
- !this.isYearArray(this.rawData, key))
94
+ this.valueOptions = Object.keys(row).filter(key => {
95
+ return !isNaN(parseFloat(row[key])) && isFinite(row[key]) && !this.isYear(row[key])
96
+ })
97
+ console.warn(this.valueOptions)
96
98
  }
97
99
  },
98
100
  isYearArray (arr, key) {
99
- return arr.every(item => this.isYear(item[key]))
101
+ if (arr.some(item => this.isYear(item[key]))) {
102
+ this.updateNonYearItems(arr, key)
103
+ return true
104
+ }
105
+ return false
106
+ },
107
+ // 修改数组中不满足条件的元素的特定键值为1970
108
+ updateNonYearItems (arr, key) {
109
+ arr.forEach(item => {
110
+ if (!this.isYear(item[key])) {
111
+ item[key] = 1970
112
+ }
113
+ })
100
114
  },
101
115
  // 判断数值或者字符串是不是年份
102
116
  isYear (value) {
103
- return /^20\d{2}$/.test(value)
117
+ return /^(19|20)\d{2}$/.test(value)
104
118
  },
105
119
  updateCharts () {
106
120
  this.renderPieChart()
@@ -28,7 +28,7 @@ export default {
28
28
  props: {
29
29
  tableData: {
30
30
  type: Array,
31
- required: true
31
+ default: () => ([])
32
32
  }
33
33
  },
34
34
  watch: {
@@ -43,6 +43,9 @@ export default {
43
43
  async initData () {
44
44
  try {
45
45
  // 从数据第一项推断列信息
46
+ if (this.tableData.length === 0) {
47
+ return
48
+ }
46
49
  const sample = this.tableData[0]
47
50
  this.tableColumns = Object.keys(sample).map(key => ({
48
51
  title: key, // 使用键名作为列标题
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <a-card class="question-history" id="question-history" size="small" :bordered="false" :bodyStyle="{ height:'100%', overflowY: 'auto'}">
3
- <a-tabs v-model="activeKey" :tabBarStyle="{ textAlign: 'center',height:'100%',postion:'' }" tabPosition="top">
3
+ <a-tabs v-model="activeKey" :tabBarStyle="{ textAlign: 'center',height:'100%' }" tabPosition="top">
4
4
  <a-tab-pane key="1" tab="对话历史">
5
5
  <a-list item-layout="horizontal" :data-source="questions">
6
6
  <a-list-item
@@ -95,6 +95,8 @@ export default {
95
95
  this.favorites.push(datum.data)
96
96
  }
97
97
  }
98
+ this.questions.sort((a, b) => new Date(b.date) - new Date(a.date))
99
+ this.favorites.sort((a, b) => new Date(b.date) - new Date(a.date))
98
100
  }
99
101
  )
100
102
  },
@@ -1,13 +1,21 @@
1
1
  <template>
2
2
  <div class="search-bar">
3
+ <a-select default-value="all" class="select" @change="handleChange">
4
+ <a-select-option v-for="d in selectOption" :key="d.value">
5
+ {{ d.text }}
6
+ </a-select-option>
7
+ </a-select>
3
8
  <a-auto-complete
4
9
  v-model="searchInput"
5
10
  class="search-input"
11
+ ref="autoComplete"
6
12
  placeholder="请输入查询的内容"
7
13
  option-label-prop="title"
14
+ :open="true"
8
15
  @select="onSearch"
9
- @search="handleSearch"
16
+ @search="fetchFunction"
10
17
  >
18
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
11
19
  <template slot="dataSource">
12
20
  <a-select-option v-for="item in dataSourceResults" :key="item.category" :title="item.category">
13
21
  <span>{{ item.category.substr(0,item.category.indexOf(searchInput)) }}</span>
@@ -33,19 +41,30 @@
33
41
  <script>
34
42
  import FavoriteList from './FavoriteList.vue'
35
43
  import { post } from '@vue2-client/services/api'
44
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
36
45
 
37
46
  export default {
38
47
  name: 'SearchBar',
39
48
  components: { FavoriteList },
40
49
  data () {
50
+ // 检索去抖
51
+ this.fetchFunction = debounce(this.fetchFunction, 300)
41
52
  return {
53
+ // 最后检索版本
54
+ lastFetchId: 0,
55
+ searching: false,
42
56
  searchInput: '', // 绑定搜索输入框的数据,
43
57
  favoriteState: false, // 是否收藏
44
58
  obj: undefined,
45
59
  favoriteListVisible: false,
46
60
  loading: false,
47
- dataSource: [],
48
61
  dataSourceResults: [],
62
+ selectOption: [
63
+ { value: 'all', text: '全部' },
64
+ { value: '合同', text: '合同类' },
65
+ { value: '项目', text: '项目类' },
66
+ { value: '人员', text: '人员类' },
67
+ ]
49
68
  }
50
69
  },
51
70
  computed: {
@@ -54,13 +73,39 @@ export default {
54
73
  this.init()
55
74
  },
56
75
  methods: {
57
- handleSearch (value) {
58
- if (value) {
59
- this.dataSourceResults = this.dataSource.filter(
60
- item => item.category.indexOf(value) !== -1
61
- )
76
+ handleChange (value) {
77
+ if (value === 'all') {
78
+ this.searchInput = ''
62
79
  } else {
63
- this.dataSourceResults = []
80
+ this.searchInput = value
81
+ }
82
+ this.dataSourceResults = []
83
+ this.fetchFunction(this.searchInput)
84
+ this.$refs.autoComplete.focus()
85
+ },
86
+ fetchFunction (value) {
87
+ this.dataSourceResults = []
88
+ if (value) {
89
+ this.searching = true
90
+ this.lastFetchId += 1
91
+ const fetchId = this.lastFetchId
92
+ post('/api/af-system/logic/openapi/getCommonData', {
93
+ type: 'ai-question',
94
+ content: value
95
+ }).then(res => {
96
+ if (fetchId !== this.lastFetchId) {
97
+ return
98
+ }
99
+ if (res != null && Array.isArray(res)) {
100
+ // 提取 json 中的 question, 并去重
101
+ this.dataSourceResults = res.map(item => JSON.parse(item.f_json).question)
102
+ .filter((item, index, arr) => arr.indexOf(item) === index)
103
+ .map(item => ({ category: item }))
104
+ console.warn(this.dataSourceResults)
105
+ }
106
+ }).finally(() => {
107
+ this.searching = false
108
+ })
64
109
  }
65
110
  },
66
111
  // 处理搜索操作
@@ -82,15 +127,6 @@ export default {
82
127
  }
83
128
  },
84
129
  init () {
85
- post('/api/af-system/logic/openapi/getCommonData', {
86
- type: 'ai-evaluation',
87
- content: '11'
88
- }).then(res => {
89
- // 提取 json 中的 question, 并去重
90
- this.dataSource = res.map(item => JSON.parse(item.f_json).question)
91
- .filter((item, index, arr) => arr.indexOf(item) === index)
92
- .map(item => ({ category: item }))
93
- })
94
130
  this.searchInput = ''
95
131
  this.obj = undefined
96
132
  this.favoriteState = false
@@ -143,6 +179,18 @@ export default {
143
179
  padding: 4px 80px 4px 40px;
144
180
  font-size: 16px;
145
181
  }
182
+ .select {
183
+ width: 100px;
184
+ height: 48px;
185
+ padding-right: 6px;
186
+ font-size: 16px;
187
+ text-align: center;
188
+ :deep(.ant-select-selection-selected-value) {
189
+ width: 100px;
190
+ height: 48px;
191
+ line-height: 48px;
192
+ }
193
+ }
146
194
  }
147
195
 
148
196
  </style>
@@ -121,6 +121,15 @@ export default {
121
121
  // age: Math.floor(Math.random() * 100) + 1
122
122
  // }
123
123
  // ]
124
+ // 保存到数据库中
125
+ post('/api/af-system/logic/openapi/addCommonData', {
126
+ type: 'ai-question',
127
+ content: {
128
+ uuid: uuid,
129
+ question: value,
130
+ date: formatDate('now')
131
+ }
132
+ })
124
133
  if (Array.isArray(res)) {
125
134
  this.addTab(uuid, value, res, false)
126
135
  } else {
@@ -33,8 +33,6 @@ routerResource.submitTicket = () => import('@vue2-client/pages/system/ticket')
33
33
  routerResource.ServiceReview = () => import('@vue2-client/pages/ServiceReview')
34
34
  // 系统设置
35
35
  routerResource.settings = () => import('@vue2-client/pages/system/settings')
36
- // 查询配置生成工具
37
- routerResource.createQuery = () => import('@vue2-client/pages/CreateQueryPage')
38
36
  // AMIS示例页面
39
37
  routerResource.amisDemo = () => import('@vue2-client/pages/AMisDemo/AMisDemo')
40
38
  // 数据检索