From 671db7e8f0b4ba634d2fff2b7adfed47d6fc9bb3 Mon Sep 17 00:00:00 2001
From: yaooo <272523191@qq.com>
Date: Wed, 6 Dec 2023 09:35:30 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=80=89=E6=8B=A9=E5=85=B3?=
=?UTF-8?q?=E8=81=94=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
admin/src/api/product.ts | 2 +-
admin/src/views/product/edit.vue | 40 +++++++------------
.../controller/land/LandController.php | 5 +++
.../controller/user/UserController.php | 6 ---
app/adminapi/logic/land/LandLogic.php | 21 ++++++++++
5 files changed, 42 insertions(+), 32 deletions(-)
diff --git a/admin/src/api/product.ts b/admin/src/api/product.ts
index 750651a7..bcd692c0 100644
--- a/admin/src/api/product.ts
+++ b/admin/src/api/product.ts
@@ -7,7 +7,7 @@ export function getUserList(params: any) {
// 土地表列表
export function apiLandLists(params: any) {
- return request.get({ url: '/land.land/lists', params })
+ return request.get({ url: '/land.land/datas', params })
}
// 产品列表列表
diff --git a/admin/src/views/product/edit.vue b/admin/src/views/product/edit.vue
index 31aba754..8c4e9d17 100644
--- a/admin/src/views/product/edit.vue
+++ b/admin/src/views/product/edit.vue
@@ -38,19 +38,18 @@
-
+
@@ -132,18 +131,16 @@ const getDetail = async (row: Record) => {
const { optionsData } = useDictOptions<{
user: any[]
+ land: any[]
}>({
user: {
api: getUserList
+ },
+ land: {
+ api: apiLandLists
}
})
-interface ListItem {
- value: string
- label: string
-}
-
-const landOptions = ref([])
const loading = ref(false)
const queryUser = async (query: string) => {
@@ -157,21 +154,16 @@ const queryUser = async (query: string) => {
const selectedUser = (value: any) => {
console.log(value)
+ queryLand(value)
}
-const queryLand = async (query: string) => {
+const queryLand = async (user_id: string) => {
loading.value = true
const landList = await apiLandLists({
- title: query ?? ''
+ user_id: user_id ?? ''
})
loading.value = false
- if (landList.count > 0) {
- landOptions.value = landList.lists.map((land: any) => {
- return { value: `${land.id}`, label: `ID: ${land.id} / 名称: ${land.title}` }
- })
- } else {
- landOptions.value = []
- }
+ optionsData.land = landList
loading.value = false
}
@@ -212,8 +204,6 @@ const handleClose = () => {
emit('close')
}
-
-
defineExpose({
open,
setFormData,
diff --git a/app/adminapi/controller/land/LandController.php b/app/adminapi/controller/land/LandController.php
index f8b52c8f..50aca4aa 100644
--- a/app/adminapi/controller/land/LandController.php
+++ b/app/adminapi/controller/land/LandController.php
@@ -42,6 +42,11 @@ class LandController extends BaseAdminController
return $this->dataLists(new LandLists());
}
+ public function datas()
+ {
+ $datas = (new LandLogic())->datas(input(''));
+ return $this->success('', $datas);
+ }
/**
* @notes 添加
diff --git a/app/adminapi/controller/user/UserController.php b/app/adminapi/controller/user/UserController.php
index 3dccc127..5afbda95 100644
--- a/app/adminapi/controller/user/UserController.php
+++ b/app/adminapi/controller/user/UserController.php
@@ -38,12 +38,6 @@ class UserController extends BaseAdminController
return $this->dataLists(new UserLists());
}
- /**
- * @notes 用户列表
- * @return \think\response\Json
- * @author 段誉
- * @date 2022/9/22 16:16
- */
public function datas()
{
$datas = (new UserLogic())->datas(input(''));
diff --git a/app/adminapi/logic/land/LandLogic.php b/app/adminapi/logic/land/LandLogic.php
index 23c45fe2..d3f45534 100644
--- a/app/adminapi/logic/land/LandLogic.php
+++ b/app/adminapi/logic/land/LandLogic.php
@@ -135,6 +135,27 @@ class LandLogic extends BaseLogic
}
}
+ public function datas($params): array
+ {
+ $userWhere = [];
+ if (!empty($params['user_id'])) {
+ $userWhere['user_id'] = $params['user_id'];
+ }
+ if (!request()->adminInfo['root'] && request()->adminInfo['user_id']) {
+ $userWhere['user_id'] = request()->adminInfo['user_id'];
+ }
+ $field = ['id', 'user_id', 'title', 'address', 'total_area', 'residual_area', 'province_code', 'province_name', 'city_code', 'city_name', 'county_code', 'county_name', 'town_code', 'town_name', 'village_code', 'village_name', 'group_code', 'group_name', 'master_name', 'master_phone', 'pic'];
+ $lists = Land::where($userWhere)
+ ->limit(0, 100)
+ ->field($field)
+ ->order('id desc')
+ ->select()->toArray();
+ foreach ($lists as &$item) {
+ $item['landinfo'] = $item['id'] . ' / ' . $item['title'];
+ }
+ return $lists;
+ }
+
/**
* @notes 删除