commit
85d87e57c1
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "es6",
|
||||||
|
"target": "es2017",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"@JS/*": ["./resources/js/*"],
|
||||||
|
"@Global/*": ["./resources/js/Global/*"],
|
||||||
|
"@Home/*": ["./resources/js/Home/*"],
|
||||||
|
"@CRM/*": ["./modules/wm-crm/resources/js/*"],
|
||||||
|
"@Common/*": ["./modules/wm-common/resources/js/*"],
|
||||||
|
"@Core/*": ["./modules/wm-core/resources/js/*"],
|
||||||
|
"@User/*": ["./modules/wm-core/resources/js/Modules/User/*"],
|
||||||
|
"@Auth/*": ["./modules/wm-core/resources/js/Modules/Authentication/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=69a485a398e10ecf1480",
|
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=ef1264c79c4715437c5f",
|
||||||
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=7afee120275aa1ba59cf",
|
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=effcde9e131519164ea0",
|
||||||
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=c369ba53a87cf86d69ee",
|
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=f672b310d08bd18def06",
|
||||||
"/js/vue/User/app.js": "/js/vue/User/app.js?id=5b6de9215672f63f22ce"
|
"/js/vue/User/app.js": "/js/vue/User/app.js?id=f8e9ae158d99d0712bd3"
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<vue-dropzone ref="myVueDropzone" id="dropzone" :destroyDropzone="false" @vdropzone-sending="setParams" @vdropzone-removed-file="removeFile" :options="dropzoneOptions" @vdropzone-success="responseSuccess"></vue-dropzone>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import vue2Dropzone from 'vue2-dropzone'
|
||||||
|
import { TokenService } from '@Global/services/storage.services'
|
||||||
|
import commonState from '@Global/store/modules/common/state';
|
||||||
|
import { url } from '@Common/mixins/urls';
|
||||||
|
import axios from 'axios';
|
||||||
|
import 'vue2-dropzone/dist/vue2Dropzone.min.css'
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
defaultMessage: { default: "<i class='fa fa-cloud-upload'></i>آپلود فایل" },
|
||||||
|
files: {default:() => ([])},
|
||||||
|
batch_id: { required: true, type: String }
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
vueDropzone: vue2Dropzone
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dropzoneOptions: {
|
||||||
|
url: url('storeFile'),
|
||||||
|
thumbnailWidth: 200,
|
||||||
|
headers: { "Authorization": `Bearer ${TokenService.getToken()}`, "Module": `${commonState.current_module}` },
|
||||||
|
addRemoveLinks: true,
|
||||||
|
dictDefaultMessage: this.defaultMessage,
|
||||||
|
sendingMultiple: true,
|
||||||
|
removeType: "server"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
batchId() {
|
||||||
|
return this.batch_id;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
responseSuccess(file, response) {
|
||||||
|
if (response.data && response.data.id) {
|
||||||
|
file['id'] = response.data.id;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
removeFile(file, error, xhr) {
|
||||||
|
if(this.dropzoneOptions.removeType == "server") {
|
||||||
|
axios.delete(url('deleteFile', {file: file.id}));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
manuallyLoadFiles(files) { //file =[ {size: 123, name: "Icon", type: "image/png", url: "https://myvizo.com/img/logo_sm.png"}]
|
||||||
|
if(Array.isArray(files) && files.length) {
|
||||||
|
for (const file of files) {
|
||||||
|
this.$refs.myVueDropzone.manuallyAddFile({name: file.collection_name, type: file.mime_type, id: file.id, size: file.size}, file.address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
manuallyRemoveAllFiles() {
|
||||||
|
this.dropzoneOptions.removeType = "client";
|
||||||
|
this.$refs.myVueDropzone.removeAllFiles();
|
||||||
|
this.dropzoneOptions.removeType = "server";
|
||||||
|
},
|
||||||
|
setParams(file, xhr, formData) {
|
||||||
|
formData.append('batch_id', this.batchId);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
files(files) {
|
||||||
|
this.manuallyRemoveAllFiles();
|
||||||
|
this.manuallyLoadFiles(files);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,10 @@
|
|||||||
|
const makeid = function makeid(length) {
|
||||||
|
var text = "";
|
||||||
|
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
||||||
|
for (var i = 0; i < length; i++)
|
||||||
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
export { makeid };
|
Loading…
Reference in new issue