|
|
@ -10,6 +10,10 @@ |
|
|
|
</el-form-item> |
|
|
|
<div v-if="form.ip" style="margin-left: 20px; margin-top: 6px; cursor: pointer;" @click="handleService"><i class="iconfont icon-bendiguajie" /></div> |
|
|
|
<p style="line-height: 32px; margin-left: 20px; font-size: 12px;">设置成功后,方可执行视觉盘点任务</p> |
|
|
|
<div style="margin-left: 20px;"> |
|
|
|
<el-button :loading="resetLoading" @click="toVerify('reset')">重启服务</el-button> |
|
|
|
<!-- <el-button>关闭</el-button> --> |
|
|
|
</div> |
|
|
|
</el-row> |
|
|
|
<el-row style="display: flex; justify-content: flex-start;"> |
|
|
|
<el-form-item label="层位占用上限" prop="maxNum"> |
|
|
@ -19,7 +23,7 @@ |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<div> |
|
|
|
<el-button style="margin-left: 30px;" :loading="crud.status.cu === 2" type="primary" @click="toVerify">保存</el-button> |
|
|
|
<el-button style="margin-left: 30px;" :loading="crud.status.cu === 2" type="primary" @click="toVerify('add')">保存</el-button> |
|
|
|
<span style="line-height: 32px; margin-left: 20px; font-size: 12px;">设置需要超级管理员权限授权!</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -104,7 +108,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import crudStockTask, { FetchAITerminalStatusQuery } from '@/api/stockTask/index' |
|
|
|
import crudStockTask, { FetchAITerminalStatusQuery, FetchStartStopBookAIService } from '@/api/stockTask/index' |
|
|
|
import { encrypt } from '@/utils/rsaEncrypt' |
|
|
|
import { verifyMaintenance } from '@/api/system/param' |
|
|
|
import CRUD, { presenter, header, form, crud } from '@crud/crud' |
|
|
@ -148,7 +152,9 @@ export default { |
|
|
|
verfiyForm: { |
|
|
|
verifyCode: '' |
|
|
|
}, |
|
|
|
verifyStatus: '', |
|
|
|
showVerifyDialog: true, |
|
|
|
resetLoading: false, |
|
|
|
rules: { |
|
|
|
ip: [ |
|
|
|
{ required: true, message: 'AI处理终端IP不可为空', trigger: 'blur' } |
|
|
@ -181,12 +187,7 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
crudStockTask.FetchInitSetting().then(res => { |
|
|
|
this.crud.form.ip = res.ip |
|
|
|
this.maxNum = res.maxNum |
|
|
|
this.crud.form.maxNum = res.maxNum |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
this.initData() |
|
|
|
}, |
|
|
|
beforeDestroy() { |
|
|
|
if (this.timer) { |
|
|
@ -194,6 +195,14 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initData() { |
|
|
|
crudStockTask.FetchInitSetting().then(res => { |
|
|
|
this.crud.form.ip = res.ip |
|
|
|
this.maxNum = res.maxNum |
|
|
|
this.crud.form.maxNum = res.maxNum |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleService() { |
|
|
|
this.servicesDisplayed = false |
|
|
|
FetchAITerminalStatusQuery({ 'ip': this.crud.form.ip }).then(res => { |
|
|
@ -280,19 +289,23 @@ export default { |
|
|
|
return false |
|
|
|
}, |
|
|
|
toVerify(btn) { |
|
|
|
if (this.form.ip) { |
|
|
|
if (this.showVerifyDialog) { |
|
|
|
// 打开输入验证码对话框 |
|
|
|
this.verifyDialogVisible = true |
|
|
|
return false |
|
|
|
} |
|
|
|
this.verifyStatus = btn |
|
|
|
if (btn === 'reset') { |
|
|
|
this.verifyDialogVisible = true |
|
|
|
} else { |
|
|
|
this.$refs.form.validateField(['ip'], err => { |
|
|
|
console.log('err', err) |
|
|
|
if (err) { |
|
|
|
return |
|
|
|
if (this.form.ip) { |
|
|
|
if (this.showVerifyDialog) { |
|
|
|
this.verifyDialogVisible = true |
|
|
|
return false |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$refs.form.validateField(['ip'], err => { |
|
|
|
console.log('err', err) |
|
|
|
if (err) { |
|
|
|
return |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
handleConfirm() { |
|
|
@ -301,17 +314,39 @@ export default { |
|
|
|
this.verifyDialogVisible = false |
|
|
|
this.verfiyForm.verifyCode = '' |
|
|
|
this.showVerifyDialog = false |
|
|
|
crudStockTask.FetchEditSetting(this.crud.form).then(res => { |
|
|
|
console.log('res', res) |
|
|
|
this.$message({ message: '修改成功', type: 'success', offset: 8 }) |
|
|
|
this.crud.refresh() |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
if (this.verifyStatus === 'add') { |
|
|
|
crudStockTask.FetchEditSetting(this.crud.form).then(res => { |
|
|
|
this.$message({ message: '修改成功', type: 'success', offset: 8 }) |
|
|
|
this.initData() |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.resetLoading = true |
|
|
|
// 重启服务 |
|
|
|
this.handleConnectAIService() |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message({ message: '验证码错误!', type: 'error', offset: 8 }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
async handleConnectAIService() { |
|
|
|
try { |
|
|
|
// // 第一次先关闭 |
|
|
|
// const firstRes = await FetchStartStopBookAIService({ runType: 0 }) |
|
|
|
// console.log('先关闭', firstRes) |
|
|
|
// this.$message({ message: '关闭服务成功', type: 'success', offset: 8 }) |
|
|
|
// 第二次重新开启 |
|
|
|
// 1开启(先关后开) 2关闭 (彻底关闭) |
|
|
|
const secondRes = await FetchStartStopBookAIService({ runType: 1 }) |
|
|
|
console.log('后开启', secondRes) |
|
|
|
this.$message({ message: '重启服务成功', type: 'success', offset: 8 }) |
|
|
|
this.resetLoading = false |
|
|
|
} catch (error) { |
|
|
|
this.$message({ message: '请求失败', type: 'error', offset: 8 }) |
|
|
|
this.resetLoading = false |
|
|
|
} |
|
|
|
}, |
|
|
|
handleClose() { |
|
|
|
if (this.$refs.verfiyForm) { |
|
|
|
this.verfiyForm.verifyCode = '' |
|
|
|