widget.qw 0.0.1

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.
Files changed (115) hide show
  1. package/README.md +73 -0
  2. package/build/favicon.ico +0 -0
  3. package/build/style.css +763 -0
  4. package/build/widget.qw.es.js +20653 -0
  5. package/build/widget.qw.umd.js +20660 -0
  6. package/index.html +17 -0
  7. package/package.json +47 -0
  8. package/public/favicon.ico +0 -0
  9. package/src/App.vue +26 -0
  10. package/src/api/index.js +126 -0
  11. package/src/assets/avatar.png +0 -0
  12. package/src/assets/banner_handle.png +0 -0
  13. package/src/assets/bg_blue.png +0 -0
  14. package/src/assets/bg_white.png +0 -0
  15. package/src/assets/down.png +0 -0
  16. package/src/assets/home.jpg +0 -0
  17. package/src/assets/icon_box.png +0 -0
  18. package/src/assets/icon_dot.png +0 -0
  19. package/src/assets/icon_draw.png +0 -0
  20. package/src/assets/icon_file.png +0 -0
  21. package/src/assets/icon_fold.png +0 -0
  22. package/src/assets/icon_shield.png +0 -0
  23. package/src/assets/logo.png +0 -0
  24. package/src/components/AuditBar.vue +341 -0
  25. package/src/components/BillCard.vue +156 -0
  26. package/src/components/CheckGroup.vue +114 -0
  27. package/src/components/DatetimePicker/DatetimePop.vue +343 -0
  28. package/src/components/DatetimePicker/index.vue +113 -0
  29. package/src/components/DayDropdown.vue +57 -0
  30. package/src/components/FilePicker.vue +114 -0
  31. package/src/components/Input.vue +72 -0
  32. package/src/components/MonthDropdown.vue +52 -0
  33. package/src/components/MultiPicker.vue +124 -0
  34. package/src/components/ProjectDropdown.vue +62 -0
  35. package/src/components/ProjectPicker.vue +111 -0
  36. package/src/components/SecretNotify.js +6 -0
  37. package/src/components/Sheet.vue +93 -0
  38. package/src/components/SinglePicker.vue +103 -0
  39. package/src/components/SingleUserSelector.vue +425 -0
  40. package/src/components/Switch.vue +65 -0
  41. package/src/components/TreePicker.vue +113 -0
  42. package/src/components/UserPicker.vue +107 -0
  43. package/src/components/UserProfile.vue +128 -0
  44. package/src/components/UsersPicker.vue +118 -0
  45. package/src/components/YearDropdown.vue +60 -0
  46. package/src/components/data_selector.vue +281 -0
  47. package/src/components/image_picker.vue +115 -0
  48. package/src/components/images_picker.vue +140 -0
  49. package/src/components/index.js +157 -0
  50. package/src/components/mult_list_selector.vue +156 -0
  51. package/src/components/product_selector.vue +186 -0
  52. package/src/components/subdepartment_selector.vue +481 -0
  53. package/src/components/user_selector.vue +639 -0
  54. package/src/components/widget/DataPop.vue +96 -0
  55. package/src/components/widget/TreePop.vue +89 -0
  56. package/src/components/widget/UserPop.vue +347 -0
  57. package/src/env.d.ts +8 -0
  58. package/src/main.js +111 -0
  59. package/src/router/index.ts +165 -0
  60. package/src/util/array_util.js +32 -0
  61. package/src/util/auth_util.js +73 -0
  62. package/src/util/bool_util.js +6 -0
  63. package/src/util/bus.js +2 -0
  64. package/src/util/cache_util.js +19 -0
  65. package/src/util/errer_code.js +7 -0
  66. package/src/util/eval_util.js +20 -0
  67. package/src/util/icon_util.js +37 -0
  68. package/src/util/image_util.js +28 -0
  69. package/src/util/index.js +56 -0
  70. package/src/util/num_util.js +71 -0
  71. package/src/util/obj_util.js +29 -0
  72. package/src/util/request.js +74 -0
  73. package/src/util/request_json.js +72 -0
  74. package/src/util/request_json_mute.js +66 -0
  75. package/src/util/request_upload.js +79 -0
  76. package/src/util/route_util.js +32 -0
  77. package/src/util/str_util.js +144 -0
  78. package/src/util/time_util.js +407 -0
  79. package/src/util/toast_util.js +25 -0
  80. package/src/util/tree_util.js +120 -0
  81. package/src/util/validate.js +183 -0
  82. package/src/util/vue_filter.js +223 -0
  83. package/src/views/auditbar/index.vue +66 -0
  84. package/src/views/billcard/index.vue +46 -0
  85. package/src/views/checkgroup/index.vue +36 -0
  86. package/src/views/dataSelector/index.vue +49 -0
  87. package/src/views/datetimepicker/index.vue +35 -0
  88. package/src/views/daydropdown/index.vue +31 -0
  89. package/src/views/filepicker/index.vue +32 -0
  90. package/src/views/home/index.vue +64 -0
  91. package/src/views/imagepicker/index.vue +32 -0
  92. package/src/views/imagespicker/index.vue +32 -0
  93. package/src/views/input/index.vue +35 -0
  94. package/src/views/monthdropdown/index.vue +31 -0
  95. package/src/views/multListSelector/index.vue +61 -0
  96. package/src/views/multipicker/index.vue +37 -0
  97. package/src/views/productSelector/index.vue +35 -0
  98. package/src/views/projectdropdown/index.vue +31 -0
  99. package/src/views/projectpicker/index.vue +42 -0
  100. package/src/views/secretnotify/index.vue +28 -0
  101. package/src/views/sheet/index.vue +46 -0
  102. package/src/views/singlepicker/index.vue +36 -0
  103. package/src/views/subdepartmentSelector/index.vue +41 -0
  104. package/src/views/switch/index.vue +35 -0
  105. package/src/views/treepicker/index.vue +42 -0
  106. package/src/views/userSelector/index.vue +54 -0
  107. package/src/views/userSelectorNew/index.vue +45 -0
  108. package/src/views/userpicker/index.vue +43 -0
  109. package/src/views/userprofile/index.vue +30 -0
  110. package/src/views/userspicker/index.vue +43 -0
  111. package/src/views/yeardropdown/index.vue +32 -0
  112. package/src/vm/index.js +6 -0
  113. package/tsconfig.json +19 -0
  114. package/tsconfig.node.json +8 -0
  115. package/vite.config.ts +73 -0
@@ -0,0 +1,156 @@
1
+ <template>
2
+ <!-- Tips section with corrected syntax -->
3
+ <div class="confirmation-tips" v-if="tips && tips.length > 0">
4
+ <van-icon name="info" color="#1989fa" />
5
+ <span>{{ tips }}</span>
6
+ </div>
7
+
8
+ <van-checkbox-group
9
+ :model-value="modelValue"
10
+ @update:model-value="$emit('update:modelValue', $event)"
11
+ class="confirmation-group"
12
+ :required="required"
13
+ :disabled="props.disabled"
14
+ :rules="rules"
15
+ >
16
+ <div class="confirmation-item" v-for="item in options" :key="item.value">
17
+ <van-checkbox
18
+ :name="item.value"
19
+ shape="square"
20
+ icon-size="18px"
21
+ class="custom-checkbox"
22
+ >
23
+ <span class="option-text">{{ item.label }}</span>
24
+ </van-checkbox>
25
+ </div>
26
+ </van-checkbox-group>
27
+ </template>
28
+
29
+ <script setup>
30
+ import { ref, watch, nextTick } from 'vue';
31
+ const props = defineProps({
32
+ options: {
33
+ type: Array,
34
+ required: true
35
+ },
36
+ modelValue: {
37
+ type: Array,
38
+ default: () => []
39
+ },
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ required: {
45
+ type: Boolean,
46
+ default: true
47
+ },
48
+ tips: {
49
+ type: String,
50
+ default: ''
51
+ },
52
+ rules : {
53
+ type: Array,
54
+ default: () => []
55
+ }
56
+ });
57
+
58
+ defineEmits(['update:modelValue']);
59
+
60
+ // watch(() => props.disabled, (newVal) => {
61
+ // console.log('disabled状态变化:', newVal);
62
+ // // 强制更新复选框状态
63
+ // nextTick(() => {
64
+ // const checkboxes = document.querySelectorAll('.van-checkbox');
65
+ // checkboxes.forEach(checkbox => {
66
+ // checkbox.style.pointerEvents = newVal ? 'none' : 'auto';
67
+ // checkbox.style.opacity = newVal ? '0.6' : '1';
68
+ // });
69
+ // });
70
+ // });
71
+ </script>
72
+
73
+ <style scoped>
74
+ /* // 修改 confirmation-group 和 confirmation-item 的样式 */
75
+ .confirmation-group {
76
+ padding: 0 16px;
77
+ --van-checkbox-disabled-icon-color: black;
78
+ }
79
+
80
+ .confirmation-item {
81
+ padding: 12px 16px;
82
+ margin: 0 -16px;
83
+ border-bottom: 1px solid #f5f5f5;
84
+ /* 禁用状态样式 */
85
+
86
+ }
87
+
88
+ /* // 在下方添加媒体查询适配小屏幕 */
89
+ @media (max-width: 320px) {
90
+ .confirmation-item {
91
+ padding: 12px 8px;
92
+ margin: 0 -8px;
93
+ }
94
+ }
95
+
96
+ .confirmation-item:last-child {
97
+ border-bottom: none;
98
+ }
99
+
100
+ /* 新增样式 */
101
+ .confirmation-tips {
102
+ padding: 12px 16px;
103
+ background: #f0faff;
104
+ border-radius: 8px;
105
+ margin: 10px 16px;
106
+ display: flex;
107
+ align-items: center;
108
+ color: #1989fa;
109
+ font-size: 13px;
110
+ border: 1px solid #d9efff;
111
+ }
112
+
113
+ .confirmation-tips .van-icon {
114
+ margin-right: 8px;
115
+ }
116
+
117
+ /* 新增字体继承样式 */
118
+ .confirmation-group {
119
+ font-size: inherit; /* 继承父级字体大小 */
120
+ }
121
+
122
+ .option-text {
123
+ font-size: 14px; /* 明确指定字体大小 */
124
+ line-height: 1.5; /* 保持行高一致 */
125
+ /* color:black; */
126
+ }
127
+
128
+ /* 适配移动端的字体调整 */
129
+ @media (max-width: 375px) {
130
+ .option-text {
131
+ font-size: 13px;
132
+ }
133
+ }
134
+
135
+ /* 新增禁用状态样式 */
136
+ .custom-checkbox:disabled :deep(.--van-checkbox__icon) {
137
+ background-color: #f5f5f5;
138
+ border-color: #ebedf0;
139
+ transition: all 0.3s;
140
+ }
141
+
142
+ .custom-checkbox:disabled :deep(.van-checkbox__icon--checked) {
143
+ background-color: #1989fa;
144
+ border-color: #1989fa;
145
+ opacity: 0.7;
146
+ }
147
+
148
+ .van-checkbox--disabled :deep(.option-text) {
149
+ color: #969799;
150
+ }
151
+
152
+ .van-checkbox--disabled.van-checkbox--checked :deep(.option-text) {
153
+ color: #1989fa;
154
+ opacity: 0.8;
155
+ }
156
+ </style>
@@ -0,0 +1,186 @@
1
+ <template>
2
+ <div class="project-selector">
3
+ <!-- 产品名称选择 -->
4
+ <data-selector v-model="selectedProjectCode" label="产品名称" placeholder="请选择产品" mode="single"
5
+ :options="productOptions" @update:modelValue="handleProjectChange" class="selector-field"
6
+ :required="props.required" :rules="props.rules" :readonly="props.readonly" />
7
+
8
+ <!-- 产品编号显示 -->
9
+ <van-field v-model="projectCode" label="产品编号" placeholder="系统自动填入" readonly class="readonly-field"
10
+ :required="props.required" />
11
+ </div>
12
+ </template>
13
+
14
+ <script setup>
15
+ import { ref, onMounted, watch, nextTick } from 'vue'
16
+ import util from '../util'
17
+ import dataSelector from './data_selector.vue'
18
+
19
+ // 缓存定义在组件内部(模块作用域)
20
+ const productListCache = {
21
+ data: ref([]),
22
+ loading: ref(false),
23
+ error: ref(null)
24
+ }
25
+
26
+ const props = defineProps({
27
+ modelValue: {
28
+ type: Object,
29
+ default: () => ({
30
+ productName: '',
31
+ productCode: ''
32
+ })
33
+ },
34
+ required: {
35
+ type: Boolean,
36
+ default: true
37
+ },
38
+ readonly: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ rules: {
43
+ type: Array,
44
+ default: () => []
45
+ }
46
+ })
47
+
48
+ const emit = defineEmits(['update:modelValue'])
49
+
50
+ // 响应式数据
51
+ const productOptions = ref([])
52
+ const selectedProjectCode = ref('')
53
+ const projectCode = ref('')
54
+
55
+ // 获取产品列表
56
+ // const fetchProducts = async () => {
57
+ // try {
58
+ // const params = {
59
+ // limit: 99999,
60
+ // page: 0
61
+ // }
62
+ // const response = await ApiUtil.project_list(params)
63
+
64
+ // console.log('获取产品列表成功:', response)
65
+
66
+ // if (response.code === 200) {
67
+ // productOptions.value = response.data.list.map(item => ({
68
+ // text: item.name,
69
+ // value: item.projectCode
70
+ // }))
71
+ // }
72
+ // } catch (error) {
73
+ // console.error('获取产品列表失败:', error)
74
+ // }
75
+ // }
76
+
77
+ // 修改后的获取产品列表方法
78
+ const fetchProducts = async () => {
79
+ try {
80
+ if (productListCache.data.value.length > 0) return
81
+ if (productListCache.loading.value) return
82
+
83
+ productListCache.loading.value = true
84
+ const response = await util.project_list({ limit: 999, page: 0 })
85
+
86
+ if (response.code === 200) {
87
+ productListCache.data.value = response.data.list.map(item => ({
88
+ text: item.name,
89
+ value: item.projectCode
90
+ }))
91
+ }
92
+ } catch (error) {
93
+ productListCache.error.value = error
94
+ console.error('获取产品列表失败:', error)
95
+ } finally {
96
+ productListCache.loading.value = false
97
+ }
98
+ }
99
+
100
+
101
+ // 处理产品选择变化
102
+ const handleProjectChange = (value) => {
103
+ const selectedProduct = productOptions.value.find(item => item.value === value)
104
+ if (selectedProduct) {
105
+ emit('update:modelValue', {
106
+ productName: selectedProduct.text,
107
+ productCode: value
108
+ })
109
+ projectCode.value = value
110
+ }
111
+ }
112
+
113
+ // 添加modelValue监听
114
+ // 修改后的watch监听
115
+ watch(() => props.modelValue, (newVal) => {
116
+ // 当productOptions加载完成后再更新选中状态
117
+ if (productOptions.value.length > 0 && newVal.productCode !== selectedProjectCode.value) {
118
+ selectedProjectCode.value = newVal.productCode
119
+ projectCode.value = newVal.productCode
120
+ }
121
+ }, { deep: true, immediate: true })
122
+
123
+ // 新增对productOptions的监听
124
+ watch(productOptions, (newOptions) => {
125
+ // 当选项列表更新后检查外部传入的值是否有效
126
+ if (props.modelValue.productCode && newOptions.length > 0) {
127
+ const exists = newOptions.some(opt => opt.value === props.modelValue.productCode)
128
+ if (exists) {
129
+ selectedProjectCode.value = props.modelValue.productCode
130
+ projectCode.value = props.modelValue.productCode
131
+ }
132
+ }
133
+ })
134
+
135
+ // 修改后的挂载逻辑
136
+ onMounted(async () => {
137
+ if (productListCache.data.value.length === 0) {
138
+ await fetchProducts()
139
+ // 确保赋值操作在数据加载后
140
+ productOptions.value = [...productListCache.data.value]
141
+ } else {
142
+ productOptions.value = [...productListCache.data.value]
143
+ }
144
+
145
+ // 延迟执行确保选项已渲染
146
+ nextTick(() => {
147
+ if (props.modelValue.productCode) {
148
+ selectedProjectCode.value = props.modelValue.productCode
149
+ projectCode.value = props.modelValue.productCode
150
+ }
151
+ })
152
+ })
153
+ </script>
154
+
155
+ <style scoped>
156
+ .project-selector {
157
+ :deep(.van-cell) {
158
+ align-items: center;
159
+ }
160
+
161
+ :deep(.van-field__label) {
162
+ width: 90px;
163
+ flex: none;
164
+ }
165
+
166
+ .readonly-field {
167
+ :deep(.van-field__control) {
168
+ color: #323233;
169
+ /* 修改文字颜色与普通字段一致 */
170
+ padding-right: 16px;
171
+ }
172
+
173
+ /* 添加必填星号对齐 */
174
+ &.van-field--required {
175
+ :deep(.van-field__label::before) {
176
+ margin-right: 4px;
177
+ }
178
+ }
179
+ }
180
+
181
+ /* 统一字段间距 */
182
+ .readonly-field {
183
+ margin: 4px 0;
184
+ }
185
+ }
186
+ </style>