|
|
|
|
@ -4,16 +4,26 @@
|
|
|
|
|
<a-button type="primary" class="add" @click="showModel('add','')">
|
|
|
|
|
新增
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button type="primary" class="plc" @click="goIo">
|
|
|
|
|
导入
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-upload
|
|
|
|
|
name="file"
|
|
|
|
|
:multiple="true"
|
|
|
|
|
accept=".xlsx"
|
|
|
|
|
:action="uploadProps.action"
|
|
|
|
|
:showUploadList = 'false'
|
|
|
|
|
@change="handleChange"
|
|
|
|
|
ref="table"
|
|
|
|
|
>
|
|
|
|
|
<a-button type="primary" class="plc" @click="goIo">
|
|
|
|
|
导入
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-upload>
|
|
|
|
|
</div>
|
|
|
|
|
<a-table
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:row-key="record => record.id"
|
|
|
|
|
:data-source="data"
|
|
|
|
|
:pagination="pagination"
|
|
|
|
|
@change="handleGetCameraList"
|
|
|
|
|
@change="handleGetCameraIoList"
|
|
|
|
|
>
|
|
|
|
|
<span slot="action" slot-scope="text, record">
|
|
|
|
|
<a-divider type="vertical"/>
|
|
|
|
|
@ -42,14 +52,20 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import Model from "./ioModel.vue"
|
|
|
|
|
import { importExcelUrl } from "@/api/importExcel";
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
title: 'ID',
|
|
|
|
|
dataIndex: 'name',
|
|
|
|
|
title: '序号',
|
|
|
|
|
// dataIndex: 'id',
|
|
|
|
|
customRender: (text, record, index) => {
|
|
|
|
|
return (
|
|
|
|
|
(record.pageNumber - 1) * 10 + index + 1
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'IO指令',
|
|
|
|
|
dataIndex: 'ip',
|
|
|
|
|
dataIndex: 'name',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '修改时间',
|
|
|
|
|
@ -69,6 +85,7 @@ export default {
|
|
|
|
|
data: [],
|
|
|
|
|
pagination:{
|
|
|
|
|
total:0,
|
|
|
|
|
current:1,
|
|
|
|
|
defaultPageSize:10, // 默认每页显示数量
|
|
|
|
|
showTotal: total => `共 ${total} 条数据`, // 显示总数
|
|
|
|
|
showSizeChanger:true, // 显示可改变每页数量
|
|
|
|
|
@ -79,14 +96,30 @@ export default {
|
|
|
|
|
columns,
|
|
|
|
|
visible:false,
|
|
|
|
|
modelType:'',
|
|
|
|
|
modelData:[]
|
|
|
|
|
modelData:[],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed:{
|
|
|
|
|
uploadProps() {
|
|
|
|
|
return {
|
|
|
|
|
action: importExcelUrl//上传Excel文件的路径
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.handleGetCameraList()
|
|
|
|
|
this.handleGetCameraIoList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleGetCameraList(pagination) {
|
|
|
|
|
handleChange(data) {
|
|
|
|
|
console.log(data)
|
|
|
|
|
if (data.file.status == "done") { // 导入表格之后成功的回调
|
|
|
|
|
this.$message.success(data.file.response.message)
|
|
|
|
|
this.handleGetCameraIoList();
|
|
|
|
|
} else if(data.file.status == 'error'){ // 导入表格之后失败的回调
|
|
|
|
|
this.$message.error(data.file.response.message)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleGetCameraIoList(pagination) {
|
|
|
|
|
console.log(pagination)
|
|
|
|
|
if(pagination){
|
|
|
|
|
this.pagination.current = pagination.current;
|
|
|
|
|
@ -97,16 +130,19 @@ export default {
|
|
|
|
|
this.request();
|
|
|
|
|
},
|
|
|
|
|
request(){
|
|
|
|
|
this.$api.httpApi.getCameraList({
|
|
|
|
|
this.$api.httpApi.getCameraIoList({
|
|
|
|
|
data: {
|
|
|
|
|
pageNum:this.pageNum,
|
|
|
|
|
pageSize:this.pageSize,
|
|
|
|
|
page:this.pageNum,
|
|
|
|
|
size:this.pageSize,
|
|
|
|
|
}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
const pagination = { ...this.pagination };
|
|
|
|
|
pagination.total = res.data.total;
|
|
|
|
|
this.data = res.data.list;
|
|
|
|
|
this.pagination = pagination;
|
|
|
|
|
res.data.list.forEach((value,index) => {
|
|
|
|
|
value.pageNumber = this.pagination.current
|
|
|
|
|
});
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
@ -119,7 +155,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
submit(visible){
|
|
|
|
|
this.visible = visible
|
|
|
|
|
this.handleGetCameraList()
|
|
|
|
|
this.handleGetCameraIoList()
|
|
|
|
|
},
|
|
|
|
|
closeModel(visible,data){
|
|
|
|
|
this.visible = visible
|
|
|
|
|
@ -128,12 +164,12 @@ export default {
|
|
|
|
|
delDosage(data){
|
|
|
|
|
console.log(data.id)
|
|
|
|
|
var id=data.id
|
|
|
|
|
this.$axios.delete('/camera/'+id, {
|
|
|
|
|
this.$axios.delete('/camera/config/'+id, {
|
|
|
|
|
data: {}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if(res.code==200){
|
|
|
|
|
this.$message.success('删除球机成功');
|
|
|
|
|
this.handleGetCameraList()
|
|
|
|
|
this.$message.success('删除球机IO成功');
|
|
|
|
|
this.handleGetCameraIoList()
|
|
|
|
|
}
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
|
|
|
|
|
|