Commit cb3bb85a by 李俊

feat: 新增删除设备和联调接口

1 parent 7c14ee4b
Pipeline #5803 passed
in 2 minutes 11 seconds
...@@ -48,6 +48,7 @@ export const postServiceRequest = data => axios(POST, FRONT + DEVICE + '/service ...@@ -48,6 +48,7 @@ export const postServiceRequest = data => axios(POST, FRONT + DEVICE + '/service
export const postServiceCommand = data => axios(POST, FRONT + DEVICE + '/service/command', data) export const postServiceCommand = data => axios(POST, FRONT + DEVICE + '/service/command', data)
export const addTemplate = data => axios(POST, FRONT + DEVICE + '/service/template/dispatch', data) export const addTemplate = data => axios(POST, FRONT + DEVICE + '/service/template/dispatch', data)
export const deleteTemplate = data => axios(POST, FRONT + DEVICE + '/service/template/revoke', data) export const deleteTemplate = data => axios(POST, FRONT + DEVICE + '/service/template/revoke', data)
export const deleteDevice = data => axios(POST, FRONT + DEVICE + '/delete', data)
const SERVICE = '/service' const SERVICE = '/service'
export const getService = data => axios(POST, FRONT + SERVICE + '/query_list', data) export const getService = data => axios(POST, FRONT + SERVICE + '/query_list', data)
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</el-tooltip> </el-tooltip>
</div> </div>
<div slot='operate' slot-scope="row"> <div slot='operate' slot-scope="row">
<span class="operate-text operate-delete" @click="delete(row.id)">{{ '删除 '}}</span> <span class="operate-text operate-delete" @click="deleteDevice(row.id)">{{ '删除 '}}</span>
</div> </div>
</st-table> </st-table>
<p class="table-title">{{'包含服务'}}</p> <p class="table-title">{{'包含服务'}}</p>
...@@ -129,7 +129,7 @@ import browserStorage from '@/services/local-storage' ...@@ -129,7 +129,7 @@ import browserStorage from '@/services/local-storage'
import Dialog from '@/helpers/dialog' import Dialog from '@/helpers/dialog'
import validate from '@/components/seeta-ui/seeta-form/validator' import validate from '@/components/seeta-ui/seeta-form/validator'
import { rTimeMin, copyText } from '@/utils/system.js' import { rTimeMin, copyText } from '@/utils/system.js'
import { getServiceDevice, deleteTag, addTag } from '@/axios' import { getServiceDevice, deleteTag, addTag, deleteDevice } from '@/axios'
export default { export default {
data() { data() {
return { return {
...@@ -348,7 +348,16 @@ export default { ...@@ -348,7 +348,16 @@ export default {
// 跳转到设备详情页面 // 跳转到设备详情页面
detail(id) { detail(id) {
}, },
delete(id) { async deleteDevice(id) {
const confirmDelete = await Dialog.confirm('提示', { message: '确认删除设备?删除设备时,也会删除此设备上的所有服务,还会取消相应的参数模板和服务配置的参数。' })
if (!confirmDelete) return
const res = await deleteDevice({ deviceid: this.currentDeviceId })
if (res) {
this.$message({
message: '删除成功',
type: 'success'
})
}
}, },
async getData() { async getData() {
const res = await getServiceDevice({ deviceid: this.currentDeviceId }) const res = await getServiceDevice({ deviceid: this.currentDeviceId })
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
<div class="list-item-content"> <div class="list-item-content">
<div> <div>
<span>{{'AppKey:'}}</span> <span>{{'AppKey:'}}</span>
<st-input width="240px" class="list-item-input" v-model="currentService.appid" show-password></st-input> <st-input width="240px" class="list-item-input" :value="currentService.appid" show-password></st-input>
</div> </div>
<div> <div>
<span>{{'Secret:'}}</span> <span>{{'Secret:'}}</span>
<st-input width="240px" class="list-item-input" v-model="currentService.secretkey" show-password></st-input> <st-input width="240px" class="list-item-input" :value="currentService.secretkey" show-password></st-input>
</div> </div>
<!-- <div class="list-item-icon"> <!-- <div class="list-item-icon">
<i class="el-icon-view blue-text"></i> <i class="el-icon-view blue-text"></i>
...@@ -521,6 +521,9 @@ export default { ...@@ -521,6 +521,9 @@ export default {
row.isBack = true row.isBack = true
this.$set(this.tokenList, index, JSON.parse(JSON.stringify(row))) this.$set(this.tokenList, index, JSON.parse(JSON.stringify(row)))
}, },
disableInput() {
return false
},
async deleteRow(index) { async deleteRow(index) {
const confirmDelete = await Dialog.confirm('提示', { message: '确认删除?' }) const confirmDelete = await Dialog.confirm('提示', { message: '确认删除?' })
if (!confirmDelete) return if (!confirmDelete) return
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div class="flex-left"> <div class="flex-left">
<div class="search-item"> <div class="search-item">
<span class="search-title">状态:</span> <span class="search-title">状态:</span>
<el-checkbox-group v-model="search.checkList" class="inline-div" @change="handleChangeSearch"> <el-checkbox-group :max="1" v-model="search.checkList" class="inline-div" @change="handleChangeSearch">
<el-checkbox :label="1" class="check-title">在线</el-checkbox> <el-checkbox :label="1" class="check-title">在线</el-checkbox>
<el-checkbox :label="0" class="check-title">离线</el-checkbox> <el-checkbox :label="0" class="check-title">离线</el-checkbox>
<el-checkbox :label="2" class="check-title">异常</el-checkbox> <el-checkbox :label="2" class="check-title">异常</el-checkbox>
...@@ -417,7 +417,7 @@ export default { ...@@ -417,7 +417,7 @@ export default {
}, },
async getData() { async getData() {
const res = await getDevice({ const res = await getDevice({
state: this.search.checkList, state: this.search.checkList ? this.search.checkList[0] : '',
pages: this.pi, pages: this.pi,
pagesize: this.ps, pagesize: this.ps,
structure: this.search.structure, structure: this.search.structure,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!