ソースを参照

Merge branch 'develop' of http://git.chelingzhu.com/chelingzhu-web/storeCheck-admin-html into develop

lilei 4 年 前
コミット
4c221e2bb9

+ 2 - 2
src/views/SupervisionAuth/role/menuModal.vue

@@ -13,10 +13,10 @@
         />
       </a-form>
       <a-form-item :wrapper-col="{ offset: 15 }">
-        <a-button type="primary" @click="handleSubmit()">
+        <a-button type="primary" @click="handleSubmit()" id="menuModal-handleSubmit">
           保存
         </a-button>
-        <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+        <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()" id="menuModal-handleCancel">
           取消
         </a-button>
       </a-form-item>

+ 9 - 9
src/views/SupervisionAuth/role/roleList.vue

@@ -5,24 +5,24 @@
         <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-input allowClear v-model.trim="queryParam.name" @pressEnter="$refs.table.refresh(true)" id="roleList-name" placeholder="请输入角色名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="状态">
-              <v-select code="ENABLE_FLAG" v-model="queryParam.isEnable" allowClear placeholder="请选择状态" ></v-select>
+              <v-select code="ENABLE_FLAG" v-model="queryParam.isEnable" id="roleList-isEnable" allowClear placeholder="请选择状态" ></v-select>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;">查询</a-button>
-            <a-button @click="reset">重置</a-button>
+            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;" id="roleList-handSubmit">查询</a-button>
+            <a-button @click="reset" id="roleList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
     <a-divider/>
     <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_supervision_role_add'">新建</a-button>
+      <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_supervision_role_add'" id="roleList-openModal">新建</a-button>
     </div>
 
     <s-table
@@ -34,12 +34,12 @@
       bordered
     >
       <span slot="status" slot-scope="text, record">
-        <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.isEnable" @change="changeFlagHandle(text, record)" v-hasPermission="'B_power_role_del'"/>
+        <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.isEnable" @change="changeFlagHandle(text, record)" v-hasPermission="'B_power_role_del'" id="roleList-changeFlagHandle"/>
       </span>
       <span slot="action" slot-scope="text, record">
-        <a class="action-button menu-text" @click="openMenuModal(record)" v-hasPermission="'M_power_role_menu'">菜单权限</a>
-        <a class="action-button" @click="handleEdit(record)" v-hasPermission="'B_supervision_role_edit'">修改</a>
-        <a v-if="!record.isEnable" class="action-button red-text" @click="delect(record)" v-hasPermission="'B_supervision_role_del'">删除</a>
+        <a class="action-button menu-text" @click="openMenuModal(record)" v-hasPermission="'M_power_role_menu'" id="roleList-openMenuModal">菜单权限</a>
+        <a class="action-button" @click="handleEdit(record)" v-hasPermission="'B_supervision_role_edit'" id="roleList-handleEdit">修改</a>
+        <a v-if="!record.isEnable" class="action-button red-text" @click="delect(record)" v-hasPermission="'B_supervision_role_del'" id="roleList-delect">删除</a>
       </span>
     </s-table>
     <!-- 新增、编辑角色弹窗 -->

+ 5 - 2
src/views/SupervisionAuth/role/roleModal.vue

@@ -6,6 +6,7 @@
         <a-form-item label="角色名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
           <a-input
             placeholder="请输入角色名称30个字以内"
+						id="roleModal-name"
             :maxLength="30"
             v-decorator="['formData.name', {
               initialValue: formData.name,
@@ -16,6 +17,7 @@
         <a-form-item label="状态" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
           <a-radio-group
             name="radioGroup"
+						id="roleModal-isEnable"
             v-decorator="[
               'formData.isEnable',
               {
@@ -30,6 +32,7 @@
 
         <a-form-item label="角色描述" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
           <a-textarea
+					id="roleModal-remarks"
             v-decorator="[
               'formData.remarks',
               { initialValue: formData.remarks,
@@ -42,10 +45,10 @@
         </a-form-item>
 
         <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-          <a-button type="primary" @click="handleSubmit()">
+          <a-button type="primary" @click="handleSubmit()" id="roleModal-handleSubmit">
             保存
           </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()" id="roleModal-handleCancel">
             取消
           </a-button>
         </a-form-item>

+ 2 - 2
src/views/SupervisionAuth/user/newStoreModal.vue

@@ -18,8 +18,8 @@
               选择门店
             </template>
             <span slot="action" slot-scope="text, record">
-              <a-button type="danger" v-if="record.usedFlag == 1" @click="delect(record)" size="small">解绑</a-button>
-              <a-button type="primary" v-if="record.usedFlag == 0" @click="handleSubmit(record)" size="small">绑定</a-button>
+              <a-button type="danger" v-if="record.usedFlag == 1" @click="delect(record)" size="small" id="newStoreModal-delect">解绑</a-button>
+              <a-button type="primary" v-if="record.usedFlag == 0" @click="handleSubmit(record)" size="small" id="newStoreModal-handleSubmit">绑定</a-button>
             </span>
           </a-table>
         </a-col>

+ 2 - 2
src/views/SupervisionAuth/user/usedStoreModal.vue

@@ -2,14 +2,14 @@
   <div>
     <a-modal v-model="isShow" @cancel="cancel" title="点检关联门店" width="45%" :footer="null">
       <!-- 新增点检门店按钮 -->
-      <a-button type="primary" icon="plus" @click="openModal" style="margin-bottom: 20px;">新增门店</a-button>
+      <a-button type="primary" icon="plus" @click="openModal" style="margin-bottom: 20px;" id="usedStoreModal-openModal">新增门店</a-button>
       <!-- 列表 -->
       <a-table :columns="columns" :data-source="loadData" :pagination="false" bordered>
         <template slot="title">
           已选门店
         </template>
         <span slot="action" slot-scope="text, record">
-          <a-button type="primary" @click="delect(record)" size="small">解绑</a-button>
+          <a-button type="primary" @click="delect(record)" size="small" id="usedStoreModal-delect">解绑</a-button>
         </span>
       </a-table>
     </a-modal>

+ 3 - 3
src/views/SupervisionAuth/user/userList.vue

@@ -29,15 +29,15 @@
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;">查询</a-button>
-            <a-button @click="reset">重置</a-button>
+            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;" id="userList-handSubmit">查询</a-button>
+            <a-button @click="reset" id="userList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
     <a-divider />
     <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_supervision_user_add'">新建</a-button>
+      <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_supervision_user_add'" id="userList-openModal">新建</a-button>
     </div>
     <s-table
       :columns="columns"

+ 2 - 2
src/views/SupervisionAuth/user/userModal.vue

@@ -115,10 +115,10 @@
           </a-col>
         </a-row>
         <a-form-item :wrapper-col="{ span: 12, offset: 5 }" style="text-align: center;">
-          <a-button type="primary" @click="handleSubmit()">
+          <a-button type="primary" @click="handleSubmit()" id="userModal-handleSubmit">
             保存
           </a-button>
-          <a-button :style="{ marginLeft: '50px' }" @click="handleCancel()">
+          <a-button :style="{ marginLeft: '50px' }" @click="handleCancel()" id="userModal-handleCancel">
             取消
           </a-button>
         </a-form-item>

+ 2 - 2
src/views/power/role/menuModal.vue

@@ -15,10 +15,10 @@
 
       </a-form>
       <a-form-item :wrapper-col="{ offset: 15 }">
-        <a-button type="primary" @click="handleSubmit()">
+        <a-button type="primary" @click="handleSubmit()" id="menuModal-handleSubmit">
           保存
         </a-button>
-        <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+        <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()" id="menuModal-handleCancel">
           取消
         </a-button>
       </a-form-item>

+ 9 - 9
src/views/power/role/roleList.vue

@@ -5,24 +5,24 @@
         <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-input allowClear v-model.trim="queryParam.name" @pressEnter="$refs.table.refresh(true)" id="roleList-name" placeholder="请输入角色名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="状态">
-              <v-select code="ENABLE_FLAG" v-model="queryParam.isEnable" @pressEnter="$refs.table.refresh(true)" allowClear placeholder="请选择状态" ></v-select>
+              <v-select code="ENABLE_FLAG" v-model="queryParam.isEnable" id="roleList-isEnable" @pressEnter="$refs.table.refresh(true)" allowClear placeholder="请选择状态" ></v-select>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;">查询</a-button>
-            <a-button @click="reset">重置</a-button>
+            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;" id="roleList-handSubmit">查询</a-button>
+            <a-button @click="reset" id="roleList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
     <a-divider/>
     <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_power_role_add'">新建</a-button>
+      <a-button type="primary" icon="plus" @click="openModal" id="roleList-openModal" v-hasPermission="'B_power_role_add'">新建</a-button>
     </div>
 
     <s-table
@@ -34,14 +34,14 @@
       bordered
     >
       <span slot="status" slot-scope="text, record">
-        <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.isEnable" @change="changeFlagHandle(text, record)" v-hasPermission="'B_power_role_enable'"/>
+        <a-switch checkedChildren="启用" unCheckedChildren="禁用" id="roleList-changeFlagHandle" v-model="record.isEnable" @change="changeFlagHandle(text, record)" v-hasPermission="'B_power_role_enable'"/>
       </span>
 
       <span slot="action" slot-scope="text, record">
         <template>
-          <a class="action-button menu-text" @click="openMenuModal(record)" v-hasPermission="'M_power_role_menu'">菜单权限</a>
-          <a class="action-button" @click="handleEdit(record)" v-hasPermission="'B_power_role_edit'">修改</a>
-          <a v-if="!record.isEnable" class="action-button red-text" @click="delect(record)" v-hasPermission="'B_power_role_del'">删除</a>
+          <a class="action-button menu-text" @click="openMenuModal(record)" id="roleList-openMenuModal" v-hasPermission="'M_power_role_menu'">菜单权限</a>
+          <a class="action-button" @click="handleEdit(record)" id="roleList-handleEdit" v-hasPermission="'B_power_role_edit'">修改</a>
+          <a v-if="!record.isEnable" class="action-button red-text" id="roleList-delect"  @click="delect(record)" v-hasPermission="'B_power_role_del'">删除</a>
         </template>
       </span>
     </s-table>

+ 5 - 2
src/views/power/role/roleModal.vue

@@ -6,6 +6,7 @@
         <a-form-item label="角色名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
           <a-input
             placeholder="请输入角色名称30个字以内"
+						id="roleModal-name"
             :maxLength="30"
             v-decorator="['formData.name', {
               initialValue: formData.name,
@@ -16,6 +17,7 @@
         <a-form-item label="状态" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
           <a-radio-group
             name="radioGroup"
+						id="roleModal-isEnable"
             v-decorator="[
               'formData.isEnable',
               {
@@ -29,6 +31,7 @@
         </a-form-item>
         <a-form-item label="角色描述" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
           <a-textarea
+					id="roleModal-remarks"
             v-decorator="[
               'formData.remarks',
               { initialValue: formData.remarks,
@@ -41,10 +44,10 @@
         </a-form-item>
 
         <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-          <a-button type="primary" @click="handleSubmit()">
+          <a-button type="primary" @click="handleSubmit()" id="roleModal-handleSubmit">
             保存
           </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
+          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()" id="roleModal-handleCancel">
             取消
           </a-button>
         </a-form-item>

+ 6 - 6
src/views/power/user/userList.vue

@@ -5,29 +5,29 @@
         <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-input allowClear v-model.trim="queryParam.name" @pressEnter="$refs.table.refresh(true)" placeholder="请输入用户名称" id="userList-name"/>
             </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="请输入手机号码" id="userList-phone"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="状态">
-              <v-select code="ENABLE_FLAG" v-model="queryParam.loginFlag" @pressEnter="$refs.table.refresh(true)" allowClear placeholder="请选择状态"></v-select>
+              <v-select code="ENABLE_FLAG" v-model="queryParam.loginFlag" @pressEnter="$refs.table.refresh(true)" allowClear placeholder="请选择状态" id="userList-engble-flag"></v-select>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;">查询</a-button>
-            <a-button @click="reset">重置</a-button>
+            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin-right: 10px;" id="userList-handSubmit">查询</a-button>
+            <a-button @click="reset" id="userList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
     </div>
     <a-divider/>
     <div class="table-operator">
-      <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_power_user_add'">新建</a-button>
+      <a-button type="primary" icon="plus" @click="openModal" v-hasPermission="'B_power_user_add'" id="userList-openModal">新建</a-button>
     </div>
     <s-table
       ref="table"

+ 222 - 232
src/views/power/user/userModal.vue

@@ -1,262 +1,252 @@
 <template>
-  <div>
-    <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel">
-      <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-input
-                placeholder="请输入用户名称"
-                v-decorator="['formData.name', {
+	<div>
+		<a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel">
+			<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-input placeholder="请输入用户名称" id="userModal-name" v-decorator="['formData.name', {
                   initialValue: formData.name,
-                  rules: [{ required: true, message: '请输入用户名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]"
-              />
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <!-- 手机号码 -->
-            <a-form-item label="手机号码" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
-              <a-input
-                placeholder="请输入手机号码"
-                v-decorator="['formData.phone', {
+                  rules: [{ required: true, message: '请输入用户名称!' },{pattern:'^[^<|>]{1,20}$',message:'请输入不含<或>的字符,最多20个字符'}] }]" />
+						</a-form-item>
+					</a-col>
+					<a-col :span="12">
+						<!-- 手机号码 -->
+						<a-form-item label="手机号码" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+							<a-input placeholder="请输入手机号码" id="userModal-phone" v-decorator="['formData.phone', {
                   initialValue: formData.phone,
-                  rules: [{ required: true, message: '请输入手机号码!' },{pattern:/^[1][0-9]{10}$/, message: '请输入正确的手机号码!'}] }]"
-              />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <!-- 性别 -->
-          <a-col :span="12">
-            <a-form-item label="性别" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
-              <v-select
-                code="SEX"
-                v-decorator="[
+                  rules: [{ required: true, message: '请输入手机号码!' },{pattern:/^[1][0-9]{10}$/, message: '请输入正确的手机号码!'}] }]" />
+						</a-form-item>
+					</a-col>
+				</a-row>
+				<a-row :gutter="24">
+					<!-- 性别 -->
+					<a-col :span="12">
+						<a-form-item label="性别" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+							<v-select code="SEX" id="userModal-sex" v-decorator="[
                   'formData.sex',
                   {
                     initialValue: formData.sex,
                     rules: [{ required: true, message: '请选择性别!' }] },
                 ]"
-                allowClear ></v-select>
+							 allowClear></v-select>
 
-            </a-form-item>
-          </a-col>
-          <!-- 状态 -->
-          <a-col :span="12">
-            <a-form-item label="状态" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
-              <a-radio-group
-                name="radioGroup"
-                v-decorator="[
+						</a-form-item>
+					</a-col>
+					<!-- 状态 -->
+					<a-col :span="12">
+						<a-form-item label="状态" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
+							<a-radio-group name="radioGroup" id="userModal-loginFlag" v-decorator="[
                   'formData.loginFlag',
                   {
                     initialValue: formData.loginFlag,
                     rules: [{ required: true, message: '请选择状态!' }] },
-                ]"
-              >
-                <a-radio :value="1">是</a-radio>
-                <a-radio :value="0">否</a-radio>
-              </a-radio-group>
+                ]">
+								<a-radio :value="1">是</a-radio>
+								<a-radio :value="0">否</a-radio>
+							</a-radio-group>
 
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="角色" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
-              <a-select
-                v-decorator="[
+						</a-form-item>
+					</a-col>
+				</a-row>
+				<a-row :gutter="24">
+					<a-col :span="24">
+						<a-form-item label="角色" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
+							<a-select id="userModal-roleNames" v-decorator="[
                   'formData.roleNames',
                   {
                     initialValue: formData.roleNames,
                     rules: [{ required: true, message: '请选择状态!' }] },
                 ]"
-                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
-                >
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="24">
-          <a-col :span="24">
-            <a-form-item label="备注" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
-              <a-textarea
-                v-decorator="[
+							 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>
+							</a-select>
+						</a-form-item>
+					</a-col>
+				</a-row>
+				<a-row :gutter="24">
+					<a-col :span="24">
+						<a-form-item label="备注" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
+							<a-textarea id="userModal-remarks" v-decorator="[
                   'formData.remarks',
                   {
                     initialValue: formData.remarks,
                     rules: [] },
                 ]"
-                style="min-height: 50px;"
-                placeholder=""
-                autosize />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
-          <a-button type="primary" @click="handleSubmit()">
-            保存
-          </a-button>
-          <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()">
-            取消
-          </a-button>
-        </a-form-item>
-      </a-form>
-    </a-modal>
-  </div>
+							 style="min-height: 50px;" placeholder="" autosize />
+						</a-form-item>
+					</a-col>
+				</a-row>
+				<a-form-item :wrapper-col="{ span: 12, offset: 5 }">
+					<a-button type="primary" @click="handleSubmit()" id="userModal-handleSubmit">
+						保存
+					</a-button>
+					<a-button :style="{ marginLeft: '8px' }" @click="handleCancel()" id="userModal-handleCancel">
+						取消
+					</a-button>
+				</a-form-item>
+			</a-form>
+		</a-modal>
+	</div>
 </template>
 
 <script>
-import { STable, VSelect } from '@/components'
-import { getRoleList, saveUserPower } from '@/api/power-user.js'
-export default {
-  name: 'UserModal',
-  components: {
-    STable, VSelect
-  },
-  props: {
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    data: {
-      type: Object,
-      default: function () {
-        return {}
-      }
-    }
-  },
-  data () {
-    return {
-      titleText: '添加用户',
-      isshow: this.visible,
-      formLayout: 'horizontal',
-      form: this.$form.createForm(this, { name: 'miniForm' }),
-      roleList: [],
-      formData: {
-        roleNames: undefined, // 角色
-        name: '',
-        loginFlag: '', // 活动状态
-        phone: '',
-        sex: '',
-        remarks: ''
-      }
-    }
-  },
-  methods: {
-    cancel (e) {
-      this.clear()
-      this.$emit('close')
-    },
-    // 保存提交
-    handleSubmit () {
-      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 => {
-            if (res.status == 200) {
-              this.$message.success(res.message ? res.message : '保存成功')
-              this.$emit('refresh')
-              setTimeout(function () {
-                _this.cancel()
-              }, 300)
-            } else {
-              this.$message.error(res.message)
-            }
-          })
-        }
-      })
-    },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        okText: '确定',
-        cancelText: '取消',
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
-    clear () {
-      this.form.resetFields()
-      delete this.formData.id
-      this.formData.roleNames = []
-      this.formData.name = ''
-      this.formData.loginFlag = ''
-      this.formData.phone = ''
-      this.formData.sex = ''
-      this.formData.remarks = ''
-    },
-    // 获取角色列表接口
-    getRoleList () {
-      getRoleList().then(res => {
-        if (res.status + '' === '200') {
-          this.roleList = res.data
-        } else {
-          this.$message.warning(res.message)
-        }
-      })
-    }
-  },
-  mounted () {
-    this.getRoleList()
-  },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, { name: 'miniForm' })
-  },
-  watch: {
-    visible (newValue, oldValue) {
-      this.isshow = newValue
-    },
-    isshow (newValue, oldValue) {
-      if (newValue) {
-        if (this.data.id) { // 编辑
-          this.titleText = '编辑用户'
-          this.formData = Object.assign({}, this.data)
-          delete this.formData.no
-          let roleNames = this.formData.roleNames
-          if (roleNames) {
-            roleNames = roleNames.split(',')
-            const arr = []
-            roleNames.map(item => {
-              const row = this.roleList.find(a => {
-                return a.name == item
-              })
-              if (row) {
-                arr.push(row.id)
-              }
-            })
-            this.formData.roleNames = arr
-          } else {
-            this.formData.roleNames = []
-          }
-          this.formData.loginFlag = Number(this.formData.loginFlag)
-        } else {
-          this.titleText = '添加用户'
-        }
-      } else {
-        this.cancel()
-      }
-    }
-  }
-}
+	import {
+		STable,
+		VSelect
+	} from '@/components'
+	import {
+		getRoleList,
+		saveUserPower
+	} from '@/api/power-user.js'
+	export default {
+		name: 'UserModal',
+		components: {
+			STable,
+			VSelect
+		},
+		props: {
+			visible: {
+				type: Boolean,
+				default: false
+			},
+			data: {
+				type: Object,
+				default: function() {
+					return {}
+				}
+			}
+		},
+		data() {
+			return {
+				titleText: '添加用户',
+				isshow: this.visible,
+				formLayout: 'horizontal',
+				form: this.$form.createForm(this, {
+					name: 'miniForm'
+				}),
+				roleList: [],
+				formData: {
+					roleNames: undefined, // 角色
+					name: '',
+					loginFlag: '', // 活动状态
+					phone: '',
+					sex: '',
+					remarks: ''
+				}
+			}
+		},
+		methods: {
+			cancel(e) {
+				this.clear()
+				this.$emit('close')
+			},
+			// 保存提交
+			handleSubmit() {
+				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 => {
+							if (res.status == 200) {
+								this.$message.success(res.message ? res.message : '保存成功')
+								this.$emit('refresh')
+								setTimeout(function() {
+									_this.cancel()
+								}, 300)
+							} else {
+								this.$message.error(res.message)
+							}
+						})
+					}
+				})
+			},
+			// 取消
+			handleCancel() {
+				const _this = this
+				this.$confirm({
+					title: '提示',
+					content: '确定取消吗?',
+					okText: '确定',
+					cancelText: '取消',
+					onOk() {
+						_this.clear()
+						_this.cancel()
+					}
+				})
+			},
+			clear() {
+				this.form.resetFields()
+				delete this.formData.id
+				this.formData.roleNames = []
+				this.formData.name = ''
+				this.formData.loginFlag = ''
+				this.formData.phone = ''
+				this.formData.sex = ''
+				this.formData.remarks = ''
+			},
+			// 获取角色列表接口
+			getRoleList() {
+				getRoleList().then(res => {
+					if (res.status + '' === '200') {
+						this.roleList = res.data
+					} else {
+						this.$message.warning(res.message)
+					}
+				})
+			}
+		},
+		mounted() {
+			this.getRoleList()
+		},
+		beforeCreate() {
+			this.form = this.$form.createForm(this, {
+				name: 'miniForm'
+			})
+		},
+		watch: {
+			visible(newValue, oldValue) {
+				this.isshow = newValue
+			},
+			isshow(newValue, oldValue) {
+				if (newValue) {
+					if (this.data.id) { // 编辑
+						this.titleText = '编辑用户'
+						this.formData = Object.assign({}, this.data)
+						delete this.formData.no
+						let roleNames = this.formData.roleNames
+						if (roleNames) {
+							roleNames = roleNames.split(',')
+							const arr = []
+							roleNames.map(item => {
+								const row = this.roleList.find(a => {
+									return a.name == item
+								})
+								if (row) {
+									arr.push(row.id)
+								}
+							})
+							this.formData.roleNames = arr
+						} else {
+							this.formData.roleNames = []
+						}
+						this.formData.loginFlag = Number(this.formData.loginFlag)
+					} else {
+						this.titleText = '添加用户'
+					}
+				} else {
+					this.cancel()
+				}
+			}
+		}
+	}
 </script>
 
-<style >
-  .ant-modal-footer {
-    display: none;
-  }
+<style>
+	.ant-modal-footer {
+		display: none;
+	}
 </style>