|
@@ -0,0 +1,440 @@
|
|
|
|
+<!-- 硬件设备 -->
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container hardwareEquipment">
|
|
|
|
+ <div class="page-container hardwareEquipmentPage" v-if="pageType === 1">
|
|
|
|
+ <div class="page-form-title-box">
|
|
|
|
+ <el-form :model="queryParams" class="form-box" ref="queryForm"
|
|
|
|
+ :inline="true" style="width:100%;">
|
|
|
|
+ <el-form-item label="" prop="queryParamsData1">
|
|
|
|
+ <el-input
|
|
|
|
+ maxLength="30"
|
|
|
|
+ v-model="queryParams.queryParamsData1"
|
|
|
|
+ placeholder="请输入名称或编号"
|
|
|
|
+ style="width: 200px"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="" prop="queryParamsData2">
|
|
|
|
+ <el-select v-model="queryParams.queryParamsData2" placeholder="请选择类型" style="width: 200px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="" prop="queryParamsData3">
|
|
|
|
+ <el-select v-model="queryParams.queryParamsData3" placeholder="请选择学院" style="width: 200px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="" prop="queryParamsData4">
|
|
|
|
+ <el-select v-model="queryParams.queryParamsData4" placeholder="请选择实验室" style="width: 200px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="" prop="queryParamsData5">
|
|
|
|
+ <el-select v-model="queryParams.queryParamsData5" placeholder="请选择工作状态" style="width: 200px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="" prop="queryParamsData6">
|
|
|
|
+ <el-select v-model="queryParams.queryParamsData6" placeholder="请选择状态" style="width: 200px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
|
|
|
|
+ <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
|
|
|
|
+ <p class="page-add-common-style-button"
|
|
|
|
+ style="float: right;"
|
|
|
|
+ @click="dialogFormReset"
|
|
|
|
+ v-hasPermiRouter="['demo:demo:add']"
|
|
|
|
+ >新增</p>
|
|
|
|
+ </el-form>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="page-content-box">
|
|
|
|
+ <el-table class="table-box" v-loading="loading" border :data="dataList">
|
|
|
|
+ <el-table-column label="设备名" prop="name" show-overflow-tooltip/>
|
|
|
|
+ <el-table-column label="编号" prop="content" width="200" show-overflow-tooltip/>
|
|
|
|
+ <el-table-column label="设备类型" prop="content" width="200" show-overflow-tooltip/>
|
|
|
|
+ <el-table-column label="实验室" prop="content" width="200" show-overflow-tooltip/>
|
|
|
|
+ <el-table-column label="继电器" prop="content" width="200" show-overflow-tooltip/>
|
|
|
|
+ <el-table-column label="工作状态" prop="content" width="200" show-overflow-tooltip/>
|
|
|
|
+ <el-table-column label="状态" prop="state" width="100" show-overflow-tooltip>
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-switch
|
|
|
|
+ @click.native="tableButton(5,scope.row)"
|
|
|
|
+ class="switch captcha-img"
|
|
|
|
+ :active-value="true"
|
|
|
|
+ :inactive-value="false"
|
|
|
|
+ active-color="#0183FA"
|
|
|
|
+ inactive-color="#999"
|
|
|
|
+ v-model="scope.row.state"
|
|
|
|
+ active-text="启用"
|
|
|
|
+ inactive-text="停用"
|
|
|
|
+ disabled
|
|
|
|
+ ></el-switch>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="创建时间" prop="createTime" width="200" show-overflow-tooltip>
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" width="200" show-overflow-tooltip v-if="tableButtonType">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div class="table-button-box">
|
|
|
|
+ <p class="table-button-null"></p>
|
|
|
|
+ <p class="table-button-p"
|
|
|
|
+ @click="tableButton(3,scope.row)"
|
|
|
|
+ v-hasPermiRouter="['demo:demo:edit']"
|
|
|
|
+ >编辑</p>
|
|
|
|
+ <p class="table-button-p"
|
|
|
|
+ @click="tableButton(4,scope.row)"
|
|
|
|
+ v-hasPermiRouter="['demo:demo:del']"
|
|
|
|
+ >删除</p>
|
|
|
|
+ <p class="table-button-null"></p>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <pagination :page-sizes="[20, 30, 40, 50]"
|
|
|
|
+ v-show="total>0"
|
|
|
|
+ :total="total"
|
|
|
|
+ :page.sync="queryParams.page"
|
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
|
+ @pagination="getList"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <!--新增弹窗-->
|
|
|
|
+ <el-dialog class="iotClassification-dialog" :title='dialogTitle' width="540px" append-to-body
|
|
|
|
+ :visible.sync="dialogType" v-if="dialogType" @close="dialogOff()"
|
|
|
|
+ :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
|
+ <el-form :model="dialogForm" ref="dialogForm" :inline="true"
|
|
|
|
+ :rules="dialogRules" class="addCheckPage-min" label-width="120px">
|
|
|
|
+ <el-form-item label="名称" prop="data1">
|
|
|
|
+ <el-input v-model="dialogForm.data1" placeholder="请输入名称" maxLength="10" style="width:320px;"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="编号" prop="data2">
|
|
|
|
+ <el-input v-model="dialogForm.data2" placeholder="请输入编号" maxLength="10" style="width:320px;"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="类型" prop="data3">
|
|
|
|
+ <el-select v-model="dialogForm.data3" placeholder="请选择类型" style="width: 320px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <!--当前类型关联继电器才显示下列配置-->
|
|
|
|
+ <div>
|
|
|
|
+ <el-form-item label="实验室:" prop="data4">
|
|
|
|
+ <el-select
|
|
|
|
+ style="width:320px;"
|
|
|
|
+ v-model="dialogForm.data4"
|
|
|
|
+ filterable
|
|
|
|
+ remote
|
|
|
|
+ reserve-keyword
|
|
|
|
+ @change="subChange"
|
|
|
|
+ placeholder="请搜索选择实验室"
|
|
|
|
+ :remote-method="subSelectList">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in subOptions"
|
|
|
|
+ :key="item.subId"
|
|
|
|
+ :label="item.subName"
|
|
|
|
+ :value="item.subId">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="继电器" prop="data5">
|
|
|
|
+ <el-select v-model="dialogForm.data5" placeholder="请选择继电器" style="width: 320px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="端子" prop="data6">
|
|
|
|
+ <el-select v-model="dialogForm.data6" placeholder="请选择继电器端子" style="width: 320px">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in optionList"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </div>
|
|
|
|
+ <el-form-item label="状态" prop="data7">
|
|
|
|
+ <el-radio-group v-model="dialogForm.data7">
|
|
|
|
+ <el-radio :label="true" style="margin-left:20px;">启用</el-radio>
|
|
|
|
+ <el-radio :label="false">禁用</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer dialog-footer-box">
|
|
|
|
+ <p class="dialog-footer-button-null"></p>
|
|
|
|
+ <p class="dialog-footer-button-info" @click="dialogOff()">取消</p>
|
|
|
|
+ <p class="dialog-footer-button-primary" @click="dialogSubmit">确定</p>
|
|
|
|
+ <p class="dialog-footer-button-null"></p>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!--<add-page :propsData="propsData" v-if="pageType === 2"></add-page>-->
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+<script>
|
|
|
|
+ //import { getDicts } from "@/api/commonality/noPermission";
|
|
|
|
+ //import { systemUserSelect } from "@/api/commonality/permission";
|
|
|
|
+ //import { getInfo } from "@/api/basicsModules/index";
|
|
|
|
+ //import addPage from "./addPage.vue";
|
|
|
|
+ export default {
|
|
|
|
+ name: 'index',
|
|
|
|
+ //components: {
|
|
|
|
+ // addPage
|
|
|
|
+ //},
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ tableButtonType:this.hasPermiDom(['demo:demo:detail','demo:demo:edit','demo:demo:del',]),
|
|
|
|
+ //页面状态
|
|
|
|
+ pageType:1,
|
|
|
|
+ //页面遮罩
|
|
|
|
+ loading:false,
|
|
|
|
+ //下拉列表数据
|
|
|
|
+ optionList:[{value:true,label:'启用'},{value:false,label:'停用'}],
|
|
|
|
+ //查询条件
|
|
|
|
+ queryParams:{
|
|
|
|
+ page:1,
|
|
|
|
+ pageSize:20,
|
|
|
|
+ queryParamsData1:"",
|
|
|
|
+ queryParamsData2 :null,
|
|
|
|
+ },
|
|
|
|
+ //列表数据
|
|
|
|
+ dataList:[],
|
|
|
|
+ //数据数量
|
|
|
|
+ total:0,
|
|
|
|
+ //组件传参
|
|
|
|
+ propsData:{},
|
|
|
|
+ //弹窗相关
|
|
|
|
+ dialogTitle:'',
|
|
|
|
+ dialogType:false,
|
|
|
|
+ dialogForm:{},
|
|
|
|
+ dialogRules:{
|
|
|
|
+ data1: [
|
|
|
|
+ { required: true, message: "请输入名称", trigger: "blur" },
|
|
|
|
+ { required: true, message: "请输入名称", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ data2: [
|
|
|
|
+ { required: true, message: "请输入编号", trigger: "blur" },
|
|
|
|
+ { required: true, message: "请输入编号", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ data3: [
|
|
|
|
+ { required: true, message: "请选择类型", trigger: "blur" },
|
|
|
|
+ { required: true, message: "请选择类型", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ data4: [
|
|
|
|
+ { required: true, message: "请搜索选择实验室", trigger: "blur" },
|
|
|
|
+ { required: true, message: "请搜索选择实验室", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ data5: [
|
|
|
|
+ { required: true, message: "请选择继电器", trigger: "blur" },
|
|
|
|
+ { required: true, message: "请选择继电器", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ data6: [
|
|
|
|
+ { required: true, message: "请选择继电器端子", trigger: "blur" },
|
|
|
|
+ { required: true, message: "请选择继电器端子", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ data7: [
|
|
|
|
+ { required: true, message: "请选择状态", trigger: "blur" },
|
|
|
|
+ { required: true, message: "请选择状态", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ // 实验室列表
|
|
|
|
+ subOptions:[],
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created () {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ mounted () {
|
|
|
|
+ //this.getList();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ //查询按钮
|
|
|
|
+ handleQuery(){
|
|
|
|
+ this.$set(this.queryParams,'page',1);
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ //重置按钮
|
|
|
|
+ resetQuery(){
|
|
|
|
+ this.$set(this,'queryParams',{
|
|
|
|
+ page:1,
|
|
|
|
+ pageSize:20,
|
|
|
|
+ queryParamsData1:"",
|
|
|
|
+ queryParamsData2 :null,
|
|
|
|
+ });
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ //获取数据列表
|
|
|
|
+ getList(){
|
|
|
|
+ this.$set(this,'loading',true);
|
|
|
|
+ let obj = JSON.parse(JSON.stringify(this.queryParams))
|
|
|
|
+ getListFunction(obj).then(response => {
|
|
|
|
+ this.$set(this,'loading',false);
|
|
|
|
+ this.$set(this,'dataList',response.data.records);
|
|
|
|
+ this.$set(this,'total',response.data.total);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //操作按钮
|
|
|
|
+ tableButton(type,row){
|
|
|
|
+ let self = this;
|
|
|
|
+ if(type == 3){
|
|
|
|
+ //编辑
|
|
|
|
+ let obj = JSON.parse(JSON.stringify(row))
|
|
|
|
+ this.$set(this,'dialogForm',obj);
|
|
|
|
+ this.$set(this,'dialogType',true);
|
|
|
|
+ }else if(type == 4){
|
|
|
|
+ //删除
|
|
|
|
+ this.$confirm('是否确认删除?', "警告", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(function() {
|
|
|
|
+ }).then(() => {
|
|
|
|
+ deleteFunction({id:row.id}).then(response => {
|
|
|
|
+ self.msgSuccess(response.message)
|
|
|
|
+ self.getList();
|
|
|
|
+ });
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ }else if(type == 5){
|
|
|
|
+ //启用&停用
|
|
|
|
+ let text = row.state ? "停用" : "启用";
|
|
|
|
+ this.$confirm('是否确认' + text + '?', "警告", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(function() {
|
|
|
|
+ }).then(() => {
|
|
|
|
+ stateFunction({id:row.id,state:!row.state,}).then(response => {
|
|
|
|
+ self.msgSuccess(response.message)
|
|
|
|
+ self.getList();
|
|
|
|
+ });
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ }else if(type == 6){
|
|
|
|
+ //返回并刷新
|
|
|
|
+ this.$set(this,'pageType',1);
|
|
|
|
+ this.getList();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //**************************弹窗相关**************************
|
|
|
|
+ //弹层关闭
|
|
|
|
+ dialogOff(){
|
|
|
|
+ this.$set(this,'dialogType',false);
|
|
|
|
+ },
|
|
|
|
+ //弹层新增
|
|
|
|
+ dialogFormReset(){
|
|
|
|
+ this.$set(this,'dialogTitle','新增');
|
|
|
|
+ this.$set(this,'dialogForm',{
|
|
|
|
+ name:"",
|
|
|
|
+ code:"",
|
|
|
|
+ attrName:"",
|
|
|
|
+ unit:"",
|
|
|
|
+ icon:"",
|
|
|
|
+ exceptionIcon:"",
|
|
|
|
+ sort:1,
|
|
|
|
+ state:true,
|
|
|
|
+ });
|
|
|
|
+ this.$set(this,'dialogType',true);
|
|
|
|
+ },
|
|
|
|
+ //dialog提交按钮
|
|
|
|
+ dialogSubmit(){
|
|
|
|
+ this.$refs["dialogForm"].validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ let obj = {
|
|
|
|
+ typeId:this.propsData.typeId,
|
|
|
|
+ typeKey:this.propsData.typeKey,
|
|
|
|
+ name:this.dialogForm.name,
|
|
|
|
+ code:this.dialogForm.code,
|
|
|
|
+ attrName:this.dialogForm.attrName,
|
|
|
|
+ unit:this.dialogForm.unit,
|
|
|
|
+ sort:this.dialogForm.sort,
|
|
|
|
+ threshhold:this.dialogForm.threshhold?this.dialogForm.threshhold:0,
|
|
|
|
+ isFluctuation:this.dialogForm.isFluctuation?this.dialogForm.isFluctuation:false,
|
|
|
|
+ fluctuationDirection:this.dialogForm.fluctuationDirection,
|
|
|
|
+ fluctuationRange:this.dialogForm.fluctuationRange?this.dialogForm.fluctuationRange:0,
|
|
|
|
+ remark:this.dialogForm.remark,
|
|
|
|
+ icon:this.dialogForm.icon,
|
|
|
|
+ exceptionIcon:this.dialogForm.exceptionIcon,
|
|
|
|
+ }
|
|
|
|
+ if(this.dialogForm.id){
|
|
|
|
+ obj.id = this.dialogForm.id;
|
|
|
|
+ iotAttributeUpdate(obj).then(response => {
|
|
|
|
+ this.msgSuccess(response.message)
|
|
|
|
+ this.dialogOff();
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ }else{
|
|
|
|
+ iotAttributeAdd(obj).then(response => {
|
|
|
|
+ this.msgSuccess(response.message)
|
|
|
|
+ this.dialogOff();
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //选中实验室
|
|
|
|
+ subChange(val){
|
|
|
|
+ let self = this;
|
|
|
|
+ // console.log(val)
|
|
|
|
+ // for(let i=0;i<self.optionsUser.length;i++){
|
|
|
|
+ // if(self.optionsUser[i].userId == val){
|
|
|
|
+ // this.$set(this,'shadeName',self.optionsUser[i].userName);
|
|
|
|
+ // this.$set(this,'shadeMobile',self.optionsUser[i].mobile);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
+ //搜索实验室
|
|
|
|
+ subSelectList(query){
|
|
|
|
+ if (query !== '' && query.length>1) {
|
|
|
|
+ // systemUserSelectUser({"userName":query,'userType':'1'}).then(response => {
|
|
|
|
+ // this.$set(this,'userOptions',response.data);
|
|
|
|
+ // });
|
|
|
|
+ } else {
|
|
|
|
+ this.$set(this,'subOptions',[]);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
+ .hardwareEquipment{
|
|
|
|
+ .hardwareEquipmentPage{
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</style>
|