Compare commits
No commits in common. "924a7c35e84706df8516db35f6afa1d28c79baa7" and "9bc28ea788257df0dc2d92df63e00f2157f2ca0b" have entirely different histories.
924a7c35e8
...
9bc28ea788
|
@ -5,11 +5,6 @@ export function getUserList(params: any) {
|
||||||
return request.get({ url: '/user.user/lists', params }, { ignoreCancelToken: true })
|
return request.get({ url: '/user.user/lists', params }, { ignoreCancelToken: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 产品列表列表
|
|
||||||
export function apiProductLists(params: any) {
|
|
||||||
return request.get({ url: '/land.product/lists', params })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 土地表列表
|
// 土地表列表
|
||||||
export function apiLandLists(params: any) {
|
export function apiLandLists(params: any) {
|
||||||
console.log(params)
|
console.log(params)
|
||||||
|
@ -35,8 +30,3 @@ export function apiLandDelete(params: any) {
|
||||||
export function apiLandDetail(params: any) {
|
export function apiLandDetail(params: any) {
|
||||||
return request.get({ url: '/land.land/detail', params })
|
return request.get({ url: '/land.land/detail', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 绑定产品
|
|
||||||
export function apiLandBind(params: any) {
|
|
||||||
return request.post({ url: '/land.land/bind', params })
|
|
||||||
}
|
|
|
@ -9,6 +9,24 @@
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||||
|
<el-form-item label="用户ID" prop="user_id">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.user_id"
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
reserve-keyword
|
||||||
|
placeholder="请输入用户信息"
|
||||||
|
:remote-method="queryUser"
|
||||||
|
:loading="loading"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="产品ID" prop="product_id">
|
<el-form-item label="产品ID" prop="product_id">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.product_id"
|
v-model="formData.product_id"
|
||||||
|
@ -117,6 +135,7 @@ const popupTitle = computed(() => {
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
|
user_id: '',
|
||||||
product_id: '',
|
product_id: '',
|
||||||
code: '',
|
code: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -131,6 +150,11 @@ const formData = reactive({
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
const formRules = reactive<any>({
|
const formRules = reactive<any>({
|
||||||
|
user_id: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入用户ID',
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
product_id: [{
|
product_id: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入产品id',
|
message: '请输入产品id',
|
||||||
|
@ -184,8 +208,29 @@ interface ListItem {
|
||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
const productOptions = ref<ListItem[]>([])
|
const productOptions = ref<ListItem[]>([])
|
||||||
|
const userOptions = ref<ListItem[]>([])
|
||||||
const loading = ref(false)
|
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 = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const queryProduct = async (query: string) => {
|
const queryProduct = async (query: string) => {
|
||||||
if (query) {
|
if (query) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
|
@ -1,147 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="edit-popup">
|
|
||||||
<popup
|
|
||||||
ref="popupRef"
|
|
||||||
:title="popupTitle"
|
|
||||||
:async="true"
|
|
||||||
width="650px"
|
|
||||||
@confirm="handleSubmit"
|
|
||||||
@close="handleClose"
|
|
||||||
>
|
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
|
||||||
<el-form-item label="土地ID" prop="id">
|
|
||||||
<el-input v-model="formData.id" disabled clearable placeholder="请输入土地ID" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="土地名称" prop="title">
|
|
||||||
<el-input
|
|
||||||
v-model="formData.title"
|
|
||||||
disabled
|
|
||||||
clearable
|
|
||||||
placeholder="请输入土地名称"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="绑定产品" prop="product_id">
|
|
||||||
<el-select
|
|
||||||
v-model="formData.product_id"
|
|
||||||
filterable
|
|
||||||
remote
|
|
||||||
reserve-keyword
|
|
||||||
placeholder="请输入产品信息"
|
|
||||||
:remote-method="queryProduct"
|
|
||||||
:loading="loading"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in productOptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</popup>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup name="landEdit">
|
|
||||||
import type { FormInstance } from 'element-plus'
|
|
||||||
import Popup from '@/components/popup/index.vue'
|
|
||||||
import { apiLandBind, apiProductLists } from '@/api/land'
|
|
||||||
import { timeFormat } from '@/utils/util'
|
|
||||||
import type { PropType } from 'vue'
|
|
||||||
defineProps({
|
|
||||||
dictData: {
|
|
||||||
type: Object as PropType<Record<string, any[]>>,
|
|
||||||
default: () => ({})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const emit = defineEmits(['success', 'close'])
|
|
||||||
const formRef = shallowRef<FormInstance>()
|
|
||||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
|
||||||
const mode = ref('add')
|
|
||||||
|
|
||||||
// 弹窗标题
|
|
||||||
const popupTitle = computed(() => {
|
|
||||||
return (mode.value = '绑定产品')
|
|
||||||
})
|
|
||||||
|
|
||||||
// 表单数据
|
|
||||||
const formData = reactive({
|
|
||||||
id: '',
|
|
||||||
title: '',
|
|
||||||
product_id: ''
|
|
||||||
})
|
|
||||||
|
|
||||||
// 表单验证
|
|
||||||
const formRules = reactive<any>({
|
|
||||||
product_id: [{
|
|
||||||
required: true,
|
|
||||||
message: '请选择绑定产品',
|
|
||||||
trigger: ['blur']
|
|
||||||
}],
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 获取详情
|
|
||||||
const setFormData = async (data: Record<any, any>) => {
|
|
||||||
for (const key in formData) {
|
|
||||||
if (data[key] != null && data[key] != undefined) {
|
|
||||||
//@ts-ignore
|
|
||||||
formData[key] = data[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ListItem {
|
|
||||||
value: string
|
|
||||||
label: string
|
|
||||||
}
|
|
||||||
const productOptions = ref<ListItem[]>([])
|
|
||||||
const loading = ref(false)
|
|
||||||
|
|
||||||
const queryProduct = async (query: string) => {
|
|
||||||
if (query) {
|
|
||||||
loading.value = true
|
|
||||||
const productList = await apiProductLists({
|
|
||||||
name: query
|
|
||||||
})
|
|
||||||
loading.value = false
|
|
||||||
if (productList.count > 0) {
|
|
||||||
productOptions.value = productList.lists.map((product: any) => {
|
|
||||||
return { value: `${product.id}`, label: `ID: ${product.id} / 名称: ${product.name}` }
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
productOptions.value = []
|
|
||||||
}
|
|
||||||
loading.value = false
|
|
||||||
} else {
|
|
||||||
productOptions.value = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 提交按钮
|
|
||||||
const handleSubmit = async () => {
|
|
||||||
await formRef.value?.validate()
|
|
||||||
const data = { ...formData, }
|
|
||||||
await apiLandBind(data)
|
|
||||||
popupRef.value?.close()
|
|
||||||
emit('success')
|
|
||||||
}
|
|
||||||
|
|
||||||
//打开弹窗
|
|
||||||
const open = (type = 'add') => {
|
|
||||||
mode.value = type
|
|
||||||
popupRef.value?.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 关闭回调
|
|
||||||
const handleClose = () => {
|
|
||||||
emit('close')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
open,
|
|
||||||
setFormData
|
|
||||||
})
|
|
||||||
</script>
|
|
|
@ -9,7 +9,7 @@
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
<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 label="用户ID" prop="user_id">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.user_id"
|
v-model="formData.user_id"
|
||||||
filterable
|
filterable
|
||||||
|
@ -118,7 +118,6 @@ const popupTitle = computed(() => {
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
user_id: '',
|
user_id: '',
|
||||||
root: 0,
|
|
||||||
title: '',
|
title: '',
|
||||||
total_area: '',
|
total_area: '',
|
||||||
residual_area: '',
|
residual_area: '',
|
||||||
|
@ -143,6 +142,11 @@ const formData = reactive({
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
const formRules = reactive<any>({
|
const formRules = reactive<any>({
|
||||||
|
user_id: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入用户ID',
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
title: [{
|
title: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入土地名称',
|
message: '请输入土地名称',
|
||||||
|
|
|
@ -49,12 +49,16 @@
|
||||||
<el-tag class="mr-2" type="info">账户: {{ row.user.account }}</el-tag>
|
<el-tag class="mr-2" type="info">账户: {{ row.user.account }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column> -->
|
</el-table-column> -->
|
||||||
<el-table-column label="土地名称" prop="title" show-overflow-tooltip />
|
<el-table-column label="土地名称">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag class="mr-2" type="info">{{ row.title }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="土地面积" prop="total_area" show-overflow-tooltip />
|
<el-table-column label="土地面积" prop="total_area" show-overflow-tooltip />
|
||||||
<el-table-column label="剩余面积" prop="residual_area" show-overflow-tooltip />
|
<el-table-column label="剩余面积" prop="residual_area" show-overflow-tooltip />
|
||||||
<el-table-column label="土地负责人" prop="master_name" show-overflow-tooltip />
|
<el-table-column label="土地负责人" prop="master_name" show-overflow-tooltip />
|
||||||
<el-table-column label="负责人电话" prop="master_phone" show-overflow-tooltip />
|
<el-table-column label="负责人电话" prop="master_phone" show-overflow-tooltip />
|
||||||
<el-table-column label="操作" width="400" align="center" fixed="right">
|
<el-table-column label="操作" width="350" align="center" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['land.land/edit']"
|
v-perms="['land.land/edit']"
|
||||||
|
@ -64,14 +68,6 @@
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
v-perms="['land.land/bind']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleBind(row)"
|
|
||||||
>
|
|
||||||
绑定产品
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['land.product/lists']"
|
v-perms="['land.product/lists']"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -125,7 +121,6 @@
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
||||||
<bind-popup v-if="bindEdit" ref="bindRef" :dict-data="dictData" @success="getLists" @close="bindEdit = false" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog v-model="dialogPicVisible" title="土地图片" center>
|
<el-dialog v-model="dialogPicVisible" title="土地图片" center>
|
||||||
|
@ -153,14 +148,11 @@ import { apiLandLists, apiLandDelete } from '@/api/land'
|
||||||
import { timeFormat } from '@/utils/util'
|
import { timeFormat } from '@/utils/util'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
import BindPopup from './bind.vue'
|
|
||||||
|
|
||||||
const { query } = useRoute()
|
const { query } = useRoute()
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
const bindRef = shallowRef<InstanceType<typeof BindPopup>>()
|
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
const bindEdit = ref(false)
|
|
||||||
|
|
||||||
let user_id = query.user_id
|
let user_id = query.user_id
|
||||||
if (typeof user_id == 'undefined') {
|
if (typeof user_id == 'undefined') {
|
||||||
|
@ -223,14 +215,6 @@ const handleEdit = async (data: any) => {
|
||||||
editRef.value?.setFormData(data)
|
editRef.value?.setFormData(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 绑定
|
|
||||||
const handleBind = async (data: any) => {
|
|
||||||
bindEdit.value = true
|
|
||||||
await nextTick()
|
|
||||||
bindRef.value?.open('bind')
|
|
||||||
bindRef.value?.setFormData(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = async (id: number | any[]) => {
|
const handleDelete = async (id: number | any[]) => {
|
||||||
await feedback.confirm('确定要删除?')
|
await feedback.confirm('确定要删除?')
|
||||||
|
|
|
@ -9,6 +9,25 @@
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||||
|
|
||||||
|
<el-form-item label="用户ID" prop="user_id">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.user_id"
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
reserve-keyword
|
||||||
|
placeholder="请输入用户信息"
|
||||||
|
:remote-method="queryUser"
|
||||||
|
:loading="loading"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="土地ID" prop="land_id">
|
<el-form-item label="土地ID" prop="land_id">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.land_id"
|
v-model="formData.land_id"
|
||||||
|
@ -97,6 +116,7 @@ const popupTitle = computed(() => {
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
|
user_id: '',
|
||||||
land_id: '',
|
land_id: '',
|
||||||
kind: '',
|
kind: '',
|
||||||
breed: '',
|
breed: '',
|
||||||
|
@ -112,6 +132,11 @@ const formData = reactive({
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
const formRules = reactive<any>({
|
const formRules = reactive<any>({
|
||||||
|
user_id: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入用户ID',
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
land_id: [{
|
land_id: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入土地id',
|
message: '请输入土地id',
|
||||||
|
@ -173,8 +198,29 @@ interface ListItem {
|
||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
const landOptions = ref<ListItem[]>([])
|
const landOptions = ref<ListItem[]>([])
|
||||||
|
const userOptions = ref<ListItem[]>([])
|
||||||
const loading = ref(false)
|
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 = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const queryLand = async (query: string) => {
|
const queryLand = async (query: string) => {
|
||||||
if (query) {
|
if (query) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
|
@ -9,6 +9,25 @@
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||||
|
|
||||||
|
<el-form-item label="用户ID" prop="user_id">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.user_id"
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
reserve-keyword
|
||||||
|
placeholder="请输入用户信息"
|
||||||
|
:remote-method="queryUser"
|
||||||
|
:loading="loading"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="种植ID" prop="land_id">
|
<el-form-item label="种植ID" prop="land_id">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.plant_id"
|
v-model="formData.plant_id"
|
||||||
|
@ -74,6 +93,7 @@ const popupTitle = computed(() => {
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
|
user_id: '',
|
||||||
plant_id: '',
|
plant_id: '',
|
||||||
type: '',
|
type: '',
|
||||||
type_text: '',
|
type_text: '',
|
||||||
|
@ -83,6 +103,11 @@ const formData = reactive({
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
const formRules = reactive<any>({
|
const formRules = reactive<any>({
|
||||||
|
user_id: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入用户ID',
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
plant_id: [{
|
plant_id: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入种植ID',
|
message: '请输入种植ID',
|
||||||
|
@ -120,8 +145,29 @@ interface ListItem {
|
||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
const landPlantOptions = ref<ListItem[]>([])
|
const landPlantOptions = ref<ListItem[]>([])
|
||||||
|
const userOptions = ref<ListItem[]>([])
|
||||||
const loading = ref(false)
|
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 = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const queryLandPlant = async (query: string) => {
|
const queryLandPlant = async (query: string) => {
|
||||||
if (query) {
|
if (query) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
|
@ -9,13 +9,26 @@
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||||
<el-form-item label="产品编号" prop="code">
|
<el-form-item label="用户ID" prop="user_id">
|
||||||
<el-input v-model="formData.code" clearable placeholder="请输入产品编号" />
|
<el-select
|
||||||
|
v-model="formData.user_id"
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
reserve-keyword
|
||||||
|
placeholder="请输入用户信息"
|
||||||
|
:remote-method="queryUser"
|
||||||
|
:loading="loading"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in userOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="产品名称" prop="name">
|
|
||||||
<el-input v-model="formData.name" clearable placeholder="请输入产品名称" />
|
<el-form-item label="土地ID" prop="land_id">
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="所属土地" prop="land_id">
|
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.land_id"
|
v-model="formData.land_id"
|
||||||
filterable
|
filterable
|
||||||
|
@ -32,6 +45,12 @@
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品编号" prop="code">
|
||||||
|
<el-input v-model="formData.code" clearable placeholder="请输入产品编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品名称" prop="name">
|
||||||
|
<el-input v-model="formData.name" clearable placeholder="请输入产品名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="产品状态" prop="status">
|
<el-form-item label="产品状态" prop="status">
|
||||||
<el-select class="flex-1" v-model="formData.status" clearable placeholder="请选择产品状态">
|
<el-select class="flex-1" v-model="formData.status" clearable placeholder="请选择产品状态">
|
||||||
|
@ -74,6 +93,7 @@ const popupTitle = computed(() => {
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
|
user_id: '',
|
||||||
land_id: '',
|
land_id: '',
|
||||||
code: '',
|
code: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -83,6 +103,16 @@ const formData = reactive({
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
const formRules = reactive<any>({
|
const formRules = reactive<any>({
|
||||||
|
user_id: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入用户id',
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
|
land_id: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入土地id',
|
||||||
|
trigger: ['blur']
|
||||||
|
}],
|
||||||
code: [{
|
code: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入产品编号',
|
message: '请输入产品编号',
|
||||||
|
@ -125,9 +155,30 @@ interface ListItem {
|
||||||
value: string
|
value: string
|
||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
|
const userOptions = ref<ListItem[]>([])
|
||||||
|
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 = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const landOptions = ref<ListItem[]>([])
|
const landOptions = ref<ListItem[]>([])
|
||||||
const loading = ref(false)
|
|
||||||
|
|
||||||
const queryLand = async (query: string) => {
|
const queryLand = async (query: string) => {
|
||||||
if (query) {
|
if (query) {
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
<span>{{ row.create_time ? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
|
<span>{{ row.create_time ? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="260" align="center" fixed="right">
|
<el-table-column label="操作" width="200" align="center" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['land.product/edit']"
|
v-perms="['land.product/edit']"
|
||||||
|
@ -94,14 +94,6 @@
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
v-perms="['land.product/edit']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleEdit(row)"
|
|
||||||
>
|
|
||||||
绑定设备
|
|
||||||
</el-button>
|
|
||||||
<el-button v-perms="['device.device/lists']" type="primary" link >
|
<el-button v-perms="['device.device/lists']" type="primary" link >
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
|
@ -111,7 +103,7 @@
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
设备信息
|
查看设备
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
|
|
@ -104,18 +104,5 @@ class LandController extends BaseAdminController
|
||||||
return $this->data($result);
|
return $this->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 绑定产品
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2023/11/22 16:35
|
|
||||||
*/
|
|
||||||
public function bind()
|
|
||||||
{
|
|
||||||
$params = (new LandValidate())->post()->goCheck('bind');
|
|
||||||
LandLogic::bind($params);
|
|
||||||
return $this->success('绑定成功', [], 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -68,15 +68,11 @@ class LandLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
|
|
||||||
return Land::where($this->searchWhere)->where($this->userSearch())->with('user')
|
return Land::where($this->searchWhere)->where($this->userSearch())->with('user')
|
||||||
->field(['id', 'user_id', 'title', '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', 'longitude', 'latitude', 'master_name', 'master_phone', 'pic'])
|
->field(['id', 'user_id', 'title', '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', 'longitude', 'latitude', 'master_name', 'master_phone', 'pic'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item, $key){
|
->select()
|
||||||
$item['root'] = $this->adminInfo['root'] ?? 0;
|
|
||||||
return $item;
|
|
||||||
})
|
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,10 @@ class DeviceLogic extends BaseLogic
|
||||||
} else {
|
} else {
|
||||||
$params['monitor_item'] = trim($params['monitor_item']);
|
$params['monitor_item'] = trim($params['monitor_item']);
|
||||||
}
|
}
|
||||||
$userId = Db::name('product')->where('id', $params['product_id'])->value('user_id');
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$device = Device::create([
|
$device = Device::create([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
|
@ -88,11 +87,10 @@ class DeviceLogic extends BaseLogic
|
||||||
} else {
|
} else {
|
||||||
$params['monitor_item'] = trim($params['monitor_item']);
|
$params['monitor_item'] = trim($params['monitor_item']);
|
||||||
}
|
}
|
||||||
$userId = Db::name('product')->where('id', $params['product_id'])->value('user_id');
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$device = Device::where('id', $params['id'])->update([
|
$device = Device::where('id', $params['id'])->update([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
|
|
|
@ -38,14 +38,10 @@ class LandLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function add(array $params): bool
|
public static function add(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = (request()->adminInfo)['user_id'];
|
|
||||||
if (!empty($params['user_id'])) {
|
|
||||||
$userId = $params['user_id'];
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Land::create([
|
Land::create([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'title' => $params['title'],
|
'title' => $params['title'],
|
||||||
'total_area' => $params['total_area'],
|
'total_area' => $params['total_area'],
|
||||||
'residual_area' => $params['residual_area'],
|
'residual_area' => $params['residual_area'],
|
||||||
|
@ -87,14 +83,10 @@ class LandLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function edit(array $params): bool
|
public static function edit(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = (request()->adminInfo)['user_id'];
|
|
||||||
if (!empty($params['user_id'])) {
|
|
||||||
$userId = $params['user_id'];
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Land::where('id', $params['id'])->update([
|
Land::where('id', $params['id'])->update([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'title' => $params['title'],
|
'title' => $params['title'],
|
||||||
'total_area' => $params['total_area'],
|
'total_area' => $params['total_area'],
|
||||||
'residual_area' => $params['residual_area'],
|
'residual_area' => $params['residual_area'],
|
||||||
|
@ -151,32 +143,4 @@ class LandLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
return Land::findOrEmpty($params['id'])->toArray();
|
return Land::findOrEmpty($params['id'])->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function bind($params): bool
|
|
||||||
{
|
|
||||||
$userId = (request()->adminInfo)['user_id'];
|
|
||||||
if (!empty($params['id'])) {
|
|
||||||
$userId = Db::name('land')->where('id', $params['id'])->value('user_id');
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
|
||||||
try {
|
|
||||||
Db::name('product')->where('id', $params['product_id'])->update([
|
|
||||||
'user_id' => $userId
|
|
||||||
]);
|
|
||||||
Db::name('land_product')->where('land_id', $params['id'])->delete();
|
|
||||||
Db::name('land_product')->where('product_id', $params['product_id'])->delete();
|
|
||||||
Db::name('land_product')->insert([
|
|
||||||
'land_id' => $params['id'],
|
|
||||||
'product_id' => $params['product_id'],
|
|
||||||
'create_time' => time(),
|
|
||||||
'update_time' => time()
|
|
||||||
]);
|
|
||||||
Db::commit();
|
|
||||||
return true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Db::rollback();
|
|
||||||
self::setError($e->getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -38,11 +38,10 @@ class LandPlantActionLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function add(array $params): bool
|
public static function add(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = Db::name('land_plant')->where('id', $params['plant_id'])->value('user_id');
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
LandPlantAction::create([
|
LandPlantAction::create([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'plant_id' => $params['plant_id'],
|
'plant_id' => $params['plant_id'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
'type_text' => $params['type_text'],
|
'type_text' => $params['type_text'],
|
||||||
|
@ -68,11 +67,10 @@ class LandPlantActionLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function edit(array $params): bool
|
public static function edit(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = Db::name('land_plant')->where('id', $params['plant_id'])->value('user_id');
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
LandPlantAction::where('id', $params['id'])->update([
|
LandPlantAction::where('id', $params['id'])->update([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'plant_id' => $params['plant_id'],
|
'plant_id' => $params['plant_id'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
'type_text' => $params['type_text'],
|
'type_text' => $params['type_text'],
|
||||||
|
|
|
@ -28,6 +28,7 @@ use think\facade\Db;
|
||||||
class LandPlantLogic extends BaseLogic
|
class LandPlantLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 添加
|
* @notes 添加
|
||||||
* @param array $params
|
* @param array $params
|
||||||
|
@ -37,11 +38,10 @@ class LandPlantLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function add(array $params): bool
|
public static function add(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = Db::name('land')->where('id', $params['land_id'])->value('user_id');
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
LandPlant::create([
|
LandPlant::create([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'land_id' => $params['land_id'],
|
'land_id' => $params['land_id'],
|
||||||
'kind' => $params['kind'],
|
'kind' => $params['kind'],
|
||||||
'breed' => $params['breed'],
|
'breed' => $params['breed'],
|
||||||
|
@ -73,11 +73,10 @@ class LandPlantLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function edit(array $params): bool
|
public static function edit(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = Db::name('land')->where('id', $params['land_id'])->value('user_id');
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
LandPlant::where('id', $params['id'])->update([
|
LandPlant::where('id', $params['id'])->update([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'land_id' => $params['land_id'],
|
'land_id' => $params['land_id'],
|
||||||
'kind' => $params['kind'],
|
'kind' => $params['kind'],
|
||||||
'breed' => $params['breed'],
|
'breed' => $params['breed'],
|
||||||
|
|
|
@ -38,26 +38,20 @@ class ProductLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function add(array $params): bool
|
public static function add(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = (request()->adminInfo)['user_id'];
|
|
||||||
if (!empty($params['land_id'])) {
|
|
||||||
$userId = Db::name('land')->where('id', $params['land_id'])->value('user_id');
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$product = Product::create([
|
$product = Product::create([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'status' => $params['status'],
|
'status' => $params['status'],
|
||||||
]);
|
]);
|
||||||
if (!empty($params['land_id'])) {
|
|
||||||
Db::name('land_product')->insert([
|
Db::name('land_product')->insert([
|
||||||
'land_id' => $params['land_id'],
|
'land_id' => $params['land_id'],
|
||||||
'product_id' => $product['id'],
|
'product_id' => $product['id'],
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
'update_time' => time()
|
'update_time' => time()
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -77,27 +71,21 @@ class ProductLogic extends BaseLogic
|
||||||
*/
|
*/
|
||||||
public static function edit(array $params): bool
|
public static function edit(array $params): bool
|
||||||
{
|
{
|
||||||
$userId = (request()->adminInfo)['user_id'];
|
|
||||||
if (!empty($params['land_id'])) {
|
|
||||||
$userId = Db::name('land')->where('id', $params['land_id'])->value('user_id');
|
|
||||||
}
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
Product::where('id', $params['id'])->update([
|
Product::where('id', $params['id'])->update([
|
||||||
'user_id' => $userId,
|
'user_id' => $params['user_id'],
|
||||||
'code' => $params['code'],
|
'code' => $params['code'],
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'status' => $params['status'],
|
'status' => $params['status'],
|
||||||
]);
|
]);
|
||||||
Db::name('land_product')->where('product_id', $params['id'])->delete();
|
Db::name('land_product')->where('product_id', $params['id'])->delete();
|
||||||
if (!empty($params['land_id'])) {
|
|
||||||
Db::name('land_product')->insert([
|
Db::name('land_product')->insert([
|
||||||
'land_id' => $params['land_id'],
|
'land_id' => $params['land_id'],
|
||||||
'product_id' => $params['id'],
|
'product_id' => $params['id'],
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
'update_time' => time()
|
'update_time' => time()
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class LandValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'id' => 'require',
|
'id' => 'require',
|
||||||
'product_id' => 'require',
|
'user_id' => 'require',
|
||||||
'title' => 'require',
|
'title' => 'require',
|
||||||
'total_area' => 'require',
|
'total_area' => 'require',
|
||||||
'residual_area' => 'require',
|
'residual_area' => 'require',
|
||||||
|
@ -62,6 +62,7 @@ class LandValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
protected $field = [
|
protected $field = [
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
|
'user_id' => '用户id',
|
||||||
'title' => '土地名称',
|
'title' => '土地名称',
|
||||||
'total_area' => '土地面积',
|
'total_area' => '土地面积',
|
||||||
'residual_area' => '剩余面积',
|
'residual_area' => '剩余面积',
|
||||||
|
@ -94,7 +95,7 @@ class LandValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
public function sceneAdd()
|
public function sceneAdd()
|
||||||
{
|
{
|
||||||
return $this->only(['title','master_name','master_phone']);
|
return $this->only(['user_id','title','master_name','master_phone']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ class LandValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
public function sceneEdit()
|
public function sceneEdit()
|
||||||
{
|
{
|
||||||
return $this->only(['id','title','master_name','master_phone']);
|
return $this->only(['id','user_id','title','master_name','master_phone']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,15 +143,4 @@ class LandValidate extends BaseValidate
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 绑定产品
|
|
||||||
* @return LandValidate
|
|
||||||
* @author likeadmin
|
|
||||||
* @date 2023/11/22 16:35
|
|
||||||
*/
|
|
||||||
public function sceneBind()
|
|
||||||
{
|
|
||||||
return $this->only(['id', 'product_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -32,6 +32,7 @@ class ProductValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'id' => 'require',
|
'id' => 'require',
|
||||||
|
'user_id' => 'require',
|
||||||
'code' => 'require',
|
'code' => 'require',
|
||||||
'name' => 'require',
|
'name' => 'require',
|
||||||
'status' => 'require',
|
'status' => 'require',
|
||||||
|
@ -44,6 +45,7 @@ class ProductValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
protected $field = [
|
protected $field = [
|
||||||
'id' => 'id',
|
'id' => 'id',
|
||||||
|
'user_id' => '用户id',
|
||||||
'code' => '产品编号',
|
'code' => '产品编号',
|
||||||
'name' => '产品名称',
|
'name' => '产品名称',
|
||||||
'status' => '产品状态',
|
'status' => '产品状态',
|
||||||
|
@ -58,7 +60,7 @@ class ProductValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
public function sceneAdd()
|
public function sceneAdd()
|
||||||
{
|
{
|
||||||
return $this->only(['code','name','status']);
|
return $this->only(['user_id','code','name','status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ class ProductValidate extends BaseValidate
|
||||||
*/
|
*/
|
||||||
public function sceneEdit()
|
public function sceneEdit()
|
||||||
{
|
{
|
||||||
return $this->only(['id','code','name','status']);
|
return $this->only(['id','user_id','code','name','status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue