Files
SoonWorkerD/src/renderer/components/workAdd/workAdd.vue
T
2024-12-31 16:51:19 +08:00

1368 lines
42 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="add_box">
<el-dialog center :visible.sync="addShow" width="80%" top="10vh" title="新建作业" :close-on-press-escape="false" :close-on-click-modal="false" :show-close="false">
<div
class="work_body"
v-loading="submitLoading"
element-loading-text="正在准备任务您也可以直接右上角关闭作业窗口"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<div @click="close" class="close_box">
<img src="@/assets/images/Close_icon.png" />
</div>
<div class="work_box">
<div class="flex_box flex_row_between work_top">
<div class="flex_box">
<div class="flex_box work_top_item">
<div class="work_top_label">光盘类型</div>
<div class="work_top_val">
<el-select v-model="form.cd_type" placeholder="请选择">
<el-option v-for="item in cd_types" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</div>
</div>
<div class="flex_box work_top_item">
<div class="work_top_label">刻录类型</div>
<div class="work_top_val">
<el-select v-model="form.copy_type" placeholder="请选择">
<el-option v-for="item in copyList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</div>
</div>
</div>
<el-popover v-model="setShow" placement="bottom-end" trigger="click">
<div class="set_box">
<div class="set_list">
<!-- <div class="flex_box set_item">
<div class="set_label">优先级</div>
<div class="set_val">
<el-select v-model="setForm.priority" placeholder="请选择">
<el-option v-for="item in priorityList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</div>
</div>
<div class="flex_box set_item">
<div class="set_label">目标工作站</div>
<div class="set_val">
<el-select v-model="setForm.stage" placeholder="请选择">
<el-option v-for="item in stageList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</div>
</div> -->
<div class="flex_box set_item">
<div class="set_label">刻录速率</div>
<div class="set_val">
<el-select v-model="setForm.speed" placeholder="请选择">
<el-option v-for="item in speedList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</div>
</div>
<div class="flex_box set_item">
<div class="set_label">刻录完成后校验光盘</div>
<div class="set_val">
<el-switch v-model="setForm.isCheck" active-color="#07C160" inactive-color="#aaa"> </el-switch>
</div>
</div>
<div class="flex_box set_item">
<div class="set_label">刻录完成后关闭光盘</div>
<div class="set_val">
<el-switch v-model="setForm.isClose" active-color="#07C160" inactive-color="#aaa"> </el-switch>
</div>
</div>
<div class="flex_box set_item">
<div class="set_label">刻录完成后删除缓存</div>
<div class="set_val">
<el-switch v-model="setForm.isDel" active-color="#07C160" inactive-color="#aaa"> </el-switch>
</div>
</div>
<div class="flex_box set_item">
<div class="set_label">作业失败打印标签</div>
<div class="set_val">
<el-switch v-model="setForm.isPrint" active-color="#07C160" inactive-color="#aaa"> </el-switch>
</div>
</div>
<div class="flex_box set_item">
<div class="set_label">允许跨盘</div>
<div class="set_val">
<el-switch v-model="setForm.isArrow" active-color="#07C160" inactive-color="#aaa"> </el-switch>
</div>
</div>
<div v-if="setForm.isArrow" class="flex_box flex_col_top set_item">
<div class="set_label">分盘设置</div>
<div class="set_val">
<el-radio-group v-model="setForm.disk">
<el-radio :label="item.id" v-for="(item, index) in diskSet" :key="index">
<div class="set_disk_name">{{ item.name }}</div>
<div class="set_disk_desc">{{ item.desc }}</div>
</el-radio>
</el-radio-group>
</div>
</div>
</div>
<div class="flex_box flex_row_center set_btns">
<el-button @click="setCancel" class="set_btn1">取消</el-button>
<el-button @click="setSure" class="set_btn2" type="primary">确定</el-button>
</div>
</div>
<div class="flex_box work_top_set" slot="reference">
<img src="@/assets/images/Setting_icon.png" />
<div>高级作业设置</div>
</div>
</el-popover>
</div>
<div class="flex_box flex_col_top work_main">
<div class="work_left">
<div class="flex_box flex_row_between work_left_top">
<div class="flex_box">
<div class="work_left_top_label">内容</div>
<div @click="addFolder" class="flex_box work_left_top_btn">
<img src="@/assets/images/file_icon.png" />
<div>添加文件夹</div>
</div>
<div @click="addFile" class="flex_box work_left_top_btn">
<img src="@/assets/images/paper_icon.png" />
<div>添加文件</div>
</div>
</div>
<div class="work_left_top_input">
<el-input placeholder="请输入卷标" v-model="form.label">
<template slot="prepend">卷标</template>
</el-input>
</div>
</div>
<div class="work_files">
<div class="work_files_box">
<!-- 文件列表 -->
<files ref="files" :onSizechange="sizeChange" :complete="upload_over"></files>
</div>
<div class="work_files_progress">
<el-progress :text-inside="true" :percentage="file_percent" :format="format" :color="customColors"></el-progress>
</div>
</div>
</div>
<div class="work_right">
<div class="flex_box work_right_top">
<div class="flex_box">
<div class="work_right_top_label">标签</div>
<el-select @change="changeTemplate" v-model="currentTemplate" placeholder="选择一个标签或点击创建标签">
<el-option v-for="item in templates" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
<el-tooltip content="选择更多模版" placement="bottom">
<div @click="openFile" class="work_right_top_file">···</div>
</el-tooltip>
</div>
<div class="work_right_top_add">新建标签</div>
</div>
<div class="wook_soon" :class="{ wook_soon1: !showList }">
<div class="flex_box flex_row_center wook_soon_top">
<img class="wook_soon_img" :src="soonImg" />
<div @click="showList = !showList" class="flex_box flex_row_center wook_soon_btn" :class="{ wook_soon_btn1: !showList }">
<img src="@/assets/images/Arrow_up_icon.png" />
</div>
</div>
<div class="wook_soon_list">
<div v-for="(item, index) in soonList" :key="index" class="flex_box wook_soon_item">
<div class="wook_soon_label">{{ item.name }}</div>
<div class="wook_soon_input">
<div v-if="item.type == 1">
<input type="file" accept="image/*" :ref="item.origin_name" :data-name="item.origin_name" />
</div>
<div v-if="item.type == 3 || item.type == 4 || item.type == 5">
<el-input clearable :disabled="csvIsExist" v-model="item.val" placeholder="请输入"></el-input>
</div>
</div>
<div @click="openFile2" v-if="item.type == 3 || item.type == 4 || item.type == 5" class="wook_soon_add">添加字段</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div slot="footer" class="flex_box flex_row_between footer_box">
<div class="flex_box footer_main">
<div class="footer_input">
<el-input placeholder="请输入数量" v-model.number="form.task_freq">
<template slot="prepend">数量</template>
</el-input>
</div>
</div>
<div class="flex_box footer_btns">
<el-button type="primary" class="footer_save" @click="workSave" :loading="saveFlag">保存</el-button>
<el-button type="primary" class="footer_submit" @click="workSubmit" :loading="submitFlag">提交</el-button>
</div>
</div>
</div>
<!-- 上传文件区域 -->
<input type="file" accept=".cs,.soon" @change="fileLoad" ref="refFile" style="display: none" />
<input type="file" accept=".csv" @change="fileLoad2" ref="refFile2" style="display: none" />
<input type="file" accept="..zip,.rar" @change="fileLoad3" ref="refFile3" style="display: none" />
</el-dialog>
</div>
</template>
<script>
let fs = require('fs')
let path = require('path')
const { app, dialog } = require('@electron/remote')
const { exec } = require('child_process')
const { ipcRenderer } = require('electron')
import { mapGetters } from 'vuex'
const dayjs = require('dayjs')
import fileEmpty from './files/fileEmpty'
import files from './files/file'
const exePath = !app.isPackaged ? process.cwd() : path.dirname(process.execPath)
export default {
name: 'UserInfo',
components: { fileEmpty, files },
props: {
saveWorkList: {
type: Object | undefined
},
isNew: {
type: Boolean
},
},
data() {
return {
addShow: false,
submitLoading: false,
saveFlag: false,
submitFlag: false,
size_form: null,
type_form: 0,
file_form: 0,
juanbiao_form: '',
options: {
target: '/upload/',
testChunks: false
},
zip_attrs: {
accept: '.zip'
},
iso_attrs: {
accept: 'iso/img'
},
form: {
task_uuid: '',
cd_type: 2,
copy_type: 2,
json_file: '',
udf_file: '',
label: '2024-10-17',
has_copy_task: false,
has_print_task: false,
ass_task: [],
task_freq: 1
},
testForm: {
req_name: 'submit_task',
req_type: 1,
req_info: {
task_uuid: 'aaaaaaaaaaaaaaa',
json_file: '/home/test/test.soon',
udf_file: '/home/test/temp.csv',
label: '2024-11-07',
cd_type: 1,
copy_type: 2,
has_copy_task: true,
has_print_task: true,
ass_task: [
{
ass_task_index: 1,
path_file: [
'/home/test/code/CDDateBank/build-CDDateBank-Imported_Kit_a412ee-Debug/libworkDllCD.so',
'/home/test/code/CDDateBank/build-CDDateBank-Imported_Kit_a412ee-Debug/libzint.so.2.12',
'/home/test/code/CDDateBank/build-CDDateBank-Imported_Kit_a412ee-Debug/privkey.txt'
]
}
],
task_freq: 1
}
},
// CD类型:CD 700MB1DVD 4.7GB2 DVD_DL 8.5GB:3BD 25GB4,BD_DL 50GB:5,BD_TL 100GB:6,BD_QL 128GB:7
CDTypes: [],
cd_types: [],
copyList: [
{
value: 1,
label: '文件文件夹刻录',
disabled: true
},
{
value: 2,
label: 'ISO文件刻录'
},
// {
// value: 3,
// label: '复制光盘'
// },
// {
// value: 4,
// label: '自动批量读取光盘'
// },
// {
// value: 5,
// label: '自动归档任务'
// },
],
fileProgess: 30,
// 模板列表
templates: [],
currentTemplate: '',
// soon文件数据
soonform: {},
fileData: {},
soonList: [],
fileLists: [],
file_name: null,
file_name3: '添加图片文件',
upload_disk: '',
soonImg: '',
showList: true,
csvIsExist: false,
totalSize: 0,
customColors: [
{ color: '#67C23A', percentage: 99 },
{ color: '#F56C6C', percentage: 100 }
],
csvForm: {
req_name: 'upload_file',
req_type: 1,
req_info: {
uuid: '',
file_name: 'temp.csv',
file_text: ''
}
},
// 高级设置
setShow: false,
setForm: {},
priorityList: [
{
value: 1,
label: '低'
},
{
value: 2,
label: '正常'
},
{
value: 3,
label: '高'
}
],
stageList: [
{
value: 0,
label: '任何'
},
{
value: 1,
label: '002A工作站'
}
],
speedList: [
// {
// value: 0,
// label: 'Auto'
// },
{
value: 1,
label: '低'
},
{
value: 2,
label: '中'
},
{
value: 3,
label: '高'
}
],
diskSet: [
{
id: 1,
name: '文件修改时间',
desc: '按照文件修改时间进行升序分盘'
},
{
id: 2,
name: '文件名称',
desc: '按照文件名称进行升序分盘'
},
{
id: 3,
name: '文件大小',
desc: '按照文件大小进行排序分盘'
}
]
}
},
watch: {
'$store.state.user.setForm': {
handler(val) {
this.setForm = { ...val }
},
deep: true,
immediate: true
},
'$store.state.chat.CDTypes': {
handler(val) {
this.CDTypes = { ...val }
},
deep: true,
immediate: true
},
'$store.state.chat.cd_types': {
handler(val) {
this.cd_types = [...val]
},
deep: true,
immediate: true
},
isNew: {
immediate: true,
handler(val) {
let that = this
that.$nextTick(function () {
if (!that.isNew) {
that.isNew = true
that.$nextTick(() => {
that.$refs.files.allSize = that.saveWorkList.size
that.$refs.files.allNumber = that.saveWorkList.filesList.length
that.$refs.files.filesList = that.saveWorkList.filesList
})
that.soonList = that.saveWorkList.soonList
that.soonImg = that.saveWorkList.soonImg
that.totalSize = that.saveWorkList.totalSize
for (let key in that.form) {
that.form[key] = that.saveWorkList[key]
}
that.form.task_name = that.saveWorkList.task_name
if (that.saveWorkList.json_file) {
fs.readFile(that.saveWorkList.json_file, 'utf8', (err, data) => {
if (err) {
console.error('读取文件时出错:', err)
return
}
let name = that.saveWorkList.json_file.split('\\')[1]
that.fileLists[0] = new File([data], name, {
type: ''
})
// that.readFile(data)
})
}
if (that.saveWorkList.udf_file) {
that.csvIsExist = true
console.log(that.saveWorkList.udf_file, that.csvIsExist)
fs.readFile(that.saveWorkList.udf_file, 'utf8', (err, data) => {
if (err) {
console.error('读取文件时出错:', err)
return
}
let name = that.saveWorkList.udf_file.split('\\')[1]
that.file_name = name
that.fileLists[0] = new File([data], name, {
type: ''
})
})
}
}
})
}
}
},
computed: {
...mapGetters(['name', 'roles']),
file_percent() {
const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size
let t = diskSize ? parseFloat(this.$accDiv(this.totalSize, diskSize)) * 100 : 0
return t > 100 ? 100 : t
}
},
mounted() {
let workForm = localStorage.getItem('workForm')
if (workForm) {
this.form.cd_type = JSON.parse(workForm).cd_type
this.form.copy_type = JSON.parse(workForm).copy_type
}
},
methods: {
// 进度条处理
format(percentage) {
const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size
let t = diskSize ? `${this.$filterSize(this.totalSize)}/${this.$filterSize(diskSize)}` : ''
return t
},
// 添加文件处理
addFolder() {
this.$refs.files.addFolder()
},
addFile() {
this.$refs.files.addFile()
},
sizeChange(size) {
this.totalSize = size
},
async upload_over() {},
// 保存
workSave() {
let that = this
if (that.form.json_file === '' && that.$refs.files.filesList.length === 0) {
that.$message({
message: '请上传作业文件',
type: 'warning'
})
return
}
let t = true
for (let i in that.$refs.files.filesList) {
if (that.$refs.files.filesList[i].size == -1) {
t = false
}
}
if (t) {
let save = {...that.form}
save.filesList = that.$refs.files.getLists()
save.totalSize = that.totalSize
if (that.soonList.length > 0) {
that.soonList.forEach((item) => {
if (item.type == 1&&that.$refs[item.origin_name][0].files[0]) {
item.val = that.$refs[item.origin_name][0].files[0].path
}
if (!item.val) {
item.val = item.default || ''
}
})
}
save.soonImg = that.soonImg
save.soonList = that.soonList
const v = JSON.stringify(save)
dialog
.showSaveDialog({
title: 'Save',
filters: [{ name: 'Soon Work', extensions: ['dwk'] }]
})
.then((result) => {
if (result.filePath == "") { return; }
if (result.filePath.substring(result.filePath.length - 5).indexOf('.') == -1) {
result.filePath += '.dwk';
}
fs.writeFileSync(result.filePath, v)
that.$message({
message: '保存成功至'+result.filePath,
type: 'success'
})
})
.catch((err) => {
console.log(err)
})
} else {
that.$message({
offset: 100,
message: '请等待计算',
type: 'warning'
})
}
},
// 提交
workSubmit() {
let that = this
const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size
const files = this.$refs.files.getLists()
let fileList = []
that.submitFlag = true
that.form.ass_task = []
setTimeout(() => {
that.submitFlag = false
}, 1000)
for (let key in files) {
let file = { ...files[key] }
try {
const fileStats = fs.statSync(files[key].path)
file.mtime = fileStats.mtimeMs
fileList.push(file)
} catch (error) {
console.error('Error reading file:', error)
}
}
if (that.form.json_file === '' && fileList.length === 0) {
this.$message({
message: '请上传作业文件',
type: 'warning'
})
return
}
if (this.setForm.isArrow) {
let overList = []
for (let i = 0; i < fileList.length; i++) {
if (fileList[i].size > diskSize) {
overList.push(fileList[i].name)
}
}
if (overList.length) {
const fileNames = overList.join(',')
this.$notify({
message: `文件${fileNames} 大小超过磁盘容量${this.$filterSize(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.size - b.size)
} else {
// 按最后修改时间排序
fileList.sort((a, b) => a.mtime - b.mtime)
}
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 > diskSize) {
this.$notify({
message: `文件${fileList[i].name} 大小超过设备容量,请重新选择文件!`,
type: 'warning'
})
return
}
if (total_size + fileList[i].size > diskSize) {
that.form.ass_task.push(task)
total_size = 0
index++
task = {
ass_task_index: index,
task_size: 0,
path_file: []
}
}
total_size += fileList[i].size
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
}
if (task.task_size > diskSize) {
this.$notify({
message: `文件大小超过设备容量!`,
type: 'warning'
})
return
}
that.form.ass_task.push(task)
}
that.form.burn_speed = that.setForm.speed
that.form.is_finished_check = that.setForm.isCheck
that.form.is_finished_close = that.setForm.isClose
that.form.is_finished_delete = that.setForm.isDel
that.form.is_printer_labal_failed = that.setForm.isPrint
// csv文件处理
if (!that.form.udf_file && that.soonList.length > 0) {
that.soonList.forEach((item) => {
if (item.type == 1&&that.$refs[item.origin_name][0].files[0]) {
item.val = that.$refs[item.origin_name][0].files[0].path
}
if (!item.val) {
item.val = item.default || ''
}
})
let csv1 = that.soonList.map(item => item.origin_name).join(',')
let csv2 = that.soonList.map(item => item.val).join(',')
that.csvForm.req_info.file_text = csv1 + '\n' + csv2
that.$store.dispatch('chat/websocketsend', that.csvForm).then(() => {
}).catch(() => {
})
}
that.submitLoading = true
if (that.form.json_file) that.form.has_print_task = true
if (fileList.length) that.form.has_copy_task = true
let theForm = { ...that.form }
if (!theForm.udf_file) delete theForm.udf_file
that.testForm.req_info = theForm
// 保存默认设置
localStorage.setItem('workForm', JSON.stringify({
cd_type: that.form.cd_type,
copy_type: that.form.copy_type
}))
that.$store.dispatch('chat/websocketsend', that.testForm).then(() => {
setTimeout(() => {
that.$message({
message: '新建作业成功',
type: 'success'
})
that.submitLoading = false
that.close()
}, 1500)
}).catch(() => {
that.submitLoading = false
})
},
// 获取模板文件列表
getTemplates() {
const filePath = path.join(exePath, 'User Templates');
fs.readdir(filePath, (err, files) => {
if (err) {
console.log(err)
} else {
console.log(files)
const fileList = files.map((file) => {
return {
label: file,
value: path.join('User Templates', file)
}
})
this.templates = fileList
}
})
},
// 选择模板
changeTemplate(e) {
let that = this
const fullPath = path.join(exePath, e)
that.form.json_file = fullPath
fs.readFile(fullPath, 'utf8', (err, data) => {
if (err) {
console.error('读取文件时出错:', err)
return
}
let name = path.basename(fullPath)
that.fileLists[0] = new File([data], name, {
type: ''
})
that.readFile(data)
})
},
// 读取文件信息
readFile(data) {
let that = this
that.fileData = JSON.parse(data)
that.soonform = {}
that.soonList = []
for (let item of that.fileData.frontData) {
if (item.type == 1 || item.type == 3 || item.type == 4 || item.type == 5) {
that.soonList.push({
name: item.name + '[正面]',
val: item.DefaultText == undefined ? '' : item.DefaultText,
origin_name: item.name,
type: item.type,
default: item.DefaultText == undefined ? undefined : item.DefaultText
}) //前
that.$set(that.soonform, item.name, item.DefaultText == undefined ? '' : item.DefaultText)
}
}
for (let item of that.fileData.backData) {
if (item.type == 1 || item.type == 3 || item.type == 4 || item.type == 5) {
that.soonList.push({
name: item.name + '[背面]',
val: item.DefaultText == undefined ? '' : item.DefaultText,
origin_name: item.name,
type: item.type,
default: item.DefaultText == undefined ? undefined : item.DefaultText
})
that.$set(that.soonform, item.name, item.DefaultText == undefined ? '' : item.DefaultText)
}
}
that.soonImg = that.fileData.frontDisplayPic
// that.$refs.refFile2.value = ''
// that.$refs.refFile3.value = ''
that.csvIsExist = false
that.file_name = null
that.file_name3 = '添加图片文件'
},
// 打开标签程序
openDesign() {
// 启动exe程序
exec('"D:\\Program Files\\Cardsoon\\SoonDesign\\SoonDesign.exe"', (error, stdout, stderr) => {
if (error) {
console.error(`执行的错误: ${error}`)
return
}
console.log(`stdout: ${stdout}`)
console.error(`stderr: ${stderr}`)
})
},
// 文件上传处理
openFile() {
this.$refs.refFile.dispatchEvent(new MouseEvent('click'))
},
openFile2() {
this.$refs.refFile2.dispatchEvent(new MouseEvent('click'))
},
openFile3() {
this.$refs.refFile3.dispatchEvent(new MouseEvent('click'))
},
fileLoad() {
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)
that.currentTemplate = ''
reader.onload = function () {
that.readFile(this.result)
}
},
fileLoad2() {
this.file_name = this.$refs.refFile2.files[0].name
this.csvLoad()
},
fileLoad3() {
this.file_name3 = this.$refs.refFile3.files[0].name
},
csvLoad() {
let that = this
let selectedFile = this.$refs.refFile2.files[0]
that.form.udf_file = selectedFile.path
let reader = new FileReader()
reader.readAsText(selectedFile)
reader.onload = function () {
//let flag = true; //校验结果
let first_line = this.result.split('\n')[0].replace('\r', '').split(',') //第一行
let second_line = this.result.split('\n')[1].replace('\r', '').split(',') //第二行
console.log(first_line, second_line)
for (let i = 0; i < first_line.length; i++) {
let index = that.soonList.findIndex(soon => soon.origin_name === first_line[i])
if(index > -1) {
that.soonList[index].val = second_line[i]
}
}
that.csvIsExist = true
}
},
genTaskUUID() {
var myDate = new Date()
var dateStr =
myDate.getFullYear().toString() +
(myDate.getMonth() + 1 >= 10 ? (myDate.getMonth() + 1).toString() : '0' + (myDate.getMonth() + 1).toString()) +
(myDate.getDate() > 9 ? myDate.getDate().toString() : '0' + myDate.getDate().toString()) +
(myDate.getHours() > 9 ? myDate.getHours().toString() : '0' + myDate.getHours().toString()) +
(myDate.getMinutes() > 9 ? myDate.getMinutes().toString() : '0' + myDate.getMinutes().toString()) +
(myDate.getSeconds() > 9 ? myDate.getSeconds().toString() : '0' + myDate.getSeconds().toString()) +
myDate
.getTime()
.toString()
.slice(myDate.getTime().toString().length - 3, myDate.getTime().toString().length - 1)
// return 'W' + Math.random().toString(36).substr(2)
return dateStr
},
show() {
this.addShow = true
this.getTemplates()
this.form.task_uuid = this.genTaskUUID()
this.csvForm.req_info.uuid = this.form.task_uuid
this.form.label = dayjs().format('YYYY-MM-DD')
console.log(this.form.task_uuid)
},
close() {
this.addShow = false
this.$emit('close')
},
// 高级设置
setCancel() {
this.setShow = false
this.setForm = this.$store.state.user.setForm
},
setSure() {
this.setShow = false
that.$store.dispatch('chat/setDatas', {name: 'workStatus', data: true})
this.$store.dispatch('setDatas', { name: 'setForm', data: this.setForm })
}
}
}
</script>
<style lang="scss" scoped>
.add_box {
::v-deep {
.el-dialog {
border-radius: 6px;
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
.el-dialog__header {
padding: 28px 28px 18px 0 0;
.el-dialog__title {
font-size: 24px;
font-weight: 500;
color: #000;
}
}
.el-dialog__body {
padding: 0;
}
.el-dialog__footer {
padding: 0;
}
}
}
.close_box {
position: absolute;
z-index: 99;
top: 0;
right: 0;
cursor: pointer;
padding: 24px 24px 0 0;
img {
width: 28px;
height: 28px;
}
}
.work_box {
padding: 0 28px;
.work_top {
height: 80px;
.work_top_item {
margin-right: 50px;
.work_top_label {
font-weight: 500;
font-size: 19px;
color: #000000;
margin-right: 12px;
}
.work_top_val {
.el-input {
height: 40px;
line-height: 40px;
}
::v-deep {
.el-input__inner {
width: 180px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__icon {
font-size: 16px;
height: 40px;
line-height: 40px;
font-weight: bold;
color: #000;
}
}
}
}
.work_top_set {
cursor: pointer;
height: 40px;
padding: 0 22px;
background: rgba(0, 195, 37, 0.12);
border-radius: 4px;
border: 1px solid rgba(0, 195, 37, 0.32);
font-weight: 500;
font-size: 18px;
color: #00c325;
img {
width: 22px;
height: 22px;
margin-right: 10px;
}
}
}
.work_main {
background-color: #f8f8f8;
border-radius: 4px;
.work_left {
width: 50%;
border-right: 1px solid #aaaaaa;
padding: 0 16px 16px;
.work_left_top {
height: 72px;
.work_left_top_label {
font-size: 19px;
font-weight: 500;
color: #000;
padding-right: 18px;
}
.work_left_top_btn {
cursor: pointer;
height: 40px;
padding: 0 22px;
background: rgba(0, 195, 37, 0.12);
border-radius: 4px;
border: 1px solid rgba(0, 195, 37, 0.32);
font-weight: 500;
font-size: 16px;
color: #00c325;
margin-right: 22px;
img {
width: 20px;
height: 20px;
margin-right: 10px;
}
}
.work_left_top_input {
.el-input {
height: 40px;
line-height: 40px;
}
::v-deep {
.el-input-group__prepend {
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__inner {
width: 180px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__icon {
font-size: 16px;
height: 40px;
line-height: 40px;
font-weight: bold;
color: #000;
}
}
}
}
.work_files {
height: 500px;
cursor: pointer;
.work_files_box {
height: 478px;
overflow-y: scroll;
}
.work_files_progress {
::v-deep {
.el-progress-bar__outer {
height: 24px !important;
font-size: 12px;
color: #000;
}
}
}
}
}
.work_right {
width: 50%;
padding: 0 16px 16px;
.work_right_top {
height: 76px;
.work_right_top_label {
font-size: 19px;
font-weight: 500;
color: #000;
padding-right: 18px;
}
::v-deep {
.el-input__inner {
width: 300px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__icon {
font-size: 16px;
height: 40px;
line-height: 40px;
font-weight: bold;
color: #000;
}
}
.work_right_top_file {
width: 63px;
height: 40px;
cursor: pointer;
background: rgba(195, 189, 0, 0.12);
border-radius: 4px;
border: 1px solid rgba(182, 195, 0, 0.4);
font-weight: 500;
font-size: 16px;
color: #d9b028;
line-height: 40px;
text-align: center;
margin: 0 22px;
}
.work_right_top_add {
width: 123px;
height: 40px;
cursor: pointer;
background: #d8f6ff;
border-radius: 4px;
border: 1px solid #75d5f2;
font-weight: 500;
font-size: 16px;
color: #25aed9;
line-height: 40px;
text-align: center;
}
}
.wook_soon {
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 {
height: 100%;
}
.wook_soon_btn {
position: absolute;
right: 10px;
bottom: 10px;
width: 56px;
height: 56px;
z-index: 9;
background: #ffffff;
border-radius: 4px;
transition: all 0.5s;
cursor: pointer;
img {
width: 25px;
height: 16px;
}
}
.wook_soon_btn1 {
transform: rotate(180deg);
}
}
.wook_soon_list {
border-radius: 6px;
transition: all 0.5s;
margin-top: 18px;
height: 282px;
background: #ffffff;
border-radius: 2px;
border: 1px solid #eaeaea;
overflow-y: scroll;
padding: 0 22px;
.wook_soon_item {
height: 68px;
border-bottom: 2px solid #e1f5e5;
.wook_soon_label {
width: 200px;
font-weight: 500;
font-size: 16px;
color: #000000;
line-height: 28px;
}
.wook_soon_input {
width: 300px;
height: 40px;
border-radius: 4px;
::v-deep {
.el-input__inner {
width: 300px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__icon {
font-size: 16px;
height: 40px;
line-height: 40px;
font-weight: bold;
color: #000;
}
}
}
.wook_soon_add {
width: 110px;
height: 40px;
cursor: pointer;
background: #d8f6ff;
border-radius: 4px;
border: 1px solid #75d5f2;
font-weight: 500;
font-size: 16px;
color: #25aed9;
line-height: 40px;
text-align: center;
margin-left: 30px;
}
}
}
}
.wook_soon1 {
.wook_soon_top {
height: 100%;
}
.wook_soon_list {
height: 0;
margin: 0;
border: none;
}
}
}
}
}
.footer_box {
height: 90px;
padding: 0 28px;
.footer_main {
.footer_input {
::v-deep {
.el-input-group__prepend {
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__inner {
width: 180px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__icon {
font-size: 16px;
height: 40px;
line-height: 40px;
font-weight: bold;
color: #000;
}
}
}
}
.footer_btns {
.footer_save {
width: 166px;
height: 45px;
background: #00bcc3;
border-radius: 4px;
font-weight: 500;
font-size: 19px;
color: #ffffff;
padding: 0;
margin-right: 22px;
}
.footer_submit {
width: 166px;
height: 45px;
background: #00c325;
border-radius: 4px;
font-weight: 500;
font-size: 19px;
color: #ffffff;
padding: 0;
}
}
}
}
// 高级设置
.set_box {
.set_list {
padding: 24px;
.set_item {
padding: 10px 0;
.set_label {
width: 180px;
font-weight: 500;
font-size: 16px;
color: #000000;
line-height: 40px;
text-align: right;
padding-right: 12px;
}
.set_val {
::v-deep {
.el-input__inner {
width: 180px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__icon {
font-size: 16px;
height: 40px;
line-height: 40px;
font-weight: bold;
color: #000;
}
}
.el-switch {
zoom: 1.2;
}
.el-radio-group {
padding: 10px 0;
.el-radio {
display: flex;
.set_disk_name {
font-weight: 500;
font-size: 16px;
color: #000000;
line-height: 16px;
margin-bottom: 4px;
}
.set_disk_desc {
font-weight: 500;
font-size: 13px;
color: #666666;
line-height: 20px;
padding-bottom: 10px;
}
}
}
}
}
}
.set_btns {
border-top: 1px solid #e1f5e5;
height: 62px;
.set_btn1 {
width: 120px;
height: 40px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #000000;
font-weight: 500;
font-size: 16px;
color: #000000;
padding: 0;
margin: 0 12px;
}
.set_btn2 {
width: 120px;
height: 40px;
background: #00c325;
border-radius: 4px;
font-weight: 500;
font-size: 16px;
padding: 0;
margin: 0 12px;
}
}
}
</style>