vue2-client 1.9.187 → 1.9.189

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.
@@ -1,31 +1,36 @@
1
1
  # function总体说明
2
+
2
3
  - function的参数,与具体事件有关系。可以在函数里,通过console.log('>>>参数', arguments)显示参数内容。
3
4
  - 如果function的参数里没有需要的数据,用this.函数/属性,可以取需要的内容,具体内容,与组件类型有关。
4
5
  - 用this.函数函数调用方式调用相应功能。
5
6
 
6
7
  # 通过this可以调用的函数
8
+
7
9
  - openDialog(configName, selectedId, mixinData):打开一个对话框,例如:this.openDialog('xxx', 5, {})
8
10
  - openDialog(configName, selectedId, mixinData, outEnv, attr):打开一个对话框:
9
11
  - openDrawer(configName, selectedId, mixinData):打开一个对话框,例如:this.openDialog('xxx', 5, {})
10
12
  - openDrawer(configName, selectedId, mixinData, outEnv, attr):打开一个对话框:
11
- * selectId:id号,formtable选择时,用selectId过滤数据 可以传递 json {a_id: 1} 或者 传递 1 ,传递数值会默认拼接查询条件 {selected_id:1}
12
- * mixinData: form表单需要的数据
13
- * outEnv: 传递给打开的界面的数据,在打开界面的js中通过this.outEnv可以访问
14
- * attr: 用于传递参数绑定到 modal 弹框上
13
+ - selectId:id号,formtable选择时,用selectId过滤数据 可以传递 json {a_id: 1} 或者 传递 1 ,传递数值会默认拼接查询条件 {selected_id:1}
14
+ - mixinData: form表单需要的数据
15
+ - outEnv: 传递给打开的界面的数据,在打开界面的js中通过this.outEnv可以访问
16
+ - attr: 用于传递参数绑定到 modal 弹框上
15
17
  - getOutEnv 获取获取 outEnv
16
18
  - this.getRealKeyData(obj) 获取真实的数据 传递 {a_a:"1"} 返回 {a:"1"}
17
19
 
18
20
  ```js
19
21
  this.openDialog('xxx', 5, {}, {}, {})
20
22
  ```
23
+
21
24
  - runLogic(logicName, parameter): 运行业务逻辑, 例如: this.runLogic('xxx', {})
22
25
 
23
26
  # 如何调用珊格中组件的数据及函数
27
+
24
28
  - 先给组件起名字,命名规范:main,left,right,top,bottom
25
29
  - 用 this.getComponentByName('main') 拿到组件。
26
30
  - emitEvent(eventName, ...args) 发送事件到外部珊格
27
31
 
28
32
  # x-form-table 可以使用的函数/数据
33
+
29
34
  - table_selectedRowKeys 获取选中的id /不用加 () 这是一个data 中的变量
30
35
  - table_selectedRows 获取选中的行 /不用加 () 这是一个data 中的变量
31
36
  - getSelectedId 获取获取selectedid
@@ -42,11 +47,11 @@ this.openDialog('xxx', 5, {}, {}, {})
42
47
  - validateTableAndSyncData (currRow, defaultAppendRowData) 本地编辑模式下校验表格并同步本地数据
43
48
  - 事件相关
44
49
  - 行编辑时,下拉选中处理,function (form,setForm,attr,util,self)
45
- * form 当前编辑行
46
- * setForm(form, {})给编辑行设置值
47
- * attr.selectRows[] 选中的数据
48
- * util 可以使用的工具方法
49
- * self x-form-table组件自身
50
+ - form 当前编辑行
51
+ - setForm(form, {})给编辑行设置值
52
+ - attr.selectRows[] 选中的数据
53
+ - util 可以使用的工具方法
54
+ - self x-form-table组件自身
50
55
  - afterSubmit( type(新增/修改/擦和讯), id: (所操作的主键id), form: (请求的表单内容)) 提交后触发
51
56
  - afterQuery( res (查询后数据), querparams (查询参数)) 查询后触发
52
57
  - curdAddBefore(func) 点击新增按钮时触发 传参为 打开新增表单函数
@@ -54,9 +59,11 @@ this.openDialog('xxx', 5, {}, {}, {})
54
59
  action(record (当前记录), id (当前记录主键), actionType (操作类型)) 操作按钮触发
55
60
 
56
61
  # x-report 插槽 使用说明
62
+
57
63
  - init(configName,configData) 配置名称 / 报表数据
58
64
  - setData(configData) 主动设置数据
59
65
  - 当使用 openDialog 打开报表时,会自动调用 init 方法,传递参数为打开弹框时传递的 **mixinData**
66
+
60
67
  ```js
61
68
  this.$refs.main.openDialog('ceshishange',
62
69
  -1,
@@ -65,6 +72,7 @@ this.openDialog('xxx', 5, {}, {}, {})
65
72
  }
66
73
  )
67
74
  ```
75
+
68
76
  - 当没有 openDialog 打开报表时,需要手动调用 init 方法 或者 setData,传递参数为需要的数据
69
77
 
70
78
  # form 简易表单
@@ -76,11 +84,13 @@ this.openDialog('xxx', 5, {}, {}, {})
76
84
  - onSubmit(form) 表单提交事件
77
85
 
78
86
  # 每种事件处理,传递给function的参数
87
+
79
88
  - 添加处理:空
80
89
  - action:(操作行数据)
81
90
  - 自定义按钮:(选中的所有行)
82
91
 
83
92
  # 例子
93
+
84
94
  function() {
85
95
  // 获取主formtable组件
86
96
  main = this.getComponentByName('main')
@@ -98,6 +108,7 @@ function() {
98
108
  return runLogic('logic', {res})
99
109
  }
100
110
  ```
111
+
101
112
  ### OpenDialog 弹框确认事件
102
113
 
103
114
  ```js
@@ -110,6 +121,7 @@ function() {
110
121
  ## 执行自定义函数之后 刷新和提示说明
111
122
 
112
123
  ### 前端函数写法
124
+
113
125
  ```js
114
126
  function () {
115
127
  if (id) {
@@ -131,7 +143,9 @@ function () {
131
143
  // messageType : "提示级别", 默认值为 "success" 可自定义传 success | warn | info | error
132
144
  // }
133
145
  ```
146
+
134
147
  ### Logic 写法
148
+
135
149
  ```go
136
150
  validate {
137
151
  id: {
@@ -146,7 +160,9 @@ function () {
146
160
  }
147
161
 
148
162
  ```
163
+
149
164
  或者
165
+
150
166
  ```go
151
167
  data.a == 3 : (
152
168
  return {
package/jsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
6
+ "baseUrl": ".",
7
+ "paths": {
8
+ "@/*": ["src/*"],
9
+ "@vue2-client/*": ["src/*"]
10
+ },
11
+ "jsx": "preserve",
12
+ "experimentalDecorators": true,
13
+ "allowSyntheticDefaultImports": true,
14
+ "sourceMap": true,
15
+ "strict": true,
16
+ "noImplicitAny": false
17
+ },
18
+ "exclude": ["node_modules", "dist"]
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.9.187",
3
+ "version": "1.9.189",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -5,7 +5,7 @@
5
5
  :title="resolvedTitle? resolvedTitle : businessTitle"
6
6
  :visible="visible"
7
7
  :width="`${xAddFormLayoutWidth}vw`"
8
- :zIndex="20"
8
+ :zIndex="101"
9
9
  okText="提交"
10
10
  @cancel="close"
11
11
  @ok="$refs.nativeForm.onSubmit()">
@@ -854,7 +854,17 @@ export default {
854
854
  }
855
855
  }
856
856
  for (const item of this.silenceAddJsonData.filter((item) => item.silencePurpose === 'customize')) {
857
- form[item.model] = await runLogic(item.silenceSource, form, this.serviceName)
857
+ let result = await runLogic(item.silenceSource, form, this.serviceName);
858
+ if (result) {
859
+ let keys = Object.keys(result);
860
+ if (keys.length === 1 && keys[0] === 'value') {
861
+ form[item.model] = result.value;
862
+ } else {
863
+ form[item.model] = result;
864
+ }
865
+ } else {
866
+ form[item.model] = result;
867
+ }
858
868
  }
859
869
  }
860
870
  },
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <div class="tag-group">
3
+ <slot>
4
+ <a-tag
5
+ v-for="(tag, index) in options"
6
+ :key="index"
7
+ :color="tag.color"
8
+ >
9
+ {{ tag.label }}
10
+ </a-tag>
11
+ </slot>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ export default {
17
+ props: {
18
+ options: {
19
+ type: Array,
20
+ required: true,
21
+ default: () => []
22
+ }
23
+ }
24
+ }
25
+ </script>
26
+
27
+ <style scoped lang="less">
28
+ .tag-group {
29
+ display: flex;
30
+ }
31
+
32
+ .tag-group .ant-tag {
33
+ border-radius: 5px;
34
+ margin-right: 0px;
35
+ min-width: 1.5rem;
36
+ min-height: 1rem;
37
+ }
38
+
39
+ .tag-group .ant-tag:first-child {
40
+ border-top-right-radius: 0;
41
+ border-bottom-right-radius: 0;
42
+ }
43
+
44
+ .tag-group .ant-tag:last-child {
45
+ border-top-left-radius: 0;
46
+ border-bottom-left-radius: 0;
47
+ }
48
+
49
+ .tag-group .ant-tag:not(:first-child):not(:last-child) {
50
+ border-radius: 0;
51
+ }
52
+ </style>
@@ -1,83 +1,18 @@
1
1
  <template>
2
2
  <a-tooltip :title="title" :overlayStyle="{zIndex: 2001}">
3
3
  <div class="img-check-box" @click="toggle">
4
- <img :src="img" alt=""/>
5
- <div v-if="sChecked" class="check-item">
6
- <a-icon type="check" />
4
+ <img :src="img" alt="" v-if="type === 'img'">
5
+ <a-icon v-else :type="icon" style="font-size: 2rem" :class="sChecked?'sChecked iconCheck':'iconCheck'"/>
6
+ <div v-if="sChecked && type === 'img'" class="check-item">
7
+ <a-icon type="check"/>
7
8
  </div>
8
9
  </div>
9
10
  </a-tooltip>
10
11
  </template>
11
12
 
12
13
  <script>
13
- const Group = {
14
- name: 'ImgCheckboxGroup',
15
- props: {
16
- multiple: {
17
- type: Boolean,
18
- required: false,
19
- default: false
20
- },
21
- defaultValues: {
22
- type: Array,
23
- required: false,
24
- default: () => []
25
- }
26
- },
27
- data () {
28
- return {
29
- values: [],
30
- options: []
31
- }
32
- },
33
- provide () {
34
- return {
35
- groupContext: this
36
- }
37
- },
38
- watch: {
39
- values: function (value) {
40
- this.$emit('change', value)
41
- // // 此条件是为解决单选时,触发两次chang事件问题
42
- // if (!(newVal.length === 1 && oldVal.length === 1 && newVal[0] === oldVal[0])) {
43
- // this.$emit('change', this.values)
44
- // }
45
- }
46
- },
47
- methods: {
48
- handleChange (option) {
49
- if (!option.checked) {
50
- if (this.values.indexOf(option.value) > -1) {
51
- this.values = this.values.filter(item => item !== option.value)
52
- }
53
- } else {
54
- if (!this.multiple) {
55
- this.values = [option.value]
56
- this.options.forEach(item => {
57
- if (item.value !== option.value) {
58
- item.sChecked = false
59
- }
60
- })
61
- } else {
62
- this.values.push(option.value)
63
- }
64
- }
65
- }
66
- },
67
- render (h) {
68
- return h(
69
- 'div',
70
- {
71
- attrs: { style: 'display: flex' }
72
- },
73
- [this.$slots.default]
74
- )
75
- }
76
- }
77
-
78
14
  export default {
79
15
  name: 'ImgCheckbox',
80
- Group,
81
16
  props: {
82
17
  checked: {
83
18
  type: Boolean,
@@ -86,7 +21,15 @@ export default {
86
21
  },
87
22
  img: {
88
23
  type: String,
89
- required: true
24
+ default: ''
25
+ },
26
+ type: {
27
+ type: String,
28
+ default: 'img'
29
+ },
30
+ icon: {
31
+ type: String,
32
+ default: ''
90
33
  },
91
34
  // eslint-disable-next-line vue/require-prop-types
92
35
  value: {
@@ -118,7 +61,7 @@ export default {
118
61
  const groupContext = this.groupContext
119
62
  if (groupContext) {
120
63
  this.sChecked = groupContext.defaultValues.length > 0 ? groupContext.defaultValues.indexOf(this.value) >= 0 : this.sChecked
121
- groupContext.options.push(this)
64
+ groupContext.datas.push(this)
122
65
  }
123
66
  },
124
67
  methods: {
@@ -142,22 +85,33 @@ export default {
142
85
  </script>
143
86
 
144
87
  <style lang="less" scoped>
145
- .img-check-box{
146
- margin-right: 16px;
147
- position: relative;
148
- border-radius: 4px;
149
- cursor: pointer;
150
- .check-item{
151
- position: absolute;
152
- top: 0;
153
- right: 0;
154
- width: 100%;
155
- padding-top: 15px;
156
- padding-left: 24px;
157
- height: 100%;
158
- color: @primary-color;
159
- font-size: 14px;
160
- font-weight: bold;
161
- }
88
+ .sChecked {
89
+ color: @primary-color;
90
+ }
91
+
92
+ .iconCheck {
93
+ padding: 5px;
94
+ border: 1px solid;
95
+ border-radius: 12px;
96
+ }
97
+
98
+ .img-check-box {
99
+ margin-right: 16px;
100
+ position: relative;
101
+ border-radius: 4px;
102
+ cursor: pointer;
103
+
104
+ .check-item {
105
+ position: absolute;
106
+ top: 0;
107
+ right: 0;
108
+ width: 100%;
109
+ padding-top: 15px;
110
+ padding-left: 24px;
111
+ height: 100%;
112
+ color: @primary-color;
113
+ font-size: 14px;
114
+ font-weight: bold;
162
115
  }
116
+ }
163
117
  </style>
@@ -0,0 +1,76 @@
1
+ <script>
2
+ export default {
3
+ name: 'ImgCheckboxGroup',
4
+ components: {
5
+ ImgCheckbox: () => import('./ImgCheckbox')
6
+ },
7
+ props: {
8
+ multiple: {
9
+ type: Boolean,
10
+ required: false,
11
+ default: false
12
+ },
13
+ defaultValues: {
14
+ type: Array,
15
+ required: false,
16
+ default: () => []
17
+ },
18
+ options: {
19
+ type: Array,
20
+ default: () => []
21
+ }
22
+ },
23
+ data () {
24
+ return {
25
+ values: [],
26
+ datas: [],
27
+ }
28
+ },
29
+ provide () {
30
+ return {
31
+ groupContext: this
32
+ }
33
+ },
34
+ watch: {
35
+ values: function (value) {
36
+ this.$emit('change', value)
37
+ }
38
+ },
39
+ methods: {
40
+ handleChange (option) {
41
+ if (!option.checked) {
42
+ if (this.values.indexOf(option.value) > -1) {
43
+ this.values = this.values.filter(item => item !== option.value)
44
+ }
45
+ } else {
46
+ if (!this.multiple) {
47
+ this.values = [option.value]
48
+ this.datas.forEach(item => {
49
+ if (item.value !== option.value) {
50
+ item.sChecked = false
51
+ }
52
+ })
53
+ } else {
54
+ this.values.push(option.value)
55
+ }
56
+ }
57
+ }
58
+ },
59
+ }
60
+ </script>
61
+
62
+ <template>
63
+ <div style="display: flex">
64
+ <slot>
65
+ <img-checkbox
66
+ v-for="(item, index) in options"
67
+ :key="index"
68
+ v-bind="item"
69
+ />
70
+ </slot>
71
+ </div>
72
+ </template>
73
+
74
+ <style scoped lang="less">
75
+
76
+ </style>
@@ -1,7 +1,9 @@
1
1
  import ColorCheckbox from '@vue2-client/components/checkbox/ColorCheckbox'
2
2
  import ImgCheckbox from '@vue2-client/components/checkbox/ImgCheckbox'
3
+ import ImgCheckboxGroup from '@vue2-client/components/checkbox/ImgCheckboxGroup'
3
4
 
4
5
  export {
5
6
  ColorCheckbox,
6
- ImgCheckbox
7
+ ImgCheckbox,
8
+ ImgCheckboxGroup
7
9
  }
@@ -0,0 +1,202 @@
1
+ // 添加类型定义
2
+ /**
3
+ * @typedef {Object} ChartConfig
4
+ * @property {string} type - 图表类型
5
+ * @property {string[]} chartsTools - 图表工具
6
+ * @property {string} dataSource - 数据源
7
+ * @property {string} xField - 横轴字段
8
+ * @property {string} xFieldSortBy - 排序依据
9
+ * @property {string} xFieldSortType - 排序方式
10
+ * @property {string} yFieldType - 纵轴类型
11
+ * @property {Array<{field: string, mold: string}>} yField - 纵轴字段
12
+ */
13
+
14
+ export const colorItems = [
15
+ [
16
+ { label: '', color: '#3371EC' },
17
+ { label: '', color: '#1CCEC0' },
18
+ { label: '', color: '#FFC60A' },
19
+ { label: '', color: '#ED6D0C' },
20
+ { label: '', color: '#DCA1E5' },
21
+ { label: '', color: '#25B2E7' }
22
+ ],
23
+ [
24
+ { label: '', color: '#F5222D' },
25
+ { label: '', color: '#FA541C' },
26
+ { label: '', color: '#FA8C16' },
27
+ { label: '', color: '#FAAD14' },
28
+ { label: '', color: '#FADB14' },
29
+ { label: '', color: '#A0D911' }
30
+ ],
31
+ [
32
+ { label: '', color: '#52C41A' },
33
+ { label: '', color: '#13C2C2' },
34
+ { label: '', color: '#1890FF' },
35
+ { label: '', color: '#2F54EB' },
36
+ { label: '', color: '#722ED1' },
37
+ { label: '', color: '#EB2F96' }
38
+ ],
39
+ [
40
+ { label: '', color: '#0F58FF' },
41
+ { label: '', color: '#2B6BFF' },
42
+ { label: '', color: '#467EFF' },
43
+ { label: '', color: '#6392FE' },
44
+ { label: '', color: '#81A6FF' },
45
+ { label: '', color: '#B7CDFF' }
46
+ ],
47
+ [
48
+ { label: '', color: '#34C623' },
49
+ { label: '', color: '#44DB34' },
50
+ { label: '', color: '#62E153' },
51
+ { label: '', color: '#80E774' },
52
+ { label: '', color: '#9DEC93' },
53
+ { label: '', color: '#D7F6D4' }
54
+ ],
55
+ [
56
+ { label: '', color: '#FF8800' },
57
+ { label: '', color: '#FF951D' },
58
+ { label: '', color: '#FFA33B' },
59
+ { label: '', color: '#FFAF56' },
60
+ { label: '', color: '#FFBE74' },
61
+ { label: '', color: '#FFD8AD' }
62
+ ],
63
+ [
64
+ { label: '', color: '#FF160F' },
65
+ { label: '', color: '#FE322B' },
66
+ { label: '', color: '#FF4E48' },
67
+ { label: '', color: '#FE6962' },
68
+ { label: '', color: '#FF847F' },
69
+ { label: '', color: '#FFB9B7' }
70
+ ],
71
+ [
72
+ { label: '', color: '#000000' },
73
+ { label: '', color: '#222222' },
74
+ { label: '', color: '#444444' },
75
+ { label: '', color: '#666666' },
76
+ { label: '', color: '#888888' },
77
+ { label: '', color: '#CCCCCC' }
78
+ ],
79
+ [
80
+ { label: '', color: '#2A004E' },
81
+ { label: '', color: '#500073' },
82
+ { label: '', color: '#C62300' },
83
+ { label: '', color: '#F14A00' },
84
+ { label: '', color: '#FFC145' },
85
+ { label: '', color: '#ECE852' }
86
+ ],
87
+ [
88
+ { label: '', color: '#7C444F' },
89
+ { label: '', color: '#9F5255' },
90
+ { label: '', color: '#DF6D2D' },
91
+ { label: '', color: '#F39E60' },
92
+ { label: '', color: '#F87A53' },
93
+ { label: '', color: '#E6C767' }
94
+ ]
95
+ ]
96
+
97
+ export const chartsTools = [
98
+ { label: '图例', value: 'legend', match: 'line,bar,pie' },
99
+ { label: '数据标签', value: 'label', match: 'line,bar,pie' },
100
+ { label: '坐标轴', value: 'xyVisible', match: 'line,bar' },
101
+ { label: '数据点', value: 'point', match: 'line' },
102
+ { label: '网格线', value: 'grid', match: 'line,bar' }
103
+ ]
104
+
105
+ export const dataSourceOptions = [
106
+ { label: '当前CRUD', value: 'curCrud' },
107
+ { label: '业务逻辑', value: 'Logic' },
108
+ { label: 'api', value: 'api', disabled: true }
109
+ ]
110
+
111
+ export const tabList = [{
112
+ key: '类型与数据',
113
+ tab: '类型与数据',
114
+ }, {
115
+ key: '自定义样式',
116
+ tab: '自定义样式',
117
+ }]
118
+
119
+ export const chartTypes = [
120
+ { label: '折线图', value: 'line', icon: 'line-chart', type: 'icon' },
121
+ { label: '柱状图', value: 'bar', icon: 'bar-chart', type: 'icon' },
122
+ { label: '圆饼图', value: 'pie', icon: 'pie-chart', type: 'icon' }]
123
+
124
+ export const sortBy = [
125
+ {
126
+ value: 'value',
127
+ label: '横轴顺序',
128
+ placeholder: '按照横轴值排序'
129
+ },
130
+ {
131
+ value: 'statistics',
132
+ label: '统计值',
133
+ placeholder: '按照统计值大小排序'
134
+ }
135
+ ]
136
+
137
+ export const sortType = [
138
+ { label: '正序', value: 'asc' },
139
+ { label: '倒序', value: 'desc' }
140
+ ]
141
+
142
+ export const yValueType = [
143
+ {
144
+ label: '统计字段数值',
145
+ value: 'sum',
146
+ molds: [{ label: '求和', value: 'sum' },
147
+ { label: '最大值', value: 'max' },
148
+ { label: '最小值', value: 'min' },
149
+ { label: '平均值', value: 'avg' },
150
+ ]
151
+ },
152
+ {
153
+ label: '统计记录总数',
154
+ value: 'count'
155
+ }
156
+ ]
157
+
158
+ // 数据字段操作选项
159
+ export const operationOptions = [
160
+ { label: '删除', value: 'delete', icon: 'delete' },
161
+ { label: '上移', value: 'moveUp', icon: 'arrow-up' },
162
+ { label: '下移', value: 'moveDown', icon: 'arrow-down' }
163
+ ]
164
+
165
+ // 每种图标的 formLabel 标签不同
166
+ export const fromItemLabelMap = {
167
+ bar: {
168
+ xField: '横轴(字段)',
169
+ yFieldType: '纵轴(字段)',
170
+ },
171
+ line: {
172
+ xField: '横轴(字段)',
173
+ yFieldType: '纵轴(字段)',
174
+ },
175
+ pie: {
176
+ xField: '扇区分组',
177
+ yFieldType: '扇区数值',
178
+ }
179
+ }
180
+
181
+ export const demoColumn = [{
182
+ label: '用户姓名',
183
+ value: 'f_user_name',
184
+ }, {
185
+ label: '用户编号',
186
+ value: 'f_userinfo_code',
187
+ }, {
188
+ label: '用户类型',
189
+ value: 'f_user_type',
190
+ }, {
191
+ label: '收款方式',
192
+ value: 'f_payment',
193
+ }, {
194
+ label: '收款金额',
195
+ value: 'f_collection',
196
+ }, {
197
+ label: '收款公司',
198
+ value: 'f_orgname',
199
+ }, {
200
+ label: '收款时间',
201
+ value: 'f_operate_date',
202
+ }]