shijiplus-web-plugin 0.1.12 → 0.1.14

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.12",
3
+ "version": "0.1.14",
4
4
  "files": [
5
5
  "src"
6
6
  ],
@@ -1,6 +1,7 @@
1
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
2
 
3
3
  const install = (vue, opts = {}) => {
4
+ console.log('--------install---plus-comp----------')
4
5
  compFiles.forEach(file => {
5
6
  let compName = ''
6
7
  file.split('-').forEach(word => {
@@ -8,7 +8,8 @@ export default {
8
8
  }
9
9
  },
10
10
  methods: {
11
- invokeExportExcel(searchForm, apiFunction) {
11
+ invokeExportExcel(searchForm, apiFunction, options = {}) {
12
+ const { exportDesc } = this.$merge({}, options)
12
13
  const checkExportDataTotal = (searchForm) => {
13
14
  return apiFunction({
14
15
  ...searchForm,
@@ -34,6 +35,8 @@ export default {
34
35
  }).then((res) => {
35
36
  if (res && res.data) {
36
37
  exportData.push(...res.data)
38
+ } else {
39
+ throw Error('导出失败')
37
40
  }
38
41
  this.orderExportModalPercent = (exportData.length / (this.totalCount || 1) * 100).toFixed(2)
39
42
  if (processUpdate) {
@@ -56,23 +59,77 @@ export default {
56
59
  }, 0)
57
60
  return
58
61
  }
59
- const instance = this.$getComponentInstance(PlusCircleProgressModal)
60
- instance.$on('on-close', (e) => {
62
+ const processInstance = this.$getComponentInstance(PlusCircleProgressModal)
63
+ processInstance.$on('on-close', (e) => {
61
64
  setTimeout(() => {
62
- this.$removeVComp(instance)
65
+ this.$removeVComp(processInstance)
63
66
  }, 500)
64
67
  })
65
- instance.show()
68
+ processInstance.show({ exportDesc })
66
69
  return excelExportFun(1, this.orderExportPageSize, (process) => {
67
- instance.updatePercent(process)
70
+ processInstance.updatePercent(process)
68
71
  }).catch(() => {
69
72
  // 宏任务最后执行
70
73
  setTimeout(() => {
71
74
  this.$Message.error('导出失败', 3)
72
- this.$removeVComp(instance)
75
+ this.$removeVComp(processInstance)
73
76
  }, 0)
74
77
  })
75
78
  })
79
+ },
80
+ exportAllData(searchForm, options = {}) {
81
+ let exportData = []
82
+ let totalCount = 0
83
+ const { apiFunction, exportDesc } = this.$merge({}, options)
84
+ const excelExportFun = (processUpdate) => {
85
+ return apiFunction({
86
+ ...searchForm
87
+ }).then((res) => {
88
+ if (res && res.data) {
89
+ totalCount = res.data.length
90
+ exportData.push(...res.data)
91
+ } else {
92
+ throw Error('导出失败')
93
+ }
94
+ let orderExportModalPercent = (exportData.length / (totalCount || 1) * 100).toFixed(2)
95
+ if (processUpdate) {
96
+ processUpdate(orderExportModalPercent)
97
+ }
98
+ if (exportData.length < totalCount) {
99
+ return excelExportFun(processUpdate)
100
+ }
101
+ return exportData
102
+ }).catch((error) => {
103
+ console.log('--------error---------', error)
104
+ throw Error('导出失败')
105
+ })
106
+ }
107
+ return new Promise((resolve, reject) => {
108
+ excelExportFun((process) => {
109
+ console.log('-------excelExport-----process--------', process)
110
+ }).then(data => {
111
+ resolve(data)
112
+ }).catch(() => {
113
+ // 宏任务最后执行
114
+ setTimeout(() => {
115
+ this.$Message.error('导出失败', 3)
116
+ }, 0)
117
+ reject(new Error('导出失败'))
118
+ })
119
+ })
120
+ },
121
+ createProcessInstance() {
122
+ const processInstance = this.$getComponentInstance(PlusCircleProgressModal)
123
+ processInstance.$on('on-close', (e) => {
124
+ setTimeout(() => {
125
+ this.$removeVComp(processInstance)
126
+ }, 500)
127
+ })
128
+ processInstance.show()
129
+ return processInstance
130
+ },
131
+ destroyProcessInstance(processInstance) {
132
+ processInstance.handlerClose()
76
133
  }
77
134
  }
78
135
  }
@@ -24,7 +24,10 @@
24
24
  </div>
25
25
  </div>
26
26
  </div>
27
- <slot name="table">
27
+ <div ref="headerRef">
28
+ <slot name="header"></slot>
29
+ </div>
30
+ <slot name="table" :pageData="pageData" :height="height">
28
31
  <Table
29
32
  :style="tableStyle"
30
33
  :columns="showColumns"
@@ -209,6 +212,9 @@ export default {
209
212
  if (this.$refs.searchAreaRef) {
210
213
  tHeight -= this.$refs.searchAreaRef.clientHeight
211
214
  }
215
+ if (this.$refs.headerRef) {
216
+ tHeight -= this.$refs.headerRef.clientHeight
217
+ }
212
218
  if (this.$refs.footerRef) {
213
219
  tHeight -= this.$refs.footerRef.clientHeight
214
220
  }
package/src/index.js CHANGED
@@ -3,6 +3,7 @@ import './index.less'
3
3
  import i18n from './locale'
4
4
  import ExtentionPlugin from './extentionPlugin'
5
5
  import importDirective from './directive'
6
+ import PlusComp from './components/plus-comp'
6
7
 
7
8
  console.log('--------web-tool---index.js----------')
8
9
 
@@ -12,5 +13,17 @@ export default {
12
13
  importDirective,
13
14
  installDirectives(Vue) {
14
15
  importDirective(Vue)
16
+ },
17
+ PlusComp,
18
+ install(vue, opts = {}) {
19
+ vue.use(PlusComp)
20
+ /**
21
+ * 注册指令
22
+ */
23
+ importDirective(vue)
24
+ vue.use(ExtentionPlugin)
25
+ vue.use(iView, {
26
+ i18n: (key, value) => i18n.t(key, value)
27
+ })
15
28
  }
16
29
  }
package/src/main.js CHANGED
@@ -7,27 +7,18 @@ import ExtentionPlugin from './extentionPlugin'
7
7
  import importDirective from './directive'
8
8
  import PlusComp from './components/plus-comp'
9
9
 
10
- Vue.config.productionTip = false
10
+ import Tool from './index'
11
+
12
+
11
13
 
12
- Vue.use(PlusComp)
13
- /**
14
- * 注册指令
15
- */
16
- importDirective(Vue)
17
14
 
18
- Vue.use(ExtentionPlugin)
19
- Vue.use(iView, {
20
- i18n: (key, value) => i18n.t(key, value)
21
- })
15
+ Vue.config.productionTip = false
16
+
17
+ Tool.install(Vue)
22
18
  new Vue({
23
19
  render: h => h(App),
24
20
  }).$mount('#app')
25
21
 
26
22
  export default {
27
- i18n,
28
- ExtentionPlugin,
29
- importDirective,
30
- installDirectives(Vue) {
31
- importDirective(Vue)
32
- }
23
+ ...Tool
33
24
  }