w-ui-v1 1.0.20 → 1.0.22

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": "w-ui-v1",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -40,3 +40,12 @@ export function getKaptchaToken() {
40
40
  method: 'POST',
41
41
  })
42
42
  }
43
+
44
+ //获取登录用户权限配置信息
45
+ export function getUserConfig() {
46
+ return request({
47
+ url: `/v3/current-user`,
48
+ })
49
+ }
50
+
51
+
@@ -19,6 +19,18 @@ export function addPageConfig(sourceId: string) {
19
19
  })
20
20
  }
21
21
 
22
+ //新增页面提交保存
23
+ export function addPageDataSave(sourceId: string, data: any) {
24
+ return request({
25
+ url: `/v3/dtmpl/data`,
26
+ method: 'POST',
27
+ data:{
28
+ sourceId,
29
+ ...data
30
+ }
31
+ })
32
+ }
33
+
22
34
  //详情页面详细配置
23
35
  export function detailPageConfig(sourceId: string) {
24
36
  return request({
package/w-add/w-add.vue CHANGED
@@ -5,7 +5,7 @@
5
5
  </view>
6
6
  <wd-collapse v-model="value" v-else>
7
7
  <wd-collapse-item :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups" :key="index">
8
- <wd-card style="box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 17px 0px;margin: 0;" title=" "
8
+ <view
9
9
  v-if="item.type === 'fieldGroup'">
10
10
  <wd-form ref="form" :model="model">
11
11
  <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
@@ -37,15 +37,19 @@
37
37
  v-model="model[subItem.id]" type="datetime"
38
38
  :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
39
39
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" />
40
+ <wSelectPicker @confirm="wSelectPickerconfirm" :prop="subItem.id"
41
+ v-if="subItem.extControlType === 'relselect'" v-model="model[subItem.id]"
42
+ :disabled="subItem.disabled" :label="subItem.title" type="radio"
43
+ :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
44
+ :source-id="subItem.sourceId" clearable filterable
45
+ :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" />
40
46
  </view>
41
47
 
42
48
  </wd-cell-group>
43
49
 
44
50
  </wd-form>
45
- <template #footer>
46
-
47
- </template>
48
- </wd-card>
51
+
52
+ </view>
49
53
  <view v-if="item.type === 'relation'">
50
54
  <view v-if="item.pointSourceId">
51
55
  <view class="row-add" v-if="item.buttons.includes('selectAdd')">
@@ -62,7 +66,7 @@
62
66
  @click="remove(item.id, PIndex, item.title)"></wd-button>
63
67
  </view>
64
68
  </template>
65
- <wd-form ref="form" :model="PItem">
69
+ <wd-form :ref="item.id" :model="PItem">
66
70
  <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
67
71
  <view v-if="!subItem.hidden" style="border-bottom: 1px solid rgb(243 242 242);">
68
72
  <wd-input v-if="subItem.extControlType === 'text'" :disabled="subItem.disabled"
@@ -92,6 +96,12 @@
92
96
  :prop="subItem.id" clearable v-model="model[subItem.id]" type="number"
93
97
  :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
94
98
  :rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" />
99
+ <wSelectPicker :prop="subItem.id" v-if="subItem.extControlType === 'relselect'"
100
+ v-model="model[subItem.id]" :disabled="subItem.disabled"
101
+ :label="subItem.title" type="radio"
102
+ :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
103
+ :source-id="subItem.sourceId" clearable filterable
104
+ :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" />
95
105
  </view>
96
106
 
97
107
  </wd-cell-group>
@@ -117,27 +127,33 @@
117
127
  </view>
118
128
  <wd-message-box />
119
129
  <wd-popup safe-area-inset-bottom position="right" v-model="showSelectRow" custom-style="width: 100vw;">
120
- <WSelectTable :sourceId="pointSourceId" >
130
+ <WSelectTable :sourceId="pointSourceId">
121
131
  <template #close>
122
132
  <view style="display: flex;justify-content: flex-end;">
123
- <wd-button type="icon" icon="close" @click="showSelectRow=false"></wd-button>
133
+ <wd-button type="icon" icon="close" @click="showSelectRow = false"></wd-button>
124
134
  </view>
125
-
135
+
126
136
  </template>
127
- </WSelectTable>
137
+ </WSelectTable>
128
138
  </wd-popup>
139
+ <wd-toast />
129
140
  </view>
130
141
  </template>
131
142
 
132
143
  <script setup lang="ts">
144
+ import wSelectPicker from '../w-select-picker/w-select-picker.vue'
133
145
  import WSelectTable from '../w-table/w-selectTable.vue';
134
146
  import { onLoad } from '@dcloudio/uni-app'
135
147
  import { ref, defineProps, reactive } from 'vue';
136
148
  import {
137
149
  addPageConfig,
138
- getEnum
150
+ getEnum,
151
+ addPageDataSave
139
152
  } from '../utils/apis/pageConfig'
140
153
  import { useMessage } from 'wot-design-uni'
154
+ import dayjs from 'dayjs/esm/index'
155
+ import { useToast } from 'wot-design-uni'
156
+ const toast = useToast()
141
157
  const message = useMessage()
142
158
  defineOptions({
143
159
  name: 'w-add'
@@ -151,15 +167,16 @@ const props = defineProps({
151
167
  })
152
168
  const sourceId = ref('')
153
169
  const pageConf = ref({ groups: [] })
170
+ const form = ref()//基本数据表单
154
171
  //表单数据
155
172
  const model = ref({})
156
173
  const loading = ref(false)
157
174
  const value = ref([])
158
175
  const Enumcolumn = ref({})
159
176
  const showSelectRow = ref(false)
160
- const pointSourceId= ref('')
177
+ const pointSourceId = ref('')
161
178
  onLoad((option: any) => {
162
- sourceId.value = props.sourceId || option.sourceId
179
+ sourceId.value = props.sourceId || option.sourceId
163
180
  getPageConfig()
164
181
  })
165
182
 
@@ -215,14 +232,72 @@ async function getEnumer() {
215
232
  Enumcolumn.value = res.data?.enumMap || {}
216
233
  }
217
234
 
235
+ //wSelectPicker组件确定事件
236
+ const wSelectPickerconfirmData = ref([])//暂存wSelectPicker组件选中的数据
237
+ const wSelectPickerconfirm = (e) => {
238
+ console.log(e)
239
+ if (Array.isArray(e.selectedItems)) {
240
+ wSelectPickerconfirmData.value.push(...e.selectedItems)
241
+ } else {
242
+ wSelectPickerconfirmData.value.push(e.selectedItems)
243
+ }
244
+ }
245
+
218
246
  //保存
219
247
  async function handleSubmit() {
220
- console.log(model.value)
248
+
249
+ form.value[0]
250
+ .validate()
251
+ .then(async ({ valid, errors }) => {
252
+ if (valid) {
253
+ toast.loading({
254
+ message: '保存中...',
255
+ duration: 0
256
+ })
257
+ const newModel = {}
258
+ pageConf.value.groups?.forEach((item: any) => {
259
+ item.fields?.forEach((subItem: any) => {
260
+ switch (subItem.extControlType) {
261
+ case 'relselect':
262
+ let t = wSelectPickerconfirmData.value.find((sItem: any) => {
263
+ return sItem.value === model.value[subItem.id]
264
+ })
265
+ newModel[subItem.id] = `${t.value}@R@${t.label}`
266
+ break
267
+ case 'datetime':
268
+ newModel[subItem.id] = model.value[subItem.id] ? dayjs(model.value[subItem.id]).format('YYYY-MM-DD HH:mm:ss') : ''
269
+ break
270
+ default:
271
+ newModel[subItem.id] = model.value[subItem.id]
272
+ }
273
+ })
274
+ });
275
+ console.log(newModel)
276
+ try {
277
+ const res = await addPageDataSave(sourceId.value, newModel)
278
+ if (res.data.status==='success'){
279
+ toast.success("保存成功")
280
+ uni.navigateBack()
281
+ }else{
282
+ toast.error(res.data.message||'保存失败"')
283
+ }
284
+
285
+ } catch (error) {
286
+ toast.error(error)
287
+ }
288
+
289
+
290
+ }
291
+ })
292
+ .catch((error) => {
293
+ console.log(error, 'error')
294
+ })
295
+
221
296
  }
222
297
 
223
298
  //选择数据
224
299
  function selectrow(item: any) {
225
- pointSourceId.value=item.pointSourceId
300
+ pointSourceId.value = item.pointSourceId
226
301
  showSelectRow.value = true
227
302
  }
228
303
 
package/w-card/w-card.vue CHANGED
@@ -125,15 +125,17 @@ function goto(type: string, item: any = {}, subItem: string = '') {
125
125
 
126
126
  </view>
127
127
  <template #footer>
128
- <wd-button size="small" class="btn" v-if="props.page.buttons.includes('detail')" @click="goto('detail')">
128
+ <view class="btns-box">
129
+ <wd-button size="small" class="btn" plain v-if="props.page.buttons.includes('detail')" @click="goto('detail')">
129
130
  详情
130
131
  </wd-button>
131
- <wd-button size="small" class="btn" v-if="props.page.buttons.includes('dtmplEdit')">
132
+ <wd-button size="small" class="btn" plain v-if="props.page.buttons.includes('dtmplEdit')">
132
133
  编辑
133
134
  </wd-button>
134
- <wd-button size="small" class="btn" type="error" v-if="props.page.buttons.includes('singleDelete')">
135
+ <wd-button size="small" class="btn" plain type="error" v-if="props.page.buttons.includes('singleDelete')">
135
136
  删除
136
137
  </wd-button>
138
+ </view>
137
139
  </template>
138
140
  </wd-card>
139
141
  </template>
@@ -203,4 +205,9 @@ function goto(type: string, item: any = {}, subItem: string = '') {
203
205
  .btn {
204
206
  margin-left: 10rpx;
205
207
  }
208
+ .btns-box{
209
+ display: flex;
210
+ justify-content: flex-end;
211
+ gap: 5px;
212
+ }
206
213
  </style>
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { onMounted, reactive, ref } from 'vue'
3
3
  import { useToast } from 'wot-design-uni'
4
- import { login, pubKey } from '../utils/apis/login'
4
+ import { login, pubKey, getUserConfig } from '../utils/apis/login'
5
5
  import WSwitchLang from '../w-switch-lang/w-switch-lang.vue'
6
6
 
7
7
  defineOptions({
@@ -50,9 +50,12 @@ function handleLogin() {
50
50
  }
51
51
  showSuccess('登录成功')
52
52
  uni.setStorageSync('token', data.token)
53
- uni.setStorageSync('userInfo', {
54
- usernamse:model.username
53
+ getUserConfig().then(({ data }: any) => {
54
+ uni.setStorageSync('userInfo', {
55
+ ...data.user
56
+ })
55
57
  })
58
+
56
59
  uni.reLaunch({
57
60
  url: '/pages/index/index',
58
61
  })
@@ -74,7 +77,7 @@ function handleSubmit() {
74
77
 
75
78
  <template>
76
79
  <view class="login">
77
- <WSwitchLang v-if="props.langSwitch"/>
80
+ <WSwitchLang v-if="props.langSwitch" />
78
81
  <view v-if="props.loginImge" class="avatar">
79
82
  <wd-img width="200rpx" height="200rpx" :src="props.loginImge">
80
83
  <template #error>
@@ -87,14 +90,10 @@ function handleSubmit() {
87
90
 
88
91
  <wd-form ref="form" :model="model">
89
92
  <wd-cell-group>
90
- <wd-input
91
- v-model="model.username" label="用户名" label-width="100px" prop="username" clearable
92
- placeholder="请输入用户名" :rules="[{ required: true, message: '请填写用户名' }]"
93
- />
94
- <wd-input
95
- v-model="model.password" label="密码" label-width="100px" prop="password" show-password
96
- clearable placeholder="请输入密码" :rules="[{ required: true, message: '请填写密码' }]"
97
- />
93
+ <wd-input v-model="model.username" label="用户名" label-width="100px" prop="username" clearable
94
+ placeholder="请输入用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
95
+ <wd-input v-model="model.password" label="密码" label-width="100px" prop="password" show-password clearable
96
+ placeholder="请输入密码" :rules="[{ required: true, message: '请填写密码' }]" />
98
97
  </wd-cell-group>
99
98
  <view class="footer">
100
99
  <wd-button type="primary" block @click="handleSubmit">
@@ -108,18 +107,20 @@ function handleSubmit() {
108
107
 
109
108
  <style scoped lang="scss">
110
109
  .login {
111
- background-color: #fff;
112
- .lang{
113
- display: flex;
114
- justify-content: flex-end;
115
- }
116
- .avatar {
117
- display: flex;
118
- justify-content: center;
119
- }
110
+ background-color: #fff;
120
111
 
121
- .footer {
122
- padding: 12px;
123
- }
112
+ .lang {
113
+ display: flex;
114
+ justify-content: flex-end;
115
+ }
116
+
117
+ .avatar {
118
+ display: flex;
119
+ justify-content: center;
120
+ }
121
+
122
+ .footer {
123
+ padding: 12px;
124
+ }
124
125
  }
125
126
  </style>
package/w-menu/w-menu.vue CHANGED
@@ -120,10 +120,10 @@ function queryList() {
120
120
 
121
121
  <template>
122
122
  <z-paging ref="paging" v-model="menuList" @query="queryList">
123
+ <template #top>
124
+
125
+ </template>
123
126
  <view>
124
- <view class="img_box">
125
- <!-- <wd-img height="250rpx" width="100%" src="../../static/bar.png" /> -->
126
- </view>
127
127
  <view v-if="filtermenu.length > 0">
128
128
  <wd-card v-for="(item, index) in filtermenu" :key="index" :title="item.title">
129
129
  <template #default>
@@ -147,6 +147,9 @@ function queryList() {
147
147
  <wd-action-sheet v-model="sheetShow" :actions="actions" :title="title"
148
148
  @select="({ item }) => { sheetGotoPage(item) }" />
149
149
  </view>
150
+ <template #bottom>
151
+
152
+ </template>
150
153
  </z-paging>
151
154
  </template>
152
155
 
@@ -91,7 +91,7 @@ import {
91
91
  getPageKey,
92
92
  pageConfig
93
93
  } from '../utils/apis/pageConfig'
94
- import { getCurrentInstance, onBeforeMount, ref, watch, nextTick, computed } from 'vue'
94
+ import { getCurrentInstance, onBeforeMount, ref, watch, nextTick, computed,defineEmits } from 'vue'
95
95
  import { useCell } from 'wot-design-uni/components/composables/useCell'
96
96
  import { getRect, isArray, isDef, isFunction, pause } from 'wot-design-uni/components/common/util'
97
97
  import { useParent } from 'wot-design-uni/components/composables/useParent'
@@ -282,8 +282,9 @@ async function setScrollIntoView() {
282
282
  function noop() { }
283
283
 
284
284
  function getSelectedItem(value: string | number | boolean) {
285
- const { valueKey, labelKey, columns } = props
286
285
 
286
+ const { valueKey, labelKey, columns } = props
287
+
287
288
  const selecteds = columns.filter((item) => {
288
289
  return item[valueKey] === value
289
290
  })
@@ -426,9 +427,10 @@ const showArrow = computed(() => {
426
427
 
427
428
  //根据配置获取数据
428
429
  const getlist = (data: any[] = []) => {
430
+ console.log('getlist',ltmplConfig.value)
429
431
  let formatData= data.map((item) => {
430
432
  return {
431
- value: item.fieldMap[ltmplConfig.value.primaryColumn.sourceId],
433
+ value: item.code,
432
434
  label: item.fieldMap[ltmplConfig.value.primaryColumn.sourceId]
433
435
  }
434
436
  })||[]
package/w-user/w-user.vue CHANGED
@@ -1,16 +1,24 @@
1
1
  <template>
2
2
  <view class="user">
3
- <view class="top">
3
+ <view class="top-box">
4
+ <view class="top">
4
5
  <view class="circle">
5
6
  <wd-icon name="user-circle" size="120rpx" color="#bababa"></wd-icon>
6
7
  </view>
7
8
  <view class="username">
8
9
  <view class="name">
9
- <text>{{ userInfo['用户名'] }}</text>
10
+ <text>{{ userInfo.name }}</text>
11
+ </view>
12
+ <view class="nickName">
13
+ <text>昵称:{{ userInfo.nickName }}</text>
10
14
  </view>
11
15
  </view>
12
16
  </view>
17
+ </view>
18
+
13
19
  <wd-cell-group>
20
+ <wd-cell title="个人信息" icon="user" v-if="userInfo.viewPersonalInfoable" :is-link="true" :clickable="true" @click="goUserInfo"/>
21
+ <!-- <wd-cell title="修改密码" icon="keywords" :is-link="true" :clickable="true" /> -->
14
22
  <wd-cell title="退出登录" icon="logout" :is-link="true" :clickable="true" @click="quit" />
15
23
  </wd-cell-group>
16
24
  <wd-message-box />
@@ -27,8 +35,12 @@ defineOptions({
27
35
  })
28
36
  const message = useMessage()
29
37
  const userInfo = ref({
30
- '用户名':uni.getStorageSync('userInfo').username || 'adminkk',
38
+ name:uni.getStorageSync('userInfo').name,
39
+ nickName:uni.getStorageSync('userInfo').nickName,
40
+ viewPersonalInfoable:uni.getStorageSync('userInfo').viewPersonalInfoable
31
41
  })
42
+
43
+ //退出登录
32
44
  const quit = () => {
33
45
  message
34
46
  .confirm({
@@ -46,6 +58,13 @@ const quit = () => {
46
58
  })
47
59
 
48
60
  }
61
+
62
+ //查看用户信息
63
+ const goUserInfo = () => {
64
+ uni.navigateTo({
65
+ url: `/pages/detail/detail?sourceId=${uni.getStorageSync('userInfo').gtmplSourceId}&code=${uni.getStorageSync('userInfo').id}`
66
+ })
67
+ }
49
68
  </script>
50
69
 
51
70
  <style scoped lang="scss">
@@ -53,14 +72,18 @@ const quit = () => {
53
72
  background-color: #f5f5f5;
54
73
  height: 100vh;
55
74
 
56
- .top {
75
+ .top-box{
76
+ // display: flex;
77
+ // justify-content: center;
78
+ // padding: 10px;
79
+ .top {
57
80
  display: flex;
58
81
  align-items: center;
59
82
  padding: 25rpx;
60
- background-color: #fff;
83
+ background-color: #4d80f0;
61
84
 
62
85
  .circle {
63
- background-color: #efefef;
86
+ background-color: #fcfcfccd;
64
87
  border-radius: 100%;
65
88
  margin-right: 20rpx;
66
89
  }
@@ -70,13 +93,20 @@ const quit = () => {
70
93
 
71
94
  .name {
72
95
  margin-bottom: 10rpx;
96
+ color: #fff;
73
97
  }
74
98
 
75
99
  .ic {
76
100
  font-size: 30rpx;
77
- color: #ccc;
101
+ color: #fff;
102
+ }
103
+ .nickName{
104
+ font-size: 12px;
105
+ color: #fff;
78
106
  }
79
107
  }
80
108
  }
109
+ }
110
+
81
111
  }
82
112
  </style>