chenrui 2 år sedan
förälder
incheckning
3b28dbfff7

+ 40 - 0
src/api/handDevice.js

@@ -0,0 +1,40 @@
+import { axios } from '@/utils/request'
+
+//  设备管理列表  分页
+export const handDeviceList = (params) => {
+  const url = `/handDevice/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 设备管理  新增
+export const handDeviceSave = (params) => {
+  const url = `/handDevice/create`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 设备管理  详情
+export const handDeviceDetail = (params) => {
+  const url = `/handDevice/findById/${params.id}`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 设备管理  删除
+export const handDeviceDel = (params) => {
+  const url = `/handDevice/delete/${params.id}`
+  return axios({
+    url: url,
+    data: params,
+    method: 'get'
+  })
+}

+ 48 - 37
src/config/router.config.js

@@ -59,43 +59,43 @@ export const asyncRouterMap = [
           permission: 'M_numsGoodsShelves'
         },
         children: [
-           {
-             path: '/numsGoodsShelves/approveStore',
-             redirect: '/numsGoodsShelves/approveStore/list',
-             name: 'approveStore',
-             component: BlankLayout,
-             meta: {
-               title: '汽修厂认证审核',
-               icon: 'monitor',
-               permission: 'M_approveStore'
-             },
-             hideChildrenInMenu: true,
-             children: [
-               {
-                 path: 'list',
-                 name: 'approveStoreList',
-                 component: () => import(/* webpackChunkName: "numsGoodsShelves" */ '@/views/numsGoodsShelves/approveStore/list.vue'),
-                 meta: {
-                   title: '认证审核列表',
-                   icon: 'monitor',
-                   replaceTab: true,
-                   hidden: true,
-                   permission: 'M_approveStore'
-                 }
-               },
-               {
-                 path: 'authPass/:sn',
-                 name: 'approveStoreAuthPass',
-                 component: () => import(/* webpackChunkName: "numsGoodsShelves" */ '@/views/numsGoodsShelves/approveStore/authPass.vue'),
-                 meta: {
-                   title: '审核通过',
-                   icon: 'monitor',
-                   replaceTab: true,
-                   hidden: true
-                 }
-               },
-             ]
-           },
+          {
+            path: '/numsGoodsShelves/approveStore',
+            redirect: '/numsGoodsShelves/approveStore/list',
+            name: 'approveStore',
+            component: BlankLayout,
+            meta: {
+              title: '汽修厂认证审核',
+              icon: 'monitor',
+              permission: 'M_approveStore'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'approveStoreList',
+                component: () => import(/* webpackChunkName: "numsGoodsShelves" */ '@/views/numsGoodsShelves/approveStore/list.vue'),
+                meta: {
+                  title: '认证审核列表',
+                  icon: 'monitor',
+                  replaceTab: true,
+                  hidden: true,
+                  permission: 'M_approveStore'
+                }
+              },
+              {
+                path: 'authPass/:sn',
+                name: 'approveStoreAuthPass',
+                component: () => import(/* webpackChunkName: "numsGoodsShelves" */ '@/views/numsGoodsShelves/approveStore/authPass.vue'),
+                meta: {
+                  title: '审核通过',
+                  icon: 'monitor',
+                  replaceTab: true,
+                  hidden: true
+                }
+              }
+            ]
+          }
         ]
       },
       // 连锁组管理
@@ -310,6 +310,17 @@ export const asyncRouterMap = [
               icon: 'read',
               permission: 'M_operateJournal'
             }
+          },
+          {
+            path: '/setting/equipmentManagement',
+            name: 'equipmentManagement',
+            component: () => import(/* webpackChunkName: "setting" */
+              '@/views/power/equipment/equipmentManagement.vue'),
+            meta: {
+              title: '设备管理',
+              icon: 'read'
+              // permission: 'M_operateJournal'
+            }
           }
         ]
       }

+ 154 - 0
src/views/power/equipment/addEquipmentModal.vue

@@ -0,0 +1,154 @@
+<template>
+  <a-modal
+    centered
+    class="userEdit-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="绑定设备"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="800">
+    <a-form-model
+      id="userEdit-form"
+      ref="ruleForm"
+      :model="form"
+      :rules="rules"
+      :label-col="formItemLayout.labelCol"
+      :wrapper-col="formItemLayout.wrapperCol">
+      <a-form-model-item label="设备编码" prop="deviceCode">
+        <a-input v-model="form.deviceCode" placeholder="请输入设备编码" />
+      </a-form-model-item>
+      <a-form-model-item label="设备名称" prop="deviceName">
+        <a-input v-model="form.deviceName" placeholder="请输入设备名称" />
+      </a-form-model-item>
+      <a-form-model-item label="绑定客户" prop="dealerSn">
+        <storeList ref="storeList" @change="custChange"></storeList>
+      </a-form-model-item>
+      <a-form-model-item label="是否启用" prop="enabledFlag">
+        <a-radio-group default-value="0" button-style="solid" v-model="form.enabledFlag">
+          <a-radio-button value="1">
+            是
+          </a-radio-button>
+          <a-radio-button value="0">
+            否
+          </a-radio-button>
+        </a-radio-group>
+      </a-form-model-item>
+      <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
+        <a-button :style="{ marginRight: '8px' }" @click="isShow=false">取消</a-button>
+        <a-button type="primary" @click="handleSubmit()" :style="{ marginLeft: '8px' }">确定</a-button>
+      </a-form-model-item>
+    </a-form-model>
+  </a-modal>
+</template>
+
+<script>
+import { VSelect } from '@/components'
+import storeList from '@/views/common/storeList.vue'
+import { handDeviceSave, handDeviceDetail } from '@/api/handDevice'
+export default {
+  components: { VSelect, storeList },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemId: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        dealerSn: undefined, // 客户SN
+        deviceCode: '', // 设备编码
+        deviceName: '', // 设备名称
+        enabledFlag: '0'//  启用标记
+      },
+      rules: {
+        deviceCode: [ { required: true, message: '请输入设备编码', trigger: 'blur' } ],
+        deviceName: [ { required: true, message: '请输入设备名称', trigger: 'blur' } ],
+        dealerSn: [ { required: true, message: '请选择绑定客户', trigger: 'change' } ],
+        enabledFlag: [ { required: true, message: '请选择是否启用', trigger: 'change' } ]
+      }
+    }
+  },
+  methods: {
+    custChange (val) {
+      this.form.dealerSn = val.key
+    },
+    // 保存
+    handleSubmit () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = JSON.parse(JSON.stringify(_this.form))
+          handDeviceSave(params).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('confirm', _this.form)
+              _this.isShow = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 获取详情
+    getDetail () {
+      handDeviceDetail({ id: this.itemId }).then(res => {
+        if (res.status == 200) {
+          this.form.versionType = res.data.versionType
+          this.form.version = res.data.version
+          this.form.publicDate = res.data.publicDate
+          this.form.forceUpgrade = res.data.forceUpgrade ? Number(res.data.forceUpgrade) : null
+          this.form.downloadUrl = res.data.downloadUrl
+          this.form.upgradeContent = res.data.upgradeContent
+          this.form.attachment = res.data.attachment
+        } else {
+          this.$refs.ruleForm.resetFields()
+        }
+      })
+    },
+    // 重置数据
+    reset () {
+      this.form = {
+        dealerSn: undefined, // 客户SN
+        deviceCode: '', // 设备编码
+        deviceName: '', // 设备名称
+        enabledFlag: '0'//  启用标记
+      }
+      this.$refs.ruleForm.resetFields()
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.reset()
+      }
+    },
+    itemId (newValue, oldValue) {
+      if (this.isShow && newValue) { //  编辑
+        this.getDetail()
+      }
+    }
+  }
+}
+</script>
+
+<style>
+</style>

+ 174 - 0
src/views/power/equipment/equipmentManagement.vue

@@ -0,0 +1,174 @@
+<template>
+  <a-card :bordered="false">
+    <div class="equipmentManagement">
+      <!-- 搜索框 -->
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="5" :sm="24">
+              <a-form-item label="设备编码">
+                <a-input allowClear v-model.trim="queryParam.deviceCode" placeholder="请输入设备编码" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-item label="客户名称">
+                <storeList ref="storeList" @change="custChange"></storeList>
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-item label="所属省份">
+                <a-select id="equipmentManagement-addrProvince" allowClear v-model="queryParam.provinceSn" placeholder="请选择省">
+                  <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-item label="启用状态">
+                <v-select
+                  v-model="queryParam.deviceCode"
+                  ref="auditStatus"
+                  code="ENABLE_FLAG"
+                  placeholder="请选择启用状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="equipmentManagement-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="equipmentManagement-reset">重置</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <div class="table-operator">
+        <a-button type="primary" class="button-error" @click="this.openModal = true">添加设备</a-button>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        bordered>
+        <!--是否启用 -->
+        <template slot="isEnabled" slot-scope="text, record">
+          <a-switch checked-children="是" un-checked-children="否" :checked="true" />
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button size="small" type="link" class="button-primary" @click="handleEdit(record)">编辑</a-button>
+          <a-button size="small" type="link" class="button-primary" @click="handleDel(record)">删除</a-button>
+        </template>
+      </s-table>
+    </div>
+    <!-- 添加设备 -->
+    <addEquipmentModal :openModal="openModal" :itemId="itemId" @confirm="$refs.table.refresh(true)" @close="openModal=false" />
+  </a-card>
+</template>
+
+<script>
+import storeList from '@/views/common/storeList.vue'
+import { STable, VSelect } from '@/components'
+import addEquipmentModal from './addEquipmentModal'
+import { handDeviceList, handDeviceDel } from '@/api/handDevice.js'
+import { getAreaCgj } from '@/api/data'
+export default {
+  name: 'EquipmentManagement',
+  components: { STable, VSelect, storeList, addEquipmentModal },
+  data () {
+    return {
+      advanced: false, // 高级搜索 展开/关闭
+      disabled: false, //  查询、重置按钮是否可操作
+      queryParam: {
+        dealerSn: undefined,
+        deviceCode: undefined,
+        deviceName: undefined,
+        enabledFlag: undefined,
+        provinceSn: undefined
+      },
+      addrProvinceList: [],
+      openModal: false,
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '设备编码', dataIndex: 'deviceCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '设备名称', dataIndex: 'deviceName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '绑定客户', dataIndex: 'dealer.dealerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '所属省份', dataIndex: 'dealer.provinceName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '是否启用', scopedSlots: { customRender: 'isEnabled' }, align: 'center' },
+        { title: '添加时间', dataIndex: 'addTime', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        return handDeviceList(Object.assign(parameter, this.queryParam)).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.disabled = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 获取所属省份
+    getCityList () {
+      getAreaCgj({ type: '2' }).then(res => {
+        if (res.status == 200) {
+          this.addrProvinceList = res.data || []
+        } else {
+          this.addrProvinceList = []
+        }
+      })
+    },
+    modalOk () {
+
+    },
+    // 选择客户
+    custChange (val) {
+      this.queryParam.dealerSn = val.key
+    },
+    handleEdit () {},
+    handleDel (row) {
+      this.$warning({
+        title: '提示',
+        content: '删除该设备后,所有绑定数据将被清除,并且不能继续操作。',
+        onOk () {
+          const _this = this
+          handDeviceDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.resetSearchForm()
+            }
+          })
+        },
+        onCancel () {}
+      })
+    },
+    //  时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    // 重置
+    resetSearchForm () {
+      this.queryParam.dealerSn = ''
+      this.queryParam.deviceCode = ''
+      this.queryParam.deviceName = ''
+      this.queryParam.enabledFlag = ''
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>
+<style lang="less">
+  .equipmentManagement{
+    .sTable{
+      margin-top: 10px;
+    }
+  }
+</style>

+ 3 - 0
src/views/power/menuMould/setModal.vue

@@ -171,6 +171,9 @@ export default {
 <style lang="less">
   .customerTypeEdit-modal{
     .ant-modal-body {
+      box-sizing:border-box;
+      max-height:77vh;
+      overflow-y:scroll;
       padding: 40px 40px 24px;
     }
     .btn-cont {