Commit 5cc22b5a authored by 秦嘉's avatar 秦嘉

工站页面样式和所有接口

parent 89f328e7
...@@ -45,6 +45,20 @@ export function updateStation(data) { ...@@ -45,6 +45,20 @@ export function updateStation(data) {
}) })
} }
// 修改工站状态
export function changeStaStatus(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/nltstation/changeStatus/' + businessId,
method: 'put',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
// 删除工站(逻辑删除) // 删除工站(逻辑删除)
export function delStation(stationID) { export function delStation(stationID) {
return request({ return request({
......
...@@ -45,6 +45,20 @@ export function updateDevice(data) { ...@@ -45,6 +45,20 @@ export function updateDevice(data) {
}) })
} }
// 修改设备状态
export function changeDevStatus(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/nltdevice/changeStatus/' + businessId,
method: 'put',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
// 删除设备(逻辑删除) // 删除设备(逻辑删除)
export function delDevice(deviceID) { export function delDevice(deviceID) {
return request({ return request({
......
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button> <el-button class="canleBtn" @click="cancel">取 消</el-button>
<el-button type="danger" class="redBtn" @click="submitForm">确 定</el-button> <el-button type="danger" class="redBtn" @click="submitForm">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
<script> <script>
import { listData } from '@/api/system/dict/data' import { listData } from '@/api/system/dict/data'
import { addStation, delStation, getStation, listStation, updateStation } from '@/api/station' import { changeStaStatus, addStation, delStation, getStation, listStation, updateStation } from '@/api/station'
export default { export default {
name: 'Station', name: 'Station',
...@@ -304,20 +304,17 @@ export default { ...@@ -304,20 +304,17 @@ export default {
this.$confirm(`“${row.staName}”工站即将被${text},是否继续?`, '提示', { this.$confirm(`“${row.staName}”工站即将被${text},是否继续?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
cancelButtonClass: 'btn-custom-cancel',
customClass: 'confirmBtnSure', customClass: 'confirmBtnSure',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
const flag = row.flag return changeStaStatus(row)
return getStation(row.businessId).then(response => {
row = response.data
row.flag = flag
return updateStation(row)
})
}).then(() => { }).then(() => {
this.$message({ this.$message({
message: text + '成功', message: text + '成功',
type: 'success' type: 'success'
}) })
this.getStaTable()
}).catch(function() { }).catch(function() {
row.flag = row.flag === '0' ? '1' : '0' row.flag = row.flag === '0' ? '1' : '0'
}) })
...@@ -338,6 +335,7 @@ export default { ...@@ -338,6 +335,7 @@ export default {
this.$confirm('所选择数据被删除后不可再恢复,是否继续?', '提示', { this.$confirm('所选择数据被删除后不可再恢复,是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
cancelButtonClass: 'btn-custom-cancel',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
return delStation(row.businessId) return delStation(row.businessId)
......
...@@ -238,7 +238,14 @@ ...@@ -238,7 +238,14 @@
</template> </template>
<script> <script>
import { addDevice, delDevice, getDevice, listDevice, updateDevice } from '@/api/system/device' import {
addDevice,
changeDevStatus,
delDevice,
getDevice,
listDevice,
updateDevice
} from '@/api/system/device'
import { listPost } from '@/api/badDefinition' import { listPost } from '@/api/badDefinition'
export default { export default {
...@@ -375,17 +382,13 @@ export default { ...@@ -375,17 +382,13 @@ export default {
customClass: 'confirmBtnSure', customClass: 'confirmBtnSure',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
const flag = row.flag return changeDevStatus(row)
getDevice(row.businessId).then(response => {
row = response.data
row.flag = flag
return updateDevice(row)
})
}).then(() => { }).then(() => {
this.$message({ this.$message({
message: text + '成功', message: text + '成功',
type: 'success' type: 'success'
}) })
this.getDevTable()
}).catch(function() { }).catch(function() {
row.flag = row.flag === '0' ? '1' : '0' row.flag = row.flag === '0' ? '1' : '0'
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment