This commit is contained in:
24kycj
2024-11-08 11:27:46 +08:00
parent aea8d1a6e2
commit 62b51776b1
4 changed files with 47 additions and 13 deletions
@@ -3,11 +3,11 @@
<div class="btn-group" v-show="false">
<div class="btn" @click="addFolder()" style="color: #67c23a">
<i class="el-icon-folder" />
{{ $t("file.addFolder") }}
添加文件夹
</div>
<div class="btn" @click="addFile()" style="color: #67c23a">
<i class="el-icon-files" />
{{ $t("file.addFile") }}
添加文件
</div>
</div>
<fileEmpty v-if="allNumber == 0" />
@@ -43,7 +43,7 @@ export default {
methods: {
getSize(size) {
if (size == -1) {
return this.$t("file.calculate");
return '正在计算...';
}
return bytesToSize(size);
},
+44 -10
View File
@@ -235,7 +235,12 @@ export default {
label: '2024-10-17',
has_copy_task: false,
has_print_task: false,
ass_task: [],
ass_task: [
{
ass_task_index: 1,
path_file: []
}
],
task_freq: 1
},
testForm: {
@@ -302,6 +307,7 @@ export default {
soonform: {},
fileData: {},
soonList: [],
fileLists: [],
file_name: null,
file_name3: '添加图片文件',
upload_disk: '',
@@ -397,6 +403,7 @@ export default {
this.$refs.files.addFile()
},
sizeChange(size) {
console.log(size)
this.size = size
},
async upload_over() {
@@ -522,8 +529,21 @@ export default {
// 提交
workSubmit() {
let that = this
const files = this.$refs.files.getLists()
for (let key in files) {
that.form.ass_task[0].path_file.push(files[key].path)
}
if (that.form.json_file === ''&& that.form.ass_task[0].path_file.length === 0) {
this.$message({
message: '请上传作业文件',
type: 'warning'
})
return
}
that.submitLoading = true
// that.$store.dispatch('chat/websocketsend', that.testForm)
that.testForm.req_info = that.form
console.log(that.form, that.testForm)
that.$store.dispatch('chat/websocketsend', that.testForm)
setTimeout(() => {
that.$message({
message: '新建作业成功',
@@ -539,6 +559,7 @@ export default {
if (err) {
console.log(err)
} else {
console.log(files)
const fileList = files.map((file) => {
return {
label: file,
@@ -551,16 +572,25 @@ export default {
},
// 选择模板
changeTemplate(e) {
let that = this
const absolutePath = path.resolve(e);
fs.realpath(absolutePath, (err, fullPath) => {
if (err) {
console.error(err);
return;
}
that.form.json_file = fullPath
});
fs.readFile(e, 'utf8', (err, data) => {
if (err) {
console.error('读取文件时出错:', err)
return
}
let name = e.split('\\')[1]
this.fileLists[0] = new File([data], name, {
that.fileLists[0] = new File([data], name, {
type: ''
})
this.readFile(data)
that.readFile(data)
})
},
// 读取文件信息
@@ -596,7 +626,6 @@ export default {
that.soonImg = that.fileData.frontDisplayPic
// that.$refs.refFile2.value = ''
// that.$refs.refFile3.value = ''
console.log(that.fileData, that.soonList, that.soonform)
that.csvIsExist = false
that.file_name = null
that.file_name3 = '添加图片文件'
@@ -634,14 +663,15 @@ export default {
this.$refs.refFile3.dispatchEvent(new MouseEvent('click'))
},
fileLoad() {
this.fileLists = this.$refs.refFile.files
let that = this
that.fileLists = this.$refs.refFile.files
let selectedFile = this.fileLists[0]
that.form.json_file = selectedFile.path
let reader = new FileReader()
reader.readAsText(selectedFile)
let _this = this
_this.currentTemplate = ''
that.currentTemplate = ''
reader.onload = function () {
_this.readFile(this.result)
that.readFile(this.result)
}
},
fileLoad2() {
@@ -947,6 +977,9 @@ export default {
height: 500px;
.wook_soon_top {
height: 200px;
padding: 10px 0;
border-radius: 6px;
background-color: rgba(0, 0, 0, 0.2);
position: relative;
transition: all 0.5s;
.wook_soon_img {
@@ -954,7 +987,7 @@ export default {
}
.wook_soon_btn {
position: absolute;
right: 0;
right: 10px;
bottom: 10px;
width: 56px;
height: 56px;
@@ -973,6 +1006,7 @@ export default {
}
}
.wook_soon_list {
border-radius: 6px;
transition: all 0.5s;
margin-top: 18px;
height: 282px;