qj-common 4.3.0 → 4.3.2
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/.babelrc +12 -12
- package/.eslintrc.js +25 -25
- package/.idea/common.iml +11 -11
- package/.idea/modules.xml +7 -7
- package/.idea/vcs.xml +5 -5
- package/.postcssrc.js +9 -9
- package/.prettierrc.js +7 -7
- package/.project +37 -37
- package/README.md +2 -2
- package/gulpfile.js +20 -20
- package/package.json +18 -18
- package/src/api/apimanage.js +146 -146
- package/src/api/common/index.js +192 -192
- package/src/api/login.js +160 -160
- package/src/api/shopFbu.js +515 -515
- package/src/api/upload.js +8 -8
- package/src/components/Bounced/index.vue +145 -145
- package/src/components/Breadcrumb/index.vue +71 -71
- package/src/components/Checkbox/index.vue +53 -53
- package/src/components/Hamburger/index.vue +48 -48
- package/src/components/Logistics/logic.vue +186 -186
- package/src/components/ScrollBar/index.vue +60 -60
- package/src/components/Sticky/index.vue +76 -76
- package/src/components/SvgIcon/index.vue +42 -42
- package/src/components/ThemePicker/index.vue +243 -243
- package/src/components/Tinymce/components/editorImage.vue +94 -94
- package/src/components/Tinymce/index.vue +166 -166
- package/src/components/Tinymce/plugins.js +7 -7
- package/src/components/Tinymce/toolbar.js +6 -6
- package/src/components/TreeTable/customEval.js +44 -44
- package/src/components/TreeTable/eval.js +29 -29
- package/src/components/TreeTable/index.vue +124 -124
- package/src/components/TreeTable/readme.md +89 -89
- package/src/components/TreeTableApi/customEval.js +49 -49
- package/src/components/TreeTableApi/eval.js +29 -29
- package/src/components/TreeTableApi/index.vue +124 -124
- package/src/components/TreeTableApi/readme.md +89 -89
- package/src/components/Upload/singleImage.vue +123 -123
- package/src/components/Upload/singleImage2.vue +118 -118
- package/src/components/Upload/singleImage3.vue +138 -138
- package/src/components/Upload/upload.vue +295 -295
- package/src/components/workOrderList/index.vue +158 -158
- package/src/dependencies.js +119 -119
- package/src/iconShop/demo.css +539 -539
- package/src/iconShop/demo_index.html +8445 -8445
- package/src/iconShop/iconfont.css +1451 -1451
- package/src/iconShop/iconfont.json +2522 -2522
- package/src/iconShop/iconfont.svg +1070 -1070
- package/src/iconfont/demo.css +539 -539
- package/src/iconfont/demo_index.html +5276 -5276
- package/src/iconfont/iconfont.css +905 -905
- package/src/iconfont/iconfont.json +1563 -1563
- package/src/iconfont/iconfont.svg +692 -692
- package/src/icons/index.js +9 -9
- package/src/lang/e.js +48 -48
- package/src/lang/en.js +48 -48
- package/src/lang/zh.js +48 -48
- package/src/main.js +62 -62
- package/src/permission.js +283 -283
- package/src/permissionForMall.backup.js +375 -375
- package/src/permissionForMall.js +375 -375
- package/src/preset.js +67 -67
- package/src/router/_import_common.js +1 -1
- package/src/router/_import_development.js +1 -1
- package/src/router/_import_production.js +1 -1
- package/src/store/getters.js +39 -39
- package/src/store/index.js +18 -18
- package/src/store/modules/app.js +34 -30
- package/src/store/modules/menu.js +82 -82
- package/src/store/modules/user.js +227 -227
- package/src/styles/element-ui.scss +1368 -1368
- package/src/styles/index.scss +166 -166
- package/src/styles/mixin.scss +27 -27
- package/src/styles/pc-ui.scss +1031 -1031
- package/src/styles/scrollBar.scss +21 -21
- package/src/styles/sidebar.scss +123 -123
- package/src/styles/transition.scss +32 -32
- package/src/styles/variables.scss +44 -44
- package/src/styles/wf-ui.scss +86 -86
- package/src/utils/auth.js +57 -57
- package/src/utils/dom.js +12 -12
- package/src/utils/getQueryString.js +5 -5
- package/src/utils/import.js +5 -5
- package/src/utils/index.js +355 -355
- package/src/utils/interceptor.js +34 -34
- package/src/utils/menu.js +116 -116
- package/src/utils/proapp.js +35 -35
- package/src/utils/query.js +26 -26
- package/src/utils/request.js +366 -366
- package/src/utils/routeMapping.js +39 -39
- package/src/utils/routeMapping.json +310 -310
- package/src/utils/utils.js +84 -84
- package/src/utils/validate.js +102 -102
- package/src/views/404.vue +72 -72
- package/src/views/Layout.vue +106 -106
- package/src/views/imgSwiper/index.vue +34 -34
- package/src/views/layout/Layout.vue +181 -170
- package/src/views/layout/components/AppMain.vue +20 -20
- package/src/views/layout/components/Footer.vue +22 -22
- package/src/views/layout/components/LeftNavbar.vue +318 -310
- package/src/views/layout/components/NavMenu.vue +15 -15
- package/src/views/layout/components/Navbar.vue +664 -661
- package/src/views/layout/components/Sidebar/SidebarItem.vue +116 -113
- package/src/views/layout/components/Sidebar/index.vue +203 -193
- package/src/views/layout/components/index.js +19 -19
- package/src/views/layout/theme/darkBlue/Layout.vue +140 -140
- package/src/views/layout/theme/darkBlue/components/AppMain.vue +38 -38
- package/src/views/layout/theme/darkBlue/components/Footer.vue +147 -147
- package/src/views/layout/theme/darkBlue/components/LeftNavbar(/345/261/225/347/244/272/345/205/250/351/203/250/350/217/234/345/215/225).vue +448 -448
- package/src/views/layout/theme/darkBlue/components/LeftNavbar.3.vue +191 -191
- package/src/views/layout/theme/darkBlue/components/LeftNavbar.vue +466 -466
- package/src/views/layout/theme/darkBlue/components/Navbar.vue +200 -200
- package/src/views/layout/theme/darkBlue/components/Sidebar/SidebarItem.vue +71 -71
- package/src/views/layout/theme/darkBlue/components/Sidebar/index.vue +49 -49
- package/src/views/layout/theme/darkBlue/components/index.js +15 -15
- package/src/views/layout-default/Layout.vue +134 -134
- package/src/views/layout-default/components/AppMain.vue +19 -19
- package/src/views/layout-default/components/Footer.vue +22 -22
- package/src/views/layout-default/components/LeftNavbar.vue +164 -164
- package/src/views/layout-default/components/Navbar.vue +295 -295
- package/src/views/layout-default/components/Sidebar/SidebarItem.vue +67 -67
- package/src/views/layout-default/components/Sidebar/index.vue +59 -59
- package/src/views/layout-default/components/index.js +4 -4
- package/src/views/layout-default/theme/darkBlue/Layout.vue +140 -140
- package/src/views/layout-default/theme/darkBlue/components/AppMain.vue +38 -38
- package/src/views/layout-default/theme/darkBlue/components/Footer.vue +147 -147
- package/src/views/layout-default/theme/darkBlue/components/LeftNavbar.vue +465 -465
- package/src/views/layout-default/theme/darkBlue/components/Navbar.vue +200 -200
- package/src/views/layout-default/theme/darkBlue/components/Sidebar/SidebarItem.vue +69 -69
- package/src/views/layout-default/theme/darkBlue/components/Sidebar/index.vue +49 -49
- package/src/views/layout-default/theme/darkBlue/components/index.js +15 -15
- package/src/views/pc/Internationalization.vue +80 -80
- package/src/views/pc/default/Layout.vue +442 -442
- package/src/views/pc/default/LayoutCard.vue +424 -424
- package/src/views/pc/default/assets/flex.scss +99 -99
- package/src/views/pc/default/footer-modules/DgFooter/index.vue +179 -179
- package/src/views/pc/default/footer-modules/DgFooter/indexSDX.vue +187 -187
- package/src/views/pc/default/footer-modules/footer.vue +171 -171
- package/src/views/pc/default/footer-modules/footerAns.vue +167 -167
- package/src/views/pc/default/footer-modules/footerBulk.vue +169 -169
- package/src/views/pc/default/footer-modules/footerDM.vue +254 -254
- package/src/views/pc/default/footer-modules/footerDefault.vue +267 -267
- package/src/views/pc/default/footer-modules/footerDefaultA.vue +270 -270
- package/src/views/pc/default/footer-modules/footerDefaultNew.vue +201 -201
- package/src/views/pc/default/footer-modules/footerHDB.vue +153 -153
- package/src/views/pc/default/footer-modules/footerHy.vue +63 -63
- package/src/views/pc/default/footer-modules/footerKYW.vue +163 -163
- package/src/views/pc/default/footer-modules/footerMh.vue +30 -30
- package/src/views/pc/default/footer-modules/footerNew.vue +116 -116
- package/src/views/pc/default/footer-modules/footer_yzj.vue +169 -169
- package/src/views/pc/default/footer-modules/footerayd.vue +85 -85
- package/src/views/pc/default/footer-modules/ymFooter.vue +154 -154
- package/src/views/pc/default/footer-modules/zgl.vue +250 -250
- package/src/views/pc/default/header-modules/DgHeader/Logo.vue +57 -57
- package/src/views/pc/default/header-modules/DgHeader/Search.vue +135 -135
- package/src/views/pc/default/header-modules/DgHeader/Settleup.vue +46 -46
- package/src/views/pc/default/header-modules/DgHeader/index.vue +38 -38
- package/src/views/pc/default/header-modules/active.vue +177 -177
- package/src/views/pc/default/header-modules/header.vue +97 -97
- package/src/views/pc/default/header-modules/headerA.vue +142 -142
- package/src/views/pc/default/header-modules/headerFLPT.vue +157 -157
- package/src/views/pc/default/header-modules/headerMh.vue +187 -187
- package/src/views/pc/default/header-modules/headerNew.vue +121 -121
- package/src/views/pc/default/header-modules/headerSDX.vue +304 -304
- package/src/views/pc/default/header-modules/headerStyle2.vue +173 -173
- package/src/views/pc/default/header-modules/headerStyle3.vue +190 -190
- package/src/views/pc/default/header-modules/headerStyle4.vue +163 -163
- package/src/views/pc/default/header-modules/headerStyleAns.vue +400 -400
- package/src/views/pc/default/header-modules/headerStyleBulk.vue +427 -427
- package/src/views/pc/default/header-modules/headerStyleDefalut.vue +209 -209
- package/src/views/pc/default/header-modules/headerStyleKYW.vue +435 -435
- package/src/views/pc/default/header-modules/headerStyle_yzj.vue +427 -427
- package/src/views/pc/default/header-modules/headerayd.vue +187 -187
- package/src/views/pc/default/header-modules/index.vue +466 -466
- package/src/views/pc/default/header-modules/ymHeader.vue +292 -292
- package/src/views/pc/default/header-modules/ysHeader.vue +248 -248
- package/src/views/pc/default/header-modules/zgl.vue +855 -855
- package/src/views/pc/default/leftMenu-modules/leftMenu-logo.vue +194 -194
- package/src/views/pc/default/leftMenu-modules/leftMenu-style2.vue +206 -206
- package/src/views/pc/default/leftMenu-modules/leftMenu-style3.vue +207 -207
- package/src/views/pc/default/leftMenu-modules/leftMenu-style4.vue +192 -192
- package/src/views/pc/default/leftMenu-modules/leftMenu.vue +183 -183
- package/src/views/pc/default/leftMenu-modules/leftMenuDefault.vue +212 -212
- package/src/views/pc/default/leftMenu-modules/leftMenuDefaultEn.vue +214 -214
- package/src/views/pc/default/leftMenu-modules/leftMenuDefaultFLPT.vue +220 -220
- package/src/views/pc/default/leftMenu-modules/leftMenuDefaultayd.vue +220 -220
- package/src/views/pc/default/nav-modules/nav.vue +52 -52
- package/src/views/pc/default/nav-modules/navAns.vue +60 -60
- package/src/views/pc/default/nav-modules/navBulk.vue +60 -60
- package/src/views/pc/default/top-modules/DgTopShortcut/index.vue +177 -177
- package/src/views/pc/default/top-modules/Toplg.vue +280 -280
- package/src/views/pc/default/top-modules/topA.vue +136 -136
- package/src/views/pc/default/top-modules/topAns.vue +261 -261
- package/src/views/pc/default/top-modules/topAns_yzj.vue +282 -282
- package/src/views/pc/default/top-modules/topBar.vue +304 -304
- package/src/views/pc/default/top-modules/topBulk.vue +280 -280
- package/src/views/pc/default/top-modules/topDefault.vue +244 -244
- package/src/views/pc/default/top-modules/topDefaultDM.vue +197 -197
- package/src/views/pc/default/top-modules/topDefaultNew.vue +271 -271
- package/src/views/pc/default/top-modules/topFLPT.vue +197 -197
- package/src/views/pc/default/top-modules/topHDB.vue +479 -479
- package/src/views/pc/default/top-modules/topKYW.vue +258 -258
- package/src/views/pc/default/top-modules/topMh.vue +174 -174
- package/src/views/pc/default/top-modules/topNew.vue +97 -97
- package/src/views/pc/default/top-modules/topSDX.vue +298 -298
- package/src/views/pc/default/top-modules/topSimple.vue +247 -247
- package/src/views/pc/default/top-modules/topSimpleHy.vue +256 -256
- package/src/views/pc/default/top-modules/topUcc.vue +264 -264
- package/src/views/pc/default/top-modules/topayd.vue +170 -170
- package/src/views/pc/default/top-modules/ymTop.vue +299 -299
- package/src/views/pc/default/top-modules/zgltop.vue +499 -499
- package/src/views/routerView.vue +9 -9
- package/src/views/templates/components/temp-select.vue +80 -80
- package/src/views/templates/components/temp-upload.vue +233 -233
- package/src/views/templates/readme.md +2 -2
- package/src/views/templates/templateInput.vue +421 -421
- package/src/views/templates/templateReadme.html +588 -588
- package/src/views/templates/templateReadme.md +619 -619
- package/src/views/templates/templateTable.vue +2243 -2243
- package/src/views/templates/templateTableData.vue +1883 -1883
- package/src/views/templates/templateUi/templateTableContent.vue +187 -187
- package/src/views/treeTemplate/index.vue +559 -559
- package/src/views/treeTemplate/treeTemplate.md +274 -274
- package/src/views/uploadDialog/index copy.vue +352 -352
- package/src/views/uploadDialog/index.vue +558 -558
- package/src/views/uploadDialog/indexOlay.vue +582 -582
- package/src/views/uploadDialog/indexPM.vue +578 -578
- package/src/views/uploadDialog/indexUpload.vue +543 -543
- package/src/views/uploadDialog/readme.md +45 -45
|
@@ -1,543 +1,543 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-dialog :title="title" width="1000px" :append-to-body="true" :visible.sync="diaVisible" @close="handelClose">
|
|
3
|
-
<!-- 点击上传弹出的第一个框 -->
|
|
4
|
-
<el-form class="dialog-form" v-if="!type || type == '0'">
|
|
5
|
-
<el-form-item label="上传本地图片" class="dialog-form-item">
|
|
6
|
-
<el-button type="primary" class="file-btn" @click="changeFile">添加图片</el-button>
|
|
7
|
-
<span class="el-upload__tip cor-red">只能上传{{ picType }}{{ !type || type == '0' ? '图片' : '文件' }},且不超过{{ num || 1 }}M,最多上传{{ picLimit }}张</span>
|
|
8
|
-
</el-form-item>
|
|
9
|
-
</el-form>
|
|
10
|
-
<el-form :inline="true" class="demo-form-inline" :model="ruleForm" label-width="80px" label-position="left">
|
|
11
|
-
<el-form-item label="图片类型">
|
|
12
|
-
<el-select v-model="ruleForm.fileSort" clearable placeholder="请选择图片类型">
|
|
13
|
-
<!-- <el-option label="全部" value=""></el-option> -->
|
|
14
|
-
<el-option label="商品图片" value="FILE_GD"></el-option>
|
|
15
|
-
<el-option label="店铺图片" value="FILE_02"></el-option>
|
|
16
|
-
</el-select>
|
|
17
|
-
</el-form-item>
|
|
18
|
-
<el-form-item label="名称">
|
|
19
|
-
<el-input v-model="ruleForm.fileRemark" clearable></el-input>
|
|
20
|
-
</el-form-item>
|
|
21
|
-
<el-form-item>
|
|
22
|
-
<el-button type="primary" @click="getImgListData">查询</el-button>
|
|
23
|
-
</el-form-item>
|
|
24
|
-
</el-form>
|
|
25
|
-
|
|
26
|
-
<el-row>
|
|
27
|
-
<el-col :span="2" class="folder">
|
|
28
|
-
<div @click="clickFolder('', -1)" :class="indexIn == 0 ? 'c-theme' : 'color-gary'">
|
|
29
|
-
<i class="icon iconfont icon-wenjianjia"></i>
|
|
30
|
-
<p class="overtext">全部</p>
|
|
31
|
-
</div>
|
|
32
|
-
</el-col>
|
|
33
|
-
<el-col :span="2" v-for="(item, i) in folderList" :key="i" class="folder">
|
|
34
|
-
<div @click="clickFolder(item.fileCode, i)" :class="indexIn === i + 1 ? 'c-theme' : 'color-gary'">
|
|
35
|
-
<i class="icon iconfont icon-wenjianjia"></i>
|
|
36
|
-
<p class="overtext">{{ item.fileName }}</p>
|
|
37
|
-
</div>
|
|
38
|
-
</el-col>
|
|
39
|
-
</el-row>
|
|
40
|
-
<el-row style="margin-top: 20px" class="images">
|
|
41
|
-
<div class="imgsList images">
|
|
42
|
-
<!-- <el-row> -->
|
|
43
|
-
<el-table
|
|
44
|
-
v-if="imgList.length > 0"
|
|
45
|
-
ref="multipleTable"
|
|
46
|
-
:data="imgList"
|
|
47
|
-
tooltip-effect="dark"
|
|
48
|
-
style="width: 100%"
|
|
49
|
-
:empty-text="'暂无图片'"
|
|
50
|
-
:row-key="
|
|
51
|
-
(row) => {
|
|
52
|
-
return row.fileCode;
|
|
53
|
-
}
|
|
54
|
-
"
|
|
55
|
-
@row-click="clickRow"
|
|
56
|
-
@selection-change="handleSelectionChange"
|
|
57
|
-
>
|
|
58
|
-
<!-- <el-col :span='4'> -->
|
|
59
|
-
<el-table-column :reserve-selection="true" type="selection" width="55"> </el-table-column>
|
|
60
|
-
<el-table-column width="120">
|
|
61
|
-
<template slot-scope="scope">
|
|
62
|
-
<img v-lazy="scope.row.fileUrl" />
|
|
63
|
-
<p class="otheritem" style="text-align: center">{{ scope.row.fileRemark }}</p>
|
|
64
|
-
</template>
|
|
65
|
-
</el-table-column>
|
|
66
|
-
<!-- </el-col> -->
|
|
67
|
-
</el-table>
|
|
68
|
-
<!-- </el-row> -->
|
|
69
|
-
</div>
|
|
70
|
-
</el-row>
|
|
71
|
-
<div class="block">
|
|
72
|
-
<el-pagination
|
|
73
|
-
@size-change="handleSizeChange"
|
|
74
|
-
@current-change="handleCurrentChange"
|
|
75
|
-
style="margin-top: 20px"
|
|
76
|
-
:current-page="pageNo"
|
|
77
|
-
:page-sizes="[10, 20, 30, 40]"
|
|
78
|
-
:page-size="pageSize"
|
|
79
|
-
layout="total, sizes, prev, pager, next"
|
|
80
|
-
:total="total"
|
|
81
|
-
></el-pagination>
|
|
82
|
-
</div>
|
|
83
|
-
<div class="file-list">
|
|
84
|
-
<el-upload
|
|
85
|
-
ref="picUpload"
|
|
86
|
-
class="pic-div"
|
|
87
|
-
:action="fileUploadUrl"
|
|
88
|
-
:data="otherData"
|
|
89
|
-
:before-upload="beforeAvatarUpload"
|
|
90
|
-
:on-success="handelSuccess"
|
|
91
|
-
:with-credentials="true"
|
|
92
|
-
:show-file-list="false"
|
|
93
|
-
:multiple="multiple"
|
|
94
|
-
></el-upload>
|
|
95
|
-
<!-- :on-remove="handleRemove"
|
|
96
|
-
list-type="picture-card"
|
|
97
|
-
:show-file-list="false" -->
|
|
98
|
-
</div>
|
|
99
|
-
<div slot="footer" class="dialog-footer">
|
|
100
|
-
<el-button @click="closed">取消</el-button>
|
|
101
|
-
<el-button type="primary" @click="setFileList" :disabled="disables">确定</el-button>
|
|
102
|
-
</div>
|
|
103
|
-
</el-dialog>
|
|
104
|
-
</template>
|
|
105
|
-
<script>
|
|
106
|
-
import API from '#/api/common';
|
|
107
|
-
import { Loading } from 'element-ui';
|
|
108
|
-
import { validateURL } from '#/utils/validate';
|
|
109
|
-
const querystring = require('querystring');
|
|
110
|
-
export default {
|
|
111
|
-
props: {
|
|
112
|
-
fileList: Array,
|
|
113
|
-
type: String,
|
|
114
|
-
fileSort: {
|
|
115
|
-
type: String,
|
|
116
|
-
default: 'FILE_GD',
|
|
117
|
-
},
|
|
118
|
-
limit: Number,
|
|
119
|
-
visible: Boolean,
|
|
120
|
-
imgType: String,
|
|
121
|
-
num: Number,
|
|
122
|
-
multiple: {
|
|
123
|
-
type: Boolean,
|
|
124
|
-
default: false,
|
|
125
|
-
},
|
|
126
|
-
fileUploadUrl: {
|
|
127
|
-
type: String,
|
|
128
|
-
default: process.env.API_ROOT + '/web/rs/resourceBase/uploadGoodsFiles.json',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
data() {
|
|
132
|
-
return {
|
|
133
|
-
count: '0',
|
|
134
|
-
disables: false,
|
|
135
|
-
ruleForm: { fileRemark: '', fileSort: this.fileSort },
|
|
136
|
-
title: '选择图片',
|
|
137
|
-
pageSize: '10',
|
|
138
|
-
pageNo: '1',
|
|
139
|
-
total: '',
|
|
140
|
-
indexIn: '',
|
|
141
|
-
rowKeys: 'fileCode',
|
|
142
|
-
row_Key: 'row[this.rowKeys]',
|
|
143
|
-
folderCode: '',
|
|
144
|
-
diaVisible: false,
|
|
145
|
-
picType: this.imgType || 'jpg/png',
|
|
146
|
-
size: this.num || 1,
|
|
147
|
-
picLimit: this.limit || 1,
|
|
148
|
-
multipleSelection: [],
|
|
149
|
-
checkList: this.fileList || [],
|
|
150
|
-
folderList: [],
|
|
151
|
-
newfolderList: [],
|
|
152
|
-
imgList: [],
|
|
153
|
-
otherData: {
|
|
154
|
-
tenantCode: '00000001',
|
|
155
|
-
filePcode: '',
|
|
156
|
-
fileSort: this.fileSort,
|
|
157
|
-
},
|
|
158
|
-
tenantCode: '',
|
|
159
|
-
fileCode: '',
|
|
160
|
-
proappEnvLayout: '',
|
|
161
|
-
uploading: [], //正在上传的文件集合
|
|
162
|
-
};
|
|
163
|
-
},
|
|
164
|
-
create() {},
|
|
165
|
-
mounted() {},
|
|
166
|
-
activated() {
|
|
167
|
-
// console.log('组件被激活了');
|
|
168
|
-
this.proappEnvLayout = JSON.parse(sessionStorage.getItem('proappEnvLayout'));
|
|
169
|
-
if (this.proappEnvLayout.tenantCode) {
|
|
170
|
-
this.tenantCode = JSON.parse(this.proappEnvLayout.tenantCode);
|
|
171
|
-
}
|
|
172
|
-
this.getImgListData();
|
|
173
|
-
},
|
|
174
|
-
methods: {
|
|
175
|
-
handleSelectionChange(data) {
|
|
176
|
-
console.log(data, '选中的值');
|
|
177
|
-
this.multipleSelection = data;
|
|
178
|
-
},
|
|
179
|
-
clickRow(row) {
|
|
180
|
-
this.$refs.multipleTable.toggleRowSelection(row);
|
|
181
|
-
},
|
|
182
|
-
handleSizeChange(val) {
|
|
183
|
-
//分页
|
|
184
|
-
this.pageSize = val;
|
|
185
|
-
this.getImgListData();
|
|
186
|
-
},
|
|
187
|
-
handleCurrentChange(val) {
|
|
188
|
-
this.pageNo = val;
|
|
189
|
-
this.getImgListData();
|
|
190
|
-
},
|
|
191
|
-
clickFolder(code, i) {
|
|
192
|
-
this.folderCode = code;
|
|
193
|
-
this.indexIn = i + 1;
|
|
194
|
-
this.pageNo = 1;
|
|
195
|
-
// console.log(code, 'code');
|
|
196
|
-
this.getImgListData();
|
|
197
|
-
},
|
|
198
|
-
getImgListData() {
|
|
199
|
-
let data = {
|
|
200
|
-
rows: this.pageSize,
|
|
201
|
-
page: this.pageNo,
|
|
202
|
-
fileCtype: 'png,jpg',
|
|
203
|
-
ownFlag: 1,
|
|
204
|
-
};
|
|
205
|
-
if (!this.ruleForm.fileRemark) {
|
|
206
|
-
delete data.fileRemark;
|
|
207
|
-
} else {
|
|
208
|
-
data.fileRemark = this.ruleForm.fileRemark;
|
|
209
|
-
}
|
|
210
|
-
if (!this.ruleForm.fileSort) {
|
|
211
|
-
delete data.fileSort;
|
|
212
|
-
} else {
|
|
213
|
-
data.fileSort = this.ruleForm.fileSort;
|
|
214
|
-
}
|
|
215
|
-
if (!this.folderCode) {
|
|
216
|
-
delete data.filePcode;
|
|
217
|
-
} else {
|
|
218
|
-
data.filePcode = this.folderCode;
|
|
219
|
-
}
|
|
220
|
-
API.queryFilePage(querystring.stringify(data)).then((res) => {
|
|
221
|
-
// console.log(res.rows);
|
|
222
|
-
res.list.map((vl) => {
|
|
223
|
-
if (!vl.fileUrl) {
|
|
224
|
-
vl.fileUrl = '';
|
|
225
|
-
} else if (vl.fileUrl && vl.fileUrl.indexOf('http') > -1) {
|
|
226
|
-
vl.fileUrl = vl.fileUrl;
|
|
227
|
-
} else {
|
|
228
|
-
vl.fileUrl = process.env.API_ROOT + '/paas/shop/' + vl.fileUrl;
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
this.imgList = res.list;
|
|
232
|
-
this.total = res.total;
|
|
233
|
-
|
|
234
|
-
this.getFolderListData();
|
|
235
|
-
++this.count;
|
|
236
|
-
});
|
|
237
|
-
},
|
|
238
|
-
getFolderListData() {
|
|
239
|
-
let data = {
|
|
240
|
-
fileCtype: 'folder',
|
|
241
|
-
ownFlag: 1,
|
|
242
|
-
};
|
|
243
|
-
if (!this.ruleForm.fileSort) {
|
|
244
|
-
delete data.fileSort;
|
|
245
|
-
} else {
|
|
246
|
-
data.fileSort = this.ruleForm.fileSort;
|
|
247
|
-
}
|
|
248
|
-
API.queryFilePage(querystring.stringify(data)).then((res) => {
|
|
249
|
-
// console.log(res.rows);
|
|
250
|
-
this.folderList = [];
|
|
251
|
-
|
|
252
|
-
this.folderList = res.list;
|
|
253
|
-
});
|
|
254
|
-
},
|
|
255
|
-
closed() {
|
|
256
|
-
this.diaVisible = false;
|
|
257
|
-
this.multipleSelection = this.fileList;
|
|
258
|
-
},
|
|
259
|
-
handelClose() {
|
|
260
|
-
this.multipleSelection = this.fileList;
|
|
261
|
-
if (this.imgList.length > 0) {
|
|
262
|
-
this.$refs.multipleTable.clearSelection();
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
this.fileUrl = '';
|
|
266
|
-
this.$refs.picUpload.abort();
|
|
267
|
-
this.uploading = [];
|
|
268
|
-
this.$emit('toggle', false);
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
beforeAvatarUpload(file) {
|
|
272
|
-
// console.log(this.size, 'file', this.beforeAvatarUpload);
|
|
273
|
-
//上传之前的回调
|
|
274
|
-
const fileType = /\.(jpg|jpeg|png|JPG|PNG)$/.test(file.name.toLowerCase());
|
|
275
|
-
if (!fileType) {
|
|
276
|
-
this.$message.error('图片格式为常见的jpg、png格式!');
|
|
277
|
-
}
|
|
278
|
-
const isLt2M = file.size / 1024 / 1024 < this.size;
|
|
279
|
-
if (!isLt2M) {
|
|
280
|
-
this.$message.error('上传的图片大小不能超过' + this.size + 'MB!');
|
|
281
|
-
}
|
|
282
|
-
if (isLt2M && fileType) {
|
|
283
|
-
this.uploading.push(file.uid);
|
|
284
|
-
}
|
|
285
|
-
return isLt2M && fileType;
|
|
286
|
-
},
|
|
287
|
-
|
|
288
|
-
handelSuccess(res, file, files) {
|
|
289
|
-
//文件上传 需要从this.uploading中移除
|
|
290
|
-
let index = this.uploading.indexOf(file.uid);
|
|
291
|
-
this.uploading.splice(index, 1);
|
|
292
|
-
// console.log(res, file, files, 'efrej');
|
|
293
|
-
|
|
294
|
-
this.multipleSelection.push({
|
|
295
|
-
name: res.fileName,
|
|
296
|
-
url: res.fileUrl,
|
|
297
|
-
goodsFileUrl: res.fileUrl,
|
|
298
|
-
goodsFileType: '0',
|
|
299
|
-
goodsFileSort: 'image',
|
|
300
|
-
goodsFileName: res.fileCode,
|
|
301
|
-
fileCode: res.fileCode,
|
|
302
|
-
status: 'success',
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
this.getImgListData();
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
changeFile() {
|
|
309
|
-
this.$refs.picUpload.$refs['upload-inner'].$el.dispatchEvent(new MouseEvent('click'));
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
setFileList() {
|
|
313
|
-
let nList = [];
|
|
314
|
-
this.multipleSelection.map((res) => {
|
|
315
|
-
nList.push({
|
|
316
|
-
name: res.fileName,
|
|
317
|
-
url: res.fileUrl,
|
|
318
|
-
goodsFileUrl: res.fileUrl,
|
|
319
|
-
goodsFileType: '0',
|
|
320
|
-
goodsFileSort: 'image',
|
|
321
|
-
goodsFileName: res.fileCode,
|
|
322
|
-
fileCode: res.fileCode,
|
|
323
|
-
status: 'success',
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
console.log(this.uploading, 'uploading');
|
|
327
|
-
if (this.uploading.length > 0) {
|
|
328
|
-
this.$confirm('请确认所有文件都上传完成,继续操作会移除正在上传的文件!', '提示', {
|
|
329
|
-
confirmButtonText: '确定',
|
|
330
|
-
cancelButtonText: '取消',
|
|
331
|
-
// type: "warning"
|
|
332
|
-
})
|
|
333
|
-
.then(() => {
|
|
334
|
-
this.$refs.picUpload.abort();
|
|
335
|
-
if (this.picLimit < this.multipleSelection.length) {
|
|
336
|
-
//判断条件
|
|
337
|
-
this.$message.error('超出最大限制张数');
|
|
338
|
-
this.$emit('setFileList', nList.slice(0, this.picLimit));
|
|
339
|
-
return false;
|
|
340
|
-
} else {
|
|
341
|
-
this.$emit('setFileList', nList);
|
|
342
|
-
this.disables = true;
|
|
343
|
-
this.diaVisible = false;
|
|
344
|
-
}
|
|
345
|
-
})
|
|
346
|
-
.catch(() => {});
|
|
347
|
-
} else {
|
|
348
|
-
if (this.picLimit < this.multipleSelection.length) {
|
|
349
|
-
//判断条件
|
|
350
|
-
|
|
351
|
-
this.$emit('setFileList', nList.slice(0, this.picLimit));
|
|
352
|
-
this.$message.error('超出最大限制张数');
|
|
353
|
-
return false;
|
|
354
|
-
} else {
|
|
355
|
-
this.$emit('setFileList', nList);
|
|
356
|
-
this.disables = true;
|
|
357
|
-
|
|
358
|
-
this.diaVisible = false;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
// 去重
|
|
363
|
-
unique(arr) {
|
|
364
|
-
var result = [],
|
|
365
|
-
hash = {};
|
|
366
|
-
for (var i = 0, elem; (elem = arr[i]) != null; i++) {
|
|
367
|
-
if (!hash[elem]) {
|
|
368
|
-
result.push(elem);
|
|
369
|
-
hash[elem] = true;
|
|
370
|
-
// console.log(hash);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return result;
|
|
374
|
-
},
|
|
375
|
-
toggleRowSelection() {
|
|
376
|
-
console.log(this.checkList, '选中显示');
|
|
377
|
-
if (this.checkList.length > 0) {
|
|
378
|
-
var showIdList = this.checkList.map((item) => {
|
|
379
|
-
if (!item.goodsFileUrl) {
|
|
380
|
-
item.goodsFileUrl = item.fileUrl;
|
|
381
|
-
}
|
|
382
|
-
if (item.goodsFileUrl.lastIndexOf('/') > -1) {
|
|
383
|
-
let start = item.goodsFileUrl.lastIndexOf('/');
|
|
384
|
-
item.fileUrlsplit = item.goodsFileUrl.substring(start + 1, item.goodsFileUrl.length);
|
|
385
|
-
return item.fileUrlsplit;
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
if (this.imgList.length > 0) {
|
|
390
|
-
this.imgList.forEach((item) => {
|
|
391
|
-
if (item.fileUrl.lastIndexOf('/') > -1) {
|
|
392
|
-
let start = item.fileUrl.lastIndexOf('/');
|
|
393
|
-
item.fileUrlsplit = item.fileUrl.substring(start + 1, item.fileUrl.length);
|
|
394
|
-
|
|
395
|
-
if (showIdList.indexOf(item.fileUrlsplit) > -1) {
|
|
396
|
-
this.$refs.multipleTable.toggleRowSelection(item, true);
|
|
397
|
-
} else {
|
|
398
|
-
this.$refs.multipleTable.toggleRowSelection(item, false);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
} else {
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
},
|
|
407
|
-
|
|
408
|
-
watch: {
|
|
409
|
-
visible() {
|
|
410
|
-
this.diaVisible = this.visible;
|
|
411
|
-
this.pageNo = 1;
|
|
412
|
-
if (this.visible) {
|
|
413
|
-
this.disables = false;
|
|
414
|
-
|
|
415
|
-
this.otherData = {
|
|
416
|
-
tenantCode: this.tenantCode || '00000001',
|
|
417
|
-
filePcode: this.folderCode,
|
|
418
|
-
fileSort: this.fileSort,
|
|
419
|
-
};
|
|
420
|
-
this.checkList = [];
|
|
421
|
-
if (Array.isArray(this.fileList) && this.fileList.length > 0) {
|
|
422
|
-
this.fileList.map((el) => {
|
|
423
|
-
el.fileCode = el.goodsFileName ? el.goodsFileName : '';
|
|
424
|
-
|
|
425
|
-
el.fileUrl = el.goodsFileUrl;
|
|
426
|
-
});
|
|
427
|
-
this.checkList = this.fileList;
|
|
428
|
-
}
|
|
429
|
-
this.getImgListData();
|
|
430
|
-
|
|
431
|
-
this.$nextTick(() => {
|
|
432
|
-
this.$refs.picUpload.$refs['upload-inner'].$el.style.display = 'none';
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
if (this.type && this.type == '1') {
|
|
436
|
-
this.title = '选择文件';
|
|
437
|
-
} else {
|
|
438
|
-
this.title = '选择图片';
|
|
439
|
-
}
|
|
440
|
-
},
|
|
441
|
-
limit() {
|
|
442
|
-
this.picLimit = this.limit || 1;
|
|
443
|
-
},
|
|
444
|
-
count(val, oldVal) {
|
|
445
|
-
this.otherData = {
|
|
446
|
-
tenantCode: this.tenantCode || '00000001',
|
|
447
|
-
filePcode: this.folderCode,
|
|
448
|
-
fileSort: this.ruleForm.fileSort,
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
this.$nextTick(() => {
|
|
452
|
-
this.toggleRowSelection();
|
|
453
|
-
});
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
};
|
|
457
|
-
</script>
|
|
458
|
-
|
|
459
|
-
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
460
|
-
.pic-div /deep/ .el-upload-list {
|
|
461
|
-
display: none !important;
|
|
462
|
-
}
|
|
463
|
-
p.overtext {
|
|
464
|
-
overflow: hidden;
|
|
465
|
-
white-space: nowrap;
|
|
466
|
-
|
|
467
|
-
text-overflow: ellipsis;
|
|
468
|
-
}
|
|
469
|
-
.folder {
|
|
470
|
-
text-align: center;
|
|
471
|
-
cursor: default;
|
|
472
|
-
i {
|
|
473
|
-
font-size: 65px;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
.color-gary {
|
|
477
|
-
color: #575555;
|
|
478
|
-
}
|
|
479
|
-
.images {
|
|
480
|
-
img {
|
|
481
|
-
width: 120px;
|
|
482
|
-
height: 120px;
|
|
483
|
-
margin-top: 20px;
|
|
484
|
-
}
|
|
485
|
-
.imgsList {
|
|
486
|
-
.el-table /deep/ tr {
|
|
487
|
-
margin: 10px;
|
|
488
|
-
float: left;
|
|
489
|
-
width: 160px;
|
|
490
|
-
padding: 0 10px;
|
|
491
|
-
border: 1px solid #ddd !important;
|
|
492
|
-
position: relative;
|
|
493
|
-
}
|
|
494
|
-
.el-table /deep/ tr .el-table-column--selection {
|
|
495
|
-
position: absolute;
|
|
496
|
-
top: 0;
|
|
497
|
-
left: 10px;
|
|
498
|
-
border: none;
|
|
499
|
-
}
|
|
500
|
-
.el-table /deep/ .has-gutter {
|
|
501
|
-
display: none;
|
|
502
|
-
}
|
|
503
|
-
.el-table /deep/ .el-table__body tbody {
|
|
504
|
-
display: flex;
|
|
505
|
-
flex-wrap: wrap;
|
|
506
|
-
width: 930px;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
.folderLists {
|
|
512
|
-
}
|
|
513
|
-
.dialog-form {
|
|
514
|
-
width: 100%;
|
|
515
|
-
box-sizing: border-box;
|
|
516
|
-
padding-left: 20px;
|
|
517
|
-
.dialog-form-item {
|
|
518
|
-
width: 100% !important;
|
|
519
|
-
margin-left: 0 !important;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
.el-dialog {
|
|
523
|
-
border-radius: 6px;
|
|
524
|
-
}
|
|
525
|
-
.file-btn {
|
|
526
|
-
position: relative;
|
|
527
|
-
overflow: hidden;
|
|
528
|
-
}
|
|
529
|
-
.file-input {
|
|
530
|
-
display: none;
|
|
531
|
-
}
|
|
532
|
-
.cor-red {
|
|
533
|
-
color: #ff0000;
|
|
534
|
-
}
|
|
535
|
-
.otheritem {
|
|
536
|
-
text-overflow: -o-ellipsis-lastline;
|
|
537
|
-
overflow: hidden;
|
|
538
|
-
text-overflow: ellipsis;
|
|
539
|
-
display: -webkit-box;
|
|
540
|
-
-webkit-line-clamp: 2;
|
|
541
|
-
-webkit-box-orient: vertical;
|
|
542
|
-
}
|
|
543
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog :title="title" width="1000px" :append-to-body="true" :visible.sync="diaVisible" @close="handelClose">
|
|
3
|
+
<!-- 点击上传弹出的第一个框 -->
|
|
4
|
+
<el-form class="dialog-form" v-if="!type || type == '0'">
|
|
5
|
+
<el-form-item label="上传本地图片" class="dialog-form-item">
|
|
6
|
+
<el-button type="primary" class="file-btn" @click="changeFile">添加图片</el-button>
|
|
7
|
+
<span class="el-upload__tip cor-red">只能上传{{ picType }}{{ !type || type == '0' ? '图片' : '文件' }},且不超过{{ num || 1 }}M,最多上传{{ picLimit }}张</span>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
</el-form>
|
|
10
|
+
<el-form :inline="true" class="demo-form-inline" :model="ruleForm" label-width="80px" label-position="left">
|
|
11
|
+
<el-form-item label="图片类型">
|
|
12
|
+
<el-select v-model="ruleForm.fileSort" clearable placeholder="请选择图片类型">
|
|
13
|
+
<!-- <el-option label="全部" value=""></el-option> -->
|
|
14
|
+
<el-option label="商品图片" value="FILE_GD"></el-option>
|
|
15
|
+
<el-option label="店铺图片" value="FILE_02"></el-option>
|
|
16
|
+
</el-select>
|
|
17
|
+
</el-form-item>
|
|
18
|
+
<el-form-item label="名称">
|
|
19
|
+
<el-input v-model="ruleForm.fileRemark" clearable></el-input>
|
|
20
|
+
</el-form-item>
|
|
21
|
+
<el-form-item>
|
|
22
|
+
<el-button type="primary" @click="getImgListData">查询</el-button>
|
|
23
|
+
</el-form-item>
|
|
24
|
+
</el-form>
|
|
25
|
+
|
|
26
|
+
<el-row>
|
|
27
|
+
<el-col :span="2" class="folder">
|
|
28
|
+
<div @click="clickFolder('', -1)" :class="indexIn == 0 ? 'c-theme' : 'color-gary'">
|
|
29
|
+
<i class="icon iconfont icon-wenjianjia"></i>
|
|
30
|
+
<p class="overtext">全部</p>
|
|
31
|
+
</div>
|
|
32
|
+
</el-col>
|
|
33
|
+
<el-col :span="2" v-for="(item, i) in folderList" :key="i" class="folder">
|
|
34
|
+
<div @click="clickFolder(item.fileCode, i)" :class="indexIn === i + 1 ? 'c-theme' : 'color-gary'">
|
|
35
|
+
<i class="icon iconfont icon-wenjianjia"></i>
|
|
36
|
+
<p class="overtext">{{ item.fileName }}</p>
|
|
37
|
+
</div>
|
|
38
|
+
</el-col>
|
|
39
|
+
</el-row>
|
|
40
|
+
<el-row style="margin-top: 20px" class="images">
|
|
41
|
+
<div class="imgsList images">
|
|
42
|
+
<!-- <el-row> -->
|
|
43
|
+
<el-table
|
|
44
|
+
v-if="imgList.length > 0"
|
|
45
|
+
ref="multipleTable"
|
|
46
|
+
:data="imgList"
|
|
47
|
+
tooltip-effect="dark"
|
|
48
|
+
style="width: 100%"
|
|
49
|
+
:empty-text="'暂无图片'"
|
|
50
|
+
:row-key="
|
|
51
|
+
(row) => {
|
|
52
|
+
return row.fileCode;
|
|
53
|
+
}
|
|
54
|
+
"
|
|
55
|
+
@row-click="clickRow"
|
|
56
|
+
@selection-change="handleSelectionChange"
|
|
57
|
+
>
|
|
58
|
+
<!-- <el-col :span='4'> -->
|
|
59
|
+
<el-table-column :reserve-selection="true" type="selection" width="55"> </el-table-column>
|
|
60
|
+
<el-table-column width="120">
|
|
61
|
+
<template slot-scope="scope">
|
|
62
|
+
<img v-lazy="scope.row.fileUrl" />
|
|
63
|
+
<p class="otheritem" style="text-align: center">{{ scope.row.fileRemark }}</p>
|
|
64
|
+
</template>
|
|
65
|
+
</el-table-column>
|
|
66
|
+
<!-- </el-col> -->
|
|
67
|
+
</el-table>
|
|
68
|
+
<!-- </el-row> -->
|
|
69
|
+
</div>
|
|
70
|
+
</el-row>
|
|
71
|
+
<div class="block">
|
|
72
|
+
<el-pagination
|
|
73
|
+
@size-change="handleSizeChange"
|
|
74
|
+
@current-change="handleCurrentChange"
|
|
75
|
+
style="margin-top: 20px"
|
|
76
|
+
:current-page="pageNo"
|
|
77
|
+
:page-sizes="[10, 20, 30, 40]"
|
|
78
|
+
:page-size="pageSize"
|
|
79
|
+
layout="total, sizes, prev, pager, next"
|
|
80
|
+
:total="total"
|
|
81
|
+
></el-pagination>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="file-list">
|
|
84
|
+
<el-upload
|
|
85
|
+
ref="picUpload"
|
|
86
|
+
class="pic-div"
|
|
87
|
+
:action="fileUploadUrl"
|
|
88
|
+
:data="otherData"
|
|
89
|
+
:before-upload="beforeAvatarUpload"
|
|
90
|
+
:on-success="handelSuccess"
|
|
91
|
+
:with-credentials="true"
|
|
92
|
+
:show-file-list="false"
|
|
93
|
+
:multiple="multiple"
|
|
94
|
+
></el-upload>
|
|
95
|
+
<!-- :on-remove="handleRemove"
|
|
96
|
+
list-type="picture-card"
|
|
97
|
+
:show-file-list="false" -->
|
|
98
|
+
</div>
|
|
99
|
+
<div slot="footer" class="dialog-footer">
|
|
100
|
+
<el-button @click="closed">取消</el-button>
|
|
101
|
+
<el-button type="primary" @click="setFileList" :disabled="disables">确定</el-button>
|
|
102
|
+
</div>
|
|
103
|
+
</el-dialog>
|
|
104
|
+
</template>
|
|
105
|
+
<script>
|
|
106
|
+
import API from '#/api/common';
|
|
107
|
+
import { Loading } from 'element-ui';
|
|
108
|
+
import { validateURL } from '#/utils/validate';
|
|
109
|
+
const querystring = require('querystring');
|
|
110
|
+
export default {
|
|
111
|
+
props: {
|
|
112
|
+
fileList: Array,
|
|
113
|
+
type: String,
|
|
114
|
+
fileSort: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: 'FILE_GD',
|
|
117
|
+
},
|
|
118
|
+
limit: Number,
|
|
119
|
+
visible: Boolean,
|
|
120
|
+
imgType: String,
|
|
121
|
+
num: Number,
|
|
122
|
+
multiple: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false,
|
|
125
|
+
},
|
|
126
|
+
fileUploadUrl: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: process.env.API_ROOT + '/web/rs/resourceBase/uploadGoodsFiles.json',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
data() {
|
|
132
|
+
return {
|
|
133
|
+
count: '0',
|
|
134
|
+
disables: false,
|
|
135
|
+
ruleForm: { fileRemark: '', fileSort: this.fileSort },
|
|
136
|
+
title: '选择图片',
|
|
137
|
+
pageSize: '10',
|
|
138
|
+
pageNo: '1',
|
|
139
|
+
total: '',
|
|
140
|
+
indexIn: '',
|
|
141
|
+
rowKeys: 'fileCode',
|
|
142
|
+
row_Key: 'row[this.rowKeys]',
|
|
143
|
+
folderCode: '',
|
|
144
|
+
diaVisible: false,
|
|
145
|
+
picType: this.imgType || 'jpg/png',
|
|
146
|
+
size: this.num || 1,
|
|
147
|
+
picLimit: this.limit || 1,
|
|
148
|
+
multipleSelection: [],
|
|
149
|
+
checkList: this.fileList || [],
|
|
150
|
+
folderList: [],
|
|
151
|
+
newfolderList: [],
|
|
152
|
+
imgList: [],
|
|
153
|
+
otherData: {
|
|
154
|
+
tenantCode: '00000001',
|
|
155
|
+
filePcode: '',
|
|
156
|
+
fileSort: this.fileSort,
|
|
157
|
+
},
|
|
158
|
+
tenantCode: '',
|
|
159
|
+
fileCode: '',
|
|
160
|
+
proappEnvLayout: '',
|
|
161
|
+
uploading: [], //正在上传的文件集合
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
create() {},
|
|
165
|
+
mounted() {},
|
|
166
|
+
activated() {
|
|
167
|
+
// console.log('组件被激活了');
|
|
168
|
+
this.proappEnvLayout = JSON.parse(sessionStorage.getItem('proappEnvLayout'));
|
|
169
|
+
if (this.proappEnvLayout.tenantCode) {
|
|
170
|
+
this.tenantCode = JSON.parse(this.proappEnvLayout.tenantCode);
|
|
171
|
+
}
|
|
172
|
+
this.getImgListData();
|
|
173
|
+
},
|
|
174
|
+
methods: {
|
|
175
|
+
handleSelectionChange(data) {
|
|
176
|
+
console.log(data, '选中的值');
|
|
177
|
+
this.multipleSelection = data;
|
|
178
|
+
},
|
|
179
|
+
clickRow(row) {
|
|
180
|
+
this.$refs.multipleTable.toggleRowSelection(row);
|
|
181
|
+
},
|
|
182
|
+
handleSizeChange(val) {
|
|
183
|
+
//分页
|
|
184
|
+
this.pageSize = val;
|
|
185
|
+
this.getImgListData();
|
|
186
|
+
},
|
|
187
|
+
handleCurrentChange(val) {
|
|
188
|
+
this.pageNo = val;
|
|
189
|
+
this.getImgListData();
|
|
190
|
+
},
|
|
191
|
+
clickFolder(code, i) {
|
|
192
|
+
this.folderCode = code;
|
|
193
|
+
this.indexIn = i + 1;
|
|
194
|
+
this.pageNo = 1;
|
|
195
|
+
// console.log(code, 'code');
|
|
196
|
+
this.getImgListData();
|
|
197
|
+
},
|
|
198
|
+
getImgListData() {
|
|
199
|
+
let data = {
|
|
200
|
+
rows: this.pageSize,
|
|
201
|
+
page: this.pageNo,
|
|
202
|
+
fileCtype: 'png,jpg',
|
|
203
|
+
ownFlag: 1,
|
|
204
|
+
};
|
|
205
|
+
if (!this.ruleForm.fileRemark) {
|
|
206
|
+
delete data.fileRemark;
|
|
207
|
+
} else {
|
|
208
|
+
data.fileRemark = this.ruleForm.fileRemark;
|
|
209
|
+
}
|
|
210
|
+
if (!this.ruleForm.fileSort) {
|
|
211
|
+
delete data.fileSort;
|
|
212
|
+
} else {
|
|
213
|
+
data.fileSort = this.ruleForm.fileSort;
|
|
214
|
+
}
|
|
215
|
+
if (!this.folderCode) {
|
|
216
|
+
delete data.filePcode;
|
|
217
|
+
} else {
|
|
218
|
+
data.filePcode = this.folderCode;
|
|
219
|
+
}
|
|
220
|
+
API.queryFilePage(querystring.stringify(data)).then((res) => {
|
|
221
|
+
// console.log(res.rows);
|
|
222
|
+
res.list.map((vl) => {
|
|
223
|
+
if (!vl.fileUrl) {
|
|
224
|
+
vl.fileUrl = '';
|
|
225
|
+
} else if (vl.fileUrl && vl.fileUrl.indexOf('http') > -1) {
|
|
226
|
+
vl.fileUrl = vl.fileUrl;
|
|
227
|
+
} else {
|
|
228
|
+
vl.fileUrl = process.env.API_ROOT + '/paas/shop/' + vl.fileUrl;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
this.imgList = res.list;
|
|
232
|
+
this.total = res.total;
|
|
233
|
+
|
|
234
|
+
this.getFolderListData();
|
|
235
|
+
++this.count;
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
getFolderListData() {
|
|
239
|
+
let data = {
|
|
240
|
+
fileCtype: 'folder',
|
|
241
|
+
ownFlag: 1,
|
|
242
|
+
};
|
|
243
|
+
if (!this.ruleForm.fileSort) {
|
|
244
|
+
delete data.fileSort;
|
|
245
|
+
} else {
|
|
246
|
+
data.fileSort = this.ruleForm.fileSort;
|
|
247
|
+
}
|
|
248
|
+
API.queryFilePage(querystring.stringify(data)).then((res) => {
|
|
249
|
+
// console.log(res.rows);
|
|
250
|
+
this.folderList = [];
|
|
251
|
+
|
|
252
|
+
this.folderList = res.list;
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
closed() {
|
|
256
|
+
this.diaVisible = false;
|
|
257
|
+
this.multipleSelection = this.fileList;
|
|
258
|
+
},
|
|
259
|
+
handelClose() {
|
|
260
|
+
this.multipleSelection = this.fileList;
|
|
261
|
+
if (this.imgList.length > 0) {
|
|
262
|
+
this.$refs.multipleTable.clearSelection();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
this.fileUrl = '';
|
|
266
|
+
this.$refs.picUpload.abort();
|
|
267
|
+
this.uploading = [];
|
|
268
|
+
this.$emit('toggle', false);
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
beforeAvatarUpload(file) {
|
|
272
|
+
// console.log(this.size, 'file', this.beforeAvatarUpload);
|
|
273
|
+
//上传之前的回调
|
|
274
|
+
const fileType = /\.(jpg|jpeg|png|JPG|PNG)$/.test(file.name.toLowerCase());
|
|
275
|
+
if (!fileType) {
|
|
276
|
+
this.$message.error('图片格式为常见的jpg、png格式!');
|
|
277
|
+
}
|
|
278
|
+
const isLt2M = file.size / 1024 / 1024 < this.size;
|
|
279
|
+
if (!isLt2M) {
|
|
280
|
+
this.$message.error('上传的图片大小不能超过' + this.size + 'MB!');
|
|
281
|
+
}
|
|
282
|
+
if (isLt2M && fileType) {
|
|
283
|
+
this.uploading.push(file.uid);
|
|
284
|
+
}
|
|
285
|
+
return isLt2M && fileType;
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
handelSuccess(res, file, files) {
|
|
289
|
+
//文件上传 需要从this.uploading中移除
|
|
290
|
+
let index = this.uploading.indexOf(file.uid);
|
|
291
|
+
this.uploading.splice(index, 1);
|
|
292
|
+
// console.log(res, file, files, 'efrej');
|
|
293
|
+
|
|
294
|
+
this.multipleSelection.push({
|
|
295
|
+
name: res.fileName,
|
|
296
|
+
url: res.fileUrl,
|
|
297
|
+
goodsFileUrl: res.fileUrl,
|
|
298
|
+
goodsFileType: '0',
|
|
299
|
+
goodsFileSort: 'image',
|
|
300
|
+
goodsFileName: res.fileCode,
|
|
301
|
+
fileCode: res.fileCode,
|
|
302
|
+
status: 'success',
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
this.getImgListData();
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
changeFile() {
|
|
309
|
+
this.$refs.picUpload.$refs['upload-inner'].$el.dispatchEvent(new MouseEvent('click'));
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
setFileList() {
|
|
313
|
+
let nList = [];
|
|
314
|
+
this.multipleSelection.map((res) => {
|
|
315
|
+
nList.push({
|
|
316
|
+
name: res.fileName,
|
|
317
|
+
url: res.fileUrl,
|
|
318
|
+
goodsFileUrl: res.fileUrl,
|
|
319
|
+
goodsFileType: '0',
|
|
320
|
+
goodsFileSort: 'image',
|
|
321
|
+
goodsFileName: res.fileCode,
|
|
322
|
+
fileCode: res.fileCode,
|
|
323
|
+
status: 'success',
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
console.log(this.uploading, 'uploading');
|
|
327
|
+
if (this.uploading.length > 0) {
|
|
328
|
+
this.$confirm('请确认所有文件都上传完成,继续操作会移除正在上传的文件!', '提示', {
|
|
329
|
+
confirmButtonText: '确定',
|
|
330
|
+
cancelButtonText: '取消',
|
|
331
|
+
// type: "warning"
|
|
332
|
+
})
|
|
333
|
+
.then(() => {
|
|
334
|
+
this.$refs.picUpload.abort();
|
|
335
|
+
if (this.picLimit < this.multipleSelection.length) {
|
|
336
|
+
//判断条件
|
|
337
|
+
this.$message.error('超出最大限制张数');
|
|
338
|
+
this.$emit('setFileList', nList.slice(0, this.picLimit));
|
|
339
|
+
return false;
|
|
340
|
+
} else {
|
|
341
|
+
this.$emit('setFileList', nList);
|
|
342
|
+
this.disables = true;
|
|
343
|
+
this.diaVisible = false;
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
.catch(() => {});
|
|
347
|
+
} else {
|
|
348
|
+
if (this.picLimit < this.multipleSelection.length) {
|
|
349
|
+
//判断条件
|
|
350
|
+
|
|
351
|
+
this.$emit('setFileList', nList.slice(0, this.picLimit));
|
|
352
|
+
this.$message.error('超出最大限制张数');
|
|
353
|
+
return false;
|
|
354
|
+
} else {
|
|
355
|
+
this.$emit('setFileList', nList);
|
|
356
|
+
this.disables = true;
|
|
357
|
+
|
|
358
|
+
this.diaVisible = false;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
// 去重
|
|
363
|
+
unique(arr) {
|
|
364
|
+
var result = [],
|
|
365
|
+
hash = {};
|
|
366
|
+
for (var i = 0, elem; (elem = arr[i]) != null; i++) {
|
|
367
|
+
if (!hash[elem]) {
|
|
368
|
+
result.push(elem);
|
|
369
|
+
hash[elem] = true;
|
|
370
|
+
// console.log(hash);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return result;
|
|
374
|
+
},
|
|
375
|
+
toggleRowSelection() {
|
|
376
|
+
console.log(this.checkList, '选中显示');
|
|
377
|
+
if (this.checkList.length > 0) {
|
|
378
|
+
var showIdList = this.checkList.map((item) => {
|
|
379
|
+
if (!item.goodsFileUrl) {
|
|
380
|
+
item.goodsFileUrl = item.fileUrl;
|
|
381
|
+
}
|
|
382
|
+
if (item.goodsFileUrl.lastIndexOf('/') > -1) {
|
|
383
|
+
let start = item.goodsFileUrl.lastIndexOf('/');
|
|
384
|
+
item.fileUrlsplit = item.goodsFileUrl.substring(start + 1, item.goodsFileUrl.length);
|
|
385
|
+
return item.fileUrlsplit;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
if (this.imgList.length > 0) {
|
|
390
|
+
this.imgList.forEach((item) => {
|
|
391
|
+
if (item.fileUrl.lastIndexOf('/') > -1) {
|
|
392
|
+
let start = item.fileUrl.lastIndexOf('/');
|
|
393
|
+
item.fileUrlsplit = item.fileUrl.substring(start + 1, item.fileUrl.length);
|
|
394
|
+
|
|
395
|
+
if (showIdList.indexOf(item.fileUrlsplit) > -1) {
|
|
396
|
+
this.$refs.multipleTable.toggleRowSelection(item, true);
|
|
397
|
+
} else {
|
|
398
|
+
this.$refs.multipleTable.toggleRowSelection(item, false);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
} else {
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
|
|
408
|
+
watch: {
|
|
409
|
+
visible() {
|
|
410
|
+
this.diaVisible = this.visible;
|
|
411
|
+
this.pageNo = 1;
|
|
412
|
+
if (this.visible) {
|
|
413
|
+
this.disables = false;
|
|
414
|
+
|
|
415
|
+
this.otherData = {
|
|
416
|
+
tenantCode: this.tenantCode || '00000001',
|
|
417
|
+
filePcode: this.folderCode,
|
|
418
|
+
fileSort: this.fileSort,
|
|
419
|
+
};
|
|
420
|
+
this.checkList = [];
|
|
421
|
+
if (Array.isArray(this.fileList) && this.fileList.length > 0) {
|
|
422
|
+
this.fileList.map((el) => {
|
|
423
|
+
el.fileCode = el.goodsFileName ? el.goodsFileName : '';
|
|
424
|
+
|
|
425
|
+
el.fileUrl = el.goodsFileUrl;
|
|
426
|
+
});
|
|
427
|
+
this.checkList = this.fileList;
|
|
428
|
+
}
|
|
429
|
+
this.getImgListData();
|
|
430
|
+
|
|
431
|
+
this.$nextTick(() => {
|
|
432
|
+
this.$refs.picUpload.$refs['upload-inner'].$el.style.display = 'none';
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
if (this.type && this.type == '1') {
|
|
436
|
+
this.title = '选择文件';
|
|
437
|
+
} else {
|
|
438
|
+
this.title = '选择图片';
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
limit() {
|
|
442
|
+
this.picLimit = this.limit || 1;
|
|
443
|
+
},
|
|
444
|
+
count(val, oldVal) {
|
|
445
|
+
this.otherData = {
|
|
446
|
+
tenantCode: this.tenantCode || '00000001',
|
|
447
|
+
filePcode: this.folderCode,
|
|
448
|
+
fileSort: this.ruleForm.fileSort,
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
this.$nextTick(() => {
|
|
452
|
+
this.toggleRowSelection();
|
|
453
|
+
});
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
</script>
|
|
458
|
+
|
|
459
|
+
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
460
|
+
.pic-div /deep/ .el-upload-list {
|
|
461
|
+
display: none !important;
|
|
462
|
+
}
|
|
463
|
+
p.overtext {
|
|
464
|
+
overflow: hidden;
|
|
465
|
+
white-space: nowrap;
|
|
466
|
+
|
|
467
|
+
text-overflow: ellipsis;
|
|
468
|
+
}
|
|
469
|
+
.folder {
|
|
470
|
+
text-align: center;
|
|
471
|
+
cursor: default;
|
|
472
|
+
i {
|
|
473
|
+
font-size: 65px;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
.color-gary {
|
|
477
|
+
color: #575555;
|
|
478
|
+
}
|
|
479
|
+
.images {
|
|
480
|
+
img {
|
|
481
|
+
width: 120px;
|
|
482
|
+
height: 120px;
|
|
483
|
+
margin-top: 20px;
|
|
484
|
+
}
|
|
485
|
+
.imgsList {
|
|
486
|
+
.el-table /deep/ tr {
|
|
487
|
+
margin: 10px;
|
|
488
|
+
float: left;
|
|
489
|
+
width: 160px;
|
|
490
|
+
padding: 0 10px;
|
|
491
|
+
border: 1px solid #ddd !important;
|
|
492
|
+
position: relative;
|
|
493
|
+
}
|
|
494
|
+
.el-table /deep/ tr .el-table-column--selection {
|
|
495
|
+
position: absolute;
|
|
496
|
+
top: 0;
|
|
497
|
+
left: 10px;
|
|
498
|
+
border: none;
|
|
499
|
+
}
|
|
500
|
+
.el-table /deep/ .has-gutter {
|
|
501
|
+
display: none;
|
|
502
|
+
}
|
|
503
|
+
.el-table /deep/ .el-table__body tbody {
|
|
504
|
+
display: flex;
|
|
505
|
+
flex-wrap: wrap;
|
|
506
|
+
width: 930px;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.folderLists {
|
|
512
|
+
}
|
|
513
|
+
.dialog-form {
|
|
514
|
+
width: 100%;
|
|
515
|
+
box-sizing: border-box;
|
|
516
|
+
padding-left: 20px;
|
|
517
|
+
.dialog-form-item {
|
|
518
|
+
width: 100% !important;
|
|
519
|
+
margin-left: 0 !important;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
.el-dialog {
|
|
523
|
+
border-radius: 6px;
|
|
524
|
+
}
|
|
525
|
+
.file-btn {
|
|
526
|
+
position: relative;
|
|
527
|
+
overflow: hidden;
|
|
528
|
+
}
|
|
529
|
+
.file-input {
|
|
530
|
+
display: none;
|
|
531
|
+
}
|
|
532
|
+
.cor-red {
|
|
533
|
+
color: #ff0000;
|
|
534
|
+
}
|
|
535
|
+
.otheritem {
|
|
536
|
+
text-overflow: -o-ellipsis-lastline;
|
|
537
|
+
overflow: hidden;
|
|
538
|
+
text-overflow: ellipsis;
|
|
539
|
+
display: -webkit-box;
|
|
540
|
+
-webkit-line-clamp: 2;
|
|
541
|
+
-webkit-box-orient: vertical;
|
|
542
|
+
}
|
|
543
|
+
</style>
|