Commit bcb61ca6 authored by xinzhedeai's avatar xinzhedeai

李春良 - 台账

parent dddcc757
import request from '@/utils/request'
import qs from 'qs'
export function getLedger(params) {
return request({
url: '/data/taizhang/history',
method: 'get',
params
})
}
export function addLedger(data) {
return request({
url: '/data/taizhang',
method: 'post',
data
})
}
export function editLedger(data) {
return request({
url: '/data/taizhang',
method: 'put',
data
})
}
export function delLedger(data) {
return request({
url: '/data/taizhang',
method: 'delete',
data
})
}
\ No newline at end of file
<template>
<div class="common-page qyzz page-t1">
<div class="head-container">
<!--表单组件-->
<el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="设备编号" prop="sensorno">
<el-input v-model="form.sensorno" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="sensorname">
<el-input v-model="form.sensorname" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="故障登记" prop="gzdj">
<el-input type="textarea" v-model="form.gzdj" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="检修记录" prop="jxjl">
<el-input type="textarea" v-model="form.jxjl" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="巡查记录" prop="xcjl">
<el-input type="textarea" v-model="form.xcjl" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="安装日期" prop="installdate">
<el-input v-model="form.installdate" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安装地点" prop="installlocal">
<el-input v-model="form.installlocal" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数量" prop="sensorcount">
<el-input v-model="form.sensorcount" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产厂家" prop="sccj">
<el-input v-model="form.sccj" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备参数" prop="sbcs">
<el-input v-model="form.sbcs" />
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="型号规格" prop="type">
<el-input v-model="form.type" />
</el-form-item>
</el-col> -->
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button type="primary" @click="submitForm">确认</el-button>
</div>
</el-dialog>
<!--工具栏-->
<div class="panel-bottom page-row">
<div class="ctin-box">
<div class="content-within">
<div class="content-fix">
<div class="toolbar">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
</el-row>
</div>
<!--表格渲染-->
<el-table ref="table" v-loading="loading" :data="dataList" size="small" style="width: 100%;" border @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="设备名称" align="center" prop="sensorname" />
<!-- <el-table-column label="型号规格" align="center" prop="type" /> -->
<el-table-column label="设备参数" align="center" prop="sbcs" />
<el-table-column label="设备编号" align="center" prop="sensorno" />
<el-table-column label="安装日期" align="center" prop="installdate" />
<el-table-column label="安装地点" align="center" prop="installlocal" />
<el-table-column label="数量" align="center" prop="sensorcount" />
<el-table-column label="生产厂家" align="center" prop="sccj" />
<el-table-column label="故障登记" align="center" prop="gzdj" />
<el-table-column label="检修记录" align="center" prop="jxjl" />
<el-table-column label="巡查记录" align="center" prop="xcjl" />
<el-table-column label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
<!-- <pagination /> -->
</div>
</div>
</template>
<script>
import {getLedger,addLedger,editLedger,delLedger} from '@/api/ledger'
// import pagination from '@crud/Pagination'
export default {
name: 'ToolQiniuConfig',
// components: { pagination, crudOperation, rrOperation, udOperation },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
dataList: [],
// 弹出层标题
title: "a",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
},
// 表单参数
form: {},
rules: {
sensorno: [
{ required: true, message: '设备编个不能为空', trigger: 'blur' }
]
}
}
},
created(){
this.getList()
},
methods: {
reset() {
this.form = {
id:undefined,
sensorname:undefined,
// type:undefined,
sbcs:undefined,
sensorno:undefined,
installdate:undefined,
installlocal:undefined,
sensorcount:undefined,
sccj:undefined,
gzdj:undefined,
jxjl:undefined,
xcjl:undefined,
};
},
getList(){
getLedger({page:0,size:999}).then(res => {
console.log(res)
this.dataList = res.body.list
})
this.loading = false;
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
console.log(this.ids)
this.single = selection.length!=1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加台账";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
// const id = row.sensorno
// getLedger({page:0,size:999,exact:{sensorno:id}}).then(response => {
// // console.log(response.body.list[0])
// this.form = response.body.list[0];
// this.open = true;
// this.title = "修改台账";
// });
this.form = row;
this.open = true;
this.title = "修改台账";
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
editLedger(this.form).then(response => {
this.$message({
message: '修改成功',
type: 'success'
});
this.open = false;
this.getList();
});
} else {
addLedger(this.form).then(response => {
this.$message({
message: '新增成功',
type: 'success'
});
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id ? [row.id] : this.ids;
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delLedger(ids)
return
}).then(()=>{
this.getList();
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
});
}
}
}
</script>
<style scoped>
</style>
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