优化bug
This commit is contained in:
@@ -164,7 +164,7 @@
|
||||
<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.name" :data-name="item.name" />
|
||||
<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>
|
||||
@@ -416,13 +416,16 @@ export default {
|
||||
...mapGetters(['name', 'roles']),
|
||||
file_percent() {
|
||||
const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size
|
||||
console.log(diskSize)
|
||||
let t = diskSize ? this.$accDiv(this.totalSize, diskSize) * 100 : 0
|
||||
return t > 100 ? 100.1 : t
|
||||
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 = workForm.cd_type
|
||||
this.form.copy_type = workForm.copy_type
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 进度条处理
|
||||
@@ -547,10 +550,15 @@ export default {
|
||||
task.path_file.push(fileList[i].path)
|
||||
task.task_size += fileList[i].size
|
||||
}
|
||||
this.form.ass_task.push(task)
|
||||
that.form.ass_task.push(task)
|
||||
}
|
||||
// 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
|
||||
}
|
||||
})
|
||||
const isEmpty = that.soonList.some((item) => item.val === '')
|
||||
if (isEmpty) {
|
||||
that.$message({
|
||||
@@ -574,6 +582,11 @@ export default {
|
||||
let theForm = { ...that.form }
|
||||
if (!theForm.udf_file) delete theForm.udf_file
|
||||
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(() => {
|
||||
setTimeout(() => {
|
||||
that.$message({
|
||||
|
||||
@@ -222,6 +222,7 @@ const defaultData = {
|
||||
const getDefaultState = () => {
|
||||
return {
|
||||
isConnect: false,
|
||||
connecting: false,
|
||||
serviceStatus: false,
|
||||
workStatus: true,
|
||||
reconnections: 0,
|
||||
@@ -250,9 +251,10 @@ const actions = {
|
||||
// 初始化websocket
|
||||
initWebSocket({ state, commit, dispatch, rootState }) {
|
||||
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
|
||||
}
|
||||
commit('setData', { name: 'connecting', data: true })
|
||||
websock = new WebSocket(process.env.VUE_APP_SOCKET_API)
|
||||
websock.onmessage = function (res) {
|
||||
dispatch('websocketonmessage', res)
|
||||
@@ -399,10 +401,12 @@ const actions = {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!state.serviceStatus) {
|
||||
commit('setData', { name: 'printer_error', data: {type: 'warning', message: '服务连接中,请耐心等待', notify: '' } })
|
||||
reject()
|
||||
return
|
||||
}
|
||||
if (!state.isConnect) {
|
||||
commit('setData', { name: 'printer_error', data: {type: 'warning', message: '请先打开服务', notify: '' } })
|
||||
reject()
|
||||
return
|
||||
}
|
||||
websock.send(JSON.stringify(res))
|
||||
@@ -412,6 +416,7 @@ const actions = {
|
||||
// 链接建立之后执行的方法
|
||||
websocketonopen: ({ commit, dispatch }, res) => {
|
||||
console.log('链接建立之后执行send方法发送数据', res)
|
||||
commit('setData', { name: 'connecting', data: false })
|
||||
commit('setData', { name: 'isConnect', data: true })
|
||||
commit('setData', { name: 'serviceStatus', data: true })
|
||||
},
|
||||
@@ -419,6 +424,7 @@ const actions = {
|
||||
websocketonclose: ({ state, commit, dispatch }, res) => {
|
||||
console.log('断开链接', res)
|
||||
// 关闭
|
||||
commit('setData', { name: 'connecting', data: false })
|
||||
commit('setData', { name: 'isConnect', data: false })
|
||||
for (let key in defaultData) {
|
||||
commit('setData', { name: key, data: defaultData[key] })
|
||||
@@ -432,6 +438,7 @@ const actions = {
|
||||
},
|
||||
// 链接错误之后执行的方法
|
||||
websocketonerror({ state, commit, dispatch }, res) {
|
||||
commit('setData', { name: 'connecting', data: false })
|
||||
commit('setData', { name: 'isConnect', data: false })
|
||||
commit('setData', { name: 'serviceStatus', data: false })
|
||||
state.reconnections += 1
|
||||
|
||||
Reference in New Issue
Block a user