htui-yllkbz 1.2.54 → 1.2.55

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "htui-yllkbz",
3
- "version": "1.2.54",
3
+ "version": "1.2.55",
4
4
  "typings": "types/index.d.ts",
5
5
  "main": "lib/htui.common.js",
6
6
  "style": "lib/htui.css",
@@ -5,7 +5,7 @@
5
5
  * @Author: hutao
6
6
  * @Date: 2021-11-11 11:23:24
7
7
  * @LastEditors: hutao
8
- * @LastEditTime: 2022-01-16 09:27:47
8
+ * @LastEditTime: 2022-02-11 14:34:01
9
9
  -->
10
10
  <template>
11
11
  <div v-loading="state.loading"
@@ -104,6 +104,7 @@
104
104
  type="tag"></common-org-info>
105
105
  <span v-else>--</span>
106
106
  </template>
107
+ <!-- 处理基础数据 -->
107
108
  <template v-else-if="item.type==='common'">
108
109
 
109
110
  <div v-if="getPropByPath(row,item.key)"
@@ -137,7 +138,7 @@
137
138
  </div>
138
139
  <span v-else>--</span>
139
140
  </template>
140
- <!-- 处理部门人员 -->
141
+ <!-- 处理布尔值显示 -->
141
142
  <template v-else-if="item.type==='boolean'">
142
143
  <el-tag :type="'success'"
143
144
  :size="'small'"
@@ -146,15 +147,25 @@
146
147
  :size="'small'"
147
148
  v-else>否</el-tag>
148
149
  </template>
149
- <!-- 处理部门人员 -->
150
+ <!-- 处理图片显示 -->
150
151
  <template v-else-if="item.type==='img'">
151
- <span v-if="fileToken in getPropByPath(row,item.key).split(',')">
152
+ <span v-if="getPropByPath(row,item.key)">
152
153
  <el-image style="width: 38px; height: 38px;margin-right:5px"
154
+ :key="fileToken"
155
+ v-for="fileToken in getPropByPath(row,item.key).split(',')"
153
156
  :src="'/files/api/filing/file/download/'+fileToken"
154
157
  :preview-src-list="['/files/api/filing/file/download/'+fileToken]">
155
158
  </el-image>
156
159
  </span>
157
-
160
+ </template>
161
+ <!-- 处理附件显示 -->
162
+ <template v-else-if="item.type==='file'">
163
+ <span v-if="getPropByPath(row,item.key)">
164
+ <i class="el-icon-paperclip"
165
+ @click="showFiles(getPropByPath(row,item.key))"
166
+ style="color:var(--primary);cursor:pointer">{{getPropByPath(row,item.key).split(',').length}}</i>
167
+ </span>
168
+ <span v-else>--</span>
158
169
  </template>
159
170
  <!-- 其他 -->
160
171
  <span v-else>{{getPropByPath(row,item.key)}}</span>
@@ -223,12 +234,30 @@
223
234
  </el-scrollbar>
224
235
  </div>
225
236
  </el-dialog>
237
+ <!-- 附件详情弹框 -->
238
+ <el-dialog :visible.sync="state.visibleFile"
239
+ title="附件查看"
240
+ :append-to-body="true"
241
+ :close-on-click-modal="true"
242
+ width="400px"
243
+ :center="true">
244
+ <p slot="title"
245
+ style="font-weight:700;font-size:18px;float:left">附件查看</p>
246
+ <el-divider></el-divider>
247
+ <div style='overflow:hidden;height:calc(30vh)'>
248
+ <el-scrollbar style='height: calc(100% + 17px)'>
249
+ <HtUploadFiles :disabled="true"
250
+ v-model="state.files"></HtUploadFiles>
251
+ </el-scrollbar>
252
+ </div>
253
+ </el-dialog>
226
254
  </div>
227
255
  </template>
228
256
  <script lang='ts'>
229
257
  import { Component, Prop, Vue, Watch } from "vue-property-decorator";
230
258
  import { Column, PageInfoType } from "@/packages/type";
231
259
  import PageInfo from "@/packages/PageInfo/index.vue";
260
+ import HtUploadFiles from "@/packages/HtUploadFiles/index.vue";
232
261
  interface State {
233
262
  pageInfo: PageInfoType;
234
263
  loading: boolean;
@@ -237,13 +266,18 @@ interface State {
237
266
  showColumnKeys: string[];
238
267
  /** 是否展示筛选框 */
239
268
  visibleFilter: boolean;
269
+ /** 是否展示附件 */
270
+ visibleFile: boolean;
240
271
  /** 当前拖动的数据 */
241
272
  currentColumn?: Column;
273
+ /** 附件ids */
274
+ files?: string;
242
275
  }
243
276
  @Component({
244
277
  name: "HtTable",
245
278
  components: {
246
279
  PageInfo,
280
+ HtUploadFiles,
247
281
  },
248
282
  })
249
283
  export default class HtTable extends Vue {
@@ -287,6 +321,7 @@ export default class HtTable extends Vue {
287
321
  @Prop() pagination?: any;
288
322
  state: State = {
289
323
  loading: false,
324
+ files: undefined,
290
325
  pageInfo: {
291
326
  currentPage: 1,
292
327
  pageSize: 10,
@@ -296,6 +331,7 @@ export default class HtTable extends Vue {
296
331
  showColumns: [],
297
332
  currentColumn: undefined,
298
333
  visibleFilter: false,
334
+ visibleFile: false,
299
335
  showColumnKeys: [],
300
336
  };
301
337
  created() {
@@ -321,6 +357,11 @@ export default class HtTable extends Vue {
321
357
  return arr;
322
358
  }, []);
323
359
  }
360
+ /** 展示附件信息 */
361
+ showFiles(val = "") {
362
+ this.state.files = val;
363
+ this.state.visibleFile = true;
364
+ }
324
365
  changeColumns(node: any, checked: boolean) {
325
366
  let { showColumnKeys } = this.state;
326
367
  if (checked) {
@@ -0,0 +1,14 @@
1
+ /*
2
+ * @Descripttion:
3
+ * @version:
4
+ * @Author: hutao
5
+ * @Date: 2021-11-15 15:00:57
6
+ * @LastEditors: hutao
7
+ * @LastEditTime: 2022-02-11 14:26:45
8
+ */
9
+ import HtUploadFiles from "./index.vue";
10
+ (HtUploadFiles as any).install = function (Vue: any) {
11
+
12
+ Vue.component("HtUploadFiles", HtUploadFiles);
13
+ };
14
+ export default HtUploadFiles;
@@ -0,0 +1,234 @@
1
+ <!--
2
+ * @Descripttion:
3
+ * @version:
4
+ * @Author: hutao
5
+ * @Date: 2022-02-11 14:26:23
6
+ * @LastEditors: hutao
7
+ * @LastEditTime: 2022-02-11 14:36:54
8
+ -->
9
+ <!--
10
+ * @Descripttion: 附件列表 ------没有搞完
11
+ * @version:
12
+ * @Author: hutao
13
+ * @Date: 2021-12-30 16:07:59
14
+ * @LastEditors: hutao
15
+ * @LastEditTime: 2022-02-10 15:11:11
16
+ -->
17
+ <template>
18
+ <div>
19
+ <el-upload class="ht-upload"
20
+ v-if="!disabled"
21
+ style="width:368px;height:108px"
22
+ :show-file-list="false"
23
+ :disabled="disabled"
24
+ :on-success="onSuccess"
25
+ :before-upload="beforeUpload"
26
+ drag
27
+ action="/files/api/filing/file/upload"
28
+ multiple>
29
+ <!-- <i class="el-icon-upload"></i> -->
30
+ <div style="margin-top:8px;font-size:12px;color:#999"
31
+ class="el-upload__text">拖动文件到此处,或<br /><em>点击上传</em></div>
32
+ <!-- <div class="el-upload__tip"
33
+ slot="tip">只能上传jpg/png文件,且不超过5M</div> -->
34
+ </el-upload>
35
+ <ul class="ht-ul-upload">
36
+ <li :key="item.fileToken"
37
+ v-for=" (item,index) in state.filesInfo">
38
+ <a @click="downLoadFile(item)"><i class="le-icon el-icon-document"
39
+ style="margin-right:7px"></i>{{item.fileName}}</a>
40
+ <span>
41
+
42
+ <i v-if="!disabled"
43
+ class="el-icon el-icon-circle-check"></i>
44
+ <i v-if="!disabled"
45
+ class="el-icon el-icon-close"
46
+ @click="delItem(item,index)"
47
+ title="删除"></i>
48
+ <i class="el-icon el-icon-download"
49
+ style="margin-right:24px"
50
+ @click="downLoadFile(item)"
51
+ title="下载"></i>
52
+ </span>
53
+
54
+ </li>
55
+ </ul>
56
+ <a :href="state.fileSrc"
57
+ target="_blank"
58
+ v-show="false"
59
+ ref="download1"></a>
60
+ </div>
61
+ </template>
62
+ <script lang='ts'>
63
+ import { _axios } from "vue-kst-auth";
64
+ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
65
+ interface State {
66
+ /** 数据状态 */
67
+ loading: boolean;
68
+ fileSrc: string;
69
+ /** 图片地址 */
70
+ fileToken: string[];
71
+ dialogVisible: boolean;
72
+ /** 附件详情列表 */
73
+ filesInfo: CreateAttachmentDto[];
74
+ }
75
+ interface FileType {
76
+ fileName: string;
77
+ fileSize?: number;
78
+ fileToken?: string;
79
+ fileType?: string;
80
+ }
81
+ interface CreateAttachmentDto {
82
+ fileToken?: string | undefined;
83
+ fileName?: string | undefined;
84
+ fileSize?: number;
85
+ fileType?: string | undefined;
86
+ sortNum?: number;
87
+ }
88
+ @Component({
89
+ name: "HtUploadFiles",
90
+ })
91
+ export default class HtUploadFiles extends Vue {
92
+ @Prop() value!: string;
93
+ /* 是否只读 */
94
+ @Prop({ default: false }) readonly?: boolean;
95
+ /** 是否禁用 */
96
+ @Prop() disabled?: boolean;
97
+ /** 数据 */
98
+ state: State = {
99
+ loading: false,
100
+ fileSrc: "",
101
+ fileToken: [],
102
+ filesInfo: [],
103
+ dialogVisible: false,
104
+ };
105
+ /** 生命周期 */
106
+ created() {
107
+ this.onValue(this.value);
108
+ }
109
+ /** 方法 */
110
+ /** 上传文件前验证 */
111
+
112
+ /** 附件上传之前的判断 */
113
+ beforeUpload(file: File) {
114
+ const isLt10MB = file.size / 1024 / 1024 < 5;
115
+ const arr = ["jpg", "png", "xlsx", "lsx", "doc", "pdf"];
116
+ const lastArr = file.name.split(".");
117
+ const type = lastArr[lastArr.length - 1];
118
+ if (!isLt10MB) {
119
+ this.$message.error("大小不能超过 5MB!");
120
+ }
121
+ if (arr.includes(type)) {
122
+ return true;
123
+ } else {
124
+ this.$notify.error(`只能上传${arr.toString()}格式文件`);
125
+ return false;
126
+ }
127
+ }
128
+ /**下载文件 */
129
+ downLoadFile(item: any) {
130
+ this.state.fileSrc = `/files/api/filing/file/download/${item.fileToken}`;
131
+ setTimeout(() => {
132
+ const adom: any = this.$refs.download1;
133
+ adom.click();
134
+ }, 100);
135
+ }
136
+ /** 附件上传成功 */
137
+ onSuccess(response: { fileToken: string }) {
138
+ console.log("response, file, fileList", response.fileToken);
139
+ //this.state.files.push(response.fileToken);
140
+ this.getFileInfo(response.fileToken);
141
+ }
142
+ /** 获取到的附件列表详情 */
143
+ getFileInfo(id: string) {
144
+ _axios.get("/files/api/filing/file/" + id).then((res) => {
145
+ this.state.filesInfo.push(res.data);
146
+ });
147
+ }
148
+ /** 删除附件列表 */
149
+ delItem(item: FileType, index: number) {
150
+ const { filesInfo } = this.state;
151
+ if (item.fileToken) {
152
+ filesInfo.splice(index, 1);
153
+ this.state.filesInfo = filesInfo;
154
+ }
155
+ }
156
+ /** 请求所有的附件信息 */
157
+ async getAllFileInfo() {
158
+ const { fileToken } = this.state;
159
+ //this.state.filesInfo = [];
160
+ for (let i = 0; i < fileToken.length; i++) {
161
+ if (
162
+ this.state.filesInfo.findIndex(
163
+ (item) => item.fileToken === fileToken[i]
164
+ ) < 0
165
+ ) {
166
+ await _axios
167
+ .get("/files/api/filing/file/" + fileToken[i])
168
+ .then((res) => {
169
+ this.state.filesInfo.push(res.data);
170
+ });
171
+ }
172
+ }
173
+ }
174
+ /** 监听 */
175
+ /** 计算属性 */
176
+ get fileList() {
177
+ return [];
178
+ }
179
+ @Watch("state.filesInfo")
180
+ onFileToken(val: CreateAttachmentDto[], old: string) {
181
+ const arr: string[] = [];
182
+ val.forEach((item) => {
183
+ if (item.fileToken) arr.push(item.fileToken);
184
+ });
185
+ this.$emit("input", arr.toString());
186
+ }
187
+ @Watch("value")
188
+ onValue(val: string) {
189
+ if (val) {
190
+ this.state.fileToken = val.split(",");
191
+ this.getAllFileInfo();
192
+ } else {
193
+ this.state.fileToken = [];
194
+ }
195
+ }
196
+ }
197
+ </script>
198
+ <style lang='scss' scoped>
199
+ .ht-ul-upload {
200
+ li {
201
+ width: 100%;
202
+ list-style: none;
203
+ height: 40px;
204
+ line-height: 40px;
205
+ padding: 0 8px;
206
+ display: flex;
207
+ justify-content: space-between;
208
+ cursor: pointer;
209
+ a {
210
+ color: #606266;
211
+ font-size: 12px;
212
+ }
213
+ .el-icon-close {
214
+ display: none;
215
+ }
216
+ &:hover {
217
+ background: #eee;
218
+ a {
219
+ color: var(--primary);
220
+ }
221
+ .el-icon-close {
222
+ display: block;
223
+ line-height: 40px;
224
+ }
225
+ .el-icon-circle-check {
226
+ display: none;
227
+ }
228
+ }
229
+ .el-icon-circle-check {
230
+ color: var(--primary);
231
+ }
232
+ }
233
+ }
234
+ </style>
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-10-21 10:08:41
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2022-01-04 09:47:12
7
+ * @LastEditTime: 2022-02-11 14:29:18
8
8
  */
9
9
 
10
10
  // 导入组件
@@ -18,10 +18,11 @@ import HtExport from './HtExport/index'
18
18
  import HtUpload from './HtUpload/index'
19
19
  import HtMd from './HtMd/index'
20
20
  import HtCountDown from './HtCountDown/index'
21
+ import HtUploadFiles from './HtUploadFiles/index'
21
22
 
22
23
 
23
24
  // 存储组件列表
24
- const components = [HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown]
25
+ const components = [HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles]
25
26
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
26
27
  const install = function (Vue: any) {
27
28
  // 判断是否安装
@@ -37,6 +38,6 @@ export default {
37
38
  // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
38
39
  install,
39
40
  // 以下是具体的组件列表
40
- HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown
41
+ HtSelectTable, HtPagination, HtTable, HtExport, HtUpload, HtMd, HtCountDown, HtUploadFiles
41
42
  }
42
43
 
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-10-25 17:05:17
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2022-01-13 15:08:32
7
+ * @LastEditTime: 2022-02-10 10:33:52
8
8
  */
9
9
  /** 初始的默认条数 */
10
10
  export const defalutPageSize = 10
@@ -69,8 +69,8 @@ export interface Column {
69
69
  hide?: boolean;
70
70
  /** 时间是否跨行展示 */
71
71
  spread?: boolean;
72
- /** 通过type展示相应的数据 用户id|部门id|时间格式化|是否布尔值*/
73
- type?: 'userId' | 'org' | 'time' | 'common' | 'boolean' | 'img';
72
+ /** 通过type展示相应的数据 用户id|部门id|时间格式化|是否布尔值|图片 |附件*/
73
+ type?: 'userId' | 'org' | 'time' | 'common' | 'boolean' | 'img' | 'file';
74
74
  /** 只有当type='common'时候有效 数据类型个ca common里面的一样但不包括时间 时间使用time */
75
75
  commonType?: 'userId' | 'departmentId' | 'baseDataId' | 'roleId' | 'baseDataName' | 'baseDataValue';
76
76
  showOverflowTooltip?: boolean;
@@ -4,7 +4,7 @@
4
4
  * @Author: hutao
5
5
  * @Date: 2021-11-15 14:41:40
6
6
  * @LastEditors: hutao
7
- * @LastEditTime: 2022-01-16 09:30:07
7
+ * @LastEditTime: 2022-02-11 13:46:07
8
8
  -->
9
9
  <template>
10
10
  <div>
@@ -31,12 +31,7 @@
31
31
  <HtTable :data="state.data"
32
32
  :height="200"
33
33
  :columns="state.columns">
34
- <div slot="sex"
35
- slot-scope="{row}">{{row.sex?'男':'女'}}</div>
36
- <div slot="age"
37
- slot-scope="{row}">
38
- <el-tag>{{row.age}}</el-tag>
39
- </div>
34
+
40
35
  <div slot="header_name">测试名字</div>
41
36
  </HtTable>
42
37
  </div>
@@ -87,16 +82,15 @@ export default class Index extends Vue {
87
82
  {
88
83
  name: "胡涛",
89
84
  age: 12,
90
- sex: 0,
85
+ sex: "e49961a4f385e5d341ce3a01ee674c90ea9e037b734228fe26753a01ee674c90,e49961a4f385e5d341ce3a01ee674c90ea9e037b734228fe26753a01ee674c90",
91
86
  id: 1,
92
-
93
87
  test: { title: "33476c23-9faa-22d3-3ee6-39f97d173566" },
94
88
  time: "2022-01-20T00:00:00+08:00",
95
89
  },
96
90
  {
97
91
  name: "胡涛",
98
92
  age: 12,
99
- sex: 1,
93
+ sex: "e49961a4f385e5d341ce3a01ee674c90ea9e037b734228fe26753a01ee674c90",
100
94
  id: 2,
101
95
  test: { title: "测试" },
102
96
  time: "2022-01-20T00:00:00+08:00",
@@ -104,7 +98,7 @@ export default class Index extends Vue {
104
98
  {
105
99
  name: "胡涛",
106
100
  age: 12,
107
- sex: 1,
101
+ sex: "tt",
108
102
  id: 3,
109
103
  test: { title: "测试" },
110
104
  time: "2022-01-20T00:00:00+08:00",
@@ -112,7 +106,7 @@ export default class Index extends Vue {
112
106
  {
113
107
  name: "胡涛",
114
108
  age: 12,
115
- sex: 0,
109
+ sex: "tt",
116
110
  id: 4,
117
111
  test: { title: "测试" },
118
112
  time: "2022-01-20T00:00:00+08:00",
@@ -120,7 +114,7 @@ export default class Index extends Vue {
120
114
  {
121
115
  name: "胡涛",
122
116
  age: 12,
123
- sex: 0,
117
+ sex: "tt",
124
118
  id: 41,
125
119
  test: { title: "测试" },
126
120
  time: "2022-01-20T00:00:00+08:00",
@@ -131,7 +125,6 @@ export default class Index extends Vue {
131
125
  title: "姓名",
132
126
  key: "test.title",
133
127
  width: "300px",
134
-
135
128
  disabled: true,
136
129
  },
137
130
  {
@@ -151,6 +144,7 @@ export default class Index extends Vue {
151
144
  {
152
145
  title: "性别",
153
146
  key: "sex",
147
+ type: "file",
154
148
  },
155
149
  ],
156
150
  };