优化bug
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -164,7 +164,7 @@
|
|||||||
<div class="wook_soon_label">{{ item.name }}</div>
|
<div class="wook_soon_label">{{ item.name }}</div>
|
||||||
<div class="wook_soon_input">
|
<div class="wook_soon_input">
|
||||||
<div v-if="item.type == 1">
|
<div v-if="item.type == 1">
|
||||||
<input type="file" accept="image/*" :ref="item.name" :data-name="item.name" />
|
<input type="file" accept="image/*" :ref="item.origin_name" :data-name="item.origin_name" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="item.type == 3 || item.type == 4 || item.type == 5">
|
<div v-if="item.type == 3 || item.type == 4 || item.type == 5">
|
||||||
<el-input clearable :disabled="csvIsExist" v-model="item.val" placeholder="请输入"></el-input>
|
<el-input clearable :disabled="csvIsExist" v-model="item.val" placeholder="请输入"></el-input>
|
||||||
@@ -416,13 +416,16 @@ export default {
|
|||||||
...mapGetters(['name', 'roles']),
|
...mapGetters(['name', 'roles']),
|
||||||
file_percent() {
|
file_percent() {
|
||||||
const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size
|
const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size
|
||||||
console.log(diskSize)
|
let t = diskSize ? parseFloat(this.$accDiv(this.totalSize, diskSize)) * 100 : 0
|
||||||
let t = diskSize ? this.$accDiv(this.totalSize, diskSize) * 100 : 0
|
return t > 100 ? 100 : t
|
||||||
return t > 100 ? 100.1 : t
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
let workForm = localStorage.getItem('workForm')
|
||||||
|
if (workForm) {
|
||||||
|
this.form.cd_type = workForm.cd_type
|
||||||
|
this.form.copy_type = workForm.copy_type
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 进度条处理
|
// 进度条处理
|
||||||
@@ -547,10 +550,15 @@ export default {
|
|||||||
task.path_file.push(fileList[i].path)
|
task.path_file.push(fileList[i].path)
|
||||||
task.task_size += fileList[i].size
|
task.task_size += fileList[i].size
|
||||||
}
|
}
|
||||||
this.form.ass_task.push(task)
|
that.form.ass_task.push(task)
|
||||||
}
|
}
|
||||||
// csv文件处理
|
// csv文件处理
|
||||||
if (!that.form.udf_file && that.soonList.length > 0) {
|
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
|
||||||
|
}
|
||||||
|
})
|
||||||
const isEmpty = that.soonList.some((item) => item.val === '')
|
const isEmpty = that.soonList.some((item) => item.val === '')
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
that.$message({
|
that.$message({
|
||||||
@@ -574,6 +582,11 @@ export default {
|
|||||||
let theForm = { ...that.form }
|
let theForm = { ...that.form }
|
||||||
if (!theForm.udf_file) delete theForm.udf_file
|
if (!theForm.udf_file) delete theForm.udf_file
|
||||||
that.testForm.req_info = theForm
|
that.testForm.req_info = theForm
|
||||||
|
// 保存默认设置
|
||||||
|
localStorage.setItem('workForm', {
|
||||||
|
cd_type: that.form.cd_type,
|
||||||
|
copy_type: that.form.copy_type
|
||||||
|
})
|
||||||
that.$store.dispatch('chat/websocketsend', that.testForm).then(() => {
|
that.$store.dispatch('chat/websocketsend', that.testForm).then(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
that.$message({
|
that.$message({
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ const defaultData = {
|
|||||||
const getDefaultState = () => {
|
const getDefaultState = () => {
|
||||||
return {
|
return {
|
||||||
isConnect: false,
|
isConnect: false,
|
||||||
|
connecting: false,
|
||||||
serviceStatus: false,
|
serviceStatus: false,
|
||||||
workStatus: true,
|
workStatus: true,
|
||||||
reconnections: 0,
|
reconnections: 0,
|
||||||
@@ -250,9 +251,10 @@ const actions = {
|
|||||||
// 初始化websocket
|
// 初始化websocket
|
||||||
initWebSocket({ state, commit, dispatch, rootState }) {
|
initWebSocket({ state, commit, dispatch, rootState }) {
|
||||||
if (typeof WebSocket === 'undefined') return console.log('您的浏览器不支持websocket')
|
if (typeof WebSocket === 'undefined') return console.log('您的浏览器不支持websocket')
|
||||||
if ((websock && state.isConnect) || !rootState.user.token) {
|
if ((websock && state.isConnect) || !rootState.user.token || state.connecting) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
commit('setData', { name: 'connecting', data: true })
|
||||||
websock = new WebSocket(process.env.VUE_APP_SOCKET_API)
|
websock = new WebSocket(process.env.VUE_APP_SOCKET_API)
|
||||||
websock.onmessage = function (res) {
|
websock.onmessage = function (res) {
|
||||||
dispatch('websocketonmessage', res)
|
dispatch('websocketonmessage', res)
|
||||||
@@ -399,10 +401,12 @@ const actions = {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!state.serviceStatus) {
|
if (!state.serviceStatus) {
|
||||||
commit('setData', { name: 'printer_error', data: {type: 'warning', message: '服务连接中,请耐心等待', notify: '' } })
|
commit('setData', { name: 'printer_error', data: {type: 'warning', message: '服务连接中,请耐心等待', notify: '' } })
|
||||||
|
reject()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!state.isConnect) {
|
if (!state.isConnect) {
|
||||||
commit('setData', { name: 'printer_error', data: {type: 'warning', message: '请先打开服务', notify: '' } })
|
commit('setData', { name: 'printer_error', data: {type: 'warning', message: '请先打开服务', notify: '' } })
|
||||||
|
reject()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
websock.send(JSON.stringify(res))
|
websock.send(JSON.stringify(res))
|
||||||
@@ -412,6 +416,7 @@ const actions = {
|
|||||||
// 链接建立之后执行的方法
|
// 链接建立之后执行的方法
|
||||||
websocketonopen: ({ commit, dispatch }, res) => {
|
websocketonopen: ({ commit, dispatch }, res) => {
|
||||||
console.log('链接建立之后执行send方法发送数据', res)
|
console.log('链接建立之后执行send方法发送数据', res)
|
||||||
|
commit('setData', { name: 'connecting', data: false })
|
||||||
commit('setData', { name: 'isConnect', data: true })
|
commit('setData', { name: 'isConnect', data: true })
|
||||||
commit('setData', { name: 'serviceStatus', data: true })
|
commit('setData', { name: 'serviceStatus', data: true })
|
||||||
},
|
},
|
||||||
@@ -419,6 +424,7 @@ const actions = {
|
|||||||
websocketonclose: ({ state, commit, dispatch }, res) => {
|
websocketonclose: ({ state, commit, dispatch }, res) => {
|
||||||
console.log('断开链接', res)
|
console.log('断开链接', res)
|
||||||
// 关闭
|
// 关闭
|
||||||
|
commit('setData', { name: 'connecting', data: false })
|
||||||
commit('setData', { name: 'isConnect', data: false })
|
commit('setData', { name: 'isConnect', data: false })
|
||||||
for (let key in defaultData) {
|
for (let key in defaultData) {
|
||||||
commit('setData', { name: key, data: defaultData[key] })
|
commit('setData', { name: key, data: defaultData[key] })
|
||||||
@@ -432,6 +438,7 @@ const actions = {
|
|||||||
},
|
},
|
||||||
// 链接错误之后执行的方法
|
// 链接错误之后执行的方法
|
||||||
websocketonerror({ state, commit, dispatch }, res) {
|
websocketonerror({ state, commit, dispatch }, res) {
|
||||||
|
commit('setData', { name: 'connecting', data: false })
|
||||||
commit('setData', { name: 'isConnect', data: false })
|
commit('setData', { name: 'isConnect', data: false })
|
||||||
commit('setData', { name: 'serviceStatus', data: false })
|
commit('setData', { name: 'serviceStatus', data: false })
|
||||||
state.reconnections += 1
|
state.reconnections += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user