123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- <!--智能灭火设备-->
- <template>
- <div class="app-container approval_handle">
- <div class="approval_handle-page" v-if="pageType == 1">
- <el-form :model="queryParams" ref="queryForm" style="margin-top:20px;" :inline="true">
- <el-form-item label="关键字" prop="name">
- <el-input
- v-model="queryParams.searchValue"
- placeholder="设备名称\关联实验室"
- clearable
- maxLength="30"
- size="small"
- />
- </el-form-item>
- <el-form-item>
- <p class="inquire-button-one" @click="handleQuery">查询</p>
- <p class="reset-button-one" @click="resetQuery">重置</p>
- </el-form-item>
- <el-form-item style="float: right;">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleClick('','','add')"
- v-hasPermi="['algorithm:firedevice:add']"
- >新增</el-button>
- </el-col>
- </el-form-item>
- </el-form>
- <el-table border v-loading="loading" :data="tableData">
- <el-table-column label="设备名称" align="left" prop="deviceName"/>
- <el-table-column label="继电器编号" align="left" prop="deviceCode"/>
- <el-table-column label="设备地址" align="left" prop="deviceUrl"></el-table-column>
- <el-table-column label="关联实验室" align="left" prop="subjectName"></el-table-column>
- <el-table-column label="状态" align="left" prop="deviceStatus">
- <template slot-scope="scope">
- <span v-if="scope.row.deviceStatus==1">离线</span>
- <span v-if="scope.row.deviceStatus==2">在线</span>
- <span v-if="scope.row.deviceStatus==3">异常</span>
- <span v-if="scope.row.deviceStatus==3" style="color: #E6A23C"> {{'('+scope.row.describe+')'}}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="180">
- <template slot-scope="scope">
- <div class="table-button-box">
- <p class="table-button-null"></p>
- <p class="table-button-p" v-hasPermi="['algorithm:firedevice:edit']" @click="handleClick('',scope.row,'edit')">编辑</p>
- <p class="table-button-p" v-hasPermi="['algorithm:firedevice:remove']" @click="handleClick('',scope.row,'delete')">删除</p>
- <p class="table-button-null"></p>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- :total="total"
- layout="total, prev, pager, next, sizes, jumper"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- <!--弹框-->
- <el-dialog :title='dialogTitle' @close="handleClose" :visible.sync="dialogVisible" width="600px" append-to-body :close-on-click-modal="false">
- <el-form :model="dialogForm" ref="dialogForm" :rules="rules" :inline="true" label-width="140px">
- <el-form-item label="设备名称:" prop="deviceName" >
- <el-input
- style="width: 400px"
- v-model="dialogForm.deviceName"
- placeholder="请输入设备名称"
- maxLength="20"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item label="继电器编号:" prop="relayCode" >
- <el-input
- style="width: 400px"
- v-model="dialogForm.relayCode"
- placeholder="请输入继电器编号"
- maxLength="20"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item label="采集器编号:" prop="deviceCode" >
- <el-input
- style="width: 400px"
- v-model="dialogForm.deviceCode"
- placeholder="请输入采集器编号"
- maxLength="20"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item label="设备地址:" prop="deviceUrl" >
- <el-input
- style="width: 400px"
- v-model="dialogForm.deviceUrl"
- placeholder="请输入设备地址"
- maxLength="3"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item label="实验地点" prop="subjectId">
- <el-select
- style="width:400px;"
- v-model="dialogForm.location"
- filterable
- remote
- clearable
- reserve-keyword
- @focus="selectFocus"
- @change="selectChange"
- placeholder="请选择实验地点"
- :remote-method="userSelectList"
- :loading="loading">
- <el-option
- v-for="item in laboratoryOptions"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="灭火倒计时:" prop="deviceCountDown" >
- <el-input
- :min="0"
- oninput="if(value<0 || value>30)value=0"
- style="width: 400px"
- v-model="dialogForm.deviceCountDown"
- placeholder="请输入倒计时秒数,仅能输入0-30之间的数字"
- clearable
- size="small"
- >
- <template slot="append">秒</template>
- </el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancel">取 消</el-button>
- <el-button type="primary" @click="submitForm">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { subjectList, } from '@/api/gasManage3_0/gasManage'
- import { firedeviceAdd, firedeviceDle, firedeviceEdit, firedeviceList } from '@/api/laboratory/subject'
- export default {
- name: "Approval",
- components: {
- },
- data() {
- return {
- dialogVisible :false,
- //页面状态
- pageType:1,
- dialogTitle:'新增智能灭火设备',
- loading:false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize:20,
- searchValue:'',
- },
- total:0,
- tableData:[],
- dialogForm:{
- id:'',
- deviceName:'',
- deviceCode:'',
- relayCode:'',
- deviceUrl:'',
- deviceCountDown:'',
- subjectId:'',
- location:'',
- },
- laboratoryOptions:[],
- // 表单校验
- rules: {
- deviceName: [
- { required: true, message: "请输入设备名称", trigger: "blur" }
- ],
- relayCode: [
- { required: true, message: "请输入继电器编号", trigger: "blur" }
- ],
- deviceCode: [
- { required: true, message: "请输入采集器编号", trigger: "blur" }
- ],
- deviceUrl: [
- { required: true, message: "请输入设备地址", trigger: "blur" }
- ],
- deviceCountDown: [
- { required: true, message: "请输入倒计时秒数", trigger: "blur" }
- ],
- subjectId: [
- { required: true, message: "请选择实验地点", trigger: "blur" }
- ],
- },
- };
- },
- methods: {
- //监听关联记录弹窗关闭
- handleClose(){
- },
- selectFocus(){
- if(!this.laboratoryOptions[0]){
- this.userSelectList("");
- }
- },
- //实验室选择
- selectChange(e){
- let self = this;
- for(let i=0;i<self.laboratoryOptions.length;i++){
- if(self.laboratoryOptions[i].id == e){
- //this.$set(this.dialogForm,"subject",self.laboratoryOptions[i]);
- this.$set(this.dialogForm,"location",self.laboratoryOptions[i].name);
- }
- }
- this.$set(this.dialogForm,"subjectId",e);
- },
- //懒加载实验室
- userSelectList(e){
- subjectList({name:e,deptId:this.dialogForm.deptId}).then(response => {
- this.laboratoryOptions = response.data;
- });
- },
- // 取消按钮
- cancel() {
- this.dialogVisible = false;
- },
- handleClick(index,row,doType){
- let _this=this;
- if(doType=='add'){//添加
- _this.dialogTitle='新增智能灭火设备';
- _this.dialogVisible=true;
- _this.dialogForm.deviceCountDown=30
- _this.dialogForm.id='';
- _this.dialogForm.deviceName='';
- _this.dialogForm.deviceCode='';
- _this.dialogForm.relayCode='';
- _this.dialogForm.deviceUrl='';
- _this.dialogForm.subjectId='';
- _this.dialogForm.location='';
- }else if(doType=='edit'){//编辑
- _this.dialogTitle='编辑智能灭火设备';
- _this.dialogVisible=true;
- _this.dialogForm.id=row.id;
- _this.dialogForm.deviceName=row.deviceName;
- _this.dialogForm.deviceCode=row.deviceCode;
- _this.dialogForm.relayCode=row.relayCode;
- _this.dialogForm.deviceUrl=row.deviceUrl
- _this.dialogForm.deviceCountDown=row.deviceCountDown;
- _this.dialogForm.subjectId=row.subjectId;
- _this.dialogForm.location=row.subjectName;
- }else if(doType=='delete'){//删除
- this.$confirm('是否确认删除当前数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- firedeviceDle(row.id).then( response => {
- if(response.code==200){
- _this.getList();
- _this.msgSuccess("删除成功");
- }
- });
- }).then(() => {
- }).catch(() => {});
- }
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.queryParams.searchValue = "";
- this.handleQuery();
- },
- getList(){
- let _this=this;
- firedeviceList(_this.queryParams).then( response => {
- let res=response.rows;
- _this.tableData=res;
- _this.total=response.total;
- });
- },
- //提交
- submitForm(){
- let _this = this;
- this.$refs['dialogForm'].validate((valid) => {
- if (valid) {
- _this.dialogForm.deviceUrl=Number( _this.dialogForm.deviceUrl)
- _this.dialogForm.deviceCountDown=Number( _this.dialogForm.deviceCountDown)
- if(!this.dialogForm.id){//新增
- firedeviceAdd(_this.dialogForm).then(res => {
- this.$message({
- type: 'success',
- message: '操作成功!',
- duration:2000,
- onClose:function(){
- _this.getList();
- _this.loading = false;
- _this.dialogVisible = false;
- }
- });
- });
- }else{//编辑
- firedeviceEdit(_this.dialogForm).then(res => {
- this.$message({
- type: 'success',
- message: '操作成功!',
- duration:2000,
- onClose:function(){
- _this.getList();
- _this.loading = false;
- _this.dialogVisible = false;
- }
- });
- });
- }
- } else {
- return false;
- }
- });
- },
- },
- mounted() {
- this.getList();
- }
- };
- </script>
- <style scoped lang="scss">
- .approval_handle {
- display: flex!important;
- flex-direction: column;
- overflow: hidden;
- .approval_handle-page{
- flex:1;
- display: flex!important;
- flex-direction: column;
- box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
- padding:20px 20px 20px!important;
- border-radius:10px;
- overflow: hidden;
- .button-box{
- width:200px;
- display: flex;
- }
- }
- .entering_t{
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #333333;
- line-height: 16px;
- margin: 36px auto 25px;
- text-align: center;
- }
- .entering_img{
- width: 288px;
- height: 140px;
- }
- .entering_input{
- width: 288px;
- }
- }
- </style>
|