Commit e4fa0f7e by 前端

Merge branch 'v3.22.0' into 'master'

合并V3.22.0

See merge request !4
2 parents 72203ccf 94d48049
This diff could not be displayed because it is too large.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"glsx-table": "^1.0.3", "glsx-table": "^1.0.3",
"glsx-vue-common": "^2.0.5", "glsx-vue-common": "^2.0.5",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"md5": "^2.3.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"sha1": "^1.1.1", "sha1": "^1.1.1",
......
...@@ -66,6 +66,12 @@ export const menuApi = { ...@@ -66,6 +66,12 @@ export const menuApi = {
deleteMenuApi(data = {}) { deleteMenuApi(data = {}) {
data.method = `${path}menu.deleteMerchantProductMenu` data.method = `${path}menu.deleteMerchantProductMenu`
return request(data, 'post') return request(data, 'post')
},
// 批量导入菜单
buildVersionMenuFunctionNew(data = {}){
data.method = `${path}menu.buildVersionMenuFunctionNew`
return request(data, 'post')
} }
} }
......
...@@ -8,7 +8,9 @@ const request = ( ...@@ -8,7 +8,9 @@ const request = (
params = {}, params = {},
method = RequestMethods.GET, method = RequestMethods.GET,
noSignAttr = [], noSignAttr = [],
url = '' url = '',
isMd5 = false,
isParams=true
) => { ) => {
params.source = 'glsx-oss-merchant-data' params.source = 'glsx-oss-merchant-data'
params.appKey = '48e5e13229b82c1b4e6e8c96151f0637' params.appKey = '48e5e13229b82c1b4e6e8c96151f0637'
...@@ -17,10 +19,18 @@ const request = ( ...@@ -17,10 +19,18 @@ const request = (
params.format = 'json' params.format = 'json'
params.sessionAuth = 'st' params.sessionAuth = 'st'
// params.createBy = this.$get_session_config().user.id // params.createBy = this.$get_session_config().user.id
var data = sign(params, noSignAttr) if (isMd5) {
if (url) { params.app_key = params.appKey
delete params.appKey
// return axios.post(`${url}/router?method=${method}`, qs.stringify(data))
}
var data = isMd5 ? sign(params, noSignAttr, true) : sign(params, noSignAttr)
if (url && isParams) {
return axios.post(`${url}/router?method=${method}`, qs.stringify(data)) return axios.post(`${url}/router?method=${method}`, qs.stringify(data))
} }
if (url && !isParams) {
return axios.post(`${url}/router`, qs.stringify(data))
}
return method === RequestMethods.GET return method === RequestMethods.GET
? GlAxios.get('router', { ? GlAxios.get('router', {
params: sign(params, noSignAttr), params: sign(params, noSignAttr),
......
import sha1 from 'sha1' import sha1 from 'sha1'
import md5 from 'md5'
import qs from 'qs' import qs from 'qs'
import _ from 'lodash' import _ from 'lodash'
const secret = window.location.href.includes('dj.glsx.com.cn') ? '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353' : 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b' const secret = window.location.href.includes('dj.glsx.com.cn') ? '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353' : 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const sign = (params, noSignAttr = []) => { const sign = (params, noSignAttr = [],isMd5) => {
delete params.sign delete params.sign
var objStr = qs.stringify(_.cloneDeep(params), { var objStr = qs.stringify(_.cloneDeep(params), {
arrayFormat: 'indices', arrayFormat: 'indices',
...@@ -30,7 +31,9 @@ const sign = (params, noSignAttr = []) => { ...@@ -30,7 +31,9 @@ const sign = (params, noSignAttr = []) => {
keys.forEach(e => { keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + realObj[e]) !noSignAttr.includes(e) && str.push(e + realObj[e])
}) })
realObj.sign = sha1(secret + str.join('') + secret).toUpperCase() realObj.sign = isMd5
? md5(secret + str.join('') + secret).toUpperCase()
: sha1(secret + str.join('') + secret).toUpperCase()
return realObj return realObj
} }
export default sign export default sign
import request from './request'
import Vue from 'vue'
const uploadApi = {
// 多文件上传接口
multipleUpload(data = {}) {
data.method = 'glsx.accounts.biz.common.pictureUpload'
return request(data, 'glsx.accounts.biz.common.pictureUpload',['file'], Vue.prototype.fileUploadURL,true)
}
}
export { uploadApi }
\ No newline at end of file \ No newline at end of file
// import App from './index.vue' // import App from './index.vue'
import base from '@/base' import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common' import GlsxVueCommon from 'glsx-vue-common'
import Vue from 'vue'
const Apps = require.context('./', false, /\.vue$/) const Apps = require.context('./', false, /\.vue$/)
Apps.keys().map(item => { Apps.keys().map(item => {
...@@ -10,6 +10,7 @@ Apps.keys().map(item => { ...@@ -10,6 +10,7 @@ Apps.keys().map(item => {
vue, vue,
config config
} = data } = data
Vue.prototype.fileUploadURL = config.axios.fileUploadURL
vue.use(GlsxVueCommon, config) vue.use(GlsxVueCommon, config)
base.render(Apps(item).default) base.render(Apps(item).default)
}) })
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
<el-row> <el-row>
<el-col :span="4" style="padding-top: 16px;"> <el-col :span="4" style="padding-top: 16px;">
<el-button icon="el-icon-plus" :size="btn_size" type="primary" @click="handleAdd">创建菜单</el-button> <el-button icon="el-icon-plus" :size="btn_size" type="primary" @click="handleAdd">创建菜单</el-button>
<!-- 新增的导入菜单按钮 -->
<el-button icon="el-icon-plus" :size="btn_size" type="primary" @click="openImportDialog">导入菜单</el-button>
</el-col> </el-col>
<el-col style="text-align: right;" :span="20"> <el-col style="text-align: right;" :span="20">
<glsx-combi-form <glsx-combi-form
...@@ -80,6 +83,32 @@ ...@@ -80,6 +83,32 @@
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</glsx-dialog> </glsx-dialog>
<!-- 导入菜单的弹窗 -->
<glsx-dialog
title="导入菜单"
:isVisible="importDialogVisible"
width="650px"
@closeDialog="closeDialog"
@confirmDialog="importFile"
>
<div class="file-upload-container">
<span class="required-star">*</span>上传文件:
<el-input
v-model="fileName"
placeholder="请选择文件"
readonly
size="middle"
style="display:inline-block; width: calc(100% - 150px);"
></el-input>
<el-button @click="selectFile" type="primary" size="small" style="margin-left:80px;margin-top: 10px;">选择文件</el-button>
<input
type="file"
ref="fileInput"
style="display: none;"
@change="handleFileChange"
>
</div>
</glsx-dialog>
</div> </div>
</template> </template>
...@@ -87,10 +116,14 @@ ...@@ -87,10 +116,14 @@
import _ from 'lodash' import _ from 'lodash'
import SelectTree from '../components/SelectTree' import SelectTree from '../components/SelectTree'
import { menuApi, baseApi } from '@/api/productManage' import { menuApi, baseApi } from '@/api/productManage'
export default { import {uploadApi } from '@/api/upload'
export default {
name: 'menuList', name: 'menuList',
data() { data() {
return { return {
importDialogVisible: false,
fileName: '',
selectedFile: null,
searchForm: { searchForm: {
productIds: [], productIds: [],
menuName: '' menuName: ''
...@@ -265,6 +298,7 @@ export default { ...@@ -265,6 +298,7 @@ export default {
'2': 'accountLevelList', '2': 'accountLevelList',
'4': 'accountRoleList' '4': 'accountRoleList'
}, },
importMenuUrl:'',
editFormData: [ editFormData: [
{ {
label: '产品', label: '产品',
...@@ -456,6 +490,73 @@ export default { ...@@ -456,6 +490,73 @@ export default {
}, },
methods: { methods: {
openImportDialog() {
this.importDialogVisible = true;
},
closeDialog() {
this.importDialogVisible = false;
this.fileName = '';
this.selectedFile = null;
},
selectFile() {
this.$refs.fileInput.click();
},
handleFileChange(event) {
const file = event.target.files[0];
if (file) {
const validFileTypes = ['xlsx', 'xls']; // 允许的文件类型
const fileExt = file.name.split('.').pop().toLowerCase();
if (validFileTypes.includes(fileExt)) {
this.fileName = file.name;
this.selectedFile = file;
const reader = new FileReader();
reader.readAsDataURL(this.selectedFile);
reader.onload = (event) => {
const base64 = event.target.result.split(',')[1];
const fileType = this.selectedFile.name.split('.').pop();
const fileUrl = fileType + '@' + base64
uploadApi.multipleUpload({ file:fileUrl}).then(
(res) => {
console.log(res.status)
if (res.status == 200) {
this.importMenuUrl = res.data.data
}else{
this.$message.error('菜单导入失败,请重试');
}
},
(err) => {
this.$message.error(err);
}
);
};
} else {
this.$message.error('不支持的文件类型');
this.$refs.fileInput.value = ''; // 清除不正确的文件
}
}
},
importFile() {
if (!this.importMenuUrl) {
this.$message.error('请先选择文件');
return;
}
menuApi.buildVersionMenuFunctionNew({ url:this.importMenuUrl}).then(
(res) => {
console.log(res)
if (res.code == '0' && res.data ) {
this.$message.success('菜单导入成功');
this.closeDialog();
} else {
this.$message.error('菜单导入失败,请重试');
}
},
(err) => {
this.$message.error(err);
}
);
},
keyDowmGetList() { keyDowmGetList() {
this.$refs.menuTable.refreshTable() this.$refs.menuTable.refreshTable()
}, },
...@@ -675,4 +776,7 @@ export default { ...@@ -675,4 +776,7 @@ export default {
} }
</script> </script>
<style scoped> <style scoped>
.file-upload-container .required-star {
color: red;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!