chenrui 4 anos atrás
pai
commit
3cbfcddff5

+ 7 - 2
src/views/equipmentManage/equipment/equipment.vue

@@ -38,7 +38,11 @@
       <template slot="boxThreePercent" slot-scope="text, record">{{ record.boxThreePercent ? record.boxThreePercent + '%' : '--' }}</template>
       <template slot="boxFourPercent" slot-scope="text, record">{{ record.boxFourPercent ? record.boxFourPercent + '%' : '--' }}</template>
       <template slot="boxFivePercent" slot-scope="text, record">{{ record.boxFivePercent ? record.boxFivePercent + '%' : '--' }}</template>
-      <!-- 状态 -->
+      <!-- 设备状态 -->
+      <template slot="onlineFlag" slot-scope="text, record">
+        <span :class="record.onlineFlag==0 ? 'red' : record.onlineFlag==1 ? 'green' : ''">{{ record.onlineFlag == 0 ? '离线' : record.onlineFlag == 1 ? '在线' : '--' }}</span>
+      </template>
+      <!-- 工作状态 -->
       <template slot="state" slot-scope="text, record">
         <span :class="record.state==0 ? 'red' : record.state==1 ? 'green' : ''">{{ record.state == 0 ? '已禁用' : record.state == 1 ? '已启用' : '--' }}</span>
       </template>
@@ -94,7 +98,8 @@ export default {
           ]
         },
         { title: '版本', dataIndex: 'boxVersion', width: 200, align: 'center' },
-        { title: '状态', scopedSlots: { customRender: 'state' }, width: 150, align: 'center' },
+        { title: '设备状态', scopedSlots: { customRender: 'onlineFlag' }, width: 150, align: 'center' },
+        { title: '工作状态', scopedSlots: { customRender: 'state' }, width: 150, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象

+ 3 - 1
src/views/equipmentManage/equipment/logModal.vue

@@ -149,6 +149,8 @@ export default {
 
 <style lang="less">
   .equipment-log-modal{
-
+    .serach-btn{
+      margin-top: 4px;
+    }
   }
 </style>

+ 7 - 1
src/views/equipmentManage/network/equipmentModal.vue

@@ -17,6 +17,7 @@
         placeholder="请通过设备编号搜索"
         enter-button="查询"
         size="large"
+        v-model="searchVal"
         @blur="noData=0"
         @focus="isFocus=true"
         @search="onSearch"
@@ -123,6 +124,7 @@ export default {
       resultData: null, //  设备搜索结果
       noData: 0,
       isFocus: false, //  搜索框是否获取焦点
+      searchVal: '', //  搜索框值
       columns: [
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
         { title: '设备编号', dataIndex: 'srcDeviceCode', width: 100, align: 'center' },
@@ -161,6 +163,7 @@ export default {
         } else {
           this.typeList = []
         }
+        this.getDevice()
       })
     },
     //  处理每个设备所对应的箱体类型
@@ -266,8 +269,11 @@ export default {
     },
     networkId (newValue, oldValue) {
       if (this.isShow && newValue) {
+        this.searchVal = ''
+        this.resultData = null //  设备搜索结果
+        this.noData = 0
+        this.isFocus = false //  搜索框是否获取焦点
         this.getDeviceType()
-        this.getDevice()
       }
     }
   }

+ 5 - 5
src/views/equipmentManage/network/network.vue

@@ -114,13 +114,13 @@ export default {
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 200, align: 'center' },
         { title: '网点名称', dataIndex: 'name', width: 200, align: 'center' },
-        { title: '省', dataIndex: 'provinceName', width: 200, align: 'center' },
-        { title: '市', dataIndex: 'cityName', width: 200, align: 'center' },
-        { title: '区', dataIndex: 'districtName', width: 200, align: 'center' },
+        { title: '省', dataIndex: 'provinceName', width: 150, align: 'center' },
+        { title: '市', dataIndex: 'cityName', width: 150, align: 'center' },
+        { title: '区', dataIndex: 'districtName', width: 150, align: 'center' },
         { title: '详细地址', dataIndex: 'address', width: 200, align: 'center' },
         { title: '兑换规则', dataIndex: 'exRuleName', width: 200, align: 'center' },
-        { title: '投放时间段名称', dataIndex: 'timeRuleName', width: 220, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
+        { title: '投放时间段名称', dataIndex: 'timeRuleName', width: 200, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {

+ 8 - 145
src/views/user/ChangePwd.vue

@@ -1,158 +1,21 @@
 <template>
-
   <a-card :bordered="false" class="change-pwd-card">
-    <a-row :gutter="24" class="change-pwd">
-      <a-col span="8" offset="8">
-        <a-form @submit="handleSubmit" :form="form">
-          <!-- 原始密码 -->
-          <a-form-item
-            label="原始密码"
-            prop="oldPwd"
-            :label-col="formLayout.labelCol"
-            :wrapper-col="formLayout.wrapperCol">
-            <a-input
-              type="password"
-              v-decorator="[
-                'formCustom.oldPwd',
-                { initialValue: formCustom.oldPwd,
-                  rules: [
-                    { required: true, message: '请输入原始密码' },
-                  ]
-                },
-              ]">
-            </a-input>
-          </a-form-item>
-          <!-- 新密码 -->
-          <a-form-item
-            label="新密码"
-            prop="passwd"
-            :label-col="formLayout.labelCol"
-            :wrapper-col="formLayout.wrapperCol">
-            <a-input
-              type="password"
-              v-decorator="[
-                'formCustom.passwd',
-                { initialValue: formCustom.passwd,
-                  rules: [
-                    { required: true, message: '请输入新密码' }
-                  ]
-                },
-              ]">
-            </a-input>
-          </a-form-item>
-          <!-- 再次确认 -->
-          <a-form-item
-            label="再次确认"
-            prop="passwdCheck"
-            :label-col="formLayout.labelCol"
-            :wrapper-col="formLayout.wrapperCol">
-            <a-input
-              type="password"
-              v-decorator="[
-                'formCustom.passwdCheck',
-                { initialValue: formCustom.passwdCheck,
-                  rules: [
-                    { required: true, message: '请再次输入密码' },
-                    { validator: compareToFirstPassword }
-                  ]
-                },
-              ]">
-            </a-input>
-          </a-form-item>
-          <a-col span="16" offset="8">
-            <a-form-item>
-              <a-button type="primary" htmlType="submit" :loading="loading">保存</a-button>
-              <a-button @click="handleReset('formCustom')" style="margin-left: 8px">重置</a-button>
-            </a-form-item>
-          </a-col>
-        </a-form>
-      </a-col>
-    </a-row>
+    <ResetPwd />
   </a-card>
-
 </template>
 
 <script>
-import { changePwd } from '@/api/login.js'
-import { mapActions, mapGetters } from 'vuex'
-
+import ResetPwd from '@/views/user/ResetPwd.vue'
 export default {
   name: 'ChangePwd',
-  data () {
-    return {
-      formLayout: {
-        labelCol: {
-          xs: { span: 24 },
-          sm: { span: 6 }
-        },
-        wrapperCol: {
-          xs: { span: 24 },
-          sm: { span: 18 }
-        }
-      },
-      form: this.$form.createForm(this),
-      loading: false,
-      formCustom: {
-        passwd: '',
-        passwdCheck: '',
-        oldPwd: ''
-      }
-    }
-  },
-  methods: {
-    ...mapActions(['Logout']),
-    // 密码校验
-    compareToFirstPassword (rule, value, callback) {
-      const form = this.form
-      if (value && value !== form.getFieldValue('formCustom.passwd')) {
-        callback('两次输入的密码不一致, 请重新输入!')
-      } else {
-        callback()
-      }
-    },
-    handleSubmit (e) {
-      e.preventDefault()
-      const _this = this
-      this.form.validateFields((err, values) => {
-        console.log(values, 'values')
-        if (!err) {
-          changePwd({
-            oldPassword: values.formCustom.oldPwd,
-            password: values.formCustom.passwd
-          }).then(res => {
-            console.log(res, 'res111111')
-            if (res.status === '200') {
-              _this.$message.success('修改成功, 请重新登录')
-              _this.logout()
-            } else {
-              // _this.$message.error(res.message)
-            }
-          })
-        }
-      })
-    },
-    logout () {
-      this.Logout({}).then(() => {
-        setTimeout(() => {
-          this.$router.push({ path: '/user/login' })
-        }, 16)
-      })
-    },
-    handleReset () {
-      this.form.resetFields()
-    }
+  components: {
+    ResetPwd
   }
-
 }
 </script>
 
-<style scoped>
-  .change-pwd {
-    margin-top: 15vh;
-  }
-
-  .change-pwd-card {
-    height: 70vh;
-    /* border-top: 2px solid #FFB01B; */
-  }
+<style lang="less" scoped>
+.change-pwd-card {
+  padding-top: 50px;
+}
 </style>

+ 155 - 0
src/views/user/ResetPwd.vue

@@ -0,0 +1,155 @@
+<template>
+  <a-row :gutter="24" class="change-pwd">
+    <a-col span="8" offset="8">
+      <a-form @submit="handleSubmit" :form="form">
+        <!-- 原始密码 -->
+        <a-form-item
+          label="原始密码"
+          prop="oldPwd"
+          :label-col="formLayout.labelCol"
+          :wrapper-col="formLayout.wrapperCol">
+          <a-input
+            type="password"
+            :maxLength="12"
+            placeholder="请输入原始密码(6~12位)"
+            v-decorator="[
+              'formCustom.oldPwd',
+              { initialValue: formCustom.oldPwd,
+                rules: [
+                  { required: true, message: '请输入原始密码' },
+                ]
+              },
+            ]">
+          </a-input>
+        </a-form-item>
+        <!-- 新密码 -->
+        <a-form-item
+          label="新密码"
+          prop="passwd"
+          :label-col="formLayout.labelCol"
+          :wrapper-col="formLayout.wrapperCol">
+          <a-input
+            type="password"
+            :maxLength="12"
+            placeholder="请输入新密码(6~12位)"
+            v-decorator="[
+              'formCustom.passwd',
+              { initialValue: formCustom.passwd,
+                rules: [
+                  { required: true, message: '请输入新密码' },
+                  { validator: passwordValid }
+                ]
+              },
+            ]">
+          </a-input>
+        </a-form-item>
+        <!-- 再次确认 -->
+        <a-form-item
+          label="再次确认"
+          prop="passwdCheck"
+          :label-col="formLayout.labelCol"
+          :wrapper-col="formLayout.wrapperCol">
+          <a-input
+            type="password"
+            :maxLength="12"
+            placeholder="请再次输入新密码(6~12位)"
+            v-decorator="[
+              'formCustom.passwdCheck',
+              { initialValue: formCustom.passwdCheck,
+                rules: [
+                  { required: true, message: '请再次输入密码' },
+                  { validator: compareToFirstPassword }
+                ]
+              },
+            ]">
+          </a-input>
+        </a-form-item>
+        <a-col span="16" offset="8">
+          <a-form-item>
+            <a-button type="primary" htmlType="submit" :loading="loading">保存</a-button>
+            <a-button @click="handleReset('formCustom')" style="margin-left: 8px">重置</a-button>
+          </a-form-item>
+        </a-col>
+      </a-form>
+    </a-col>
+  </a-row>
+</template>
+
+<script>
+import { changePwd } from '@/api/login.js'
+import { mapActions } from 'vuex'
+export default {
+  name: 'ResetPwd',
+  data () {
+    return {
+      formLayout: {
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 6 }
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 18 }
+        }
+      },
+      form: this.$form.createForm(this),
+      loading: false,
+      formCustom: {
+        passwd: '',
+        passwdCheck: '',
+        oldPwd: ''
+      }
+    }
+  },
+  methods: {
+    ...mapActions(['Logout']),
+    //  密码位数校验
+    passwordValid (rule, value, callback) {
+      if (value.length < 6 || value.length > 12) {
+        callback('请输入6-12位密码!')
+      } else {
+        callback()
+      }
+    },
+    // 密码校验
+    compareToFirstPassword (rule, value, callback) {
+      const form = this.form
+      if (value && value !== form.getFieldValue('formCustom.passwd')) {
+        callback('两次输入的密码不一致, 请重新输入!')
+      } else {
+        callback()
+      }
+    },
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          changePwd({
+            oldPassword: values.formCustom.oldPwd,
+            password: values.formCustom.passwd
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success('修改成功, 请重新登录')
+              _this.logout()
+            }
+          })
+        }
+      })
+    },
+    logout () {
+      this.Logout({}).then(() => {
+        setTimeout(() => {
+          this.$router.push({ path: '/user/login' })
+        }, 16)
+      })
+    },
+    handleReset () {
+      this.form.resetFields()
+    }
+  }
+}
+</script>
+
+<style>
+</style>