This commit is contained in:
24kycj
2024-12-09 14:56:35 +08:00
parent f933a19025
commit 1f8f0dcb4c
7 changed files with 359 additions and 261 deletions
+19 -36
View File
@@ -2,13 +2,12 @@
"name": "soonworkerdisk", "name": "soonworkerdisk",
"version": "0.0.1", "version": "0.0.1",
"author": "24kycj <1637269896@qq.com>", "author": "24kycj <1637269896@qq.com>",
"description": "KaShu SoonWorkerDisk", "description": "Cardsoon SoonWorkerDisk",
"homepage": "https://www.cardsoon.com/index.php/cn", "homepage": "https://www.cardsoon.com/index.php/cn",
"license": "MIT", "license": "MIT",
"main": "./dist/electron/main.js", "main": "./dist/electron/main.js",
"scripts": { "scripts": {
"build": "node .electron-vue/build.js && electron-builder", "build": "node .electron-vue/build.js && electron-builder --arm64",
"build:linux": "node .electron-vue/build.js && electron-builder --linux",
"build:dir": "node .electron-vue/build.js && electron-builder --dir", "build:dir": "node .electron-vue/build.js && electron-builder --dir",
"build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js", "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js", "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
@@ -23,47 +22,31 @@
"postinstall": "npm run lint:fix" "postinstall": "npm run lint:fix"
}, },
"build": { "build": {
"productName": "soonworkerdisk", "productName": "soonworkerD",
"appId": "com.kashu.soonworkerdisk", "appId": "com.cardsoon.soonworkerD",
"extraFiles": [ "extraFiles": [
{ {
"from": "./User Templates", "from": "User Templates",
"to": "." "to": "./User Templates"
}, },
{ {
"from": "./cardsoonServer", "from": "cardsoonServer",
"to": "." "to": "./CardsoonServer"
} }
], ],
"linux": {
"maintainer": "Jerry Xu <jerry79.xu@gmail.com>",
"category": "Utility",
"target": [
"AppImage",
"deb",
"rpm"
],
"icon": "public/images/favicon.svg"
},
"copyright": "Copyright@2023 cardsoon.com",
"directories": { "directories": {
"output": "build" "output": "build"
},
"files": [
"dist/electron/**/*"
],
"dmg": {
"contents": [
{
"x": 410,
"y": 150,
"type": "link",
"path": "/Applications"
},
{
"x": 130,
"y": 150,
"type": "file"
}
]
},
"mac": {
"icon": "build/icons/icon.icns"
},
"win": {
"icon": "build/icons/icon.ico"
},
"linux": {
"icon": "build/icons"
} }
}, },
"dependencies": { "dependencies": {
+6 -2
View File
@@ -210,6 +210,9 @@ const dayjs = require('dayjs')
import fileEmpty from './files/fileEmpty' import fileEmpty from './files/fileEmpty'
import files from './files/file' import files from './files/file'
const exePath = path.dirname(process.execPath)
// const exePath = process.cwd();
export default { export default {
name: 'UserInfo', name: 'UserInfo',
components: { fileEmpty, files }, components: { fileEmpty, files },
@@ -720,7 +723,7 @@ export default {
}, },
// 获取模板文件列表 // 获取模板文件列表
getTemplates() { getTemplates() {
const filePath = path.join(process.cwd(), 'User Templates'); const filePath = path.join(exePath, 'User Templates');
fs.readdir(filePath, (err, files) => { fs.readdir(filePath, (err, files) => {
if (err) { if (err) {
console.log(err) console.log(err)
@@ -892,7 +895,8 @@ export default {
}, },
setSure() { setSure() {
this.setShow = false this.setShow = false
this.$store.commit('setData', { name: 'setForm', data: this.setForm }) that.$store.dispatch('chat/setDatas', {name: 'workStatus', data: true})
this.$store.dispatch('setDatas', { name: 'setForm', data: this.setForm })
} }
} }
} }
+11 -5
View File
@@ -313,6 +313,10 @@ const mutations = {
} }
const actions = { const actions = {
// 改变state值
setDatas: ({ commit }, data) => {
commit('setData', data)
},
// 初始化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')
@@ -450,7 +454,13 @@ const actions = {
} }
if (error.printer_error) { if (error.printer_error) {
error.printer_error = '0x' + error.printer_error.toString(16) error.printer_error = '0x' + error.printer_error.toString(16)
commit('setData', { name: 'printer_error', data: { type: 'error', confirm: printer_errors[error.printer_error], req: 'continue_task' } }) let continues = ['0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x21']
let req = continues.indexOf(error.printer_error) > -1 ? 'continue_task' : ''
if (req) {
commit('setData', { name: 'printer_error', data: { type: 'error', confirm: printer_errors[error.printer_error], req: req } })
} else {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: printer_errors[error.printer_error] } })
}
} }
} }
} else { } else {
@@ -524,10 +534,6 @@ const actions = {
closeWebsocket: () => { closeWebsocket: () => {
// 关闭 // 关闭
if (websock) websock.close() if (websock) websock.close()
},
// 改变工作状态
changeWorkStatus: ({ commit }, data) => {
commit('setData', { name: 'workStatus', data: data })
} }
} }
+5
View File
@@ -18,6 +18,7 @@ const user = {
avatar: avatar:
'https://image.baidu.com/search/detail?ct=503316480&z=&tn=baiduimagedetail&ipn=d&word=admin&step_word=&lid=8980923753406439282&ie=utf-8&in=&cl=2&lm=-1&st=-1&hd=&latest=&copyright=&cs=1902119677,258344230&os=3526618670,2431782315&simid=3426573763,123057590&pn=11&rn=1&di=7410818322373017601&ln=1928&fr=&fmq=1730735680169_R&ic=&s=undefined&se=&sme=&tab=0&width=&height=&face=undefined&is=0,0&istype=2&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=1e&objurl=https%3A%2F%2Fclearhub.tech%2Fwp-content%2Fuploads%2F2018%2F11%2F12.png&rpstart=0&rpnum=0&adpicid=0&nojc=undefined&dyTabStr=MCwzLDEsMiwxMyw3LDYsNSwxMiw5', 'https://image.baidu.com/search/detail?ct=503316480&z=&tn=baiduimagedetail&ipn=d&word=admin&step_word=&lid=8980923753406439282&ie=utf-8&in=&cl=2&lm=-1&st=-1&hd=&latest=&copyright=&cs=1902119677,258344230&os=3526618670,2431782315&simid=3426573763,123057590&pn=11&rn=1&di=7410818322373017601&ln=1928&fr=&fmq=1730735680169_R&ic=&s=undefined&se=&sme=&tab=0&width=&height=&face=undefined&is=0,0&istype=2&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=1e&objurl=https%3A%2F%2Fclearhub.tech%2Fwp-content%2Fuploads%2F2018%2F11%2F12.png&rpstart=0&rpnum=0&adpicid=0&nojc=undefined&dyTabStr=MCwzLDEsMiwxMyw3LDYsNSwxMiw5',
roles: ['admin'], roles: ['admin'],
oneLogin: false,
// 高级设置 // 高级设置
setForm: setFormDefault, setForm: setFormDefault,
}, },
@@ -41,6 +42,10 @@ const user = {
}, },
actions: { actions: {
// 改变state值
setDatas: ({ commit }, data) => {
commit('setData', data)
},
// 登录 // 登录
Login({ commit }, userInfo) { Login({ commit }, userInfo) {
const username = userInfo.username.trim() const username = userInfo.username.trim()
+181 -81
View File
@@ -1,8 +1,5 @@
<template> <template>
<div class="container_box" v-loading="serviceLoading" <div class="container_box" v-loading="serviceLoading" :element-loading-text="serviceText" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
:element-loading-text="serviceText"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)">
<!-- 头部 --> <!-- 头部 -->
<div class="flex_box flex_row_between top_box"> <div class="flex_box flex_row_between top_box">
<div class="flex_box top_left"> <div class="flex_box top_left">
@@ -66,7 +63,7 @@
<div class="device_info_option_cap"> <div class="device_info_option_cap">
<div <div
class="device_info_option_cap_box" class="device_info_option_cap_box"
:class="{ 'device_info_option_cap_box1': printer_info.strongList[2].cd_num < 30, 'device_info_option_cap_box2': printer_info.strongList[2].cd_num < 10 }" :class="{ device_info_option_cap_box1: printer_info.strongList[2].cd_num < 30, device_info_option_cap_box2: printer_info.strongList[2].cd_num < 10 }"
:style="{ height: $accDiv(printer_info.strongList[2].cd_num, 50) * 100 + '%' }" :style="{ height: $accDiv(printer_info.strongList[2].cd_num, 50) * 100 + '%' }"
></div> ></div>
</div> </div>
@@ -78,7 +75,12 @@
<i v-if="currentRunVal === 6" class="el-icon-caret-bottom"></i> <i v-if="currentRunVal === 6" class="el-icon-caret-bottom"></i>
</div> </div>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"><span :style="{'color': index === printer_info.strongList[2].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[2].cd_type ? '600' : '400' }">{{ item }}</span></el-dropdown-item> <el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"
><span
:style="{ color: index === printer_info.strongList[2].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[2].cd_type ? '600' : '400' }"
>{{ item }}</span
></el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
@@ -89,7 +91,7 @@
<div class="device_info_option_cap"> <div class="device_info_option_cap">
<div <div
class="device_info_option_cap_box" class="device_info_option_cap_box"
:class="{ 'device_info_option_cap_box1': printer_info.strongList[1].cd_num < 30, 'device_info_option_cap_box2': printer_info.strongList[1].cd_num < 10 }" :class="{ device_info_option_cap_box1: printer_info.strongList[1].cd_num < 30, device_info_option_cap_box2: printer_info.strongList[1].cd_num < 10 }"
:style="{ height: $accDiv(printer_info.strongList[1].cd_num, 50) * 100 + '%' }" :style="{ height: $accDiv(printer_info.strongList[1].cd_num, 50) * 100 + '%' }"
></div> ></div>
</div> </div>
@@ -101,7 +103,12 @@
<i v-if="currentRunVal === 6" class="el-icon-caret-bottom"></i> <i v-if="currentRunVal === 6" class="el-icon-caret-bottom"></i>
</div> </div>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"><span :style="{'color': index === printer_info.strongList[1].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[1].cd_type ? '600' : '400' }">{{ item }}</span></el-dropdown-item> <el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"
><span
:style="{ color: index === printer_info.strongList[1].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[1].cd_type ? '600' : '400' }"
>{{ item }}</span
></el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
@@ -124,7 +131,9 @@
<div class="device_info_option_b_text device_info_option_b_text1">{{ parseInt(printer_info.yellow_last) }}%</div> <div class="device_info_option_b_text device_info_option_b_text1">{{ parseInt(printer_info.yellow_last) }}%</div>
</div> </div>
<div v-if="isLast" @click="isLast = false" class="flex_box flex_row_center device_info_option_b"> <div v-if="isLast" @click="isLast = false" class="flex_box flex_row_center device_info_option_b">
<div class="device_info_option_b_text device_info_option_b_text1">{{ parseInt($accDiv($accAdd($accAdd(printer_info.blue_last,printer_info.red_last),printer_info.yellow_last),3)) }}%</div> <div class="device_info_option_b_text device_info_option_b_text1">
{{ parseInt($accDiv($accAdd($accAdd(printer_info.blue_last, printer_info.red_last), printer_info.yellow_last), 3)) }}%
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -148,7 +157,14 @@
</div> </div>
</div> </div>
<!-- <div class="flex_box device_status" :class="`flex_box device_status device_status${printer_info.printer_status} device_status${printer_info.cover_flag}`"> --> <!-- <div class="flex_box device_status" :class="`flex_box device_status device_status${printer_info.printer_status} device_status${printer_info.cover_flag}`"> -->
<div class="flex_box device_status" :class="{ 'device_status1': printer_info.printer_status === 'I', 'device_status2': printer_info.printer_status === 'B' || printer_info.printer_status === 'P', 'device_status3': printer_info.cover_flag || printer_info.calibration_flag || printer_info.lack_ink || !isConnect || !serviceStatus }"> <div
class="flex_box device_status"
:class="{
device_status1: printer_info.printer_status === 'I',
device_status2: printer_info.printer_status === 'B' || printer_info.printer_status === 'P',
device_status3: printer_info.cover_flag || printer_info.calibration_flag || printer_info.lack_ink || !isConnect || !serviceStatus
}"
>
<div class="device_status_dot"></div> <div class="device_status_dot"></div>
<div class="device_status_text">{{ runText }}</div> <div class="device_status_text">{{ runText }}</div>
</div> </div>
@@ -175,9 +191,11 @@
<div class="device_right_top_title">{{ cd_list[0].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[0].cd_pos] }})</div> <div class="device_right_top_title">{{ cd_list[0].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[0].cd_pos] }})</div>
<template v-if="cd_list[0].copy_scheduler > 0"> <template v-if="cd_list[0].copy_scheduler > 0">
<div class="flex_box device_right_top_progress"> <div class="flex_box device_right_top_progress">
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[0].copy_scheduler + '%' }"></div> <div class="device_right_top_progress_box" :style="{ width: cd_list[0].copy_scheduler + '%' }"></div>
</div>
<div class="device_right_top_text">
已刻录{{ $filterSize(cd_list[0].use_size) }}{{ $filterSize(cd_list[0].total_size) }}<span v-if="cd_list[0].burn_speed">速度{{ cd_list[0].burn_speed.toFixed(2) }}X</span>
</div> </div>
<div class="device_right_top_text">已刻录{{ $filterSize(cd_list[0].use_size) }}{{ $filterSize(cd_list[0].total_size) }}<span v-if="cd_list[0].burn_speed">速度{{ cd_list[0].burn_speed.toFixed(2) }}X</span></div>
</template> </template>
<div class="device_right_top_text">状态{{ $store.state.chat.CDStatus[cd_list[0].cd_status] }}</div> <div class="device_right_top_text">状态{{ $store.state.chat.CDStatus[cd_list[0].cd_status] }}</div>
<div class="device_right_top_text">任务{{ cd_list[0].cd_taskid && cd_list[0].copy_scheduler ? cd_list[0].cd_taskid : '' }}</div> <div class="device_right_top_text">任务{{ cd_list[0].cd_taskid && cd_list[0].copy_scheduler ? cd_list[0].cd_taskid : '' }}</div>
@@ -196,9 +214,11 @@
<div class="device_right_top_title">{{ cd_list[1].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[1].cd_pos] }})</div> <div class="device_right_top_title">{{ cd_list[1].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[1].cd_pos] }})</div>
<template v-if="cd_list[1].copy_scheduler"> <template v-if="cd_list[1].copy_scheduler">
<div class="flex_box device_right_top_progress"> <div class="flex_box device_right_top_progress">
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[1].copy_scheduler + '%' }"></div> <div class="device_right_top_progress_box" :style="{ width: cd_list[1].copy_scheduler + '%' }"></div>
</div>
<div class="device_right_top_text">
已刻录{{ $filterSize(cd_list[1].use_size) }}{{ $filterSize(cd_list[1].total_size) }}<span v-if="cd_list[1].burn_speed">速度{{ cd_list[1].burn_speed.toFixed(2) }}X</span>
</div> </div>
<div class="device_right_top_text">已刻录{{ $filterSize(cd_list[1].use_size) }}{{ $filterSize(cd_list[1].total_size) }}<span v-if="cd_list[1].burn_speed">速度{{ cd_list[1].burn_speed.toFixed(2) }}X</span></div>
</template> </template>
<div class="device_right_top_text">状态{{ $store.state.chat.CDStatus[cd_list[1].cd_status] }}</div> <div class="device_right_top_text">状态{{ $store.state.chat.CDStatus[cd_list[1].cd_status] }}</div>
<div class="device_right_top_text">任务{{ cd_list[1].cd_taskid && cd_list[1].copy_scheduler ? cd_list[1].cd_taskid : '' }}</div> <div class="device_right_top_text">任务{{ cd_list[1].cd_taskid && cd_list[1].copy_scheduler ? cd_list[1].cd_taskid : '' }}</div>
@@ -307,8 +327,9 @@ import { mapGetters } from 'vuex'
const { app, dialog } = require('@electron/remote') const { app, dialog } = require('@electron/remote')
import UserInfo from '@/components/userInfo/userInfo.vue' import UserInfo from '@/components/userInfo/userInfo.vue'
import WorkAdd from '@/components/workAdd/workAdd.vue' import WorkAdd from '@/components/workAdd/workAdd.vue'
const exePath = process.cwd(); const exePath = path.dirname(process.execPath)
const shPath = path.join(exePath, 'cardsoonServer', 'control.sh') // const exePath = process.cwd();
const shPath = path.join(exePath, 'CardsoonServer', 'control.sh')
export default { export default {
name: 'dashboard', name: 'dashboard',
components: { UserInfo, WorkAdd }, components: { UserInfo, WorkAdd },
@@ -403,6 +424,17 @@ export default {
} }
}, },
watch: { watch: {
'$store.state.user.oneLogin': {
handler(val) {
console.log(val, 'oneLoginoneLoginoneLogin')
if (val) {
this.$store.dispatch('setDatas', { name: 'oneLogin', data: false })
this.startService()
}
},
deep: true,
immediate: true
},
'$store.state.chat.task_list': { '$store.state.chat.task_list': {
handler(val) { handler(val) {
if (val && val.length) { if (val && val.length) {
@@ -529,39 +561,45 @@ export default {
}, },
workStatus() { workStatus() {
return this.isConnect && this.serviceStatus return this.isConnect && this.serviceStatus
}, }
}, },
mounted() { mounted() {
that = this that = this
let name = 'ERR_ELECTRON_BUILDER_CANNOT_EXECUTE'
console.log(name.toLowerCase())
}, },
methods: { methods: {
// 服务打开/关闭 // 服务打开/关闭
serviceChange(e) { serviceChange(e) {
let that = this
// if (!that.serviceStatus) { // if (!that.serviceStatus) {
// return // return
// } // }
console.log(e)
that.serviceLoading = true
if (e) { if (e) {
that.serviceText = '服务启动中' that
this.$runCmd(`bash ${shPath} start`).then(res => { .$confirm('确定执行开启服务操作吗?', '温馨提示', {
that.$store.dispatch('chat/changeWorkStatus', true) confirmButtonText: '确定',
setTimeout(() => { cancelButtonText: '取消',
that.$store.dispatch('chat/initWebSocket') type: 'warning'
}, 500);
}).catch(err => {
that.$message({
message: err,
type: 'error'
}) })
.then(() => {
that.startService()
})
.catch(() => {
that.serviceLoading = false that.serviceLoading = false
}) })
} else { } else {
that
.$confirm('确定执行开启服务操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.serviceLoading = true
that.serviceText = '服务关闭中' that.serviceText = '服务关闭中'
this.$runCmd(`bash ${shPath} stop`).then(res => { that
that.$store.dispatch('chat/changeWorkStatus', false) .$runCmd(`bash ${shPath} stop`)
.then((res) => {
that.$store.dispatch('chat/setDatas', { name: 'workStatus', data: false })
setTimeout(() => { setTimeout(() => {
that.$store.dispatch('chat/closeWebsocket') that.$store.dispatch('chat/closeWebsocket')
that.serviceLoading = false that.serviceLoading = false
@@ -569,16 +607,41 @@ export default {
message: '服务已关闭', message: '服务已关闭',
type: 'success' type: 'success'
}) })
}, 500); }, 500)
}).catch(err => { })
.catch((err) => {
that.$message({ that.$message({
message: err, message: err,
type: 'error' type: 'error'
}) })
that.serviceLoading = false that.serviceLoading = false
}) })
})
.catch(() => {
that.serviceLoading = false
})
} }
}, },
startService() {
let that = this
that.serviceLoading = true
that.serviceText = '服务启动中'
that
.$runCmd(`bash ${shPath} start`)
.then((res) => {
that.$store.dispatch('chat/setDatas', { name: 'workStatus', data: true })
setTimeout(() => {
that.$store.dispatch('chat/initWebSocket')
}, 500)
})
.catch((err) => {
that.$message({
message: err,
type: 'error'
})
that.serviceLoading = false
})
},
// 执行 // 执行
handleRun() { handleRun() {
if (!that.workStatus) { if (!that.workStatus) {
@@ -603,154 +666,184 @@ export default {
switch (that.runVal) { switch (that.runVal) {
case 1: case 1:
// 重启设备 // 重启设备
that.$confirm('确定执行重启设备操作吗?', '温馨提示', { that
.$confirm('确定执行重启设备操作吗?', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
that.$store.dispatch('chat/websocketsend', { .then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'resetPrinter', req_name: 'resetPrinter',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
}) })
break; break
case 2: case 2:
// 清除错误 // 清除错误
that.$confirm('确定执行清除错误操作吗?', '温馨提示', { that
.$confirm('确定执行清除错误操作吗?', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
that.$store.dispatch('chat/websocketsend', { .then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev', req_name: 'autoSetCDDev',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
}) })
that.$store.dispatch('chat/websocketsend', { that.$store
.dispatch('chat/websocketsend', {
req_name: 'cleanError', req_name: 'cleanError',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
break; break
case 3: case 3:
// 校准盘仓 // 校准盘仓
that.$confirm('确定执行校准盘仓操作吗?', '温馨提示', { that
.$confirm('确定执行校准盘仓操作吗?', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
that.$store.dispatch('chat/websocketsend', { .then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev', req_name: 'autoSetCDDev',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
}) })
that.$store.dispatch('chat/websocketsend', { that.$store
.dispatch('chat/websocketsend', {
req_name: 'CaliCDStone', req_name: 'CaliCDStone',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
break; break
case 4: case 4:
// 校准设备 // 校准设备
that.$confirm('确定执行校准设备操作吗?', '温馨提示', { that
.$confirm('确定执行校准设备操作吗?', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
that.$store.dispatch('chat/websocketsend', { .then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev', req_name: 'autoSetCDDev',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
}) })
that.$store.dispatch('chat/websocketsend', { that.$store
.dispatch('chat/websocketsend', {
req_name: 'CaliPrinter', req_name: 'CaliPrinter',
req_type: 1, req_type: 1,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
break; break
case 5: case 5:
// 自动匹配光驱 // 自动匹配光驱
that.$confirm('确定执行自动匹配光驱操作吗?', '温馨提示', { that
.$confirm('确定执行自动匹配光驱操作吗?', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
that.$store.dispatch('chat/websocketsend', { .then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev', req_name: 'autoSetCDDev',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
}) })
break; break
case 6: case 6:
outTimer = setTimeout(() => { outTimer = setTimeout(() => {
that.currentRunVal = 0 that.currentRunVal = 0
that.printer_info.strongList = that.default_cd that.printer_info.strongList = that.default_cd
}, 120000); }, 120000)
break; break
case 7: case 7:
// 进入运输模式 // 进入运输模式
that.$confirm('请确保已经取掉左右光盘仓托架,再点击确定', '温馨提示', { that
.$confirm('请确保已经取掉左右光盘仓托架,再点击确定', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
that.$store.dispatch('chat/websocketsend', { .then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'TransportMode', req_name: 'TransportMode',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
}) })
break; break
} }
that.currentRunVal = that.runVal that.currentRunVal = that.runVal
}, },
@@ -760,10 +853,13 @@ export default {
that.changeCD.req_info.strong_list[type - 1].strong_type = e that.changeCD.req_info.strong_list[type - 1].strong_type = e
}, },
sureCD() { sureCD() {
that.$store.dispatch('chat/websocketsend', that.changeCD).then(() => { that.$store
.dispatch('chat/websocketsend', that.changeCD)
.then(() => {
clearTimeout(outTimer) clearTimeout(outTimer)
that.currentRunVal = 0 that.currentRunVal = 0
}).catch(() => { })
.catch(() => {
clearTimeout(outTimer) clearTimeout(outTimer)
that.currentRunVal = 0 that.currentRunVal = 0
}) })
@@ -833,20 +929,22 @@ export default {
}, },
// 作业重试 // 作业重试
workRetry(e) { workRetry(e) {
that.$store.dispatch('chat/websocketsend', { that.$store
.dispatch('chat/websocketsend', {
req_name: 'retry_task', req_name: 'retry_task',
req_type: 1, req_type: 1,
req_info: { req_info: {
task_uuid: that.task_list[e].task_uuid task_uuid: that.task_list[e].task_uuid
} }
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '重试成功', message: '重试成功',
type: 'success' type: 'success'
}) })
that.task_list[e].task_status = 1 that.task_list[e].task_status = 1
if (that.task_list[e].ass_task && that.task_list[e].ass_task.length > 0) { if (that.task_list[e].ass_task && that.task_list[e].ass_task.length > 0) {
that.task_list[e].ass_task.forEach(item => { that.task_list[e].ass_task.forEach((item) => {
item.task_status = 1 item.task_status = 1
}) })
} }
@@ -854,20 +952,22 @@ export default {
}, },
// 作业取消 // 作业取消
workCancel(e) { workCancel(e) {
that.$store.dispatch('chat/websocketsend', { that.$store
.dispatch('chat/websocketsend', {
req_name: 'cancle_task', req_name: 'cancle_task',
req_type: 1, req_type: 1,
req_info: { req_info: {
task_uuid: that.task_list[e].task_uuid task_uuid: that.task_list[e].task_uuid
} }
}).then(() => { })
.then(() => {
that.$message({ that.$message({
message: '取消成功', message: '取消成功',
type: 'success' type: 'success'
}) })
that.task_list[e].task_status = 7 that.task_list[e].task_status = 7
if (that.task_list[e].ass_task && that.task_list[e].ass_task.length > 0) { if (that.task_list[e].ass_task && that.task_list[e].ass_task.length > 0) {
that.task_list[e].ass_task.forEach(item => { that.task_list[e].ass_task.forEach((item) => {
item.task_status = 7 item.task_status = 7
}) })
} }
+3 -3
View File
@@ -81,10 +81,10 @@ export default {
this.loading = true this.loading = true
setToken('data.token') setToken('data.token')
if (localStorage.getItem('setForm')) { if (localStorage.getItem('setForm')) {
this.$store.commit('setData', {name: 'setForm', data: localStorage.getItem('setForm')}) this.$store.dispatch('setDatas', {name: 'setForm', data: localStorage.getItem('setForm')})
} }
this.$store.commit('SET_TOKEN', 'data.token') this.$store.dispatch('setDatas', {name: 'token', data: 'data.token'})
this.$store.dispatch('chat/initWebSocket') // 初始化websocket this.$store.dispatch('setDatas', {name: 'oneLogin', data: true})
setTimeout(() => { setTimeout(() => {
this.loading = false this.loading = false
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
+1 -1
View File
@@ -557,7 +557,7 @@ export default {
}, },
// 刷新时间 // 刷新时间
handleRefresh() { handleRefresh() {
this.$store.commit('chat/setData', { this.$store.dispatch('chat/setDatas', {
name: 'refreshTime', name: 'refreshTime',
data: this.refreshTime data: this.refreshTime
}) })