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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

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