w-ui-v1 1.1.33 → 1.1.35

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/index.ts CHANGED
@@ -17,6 +17,7 @@ import WReportTable from './w-report-table/w-report-table.vue'
17
17
  import WFormControlVue from './w-form-control/w-form-control.vue'
18
18
  import WScanBindingSensor from './w-scan-binding-sensor/w-scan-binding-sensor.vue'
19
19
  import WUpdateVersion from './w-update-version/w-update-version.vue'
20
+ import WTree from './w-tree/w-tree.vue'
20
21
  import {menu} from './utils/apis/menu'
21
22
  import request from './utils/http'
22
23
  import nfc from './utils/nfc'
@@ -41,7 +42,8 @@ const coms: any[] = [
41
42
  WReportTable,
42
43
  WFormControlVue,
43
44
  WScanBindingSensor,
44
- WUpdateVersion
45
+ WUpdateVersion,
46
+ WTree
45
47
  ]
46
48
  // 批量组件注册
47
49
  function install(Vue: App) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.1.33",
3
+ "version": "1.1.35",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -0,0 +1,20 @@
1
+ import request from '../http.js'
2
+ // 树列表页面详细配置
3
+ export function treeConfigApi(sourceId: string) {
4
+ return request({
5
+ url: `/v3/ttmpl/config?sourceId=${sourceId}`,
6
+ })
7
+ }
8
+
9
+ //树数据
10
+ export function treeDataApi(sourceId: string) {
11
+ return request({
12
+ url: `/v3/ttmpl/root-data?sourceId=${sourceId}`,
13
+ })
14
+ }
15
+ //树节点数据
16
+ export function treeNodeDataApi(sourceId: string,mainCode?:string) {
17
+ return request({
18
+ url: `/v3/ltmpl/top-data?sourceId=${sourceId}&mainCode=${mainCode}`,
19
+ })
20
+ }
@@ -70,7 +70,7 @@
70
70
  <wd-cell v-else-if="(subItem.controlType === 'textarea'&&subItem.extControlType==='relselectvalue')||subItem.extControlType === 'entity-select'" title-width="100px" :prop="subItem.id"
71
71
  :rules="[{ required: subItem.required, message: `${changeLanguageConmon('请选择')}${changeLanguageConmon(subItem.title)}` }]" :title="changeLanguageConmon(subItem.title)">
72
72
  <view style="text-align: left">
73
- <wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :disabled="subItem.disabled"
73
+ <wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :disabled="subItem.disabled"
74
74
  :type="'checkbox'"
75
75
  :placeholder="subItem.disabled ? changeLanguageConmon('无需输入') : `${changeLanguageConmon('请输入')}${changeLanguageConmon(subItem.title)}`" :source-id="subItem.sourceId" filterable
76
76
  @clear="clear" clearable />
@@ -79,7 +79,7 @@
79
79
  <wd-cell v-else-if="subItem.controlType === 'text'&&subItem.extControlType==='relselectvalue'" title-width="100px" :prop="subItem.id"
80
80
  :rules="[{ required: subItem.required, message: `${changeLanguageConmon('请选择')}${changeLanguageConmon(subItem.title)}` }]" :title="changeLanguageConmon(subItem.title)">
81
81
  <view style="text-align: left">
82
- <wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :disabled="subItem.disabled"
82
+ <wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :disabled="subItem.disabled"
83
83
  :type="'checkbox'"
84
84
  :placeholder="subItem.disabled ? changeLanguageConmon('无需输入') : `${changeLanguageConmon('请输入')}${changeLanguageConmon(subItem.title)}`" :source-id="subItem.sourceId" filterable
85
85
  @clear="clear" clearable />
@@ -88,7 +88,7 @@
88
88
  <wd-cell v-else-if="subItem.extControlType === 'relselect'" title-width="100px" :prop="subItem.id"
89
89
  :rules="[{ required: subItem.required, message: `${changeLanguageConmon('请选择')}${changeLanguageConmon(subItem.title)}` }]" :title="changeLanguageConmon(subItem.title)">
90
90
  <view style="text-align: left">
91
- <wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :disabled="subItem.disabled"
91
+ <wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :disabled="subItem.disabled"
92
92
  :max="subItem.max==='1'?1:0"
93
93
  :placeholder="subItem.disabled ? changeLanguageConmon('无需输入') : `${changeLanguageConmon('请输入')}${changeLanguageConmon(subItem.title)}`" :source-id="subItem.sourceId" filterable
94
94
  @clear="clear" clearable />
@@ -1,23 +1,19 @@
1
1
  <template>
2
2
  <view>
3
3
  <wd-message-box selector="wd-message-box-slot" custom-class="wd-message-box-slot">
4
- <wd-form ref="form" :model="model">
5
- <wFromControl :subItem="subItem" v-for="(subItem,subIndex) in page.formItem" :key="subIndex" :model="model" :Enumcolumn="Enumcolumn"
6
- v-model:model-value="model[subItem.id]" />
7
- </wd-form>
4
+ <view>
5
+ <wd-form ref="form" :model="model">
6
+ <wFromControl :subItem="subItem" v-for="(subItem,subIndex) in page.formItem" :key="subIndex" :model="model" :Enumcolumn="Enumcolumn"
7
+ v-model:model-value="model[subItem.id]" />
8
+ </wd-form>
9
+ </view>
10
+
8
11
  </wd-message-box>
9
12
  <wd-toast />
10
13
  </view>
11
14
  </template>
12
15
 
13
- <script lang="ts">
14
- //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
15
- export default {
16
- options: {
17
- styleIsolation: 'shared'//使css :deep()生效
18
- }
19
- }
20
- </script>
16
+
21
17
  <script setup lang="ts">
22
18
  import { changeLanguageConmon} from '../Locale'
23
19
  import wFromControl from '../w-form-control/w-form-control.vue'
@@ -119,7 +115,14 @@ defineExpose({
119
115
 
120
116
  <style scoped lang="scss">
121
117
  :deep(.wd-message-box-slot){
122
- width: 95vw !important;
118
+ width: 100vw !important;
119
+ }
120
+ :deep(.wd-popup--center){
121
+ height: calc(100vh - 44px);
122
+ bottom: 0;
123
+ transform: translate3d(-50%, 0, 0) !important;
124
+ top:unset !important;
125
+ border-radius: 0;
123
126
  }
124
127
  :deep( .wd-message-box-slot .wd-message-box__flex){
125
128
  justify-content: space-between !important;
package/w-menu/w-menu.vue CHANGED
@@ -1,31 +1,29 @@
1
- <script lang="ts">
2
- //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
3
- export default {
4
- options: {
5
- styleIsolation: 'shared'//使css :deep()生效
6
- }
7
- }
8
- </script>
1
+
9
2
  <script setup lang="ts">
10
3
  import { cloneDeep } from 'lodash-es'
11
4
  import {
12
5
  computed,
13
6
  onMounted,
14
7
  ref,
15
- defineProps
8
+ defineProps,
9
+ PropType
16
10
  } from 'vue'
17
11
  import { menu } from '../utils/apis/menu'
18
12
  import { changeLanguageConmon} from '../Locale'
19
13
  defineOptions({
20
14
  name: 'WMenu',
21
15
  })
16
+ interface Icon{
17
+ id:string
18
+ path:string
19
+ }
22
20
  const props = defineProps({
23
21
  icons: {
24
- type: Array,
25
- default: []
22
+ type: Array as PropType<Icon[]>,
23
+ default: ()=>[]
26
24
  },
27
25
  load:{
28
- type: Function,
26
+ type: Function as PropType<()=>void>,
29
27
  default: ()=>{}
30
28
  }
31
29
  })
@@ -45,14 +45,14 @@
45
45
  :min="min" :max="max" @change="handleChange">
46
46
  <view v-for="item in filterColumns" :key="item[valueKey]" :id="'check' + item[valueKey]">
47
47
  <wd-checkbox :modelValue="item[valueKey]" :disabled="item.disabled">
48
- <text v-if="filterable && filterVal" style="white-space: pre-wrap;width: 600rpx;display: inline-block;">
48
+ <text v-if="filterable && filterVal" style="white-space: pre-wrap;width: 500rpx;display: inline-block;">
49
49
  <block v-for="text in item[labelKey]" :key="text.label">
50
50
  <text v-if="text.type === 'active'"
51
51
  class="wd-select-picker__text-active" >{{ text.label }}</text>
52
52
  <text v-else >{{ text.label }}</text>
53
53
  </block>
54
54
  </text>
55
- <text v-else style="white-space: pre-wrap;width: 600rpx;display: inline-block;">
55
+ <text v-else style="white-space: pre-wrap;width: 500rpx;display: inline-block;">
56
56
  {{ item[labelKey] }}
57
57
  </text>
58
58
  </wd-checkbox>
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <wd-col-picker label="选择地址" v-model="value" :columns="columns" :column-change="columnChange" :display-format="displayFormat"
3
+ @confirm="handleConfirm"></wd-col-picker>
4
+ </template>
5
+
6
+ <script setup lang="ts">
7
+ import { ref, reactive, defineOptions, onMounted,defineProps } from 'vue'
8
+ import { treeConfigApi, treeDataApi,treeNodeDataApi } from '../utils/apis/tree'
9
+ import { pageConfig } from '../utils/apis/pageConfig'
10
+ defineOptions({
11
+ name: 'WTree',
12
+ })
13
+ const value = ref<string[]>([])
14
+ const sourceId = ref('')
15
+ const columns = ref<any[]>([])
16
+ const treeConfigs = reactive({
17
+ branchRatmplId: "",
18
+ branchTitle: "",
19
+ id: "",
20
+ rootGtmplId: '',
21
+ primaryColumnId: ""
22
+ })
23
+ // 定义 props 类型
24
+ interface Props {
25
+ sourceId: string
26
+ }
27
+
28
+ const props=defineProps<Props>()
29
+ onMounted(() => {
30
+ sourceId.value=props.sourceId
31
+ treeConfig1()
32
+ })
33
+
34
+ //获取配置1
35
+ const treeConfig1 = async () => {
36
+ try {
37
+ const res = await treeConfigApi(sourceId.value)
38
+ treeConfigs.branchRatmplId = res.data.ttmplConfig.branchRatmplId
39
+ treeConfigs.branchTitle = res.data.ttmplConfig.branchTitle
40
+ treeConfigs.id = res.data.ttmplConfig.id
41
+ treeConfigs.rootGtmplId = res.data.ttmplConfig.rootGtmplId
42
+ treeConfig2(treeConfigs.branchRatmplId)
43
+ } catch (error) {
44
+ //TODO handle the exception
45
+ }
46
+ }
47
+
48
+ //获取配置2
49
+ const treeConfig2 = async (sourceId : string) => {
50
+ try {
51
+ const res = await pageConfig(sourceId)
52
+ treeConfigs.primaryColumnId = res.data.ltmplConfig.primaryColumn.sourceId
53
+ getTreeData(treeConfigs.branchRatmplId)
54
+ } catch (error) {
55
+ //TODO handle the exception
56
+ }
57
+ }
58
+
59
+ //获取数据
60
+ const getTreeData = async (sourceId : string) => {
61
+ try {
62
+ const res = await treeDataApi(sourceId)
63
+
64
+ columns.value = [res.data.entities.map((item : any) => {
65
+ return {
66
+ value: item.code,
67
+ label: item.fieldMap[treeConfigs.primaryColumnId]
68
+ }
69
+ })]
70
+ } catch (error) {
71
+ //TODO handle the exception
72
+ }
73
+ }
74
+
75
+ const columnChange = async ({ selectedItem, resolve, finish }) => {
76
+ try {
77
+ const res = await treeNodeDataApi(treeConfigs.branchRatmplId, selectedItem.value)
78
+ if(res.data.entities&&res.data.entities.length){
79
+ resolve(
80
+ res.data.entities.map((item : any) => {
81
+ return {
82
+ value: item.code,
83
+ label: item.fieldMap[treeConfigs.primaryColumnId]
84
+ }
85
+ })
86
+ )
87
+ }else{
88
+ finish()
89
+ }
90
+
91
+ } catch (error) {
92
+ finish(false)
93
+ //TODO handle the exception
94
+ }
95
+
96
+ }
97
+
98
+ function handleConfirm({ value }) {
99
+ console.log(value)
100
+ }
101
+ // 格式化方法
102
+ const displayFormat = (selectedItems: Record<string, any>[]) => {
103
+ return selectedItems[selectedItems.length - 2].label + '/' + selectedItems[selectedItems.length - 1].label
104
+ }
105
+ </script>
106
+
107
+ <style>
108
+ </style>