vue2-client 1.2.99 → 1.2.100

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": "vue2-client",
3
- "version": "1.2.99",
3
+ "version": "1.2.100",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -27,6 +27,7 @@
27
27
  "enquire.js": "^2.1.6",
28
28
  "file-saver": "^2.0.5",
29
29
  "highlight.js": "^10.7.3",
30
+ "js-base64": "^3.7.2",
30
31
  "js-cookie": "^2.2.1",
31
32
  "jsencrypt": "^3.2.1",
32
33
  "lodash.get": "^4.4.2",
@@ -29,6 +29,18 @@
29
29
  </a-list-item>
30
30
  </a-list>
31
31
  </a-tab-pane>
32
+ <a-drawer
33
+ placement="right"
34
+ title="待确认制度详情"
35
+ :width="screenWidth * 0.5"
36
+ :visible="institutionDetailVisible"
37
+ @close="onClose"
38
+ >
39
+ <institution-detail
40
+ :institutionId="institution"
41
+ :affirmInstitution="affirmInstitution"
42
+ @get_to_be_confirmed="getToBeConfirmed"/>
43
+ </a-drawer>
32
44
  </a-tabs>
33
45
  </a-spin>
34
46
  </div>
@@ -42,22 +54,32 @@
42
54
 
43
55
  <script>
44
56
  import { post } from '@vue2-client/services/api'
57
+ import InstitutionDetail from './InstitutionDetail'
45
58
 
46
59
  export default {
47
60
  name: 'HeaderNotice',
48
61
  data () {
49
62
  return {
50
63
  loading: false,
64
+ screenWidth: document.documentElement.clientWidth,
51
65
  show: false,
66
+ institutionDetailVisible: false,
67
+ institution: undefined,
68
+ affirmInstitution: undefined,
52
69
  exception: [],
53
70
  backlog: []
54
71
  }
55
72
  },
73
+ components: { InstitutionDetail },
56
74
  computed: {},
57
75
  created () {
58
- this.get_to_be_confirmed()
76
+ this.getToBeConfirmed()
59
77
  },
60
78
  methods: {
79
+ onClose () {
80
+ this.institutionDetailVisible = false
81
+ this.getToBeConfirmed()
82
+ },
61
83
  read (item) {
62
84
  post('/webmeterapi/saveSingleTable', {
63
85
  data: {
@@ -68,7 +90,8 @@ export default {
68
90
  this.refresh()
69
91
  })
70
92
  },
71
- get_to_be_confirmed (item) {
93
+ getToBeConfirmed () {
94
+ this.institutionDetailVisible = false
72
95
  try {
73
96
  if (this.$login.f.name) {
74
97
  post('/webmetersql/getToBeConfirmed', { data: { condition: `state = '待确认' and f_affirm_by = '${this.$login.f.name}'` } }).then(res => {
@@ -80,18 +103,10 @@ export default {
80
103
  }
81
104
  },
82
105
  confirm_institution (item) {
83
- post('/webmeterapi/affirmInstitution', {
84
- data: {
85
- tobe: [
86
- {
87
- id: item.id,
88
- f_affirm_type: '系统确认'
89
- }
90
- ]
91
- }
92
- }).then(res => {
93
- this.get_to_be_confirmed()
94
- })
106
+ this.institutionDetailVisible = true
107
+ this.show = false
108
+ this.institution = item.institution
109
+ this.affirmInstitution = item.id
95
110
  },
96
111
  refresh () {
97
112
  post('/webmeterapi/commonQuery', {
@@ -0,0 +1,177 @@
1
+ <template>
2
+ <div>
3
+ <h2 style="text-align: center">{{ institutionData.f_title }}</h2>
4
+ <p>简述: {{ institutionData.f_sketch }}</p>
5
+ <p>生效时间: {{ format(institutionData.f_effective_date) }}</p>
6
+ <div v-if="showDocument" class="content">
7
+ <iframe :src="institutionDocUrl" width="100%" height="100%" frameborder="0"></iframe>
8
+ </div>
9
+ <!-- 其他附件 -->
10
+ <div class="other-file">
11
+ <div class="title">其他附件</div>
12
+ <div v-for="file in otherFiles" :key="file.id">
13
+ <a class="file-item">
14
+ <span class="file-action" @click="handlePreviewDoc(file.url)">
15
+ <a-icon type="link" />{{ file.name }}
16
+ </span>
17
+ <span class="file-action" @click="handlePreviewDoc(file.url)">
18
+ <a-icon type="eye" />预览
19
+ </span>
20
+ <a class="file-action" @click="handlePreDowDoc(file)" target="_blank"><a-icon type="download" />下载</a>
21
+ </a>
22
+ </div>
23
+ </div>
24
+ <!-- 其他附件预览 -->
25
+ <a-modal v-model="previewDocVisible" :footer="null" :dialog-style="{ top: '20px' }" width="97%" :z-index="1001">
26
+ <div class="preview-doc-container">
27
+ <a-spin size="large" :spinning="previewDocLoading" />
28
+ <iframe
29
+ v-show="!previewDocLoading"
30
+ :src="previewDocUrl"
31
+ width="100%"
32
+ height="100%"
33
+ frameborder="0"
34
+ @load="previewDocLoading = false" />
35
+ </div>
36
+ </a-modal>
37
+ <a-button type="primary" @click="confirm_institution">确认</a-button>
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+ import { Base64 } from 'js-base64'
43
+ import { post } from '@vue2-client/services/api/restTools'
44
+ import { formatDate } from '@vue2-client/utils/util'
45
+
46
+ export default {
47
+ name: 'InstitutionDetail',
48
+ props: {
49
+ institutionId: {
50
+ type: Number,
51
+ default: undefined
52
+ },
53
+ affirmInstitution: {
54
+ type: Number,
55
+ default: undefined
56
+ }
57
+ },
58
+ data () {
59
+ return {
60
+ institutionDocUrl: undefined,
61
+ showDocument: false,
62
+ otherFiles: [],
63
+ institutionData: {},
64
+ previewDocVisible: false,
65
+ previewDocUrl: undefined,
66
+ previewDocLoading: false
67
+ }
68
+ },
69
+ watch: {
70
+ institutionId () {
71
+ this.getDetailData()
72
+ }
73
+ },
74
+ mounted () {
75
+ this.getDetailData()
76
+ },
77
+ methods: {
78
+ // 获取详情数据
79
+ getDetailData () {
80
+ if (!this.institutionId) {
81
+ return
82
+ }
83
+ const otherFiles = []
84
+ post('/webmeterapi/getInstitutionDetail', {
85
+ id: this.institutionId
86
+ }).then(res => {
87
+ res.files.forEach(item => {
88
+ if (item.use_type === '制度文件') {
89
+ const institutionDocUrl = previewDocService + encodeURIComponent(Base64.encode(fileServer + item.url))
90
+ this.institutionDocUrl = institutionDocUrl
91
+ this.showDocument = true
92
+ } else {
93
+ otherFiles.push(item)
94
+ }
95
+ })
96
+ this.institutionData = res.institution
97
+ this.otherFiles = otherFiles
98
+ })
99
+ },
100
+ format (dateStr) {
101
+ return formatDate(dateStr, 'yyyy-MM-dd')
102
+ },
103
+ // 其他附件预览
104
+ handlePreviewDoc (url) {
105
+ const previewDocUrl = previewDocService + encodeURIComponent(Base64.encode(fileServer + url))
106
+ if (this.previewDocUrl != previewDocUrl) {
107
+ this.previewDocLoading = true
108
+ this.previewDocUrl = previewDocUrl
109
+ }
110
+ this.previewDocVisible = true
111
+ },
112
+ // 下载文档
113
+ handlePreDowDoc (file) {
114
+ const a = document.createElement('a')
115
+ a.href = file.url
116
+ a.download = file.name
117
+ a.click()
118
+ },
119
+ confirm_institution () {
120
+ post('/webmeterapi/affirmInstitution', {
121
+ data: {
122
+ tobe: [
123
+ {
124
+ id: this.affirmInstitution,
125
+ f_affirm_type: '系统确认'
126
+ }
127
+ ]
128
+ }
129
+ }).then(res => {
130
+ this.$message.success('确认成功')
131
+ this.$emit('get_to_be_confirmed')
132
+ })
133
+ },
134
+ }
135
+ }
136
+ // 文档预览服务 API
137
+ const previewDocService = 'http://123.60.214.109:8012/onlinePreview?url='
138
+ // 文件服务器地址
139
+ const fileServer = 'http://123.60.214.109:8406'
140
+ </script>
141
+
142
+ <style lang="less" scoped>
143
+ .content {
144
+ height: 80vh;
145
+ img {
146
+ max-width: 100%;
147
+ }
148
+ }
149
+ .other-file {
150
+ margin: 16px 0;
151
+ .title {
152
+ margin-bottom: 6px;
153
+ }
154
+ }
155
+ .file-item {
156
+ .file-action {
157
+ padding: 3px 4px;
158
+ color: #1890ff;
159
+ &:hover {
160
+ background: #e6f7ff;
161
+ }
162
+ }
163
+ .anticon {
164
+ margin-right: 3px;
165
+ }
166
+ }
167
+ .file-list-title {
168
+ color: rgba(0, 0, 0, 0.85);
169
+ font-weight: bold;
170
+ font-size: 16px;
171
+ margin-bottom: 8px;
172
+ }
173
+ .preview-doc-container {
174
+ height: calc(100vh - 92px);
175
+ padding-top: 20px;
176
+ }
177
+ </style>