Răsfoiți Sursa

更新了员工管理的代码

wangning 5 ani în urmă
părinte
comite
4a268723ff
2 a modificat fișierele cu 71 adăugiri și 5 ștergeri
  1. 48 4
      pt/src/saas/shop/manage.vue
  2. 23 1
      pt/src/service/auth/index.js

+ 48 - 4
pt/src/saas/shop/manage.vue

@@ -1,6 +1,37 @@
 <template>
 <template>
 	<div class="app-list-content">
 	<div class="app-list-content">
-		<x-crud class="liu-crud-wrap" @load="onLoad"> </x-crud>
+		<x-crud class="liu-crud-wrap" @load="onLoad">
+      <!-- 头像 -->
+      <template #table-column-avator="{scope}">
+        <cl-avatar
+					shape="square"
+					:size="40"
+					:src="scope.row.avator | default_avatar"
+					:style="{ margin: 'auto' }"
+				></cl-avatar>
+      </template> 
+      <!-- 管理员 -->
+      <template #table-column-super="{scope}">
+        <span>{{scope.row.status == 1 ? '是' : scope.row.status == 2 ? '不是' : '-'}}</span>
+      </template> 
+      <!-- 创始人 -->
+      <template #table-column-founder="{scope}">
+        <span>{{scope.row.founder == 1 ? '是' : scope.row.status == 2 ? '不是' : '-'}}</span>
+      </template> 
+      <!-- 操作 -->
+			<template #slot-column-option="{scope}">
+					<template>
+						<el-popover placement="top" width="160" :ref="'popover-' + scope.row.id">
+							<p>确定要删除吗?</p>
+							<div style="text-align: right; margin: 0">
+								<el-button size="mini" type="text" @click="selfGetCancel(scope.row.id)">取消</el-button>
+								<el-button type="primary" size="mini" @click="noSendShipFn(scope.row)">确定</el-button>
+							</div>
+              <el-button type="text" size="small" slot="reference">删除</el-button>
+						</el-popover>
+					</template>
+			</template>
+    </x-crud>
 	</div>
 	</div>
 </template>
 </template>
 
 
@@ -9,7 +40,7 @@ export default {
 	data() {
 	data() {
 		return {
 		return {
 			// x-crud
 			// x-crud
-			app: null
+			show: false
 		};
 		};
 	},
 	},
 	mounted() {},
 	mounted() {},
@@ -93,7 +124,7 @@ export default {
 							label: '操作'
 							label: '操作'
 						},
 						},
 						// 布局,请移步 `layout`
 						// 布局,请移步 `layout`
-						layout: []
+						layout: ['slot-column-option']
 					}
 					}
 				})
 				})
 				.set('layout', [
 				.set('layout', [
@@ -104,7 +135,20 @@ export default {
 				])
 				])
 				.done();
 				.done();
 			app.refresh();
 			app.refresh();
-		}
+		},
+    //取消删除
+		selfGetCancel(id) {
+			this.$refs[`popover-` + id].doClose();
+		},
+    // 确定删除
+		noSendShipFn(item) {
+      console.log('item.id', item.id)
+      let param = { id: item.id }
+			this.$service.auth.shopAdminDelete(param).then(res => {
+				this.$message.success('操作成功!');
+        this.$refs[`popover-` + item.id].doClose();
+			});
+		},
 	}
 	}
 };
 };
 </script>
 </script>

+ 23 - 1
pt/src/service/auth/index.js

@@ -29,7 +29,7 @@ export class CommonService extends BaseService {
   }
   }
 
 
   	/**
   	/**
-	 * 员工列表 b
+	 * 员工列表 b 
 	 *
 	 *
 	 * @returns
 	 * @returns
 	 * @memberof CommonService
 	 * @memberof CommonService
@@ -38,8 +38,30 @@ export class CommonService extends BaseService {
 		return this.request({
 		return this.request({
 			url: '/shop-admin/list',
 			url: '/shop-admin/list',
 			data: data
 			data: data
+		}).then(res => {
+			return {
+				...res,
+				pagination: {
+					totalPage: res.totalPage,
+					total: parseInt(res.totalNum)
+				}
+			};
 		});
 		});
   }
   }
+
+    	/**
+	 * 删除员工 b  
+	 *
+	 * @returns
+	 * @memberof CommonService
+	 */
+      shopAdminDelete(data) {
+      return this.request({
+        url: 'shop-admin/delete',
+        method: 'GET',
+        params: data
+      })
+    }
   
   
 }
 }