更新细节
This commit is contained in:
parent
6f3314f92c
commit
bed415a1e5
|
@ -2,7 +2,7 @@ import request from '@/utils/request'
|
|||
|
||||
// 用户列表
|
||||
export function getUserList(params: any) {
|
||||
return request.get({ url: '/user.user/lists', params }, { ignoreCancelToken: true })
|
||||
return request.get({ url: '/user.user/datas', params }, { ignoreCancelToken: true })
|
||||
}
|
||||
|
||||
// 产品列表列表
|
||||
|
|
|
@ -9,22 +9,21 @@
|
|||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||
<el-form-item v-if="formData.root == 1" label="用户ID" prop="user_id">
|
||||
<el-form-item v-if="formData.root == 1" label="所属用户" prop="user_id">
|
||||
<el-select
|
||||
v-model="formData.user_id"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
filterable
|
||||
placeholder="请输入用户信息"
|
||||
:remote-method="queryUser"
|
||||
:loading="loading"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
<el-option
|
||||
v-for="(item, index) in optionsData.user"
|
||||
:key="index"
|
||||
:label="item.userinfo"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="土地名称" prop="title">
|
||||
|
@ -90,6 +89,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup name="landEdit">
|
||||
import { useDictOptions } from '@/hooks/useDictOptions'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiLandAdd, apiLandEdit, apiLandDetail, getUserList, getUserInfo } from '@/api/land'
|
||||
|
@ -182,31 +182,23 @@ const getDetail = async (row: Record<string, any>) => {
|
|||
setFormData(data)
|
||||
}
|
||||
|
||||
interface ListItem {
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
const userOptions = ref<ListItem[]>([])
|
||||
const { optionsData } = useDictOptions<{
|
||||
user: any[]
|
||||
}>({
|
||||
user: {
|
||||
api: getUserList
|
||||
}
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const queryUser = async (query: string) => {
|
||||
if (query) {
|
||||
loading.value = true
|
||||
const userList = await getUserList({
|
||||
keyword: query
|
||||
})
|
||||
loading.value = false
|
||||
if (userList.count > 0) {
|
||||
userOptions.value = userList.lists.map((user: any) => {
|
||||
return { value: `${user.id}`, label: `ID: ${user.id} / 账户: ${user.account}` }
|
||||
})
|
||||
} else {
|
||||
userOptions.value = []
|
||||
}
|
||||
loading.value = false
|
||||
} else {
|
||||
userOptions.value = []
|
||||
}
|
||||
loading.value = true
|
||||
const userList = await getUserList({
|
||||
keyword: query ?? ''
|
||||
})
|
||||
optionsData.user = userList
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
|
@ -240,7 +232,6 @@ const handleClose = () => {
|
|||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
filterable
|
||||
placeholder="请输入用户信息"
|
||||
:remote-method="queryUser"
|
||||
@change="selectedUser"
|
||||
@blur="selectedUser"
|
||||
:loading="loading"
|
||||
>
|
||||
<el-option
|
||||
|
@ -42,6 +42,7 @@
|
|||
filterable
|
||||
placeholder="请输入土地信息"
|
||||
:remote-method="queryLand"
|
||||
@focus="selectedLand"
|
||||
:loading="loading"
|
||||
>
|
||||
<el-option
|
||||
|
@ -117,7 +118,6 @@ const setFormData = async (data: Record<any, any>) => {
|
|||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
formData.create_time = timeFormat(formData.create_time,'yyyy-mm-dd hh:MM:ss')
|
||||
}
|
||||
|
@ -153,7 +153,8 @@ const queryUser = async (query: string) => {
|
|||
}
|
||||
|
||||
const selectedUser = (value: any) => {
|
||||
queryLand(value)
|
||||
optionsData.land = []
|
||||
formData.land_id = ''
|
||||
}
|
||||
|
||||
const queryLand = async (user_id: string) => {
|
||||
|
@ -166,6 +167,10 @@ const queryLand = async (user_id: string) => {
|
|||
loading.value = false
|
||||
}
|
||||
|
||||
const selectedLand = () => {
|
||||
queryLand(formData.user_id)
|
||||
}
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
|
|
|
@ -38,8 +38,9 @@ class LandLogic extends BaseLogic
|
|||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$root = (request()->adminInfo)['root'];
|
||||
$userId = (request()->adminInfo)['user_id'];
|
||||
if (!empty($params['user_id'])) {
|
||||
if ($root && !empty($params['user_id'])) {
|
||||
$userId = $params['user_id'];
|
||||
}
|
||||
Db::startTrans();
|
||||
|
@ -86,8 +87,9 @@ class LandLogic extends BaseLogic
|
|||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
$root = (request()->adminInfo)['root'];
|
||||
$userId = (request()->adminInfo)['user_id'];
|
||||
if (!empty($params['user_id'])) {
|
||||
if ($root && !empty($params['user_id'])) {
|
||||
$userId = $params['user_id'];
|
||||
}
|
||||
Db::startTrans();
|
||||
|
|
|
@ -73,7 +73,7 @@ class UserLogic extends BaseLogic
|
|||
->order('id desc')
|
||||
->select()->toArray();
|
||||
foreach ($lists as &$item) {
|
||||
$item['userinfo'] = $item['id'] . ' / ' . $item['nickname'] . ' / ' . $item['account'];
|
||||
$item['userinfo'] = $item['id'] . ' / ' . $item['account'];
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue