shijiplus-web-plugin 0.1.34 → 0.1.36

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": "shijiplus-web-plugin",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "files": [
5
5
  "src"
6
6
  ],
@@ -1,4 +1,4 @@
1
- const compFiles = ['plus-tag', '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']
1
+ const compFiles = ['plus-input', 'plus-tag', 'plus-table-v2', '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
2
 
3
3
  const install = (vue, opts = {}) => {
4
4
  console.log('--------install---plus-comp----------')
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div :class="`plus-input i-flex-wrap nowrap ${type}`">
3
+ <Input
4
+ v-model="mValue"
5
+ :type="type"
6
+ :rows="mRows"
7
+ :autosize="mAutosize"
8
+ :placeholder="placeholder"
9
+ :maxlength="maxlength"
10
+ />
11
+ <span class="counter">{{ (mValue || '').length }}/{{ maxlength }}</span>
12
+ </div>
13
+ </template>
14
+ <script>
15
+ export default {
16
+ model: {
17
+ prop: 'value',
18
+ event: 'input'
19
+ },
20
+ props: {
21
+ value: [Number, String],
22
+ placeholder: String,
23
+ type: {
24
+ type: String,
25
+ default: 'text'
26
+ },
27
+ maxlength: {
28
+ type: Number,
29
+ default: null
30
+ }
31
+ },
32
+ watch: {
33
+ type: {
34
+ handler(val) {
35
+ if (val == 'textarea') {
36
+ this.mRows = 3
37
+ }
38
+ },
39
+ immediate: true
40
+ },
41
+ value: {
42
+ handler(val) {
43
+ this.mValue = val
44
+ },
45
+ immediate: true
46
+ },
47
+ mValue: {
48
+ handler(nVal) {
49
+ this.$emit('input', nVal)
50
+ },
51
+ immediate: true,
52
+ deep: true
53
+ }
54
+ },
55
+ data() {
56
+ return {
57
+ mValue: null,
58
+ mRows: 2,
59
+ mAutosize: { minRows: 2, maxRows: 6 }
60
+ }
61
+ },
62
+ methods: {}
63
+ }
64
+ </script>
65
+ <style lang="less" scoped>
66
+ .plus-input {
67
+ .counter {
68
+ font-size: 12px;
69
+ }
70
+ &.textarea {
71
+ .counter {
72
+ margin-top: auto;
73
+ }
74
+ }
75
+ }
76
+ </style>
@@ -0,0 +1,78 @@
1
+ import PlusCircleProgressModal from './plus-circle-progress-modal.vue'
2
+ export default {
3
+ data() {
4
+ return {
5
+ totalCount: 0,
6
+ orderExportModalPercent: 0,
7
+ orderExportPageSize: 100
8
+ }
9
+ },
10
+ methods: {
11
+ invokeExportExcel(searchForm, apiFunction) {
12
+ const checkExportDataTotal = (searchForm) => {
13
+ return apiFunction({
14
+ ...searchForm,
15
+ pageNo: 1,
16
+ currentPage: 1,
17
+ pageSize: 1
18
+ })
19
+ .then((res) => {
20
+ if (res && res.meta) {
21
+ this.totalCount = res.meta.totalCount
22
+ } else {
23
+ this.totalCount = (res.data || []).length
24
+ }
25
+ })
26
+ }
27
+ let exportData = []
28
+ const excelExportFun = (pageNo, pageSize, processUpdate) => {
29
+ return apiFunction({
30
+ ...searchForm,
31
+ currentPage: pageNo,
32
+ pageNo: pageNo,
33
+ pageSize: pageSize
34
+ }).then((res) => {
35
+ if (res && res.data) {
36
+ exportData.push(...res.data)
37
+ }
38
+ this.orderExportModalPercent = (exportData.length / (this.totalCount || 1) * 100).toFixed(2)
39
+ if (processUpdate) {
40
+ processUpdate(this.orderExportModalPercent)
41
+ }
42
+ if (exportData.length < this.totalCount) {
43
+ return excelExportFun(pageNo + 1, pageSize, processUpdate)
44
+ }
45
+ return exportData
46
+ }).catch((error) => {
47
+ console.log('--------error---------', error)
48
+ throw Error('导出失败')
49
+ })
50
+ }
51
+ return checkExportDataTotal(searchForm).then((res) => {
52
+ if (this.totalCount === 0) {
53
+ // 宏任务最后执行
54
+ setTimeout(() => {
55
+ this.$Message.error('暂无数据,请搜索后重试', 3)
56
+ }, 0)
57
+ return
58
+ }
59
+ const instance = this.$getComponentInstance(PlusCircleProgressModal)
60
+ instance.$on('on-close', (e) => {
61
+ setTimeout(() => {
62
+ this.$removeVComp(instance)
63
+ }, 500)
64
+ })
65
+ instance.show()
66
+ return excelExportFun(1, this.orderExportPageSize, (process) => {
67
+ instance.updatePercent(process)
68
+ }).catch(() => {
69
+ // 宏任务最后执行
70
+ setTimeout(() => {
71
+ this.$Message.error('导出失败', 3)
72
+ this.$removeVComp(instance)
73
+ }, 0)
74
+ })
75
+ })
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <PlusModal
3
+ :props="modalProps"
4
+ :closable="false"
5
+ @on-close="handlerClose"
6
+ width="500px"
7
+ >
8
+ <div class="i-flex-wrap justify-center align-center" style="height: 200px">
9
+ <i-circle :strokeColor="'var(--primary-color)'" :percent="percent">
10
+ <p class="sub-text">正在导出...</p>
11
+ <p
12
+ class="primary-title"
13
+ style="margin-top: 6px; color: var(--primary-color)"
14
+ >
15
+ {{ percent }}%
16
+ </p>
17
+ </i-circle>
18
+ </div>
19
+ <div slot="footer"></div>
20
+ </PlusModal>
21
+ </template>
22
+ <script>
23
+ export default {
24
+ data() {
25
+ return {
26
+ modalProps: {
27
+ show: false
28
+ },
29
+ percent: 0
30
+ }
31
+ },
32
+ methods: {
33
+ updatePercent(value) {
34
+ this.percent = Number(value)
35
+ if (this.percent >= 100) {
36
+ setTimeout(() => {
37
+ this.handlerClose()
38
+ }, 800)
39
+ }
40
+ },
41
+ handlerClose() {
42
+ this.modalProps.show = false
43
+ this.$emit('on-close')
44
+ },
45
+ show() {
46
+ this.percent = 0
47
+ this.modalProps.show = true
48
+ },
49
+ hide() {}
50
+ }
51
+ }
52
+ </script>
53
+ <style lang="less" scoped>
54
+ </style>