Explorar el Código

登录 + 组织 + 门店

chenrui hace 4 años
padre
commit
88c6972e63

+ 26 - 0
src/api/atorg.js

@@ -0,0 +1,26 @@
+import { axios } from '@/utils/request'
+
+// 组织机构列表
+export const findOrgTree = params => {
+  return axios({
+    url: '/atorg/findOrgTree',
+    data: params,
+    method: 'post'
+  })
+}
+// 保存
+export const saveAtorg = params => {
+  return axios({
+    url: '/atorg/save',
+    data: params,
+    method: 'post'
+  })
+}
+// 删除
+export const delAtorg = params => {
+  return axios({
+    url: `/atorg/delete/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}

+ 1 - 1
src/api/data.js

@@ -2,7 +2,7 @@ import { axios } from '@/utils/request'
 
 export function login (parameter) {
   return axios({
-    url: '/login',
+    url: '/auth/login',
     method: 'post',
     data: parameter
   })

+ 2 - 2
src/api/index.js

@@ -1,6 +1,6 @@
 const api = {
-  Login: '/login',
-  Logout: '/logout',
+  Login: '/auth/login',
+  Logout: '/auth/logout',
   ForgePassword: '/auth/forge-password',
   Register: '/auth/register',
   twoStepCode: '/auth/2step-code',

+ 2 - 2
src/api/login.js

@@ -3,7 +3,7 @@ import { axios } from '@/utils/request'
 
 export function login ({ username, password }) {
   return axios({
-    url: 'login',
+    url: '/auth/login',
     headers: { 'content-type': 'application/x-www-form-urlencoded', 'App-Type': 9 },
     data: `username=${username}&password=${password}`,
     method: 'post'
@@ -12,7 +12,7 @@ export function login ({ username, password }) {
 
 export function logout () {
   return axios({
-    url: 'logout',
+    url: '/auth/logout',
     method: 'get'
   })
 }

+ 26 - 0
src/api/store.js

@@ -0,0 +1,26 @@
+import { axios } from '@/utils/request'
+
+// 查询门店明细
+export const findStoreDetail = params => {
+  return axios({
+    url: `/store/findDetail/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+// 分页查询门店列表
+export const findStoreList = params => {
+  return axios({
+    url: '/store/findPage',
+    data: params,
+    method: 'post'
+  })
+}
+// 保存门店组织机构
+export const saveStoreOrg = params => {
+  return axios({
+    url: '/store/saveOrg',
+    data: params,
+    method: 'post'
+  })
+}

+ 34 - 1
src/config/router.config.js

@@ -44,6 +44,39 @@ export const asyncRouterMap = [{
     }
     ]
   },
+  // 基础设置 BasicSettings
+  {
+    path: '/BasicSettings',
+    redirect: '/BasicSettings/Organization',
+    component: PageView,
+    meta: {
+      title: '基础设置',
+      icon: 'apartment'
+      // permission: 'M_yyAuth_0'
+    },
+    children: [
+      {
+        path: '/BasicSettings/Organization',
+        name: 'Organization',
+        component: () => import(/* webpackChunkName: "auth" */ '@/views/BasicSettings/Organization.vue'),
+        meta: {
+          title: '组织机构',
+          icon: 'user'
+          // permission: 'M_auth_yyUser'
+        }
+      },
+      {
+        path: '/BasicSettings/StoreManagement',
+        name: 'StoreManagement',
+        component: () => import(/* webpackChunkName: "auth" */ '@/views/BasicSettings/StoreManagement.vue'),
+        meta: {
+          title: '门店管理',
+          icon: 'user'
+          // permission: 'M_auth_yyUser'
+        }
+      }
+    ]
+  },
   {
     path: '/auth',
     redirect: '/auth/userList',
@@ -107,7 +140,7 @@ export const asyncRouterMap = [{
         }
       }
     ]
-  },
+  }
   ]
 },
 {

+ 2 - 2
src/permission.js

@@ -27,7 +27,7 @@ router.beforeEach((to, from, next) => {
       NProgress.done()
     } else {
       const userInfo = Vue.ls.get('userName')
-      // console.log(userInfo)
+      console.log(userInfo)
       if (userInfo) {
         store.dispatch('SetInfo', userInfo)
       } else {
@@ -41,7 +41,7 @@ router.beforeEach((to, from, next) => {
           .dispatch('GetInfo', token)
           .then(res => {
             const roles = res
-            // console.log(roles, 'roles')
+            console.log(roles, 'roles')
             if (roles.permissionList.length == 0 || !roles) {
               store.dispatch('Logout').then(() => {
                 store.dispatch('ResetRoutes').then(() => {

+ 45 - 14
src/store/modules/user.js

@@ -35,26 +35,57 @@ const user = {
   },
 
   actions: {
+    // 登录
+    // Login ({ commit }, userInfo) {
+    //   console.log(userInfo, 'userInfo----')
+    //   return new Promise((resolve, reject) => {
+    //     login(userInfo).then(res => {
+    //       console.log(res, 'login success')
+    //       if (res && res.userid) {
+    //         Vue.ls.set('hasError', 0)
+    //         commit('SET_TOKEN', res.userid)
+    //         commit('SET_NAME', { name: res.userNameCN, welcome: welcome() })
+    //         commit('SET_AVATAR', res.avatar ? res.avatar : '')
+    //         Vue.ls.set('rolesAccess', { permissionList: res.permCodes }, 7 * 24 * 60 * 60 * 1000)
+    //         // 记住密码
+    //         if (userInfo.rememberMe) {
+    //           VueCookies.set('REMEMBER_ME', JSON.stringify(userInfo))
+    //         } else {
+    //           VueCookies.remove('REMEMBER_ME')
+    //         }
+    //       }
+    //       resolve()
+    //     }).catch(error => {
+    //       reject(error)
+    //     })
+    //   })
+    // },
     // 登录
     Login ({ commit }, userInfo) {
       console.log(userInfo, 'userInfo----')
       return new Promise((resolve, reject) => {
-        login(userInfo).then(res => {
-          console.log(res, 'login success')
-          if (res && res.userid) {
-            Vue.ls.set('hasError', 0)
-            commit('SET_TOKEN', res.userid)
-            commit('SET_NAME', { name: res.userNameCN, welcome: welcome() })
-            commit('SET_AVATAR', res.avatar ? res.avatar : '')
-            Vue.ls.set('rolesAccess', { permissionList: res.permCodes }, 7 * 24 * 60 * 60 * 1000)
-            // 记住密码
-            if (userInfo.rememberMe) {
-              VueCookies.set('REMEMBER_ME', JSON.stringify(userInfo))
-            } else {
-              VueCookies.remove('REMEMBER_ME')
+        login(userInfo).then(ret => {
+          console.log(ret, 'login success')
+          if (ret.status == 200) {
+            const res = ret.data
+            if (ret.access_token && ret.auth_user) {
+              const users = ret.auth_user
+              Vue.ls.set('hasError', 0)
+              commit('SET_TOKEN', ret.access_token)
+              commit('SET_NAME', { name: users.userNameCN, welcome: welcome() })
+              Vue.ls.set('rolesAccess', { permissionList: users.permCodes }, 7 * 24 * 60 * 60 * 1000)
+              // commit('SET_AVATAR', res.avatar ? res.avatar : '')
+              // 记住密码
+              if (userInfo.rememberMe) {
+                VueCookies.set('REMEMBER_ME', JSON.stringify(userInfo))
+              } else {
+                VueCookies.remove('REMEMBER_ME')
+              }
             }
+            resolve(res)
+          } else {
+            reject(ret)
           }
-          resolve()
         }).catch(error => {
           reject(error)
         })

+ 194 - 0
src/views/BasicSettings/Organization.vue

@@ -0,0 +1,194 @@
+<template>
+  <a-card class="organization-wrap" :bordered="false">
+    <!-- 新建 -->
+    <div class="table-operator"><a-button type="primary" icon="plus" @click="addOrg()">添加最高级</a-button></div>
+    <!-- 表格列表 -->
+    <s-table
+      class="s-table"
+      ref="table"
+      size="default"
+      rowKey="id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          v-if="record.children"
+          type="link"
+          size="small"
+          icon="plus"
+          class="btn-add-s"
+          @click="addOrg(text)">添加子级</a-button>
+        <a-button type="link" size="small" icon="edit" class="btn-edit-s" @click="editOrg(text)">编辑</a-button>
+        <a-button type="link" size="small" icon="delete" class="btn-del-s" @click="delOrg(text)">删除</a-button>
+      </template>
+    </s-table>
+    <!-- 添加子级 -->
+    <a-modal
+      class="modal"
+      :title="title"
+      :visible="visible"
+      :footer="null"
+      :closable="true"
+      @cancel="onCancel"
+      width="600px">
+      <!-- 表单 -->
+      <a-form-model ref="ruleForm" :model="form" :rules="rules">
+        <a-form-model-item label="网点名称" prop="name">
+          <a-input v-model.trim="form.name" :maxLength="30" placeholder="请输入组织机构名称,30个字以内" />
+        </a-form-model-item>
+        <a-form-model-item class="btn-cont">
+          <a-button type="primary" @click="onSubmit">保存</a-button>
+          <a-button class="cancel" @click="onCancel">取消</a-button>
+        </a-form-model-item>
+      </a-form-model>
+    </a-modal>
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { findOrgTree, saveAtorg, delAtorg } from '@/api/atorg.js'
+export default {
+  components: { STable, VSelect },
+  data () {
+    return {
+      columns: [
+        { title: '组织机构名称', dataIndex: 'name', width: '100', align: 'left' },
+        { title: '创建时间', dataIndex: 'createDate', width: '100', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return findOrgTree(Object.assign(parameter, {})).then(res => {
+          console.log(res)
+          //  递归去除空children
+          this.recursionFun(res.data.list)
+          return res.data
+        })
+      },
+      title: '新增', //  对话框标题
+      visible: false, //  对话框是否可见
+      form: { //  新增编辑  组织机构
+        name: ''
+      },
+      rules: { //  表单校验规则
+        name: [{ required: true, message: '请输入组织机构名称', trigger: 'blur' }]
+      },
+      nowId: '', //  当前操作的数据id
+      nowPid: '' //  当前操作的数据上级id
+    }
+  },
+  methods: {
+    //  添加子级
+    addOrg (item) {
+      this.nowId = ''
+      if (item) { //  子级
+        this.nowPid = item.id
+      } else { //  最高级
+        this.nowPid = 0
+      }
+      this.title = '新增'
+      this.visible = true
+    },
+    //  编辑
+    editOrg (item) {
+      this.nowId = item.id
+      this.nowPid = item.pid
+      this.title = '编辑'
+      this.form.name = item.name
+      this.visible = true
+    },
+    //  保存
+    onSubmit () {
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const formData = JSON.parse(JSON.stringify(_this.form))
+          formData.id = _this.nowId
+          formData.pid = _this.nowPid
+          saveAtorg(formData).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh(true)
+              _this.visible = false
+            } else {
+              _this.$message.error(res.message)
+            }
+          })
+        } else {
+          return false
+        }
+      })
+    },
+    //  关闭对话框
+    onCancel () {
+      //  重置表单数据
+      this.form.name = ''
+      this.visible = false
+    },
+    //  删除
+    delOrg (item) {
+      const _this = this
+      _this.nowId = item.id
+      _this.$confirm({
+        title: '提示',
+        content: '删除后原数据不可恢复,是否删除?',
+        onOk () {
+          delAtorg({ id: _this.nowId }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            } else {
+              _this.$message.error(res.message)
+            }
+          })
+        }
+      })
+    },
+    //  递归函数
+    recursionFun (data) {
+      data.map(item => {
+        if (item.children && item.children.length == 0) {
+          delete item.children
+        } else {
+          this.recursionFun(item.children)
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .organization-wrap{
+    // 表格
+    .s-table{
+      .btn-edit-s{
+        color: #1891ff;
+        margin: 0 5px;
+      }
+      .btn-del-s{
+        color: #ff4d4f;
+      }
+      .btn-edit-s.ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger), .btn-edit-s.ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger){
+        color: #1891ff;
+        border-color: #1891ff;
+      }
+      .btn-del-s.ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger), .btn-del-s.ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger){
+        color: #ff4d4f;
+        border-color: #ff4d4f;
+      }
+    }
+  }
+  // 弹框
+  .modal{
+    .btn-cont{
+      text-align: center;
+      .cancel {
+      	margin-left: 50px;
+      }
+    }
+  }
+</style>

+ 169 - 0
src/views/BasicSettings/StoreManagement.vue

@@ -0,0 +1,169 @@
+<template>
+  <a-card class="StoreManagement" :bordered="false">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline">
+        <a-row :gutter="48">
+          <a-col :span="6">
+            <a-form-item class="search-item" label="门店名称">
+              <a-input v-model.trim="queryParam.name" placeholder="请输入门店名称" @pressEnter="$refs.table.refresh(true)" allowClear />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item class="search-item" label="负责人手机">
+              <a-input v-model.trim="queryParam.managerMobile" placeholder="请输入负责人手机" @pressEnter="$refs.table.refresh(true)" allowClear />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item class="search-item" label="组织机构">
+              <a-input v-model.trim="queryParam.orgCode" placeholder="请选择组织机构" @pressEnter="$refs.table.refresh(true)" allowClear />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item class="search-item" label="门店类型">
+              <!-- <v-select ref="businessStatus" allowClear placeholder="请选择门店类型" v-model="queryParam.type" code="STORE_BUSINESS_STATUS"></v-select> -->
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item class="search-item" label="启用状态">
+              <!-- <v-select ref="deviceStatus" allowClear placeholder="请选择启用状态" v-model="queryParam.enableFlag" code="DEVICE_STATUS"></v-select> -->
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-button type="primary" class="search-btn" @click="$refs.table.refresh(true)">查询</a-button>
+            <a-button type="" @click="reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 表格列表 -->
+    <s-table
+      ref="table"
+      size="default"
+      rowKey="id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-icon type="edit" title="编辑" @click="edit(record)" :style="{ fontSize: '20px', color: '#1890FF', padding: '0 10px' }" />
+        <a-icon type="link" title="设置" @click="modalHandle('details', record)" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" />
+      </template>
+    </s-table>
+
+    <!-- 新增/编辑 洗车机 -->
+    <store-modal :openModal="openModal" :storeId="storeId" @success="carWashSubmit" @close="closeModal" />
+    <!-- 查看详情 洗车机 -->
+    <!-- <details-car-wash-modal :openModal="openEquipmentModal" :storeId="storeId" @close="closeDetailsModal" /> -->
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import StoreModal from './StoreModal.vue'
+// import DetailsCarWashModal from './DetailsCarWashModal.vue'
+// import { getProvince, getCityByPro } from '@/api/lookup'
+import { findStoreList } from '@/api/store.js'
+export default {
+  name: 'CarWashManagement',
+  components: { STable, VSelect, StoreModal },
+  data () {
+    return {
+      queryParam: {
+        name: '', //  门店名称
+        managerMobile: '', //  负责人手机
+        orgCode: '', //  组织机构
+        type: '', //  门店类型
+        enableFlag: '' //  启用状态
+      },
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '100', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '100', align: 'center' },
+        { title: '组织机构', dataIndex: 'orgCode', width: '100', align: 'center' },
+        { title: '门店名称', dataIndex: 'name', width: '100', align: 'center' },
+        { title: '门店类型', dataIndex: 'type', width: '100', align: 'center' },
+        { title: '负责人名称', dataIndex: 'managerId', width: '100', align: 'center' },
+        { title: '负责人手机', dataIndex: 'managerMobile', width: '100', align: 'center' },
+        { title: '启用状态', dataIndex: 'enableFlag', width: '100', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '265', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return findStoreList(Object.assign(parameter, this.queryParam)).then(res => {
+          console.log(res)
+          const no = (res.data.pageNo - 1) * res.data.pageSize
+          for (let i = 0; i < res.data.list.length; i++) {
+            const _item = res.data.list[i]
+            _item.no = no + i + 1
+          }
+          return res.data
+        })
+      },
+      openModal: false, //  新增/编辑 洗车机  弹框展示状态
+      pageType: '', //  新增/编辑 洗车机  页面类型
+      openEquipmentModal: false, //  查看详情 洗车机  弹框展示状态
+      addrProvinceList: [], //  省列表数据
+      addrCityList: [], //  市列表数据
+      isQrCodeModal: false, //  查看小程序码   弹框展示状态
+      qrCode: '', //  小程序码
+      storeId: '' //  网点id
+    }
+  },
+  mounted () {
+    const arr = [
+      { a: 1, b: 3 },
+      { a: 11, b: 331 },
+      { a: 111, b: 333 },
+      { a: 1111, b: 33 }
+    ]
+    const arrs = { a: { b: 1, c: 3 } }
+    arr.push({ a: arrs['a'].b, b: arrs['a'].c })
+    console.log(arr)
+  },
+  methods: {
+    //  编辑
+    edit (item) {
+      this.storeId = String(item.id)
+      this.openModal = true
+      this.openEquipmentModal = false
+    },
+    // 新增编辑  提交成功
+    carWashSubmit () {
+      this.$refs.table.refresh(true)
+      this.openModal = false
+    },
+    //  重置
+    reset () {
+      this.queryParam = {
+        name: '', //  门店名称
+        managerMobile: '', //  负责人手机
+        orgCode: '', //  组织机构
+        type: '', //  门店类型
+        enableFlag: '' //  启用状态
+      }
+      this.addrCityList = []
+      this.$refs.table.refresh(true)
+    },
+    // 新增、编辑 弹框关闭
+    closeModal () {
+      this.storeId = ''
+      this.openModal = false
+    },
+    // 详情 弹框关闭
+    closeDetailsModal () {
+      this.storeId = ''
+      this.openEquipmentModal = false
+    }
+  }
+}
+</script>
+
+<style lang="less">
+.StoreManagement {
+	.table-page-search-wrapper {
+		.search-btn {
+			margin-right: 10px;
+		}
+	}
+}
+</style>

+ 229 - 0
src/views/BasicSettings/StoreModal.vue

@@ -0,0 +1,229 @@
+<template>
+  <a-modal
+    class="StoreModal"
+    title="编辑"
+    :width="1000"
+    :footer="null"
+    :destroyOnClose="true"
+    @cancel="isShow = false"
+    v-model="isShow">
+    <!-- 表单 -->
+    <a-form-model
+      class="form"
+      ref="ruleForm"
+      :model="form"
+      :rules="rules"
+      :label-col="{ span: 6 }"
+      :wrapper-col="{ span: 18 }">
+      <a-row :gutter="20" v-if="storeInfo">
+        <a-col :span="8" class="item-w">
+          <div class="item-label">门店名称:</div>
+          <div class="item-cont">{{ storeInfo.name }}</div>
+        </a-col>
+        <a-col :span="8" class="item-w">
+          <div class="item-label">门店负责人:</div>
+          <div class="item-cont">{{ storeInfo.managerName }}</div>
+        </a-col>
+        <a-col :span="8" class="item-w">
+          <div class="item-label">负责人手机:</div>
+          <div class="item-cont">{{ storeInfo.managerMobile }}</div>
+        </a-col>
+        <a-col :span="24" class="item-w">
+          <div class="item-label">地址:</div>
+          <div class="item-cont">{{ storeInfo.addrProvinceName }} - {{ storeInfo.addrCityName }} - {{ storeInfo.addrDistrictName }} - {{ storeInfo.addrDetail }}</div>
+        </a-col>
+        <a-col :span="8" class="item-w">
+          <div class="item-label">纬度:</div>
+          <div class="item-cont">{{ storeInfo.lat }}</div>
+        </a-col>
+        <a-col :span="8" class="item-w">
+          <div class="item-label">经度:</div>
+          <div class="item-cont">{{ storeInfo.lng }}</div>
+        </a-col>
+        <a-col :span="8" class="item-w">
+          <div class="item-label">营业时间:</div>
+          <div class="item-cont">{{ storeInfo.beginTime }} - {{ storeInfo.endTime }}</div>
+        </a-col>
+        <a-col :span="8" class="item-w">
+          <div class="item-label">是否自营:</div>
+          <div class="item-cont">{{ storeInfo.selfFlag }}</div>
+        </a-col>
+        <a-col :span="8" class="item-w">
+          <div class="item-label">启用状态:</div>
+          <div class="item-cont">{{ storeInfo.isEnable }}</div>
+        </a-col>
+        <a-col :span="8">
+          <a-form-model-item class="form-label" label="组织归属" prop="orgCode" :label-col="{ span: 7 }" :wrapper-col="{ span: 17 }">
+            <a-tree-select
+              showSearch
+              v-model="form.orgCode"
+              allowClear
+              style="width: 100%"
+              :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+              :tree-data="treeData"
+              placeholder="请选择组织归属"
+              treeNodeFilterProp="title">
+            </a-tree-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="24">
+          <a-form-model-item class="btn-cont" :label-col="{ span: 0 }" :wrapper-col="{ span: 24 }">
+            <a-button type="primary" @click="onSubmit">保存</a-button>
+            <a-button class="cancel" @click="isShow = false">取消</a-button>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+    </a-form-model>
+  </a-modal>
+</template>
+
+<script>
+import { Tree } from '@/components'
+import { findStoreDetail, saveStoreOrg } from '@/api/store.js'
+import { findOrgTree } from '@/api/atorg.js'
+export default {
+  components: { Tree },
+  name: 'StoreModal',
+  props: {
+    openModal: {
+      //  弹框是否展示
+      type: Boolean,
+      default: false
+    },
+    storeId: {
+      //  门店id
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  弹框是否展示
+      form: { //  编辑
+        orgCode: null //  机构编码
+      },
+      rules: { //  表单校验规则
+        orgCode: [{ required: true, message: '请选择所属组织归属', trigger: 'change' }]
+      },
+      treeData: [],
+      storeInfo: null //  门店详情
+    }
+  },
+  methods: {
+    //  门店详情
+    getStoreInfo (id) {
+      findStoreDetail({ id: id }).then(res => {
+        console.log(res, '————————')
+        if (res.status == 200) {
+          this.storeInfo = res.data
+        }
+      })
+    },
+    //  获取组织机构  数据
+    getOrgList () {
+      findOrgTree().then(res => {
+        if (res.status == 200) {
+          this.treeData = this.recursionFun(res.data.list)
+        } else {
+          this.treeData = []
+        }
+      })
+    },
+    //  递归函数
+    recursionFun (data) {
+      data.map(item => {
+        if (item.children && item.children.length == 0) {
+          item.key = item.id ? 'org' + item.id : ''
+          item.value = item.id ? item.id : ''
+          item.title = item.name ? item.name : ''
+        } else {
+          item.key = item.id ? 'org' + item.id : ''
+          item.value = item.id ? item.id : ''
+          item.title = item.name ? item.name : ''
+          this.recursionFun(item.children)
+        }
+      })
+      return data
+    },
+    //  保存
+    onSubmit () {
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const formData = JSON.parse(JSON.stringify(_this.form))
+          formData.tenantId = this.storeId
+          console.log(formData)
+          // saveStoreOrg(formData).then(res => {
+          //   if (res.status == 200) {
+          //     _this.$message.success(res.message)
+          //     _this.$emit('success')
+          //   } else {
+          //     _this.$message.error(res.message)
+          //   }
+          // })
+        } else {
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+      } else {
+        // this.resetForm() //  重置表单数据
+        // this.getProvinceList() //  获取省下拉
+        // this.getItemQuery() //  服务类型  列表
+      }
+    },
+    storeId (newValue, oldValue) {
+      if (newValue && this.isShow) {
+        this.getOrgList()
+        this.getStoreInfo(newValue)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .StoreModal{
+    .form{
+      .item-w{
+        display: flex;
+        line-height: 24px;
+        padding: 8px 0;
+        margin-bottom: 24px;
+        .item-label{
+          flex-shrink: 0;
+          width: 90px;
+          text-align: right;
+          font-weight: bold;
+        }
+        .item-cont{
+          flex-grow: 1;
+        }
+      }
+      .btn-cont {
+        text-align: center;
+        .cancel {
+          margin-left: 40px;
+        }
+      }
+      .form-label{
+        .ant-form-item-label{
+          .ant-form-item-required{
+            font-weight: bold;
+            color: rgba(0, 0, 0, 0.65);
+          }
+        }
+      }
+    }
+  }
+</style>

+ 2 - 1
vue.config.js

@@ -110,7 +110,8 @@ const vueConfig = {
       '/api': {
         // target: 'http://carwash.test.zyucgj.com/cw-admin/',
         // target: 'http://192.168.16.102:8101/cw-admin/',
-        target: 'https://carwash.test.zyucgj.com/cw-admin/',
+        // target: 'https://carwash.test.zyucgj.com/cw-admin/',
+        target: 'http://192.168.16.107:7300/mock/5f5b0d9ecb0f492ad4ee85db/admin/at-admin/',
         ws: false,
         changeOrigin: true,
         pathRewrite: {