zhangdan před 4 roky
rodič
revize
c38218a778

+ 32 - 21
src/api/card-voucher-user.js

@@ -3,15 +3,22 @@ import { axios } from '@/utils/request'
 // 重置密码
 export const resetPSD = params => {
   return axios({
-    url: 'yyuser/resetPwd',
+    url: 'dduser/resetPwd',
     data: params,
     method: 'POST'
   })
 }
-
-// 获取列表数据
+// 启用禁用
+// export const updateEnableStatus = params => {
+//   return axios({
+//     url: `user/enable/${params.id}/${params.flag}`,
+//     data: {},
+//     method: 'get'
+//   })
+// }
+// 督导列表
 export const getPowerUserList = params => {
-  const url = `yyuser/queryLike/${params.pageNo}/${params.pageSize}`
+  const url = `dduser/queryLike/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -20,38 +27,42 @@ export const getPowerUserList = params => {
     method: 'POST'
   })
 }
-
-// 改变权限状态接口
-export const updateEnableStatus = params => {
+// 删除督导用户
+export const delectUserPower = params => {
   return axios({
-    url: `yyuser/enable/${params.id}/${params.flag}`,
+    url: `dduser/delete/${params.id}`,
     data: {},
     method: 'get'
   })
 }
-
-// 删除用户接口
-export const delectUserPower = params => {
+// 督导名下已选门店列表
+export const getRoleList = params => {
   return axios({
-    url: `yyuser/delete/${params.id}`,
-    data: {},
-    method: 'get'
+    url: 'dduser/queryUsedStoreList',
+    data: params,
+    method: 'POST'
   })
 }
-
-// 新增/编辑保存接口
+// 新增/编辑 保存用户
 export const saveUserPower = params => {
   return axios({
-    url: 'yyuser/save',
+    url: 'dduser/save',
     data: params,
     method: 'POST'
   })
 }
-
-// 获取角色列表接口
-export const getRoleList = params => {
+// 解绑 (督导已选门店)
+export const deleteUserStore = params => {
+  return axios({
+    url: 'dduser/deleteUserStore/{id}',
+    data: {},
+    method: 'get'
+  })
+}
+// 新增门店(督导巡店)
+export const saveNewUserStore = params => {
   return axios({
-    url: 'yyrole/findAll',
+    url: 'dduser/saveUserStore',
     data: params,
     method: 'POST'
   })

+ 198 - 0
src/views/CardVoucherAuth/user/allStoreModal.vue

@@ -0,0 +1,198 @@
+<template>
+  <div>
+    <a-modal v-model="isShow" @cancel="cancel" title="选择关联门店" width="60%" >
+      <a-row :gutter="24">
+        <a-form class="form-box" :form="form" @submit="handleSubmit">
+          <!-- <a-card> -->
+          <a-col :span="8">
+            <a-tree
+              v-model="checkedKeys"
+              checkable
+              :expanded-keys="expandedKeys"
+              :auto-expand-parent="autoExpandParent"
+              :selected-keys="selectedKeys"
+              :tree-data="treeData"
+              @expand="onExpand"
+              @select="onSelect"
+            />
+          </a-col>
+          <a-col span="1" class="divider">
+          </a-col>
+          <a-col :span="15">
+            <a-table :columns="columns" :data-source="data" bordered >
+              <template slot="title" slot-scope="currentPageData">
+                新增门店
+              </template>
+              <span slot="action" slot-scope="text, record">
+                <a-button type="primary" @click="delect(record)" size="small">解绑</a-button>
+              </span>
+            </a-table>
+          </a-col>
+          <!-- </a-card> -->
+          <a-form-item class="footer" :wrapper-col="{ span: 24, offset: 12 }">
+            <a-button type="primary" @click="handleSubmit()">
+              保存
+            </a-button>
+            <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+              取消
+            </a-button>
+          </a-form-item>
+        </a-form>
+      </a-row>
+    </a-modal>
+  </div>
+</template>
+
+<script>
+const treeData = [
+	  {
+	    title: '陕西区域',
+	    key: '0-0',
+	    children: [
+	      {
+	        title: '西安',
+	        key: '0-0-0',
+	        children: [
+	          { title: '东郊', key: '0-0-0-0', children: [{ title: '咸宁东路', key: '0-0-0-00' }] },
+	          { title: '西郊', key: '0-0-0-1', children: [{ title: '常青二路', key: '0-0-0-99' }] },
+	          { title: '南郊', key: '0-0-0-2', children: [{ title: '西部大道', key: '0-0-0-66' }] },
+			  { title: '北郊', key: '0-0-0-3' }
+	        ]
+	      },
+	      {
+	        title: '咸阳',
+	        key: '0-0-1',
+	        children: [
+	          { title: '东郊', key: '0-0-0-4' },
+	          { title: '西郊', key: '0-0-0-5' },
+	          { title: '南郊', key: '0-0-0-6' },
+	          { title: '北郊', key: '0-0-0-7' }
+	        ]
+	      },
+	      {
+	        title: '渭南',
+	        key: '0-0-2',
+        children: [
+			  { title: '东郊', key: '0-0-0-8' },
+			  { title: '西郊', key: '0-0-0-9' },
+			  { title: '南郊', key: '0-0-0-10' },
+			  { title: '北郊', key: '0-0-0-11' }
+        ]
+	      }
+	    ]
+	  },
+	  {
+	    title: '宁夏区域',
+	    key: '0-1',
+	    children: [
+	      { title: '0-1-0-0', key: '0-1-0-0' },
+	      { title: '0-1-0-1', key: '0-1-0-1' },
+	      { title: '0-1-0-2', key: '0-1-0-2' }
+	    ]
+	  },
+	  {
+	    title: '青海区域',
+	    key: '0-2'
+	  }
+]
+export default {
+  name: 'AllStoreModal',
+  props: {
+		  visible: {
+			  type: Boolean,
+			  default: false
+		 }
+  },
+  data () {
+    return {
+      isShow: this.visible,
+      expandedKeys: ['0-0-0', '0-0-1'],
+	        autoExpandParent: true,
+	        checkedKeys: ['0-0-0'],
+	        selectedKeys: [],
+	        treeData,
+      columns: [
+					  {
+					      title: '序号',
+					    dataIndex: 'no',
+					  minWidth: '100',
+					  align: 'center'
+					  },
+					  {
+					    title: '门店名称',
+					    dataIndex: 'storeName',
+					  minWidth: '100',
+					  align: 'center'
+					  },
+					  {
+					    title: '操作',
+					    key: '操作',
+					  minWidth: '100',
+					  align: 'center',
+					    scopedSlots: { customRender: 'action' }
+					  }
+      ],
+      data: [{
+					  storeName: '常青二路'
+      },
+      {
+					  storeName: '西部大道'
+      },
+      {
+					  storeName: '咸宁东路'
+      }]
+    }
+  },
+  methods: {
+	  cancel (e) {
+	    // this.clear()
+	    this.$emit('close')
+	  },
+	  onExpand (expandedKeys) {
+	        console.log('onExpand', expandedKeys)
+	        // if not set autoExpandParent to false, if children expanded, parent can not collapse.
+	        // or, you can remove all expanded children keys.
+	        this.expandedKeys = expandedKeys
+	        this.autoExpandParent = false
+	      },
+	      onCheck (checkedKeys) {
+	        console.log('onCheck', checkedKeys)
+	        this.checkedKeys = checkedKeys
+	      },
+	      onSelect (selectedKeys, info) {
+	        console.log('onSelect', info)
+	        this.selectedKeys = selectedKeys
+	      },
+		  // 保存
+		  handleSubmit () {
+    },
+    // 取消
+    handleCancel () {
+		  const _this = this
+		  this.$confirm({
+		    title: '提示',
+		    content: '确定取消吗?',
+		    okText: '确定',
+		    cancelText: '取消',
+		    onOk () {
+		      // _this.clear()
+		      _this.cancel()
+		    }
+		  })
+    }
+  },
+  watch: {
+    visible (newValue, oldValue) {
+	  this.isShow = newValue
+    },
+    isShow (newValue, oldValue) {
+    },
+    checkedKeys (val) {
+	      console.log('onCheck', val)
+	    }
+  }
+}
+</script>
+
+<style scoped>
+</style>

+ 120 - 0
src/views/CardVoucherAuth/user/storeModal.vue

@@ -0,0 +1,120 @@
+<template>
+  <div>
+    <a-modal v-model="isShow" @cancel="cancel" title="点检关联门店" width="45%">
+      <!-- 新增点检门店按钮 -->
+      <a-button type="primary" icon="plus" @click="openModal" style="margin-bottom: 20px;">新增门店</a-button>
+      <!-- 列表 -->
+      <a-table :columns="columns" :data-source="data" bordered>
+        <template slot="title" slot-scope="currentPageData">
+          已选门店
+        </template>
+        <span slot="action" slot-scope="text, record">
+          <a-button type="primary" @click="delect(record)" size="small">解绑</a-button>
+        </span>
+      </a-table>
+    </a-modal>
+    <!-- 新增点检门店弹窗 -->
+    <allStoreModal :visible="showAllStoreModal" :storeData="storeData" @close="showAllStoreModal=false"></allStoreModal>
+  </div>
+
+</template>
+
+<script>
+import { STable } from '@/components'
+import allStoreModal from './allStoreModal.vue'
+export default {
+  name: 'StoreModal',
+  components: {
+    STable,
+    allStoreModal
+  },
+  props: {
+		  visible: {
+			  type: Boolean,
+			  default: false
+		 }
+  },
+  data () {
+    return {
+      isShow: this.visible,
+	  showAllStoreModal: false,
+      storeData: [],
+	  columns: [
+	    {
+          title: '序号',
+	      dataIndex: 'no',
+		  minWidth: '100',
+		  align: 'center'
+	    },
+	    {
+	      title: '门店名称',
+	      dataIndex: 'storeName',
+		  minWidth: '100',
+		  align: 'center'
+	    },
+	    {
+	      title: '操作',
+	      key: '操作',
+		  minWidth: '100',
+		  align: 'center',
+	      scopedSlots: { customRender: 'action' }
+	    }
+	  ],
+	  data: [{
+	    storeName: '常青二路'
+	  },
+	  {
+	    storeName: '西部大道'
+	  },
+	  {
+	    storeName: '咸宁东路'
+	  }]
+    }
+  },
+  methods: {
+	  cancel (e) {
+	    // this.clear()
+	    this.$emit('close')
+	  },
+	  // 新增点检门店
+	  openModal () {
+		 this.showAllStoreModal = true
+	  },
+	  // 解绑门店
+	 delect (row) {
+	   const _this = this
+	   this.$confirm({
+	     title: '警告',
+	     content: '删除后无法恢复,确认删除?',
+	     okText: '确定',
+	     cancelText: '取消'
+	     // onOk () {
+	     //   delectUserPower({
+	     //     id: row.id
+	     //   }).then(res => {
+	     //     if (res.status == 200) {
+	     //       _this.$message.success('删除成功')
+	     //       _this.$refs.table.refresh()
+	     //     } else {
+	     //       _this.$message.error(res.message)
+	     //     }
+	     //   }).catch(() => {
+	     //     _this.$message.success('删除失败, 请稍后重试')
+	     //   })
+	     // }
+	   })
+	 }
+  },
+  watch: {
+    visible (newValue, oldValue) {
+	  this.isShow = newValue
+    },
+    isShow (newValue, oldValue) {
+    }
+  }
+}
+</script>
+
+<style>
+
+</style>

+ 194 - 124
src/views/CardVoucherAuth/user/userList.vue

@@ -4,13 +4,13 @@
       <a-form layout="inline">
         <a-row :gutter="48">
           <a-col :md="6" :sm="24">
-            <a-form-item label="用户名称">
-              <a-input allowClear v-model.trim="queryParam.name" @pressEnter="$refs.table.refresh(true)" placeholder="请输入用户名称"/>
+            <a-form-item label="员工姓名">
+              <a-input allowClear v-model.trim="queryParam.name" @pressEnter="$refs.table.refresh(true)" placeholder="请输入员工姓名" />
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="手机号码">
-              <a-input allowClear v-model.trim="queryParam.phone" @pressEnter="$refs.table.refresh(true)" placeholder="请输入手机号码"/>
+              <a-input allowClear v-model.trim="queryParam.phone" @pressEnter="$refs.table.refresh(true)" placeholder="请输入手机号码" />
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
@@ -25,20 +25,19 @@
         </a-row>
       </a-form>
     </div>
-    <a-divider/>
+    <a-divider />
     <div class="table-operator">
       <a-button type="primary" icon="plus" @click="openModal">新建</a-button>
     </div>
-    <s-table
+    <!-- <s-table
       ref="table"
       size="default"
       rowKey="id"
       :columns="columns"
       :data="loadData"
-      bordered
-    >
+      bordered>
       <span slot="status" slot-scope="text, record">
-        <a-switch checkedChildren="" unCheckedChildren="" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
+        <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)" />
       </span>
       <div slot="roleNames" slot-scope="text, record" :title="record.roleNames">
         <span v-if="record.roleNames">{{ record.roleNames.substr(0,12) + '...' }}</span>
@@ -46,26 +45,70 @@
       </div>
       <span slot="action" slot-scope="text, record">
         <template>
-          <div >
+          <div>
             <a class="action-button" @click="handleEdit(record)">修改</a>
             <a v-if="record.loginFlag" class="action-button reset-text" @click="resetPassword(record)">重置密码</a>
             <a v-if="!record.loginFlag" class="action-button red-text" @click="delect(record)">删除</a>
           </div>
         </template>
       </span>
-    </s-table>
+    </s-table> -->
+    <a-table :columns="columns" :data-source="data" bordered>
+      <span slot="action" slot-scope="text, record">
+        <!-- 点检关联门店 -->
+        <a-tooltip placement="bottom">
+          <template slot="title">
+            <span>编辑</span>
+          </template>
+          <a-icon type="edit" style="font-size: 20px;color: #1890FF;padding: 0 10px;" @click="handleEdit(record)" />
+        </a-tooltip>
+        <a-tooltip placement="bottom">
+          <template slot="title">
+            <span>关联点检门店</span>
+          </template>
+          <a-icon type="apartment" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="selectStore(record)" />
+        </a-tooltip>
+        <a-tooltip placement="bottom">
+          <template slot="title">
+            <span>重置密码</span>
+          </template>
+          <a-icon type="unlock" style="font-size: 20px;color: #08c0de;padding: 0 10px;"/>
+        </a-tooltip>
+        <a-tooltip placement="bottom">
+          <template slot="title">
+            <span>删除</span>
+          </template>
+          <a-icon type="delete" style="font-size: 20px;color: red;padding: 0 10px;" @click="delect(record)" />
+        </a-tooltip>
+      </span>
+    </a-table>
+    <!-- 新增用户弹窗 -->
     <userModal :visible="showModal" @refresh="$refs.table.refresh(true)" :data="itemData" @close="showModal = false"></userModal>
+    <!-- 点检门店弹窗 -->
+    <storeModal :visible="showStoreModal" @close="showStoreModal=false"></storeModal>
   </a-card>
 </template>
 
 <script>
-import { STable, VSelect } from '@/components'
+import {
+  STable,
+  VSelect
+} from '@/components'
 import userModal from './userModal.vue'
-import { resetPSD, updateEnableStatus, getPowerUserList, delectUserPower } from '@/api/card-voucher-user.js'
+import storeModal from './storeModal.vue'
+// import {
+//   resetPSD,
+//   // updateEnableStatus,
+//   getPowerUserList,
+//   delectUserPower
+// } from '@/api/card-voucher-user.js'
 export default {
   name: 'UserList',
   components: {
-    STable, VSelect, userModal
+    STable,
+    VSelect,
+    userModal,
+    storeModal
   },
   data () {
     return {
@@ -76,72 +119,89 @@ export default {
         loginFlag: ''
       },
       showModal: false,
+	  showStoreModal: false,
       itemData: {}, // 编辑行数据
-      // 表头
-      columns: [
-        {
+	  columns: [
+	    {
           title: '序号',
-          dataIndex: 'no',
-          width: '40',
-          align: 'center'
-        },
-        {
-          title: '用户名称',
-          dataIndex: 'name',
-          width: '100',
-          align: 'center'
-        },
-        {
-          title: '手机号码',
-          dataIndex: 'phone',
-          width: '100',
-          align: 'center'
-        },
+	      dataIndex: 'no',
+		  minWidth: '100',
+		  align: 'center'
+	    },
+	    {
+	      title: '创建时间',
+	      dataIndex: 'createDate',
+		  minWidth: '100',
+		  align: 'center'
+	    },
+	    {
+	      title: '员工姓名',
+	      dataIndex: 'name',
+		  minWidth: '100',
+		  align: 'center'
+	    },
+	    {
+	      title: '手机号码',
+	      dataIndex: 'phone',
+		  minWidth: '100',
+		  align: 'center'
+	    },
         {
-          title: '角色',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'roleNames' }
+		  title: '角色',
+		  dataIndex: 'userType',
+		  minWidth: '100',
+		  align: 'center'
         },
         {
-          title: '状态',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'status' }
+		  title: '启用状态',
+		  dataIndex: 'status',
+		  minWidth: '100',
+		  align: 'center'
         },
-        {
-          title: '创建时间',
-          dataIndex: 'createDate',
-          width: '120',
-          align: 'center'
-        },
-        {
-          title: '操作',
-          width: '100',
-          align: 'center',
-          scopedSlots: { customRender: 'action' }
-        }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        return getPowerUserList(Object.assign(parameter, this.queryParam)).then(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
-            _item.loginFlag = _item.loginFlag + '' === '1'
-          }
-          return res.data
-        })
+	    {
+	      title: '操作',
+	      dataIndex: 'action',
+		  minWidth: '100',
+		  align: 'center',
+	      scopedSlots: { customRender: 'action' }
+	    }
+	  ],
+	  data: [{
+        key: '1',
+        name: 'John Brown',
+        age: 32,
+        address: 'New York No. 1 Lake Park',
+        tags: ['nice', 'developer']
+      },
+      {
+        key: '2',
+        name: 'Jim Green',
+        age: 42,
+        address: 'London No. 1 Lake Park',
+        tags: ['loser']
       },
-      optionAlertShow: false
+      {
+        key: '3',
+        name: 'Joe Black',
+        age: 32,
+        address: 'Sidney No. 1 Lake Park',
+        tags: ['cool', 'teacher']
+      }],
+      // 加载数据方法 必须为 Promise 对象
+      // loadData: parameter => {
+      //   return getPowerUserList(Object.assign(parameter, this.queryParam)).then(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
+      //   //     _item.loginFlag = _item.loginFlag + '' === '1'
+      //   //   }
+      //     return res.data
+      //   })
+      // },
+      // optionAlertShow: false
     }
   },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      // vm.$refs.table.refresh()
-    })
-  },
   methods: {
     // 刷新列表
     refreshTable () {
@@ -161,19 +221,24 @@ export default {
       this.showModal = true
       this.itemData = {}
     },
+    // 选择点检门店
+    selectStore (row) {
+      this.showStoreModal = true
+      console.log('wobeidianjile')
+    },
     // 重置密码
     resetPassword (row) {
-      resetPSD({
-        id: row.id
-      }).then(res => {
-        if (res.status == 200) {
-          this.$message.success('密码重置成功')
-        } else {
-          this.$message.error(res.message)
-        }
-      }).catch(() => {
-        this.$message.success('密码重置失败, 请稍后重试')
-      })
+      // resetPSD({
+      //   id: row.id
+      // }).then(res => {
+      //   if (res.status == 200) {
+      //     this.$message.success('密码重置成功')
+      //   } else {
+      //     this.$message.error(res.message)
+      //   }
+      // }).catch(() => {
+      //   this.$message.success('密码重置失败, 请稍后重试')
+      // })
     },
     // 删除
     delect (row) {
@@ -184,18 +249,18 @@ export default {
         okText: '确定',
         cancelText: '取消',
         onOk () {
-          delectUserPower({
-            id: row.id
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success('删除成功')
-              _this.$refs.table.refresh()
-            } else {
-              _this.$message.error(res.message)
-            }
-          }).catch(() => {
-            _this.$message.success('删除失败, 请稍后重试')
-          })
+        //   delectUserPower({
+        //     id: row.id
+        //   }).then(res => {
+        //     if (res.status == 200) {
+        //       _this.$message.success('删除成功')
+        //       _this.$refs.table.refresh()
+        //     } else {
+        //       _this.$message.error(res.message)
+        //     }
+        //   }).catch(() => {
+        //     _this.$message.success('删除失败, 请稍后重试')
+        //   })
         }
       })
     },
@@ -206,6 +271,7 @@ export default {
       })
       return str.join(',')
     },
+    // 编辑
     handleEdit (row) {
       this.showModal = true
       this.itemData = row
@@ -216,40 +282,44 @@ export default {
         id: record.id,
         flag: record.loginFlag ? '1' : '0'
       }
-      updateEnableStatus(_data).then(res => {
-        if (res.status + '' === '200') {
-          this.$message.success('修改成功')
-        } else {
-          this.$message.error(res.message)
-          record.loginFlag = !record.loginFlag
-        }
-      })
+      // updateEnableStatus(_data).then(res => {
+      //   if (res.status + '' === '200') {
+      //     this.$message.success('修改成功')
+      //   } else {
+      //     this.$message.error(res.message)
+      //     record.loginFlag = !record.loginFlag
+      //   }
+      // })
     }
   }
 }
 </script>
 <style scoped>
-  .table-page-search-wrapper .ant-form-inline .ant-form-item{
-    margin-bottom: 0;
-  }
-  .flex-sp{
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-  }
-  .action-button{
-   line-height: 40px;
-   white-space: nowrap;
-    padding: 5px 10px;
-    background-color: #1890ff;
-    border-radius: 4px;
-    color: #fff;
-    margin-right: 5px;
-  }
-  .red-text{
-    background-color: red;
-  }
-  .reset-text {
-    background-color: #31b50b;
-  }
+	.table-page-search-wrapper .ant-form-inline .ant-form-item {
+		margin-bottom: 0;
+	}
+
+	.flex-sp {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+	}
+
+	.action-button {
+		line-height: 40px;
+		white-space: nowrap;
+		padding: 5px 10px;
+		background-color: #1890ff;
+		border-radius: 4px;
+		color: #fff;
+		margin-right: 5px;
+	}
+
+	.red-text {
+		background-color: red;
+	}
+
+	.reset-text {
+		background-color: #31b50b;
+	}
 </style>

+ 110 - 47
src/views/CardVoucherAuth/user/userModal.vue

@@ -1,17 +1,16 @@
 <template>
   <div>
-    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel">
+    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel" width="35%">
       <a-form :form="form" @submit="handleSubmit">
         <a-row :gutter="24">
           <a-col :span="12">
             <!-- 用户名称 -->
-            <a-form-item label="用户名称" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+            <a-form-item label="员工姓名" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
               <a-input
-                placeholder="请输入用户名称"
+                placeholder="请输入员工姓名"
                 v-decorator="['formData.name', {
                   initialValue: formData.name,
-                  rules: [{ required: true, message: '请输入用户名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-              />
+                  rules: [{ required: true, message: '请输入员工姓名!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]" />
             </a-form-item>
           </a-col>
           <a-col :span="12">
@@ -21,8 +20,7 @@
                 placeholder="请输入手机号码"
                 v-decorator="['formData.phone', {
                   initialValue: formData.phone,
-                  rules: [{ required: true, message: '请输入手机号码!' },{pattern:/^[1][0-9]{10}$/, message: '请输入正确的手机号码!'}] }]"
-              />
+                  rules: [{ required: true, message: '请输入手机号码!' },{pattern:/^[1][0-9]{10}$/, message: '请输入正确的手机号码!'}] }]" />
             </a-form-item>
           </a-col>
         </a-row>
@@ -38,7 +36,7 @@
                     initialValue: formData.sex,
                     rules: [{ required: true, message: '请选择性别!' }] },
                 ]"
-                allowClear ></v-select>
+                allowClear></v-select>
 
             </a-form-item>
           </a-col>
@@ -52,8 +50,7 @@
                   {
                     initialValue: formData.loginFlag,
                     rules: [{ required: true, message: '请选择状态!' }] },
-                ]"
-              >
+                ]">
                 <a-radio :value="1">是</a-radio>
                 <a-radio :value="0">否</a-radio>
               </a-radio-group>
@@ -61,7 +58,7 @@
             </a-form-item>
           </a-col>
         </a-row>
-        <a-row :gutter="24">
+        <!-- <a-row :gutter="24">
           <a-col :span="24">
             <a-form-item label="角色" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
               <a-select
@@ -73,39 +70,48 @@
                 ]"
                 mode="multiple"
                 style="width: 100%"
-                placeholder="请选择角色"
-              >
-                <a-select-option
-                  v-for="item in roleList"
-                  :key="item.id"
-                  :disabled="item.isEnable == '0' ? true : false"
-                >{{ item.name }}</a-select-option
-                >
+                placeholder="请选择角色">
+                <a-select-option v-for="item in roleList" :key="item.id" :disabled="item.isEnable == '0' ? true : false">{{ item.name }}</a-select-option>
               </a-select>
             </a-form-item>
           </a-col>
-        </a-row>
+        </a-row> -->
         <a-row :gutter="24">
           <a-col :span="24">
-            <a-form-item label="备注" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
-              <a-textarea
+            <a-form-item label="所属机构" :label-col="{ span:4 }" :wrapper-col="{ span: 20 }">
+              <!-- <a-select
                 v-decorator="[
-                  'formData.remarks',
+                  'formData.roleNames',
                   {
-                    initialValue: formData.remarks,
-                    rules: [] },
+                    initialValue: formData.roleNames,
+                    rules: [{ required: true, message: '请选择所属机构!' }] },
                 ]"
-                style="min-height: 50px;"
-                placeholder=""
-                autosize />
+                style="width: 100%"
+                placeholder="请选择所属机构"
+              >
+                <a-select-option
+                  v-for="item in roleList"
+                  :key="item.id"
+                  :disabled="item.isEnable == '0' ? true : false"
+                >{{ item.name }}</a-select-option
+                >
+              </a-select>-->
+              <a-tree-select
+                v-model="value"
+                style="width: 100%"
+                :tree-data="treeData"
+                tree-checkable
+                :show-checked-strategy="SHOW_ALL"
+                search-placeholder="Please select"
+              />
             </a-form-item>
           </a-col>
         </a-row>
-        <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
+        <a-form-item :wrapper-col="{ span: 12, offset: 5 }" style="text-align: center;">
           <a-button type="primary" @click="handleSubmit()">
             保存
           </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+          <a-button :style="{ marginLeft: '50px' }" @click="handleCancel()">
             取消
           </a-button>
         </a-form-item>
@@ -115,12 +121,58 @@
 </template>
 
 <script>
-import { STable, VSelect } from '@/components'
-import { getRoleList, saveUserPower } from '@/api/card-voucher-user.js'
+import {
+  STable,
+  VSelect
+} from '@/components'
+import {
+  getRoleList,
+  saveUserPower
+} from '@/api/card-voucher-user.js'
+import { TreeSelect } from 'ant-design-vue'
+const SHOW_ALL = TreeSelect.SHOW_ALL
+const treeData = [
+  {
+    title: 'Node1',
+    value: '0-0',
+    key: '0-0',
+    children: [
+      {
+        title: 'Child Node1',
+        value: '0-0-0',
+        key: '0-0-0'
+      }
+    ]
+  },
+  {
+    title: 'Node2',
+    value: '0-1',
+    key: '0-1',
+    children: [
+      {
+        title: 'Child Node3',
+        value: '0-1-0',
+        key: '0-1-0',
+        disabled: true
+      },
+      {
+        title: 'Child Node4',
+        value: '0-1-1',
+        key: '0-1-1'
+      },
+      {
+        title: 'Child Node5',
+        value: '0-1-2',
+        key: '0-1-2'
+      }
+    ]
+  }
+]
 export default {
   name: 'UserModal',
   components: {
-    STable, VSelect
+    STable,
+    VSelect
   },
   props: {
     visible: {
@@ -139,7 +191,9 @@ export default {
       titleText: '添加用户',
       isshow: this.visible,
       formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'miniForm' }),
+      form: this.$form.createForm(this, {
+        name: 'miniForm'
+      }),
       roleList: [],
       formData: {
         roleNames: undefined, // 角色
@@ -148,10 +202,15 @@ export default {
         phone: '',
         sex: '',
         remarks: ''
-      }
+      },
+	  value: ['0-0-0'],
+	  treeData,
+      SHOW_ALL
+
     }
   },
   methods: {
+
     cancel (e) {
       this.clear()
       this.$emit('close')
@@ -161,8 +220,10 @@ export default {
       const _this = this
       this.form.validateFields((err, values) => {
         if (!err) {
-          values.formData.roleNames = values.formData.roleNames.join(',')
-          saveUserPower(Object.assign({ id: this.data.id ? this.data.id : '' }, values.formData)).then(res => {
+          // values.formData.roleNames = values.formData.roleNames.join(',')
+          saveUserPower(Object.assign({
+            id: this.data.id ? this.data.id : ''
+          }, values.formData)).then(res => {
             if (res.status == 200) {
               this.$message.success(res.message ? res.message : '保存成功')
               this.$emit('refresh')
@@ -211,11 +272,13 @@ export default {
       })
     }
   },
-  mounted () {
-    this.getRoleList()
-  },
+  // mounted () {
+  //   this.getRoleList()
+  // },
   beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'miniForm' })
+    this.form = this.$form.createForm(this, {
+      name: 'miniForm'
+    })
   },
   watch: {
     visible (newValue, oldValue) {
@@ -256,10 +319,10 @@ export default {
 }
 </script>
 
-<style >
-  .modalBox{
-  }
-  .ant-modal-footer {
-    display: none;
-  }
+<style>
+	.modalBox {}
+
+	.ant-modal-footer {
+		display: none;
+	}
 </style>