优化分盘设置
This commit is contained in:
@@ -27,8 +27,7 @@ export default {
|
|||||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.list {
|
.list {
|
||||||
height: 374px;
|
height: 100%;
|
||||||
max-height: 374px;
|
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
|
|||||||
@@ -245,13 +245,7 @@ export default {
|
|||||||
label: '2024-10-17',
|
label: '2024-10-17',
|
||||||
has_copy_task: false,
|
has_copy_task: false,
|
||||||
has_print_task: false,
|
has_print_task: false,
|
||||||
ass_task: [
|
ass_task: [],
|
||||||
{
|
|
||||||
ass_task_index: 1,
|
|
||||||
task_size: 0,
|
|
||||||
path_file: []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
task_freq: 1
|
task_freq: 1
|
||||||
},
|
},
|
||||||
testForm: {
|
testForm: {
|
||||||
@@ -327,17 +321,7 @@ export default {
|
|||||||
csvIsExist: false,
|
csvIsExist: false,
|
||||||
// 高级设置
|
// 高级设置
|
||||||
setShow: false,
|
setShow: false,
|
||||||
setForm: {
|
setForm: {},
|
||||||
priority: 2,
|
|
||||||
stage: 0,
|
|
||||||
speed: 0,
|
|
||||||
isCheck: true,
|
|
||||||
isDel: true,
|
|
||||||
isClose: true,
|
|
||||||
isArrow: true,
|
|
||||||
isPrint: true,
|
|
||||||
disk: 1
|
|
||||||
},
|
|
||||||
priorityList: [
|
priorityList: [
|
||||||
{
|
{
|
||||||
value: 1,
|
value: 1,
|
||||||
@@ -396,7 +380,17 @@ export default {
|
|||||||
name: '文件修改时间',
|
name: '文件修改时间',
|
||||||
desc: '按照文件修改时间进行升序分盘'
|
desc: '按照文件修改时间进行升序分盘'
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
diskSize: 512*1024*1024
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$store.state.user.setForm': {
|
||||||
|
handler(val) {
|
||||||
|
this.setForm = val
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -538,24 +532,102 @@ export default {
|
|||||||
// this.flag_cont_up = false
|
// this.flag_cont_up = false
|
||||||
},
|
},
|
||||||
// 保存
|
// 保存
|
||||||
workSave() {},
|
workSave() {
|
||||||
|
|
||||||
|
},
|
||||||
// 提交
|
// 提交
|
||||||
workSubmit() {
|
workSubmit() {
|
||||||
let that = this
|
let that = this
|
||||||
const files = this.$refs.files.getLists()
|
const files = this.$refs.files.getLists()
|
||||||
let task_size = 0
|
let fileList = []
|
||||||
for (let key in files) {
|
for (let key in files) {
|
||||||
that.form.ass_task[0].path_file.push(files[key].path)
|
let file = {...files[key]}
|
||||||
task_size+=files[key].size
|
try {
|
||||||
|
const fileStats = fs.statSync(files[key].path);
|
||||||
|
file.mtime = fileStats.mtimeMs
|
||||||
|
fileList.push(file)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error reading file:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
that.form.ass_task[0].task_size = task_size
|
if (that.form.json_file === ''&& fileList.length === 0) {
|
||||||
if (that.form.json_file === ''&& that.form.ass_task[0].path_file.length === 0) {
|
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请上传作业文件',
|
message: '请上传作业文件',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (this.setForm.isArrow) {
|
||||||
|
let overList = []
|
||||||
|
for (let i = 0; i < fileList.length; i++) {
|
||||||
|
if (fileList[i].size > this.diskSize) {
|
||||||
|
overList.push(fileList[i].name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (overList.length) {
|
||||||
|
const fileNames = overList.join(',')
|
||||||
|
this.$notify({
|
||||||
|
message: `文件${fileNames} 大小超过磁盘容量${this.$filterSize(this.diskSize)},请重新选择文件!`,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.setForm.disk === 2) {
|
||||||
|
// 按文件名排序
|
||||||
|
fileList.sort((a, b) => {
|
||||||
|
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1;
|
||||||
|
if (a.name.toLowerCase() > b.name.toLowerCase()) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
} else if (this.setForm.disk === 3) {
|
||||||
|
// 按最后修改时间排序
|
||||||
|
fileList.sort((a, b) => a.mtime - b.mtime);
|
||||||
|
} else {
|
||||||
|
// 按文件大小排序
|
||||||
|
fileList.sort((a, b) => a.size - b.size);
|
||||||
|
}
|
||||||
|
let index = 1
|
||||||
|
let total_size = 0
|
||||||
|
let task = {
|
||||||
|
ass_task_index: index,
|
||||||
|
task_size: 0,
|
||||||
|
path_file: []
|
||||||
|
}
|
||||||
|
for (let i = 0; i < fileList.length; i++) {
|
||||||
|
if (fileList[i].size > this.diskSize) {
|
||||||
|
this.$notify({
|
||||||
|
message: `文件${fileList[i].name} 大小超过设备容量,请重新选择文件!`,
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total_size += fileList[i].size
|
||||||
|
if (total_size > this.diskSize) {
|
||||||
|
that.form.ass_task.push(task)
|
||||||
|
total_size = 0
|
||||||
|
index++
|
||||||
|
task = {
|
||||||
|
ass_task_index: index,
|
||||||
|
task_size: 0,
|
||||||
|
path_file: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
task.path_file.push(fileList[i].path)
|
||||||
|
task.task_size += fileList[i].size
|
||||||
|
if (i === fileList.length - 1) that.form.ass_task.push(task)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let task = {
|
||||||
|
ass_task_index: 1,
|
||||||
|
task_size: 0,
|
||||||
|
path_file: []
|
||||||
|
}
|
||||||
|
for (let i = 0; i < fileList.length; i++) {
|
||||||
|
task.path_file.push(fileList[i].path)
|
||||||
|
task.task_size += fileList[i].size
|
||||||
|
}
|
||||||
|
this.form.ass_task.push(task)
|
||||||
|
}
|
||||||
that.submitLoading = true
|
that.submitLoading = true
|
||||||
that.testForm.req_info = that.form
|
that.testForm.req_info = that.form
|
||||||
console.log(that.form, that.testForm)
|
console.log(that.form, that.testForm)
|
||||||
@@ -740,9 +812,11 @@ export default {
|
|||||||
// 高级设置
|
// 高级设置
|
||||||
setCancel() {
|
setCancel() {
|
||||||
this.setShow = false
|
this.setShow = false
|
||||||
|
this.setForm = this.$store.state.user.setForm
|
||||||
},
|
},
|
||||||
setSure() {
|
setSure() {
|
||||||
this.setShow = false
|
this.setShow = false
|
||||||
|
this.$store.commit('setData', {name: 'setForm', data: this.setForm})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
// import { login, logout, getInfo } from '@/api/login'
|
// import { login, logout, getInfo } from '@/api/login'
|
||||||
import { getToken, setToken, removeToken } from '../../utils/auth'
|
import { getToken, setToken, removeToken } from '../../utils/auth'
|
||||||
|
const setFormDefault = {
|
||||||
|
priority: 2,
|
||||||
|
stage: 0,
|
||||||
|
speed: 0,
|
||||||
|
isCheck: true,
|
||||||
|
isDel: true,
|
||||||
|
isClose: true,
|
||||||
|
isArrow: true,
|
||||||
|
isPrint: true,
|
||||||
|
disk: 1
|
||||||
|
}
|
||||||
const user = {
|
const user = {
|
||||||
state: {
|
state: {
|
||||||
token: getToken(),
|
token: getToken(),
|
||||||
name: 'admin',
|
name: 'admin',
|
||||||
avatar:
|
avatar:
|
||||||
'https://image.baidu.com/search/detail?ct=503316480&z=&tn=baiduimagedetail&ipn=d&word=admin&step_word=&lid=8980923753406439282&ie=utf-8&in=&cl=2&lm=-1&st=-1&hd=&latest=©right=&cs=1902119677,258344230&os=3526618670,2431782315&simid=3426573763,123057590&pn=11&rn=1&di=7410818322373017601&ln=1928&fr=&fmq=1730735680169_R&ic=&s=undefined&se=&sme=&tab=0&width=&height=&face=undefined&is=0,0&istype=2&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=1e&objurl=https%3A%2F%2Fclearhub.tech%2Fwp-content%2Fuploads%2F2018%2F11%2F12.png&rpstart=0&rpnum=0&adpicid=0&nojc=undefined&dyTabStr=MCwzLDEsMiwxMyw3LDYsNSwxMiw5',
|
'https://image.baidu.com/search/detail?ct=503316480&z=&tn=baiduimagedetail&ipn=d&word=admin&step_word=&lid=8980923753406439282&ie=utf-8&in=&cl=2&lm=-1&st=-1&hd=&latest=©right=&cs=1902119677,258344230&os=3526618670,2431782315&simid=3426573763,123057590&pn=11&rn=1&di=7410818322373017601&ln=1928&fr=&fmq=1730735680169_R&ic=&s=undefined&se=&sme=&tab=0&width=&height=&face=undefined&is=0,0&istype=2&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=1e&objurl=https%3A%2F%2Fclearhub.tech%2Fwp-content%2Fuploads%2F2018%2F11%2F12.png&rpstart=0&rpnum=0&adpicid=0&nojc=undefined&dyTabStr=MCwzLDEsMiwxMyw3LDYsNSwxMiw5',
|
||||||
roles: ['admin']
|
roles: ['admin'],
|
||||||
|
// 高级设置
|
||||||
|
setForm: setFormDefault,
|
||||||
},
|
},
|
||||||
|
|
||||||
mutations: {
|
mutations: {
|
||||||
@@ -22,6 +34,9 @@ const user = {
|
|||||||
},
|
},
|
||||||
SET_ROLES: (state, roles) => {
|
SET_ROLES: (state, roles) => {
|
||||||
state.roles = roles
|
state.roles = roles
|
||||||
|
},
|
||||||
|
setData: (state, obj) => {
|
||||||
|
state[obj.name] = obj.data
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
setToken('data.token')
|
setToken('data.token')
|
||||||
|
if (localStorage.getItem('setForm')) {
|
||||||
|
this.$store.commit('setData', {name: 'setForm', data: localStorage.getItem('setForm')})
|
||||||
|
}
|
||||||
this.$store.commit('SET_TOKEN', 'data.token')
|
this.$store.commit('SET_TOKEN', 'data.token')
|
||||||
this.$store.dispatch('chat/initWebSocket') // 初始化websocket
|
this.$store.dispatch('chat/initWebSocket') // 初始化websocket
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user