报警界面添加按时间查询、默认查询当天报警信息,补充语言,更新读取plc代码
| | |
| | | "js-cookie": "^3.0.1", |
| | | "less": "^3.12.2", |
| | | "less-loader": "^6.2.0", |
| | | "moment": "^2.29.4", |
| | | "vue": "^2.6.11", |
| | | "vue-i18n": "^8.26.5", |
| | | "vue-router": "^3.3.4", |
| | |
| | | }, |
| | | "bin": { |
| | | "mkdirp": "bin/cmd.js" |
| | | } |
| | | }, |
| | | "node_modules/moment": { |
| | | "version": "2.29.4", |
| | | "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", |
| | | "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", |
| | | "engines": { |
| | | "node": "*" |
| | | } |
| | | }, |
| | | "node_modules/move-concurrently": { |
| | |
| | | "minimist": "^1.2.5" |
| | | } |
| | | }, |
| | | "moment": { |
| | | "version": "2.29.4", |
| | | "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", |
| | | "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" |
| | | }, |
| | | "move-concurrently": { |
| | | "version": "1.0.1", |
| | | "resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz", |
| | |
| | | "js-cookie": "^3.0.1", |
| | | "less": "^3.12.2", |
| | | "less-loader": "^6.2.0", |
| | | "moment": "^2.29.4", |
| | | "vue": "^2.6.11", |
| | | "vue-i18n": "^8.26.5", |
| | | "vue-router": "^3.3.4", |
| | |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function setTime (shijian1, shijian2) { |
| | | return request({ |
| | | url: '/alarm/stTime?shijian1=' + shijian1 + '&shijian2=' + shijian2, |
| | | method: 'get', |
| | | data: "" |
| | | }) |
| | | } |
| | |
| | | "B02 OUT DEC error": "B02 OUT DEC error",
|
| | | "B02 OUT pos error": "B02 OUT pos error"
|
| | | },
|
| | | "Electrical": "Electrical",
|
| | | "Parameter": "Parameter",
|
| | | "Action": "Action",
|
| | | "Sign": "Sign",
|
| | |
| | | "B02 OUT DEC error": "B02 OUT DEC 错误",
|
| | | "B02 OUT pos error": "B02 OUT pos 错误"
|
| | | },
|
| | | "Electrical": "设备管理",
|
| | | "Parameter": "参数下发",
|
| | | "Action": "开关控制",
|
| | | "Sign": "IO状态",
|
| | |
| | | <!--面包屑导航区域-->
|
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
|
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
|
| | | <el-button type="text">Electrical</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
|
| | | <el-button type="text">{{ $t('Electrical') }}</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">{{ $t('Parameter') }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">{{ $t('Action') }}</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">{{ $t('Sign') }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">{{ $t('State') }}</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">{{ $t('Alarm') }}</router-link>
|
| | | </el-breadcrumb>
|
| | | <div>Sign</div>
|
| | | <div style="padding-right: 30px;display: flex;flex-wrap: wrap;" class="neir">
|
| | |
| | | </template>
|
| | |
|
| | | <script >
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | let socket;
|
| | | export default {
|
| | | name: "Sign",
|
| | | mixins: [LanguageMixin],
|
| | | data () {
|
| | | return {
|
| | | record: {
|
| | |
| | | let obj = JSON.parse(msg.data);
|
| | | //this.$set(this.record.params, 0, obj.params[0]);
|
| | | this.record.params[0] = obj.sig[0];
|
| | | for (let a = 0; a <= this.record.params.length; a++) {
|
| | | for (let a = 0; a <= this.record.xyData[0] - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | |
| | | <!--面包屑导航区域-->
|
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
|
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link>
|
| | | <el-button type="text">Electrical</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link>
|
| | | <el-button type="text">{{ $t('Electrical') }}</el-button>
|
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">{{ $t('Parameter') }}</router-link>
|
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">{{ $t('Action') }}</router-link>
|
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">{{ $t('Sign') }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text">{{ $t('State') }}</router-link>
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">{{ $t('Alarm') }}</router-link>
|
| | | </el-breadcrumb>
|
| | | <div>State</div>
|
| | |
|
| | |
|
| | | <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="messagepack.data">
|
| | | <div id="btn_div">
|
| | | <el-button type="primary" @click="send()">Distribute</el-button>
|
| | | <!-- <button @click="send()">测试发送</button> -->
|
| | | </div>
|
| | |
|
| | | <div class="kuai_div" v-for="item in this.record.xyData" :key="item.name">
|
| | | <el-input style="width: 280px;" class="in_mc" v-model="item.name"></el-input>
|
| | | <el-input v-model="item.value" style="width: 80px;"></el-input>
|
| | | <el-input v-model.number="item.value" style="width: 80px;"></el-input>
|
| | | </div>
|
| | |
|
| | |
|
| | |
| | | </template>
|
| | |
|
| | | <script >
|
| | |
|
| | | import LanguageMixin from '../../lang/LanguageMixin'
|
| | | let socket;
|
| | | export default {
|
| | | name: "State",
|
| | | mixins: [LanguageMixin],
|
| | | data () {
|
| | | return {
|
| | | record: {
|
| | | params: [0, 0, 0, 0, 0, 0, 0, 0, 0,],
|
| | | params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
|
| | | xyData: [
|
| | | { name: 'D01.State', value: 0 },
|
| | | { name: 'D02.State', value: 0 },
|
| | |
| | | { name: 'D05.State', value: 0 },
|
| | | { name: 'D06.State', value: 0 },
|
| | | ],
|
| | | canshu: [
|
| | | 'D01.State',
|
| | | 'D02.State',
|
| | | 'B01.State',
|
| | | 'B02.State',
|
| | | 'A01.State',
|
| | | 'A02.State',
|
| | | 'D03.State',
|
| | | 'D04.State',
|
| | | 'D05.State',
|
| | | 'D06.State',
|
| | | ],
|
| | | // canshu: [
|
| | | // 'D01.State',
|
| | | // 'D02.State',
|
| | | // 'B01.State',
|
| | | // 'B02.State',
|
| | | // 'A01.State',
|
| | | // 'A02.State',
|
| | | // 'D03.State',
|
| | | // 'D04.State',
|
| | | // 'D05.State',
|
| | | // 'D06.State',
|
| | | // ],
|
| | |
|
| | | },
|
| | |
|
| | |
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | this.record.params[0] = obj.sta[0];
|
| | | for (let a = 0; a <= this.record.params.length; a++) {
|
| | | //this.record.xyData[a] = [this.record.params[0][a], this.record.canshu[a]];
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | for (let a = 0; a <= this.record.xyData[0].length - 1; a++) {
|
| | | if (!this.record.xyData[a]) {
|
| | | this.record.xyData[a] = { name: this.record.canshu[a], value: this.record.params[0][a] };
|
| | | } else {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | | }
|
| | |
|
| | | }
|
| | | this.$forceUpdate();
|
| | | console.log(this.record.xyData);
|
| | | //console.log(this.record.params[0])
|
| | | // console.log(this.records.canshu);
|
| | |
|
| | | }.bind(this);
|
| | | //关闭事件
|
| | |
| | | }
|
| | | },
|
| | | send () {
|
| | | this.messagepack.data = { taskname: "前端到后台" };
|
| | | socket?.send(JSON.stringify(this.messagepack)); // 将组装好的json发送给服务端,由服务端进行转发
|
| | | this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value)); // 转换为整数数组
|
| | | console.log(this.messagepack);
|
| | | socket?.send(JSON.stringify(this.messagepack));
|
| | | },
|
| | | handleChange (index, value) {
|
| | | this.record.xyData[index].value = value;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <!--面包屑导航区域--> |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/home" tag="el-button" type="text">{{ $t('langHome') }}</router-link> |
| | | <el-button type="text">Electrical</el-button> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">Parameter</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">Action</router-link> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">Sign</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text">State</router-link> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">Alarm</router-link> |
| | | <el-button type="text">{{ $t('Electrical') }}</el-button> |
| | | <router-link to="/Electrical/Parameter" tag="el-button" type="text">{{ $t('Parameter') }}</router-link> |
| | | <router-link to="/Electrical/Action" tag="el-button" type="text">{{ $t('Action') }}</router-link> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text">{{ $t('Sign') }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text">{{ $t('State') }}</router-link> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text">{{ $t('Alarm') }}</router-link> |
| | | </el-breadcrumb> |
| | | <div>Alarm</div> |
| | | <!-- <el-form label-width="100px" style="display: flex;flex-wrap: wrap;" :model="{ messagepack }"> |
| | | <div class="kuai_div" v-for="item in this.record.xyData" :key="item[1]"> |
| | | <el-input v-model="item[1]" style="width: 240px;" class="in_mc"></el-input> |
| | | <el-switch v-model="item[0]" active-value="0" inactive-value="1"></el-switch> |
| | | </div> |
| | | </el-form> --> |
| | | <div class="block"> |
| | | <span class="demonstration">时间:</span> |
| | | <el-date-picker v-model="shijian1" type="datetime" placeholder="选择日期时间" align="right" |
| | | :picker-options="pickerOptions"> |
| | | </el-date-picker> |
| | | ~ |
| | | <el-date-picker v-model="shijian2" type="datetime" placeholder="选择日期时间" align="right" |
| | | :picker-options="pickerOptions"> |
| | | </el-date-picker> |
| | | <el-button type="primary" @click="selectTime()">查询</el-button> |
| | | </div> |
| | | |
| | | <el-table :data="localizedRoles" style="width: 100%;" height="590"> |
| | | <el-table :data="localizedRoles" style="width: 100%;" height="550"> |
| | | <el-table-column prop="id" label="id" width="80"> |
| | | </el-table-column> |
| | | <el-table-column prop="content" label="content"> |
| | |
| | | </template> |
| | | |
| | | <script > |
| | | import { setAll } from "../../api/alarm"; |
| | | import { setAll, setTime } from "../../api/alarm"; |
| | | |
| | | import moment from 'moment'; |
| | | //setTime |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | let socket; |
| | | export default { |
| | |
| | | data: "1", |
| | | pageSize: 10 |
| | | }, |
| | | pickerOptions: { |
| | | shortcuts: [{ |
| | | text: '今天', |
| | | onClick (picker) { |
| | | picker.$emit('pick', new Date()); |
| | | } |
| | | }, { |
| | | text: '昨天', |
| | | onClick (picker) { |
| | | const date = new Date(); |
| | | date.setTime(date.getTime() - 3600 * 1000 * 24); |
| | | picker.$emit('pick', date); |
| | | } |
| | | }, { |
| | | text: '一周前', |
| | | onClick (picker) { |
| | | const date = new Date(); |
| | | date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); |
| | | picker.$emit('pick', date); |
| | | } |
| | | }], |
| | | |
| | | }, |
| | | shijian1: "", |
| | | shijian2: "", |
| | | } |
| | | |
| | | |
| | | }, |
| | | created () { |
| | | this.init(); |
| | | this.load(); |
| | | |
| | | |
| | | if (this.shijian1 == "" || this.shijian2 == "") { |
| | | this.load(); |
| | | } |
| | | else { |
| | | this.selectTime(); |
| | | } |
| | | |
| | | }, |
| | | methods: { |
| | |
| | | } else { |
| | | this.localizedRoles = [...this.roles]; |
| | | } |
| | | console.log(this.localizedRoles); |
| | | //console.log(this.localizedRoles); |
| | | }); |
| | | |
| | | }, |
| | | selectTime () { |
| | | let sj1 = moment(this.shijian1).format('YYYY-MM-DD%20HH:mm'); |
| | | let sj2 = moment(this.shijian2).format('YYYY-MM-DD%20HH:mm') |
| | | |
| | | setTime(sj1, sj2).then(res => { |
| | | this.roles = res.data.list; |
| | | const language = this.$i18n.locale; |
| | | if (language === 'zh-CN') { |
| | | this.replaceChineseWithEnglish(); |
| | | } else { |
| | | this.localizedRoles = [...this.roles]; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | replaceChineseWithEnglish () { |
| | | const translation = this.$t('translation'); |
| | | this.localizedRoles = this.roles.map(role => ({ |
| | |
| | | |
| | | this.record.params[0] = obj.arm; |
| | | //每次请求更新数据 |
| | | this.load(); |
| | | if (this.shijian1 == "" || this.shijian2 == "") { |
| | | this.load(); |
| | | } |
| | | else { |
| | | this.selectTime(); |
| | | } |
| | | this.$forceUpdate(); |
| | | }.bind(this); |
| | | //关闭事件 |
| | |
| | | <el-row :gutter="20"> |
| | | <!--搜索与添加区域--> |
| | | <el-col :span="6"> |
| | | <el-input :placeholder= "$t('langUsernamePlaceholder')" v-model="queryInfo.username" clearable @clear="getUserList"> |
| | | <el-input :placeholder="$t('langUsernamePlaceholder')" v-model="queryInfo.username" clearable |
| | | @clear="getUserList"> |
| | | </el-input> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-input :placeholder="$t('langEmailPlaceholder')" v-model="queryInfo.email" clearable @clear="getUserList"> |
| | | <el-input :placeholder="$t('langEmailPlaceholder')" v-model="queryInfo.email" clearable @clear="getUserList"> |
| | | </el-input> |
| | | </el-col> |
| | | <!--搜索按钮--> |
| | |
| | | <el-table-column :label="$t('langCreateTime')" prop="createTime"></el-table-column> |
| | | <el-table-column :label="$t('langDisabled')"> |
| | | <template slot-scope="scope"> |
| | | <el-switch |
| | | :active-value="0" |
| | | :inactive-value="1" |
| | | v-model="scope.row.state" |
| | | @change="stateChange(scope.row)"> |
| | | <el-switch :active-value="0" :inactive-value="1" v-model="scope.row.state" @change="stateChange(scope.row)"> |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="primary" icon="el-icon-refresh" @click="resetPassword(scope.row)"> |
| | | |
| | | {{ $t('resetPassword') }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <template slot-scope="scope"> |
| | | <el-button type="primary" icon="el-icon-refresh" @click="resetPassword(scope.row)"> |
| | | |
| | | {{ $t('resetPassword') }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :label="$t('langAction')"> |
| | | <template slot-scope="scope"> |
| | | <!--修改--> |
| | | <el-tooltip effect="dark" :content="$t('langEdit')" placement="top" :enterable="false"> |
| | | <el-button type="primary" icon="el-icon-edit" size="mini" |
| | | @click="showEditDialog(scope.row.id)"></el-button> |
| | | <el-button type="primary" icon="el-icon-edit" size="mini" @click="showEditDialog(scope.row.id)"></el-button> |
| | | </el-tooltip> |
| | | <!--删除--> |
| | | <el-tooltip effect="dark" :content="$t('langDelete')" placement="top" :enterable="false"> |
| | | <el-button type="danger" icon="el-icon-delete" size="mini" |
| | | @click="removeUserById(scope.row)"></el-button> |
| | | <el-button type="danger" icon="el-icon-delete" size="mini" @click="removeUserById(scope.row)"></el-button> |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页区域--> |
| | | <el-pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="queryInfo.pageNum" |
| | | :page-sizes="[6, 12, 18, 24]" |
| | | :page-size="queryInfo.pageSize" |
| | | :total="userList.total" |
| | | |
| | | :pager-count="7" |
| | | :layout="layout" |
| | | > |
| | | </el-pagination> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
| | | :current-page="queryInfo.pageNum" :page-sizes="[6, 12, 18, 24]" :page-size="queryInfo.pageSize" |
| | | :total="userList.total" :pager-count="7" :layout="layout"> |
| | | </el-pagination> |
| | | </el-card> |
| | | <!--添加用户的对话框--> |
| | | <el-dialog |
| | | :title="$t('langAddUserTitle')" |
| | | :visible.sync="addDialogVisible" |
| | | width="50%" |
| | | @close="addDialogClosed"> |
| | | <el-dialog :title="$t('langAddUserTitle')" :visible.sync="addDialogVisible" width="50%" @close="addDialogClosed"> |
| | | <!--内容主体区域--> |
| | | <el-form :model="addUserForm" :rules="addUserRules" ref="addUserRef" label-width="100px"> |
| | | <el-form-item :label="$t('langUsername')" prop="username" > |
| | | <el-input v-model="addUserForm.username" ></el-input> |
| | | <el-form-item :label="$t('langUsername')" prop="username"> |
| | | <el-input v-model="addUserForm.username"></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('langPassword')" prop="password" > |
| | | <el-form-item :label="$t('langPassword')" prop="password"> |
| | | <el-input v-model="addUserForm.password" type="password"></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('langEmail')" prop="email"> |
| | | <el-input v-model="addUserForm.email"></el-input> |
| | | </el-form-item> |
| | | |
| | | |
| | | |
| | | <el-form-item :label="$t('langState')" prop="state"> |
| | | <el-select v-model="addUserForm.state" > |
| | | <el-option v-for="(item,index) in options" |
| | | :key="index" |
| | | :value="item.value" |
| | | :label="item.label"> |
| | | <el-select v-model="addUserForm.state"> |
| | | <el-option v-for="(item, index) in options" :key="index" :value="item.value" :label="item.label"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="角色" prop="roleId"> |
| | | <el-select filterable v-model="addUserForm.roleId" placeholder="请选择"> |
| | | <el-option v-for="item in roleList" |
| | | :key="item.id" |
| | | :value="item.id" |
| | | :label="item.name"> |
| | | <el-option v-for="item in roleList" :key="item.id" :value="item.id" :label="item.name"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </span> |
| | | </el-dialog> |
| | | <!--修改用户的对话框--> |
| | | <el-dialog |
| | | :title="$t('langEditUserTitle')" |
| | | :visible.sync="editDialogVisible" |
| | | width="50%"> |
| | | <el-dialog :title="$t('langEditUserTitle')" :visible.sync="editDialogVisible" width="50%"> |
| | | <!--内容主体区域--> |
| | | <el-form :model="editUserForm" :rules="addUserRules" ref="addCategoryRef" label-width="100px"> |
| | | <el-form-item :label="$t('langUsername')" prop="username"> |
| | |
| | | </el-form-item> |
| | | <el-form-item :label="$t('role')" prop="roleId"> |
| | | <el-select filterable v-model="editUserForm.roleId" placeholder="请选择"> |
| | | <el-option v-for="item in roleList" |
| | | :key="item.id" |
| | | :value="item.id" |
| | | :label="item.name"> |
| | | <el-option v-for="item in roleList" :key="item.id" :value="item.id" :label="item.name"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-input v-model="editUserForm.email"></el-input> |
| | | </el-form-item> |
| | | <el-form-item :label="$t('langDisabled')" prop="state"> |
| | | <el-select v-model="editUserForm.state" > |
| | | <el-option v-for="(item,index) in options" |
| | | :key="index" |
| | | :value="item.value" |
| | | :label="item.label"> |
| | | <el-select v-model="editUserForm.state"> |
| | | <el-option v-for="(item, index) in options" :key="index" :value="item.value" :label="item.label"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | |
| | | |
| | | <script> |
| | | import {getById, removeById, saveOrUpdate, selectPage,resetPass} from "../../api/user"; |
| | | import {select} from "../../api/role"; |
| | | import { getById, removeById, saveOrUpdate, selectPage, resetPass } from "../../api/user"; |
| | | import { select } from "../../api/role"; |
| | | |
| | | import LanguageMixin from '../../lang/LanguageMixin' |
| | | export default { |
| | | name: "User", |
| | | mixins: [LanguageMixin], |
| | | |
| | | data() { |
| | | data () { |
| | | return { |
| | | layout: 'total, sizes, prev, pager, next, jumper', |
| | | queryInfo: { |
| | |
| | | editUserForm: { |
| | | |
| | | roleId: null, |
| | | name:null, |
| | | roleid:null, |
| | | name: null, |
| | | roleid: null, |
| | | }, |
| | | // 添加分类的验证规则 |
| | | addUserRules: { |
| | | roleId: null, |
| | | username: [ |
| | | {required: true, message: '请输入用户名', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'} |
| | | { required: true, message: '请输入用户名', trigger: 'blur' }, |
| | | { min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur' } |
| | | ], |
| | | password: [ |
| | | {required: true, message: '请输入密码', trigger: 'blur'}, |
| | | {min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur'} |
| | | { required: true, message: '请输入密码', trigger: 'blur' }, |
| | | { min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur' } |
| | | ], |
| | | email: [ |
| | | {required: true, message: '请输入邮箱', trigger: 'blur'}, |
| | | {type: 'email', message: '请输入正确格式的邮箱地址', trigger: 'blur'} |
| | | { required: true, message: '请输入邮箱', trigger: 'blur' }, |
| | | { type: 'email', message: '请输入正确格式的邮箱地址', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | // 控制添加用户弹框的显示和隐藏 |
| | |
| | | // 控制修改用户弹框的显示和隐藏 |
| | | editDialogVisible: false, |
| | | options: [ |
| | | {label: '正常', value: 1}, |
| | | {label: '禁用', value: 0} |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 } |
| | | ], |
| | | roleList: [], |
| | | } |
| | | }, |
| | | created() { |
| | | created () { |
| | | this.getUserList(); |
| | | }, |
| | | methods: { |
| | | getUserList() { |
| | | getUserList () { |
| | | selectPage(this.queryInfo).then(res => { |
| | | this.userList.records = res.data.records; |
| | | |
| | | this.userList.total = res.data.total |
| | | }); |
| | | |
| | | // test().then(res => { |
| | | // console.log(res.data) |
| | | // }); |
| | | // const data6 = [ |
| | | // { id: 32, deviceName: 'Device 7', address: 'Address 1' }, |
| | | // { id: 33, deviceName: 'Device 8', address: 'Address 2' }, |
| | | |
| | | // ]; |
| | | // test().then(res => { |
| | | // console.log(res.data) |
| | | // }); |
| | | // const data6 = [ |
| | | // { id: 32, deviceName: 'Device 7', address: 'Address 1' }, |
| | | // { id: 33, deviceName: 'Device 8', address: 'Address 2' }, |
| | | |
| | | // testup(data6).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | |
| | | // call({ |
| | | // id: 1, |
| | | // name: 12345 |
| | | // }).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | // ]; |
| | | |
| | | // testup(data6).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | |
| | | // call({ |
| | | // id: 1, |
| | | // name: 12345 |
| | | // }).then(res => { |
| | | // console.log(res.data); |
| | | // }); |
| | | |
| | | }, |
| | | |
| | | showAddDialog() { |
| | | |
| | | showAddDialog () { |
| | | this.addDialogVisible = true; |
| | | select().then(res => { |
| | | this.roleList = res.data; |
| | | }); |
| | | select().then(res => { |
| | | this.roleList = res.data; |
| | | }); |
| | | }, |
| | | // stateChange(info) { |
| | | // saveOrUpdate(info).then(() => { |
| | | // this.$message.success("更新状态成功") |
| | | // }); |
| | | // }, |
| | | stateChange(info) { |
| | | saveOrUpdate(info).then(() => { |
| | | const successMessage = this.$t('updateSuccessMessage'); |
| | | this.$message.success(successMessage); |
| | | }); |
| | | }, |
| | | resetPassword(info) { |
| | | this.$confirm('确认重置密码为默认值吗?', '重置密码', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | resetPass(info).then(() => { |
| | | this.$message.success('密码已重置为默认值'); |
| | | stateChange (info) { |
| | | saveOrUpdate(info).then(() => { |
| | | const successMessage = this.$t('updateSuccessMessage'); |
| | | this.$message.success(successMessage); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | // 用户取消重置密码操作 |
| | | }); |
| | | }, |
| | | showEditDialog(id) { |
| | | getById({id: id}).then(res => { |
| | | }, |
| | | resetPassword (info) { |
| | | this.$confirm('确认重置密码为默认值吗?', '重置密码', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | resetPass(info).then(() => { |
| | | this.$message.success('密码已重置为默认值'); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | // 用户取消重置密码操作 |
| | | }); |
| | | }, |
| | | showEditDialog (id) { |
| | | getById({ id: id }).then(res => { |
| | | this.editUserForm = res.data; |
| | | this.editDialogVisible = true; |
| | | }); |
| | | |
| | | |
| | | |
| | | select().then(res => { |
| | | this.roleList = res.data; |
| | | }); |
| | | this.roleList = res.data; |
| | | }); |
| | | }, |
| | | removeUserById(user) { |
| | | removeUserById (user) { |
| | | // 弹框询问用户是否删除分类 |
| | | this.$confirm('此操作将永久删除该分类, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | removeById({id: user.id}).then(() => { |
| | | removeById({ id: user.id }).then(() => { |
| | | // 重新获取分类列表 |
| | | this.getUserList(); |
| | | this.$message.success("删除用户成功"); |
| | |
| | | this.$message.info('已取消删除'); |
| | | }); |
| | | }, |
| | | handleSizeChange(newSize) { |
| | | handleSizeChange (newSize) { |
| | | this.queryInfo.pageSize = newSize; |
| | | this.getUserList() |
| | | }, |
| | | handleCurrentChange(newPage) { |
| | | handleCurrentChange (newPage) { |
| | | this.queryInfo.pageNum = newPage; |
| | | this.getUserList() |
| | | }, |
| | | addDialogClosed() { |
| | | addDialogClosed () { |
| | | this.$refs['addUserRef'].resetFields(); |
| | | }, |
| | | addUser() { |
| | | addUser () { |
| | | this.$refs.addUserRef.validate(async valid => { |
| | | if (!valid) return; |
| | | saveOrUpdate(this.addUserForm).then(() => { |
| | |
| | | }); |
| | | }) |
| | | }, |
| | | editUserInfo() { |
| | | editUserInfo () { |
| | | this.$refs.addCategoryRef.validate(async valid => { |
| | | if (!valid) return; |
| | | |
| | | |
| | | saveOrUpdate(this.editUserForm).then(() => { |
| | | this.$message.success("修改用户成功"); |
| | | // 隐藏添加分类对话框 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12); |
| | | |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // // jsonObject.append("params", paramlist); |
| | | // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| | | // 11, }); |
| | | // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | // if (sendwServer != null) { |
| | | // sendwServer.sendMessage(jsonObject.toString()); |
| | | // } |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.DBx0.0", 40); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | jsonObject.append("arm", |
| | | new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, }); |
| | | jsonObject.append("params", plclist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("alarm"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | Short[] shuzu1 = { |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | }; |
| | | Short[] shuzu1 = plclist.toArray(new Short[0]); |
| | | // Short[] shuzu1 = { |
| | | // 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
| | | // 1, 0, 1, 0, 0, |
| | | // 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // }; |
| | | |
| | | String[] shuzu = { |
| | | "D01 VFD error", |
| | |
| | | for (short i = 0; i < shuzu1.length; i++) { |
| | | short result = alarmMapper.selectnullti(shuzu[i]); |
| | | if (shuzu1[i] == 1 && result == 0) { |
| | | alarmMapper.Insertalarm(shuzu[i]); |
| | | // alarmMapper.Insertalarm(shuzu[i]); |
| | | } else if (shuzu1[i] == 0 && result > 0) { |
| | | alarmMapper.updatealarm(shuzu[i]); |
| | | } |
| | | } |
| | | |
| | | // 写 |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | |
| | | String addressList = "DB100.DBW0"; |
| | | // addressList.add("DB100.DBW0"); |
| | | // addressList.add("DB100.DBW2"); |
| | | // addressList.add("DB100.DBW4"); |
| | | // addressList.add("DB100.DBW6"); |
| | | // addressList.add("DB100.DBW8"); |
| | | // addressList.add("DB100.DBW10"); |
| | | // addressList.add("DB100.DBW12"); |
| | | // addressList.add("DB100.DBW14"); |
| | | // addressList.add("DB100.DBW16"); |
| | | // addressList.add("DB100.DBW18"); |
| | | // addressList.add("DB100.DBW20"); |
| | | // addressList.add("DB100.DBW22"); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12); |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.DBX0.0", 58); |
| | | |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // // jsonObject.append("params", paramlist); |
| | | // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| | | // 11, }); |
| | | // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | // if (sendwServer != null) { |
| | | // sendwServer.sendMessage(jsonObject.toString()); |
| | | // } |
| | | |
| | | JSONObject jsonObject3 = new JSONObject(); |
| | | jsonObject3.append("sig", |
| | | new short[] { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
| | | 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, }); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject3.append("sig", |
| | | // new short[] { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
| | | // 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, |
| | | // }); |
| | | jsonObject.append("sig", plclist); |
| | | WebSocketServer sendwServer3 = WebSocketServer.sessionMap.get("Sign"); |
| | | if (sendwServer3 != null) { |
| | | sendwServer3.sendMessage(jsonObject3.toString()); |
| | | sendwServer3.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("Sign"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | |
| | | String addressList = "DB100.DBW0"; |
| | | // addressList.add("DB100.DBW0"); |
| | | // addressList.add("DB100.DBW2"); |
| | | // addressList.add("DB100.DBW4"); |
| | | // addressList.add("DB100.DBW6"); |
| | | // addressList.add("DB100.DBW8"); |
| | | // addressList.add("DB100.DBW10"); |
| | | // addressList.add("DB100.DBW12"); |
| | | // addressList.add("DB100.DBW14"); |
| | | // addressList.add("DB100.DBW16"); |
| | | // addressList.add("DB100.DBW18"); |
| | | // addressList.add("DB100.DBW20"); |
| | | // addressList.add("DB100.DBW22"); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.DBW", 12); |
| | | |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // // jsonObject.append("params", paramlist); |
| | | // jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| | | // 11, }); |
| | | // WebSocketServer sendwServer = WebSocketServer.sessionMap.get("Parameter"); |
| | | // if (sendwServer != null) { |
| | | // sendwServer.sendMessage(jsonObject.toString()); |
| | | // } |
| | | List<Short> plclist = S7control.getinstance().ReadWord("DB103.DBW0", 10); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sta", |
| | | new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, |
| | | 1, }); |
| | | // jsonObject.append("sta", |
| | | // new short[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, }); |
| | | jsonObject.append("sta", plclist); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("State"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | WebSocketServer webSocketServer = WebSocketServer.sessionMap.get("State"); |
| | | if (webSocketServer != null) { |
| | | List<String> messages = webSocketServer.getMessages(); |
| | | |
| | | String addressList = "DB100.DBW0"; |
| | | // addressList.add("DB100.DBW0"); |
| | | // addressList.add("DB100.DBW2"); |
| | | // addressList.add("DB100.DBW4"); |
| | | // addressList.add("DB100.DBW6"); |
| | | // addressList.add("DB100.DBW8"); |
| | | // addressList.add("DB100.DBW10"); |
| | | // addressList.add("DB100.DBW12"); |
| | | // addressList.add("DB100.DBW14"); |
| | | // addressList.add("DB100.DBW16"); |
| | | // addressList.add("DB100.DBW18"); |
| | | // addressList.add("DB100.DBW20"); |
| | | // addressList.add("DB100.DBW22"); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // 将最后一个消息转换为 short 类型的列表 |
| | | String lastMessage = messages.get(messages.size() - 1); |
| | | System.out.println("messages:" + messages); |
| | | String[] parts = lastMessage.split(","); |
| | | List<Short> messageValues = new ArrayList<>(); |
| | | for (String part : parts) { |
| | | try { |
| | | // 使用正则表达式清除非数字字符 |
| | | String cleanedPart = part.replaceAll("[^0-9-]", ""); |
| | | short value = Short.parseShort(cleanedPart.trim()); |
| | | messageValues.add(value); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 将消息值写入 PLC |
| | | // S7control.getinstance().WriteWord(addressList, messageValues); |
| | | System.out.println("messageValues:" + messageValues); |
| | | System.out.println("addressList:" + addressList); |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.example.springboot.entity.alarmmg; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.service.AlarmService; |
| | | import com.microsoft.schemas.office.office.STInsetMode; |
| | | |
| | | @RestController |
| | | @RequestMapping("/alarm") |
| | |
| | | |
| | | @GetMapping("/load") |
| | | public Result selectAll() { |
| | | List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/stTime") |
| | | public Result selecttime(String shijian1, String shijian2) { |
| | | System.out.println("++++++"); |
| | | System.out.println(shijian1); |
| | | |
| | | if (shijian1 != "" || shijian2 != "") { |
| | | String sj1 = shijian1.replace("#20", " "); |
| | | String sj2 = shijian2.replace("#20", " "); |
| | | List<alarmmg> storageCagelist = alarmMapper.selecttime(sj1, sj2); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } else { |
| | | List<alarmmg> storageCagelist = alarmMapper.selectAll(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", storageCagelist); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Mapper |
| | | public interface AlarmMapper { |
| | | @Select("SELECT * FROM alarmmg") |
| | | @Select("SELECT * FROM alarmmg where endTime is not null and to_days(timeon)=to_days(now())") |
| | | List<alarmmg> selectAll(); |
| | | |
| | | @Select("SELECT count(*) FROM alarmmg where endTime is null and content=#{content}") |
| | |
| | | |
| | | @Insert("UPDATE `canadames`.`alarmmg` set endTime= now() where endTime is null and content=#{content}") |
| | | void updatealarm(String content); |
| | | |
| | | @Select("SELECT * FROM alarmmg where timeon between #{sj1} and #{sj2}") |
| | | List<alarmmg> selecttime(String sj1, String sj2); |
| | | } |