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,113 @@
1
+ <template>
2
+ <van-field v-if="!isGone"
3
+ :label="props.label" :required="isRequired" :rules="props.rules" :disabled="isDisabled"
4
+ :placeholder="props.placeholder" :is-link="isReadonly ? false : true" @click="data.isShowPop = !isReadonly"
5
+ label-class="label">
6
+ <template #input>
7
+ <div class="select-list">
8
+ <van-tag class="select-item" :closeable="!isDisabled" type="primary" plain v-for="(item, i) in selectOptions"
9
+ :key="item" @close.stop="onDelete(item)">
10
+ {{ item.text }}
11
+ </van-tag>
12
+ </div>
13
+ </template>
14
+ </van-field>
15
+
16
+ <TreePop v-model:show="data.isShowPop"
17
+ v-model="modelValue"
18
+ :options="data.options" />
19
+
20
+ </template>
21
+ <script setup>
22
+ import { reactive, onMounted, watch, computed } from "vue";
23
+ import util from "../util"
24
+ import { useVModel } from '@vueuse/core'
25
+ import TreePop from './widget/TreePop.vue'
26
+
27
+ const props = defineProps({
28
+ modelValue: {
29
+ type: Array,
30
+ default: [],
31
+ },
32
+ label: {
33
+ type: String,
34
+ default: "",
35
+ },
36
+ placeholder: {
37
+ type: String,
38
+ default: "请选择",
39
+ },
40
+ id: {
41
+ type: String,
42
+ default: "",
43
+ },
44
+ required: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ readonly: {
49
+ type: Boolean,
50
+ default: false,
51
+ },
52
+ rules: {
53
+ type: Array,
54
+ default: () => [],
55
+ },
56
+ auth: {
57
+ type: String,
58
+ default: "",
59
+ },
60
+ });
61
+
62
+ // 弹出层
63
+ const data = reactive({
64
+ isShowPop: false,
65
+ options: []
66
+ })
67
+
68
+ const selectOptions = computed(()=>{
69
+ return util.ids2nodes(modelValue.value, data.options)
70
+ })
71
+
72
+ // 定义emit
73
+ const emit = defineEmits(["update:modelValue","select"]);
74
+ const modelValue = useVModel(props, 'modelValue', emit)
75
+ const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props);
76
+
77
+ onMounted(async () => {
78
+ await query()
79
+ })
80
+
81
+ const query = async () => {
82
+ let params = {
83
+ id: props.id,
84
+ }
85
+ const res = await util.dictionary_dict(params)
86
+ console.log(res.data)
87
+
88
+ if (!res.data.parseValue) {
89
+ data.options = []
90
+ return
91
+ }
92
+
93
+ data.options = res.data.parseValue
94
+ }
95
+
96
+ const onDelete=(option)=>{
97
+ modelValue.value = (modelValue.value || []).filter(item=>{
98
+ return item != option.id
99
+ })
100
+ }
101
+
102
+ watch(() => modelValue.value, async(n, o) => {
103
+ emit('select', selectOptions.value)
104
+ }, {
105
+ immediate: true
106
+ })
107
+ </script>
108
+
109
+ <style scoped>
110
+ .select-item{
111
+ margin:3px;
112
+ }
113
+ </style>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <van-field v-if="!isGone" :label="props.label" :required="isRequired" :rules="props.rules" :disabled="isDisabled"
3
+ :placeholder="props.placeholder" :is-link="isReadonly ? false : true" @click="data.isShowPop = !isReadonly"
4
+ label-class="label">
5
+ <template #input>
6
+ <van-tag class="user" v-if="modelValue" :closeable="!isDisabled" type="primary" plain
7
+ @close.stop="onDelete">
8
+ {{ data.user.name }}
9
+ </van-tag>
10
+ </template>
11
+ </van-field>
12
+
13
+ <UserPop v-model:show="data.isShowPop" :rootDeptId="props.rootDeptId" :deptRangeId="props.deptRangeId"
14
+ @select="onSelectUser" />
15
+
16
+ </template>
17
+ <script setup>
18
+ import { reactive, onMounted, watch } from "vue";
19
+ import util from "../util"
20
+ import { useVModel } from '@vueuse/core'
21
+ import UserPop from './widget/UserPop.vue'
22
+
23
+ const props = defineProps({
24
+ modelValue: {
25
+ type: String,
26
+ default: '',
27
+ },
28
+ label: {
29
+ type: String,
30
+ default: "选择人员",
31
+ },
32
+ placeholder: {
33
+ type: String,
34
+ default: "请选择人员",
35
+ },
36
+ required: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ readonly: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+ rules: {
45
+ type: Array,
46
+ default: [],
47
+ },
48
+ // 默认查询所有组织机构
49
+ rootDeptId: {
50
+ type: String,
51
+ default: "1", //组织机构id
52
+ },
53
+ // 二级部门取值范围字典id
54
+ // 取dictionary库.dict的配置id
55
+ deptRangeId: {
56
+ type: String,
57
+ default: ''
58
+ },
59
+ auth: {
60
+ type: String,
61
+ default: "",
62
+ },
63
+ });
64
+
65
+ // 弹出层
66
+ const data = reactive({
67
+ isShowPop: false,
68
+ user: {}
69
+ })
70
+
71
+ // 定义emit
72
+ const emit = defineEmits(["update:modelValue", "select"]);
73
+ const modelValue = useVModel(props, 'modelValue', emit)
74
+ const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props);
75
+
76
+ //首页加载
77
+ onMounted(() => {
78
+ })
79
+
80
+ const onSelectUser = (userId) => {
81
+ modelValue.value = userId
82
+ }
83
+
84
+ const onDelete=()=>{
85
+ data.user={}
86
+ modelValue.value = null
87
+ }
88
+
89
+ watch(() => modelValue.value, async (n, o) => {
90
+ if (!n) {
91
+ data.user = {}
92
+ return
93
+ }
94
+
95
+ let res = await util.get_wxuser_by_id({ userId: n })
96
+ data.user = res.data
97
+ emit('select', data.user)
98
+ }, {
99
+ immediate: true
100
+ })
101
+ </script>
102
+
103
+ <style scoped>
104
+ .user{
105
+ padding:4px 8px;
106
+ }
107
+ </style>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div class="widget">
3
+ <van-image round width="80px" height="80px" :src="data.userInfo?.wxUser?.avatar" class="user-avatar" />
4
+ <div class="user-info">
5
+ <span class="user-info-item">{{ data.userInfo?.wxUser?.userid }}</span>
6
+ <span class="user-info-item">{{ data.userInfo?.wxUser?.name }}</span>
7
+ <span class="user-info-item">{{ data.userInfo?.wxUser?.position }}</span>
8
+ <span class="user-info-item">{{ data.userInfo?.wxUser?.mobile }}</span>
9
+ </div>
10
+ <div class="user-jobs">
11
+ <span class="job-item" v-for="(item, i) in deptPaths" :key="i">{{ item.name }}</span>
12
+ </div>
13
+
14
+ <van-button block class="logout-button" @click="onLogout">
15
+ 注销
16
+ </van-button>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup>
21
+ import { reactive, onMounted, watch, defineEmits, computed } from "vue";
22
+ import util from "../util"
23
+
24
+ const data = reactive({
25
+ userInfo: {}
26
+ })
27
+ const emit = defineEmits(['logout'])
28
+
29
+ const deptPaths = computed(() => {
30
+ //过滤掉公司
31
+ if (data.userInfo && data.userInfo.departments && data.userInfo.departments.length>1)
32
+ return data.userInfo.departments.filter(item => item.id != '1')
33
+
34
+ // 外部访客,返回公司名
35
+ if(data.userInfo && data.userInfo.wxUser)
36
+ return [{name: data.userInfo.wxUser.corp}]
37
+
38
+ return []
39
+ })
40
+
41
+ const onLogout = () => {
42
+ emit('logout')
43
+ }
44
+
45
+ const getUserInfo = async () => {
46
+ let res = await util.auth_get_user_info()
47
+ data.userInfo = res.data
48
+ }
49
+
50
+ onMounted(() => {
51
+ getUserInfo()
52
+ })
53
+ </script>
54
+
55
+ <style scoped>
56
+ .widget {
57
+ position: relative;
58
+ display: flex;
59
+ flex-direction: column;
60
+ align-items: center;
61
+ justify-content: space-around;
62
+ padding: 20px;
63
+ background: linear-gradient(to right, #4a90e2, #87ceeb);
64
+ border-radius: 10px;
65
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
66
+
67
+ .user-avatar {
68
+ margin-bottom: 15px;
69
+ }
70
+
71
+ .user-info {
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: space-around;
75
+ margin-bottom: 15px;
76
+
77
+ .user-info-item {
78
+ font-size: 16px;
79
+ line-height: 22px;
80
+ color: #fff;
81
+ text-align: center;
82
+ padding: 0 3px;
83
+ }
84
+ }
85
+
86
+ .space {
87
+ min-height: 10px;
88
+ flex: 1;
89
+ }
90
+
91
+ /* 添加退出按钮样式 */
92
+ .logout-button {
93
+ width: 70px;
94
+ height: 30px;
95
+ position: absolute;
96
+ top: 20px;
97
+ right: 20px;
98
+ background-color: rgba(255, 255, 255, 0.2);
99
+ color: white;
100
+ border: none;
101
+ border-radius: 15px;
102
+ padding: 5px 15px;
103
+ cursor: pointer;
104
+ font-size: 14px;
105
+ transition: background-color 0.3s;
106
+ }
107
+
108
+ .logout-button:hover {
109
+ background-color: rgba(255, 255, 255, 0.4);
110
+ }
111
+
112
+ .user-jobs {
113
+ display: flex;
114
+ justify-content: center;
115
+ gap: 15px;
116
+ width: 100%;
117
+ max-width: 300px;
118
+
119
+ .job-item {
120
+ padding: 5px 10px;
121
+ background-color: rgba(255, 255, 255, 0.2);
122
+ border-radius: 20px;
123
+ font-size: 12px;
124
+ color: #fff;
125
+ }
126
+ }
127
+ }
128
+ </style>
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <van-field v-if="!isGone"
3
+ :label="props.label" :required="isRequired" :rules="props.rules" :disabled="isDisabled"
4
+ :placeholder="props.placeholder" :is-link="isReadonly ? false : true" @click="data.isShowPop = !isReadonly"
5
+ label-class="label">
6
+ <template #input>
7
+ <div class="user-list">
8
+ <van-tag class="user-item" :closeable="!isDisabled" type="primary" plain v-for="(item, i) in data.users"
9
+ :key="item" @close.stop="onDelete(item)">
10
+ {{ item.name }}
11
+ </van-tag>
12
+ </div>
13
+ </template>
14
+ </van-field>
15
+
16
+ <UserPop v-model:show="data.isShowPop"
17
+ :rootDeptId="props.rootDeptId"
18
+ :deptRangeId="props.deptRangeId"
19
+ @select="onSelectUser" />
20
+
21
+ </template>
22
+ <script setup>
23
+ import { reactive, onMounted, watch } from "vue";
24
+ import util from "../util"
25
+ import { useVModel } from '@vueuse/core'
26
+ import UserPop from './widget/UserPop.vue'
27
+
28
+ const props = defineProps({
29
+ modelValue: {
30
+ type: Array,
31
+ default: [],
32
+ },
33
+ label: {
34
+ type: String,
35
+ default: "选择人员",
36
+ },
37
+ placeholder: {
38
+ type: String,
39
+ default: "请选择人员",
40
+ },
41
+ required: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ readonly: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ rules: {
50
+ type: Array,
51
+ default: () => [],
52
+ },
53
+ // 默认查询所有组织机构
54
+ rootDeptId: {
55
+ type: String,
56
+ default: "1", //组织机构id
57
+ },
58
+ // 二级部门取值范围字典id
59
+ // 取dictionary库.dict的配置id
60
+ deptRangeId: {
61
+ type: String,
62
+ default: ''
63
+ },
64
+ auth: {
65
+ type: String,
66
+ default: "",
67
+ },
68
+ });
69
+
70
+ // 弹出层
71
+ const data = reactive({
72
+ isShowPop: false,
73
+ users: []
74
+ })
75
+
76
+ // 定义emit
77
+ const emit = defineEmits(["update:modelValue", "select"]);
78
+ const modelValue = useVModel(props, 'modelValue', emit)
79
+ const { isRequired, isReadonly, isGone, isDisabled } = util.props2auth(props);
80
+
81
+ //首页加载
82
+ onMounted(() => {
83
+ })
84
+
85
+ const onSelectUser = (userId) => {
86
+ let newAry = [...(modelValue.value || []), userId]
87
+ modelValue.value = util.uniq(newAry)
88
+ }
89
+
90
+ const onDelete=(user)=>{
91
+ modelValue.value = (modelValue.value || []).filter(item=>{
92
+ return item != user.userid
93
+ })
94
+ }
95
+
96
+ watch(() => modelValue.value, async(n, o) => {
97
+ if(!modelValue.value || modelValue.value.length<1){
98
+ data.users = []
99
+ return
100
+ }
101
+
102
+ let ary = []
103
+ for(var i=0;i<modelValue.value.length;i++){
104
+ let res = await util.get_wxuser_by_id({userId:modelValue.value[i]})
105
+ ary.push(res.data)
106
+ }
107
+ data.users = ary
108
+ emit('select', data.users)
109
+ }, {
110
+ immediate: true
111
+ })
112
+ </script>
113
+
114
+ <style scoped>
115
+ .user-item{
116
+ margin:3px;
117
+ }
118
+ </style>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <van-dropdown-item v-model="modelValue" :options="data.yearOptions" />
3
+ </template>
4
+ <script setup>
5
+ import { reactive, onMounted, watch } from "vue";
6
+ import util from "../util"
7
+ import { useVModel } from '@vueuse/core'
8
+
9
+ const props = defineProps({
10
+ modelValue: {
11
+ type: Number,
12
+ default: 0,
13
+ },
14
+ startYear: {
15
+ type: Number,
16
+ default: 2000,
17
+ },
18
+ endYear: {
19
+ type: Number,
20
+ default: new Date().getFullYear(),
21
+ },
22
+ label: {
23
+ type: String,
24
+ default: "选择年份",
25
+ },
26
+ placeholder: {
27
+ type: String,
28
+ default: "请选择年份",
29
+ },
30
+ });
31
+
32
+ // 弹出层
33
+ const data = reactive({
34
+ yearOptions: []
35
+ })
36
+
37
+ // 定义emit
38
+ const emit = defineEmits(["update:modelValue"]);
39
+ const modelValue = useVModel(props, 'modelValue', emit)
40
+
41
+ const setupYearOptions = () => {
42
+ data.yearOptions.push({
43
+ text: '年',
44
+ value: 0
45
+ })
46
+ for (var i = props.endYear; i >= props.startYear; i--) {
47
+ data.yearOptions.push({
48
+ text: i,
49
+ value: i,
50
+ });
51
+ }
52
+ };
53
+
54
+ //首页加载
55
+ onMounted(() => {
56
+ setupYearOptions()
57
+ })
58
+ </script>
59
+
60
+ <style scoped></style>