vue2-client 1.2.98 → 1.2.99-test

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.98",
3
+ "version": "1.2.99-test",
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",
@@ -79,15 +79,6 @@ export default {
79
79
  type: Array,
80
80
  default: () => []
81
81
  },
82
- // 默认选中key
83
- defaultCheckedNames: {
84
- type: Array,
85
- default: () => []
86
- },
87
- defaultCheckedIds: {
88
- type: Array,
89
- default: () => []
90
- },
91
82
  // // 返回数据类型 String,Array 发现返回类型只能有一个
92
83
  // type: {
93
84
  // type: String,
@@ -115,10 +106,8 @@ export default {
115
106
  this.visible = true
116
107
  this.searchValue = ''
117
108
  this.treeData = this.sourceTreeData
118
- if (this.defaultCheckedIds.length > 0) {
119
- this.checkedKeys = this.getCheckedKeys(this.defaultCheckedIds)
120
- } else if (this.defaultCheckedNames.length > 0) {
121
- this.checkedKeys = this.getCheckedKeys(this.defaultCheckedNames)
109
+ if (this.value.length > 0) {
110
+ this.checkedKeys = this.getCheckedKeys(this.value)
122
111
  }
123
112
  this.expandedKeys = []
124
113
  },
@@ -70,7 +70,12 @@ export default {
70
70
  ...mapState('account', { currUser: 'user' })
71
71
  },
72
72
  created () {
73
- this.uploadedFileList = this.model.type === 'file' ? [...this.files] : [...this.images]
73
+ const list = this.model.type === 'file' ? [...this.files] : [...this.images]
74
+ if (this.model.useType) {
75
+ this.uploadedFileList = list.filter(item => item.f_use_type === this.model.useType)
76
+ } else {
77
+ this.uploadedFileList = list
78
+ }
74
79
  },
75
80
  methods: {
76
81
  uploadFiles (info) {
@@ -323,7 +323,11 @@ export default {
323
323
  }
324
324
  const item = this.realJsonData[i]
325
325
  if (this.modifyModelData.data[item.model] || this.modifyModelData.data[item.model] === 0) {
326
- this.form[item.model] = this.modifyModelData.data[item.model] + ''
326
+ if (this.modifyModelData.data[item.model] instanceof Array) {
327
+ this.form[item.model] = this.modifyModelData.data[item.model]
328
+ } else {
329
+ this.form[item.model] = this.modifyModelData.data[item.model] + ''
330
+ }
327
331
  } else {
328
332
  this.form[item.model] = undefined
329
333
  }
@@ -37,26 +37,43 @@
37
37
  <a-icon :class="['header-notice-icon']" type="bell"/>
38
38
  </a-badge>
39
39
  </span>
40
+ <a-drawer
41
+ placement="right"
42
+ title="待确认制度详情"
43
+ :width="screenWidth * 0.5"
44
+ :visible="institutionDetailVisible"
45
+ @close="institutionDetailVisible = false"
46
+ >
47
+ <institution-detail
48
+ :institutionId="institution"
49
+ affirmInstitution="affirmInstitution"
50
+ @get_to_be_confirmed="getToBeConfirmed"/>
51
+ </a-drawer>
40
52
  </a-dropdown>
41
53
  </template>
42
54
 
43
55
  <script>
44
56
  import { post } from '@vue2-client/services/api'
45
- import { mapState } from 'vuex'
57
+ import InstitutionDetail from './InstitutionDetail'
46
58
 
47
59
  export default {
48
60
  name: 'HeaderNotice',
49
61
  data () {
50
62
  return {
51
63
  loading: false,
64
+ screenWidth: document.documentElement.clientWidth,
52
65
  show: false,
66
+ institutionDetailVisible: false,
67
+ institution: undefined,
68
+ affirmInstitution: undefined,
53
69
  exception: [],
54
70
  backlog: []
55
71
  }
56
72
  },
73
+ components: { InstitutionDetail },
57
74
  computed: {},
58
75
  created () {
59
- this.get_to_be_confirmed()
76
+ this.getToBeConfirmed()
60
77
  },
61
78
  methods: {
62
79
  read (item) {
@@ -69,7 +86,7 @@ export default {
69
86
  this.refresh()
70
87
  })
71
88
  },
72
- get_to_be_confirmed (item) {
89
+ getToBeConfirmed () {
73
90
  try {
74
91
  if (this.$login.f.name) {
75
92
  post('/webmetersql/getToBeConfirmed', { data: { condition: `state = '待确认' and f_affirm_by = '${this.$login.f.name}'` } }).then(res => {
@@ -81,18 +98,9 @@ export default {
81
98
  }
82
99
  },
83
100
  confirm_institution (item) {
84
- post('/webmeterapi/affirmInstitution', {
85
- data: {
86
- tobe: [
87
- {
88
- id: item.id,
89
- f_affirm_type: '系统确认'
90
- }
91
- ]
92
- }
93
- }).then(res => {
94
- this.get_to_be_confirmed()
95
- })
101
+ this.institution = item.institution
102
+ this.affirmInstitution = item.id
103
+ this.institutionDetailVisible = true
96
104
  },
97
105
  refresh () {
98
106
  post('/webmeterapi/commonQuery', {
@@ -0,0 +1,176 @@
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
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ import { Base64 } from 'js-base64'
42
+ import { post } from '@vue2-client/services/api/restTools'
43
+ import { formatDate } from '@vue2-client/utils/util'
44
+
45
+ export default {
46
+ name: 'InstitutionDetail',
47
+ props: {
48
+ institutionId: {
49
+ type: Number,
50
+ default: undefined
51
+ },
52
+ affirmInstitution: {
53
+ type: Number,
54
+ default: undefined
55
+ }
56
+ },
57
+ data () {
58
+ return {
59
+ institutionDocUrl: undefined,
60
+ showDocument: false,
61
+ otherFiles: [],
62
+ institutionData: {},
63
+ previewDocVisible: false,
64
+ previewDocUrl: undefined,
65
+ previewDocLoading: false
66
+ }
67
+ },
68
+ watch: {
69
+ institutionId () {
70
+ this.getDetailData()
71
+ }
72
+ },
73
+ mounted () {
74
+ this.getDetailData()
75
+ },
76
+ methods: {
77
+ // 获取详情数据
78
+ getDetailData () {
79
+ if (!this.institutionId) {
80
+ return
81
+ }
82
+ const otherFiles = []
83
+ post('/webmeterapi/getInstitutionDetail', {
84
+ id: this.institutionId
85
+ }).then(res => {
86
+ res.files.forEach(item => {
87
+ if (item.use_type === '制度文件') {
88
+ const institutionDocUrl = previewDocService + encodeURIComponent(Base64.encode(fileServer + item.url))
89
+ this.institutionDocUrl = institutionDocUrl
90
+ this.showDocument = true
91
+ } else {
92
+ otherFiles.push(item)
93
+ }
94
+ })
95
+ this.institutionData = res.institution
96
+ this.otherFiles = otherFiles
97
+ })
98
+ },
99
+ format (dateStr) {
100
+ return formatDate(dateStr, 'yyyy-MM-dd')
101
+ },
102
+ // 其他附件预览
103
+ handlePreviewDoc (url) {
104
+ const previewDocUrl = previewDocService + encodeURIComponent(Base64.encode(fileServer + url))
105
+ if (this.previewDocUrl != previewDocUrl) {
106
+ this.previewDocLoading = true
107
+ this.previewDocUrl = previewDocUrl
108
+ }
109
+ this.previewDocVisible = true
110
+ },
111
+ // 下载文档
112
+ handlePreDowDoc (file) {
113
+ const a = document.createElement('a')
114
+ a.href = file.url
115
+ a.download = file.name
116
+ a.click()
117
+ },
118
+ confirm_institution (item) {
119
+ this.institution = item.institution
120
+ post('/webmeterapi/affirmInstitution', {
121
+ data: {
122
+ tobe: [
123
+ {
124
+ id: item.id,
125
+ f_affirm_type: '系统确认'
126
+ }
127
+ ]
128
+ }
129
+ }).then(res => {
130
+ this.$emit('get_to_be_confirmed')
131
+ })
132
+ },
133
+ }
134
+ }
135
+ // 文档预览服务 API
136
+ const previewDocService = 'http://123.60.214.109:8012/onlinePreview?url='
137
+ // 文件服务器地址
138
+ const fileServer = 'http://123.60.214.109:8406'
139
+ </script>
140
+
141
+ <style lang="less" scoped>
142
+ .content {
143
+ height: 80vh;
144
+ img {
145
+ max-width: 100%;
146
+ }
147
+ }
148
+ .other-file {
149
+ margin: 16px 0;
150
+ .title {
151
+ margin-bottom: 6px;
152
+ }
153
+ }
154
+ .file-item {
155
+ .file-action {
156
+ padding: 3px 4px;
157
+ color: #1890ff;
158
+ &:hover {
159
+ background: #e6f7ff;
160
+ }
161
+ }
162
+ .anticon {
163
+ margin-right: 3px;
164
+ }
165
+ }
166
+ .file-list-title {
167
+ color: rgba(0, 0, 0, 0.85);
168
+ font-weight: bold;
169
+ font-size: 16px;
170
+ margin-bottom: 8px;
171
+ }
172
+ .preview-doc-container {
173
+ height: calc(100vh - 92px);
174
+ padding-top: 20px;
175
+ }
176
+ </style>