add plc publish function

This commit is contained in:
龚祖望 2023-08-29 10:52:52 +08:00
parent 0d2541359c
commit 3baeb6bad6
3 changed files with 22 additions and 6 deletions

View File

@ -23,3 +23,11 @@ export function remove(data) {
data data
}) })
} }
export function publish(data) {
return request({
url: '/protocolProduct/publish',
method: 'post',
data
})
}

View File

@ -49,7 +49,7 @@
<p style="margin-left: 0; text-align: center"> <p style="margin-left: 0; text-align: center">
<el-button <el-button
class="func_button" class="func_button"
@click="loadOnline(formula.deviceId)" @click="loadOnline(formula.productName)"
>在线烧录</el-button> >在线烧录</el-button>
</p> </p>
</div> </div>
@ -504,7 +504,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { getList, add, remove } from '@/api/terminal/plc' import { getList, add, remove, publish } from '@/api/terminal/plc'
export default { export default {
data() { data() {
@ -706,7 +706,9 @@ export default {
this.form.readItemList = [] this.form.readItemList = []
}, },
exportFile(formula) { exportFile(formula) {
const data = JSON.stringify(formula) const { deviceId, deviceName, productName, protocolType, readItemList, readPeriod, socketConfig } = formula
const temp = { deviceId, deviceName, productName, protocolType, readItemList, readPeriod, socketConfig }
const data = JSON.stringify(temp)
const name = formula.productName + '.json' const name = formula.productName + '.json'
const url = window.URL.createObjectURL( const url = window.URL.createObjectURL(
new Blob([data], { type: 'application/json' }) new Blob([data], { type: 'application/json' })
@ -720,8 +722,14 @@ export default {
window.URL.revokeObjectURL(a.href) window.URL.revokeObjectURL(a.href)
document.body.removeChild(a) document.body.removeChild(a)
}, },
loadOnline(deviceId) { loadOnline(productName) {
console.log('在线烧录') this.$prompt('请输入终端id', '提示', { confirmButtonText: '确定', cancelButtonText: '取消' }).then(({ value }) => {
publish({ productName, clientId: value }).then(res => {
if (res.code === '200000') {
this.$message.success('配方推送成功')
}
})
})
} }
} }
} }

View File

@ -31,7 +31,7 @@ module.exports = {
proxy: { proxy: {
'/dashengda': { '/dashengda': {
// target: 'http://115.238.53.60:33333/', // 大胜达 // target: 'http://115.238.53.60:33333/', // 大胜达
target: 'http://192.168.140.64:8080/', // wty target: 'http://192.168.130.52:8080/', // wty
// target: 'http://10.0.30.23:8080', // target: 'http://10.0.30.23:8080',
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {