app-form-view 0.0.3 → 0.0.4

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": "app-form-view",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "vue表单组件库",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -0,0 +1,152 @@
1
+
2
+ const BASE = 'sjyy/sjczgl/form/bdgl/config/'
3
+ const API = {
4
+ scene: BASE + 'getFromConfigScene',
5
+ addSave: BASE + 'formConfigAdd',
6
+ editSave: BASE + 'formConfigEdit',
7
+ view: BASE + 'formConfigView',
8
+ getData: 'sjyy/sjczgl/form/bdgl/formBdglView',
9
+ getSjyyFields: 'sjyy/sjcxgl/sjxgl/getYsjSjxList',
10
+ getDict: BASE + 'getFormDictData',
11
+ getFormInitData: 'sjyy/sjczgl/sjcjh/getFormInitData',
12
+ getViewData: 'sjyy/sjczgl/sjcjh/getDataViewById'
13
+ }
14
+ export const APIOPTIONS = [
15
+ { label: '系统管理信息-用户管理', url: BASE + 'selectUsers', method: 'get', fhType: 'page', paramsList: [{ label: '选择模式', name: 'xzms', value: '' }], xtgllx: 'user-gl' },
16
+ { label: '系统管理信息-角色管理', url: BASE + 'selectRoles', method: 'get', fhType: 'page', paramsList: [{ label: '选择模式', name: 'xzms', value: '' }], xtgllx: 'role-gl' },
17
+ { label: '系统管理信息-部门管理', url: 'system/dept/roleDeptTreeData', fhType: 'page', method: 'get', paramsList: [], xtgllx: 'dept-gl' },
18
+ { label: '数据查询应用数据表页面', url: BASE + 'sjyyZycxSjzy', fhType: 'page', method: 'get', paramsList: [{ label: '选择模式', name: 'xzms', value: '' }, { label: '数据表ID', name: 'id', value: '' }], xtgllx: 'sjcxyy-table' },
19
+ { label: '数据查询应用数据表JSON', url: 'sjyy/zycx/getZycxDataList', fhType: 'json', method: 'post', paramsList: [{ label: '选择模式', name: 'xzms', value: '' }, { label: '数据表ID', name: 'id', value: '' }], xtgllx: 'sjcxyy-table' }
20
+ ]
21
+ export const TYPEMAPPINGS = {
22
+ input: {
23
+ widget: 'input'
24
+ },
25
+ radio: {
26
+ widget: 'radio',
27
+ },
28
+ checkbox: {
29
+ widget: 'checkbox',
30
+ },
31
+ textarea: {
32
+ widget: 'textarea',
33
+ },
34
+ select: {
35
+ widget: 'select',
36
+ },
37
+ date: {
38
+ widget: 'datetime',
39
+ },
40
+ rqsjfw: {
41
+ widget: 'datetimeRange',
42
+ },
43
+ password: {
44
+ widget: 'password',
45
+ },
46
+ number: {
47
+ widget: 'inputNumber'
48
+ },
49
+ upload: {
50
+ widget: 'inputUpload'
51
+ },
52
+ tree_select: {
53
+ widget: 'inputTree'
54
+ }
55
+ }
56
+ //
57
+ export function getFormConfig(data) {
58
+
59
+ }
60
+ export function getFormConfigScene(data) {
61
+ return this.$request({
62
+ url: API.scene,
63
+ method: 'post',
64
+ data: data
65
+ })
66
+ }
67
+
68
+ export function saveFormData(data) {
69
+ return this.$request({
70
+ url: data.id !== undefined ? API.editSave : API.addSave,
71
+ method: 'post',
72
+ data: data
73
+ })
74
+ }
75
+ export function getTableData(data) {
76
+ return this.$request({
77
+ url: API.getData,
78
+ method: 'post',
79
+ data: data
80
+ })
81
+ }
82
+
83
+ export function getUserInfo() {
84
+ return this.$request({
85
+ url: '/sjyy/sjczgl/form/bdgl/config/getDqyh',
86
+ method: 'get'
87
+ })
88
+ }
89
+
90
+ export function getFormData(data) {
91
+ return this.$request({
92
+ url: API.view,
93
+ method: 'post',
94
+ data: data
95
+ })
96
+ }
97
+
98
+ export function getSjyyFields(data) {
99
+ return this.$request({
100
+ url: API.getSjyyFields,
101
+ method: 'post',
102
+ data: data
103
+ })
104
+ }
105
+ export function getDict(dictType, dictLylx) {
106
+ return this.$request({
107
+ url: API.getDict,
108
+ method: 'post',
109
+ data: { dictType, dictLylx: dictLylx || 'sys' }
110
+ })
111
+ }
112
+
113
+ // 接口列表
114
+ export function apiList(query) {
115
+ return this.$request({
116
+ url: '/gzt/jkgl/getGztJklist',
117
+ method: 'post',
118
+ data: query
119
+ })
120
+ }
121
+ // 接口详情
122
+ export function apiView(id) {
123
+ return this.$request({
124
+ url: '/gzt/jkgl/jkglView',
125
+ method: 'post',
126
+ data: { id }
127
+ })
128
+ }
129
+
130
+ export function getViewData(data) {
131
+ return this.$request({
132
+ url: API.getViewData,
133
+ method: 'post',
134
+ data: data
135
+ })
136
+ }
137
+
138
+ export function getFormInitData(data) {
139
+ return this.$request({
140
+ url: API.getFormInitData,
141
+ method: 'post',
142
+ data: data
143
+ })
144
+ }
145
+
146
+ export function getData(url, data) {
147
+ return this.$request({
148
+ url: url,
149
+ method: 'post',
150
+ data: data
151
+ })
152
+ }
@@ -0,0 +1,11 @@
1
+
2
+
3
+ // 根据字典类型查询字典数据信息
4
+ export function getDicts(dictType, dictLylx) {
5
+ let type = dictType.split('/')[0]
6
+ return this.$request({
7
+ url: '/sjyy/sjczgl/form/bdgl/config/getFormDictData',
8
+ data: { dictType: type, dictLylx: dictLylx || dictType.split('/')[1] || 'sys' },
9
+ method: 'post'
10
+ })
11
+ }
package/src/app-index.js CHANGED
@@ -1,53 +1,55 @@
1
1
  import Vue from 'vue'
2
2
  import '@/assets/scss/app-form.scss'
3
3
  import viewAppForm from '@/views/build/viewAppForm.vue'
4
- // 全部导入改名
5
- import _AppForm from '@/components/appForm/Form.vue'
6
- import _AppFormItem from '@/components/appForm/Formitem.vue'
7
- import _AppSubRow from '@/components/appForm/SubRow.vue'
8
- import _AppInput from '@/components/appForm/Input.vue'
9
- import _AppTextBox from '@/components/appForm/TextBox.vue'
10
- import _AppInputHidden from '@/components/appForm/InputHidden.vue'
11
- import _AppSelect from '@/components/appForm/Select.vue'
12
- import _AppRadio from '@/components/appForm/Radio.vue'
13
- import _AppCheckbox from '@/components/appForm/Checkbox.vue'
14
- import _AppDateTimePicker from '@/components/appForm/DateTimePicker.vue'
15
- import _AppDateTimeRange from '@/components/appForm/DateTimePickers.vue'
16
- import _AppInputTree from '@/components/appForm/inputTree.vue'
17
- import _AppInputUpload from '@/components/appForm/InputUpload.vue'
18
- import _AppSearchSelect from '@/components/appForm/SearchSelect.vue'
19
- import _AppSearchApi from '@/components/appForm/SearchApi.vue'
20
- import _AppSubTitle from '@/components/appForm/SubTitle.vue'
21
- import _AppTable from '@/components/appForm/Table.vue'
22
- import _AppButton from '@/components/appForm/Button.vue'
23
- import _AppLayoutBlock from './components/appForm/LayoutBlock.vue'
4
+ import AppForm from '@/components/appForm/Form.vue'
5
+ import AppFormItem from '@/components/appForm/Formitem.vue'
6
+ import AppSubRow from '@/components/appForm/SubRow.vue'
7
+ import AppInput from '@/components/appForm/Input.vue'
8
+ import AppTextBox from '@/components/appForm/TextBox.vue'
9
+ import AppInputHidden from '@/components/appForm/InputHidden.vue'
10
+ import AppSelect from '@/components/appForm/Select.vue'
11
+ import AppRadio from '@/components/appForm/Radio.vue'
12
+ import AppCheckbox from '@/components/appForm/Checkbox.vue'
13
+ import AppDateTimePicker from '@/components/appForm/DateTimePicker.vue'
14
+ import AppDateTimeRange from '@/components/appForm/DateTimePickers.vue'
15
+ import AppInputTree from '@/components/appForm/inputTree.vue'
16
+ import AppInputUpload from '@/components/appForm/InputUpload.vue'
17
+ import AppSearchSelect from '@/components/appForm/SearchSelect.vue'
18
+ import AppSearchApi from '@/components/appForm/SearchApi.vue'
19
+ import AppSubTitle from '@/components/appForm/SubTitle.vue'
20
+ import AppTable from '@/components/appForm/Table.vue'
21
+ import AppButton from '@/components/appForm/Button.vue'
22
+ import AppLayoutBlock from './components/appForm/LayoutBlock.vue'
24
23
 
25
24
  const components = {
26
25
  AppFormView: viewAppForm,
27
- AppForm: _AppForm,
28
- AppFormItem: _AppFormItem,
29
- AppSubRow: _AppSubRow,
30
- AppInput: _AppInput,
31
- AppTextBox: _AppTextBox,
32
- AppInputHidden: _AppInputHidden,
33
- AppSelect: _AppSelect,
34
- AppRadio: _AppRadio,
35
- AppCheckbox: _AppCheckbox,
36
- AppDateTimePicker: _AppDateTimePicker,
37
- AppDateTimeRange: _AppDateTimeRange,
38
- AppInputTree: _AppInputTree,
39
- AppInputUpload: _AppInputUpload,
40
- AppSearchSelect: _AppSearchSelect,
41
- AppSearchApi: _AppSearchApi,
42
- AppSubTitle: _AppSubTitle,
43
- AppTable: _AppTable,
44
- AppButton: _AppButton,
45
- AppLayoutBlock: _AppLayoutBlock
26
+ AppForm,
27
+ AppFormItem,
28
+ AppSubRow,
29
+ AppInput,
30
+ AppTextBox,
31
+ AppInputHidden,
32
+ AppSelect,
33
+ AppRadio,
34
+ AppCheckbox,
35
+ AppDateTimePicker,
36
+ AppDateTimeRange,
37
+ AppInputTree,
38
+ AppInputUpload,
39
+ AppSearchSelect,
40
+ AppSearchApi,
41
+ AppSubTitle,
42
+ AppTable,
43
+ AppButton,
44
+ AppLayoutBlock
46
45
  }
47
46
 
48
47
  const install = function (Vue) {
49
48
  if (install.installed) return
50
49
  install.installed = true
50
+ if (options.request) {
51
+ Vue.prototype.$request = options.request
52
+ }
51
53
  Object.values(components).forEach(comp => {
52
54
  Vue.component(comp.name, comp)
53
55
  })
@@ -59,24 +61,24 @@ const AppFormPlugin = {
59
61
  }
60
62
  export default AppFormPlugin
61
63
 
62
- // 现在导出变量名和导入别名不冲突,正常编译
64
+ // 逐行具名导出,不会和顶部import变量重名
63
65
  export const AppFormView = components.AppFormView
64
- export const AppForm = components.AppForm
65
- export const AppFormItem = components.AppFormItem
66
- export const AppSubRow = components.AppSubRow
67
- export const AppInput = components.AppInput
68
- export const AppTextBox = components.AppTextBox
69
- export const AppInputHidden = components.AppInputHidden
70
- export const AppSelect = components.AppSelect
71
- export const AppRadio = components.AppRadio
72
- export const AppCheckbox = components.AppCheckbox
73
- export const AppDateTimePicker = components.AppDateTimePicker
74
- export const AppDateTimeRange = components.AppDateTimeRange
75
- export const AppInputTree = components.AppInputTree
76
- export const AppInputUpload = components.AppInputUpload
77
- export const AppSearchSelect = components.AppSearchSelect
78
- export const AppSearchApi = components.AppSearchApi
79
- export const AppSubTitle = components.AppSubTitle
80
- export const AppTable = components.AppTable
81
- export const AppButton = components.AppButton
82
- export const AppLayoutBlock = components.AppLayoutBlock
66
+ export const CAppForm = components.AppForm
67
+ export const CAppFormItem = components.AppFormItem
68
+ export const CAppSubRow = components.AppSubRow
69
+ export const CAppInput = components.AppInput
70
+ export const CAppTextBox = components.AppTextBox
71
+ export const CAppInputHidden = components.AppInputHidden
72
+ export const CAppSelect = components.AppSelect
73
+ export const CAppRadio = components.AppRadio
74
+ export const CAppCheckbox = components.AppCheckbox
75
+ export const CAppDateTimePicker = components.AppDateTimePicker
76
+ export const CAppDateTimeRange = components.AppDateTimeRange
77
+ export const CAppInputTree = components.AppInputTree
78
+ export const CAppInputUpload = components.AppInputUpload
79
+ export const CAppSearchSelect = components.AppSearchSelect
80
+ export const CAppSearchApi = components.AppSearchApi
81
+ export const CAppSubTitle = components.AppSubTitle
82
+ export const CAppTable = components.AppTable
83
+ export const CAppButton = components.AppButton
84
+ export const CAppLayoutBlock = components.AppLayoutBlock
@@ -5,13 +5,13 @@
5
5
  :disabled="attrs.readonly || attrs.disabled">
6
6
  <van-checkbox :name="option.value" v-for="option in selectOptions" :key="option.value" shape="square">{{
7
7
  option.label
8
- }}</van-checkbox>
8
+ }}</van-checkbox>
9
9
  </template>
10
10
  </van-field>
11
11
  </template>
12
12
 
13
13
  <script>
14
- import { getDicts } from '@/api/dict/data'
14
+ import { getDicts } from '@/api/dict/app-data'
15
15
  import baseMixin from './baseMixin.js'
16
16
  import eventsMixin from '../form/form-event-mixin.js'
17
17
 
@@ -4,13 +4,13 @@
4
4
  <van-radio-group v-model="innerValue" @change="handleChange" direction="horizontal"
5
5
  :disabled="attrs.readonly || attrs.disabled">
6
6
  <van-radio :name="option.value" v-for="option in selectOptions" :key="option.value">{{ option.label
7
- }}</van-radio>
7
+ }}</van-radio>
8
8
  </template>
9
9
  </van-field>
10
10
  </template>
11
11
 
12
12
  <script>
13
- import { getDicts } from '@/api/dict/data'
13
+ import { getDicts } from '@/api/dict/app-data'
14
14
  import baseMixin from './baseMixin.js'
15
15
  import eventsMixin from '../form/form-event-mixin.js'
16
16
 
@@ -1,5 +1,4 @@
1
1
  import { mapState } from 'vuex'
2
- import request from '@/utils/request'
3
2
  import DataFetcher from '@/utils/DataFetcher'
4
3
  import { isPlainObject, isArray } from '@/utils/index.js'
5
4
  import config from '@/utils/config'
@@ -222,6 +221,6 @@ export default {
222
221
  }
223
222
  },
224
223
  created: function () {
225
- this.dataFetcher = new DataFetcher(request)
224
+ this.dataFetcher = new DataFetcher(this.$request)
226
225
  },
227
226
  }
@@ -23,7 +23,7 @@
23
23
  import { baseComponents } from '@/utils/generator/config'
24
24
  import { mapActions, mapState } from 'vuex'
25
25
  import AppFormItem from './AppFormItem.vue'
26
- import { getFormData, getFormInitData, getViewData } from '@/api/form'
26
+ import { getFormData, getFormInitData, getViewData } from '@/api/app-form'
27
27
  import { findFirstNodeByNameAndSjbName } from '@/utils/index'
28
28
  export default {
29
29
  components: {
@@ -30,7 +30,6 @@
30
30
  </div>
31
31
  </template>
32
32
  <script>
33
- import { mapActions, mapState } from 'vuex'
34
33
  import FormItem from './FormItem'
35
34
  import ViewFormItem from './viewFormItem'
36
35
  import { getFormData, getFormInitData, getViewData } from '@/api/form'
@@ -56,7 +55,6 @@ export default {
56
55
  }
57
56
  },
58
57
  computed: {
59
- ...mapState('user', ['userInfo']),
60
58
  hiddenList() {
61
59
  return this.drawingList.filter(item => item.noDrag)
62
60
  },
@@ -244,7 +242,6 @@ export default {
244
242
 
245
243
  },
246
244
  methods: {
247
- ...mapActions('user', ['fetchUserInfo']),
248
245
  updateItem(key, value) {
249
246
  // 场景1:key是对象(原有逻辑,适配 name/sjbName/key 格式)
250
247
  if (typeof key === 'object') {