Bläddra i källkod

feat: ERP店铺列表增加允许绑定筛选

- 后端 listAll 新增 bindEnabled 参数
- 前端搜索区新增「允许绑定」下拉框(允许/不允许)

Co-Authored-By: Claude <noreply@anthropic.com>
skyline 1 dag sedan
förälder
incheckning
4369f72298

+ 1 - 1
haha-admin-web/src/api/erpShop.ts

@@ -11,7 +11,7 @@ export const syncErpShops = () =>
   http.request<Result>("post", "/erp-shops/sync");
 
 /** 分页获取已缓存的 ERP 店铺列表 */
-export const getErpShopList = (params: { keyword?: string; boundStatus?: number; page: number; pageSize: number }) =>
+export const getErpShopList = (params: { keyword?: string; boundStatus?: number; bindEnabled?: number; page: number; pageSize: number }) =>
   http.request<Result>("get", "/erp-shops", { params });
 
 /** 绑定设备与 ERP 店铺 */

+ 16 - 1
haha-admin-web/src/views/erp-shop/index.vue

@@ -31,7 +31,8 @@ const batchUpdating = ref(false);
 
 const form = reactive({
   keyword: "",
-  boundStatus: undefined as number | undefined
+  boundStatus: undefined as number | undefined,
+  bindEnabled: undefined as number | undefined
 });
 
 const dataList = ref<any[]>([]);
@@ -54,6 +55,7 @@ async function fetchList() {
     const res = await getErpShopList({
       keyword: form.keyword || undefined,
       boundStatus: form.boundStatus,
+      bindEnabled: form.bindEnabled,
       page: pagination.currentPage,
       pageSize: pagination.pageSize
     });
@@ -70,6 +72,7 @@ async function fetchList() {
 function resetForm() {
   form.keyword = "";
   form.boundStatus = undefined;
+  form.bindEnabled = undefined;
   pagination.currentPage = 1;
   fetchList();
 }
@@ -275,6 +278,18 @@ onMounted(() => {
           <el-option label="未绑定" :value="0" />
         </el-select>
       </el-form-item>
+      <el-form-item label="允许绑定:">
+        <el-select
+          v-model="form.bindEnabled"
+          placeholder="全部"
+          clearable
+          class="w-[140px]!"
+          @change="handleSearch"
+        >
+          <el-option label="允许" :value="1" />
+          <el-option label="不允许" :value="0" />
+        </el-select>
+      </el-form-item>
       <el-form-item label="店铺名称:">
         <el-input
           v-model="form.keyword"

+ 2 - 1
haha-admin/src/main/java/com/haha/admin/controller/ErpShopController.java

@@ -44,9 +44,10 @@ public class ErpShopController {
     @GetMapping
     public Result<PageResult<ErpShop>> list(@RequestParam(required = false) String keyword,
                                              @RequestParam(required = false) Integer boundStatus,
+                                             @RequestParam(required = false) Integer bindEnabled,
                                              @RequestParam(defaultValue = "1") int page,
                                              @RequestParam(defaultValue = "10") int pageSize) {
-        IPage<ErpShop> pageResult = erpShopService.listAll(keyword, boundStatus, page, pageSize);
+        IPage<ErpShop> pageResult = erpShopService.listAll(keyword, boundStatus, bindEnabled, page, pageSize);
         return Result.success("查询成功", PageResult.of(pageResult));
     }
 

+ 1 - 1
haha-service/src/main/java/com/haha/service/ErpShopService.java

@@ -11,7 +11,7 @@ public interface ErpShopService extends IService<ErpShop> {
 
     void syncFromErp();
 
-    IPage<ErpShop> listAll(String keyword, Integer boundStatus, int page, int pageSize);
+    IPage<ErpShop> listAll(String keyword, Integer boundStatus, Integer bindEnabled, int page, int pageSize);
 
     void bindDevice(Long deviceId, Long erpShopId);
 

+ 4 - 1
haha-service/src/main/java/com/haha/service/impl/ErpShopServiceImpl.java

@@ -108,9 +108,12 @@ public class ErpShopServiceImpl extends ServiceImpl<ErpShopMapper, ErpShop> impl
     }
 
     @Override
-    public IPage<ErpShop> listAll(String keyword, Integer boundStatus, int page, int pageSize) {
+    public IPage<ErpShop> listAll(String keyword, Integer boundStatus, Integer bindEnabled, int page, int pageSize) {
         LambdaQueryWrapper<ErpShop> wrapper = new LambdaQueryWrapper<ErpShop>()
                 .eq(ErpShop::getStatus, 1);
+        if (bindEnabled != null) {
+            wrapper.eq(ErpShop::getBindEnabled, bindEnabled);
+        }
         if (StringUtils.hasText(keyword)) {
             wrapper.and(w -> w
                     .like(ErpShop::getShopName, keyword)