shijiplus-web-plugin 0.1.11 → 0.1.12

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 (27) hide show
  1. package/package.json +8 -4
  2. package/src/App.vue +3 -1
  3. package/src/components/plus-comp/index.js +15 -0
  4. package/src/components/plus-comp/permission-component/permission-component.vue +78 -0
  5. package/src/components/plus-comp/plus-card/plus-card.vue +21 -0
  6. package/src/components/plus-comp/plus-city-cascader/plus-city-cascader.vue +108 -0
  7. package/src/components/plus-comp/plus-common-header/plus-common-header.vue +58 -0
  8. package/src/components/plus-comp/plus-count-down/plus-count-down.vue +51 -0
  9. package/src/components/plus-comp/plus-drawer/plus-drawer.vue +116 -0
  10. package/src/components/plus-comp/plus-form/plus-form.vue +149 -0
  11. package/src/components/plus-comp/plus-icon/plus-icon.vue +91 -0
  12. package/src/components/plus-comp/plus-modal/plus-modal.vue +281 -0
  13. package/src/components/plus-comp/plus-poptip/plus-poptip.vue +42 -0
  14. package/src/components/plus-comp/plus-qr-code/plus-qr-code.vue +110 -0
  15. package/src/components/plus-comp/plus-remote-selector/plus-remote-selector.vue +126 -0
  16. package/src/components/plus-comp/plus-scrollview/plus-scrollview.vue +58 -0
  17. package/src/components/plus-comp/plus-select/plus-select.vue +118 -0
  18. package/src/components/plus-comp/plus-table/export-mixin.js +78 -0
  19. package/src/components/plus-comp/plus-table/plus-circle-progress-modal.vue +54 -0
  20. package/src/components/plus-comp/plus-table/plus-table.vue +568 -0
  21. package/src/components/plus-comp/plus-tabs/plus-tabs.vue +76 -0
  22. package/src/directive/index.js +2 -0
  23. package/src/directive/module/authAccess.js +2 -2
  24. package/src/extentionPlugin/string.js +30 -1
  25. package/src/libs/excel.js +203 -0
  26. package/src/libs/util.js +184 -0
  27. package/src/main.js +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shijiplus-web-plugin",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "files": [
5
5
  "src"
6
6
  ],
@@ -15,7 +15,10 @@
15
15
  "lint": "vue-cli-service lint"
16
16
  },
17
17
  "dependencies": {
18
- "iview": "^3.5.4"
18
+ "html2canvas": "^1.4.1",
19
+ "iview": "^3.5.4",
20
+ "qrcodejs2": "0.0.2",
21
+ "xlsx": "^0.13.3"
19
22
  },
20
23
  "devDependencies": {
21
24
  "vue": "^2.6.14",
@@ -46,7 +49,8 @@
46
49
  },
47
50
  "rules": {
48
51
  "no-unused-vars": "off",
49
- "no-prototype-builtins": "off"
52
+ "no-prototype-builtins": "off",
53
+ "vue/no-mutating-props": "off"
50
54
  }
51
55
  },
52
56
  "browserslist": [
@@ -54,4 +58,4 @@
54
58
  "last 2 versions",
55
59
  "not dead"
56
60
  ]
57
- }
61
+ }
package/src/App.vue CHANGED
@@ -1,14 +1,16 @@
1
1
  <template>
2
2
  <div id="app">
3
3
  <img id="img" alt="Vue logo" src="./assets/logo.png" />
4
+ <plus-city-cascader></plus-city-cascader>
4
5
  </div>
5
6
  </template>
6
7
 
7
8
  <script>
9
+ import PlusCityCascader from './components/plus-comp/plus-city-cascader/plus-city-cascader.vue'
8
10
 
9
11
  export default {
10
12
  name: 'App',
11
- components: {},
13
+ components: {PlusCityCascader},
12
14
  mounted() {
13
15
  console.log(
14
16
  'web-tool mounted!',
@@ -0,0 +1,15 @@
1
+ const compFiles = ['plus-icon', 'plus-city-cascader', 'plus-count-down', 'plus-city-cascader', 'plus-common-header', 'plus-poptip', 'plus-qr-code', 'plus-drawer', 'plus-tabs', 'plus-remote-selector', 'plus-select', 'plus-form', 'plus-scrollview', 'plus-table', 'plus-modal', 'plus-card', 'permission-component']
2
+
3
+ const install = (vue, opts = {}) => {
4
+ compFiles.forEach(file => {
5
+ let compName = ''
6
+ file.split('-').forEach(word => {
7
+ compName += word[0].toLocaleUpperCase() + word.substring(1, word.length)
8
+ })
9
+ vue.component(compName, require(`./${file}/${file}.vue`).default)
10
+ })
11
+ }
12
+
13
+ export default {
14
+ install
15
+ }
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div @click="onclick">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+ <script>
7
+ import { getIntersection } from '../../../libs/tools'
8
+ export default {
9
+ props: {
10
+ hideWhenNoAuth: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ authCode: {
15
+ type: [String, Array],
16
+ default: ''
17
+ }
18
+ },
19
+ watch: {
20
+ hideWhenNoAuth: {
21
+ handler(val) {
22
+ if (
23
+ document.location.hostname == 'localhost' ||
24
+ document.location.hostname.indexOf('192.168') != -1 ||
25
+ !this.authCode ||
26
+ !this.$store.state.user.access ||
27
+ this.$store.state.user.access.length == 0
28
+ ) {
29
+ this.hasAccess = true
30
+ }
31
+ if (typeof this.authCode == 'string') {
32
+ if (
33
+ this.$store.state.user.access &&
34
+ this.$store.state.user.access.indexOf(this.authCode) != -1
35
+ ) {
36
+ this.hasAccess = true
37
+ }
38
+ } else if (this.authCode instanceof Array) {
39
+ const rst = getIntersection(
40
+ this.$store.state.user.access,
41
+ this.authCode
42
+ )
43
+ if (rst.length) {
44
+ this.hasAccess = true
45
+ }
46
+ }
47
+ if (val && !this.hasAccess) {
48
+ this.$nextTick(() => {
49
+ this.$el.parentNode.removeChild(this.$el)
50
+ })
51
+ }
52
+ },
53
+ deep: true,
54
+ immediate: true
55
+ }
56
+ },
57
+ data() {
58
+ return {
59
+ hasAccess: false
60
+ }
61
+ },
62
+ methods: {
63
+ onclick() {
64
+ console.log('------this.hasAccess---------', this.hasAccess)
65
+ if (this.hasAccess) {
66
+ this.$emit('click')
67
+ } else {
68
+ this.$Message.success('无权限,请联系管理员~')
69
+ }
70
+ }
71
+ }
72
+ }
73
+ </script>
74
+ <style lang="less" scoped>
75
+ .permission-component {
76
+ cursor: pointer;
77
+ }
78
+ </style>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <Card class="plus-card" dis-hover :bordered="false">
3
+ <slot></slot>
4
+ </Card>
5
+ </template>
6
+ <script>
7
+ export default {
8
+ props: {},
9
+ data() {
10
+ return {}
11
+ }
12
+ }
13
+ </script>
14
+ <style lang="less" scoped>
15
+ .plus-card {
16
+ position: relative;
17
+ /deep/.ivu-card-body {
18
+ height: 100%;
19
+ }
20
+ }
21
+ </style>
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <Cascader
3
+ :data="provinceList"
4
+ :load-data="loadData"
5
+ ref="plusCascaderRef"
6
+ v-model="selectResult"
7
+ @on-change="onchange"
8
+ ></Cascader>
9
+ </template>
10
+
11
+ <script>
12
+ import Emitter from 'iview/src/mixins/emitter'
13
+ export default {
14
+ name: 'AreaSelector',
15
+ mixins: [Emitter],
16
+ props: {
17
+ province: [String, Number],
18
+ city: [String, Number],
19
+ getAllProvince: { type: Function, default: null },
20
+ getCityByPid: { type: Function, default: null }
21
+ },
22
+ data() {
23
+ return {
24
+ provinceList: [],
25
+
26
+ provinceCode: '',
27
+ cityCode: '',
28
+
29
+ selectResult: []
30
+ }
31
+ },
32
+ computed: {},
33
+ watch: {
34
+ province: function (val) {
35
+ if (!val) {
36
+ this.$refs.plusCascaderRef.clearSelect()
37
+ } else {
38
+ this.selectResult = [this.province, this.city]
39
+ }
40
+ },
41
+ city: function (val) {
42
+ this.selectResult = [this.province, this.city]
43
+ }
44
+ },
45
+ methods: {
46
+ onchange(value, selectedData) {
47
+ const result = {
48
+ province: selectedData[0] || {},
49
+ city: selectedData[1] || {}
50
+ }
51
+ this.$emit('change', result)
52
+ console.log('----------onchange-------------', result)
53
+ this.dispatch('FormItem', 'on-form-change', result)
54
+ },
55
+ // 查询省份列表
56
+ getAllProvinces() {
57
+ if (this.getAllProvince === null) {
58
+ return
59
+ }
60
+ this.getAllProvince().then((res) => {
61
+ let provinceArr = res.data.data
62
+ provinceArr.forEach((pi) => {
63
+ this.provinceList.push({
64
+ value: pi.id,
65
+ label: pi.name,
66
+ loading: false,
67
+ children: [],
68
+ lvl: 'province',
69
+ rawData: pi
70
+ })
71
+ })
72
+ })
73
+ },
74
+ loadCity(item, callback) {
75
+ item.children = []
76
+ if (this.getCityByPid === null) {
77
+ return
78
+ }
79
+ this.getCityByPid(item.value).then((res) => {
80
+ let citiesArr = res.data.data
81
+ if (citiesArr != null) {
82
+ citiesArr.forEach((ci) => {
83
+ item.children.push({
84
+ value: ci.id,
85
+ label: ci.name,
86
+ rawData: ci
87
+ })
88
+ })
89
+ }
90
+ item.loading = false
91
+ callback()
92
+ })
93
+ },
94
+ loadData(item, callback) {
95
+ item.loading = true
96
+ if (item.lvl === 'province') {
97
+ this.loadCity(item, callback)
98
+ }
99
+ }
100
+ },
101
+ mounted() {
102
+ this.getAllProvinces()
103
+ }
104
+ }
105
+ </script>
106
+
107
+ <style scoped>
108
+ </style>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <Header class="plus-common-header">
3
+ <div class="header-wrap align-center">
4
+ <img class="logo" src="/images/hd/plus-icon.png" />
5
+ <slot></slot>
6
+ </div>
7
+ </Header>
8
+ </template>
9
+ <script>
10
+ export default {
11
+ name: 'HeaderBar',
12
+ components: {},
13
+ props: {},
14
+ computed: {
15
+ moudelType() {
16
+ const breadCrumbs = this.$store.state.app.breadCrumbList
17
+ if (breadCrumbs && breadCrumbs.length) {
18
+ return breadCrumbs[0].meta && breadCrumbs[0].meta.moudelType
19
+ }
20
+ return ''
21
+ }
22
+ },
23
+ methods: {
24
+ toMarket() {
25
+ this.$router.push({
26
+ name: 'activity-market'
27
+ })
28
+ },
29
+ toPlatform() {
30
+ this.$router.push({
31
+ name: 'order'
32
+ })
33
+ }
34
+ }
35
+ }
36
+ </script>
37
+ <style lang="less" scoped>
38
+ .plus-common-header {
39
+ padding: 0;
40
+ background: #ffffff;
41
+ z-index: 1000;
42
+ height: 72px;
43
+ line-height: 72px;
44
+ .header-wrap {
45
+ position: relative;
46
+ background-color: #ffffff;
47
+ box-shadow: var(--shadow-down);
48
+ padding: 0 16px;
49
+ height: 100%;
50
+ .logo {
51
+ margin-left: 32px;
52
+ width: 120px;
53
+ height: 38px;
54
+ object-fit: contain;
55
+ }
56
+ }
57
+ }
58
+ </style>
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <div @click="onclick">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+ <script>
7
+ export default {
8
+ props: {
9
+ beginNum: {
10
+ type: Number,
11
+ default: 60
12
+ }
13
+ },
14
+ data() {
15
+ return {
16
+ timer: null,
17
+ currentNumber: 0
18
+ }
19
+ },
20
+ methods: {
21
+ onclick() {
22
+ this.currentNumber = this.beginNum
23
+ this.$emit('start')
24
+ this.countdownFun()
25
+ },
26
+ countdownFun() {
27
+ this.currentNumber = this.currentNumber - 1
28
+ this.$emit('change', { target: this, value: this.currentNumber })
29
+ if (this.currentNumber <= 0) {
30
+ this.$emit('end')
31
+ return
32
+ }
33
+ this.timer = setTimeout(() => {
34
+ this.countdownFun()
35
+ }, 1000)
36
+ },
37
+ removeTimer() {
38
+ if (this.timer) {
39
+ clearTimeout(this.timer)
40
+ this.timer = null
41
+ }
42
+ }
43
+ },
44
+ beforeDestroy() {
45
+ this.removeTimer()
46
+ },
47
+ mounted() {
48
+ this.removeTimer()
49
+ }
50
+ }
51
+ </script>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div class="plus-drawer">
3
+ <Drawer
4
+ :class-name="className + ' plus-drawer'"
5
+ v-model="visiable"
6
+ :title="props.title"
7
+ :mask-closable="maskClosable"
8
+ :width="width"
9
+ @on-close="onClose"
10
+ @on-visible-change="onVisibleChange"
11
+ >
12
+ <div class="body-inner">
13
+ <slot></slot>
14
+ </div>
15
+
16
+ <div class="drawer-footer i-flex-wrap justify-center align-center">
17
+ <slot name="footer">
18
+ <Button type="primary" @click="onClose"> 关闭 </Button>
19
+ </slot>
20
+ </div>
21
+ <Spin v-if="props.loading" fix>
22
+ <Icon type="ios-loading" size="18" class="demo-spin-icon-load"></Icon>
23
+ <div>{{ props.loadingTip || '正在处理...' }}</div>
24
+ </Spin>
25
+ </Drawer>
26
+ </div>
27
+ </template>
28
+ <script>
29
+ export default {
30
+ props: {
31
+ width: {
32
+ type: [String, Number],
33
+ default: '40'
34
+ },
35
+ maskClosable: {
36
+ type: Boolean,
37
+ default: true
38
+ },
39
+ className: {
40
+ type: String,
41
+ default: ''
42
+ },
43
+ props: {
44
+ type: Object,
45
+ default() {
46
+ return {
47
+ show: false,
48
+ title: '',
49
+ loading: false,
50
+ loadingTip: null
51
+ }
52
+ }
53
+ }
54
+ },
55
+ watch: {
56
+ 'props.show': {
57
+ handler(nValue) {
58
+ this.visiable = nValue
59
+ },
60
+ deep: true,
61
+ immediate: true
62
+ }
63
+ },
64
+ data() {
65
+ return {
66
+ visiable: false
67
+ }
68
+ },
69
+ methods: {
70
+ onVisibleChange(e) {
71
+ this.props.show = e
72
+ if (!e) {
73
+ this.$emit('on-close')
74
+ }
75
+ },
76
+ onClose() {
77
+ this.props.show = false
78
+ this.$emit('on-close')
79
+ }
80
+ }
81
+ }
82
+ </script>
83
+ <style lang="less" scoped>
84
+ .plus-drawer {
85
+ /deep/&.ivu-drawer-wrap {
86
+ .ivu-drawer-header {
87
+ height: 60px;
88
+ line-height: 60px;
89
+ padding: 0 24px;
90
+ .ivu-drawer-header-inner {
91
+ font-weight: 600;
92
+ }
93
+ }
94
+ .ivu-drawer-body {
95
+ padding: 0;
96
+ }
97
+ .body-inner {
98
+ height: ~'calc(100% - 80px)';
99
+ padding: 24px 24px 0px;
100
+ overflow: auto;
101
+ }
102
+ .drawer-footer {
103
+ height: 80px;
104
+ border-top: 1px solid #e8eaec;
105
+ padding: 0 24px;
106
+ background-color: #ffffff;
107
+ .ivu-btn {
108
+ margin-right: 40px;
109
+ &:last-child {
110
+ margin-right: 0px;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ </style>
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <div class="plus-form-wrap" ref="plusFormRef">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+ <script>
7
+ import Vue from 'vue'
8
+ export default {
9
+ props: {
10
+ disabled: {
11
+ type: [Boolean],
12
+ default: false
13
+ }
14
+ },
15
+ watch: {
16
+ disabled: {
17
+ handler(nVal) {
18
+ this.$nextTick(() => {
19
+ this.findDisabledChildren(this.$refs.plusFormRef.__vue__)
20
+ })
21
+ },
22
+ deep: true,
23
+ immediate: true
24
+ }
25
+ },
26
+ methods: {
27
+ findDisabledChildren(comp) {
28
+ if (!comp) {
29
+ return
30
+ }
31
+ if (comp._props && comp._props.hasOwnProperty('disabled')) {
32
+ comp._props.disabled = this.disabled
33
+ }
34
+ if (comp.$children) {
35
+ comp.$children.forEach((item) => {
36
+ this.findDisabledChildren(item)
37
+ })
38
+ }
39
+ }
40
+ },
41
+ updated() {},
42
+ mounted() {
43
+ Vue.config.warnHandler = (e, vm, info) => {
44
+ if (e.indexOf('Prop being mutated') == -1) {
45
+ console.warn(e, vm, info)
46
+ }
47
+ }
48
+ this.$children[0].fields.forEach((fVm) => {
49
+ if (fVm.$watch) {
50
+ fVm.$watch('validateState', (nVal, oVal) => {
51
+ this.$emit('on-validated-change', {
52
+ field: fVm.prop,
53
+ state: nVal,
54
+ el: fVm
55
+ })
56
+ })
57
+ }
58
+ })
59
+ }
60
+ }
61
+ </script>
62
+ <style lang="less" scoped>
63
+ .plus-form-wrap {
64
+ /deep/.ivu-form {
65
+ .ivu-form-item {
66
+ --error-left: 0px;
67
+ --error-pd-tp: 6px;
68
+ --form-item-mg-bt: 24px;
69
+ display: flex;
70
+ align-items: center;
71
+ margin-bottom: var(--form-item-mg-bt);
72
+
73
+ .ivu-form-item-label {
74
+ font-family: PingFangSC-SNaNpxibold;
75
+ font-weight: 600;
76
+ font-size: 14px;
77
+ color: #515a6e;
78
+ letter-spacing: 0.7px;
79
+ padding: 0;
80
+ flex-shrink: 0;
81
+ & + .ivu-form-item-content {
82
+ margin-left: 16px !important;
83
+ }
84
+ }
85
+
86
+ .ivu-form-item-content {
87
+ flex-grow: 1;
88
+ }
89
+ &.ivu-form-item-required {
90
+ .ivu-form-item-label:before {
91
+ margin-right: 0;
92
+ }
93
+ }
94
+ &.slot-label {
95
+ .ivu-form-item-label {
96
+ display: flex;
97
+ justify-content: flex-end;
98
+ label {
99
+ margin-right: 0;
100
+ }
101
+ }
102
+ &.ivu-form-item-required {
103
+ .ivu-form-item-label {
104
+ &::before {
105
+ display: none;
106
+ }
107
+ .required::before {
108
+ content: '*';
109
+ display: inline-block;
110
+ margin-right: 0px;
111
+ line-height: 1;
112
+ font-family: SimSun;
113
+ font-size: 14px;
114
+ color: #ff0000;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ &.flex-start {
120
+ align-items: flex-start;
121
+ .ivu-form-item-label {
122
+ margin-top: 10px;
123
+ }
124
+ }
125
+ &.compact-form-item {
126
+ margin-bottom: 0px;
127
+ }
128
+ &.ivu-form-item-error {
129
+ margin-bottom: var(--form-item-mg-bt);
130
+ .ivu-form-item-error-tip {
131
+ left: var(--error-left);
132
+ padding-top: var(--error-pd-tp);
133
+ }
134
+ .form-item-other-tips {
135
+ margin-top: 26px !important;
136
+ }
137
+ }
138
+ }
139
+
140
+ .ivu-radio-wrapper {
141
+ font-size: 14px;
142
+ }
143
+ &.ivu-form-inline {
144
+ display: inline-flex;
145
+ flex-wrap: wrap;
146
+ }
147
+ }
148
+ }
149
+ </style>