app-form-view 0.0.2 → 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.2",
3
+ "version": "0.0.4",
4
4
  "description": "vue表单组件库",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -40,10 +40,10 @@ export default [
40
40
  external,
41
41
  output: {
42
42
  file: "dist/index.js",
43
- name,
44
43
  banner,
45
44
  format: 'umd',
46
- globals
45
+ globals,
46
+ name: "AppFormView",
47
47
  },
48
48
  // 重点:删掉外层的 scss 实例,只追加压缩插件
49
49
  plugins: [
@@ -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,9 +1,6 @@
1
1
  import Vue from 'vue'
2
2
  import '@/assets/scss/app-form.scss'
3
- // 只导入自己的组件
4
3
  import viewAppForm from '@/views/build/viewAppForm.vue'
5
-
6
- // 内部子组件 —— 只供 viewAppForm 内部使用,不对外!
7
4
  import AppForm from '@/components/appForm/Form.vue'
8
5
  import AppFormItem from '@/components/appForm/Formitem.vue'
9
6
  import AppSubRow from '@/components/appForm/SubRow.vue'
@@ -24,8 +21,8 @@ import AppTable from '@/components/appForm/Table.vue'
24
21
  import AppButton from '@/components/appForm/Button.vue'
25
22
  import AppLayoutBlock from './components/appForm/LayoutBlock.vue'
26
23
 
27
- // 内部组件列表
28
- const innerComponents = [
24
+ const components = {
25
+ AppFormView: viewAppForm,
29
26
  AppForm,
30
27
  AppFormItem,
31
28
  AppSubRow,
@@ -45,21 +42,43 @@ const innerComponents = [
45
42
  AppTable,
46
43
  AppButton,
47
44
  AppLayoutBlock
48
- ]
45
+ }
49
46
 
50
- // 安装插件:只对外暴露 viewAppForm
51
47
  const install = function (Vue) {
52
48
  if (install.installed) return
53
-
54
- // 1. 注册内部子组件(给 viewAppForm 使用)
55
- innerComponents.forEach(comp => {
49
+ install.installed = true
50
+ if (options.request) {
51
+ Vue.prototype.$request = options.request
52
+ }
53
+ Object.values(components).forEach(comp => {
56
54
  Vue.component(comp.name, comp)
57
55
  })
56
+ }
58
57
 
59
- // 2. 只对外导出这一个主组件
60
- Vue.component(viewAppForm.name, viewAppForm)
58
+ const AppFormPlugin = {
59
+ install,
60
+ ...components
61
61
  }
62
+ export default AppFormPlugin
62
63
 
63
- export default {
64
- install
65
- }
64
+ // 逐行具名导出,不会和顶部import变量重名
65
+ export const AppFormView = components.AppFormView
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') {