初始化
This commit is contained in:
parent
557827e55b
commit
78d29c53b2
|
@ -0,0 +1,7 @@
|
||||||
|
NODE_ENV = 'test'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VITE_APP_BASE_URL='http://test-suyuan.lihaink.cn'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
NODE_ENV = 'production'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VITE_APP_BASE_URL='http://ceshi-suyuan.lihaink.cn'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
NODE_ENV = 'development'
|
|
||||||
|
|
||||||
# Base API
|
|
||||||
VITE_APP_BASE_URL=''
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
NODE_ENV = 'production'
|
||||||
|
# Base API
|
||||||
|
VITE_APP_BASE_URL='https://suyuan.lihaink.cn'
|
|
@ -1,3 +0,0 @@
|
||||||
NODE_ENV = 'production'
|
|
||||||
# Base API
|
|
||||||
VITE_APP_BASE_URL=''
|
|
|
@ -3,9 +3,12 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"serve": "vite",
|
||||||
|
"dev": "vite --mode dev --port 8080",
|
||||||
|
"pro": "vite --mode pro --port 8080",
|
||||||
"preview": "vite preview --port 4173",
|
"preview": "vite preview --port 4173",
|
||||||
"build": "vite build && node scripts/release.mjs",
|
"build": "vite build && node scripts/release.mjs",
|
||||||
|
"build1": "vite build && node scripts/release.mjs && --mode build",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,11 +3,9 @@ const config = {
|
||||||
title: '后台管理系统', //网站默认标题
|
title: '后台管理系统', //网站默认标题
|
||||||
version: '1.6.0', //版本号
|
version: '1.6.0', //版本号
|
||||||
baseUrl: `${
|
baseUrl: `${
|
||||||
import.meta.env.VITE_APP_BASE_URL
|
import.meta.env.VITE_APP_BASE_URL
|
||||||
}/`, //请求接口域名
|
}/`, //请求接口域名
|
||||||
// baseUrl: 'http://127.0.0.1:30005/',
|
|
||||||
urlPrefix: 'adminapi', //请求默认前缀
|
urlPrefix: 'adminapi', //请求默认前缀
|
||||||
timeout: 10 * 1000 //请求超时时长
|
timeout: 10 * 1000 //请求超时时长
|
||||||
}
|
}
|
||||||
|
|
||||||
export default config
|
export default config
|
||||||
|
|
|
@ -10,3 +10,6 @@ const app = createApp(App)
|
||||||
app.use(install)
|
app.use(install)
|
||||||
app.provide('base_url', configs.baseUrl+configs.urlPrefix);
|
app.provide('base_url', configs.baseUrl+configs.urlPrefix);
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-popup">
|
<div class="edit-popup">
|
||||||
<popup
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="650px" @confirm="handleSubmit" @close="handleClose">
|
||||||
ref="popupRef"
|
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||||
:title="popupTitle"
|
<el-form-item label="土地ID" prop="id">
|
||||||
:async="true"
|
<el-input v-model="formData.id" disabled clearable placeholder="请输入土地ID" />
|
||||||
width="650px"
|
</el-form-item>
|
||||||
@confirm="handleSubmit"
|
<el-form-item label="土地名称" prop="title">
|
||||||
@close="handleClose"
|
<el-input v-model="formData.title" disabled clearable placeholder="请输入土地名称" />
|
||||||
>
|
</el-form-item>
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
<el-form-item label="绑定产品" prop="product_id">
|
||||||
<el-form-item label="土地ID" prop="id">
|
<el-select v-model="formData.product_id" remote filterable placeholder="请输入产品信息"
|
||||||
<el-input v-model="formData.id" disabled clearable placeholder="请输入土地ID" />
|
:remote-method="queryProduct" :loading="loading">
|
||||||
</el-form-item>
|
<el-option v-for="(item, index) in optionsData.product" :key="index" :label="item.productinfo"
|
||||||
<el-form-item label="土地名称" prop="title">
|
:value="item.id" />
|
||||||
<el-input
|
</el-select>
|
||||||
v-model="formData.title"
|
</el-form-item>
|
||||||
disabled
|
|
||||||
clearable
|
|
||||||
placeholder="请输入土地名称"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="绑定产品" prop="product_id">
|
|
||||||
<el-select
|
|
||||||
v-model="formData.product_id"
|
|
||||||
remote
|
|
||||||
filterable
|
|
||||||
placeholder="请输入产品信息"
|
|
||||||
:remote-method="queryProduct"
|
|
||||||
:loading="loading"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in optionsData.product"
|
|
||||||
:key="index"
|
|
||||||
:label="item.productinfo"
|
|
||||||
:value="item.id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</popup>
|
</popup>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,175 +1,79 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-popup">
|
<div class="edit-popup">
|
||||||
<popup
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="650px" @confirm="handleSubmit" @close="handleClose">
|
||||||
ref="popupRef"
|
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||||
:title="popupTitle"
|
<el-form-item v-if="formData.root == 1" label="所属用户" prop="user_id">
|
||||||
:async="true"
|
<el-select v-model="formData.user_id" remote filterable placeholder="请输入用户信息" :remote-method="queryUser"
|
||||||
width="650px"
|
:loading="loading">
|
||||||
@confirm="handleSubmit"
|
<el-option v-for="(item, index) in optionsData.user" :key="index" :label="item.userinfo" :value="item.id" />
|
||||||
@close="handleClose"
|
</el-select>
|
||||||
>
|
</el-form-item>
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
<el-form-item label="土地名称" prop="title">
|
||||||
<el-form-item v-if="formData.root == 1" label="所属用户" prop="user_id">
|
<el-input v-model="formData.title" clearable placeholder="请输入土地名称" />
|
||||||
<el-select
|
</el-form-item>
|
||||||
v-model="formData.user_id"
|
<el-form-item label="详细地址" prop="address">
|
||||||
remote
|
<el-input v-model="formData.address" clearable placeholder="请输入详细地址" />
|
||||||
filterable
|
</el-form-item>
|
||||||
placeholder="请输入用户信息"
|
<el-form-item label="土地面积" prop="total_area">
|
||||||
:remote-method="queryUser"
|
<el-input v-model="formData.total_area" clearable placeholder="请输入土地面积" />
|
||||||
:loading="loading"
|
</el-form-item>
|
||||||
>
|
<!-- <el-form-item label="剩余面积" prop="residual_area">
|
||||||
<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">
|
|
||||||
<el-input v-model="formData.title" clearable placeholder="请输入土地名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="详细地址" prop="address">
|
|
||||||
<el-input v-model="formData.address" clearable placeholder="请输入详细地址" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="土地面积" prop="total_area">
|
|
||||||
<el-input v-model="formData.total_area" clearable placeholder="请输入土地面积" />
|
|
||||||
</el-form-item>
|
|
||||||
<!-- <el-form-item label="剩余面积" prop="residual_area">
|
|
||||||
<el-input v-model="formData.residual_area" clearable disabled placeholder="请输入剩余面积" />
|
<el-input v-model="formData.residual_area" clearable disabled placeholder="请输入剩余面积" />
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item label="省" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" prop="province_code">
|
||||||
label="省"
|
<el-select v-model="formData.province_code" placeholder="请选择省" clearable @change="province_change"
|
||||||
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]"
|
:style="{ width: '100%' }">
|
||||||
prop="province_code"
|
<el-option v-for="(item, index) in datas.provinceOptions" :key="index" :label="item.province_name"
|
||||||
>
|
:value="item.province_code"></el-option>
|
||||||
<el-select
|
</el-select>
|
||||||
v-model="formData.province_code"
|
</el-form-item>
|
||||||
placeholder="请选择省"
|
<el-form-item label="市" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" prop="city_code">
|
||||||
clearable
|
<el-select v-model="formData.city_code" placeholder="请选择市" clearable @change="city_change"
|
||||||
@change="province_change"
|
:style="{ width: '100%' }">
|
||||||
:style="{ width: '100%' }"
|
<el-option v-for="(item, index) in datas.cityOptions" :key="index" :label="item.city_name"
|
||||||
>
|
:value="item.city_code"></el-option>
|
||||||
<el-option
|
</el-select>
|
||||||
v-for="(item, index) in datas.provinceOptions"
|
</el-form-item>
|
||||||
:key="index"
|
<el-form-item label="区" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" prop="county_code">
|
||||||
:label="item.province_name"
|
<el-select v-model="formData.county_code" placeholder="请选择区" clearable @change="area_change"
|
||||||
:value="item.province_code"
|
:style="{ width: '100%' }">
|
||||||
></el-option>
|
<el-option v-for="(item, index) in datas.areaOptions" :key="index" :label="item.county_name"
|
||||||
</el-select>
|
:value="item.county_code"></el-option>
|
||||||
</el-form-item>
|
</el-select>
|
||||||
<el-form-item
|
</el-form-item>
|
||||||
label="市"
|
<el-form-item label="镇" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" prop="town_code">
|
||||||
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]"
|
<el-select v-model="formData.town_code" placeholder="请选择镇" clearable @change="street_change"
|
||||||
prop="city_code"
|
:style="{ width: '100%' }">
|
||||||
>
|
<el-option v-for="(item, index) in datas.streetOptions" :key="index" :label="item.town_name"
|
||||||
<el-select
|
:value="item.town_code"></el-option>
|
||||||
v-model="formData.city_code"
|
</el-select>
|
||||||
placeholder="请选择市"
|
</el-form-item>
|
||||||
clearable
|
<el-form-item label="村" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" prop="village_code">
|
||||||
@change="city_change"
|
<el-select v-model="formData.village_code" placeholder="请选择村" clearable @change="village_change"
|
||||||
:style="{ width: '100%' }"
|
:style="{ width: '100%' }">
|
||||||
>
|
<el-option v-for="(item, index) in datas.villageOptions" :key="index" :label="item.village_name"
|
||||||
<el-option
|
:value="item.village_code"></el-option>
|
||||||
v-for="(item, index) in datas.cityOptions"
|
</el-select>
|
||||||
:key="index"
|
</el-form-item>
|
||||||
:label="item.city_name"
|
<el-form-item label="队" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]" prop="group_code">
|
||||||
:value="item.city_code"
|
<el-select v-model="formData.group_code" placeholder="请选择队" clearable :style="{ width: '100%' }">
|
||||||
></el-option>
|
<el-option v-for="(item, index) in datas.brigadeOptions" :key="index" :label="item.group_name"
|
||||||
</el-select>
|
:value="item.id"></el-option>
|
||||||
</el-form-item>
|
</el-select>
|
||||||
<el-form-item
|
</el-form-item>
|
||||||
label="区"
|
<el-form-item label="土地负责人" prop="master_name">
|
||||||
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]"
|
<el-input v-model="formData.master_name" clearable placeholder="请输入土地负责人" />
|
||||||
prop="county_code"
|
</el-form-item>
|
||||||
>
|
<el-form-item label="负责人电话" prop="master_phone">
|
||||||
<el-select
|
<el-input v-model="formData.master_phone" clearable placeholder="请输入负责人电话" />
|
||||||
v-model="formData.county_code"
|
</el-form-item>
|
||||||
placeholder="请选择区"
|
<!-- <el-form-item label="土地图片" prop="pic">
|
||||||
clearable
|
|
||||||
@change="area_change"
|
|
||||||
:style="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in datas.areaOptions"
|
|
||||||
:key="index"
|
|
||||||
:label="item.county_name"
|
|
||||||
:value="item.county_code"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
label="镇"
|
|
||||||
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]"
|
|
||||||
prop="town_code"
|
|
||||||
>
|
|
||||||
<el-select
|
|
||||||
v-model="formData.town_code"
|
|
||||||
placeholder="请选择镇"
|
|
||||||
clearable
|
|
||||||
@change="street_change"
|
|
||||||
:style="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in datas.streetOptions"
|
|
||||||
:key="index"
|
|
||||||
:label="item.town_name"
|
|
||||||
:value="item.town_code"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
label="村"
|
|
||||||
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]"
|
|
||||||
prop="village_code"
|
|
||||||
>
|
|
||||||
<el-select
|
|
||||||
v-model="formData.village_code"
|
|
||||||
placeholder="请选择村"
|
|
||||||
clearable
|
|
||||||
@change="village_change"
|
|
||||||
:style="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in datas.villageOptions"
|
|
||||||
:key="index"
|
|
||||||
:label="item.village_name"
|
|
||||||
:value="item.village_code"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
label="队"
|
|
||||||
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]"
|
|
||||||
prop="group_code"
|
|
||||||
>
|
|
||||||
<el-select
|
|
||||||
v-model="formData.group_code"
|
|
||||||
placeholder="请选择队"
|
|
||||||
clearable
|
|
||||||
:style="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in datas.brigadeOptions"
|
|
||||||
:key="index"
|
|
||||||
:label="item.group_name"
|
|
||||||
:value="item.id"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="土地负责人" prop="master_name">
|
|
||||||
<el-input v-model="formData.master_name" clearable placeholder="请输入土地负责人" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="负责人电话" prop="master_phone">
|
|
||||||
<el-input v-model="formData.master_phone" clearable placeholder="请输入负责人电话" />
|
|
||||||
</el-form-item>
|
|
||||||
<!-- <el-form-item label="土地图片" prop="pic">
|
|
||||||
<material-picker v-model="formData.pic" :limit="4" />
|
<material-picker v-model="formData.pic" :limit="4" />
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
</el-form>
|
</el-form>
|
||||||
</popup>
|
</popup>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="landEdit">
|
<script lang="ts" setup name="landEdit">
|
||||||
|
@ -187,10 +91,10 @@ import {
|
||||||
} from "@/api/common";
|
} from "@/api/common";
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
defineProps({
|
defineProps({
|
||||||
dictData: {
|
dictData: {
|
||||||
type: Object as PropType<Record<string, any[]>>,
|
type: Object as PropType<Record<string, any[]>>,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['success', 'close'])
|
const emit = defineEmits(['success', 'close'])
|
||||||
const formRef = shallowRef<FormInstance>()
|
const formRef = shallowRef<FormInstance>()
|
||||||
|
@ -206,127 +110,127 @@ const popupTitle = computed(() => {
|
||||||
getVillageList();
|
getVillageList();
|
||||||
getBrigadeList();
|
getBrigadeList();
|
||||||
}
|
}
|
||||||
return mode.value == 'edit' ? '编辑土地' : '新增土地'
|
return mode.value == 'edit' ? '编辑土地' : '新增土地'
|
||||||
})
|
})
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
user_id: '',
|
user_id: '',
|
||||||
root: 0,
|
root: 0,
|
||||||
title: '',
|
title: '',
|
||||||
total_area: '',
|
total_area: '',
|
||||||
residual_area: '',
|
residual_area: '',
|
||||||
province_code: '',
|
province_code: '',
|
||||||
province_name: '',
|
province_name: '',
|
||||||
city_code: '',
|
city_code: '',
|
||||||
city_name: '',
|
city_name: '',
|
||||||
county_code: '',
|
county_code: '',
|
||||||
county_name: '',
|
county_name: '',
|
||||||
town_code: '',
|
town_code: '',
|
||||||
town_name: '',
|
town_name: '',
|
||||||
village_code: '',
|
village_code: '',
|
||||||
village_name: '',
|
village_name: '',
|
||||||
group_code: '',
|
group_code: '',
|
||||||
group_name: '',
|
group_name: '',
|
||||||
master_name: '',
|
master_name: '',
|
||||||
master_phone: '',
|
master_phone: '',
|
||||||
address: '',
|
address: '',
|
||||||
pic: '',
|
pic: '',
|
||||||
mode: mode.value
|
mode: mode.value
|
||||||
})
|
})
|
||||||
|
|
||||||
// 表单验证
|
// 表单验证
|
||||||
const formRules = reactive<any>({
|
const formRules = reactive<any>({
|
||||||
title: [{
|
title: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入土地名称',
|
message: '请输入土地名称',
|
||||||
trigger: ['blur']
|
trigger: ['blur']
|
||||||
}],
|
}],
|
||||||
address: [{
|
address: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入详细地址',
|
message: '请输入详细地址',
|
||||||
trigger: ['blur']
|
trigger: ['blur']
|
||||||
}],
|
}],
|
||||||
master_name: [{
|
master_name: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入土地负责人',
|
message: '请输入土地负责人',
|
||||||
trigger: ['blur']
|
trigger: ['blur']
|
||||||
}],
|
}],
|
||||||
master_phone: [{
|
master_phone: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入负责人电话',
|
message: '请输入负责人电话',
|
||||||
trigger: ['blur']
|
trigger: ['blur']
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 获取详情
|
// 获取详情
|
||||||
const setFormData = async (data: Record<any, any>) => {
|
const setFormData = async (data: Record<any, any>) => {
|
||||||
for (const key in formData) {
|
for (const key in formData) {
|
||||||
if (data[key] != null && data[key] != undefined) {
|
if (data[key] != null && data[key] != undefined) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
formData[key] = data[key]
|
formData[key] = data[key]
|
||||||
if (key == 'pic') {
|
if (key == 'pic') {
|
||||||
formData[key] = ''
|
formData[key] = ''
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDetail = async (row: Record<string, any>) => {
|
const getDetail = async (row: Record<string, any>) => {
|
||||||
const data = await apiLandDetail({
|
const data = await apiLandDetail({
|
||||||
id: row.id
|
id: row.id
|
||||||
})
|
})
|
||||||
setFormData(data)
|
setFormData(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { optionsData } = useDictOptions<{
|
const { optionsData } = useDictOptions<{
|
||||||
user: any[]
|
user: any[]
|
||||||
}>({
|
}>({
|
||||||
user: {
|
user: {
|
||||||
api: getUserList
|
api: getUserList
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
const queryUser = async (query: string) => {
|
const queryUser = async (query: string) => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const userList = await getUserList({
|
const userList = await getUserList({
|
||||||
keyword: query ?? ''
|
keyword: query ?? ''
|
||||||
})
|
})
|
||||||
optionsData.user = userList
|
optionsData.user = userList
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate()
|
||||||
const data = { ...formData, }
|
const data = { ...formData, }
|
||||||
mode.value == 'edit'
|
mode.value == 'edit'
|
||||||
? await apiLandEdit(data)
|
? await apiLandEdit(data)
|
||||||
: await apiLandAdd(data)
|
: await apiLandAdd(data)
|
||||||
popupRef.value?.close()
|
popupRef.value?.close()
|
||||||
emit('success')
|
emit('success')
|
||||||
}
|
}
|
||||||
|
|
||||||
//打开弹窗
|
//打开弹窗
|
||||||
const open = (type = 'add') => {
|
const open = (type = 'add') => {
|
||||||
mode.value = type
|
mode.value = type
|
||||||
popupRef.value?.open()
|
popupRef.value?.open()
|
||||||
getUserInfo()
|
getUserInfo()
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
const root = res.user.root ?? 0
|
const root = res.user.root ?? 0
|
||||||
formData.root = root
|
formData.root = root
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
console.log('err', err)
|
console.log('err', err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭回调
|
// 关闭回调
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
const datas = reactive({
|
const datas = reactive({
|
||||||
|
@ -340,8 +244,8 @@ const datas = reactive({
|
||||||
function province_change(value: string) {
|
function province_change(value: string) {
|
||||||
getCityList();
|
getCityList();
|
||||||
// 给省名称赋值
|
// 给省名称赋值
|
||||||
datas['provinceOptions'].forEach((item: any) =>{
|
datas['provinceOptions'].forEach((item: any) => {
|
||||||
if(item.province_code == value) {
|
if (item.province_code == value) {
|
||||||
formData.province_name = item.province_name
|
formData.province_name = item.province_name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -373,8 +277,8 @@ const getAreaList = async () => {
|
||||||
const data = await apiAreaList({ area: formData.city_code });
|
const data = await apiAreaList({ area: formData.city_code });
|
||||||
datas["areaOptions"] = data;
|
datas["areaOptions"] = data;
|
||||||
// 市名称
|
// 市名称
|
||||||
datas['cityOptions'].forEach((item: any) =>{
|
datas['cityOptions'].forEach((item: any) => {
|
||||||
if(item.city_code == formData.city_code) {
|
if (item.city_code == formData.city_code) {
|
||||||
formData.city_name = item.city_name
|
formData.city_name = item.city_name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -383,8 +287,8 @@ const getStreetList = async () => {
|
||||||
const data = await apiStreetList({ street: formData.county_code });
|
const data = await apiStreetList({ street: formData.county_code });
|
||||||
datas["streetOptions"] = data;
|
datas["streetOptions"] = data;
|
||||||
// 区名称
|
// 区名称
|
||||||
datas['areaOptions'].forEach((item: any) =>{
|
datas['areaOptions'].forEach((item: any) => {
|
||||||
if(item.county_code == formData.county_code) {
|
if (item.county_code == formData.county_code) {
|
||||||
formData.county_name = item.county_name
|
formData.county_name = item.county_name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -392,9 +296,9 @@ const getStreetList = async () => {
|
||||||
const getVillageList = async () => {
|
const getVillageList = async () => {
|
||||||
const data = await apiVillageList({ village: formData.town_code });
|
const data = await apiVillageList({ village: formData.town_code });
|
||||||
datas["villageOptions"] = data;
|
datas["villageOptions"] = data;
|
||||||
// 镇名称
|
// 镇名称
|
||||||
datas['streetOptions'].forEach((item: any) =>{
|
datas['streetOptions'].forEach((item: any) => {
|
||||||
if(item.town_code == formData.town_code) {
|
if (item.town_code == formData.town_code) {
|
||||||
formData.town_name = item.town_name
|
formData.town_name = item.town_name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -403,8 +307,8 @@ const getBrigadeList = async () => {
|
||||||
const data = await apiBrigadeList();
|
const data = await apiBrigadeList();
|
||||||
datas["brigadeOptions"] = data;
|
datas["brigadeOptions"] = data;
|
||||||
// 镇名称
|
// 镇名称
|
||||||
datas['villageOptions'].forEach((item: any) =>{
|
datas['villageOptions'].forEach((item: any) => {
|
||||||
if(item.village_code == formData.village_code) {
|
if (item.village_code == formData.village_code) {
|
||||||
formData.village_name = item.village_name
|
formData.village_name = item.village_name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -412,8 +316,8 @@ const getBrigadeList = async () => {
|
||||||
getProvinceList(); // 初始化即请求省份数据
|
getProvinceList(); // 初始化即请求省份数据
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open,
|
open,
|
||||||
setFormData,
|
setFormData,
|
||||||
getDetail
|
getDetail
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,42 +1,34 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card class="!border-none mb-4" shadow="never">
|
<el-card class="!border-none mb-4" shadow="never">
|
||||||
<el-form
|
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||||
class="mb-[-16px]"
|
|
||||||
:model="queryParams"
|
|
||||||
inline
|
|
||||||
>
|
|
||||||
<el-form-item label="用户ID" prop="user_id">
|
<el-form-item label="用户ID" prop="user_id">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.user_id" clearable placeholder="请输入用户ID" />
|
<el-input class="w-[280px]" v-model="queryParams.user_id" clearable placeholder="请输入用户ID" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土地名称" prop="title">
|
<el-form-item label="土地名称" prop="title">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.title" clearable placeholder="请输入土地名称" />
|
<el-input class="w-[280px]" v-model="queryParams.title" clearable placeholder="请输入土地名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="土地负责人" prop="master_name">
|
<el-form-item label="土地负责人" prop="master_name">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.master_name" clearable placeholder="请输入土地负责人" />
|
<el-input class="w-[280px]" v-model="queryParams.master_name" clearable placeholder="请输入土地负责人" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="负责人电话" prop="master_phone">
|
<el-form-item label="负责人电话" prop="master_phone">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.master_phone" clearable placeholder="请输入负责人电话" />
|
<el-input class="w-[280px]" v-model="queryParams.master_phone" clearable placeholder="请输入负责人电话" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||||
<el-button @click="resetParams">重置</el-button>
|
<el-button @click="resetParams">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
<el-card class="!border-none" v-loading="pager.loading" shadow="never" >
|
||||||
<el-button v-perms="['land.land/add']" type="primary" @click="handleAdd">
|
<el-button v-perms="['land.land/add']" type="primary" @click="handleAdd">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon name="el-icon-Plus" />
|
<icon name="el-icon-Plus" />
|
||||||
</template>
|
</template>
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.land/delete']" :disabled="!selectData.length" @click="handleDelete(selectData)">
|
||||||
v-perms="['land.land/delete']"
|
|
||||||
:disabled="!selectData.length"
|
|
||||||
@click="handleDelete(selectData)"
|
|
||||||
>
|
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
|
@ -56,64 +48,36 @@
|
||||||
<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="400" align="center" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button v-perms="['land.land/edit']" type="primary" link @click="handleEdit(row)">
|
||||||
v-perms="['land.land/edit']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleEdit(row)"
|
|
||||||
>
|
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.land/bind']" type="primary" link @click="handleBind(row)">
|
||||||
v-perms="['land.land/bind']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleBind(row)"
|
|
||||||
>
|
|
||||||
绑定产品
|
绑定产品
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.product/lists']" type="primary" link>
|
||||||
v-perms="['land.product/lists']"
|
<router-link :to="{
|
||||||
type="primary"
|
path: getRoutePath('land.product/lists'),
|
||||||
link
|
query: {
|
||||||
>
|
land_id: row.id
|
||||||
<router-link
|
}
|
||||||
:to="{
|
}">
|
||||||
path: getRoutePath('land.product/lists'),
|
|
||||||
query: {
|
|
||||||
land_id: row.id
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
产品管理
|
产品管理
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" link @click="handleDetail(row)"
|
<el-button type="primary" link @click="handleDetail(row)">
|
||||||
>
|
|
||||||
土地图片
|
土地图片
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.land_plant/lists']" type="primary" link>
|
||||||
v-perms="['land.land_plant/lists']"
|
<router-link :to="{
|
||||||
type="primary"
|
path: getRoutePath('land.land_plant/lists'),
|
||||||
link
|
query: {
|
||||||
>
|
land_id: row.id
|
||||||
<router-link
|
}
|
||||||
:to="{
|
}">
|
||||||
path: getRoutePath('land.land_plant/lists'),
|
|
||||||
query: {
|
|
||||||
land_id: row.id
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
种植信息
|
种植信息
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.land/delete']" type="danger" link @click="handleDelete(row.id)">
|
||||||
v-perms="['land.land/delete']"
|
|
||||||
type="danger"
|
|
||||||
link
|
|
||||||
@click="handleDelete(row.id)"
|
|
||||||
>
|
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -130,17 +94,8 @@
|
||||||
|
|
||||||
<el-dialog v-model="dialogPicVisible" title="土地图片" center>
|
<el-dialog v-model="dialogPicVisible" title="土地图片" center>
|
||||||
<div style="display: inline-block; margin: 12px" v-for="img in detailData.picData" :key="img">
|
<div style="display: inline-block; margin: 12px" v-for="img in detailData.picData" :key="img">
|
||||||
<el-image
|
<el-image style="width: 200px; height: 200px" :src="img" :zoom-rate="1.2" :max-scale="5" :min-scale="0.2"
|
||||||
style="width: 200px; height: 200px"
|
:preview-src-list="detailData.picData" :initial-index="4" fit="cover" center />
|
||||||
:src="img"
|
|
||||||
:zoom-rate="1.2"
|
|
||||||
:max-scale="5"
|
|
||||||
:min-scale="0.2"
|
|
||||||
:preview-src-list="detailData.picData"
|
|
||||||
:initial-index="4"
|
|
||||||
fit="cover"
|
|
||||||
center
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
@ -155,6 +110,7 @@ import feedback from '@/utils/feedback'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
import BindPopup from './bind.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 bindRef = shallowRef<InstanceType<typeof BindPopup>>()
|
||||||
|
|
|
@ -1,74 +1,67 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-popup">
|
<div class="edit-popup">
|
||||||
<popup
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="650px" @confirm="handleSubmit" @close="handleClose">
|
||||||
ref="popupRef"
|
|
||||||
:title="popupTitle"
|
|
||||||
:async="true"
|
|
||||||
width="650px"
|
|
||||||
@confirm="handleSubmit"
|
|
||||||
@close="handleClose"
|
|
||||||
>
|
|
||||||
<el-form ref="formRef" :model="formData" label-width="170px" :rules="formRules">
|
<el-form ref="formRef" :model="formData" label-width="170px" :rules="formRules">
|
||||||
<el-form-item label="土壤最高温度" prop="soil_temp_max">
|
<el-form-item label="土壤最高温度" prop="soil_temp_max">
|
||||||
<el-input v-model="formData.soil_temp_max" clearable placeholder="请输入土壤最高温度" />
|
<el-input v-model="formData.soil_temp_max" clearable placeholder="请输入土壤最高温度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最低温度" prop="soil_temp_min">
|
<el-form-item label="土壤最低温度" prop="soil_temp_min">
|
||||||
<el-input v-model="formData.soil_temp_min" clearable placeholder="请输入土壤最低温度" />
|
<el-input v-model="formData.soil_temp_min" clearable placeholder="请输入土壤最低温度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最高湿度" prop="soil_mois_max">
|
<el-form-item label="土壤最高湿度" prop="soil_mois_max">
|
||||||
<el-input v-model="formData.soil_mois_max" clearable placeholder="请输入土壤最高湿度" />
|
<el-input v-model="formData.soil_mois_max" clearable placeholder="请输入土壤最高湿度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最低湿度" prop="soil_mois_min">
|
<el-form-item label="土壤最低湿度" prop="soil_mois_min">
|
||||||
<el-input v-model="formData.soil_mois_min" clearable placeholder="请输入土壤最低湿度" />
|
<el-input v-model="formData.soil_mois_min" clearable placeholder="请输入土壤最低湿度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最高PH值" prop="soil_ph_max">
|
<el-form-item label="土壤最高PH值" prop="soil_ph_max">
|
||||||
<el-input v-model="formData.soil_ph_max" clearable placeholder="请输入土壤最高PH值" />
|
<el-input v-model="formData.soil_ph_max" clearable placeholder="请输入土壤最高PH值" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最低PH值" prop="soil_ph_min">
|
<el-form-item label="土壤最低PH值" prop="soil_ph_min">
|
||||||
<el-input v-model="formData.soil_ph_min" clearable placeholder="请输入土壤最低PH值" />
|
<el-input v-model="formData.soil_ph_min" clearable placeholder="请输入土壤最低PH值" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最高氮含量" prop="soil_n_content_max">
|
<el-form-item label="土壤最高氮含量" prop="soil_n_content_max">
|
||||||
<el-input v-model="formData.soil_n_content_max" clearable placeholder="请输入土壤最高氮含量" />
|
<el-input v-model="formData.soil_n_content_max" clearable placeholder="请输入土壤最高氮含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最低氮含量" prop="soil_n_content_min">
|
<el-form-item label="土壤最低氮含量" prop="soil_n_content_min">
|
||||||
<el-input v-model="formData.soil_n_content_min" clearable placeholder="请输入土壤最低氮含量" />
|
<el-input v-model="formData.soil_n_content_min" clearable placeholder="请输入土壤最低氮含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最高磷含量" prop="soil_p_content_max">
|
<el-form-item label="土壤最高磷含量" prop="soil_p_content_max">
|
||||||
<el-input v-model="formData.soil_p_content_max" clearable placeholder="请输入土壤最高磷含量" />
|
<el-input v-model="formData.soil_p_content_max" clearable placeholder="请输入土壤最高磷含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最低磷含量" prop="soil_p_content_min">
|
<el-form-item label="土壤最低磷含量" prop="soil_p_content_min">
|
||||||
<el-input v-model="formData.soil_p_content_min" clearable placeholder="请输入土壤最低磷含量" />
|
<el-input v-model="formData.soil_p_content_min" clearable placeholder="请输入土壤最低磷含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最高钾含量" prop="soil_k_content_max">
|
<el-form-item label="土壤最高钾含量" prop="soil_k_content_max">
|
||||||
<el-input v-model="formData.soil_k_content_max" clearable placeholder="请输入土壤最高钾含量" />
|
<el-input v-model="formData.soil_k_content_max" clearable placeholder="请输入土壤最高钾含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土壤最低钾含量" prop="soil_k_content_min">
|
<el-form-item label="土壤最低钾含量" prop="soil_k_content_min">
|
||||||
<el-input v-model="formData.soil_k_content_min" clearable placeholder="请输入土壤最低钾含量" />
|
<el-input v-model="formData.soil_k_content_min" clearable placeholder="请输入土壤最低钾含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="空气最高温度" prop="air_temp_max">
|
<el-form-item label="空气最高温度" prop="air_temp_max">
|
||||||
<el-input v-model="formData.air_temp_max" clearable placeholder="请输入空气最高温度" />
|
<el-input v-model="formData.air_temp_max" clearable placeholder="请输入空气最高温度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="空气最低温度" prop="air_temp_min">
|
<el-form-item label="空气最低温度" prop="air_temp_min">
|
||||||
<el-input v-model="formData.air_temp_min" clearable placeholder="请输入空气最低温度" />
|
<el-input v-model="formData.air_temp_min" clearable placeholder="请输入空气最低温度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="空气最高湿度" prop="air_mois_max">
|
<el-form-item label="空气最高湿度" prop="air_mois_max">
|
||||||
<el-input v-model="formData.air_mois_max" clearable placeholder="请输入空气最高湿度" />
|
<el-input v-model="formData.air_mois_max" clearable placeholder="请输入空气最高湿度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="空气最低湿度" prop="air_mois_min">
|
<el-form-item label="空气最低湿度" prop="air_mois_min">
|
||||||
<el-input v-model="formData.air_mois_min" clearable placeholder="请输入空气最低湿度" />
|
<el-input v-model="formData.air_mois_min" clearable placeholder="请输入空气最低湿度" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="空气最大二氧化碳含量" prop="air_co2_content_max">
|
<el-form-item label="空气最大二氧化碳含量" prop="air_co2_content_max">
|
||||||
<el-input v-model="formData.air_co2_content_max" clearable placeholder="请输入空气最大二氧化碳含量" />
|
<el-input v-model="formData.air_co2_content_max" clearable placeholder="请输入空气最大二氧化碳含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="空气最小二氧化碳含量" prop="air_co2_content_min">
|
<el-form-item label="空气最小二氧化碳含量" prop="air_co2_content_min">
|
||||||
<el-input v-model="formData.air_co2_content_min" clearable placeholder="请输入空气最小二氧化碳含量" />
|
<el-input v-model="formData.air_co2_content_min" clearable placeholder="请输入空气最小二氧化碳含量" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="最大风速" prop="wind_speed_max">
|
<el-form-item label="最大风速" prop="wind_speed_max">
|
||||||
<el-input v-model="formData.wind_speed_max" clearable placeholder="请输入最大风速" />
|
<el-input v-model="formData.wind_speed_max" clearable placeholder="请输入最大风速" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="最小风速" prop="wind_speed_min">
|
<el-form-item label="最小风速" prop="wind_speed_min">
|
||||||
<el-input v-model="formData.wind_speed_min" clearable placeholder="请输入最小风速" />
|
<el-input v-model="formData.wind_speed_min" clearable placeholder="请输入最小风速" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</popup>
|
</popup>
|
||||||
</div>
|
</div>
|
||||||
|
@ -251,7 +244,7 @@ const getDetail = async (row: Record<string, any>) => {
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate()
|
||||||
const data = { ...formData, }
|
const data = { ...formData, }
|
||||||
mode.value == 'edit'
|
mode.value == 'edit'
|
||||||
? await apiMonitorThresholdEdit(data)
|
? await apiMonitorThresholdEdit(data)
|
||||||
: await apiMonitorThresholdAdd(data)
|
: await apiMonitorThresholdAdd(data)
|
||||||
|
|
|
@ -81,6 +81,7 @@ const handleAdd = async () => {
|
||||||
// 编辑
|
// 编辑
|
||||||
const handleEdit = async (data: any) => {
|
const handleEdit = async (data: any) => {
|
||||||
showEdit.value = true
|
showEdit.value = true
|
||||||
|
|
||||||
await nextTick()
|
await nextTick()
|
||||||
editRef.value?.open('edit')
|
editRef.value?.open('edit')
|
||||||
editRef.value?.setFormData(data)
|
editRef.value?.setFormData(data)
|
||||||
|
|
|
@ -1,44 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-popup">
|
<div class="edit-popup">
|
||||||
<popup
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="650px" @confirm="handleSubmit" @close="handleClose">
|
||||||
ref="popupRef"
|
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
||||||
:title="popupTitle"
|
<el-form-item label="产品ID" prop="id">
|
||||||
:async="true"
|
<el-input v-model="formData.id" disabled clearable placeholder="请输入产品ID" />
|
||||||
width="650px"
|
</el-form-item>
|
||||||
@confirm="handleSubmit"
|
<el-form-item label="产品名称" prop="name">
|
||||||
@close="handleClose"
|
<el-input v-model="formData.name" disabled clearable placeholder="请输入产品名称" />
|
||||||
>
|
</el-form-item>
|
||||||
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
|
<el-form-item label="绑定设备" prop="device_id">
|
||||||
<el-form-item label="产品ID" prop="id">
|
<el-select v-model="formData.device_id" filterable multiple remote reserve-keyword placeholder="请输入设备信息"
|
||||||
<el-input v-model="formData.id" disabled clearable placeholder="请输入产品ID" />
|
:remote-method="queryDevice" :loading="loading">
|
||||||
</el-form-item>
|
<el-option v-for="(item, index) in optionsData.device" :key="index" :label="item.deviceinfo"
|
||||||
<el-form-item label="产品名称" prop="name">
|
:value="item.id" />
|
||||||
<el-input
|
</el-select>
|
||||||
v-model="formData.name"
|
</el-form-item>
|
||||||
disabled
|
|
||||||
clearable
|
|
||||||
placeholder="请输入产品名称"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="绑定设备" prop="device_id">
|
|
||||||
<el-select
|
|
||||||
v-model="formData.device_id"
|
|
||||||
filterable
|
|
||||||
multiple
|
|
||||||
remote
|
|
||||||
reserve-keyword
|
|
||||||
placeholder="请输入设备信息"
|
|
||||||
:remote-method="queryDevice"
|
|
||||||
:loading="loading"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in optionsData.device"
|
|
||||||
:key="index"
|
|
||||||
:label="item.deviceinfo"
|
|
||||||
:value="item.id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</popup>
|
</popup>
|
||||||
</div>
|
</div>
|
||||||
|
@ -116,7 +92,7 @@ const queryDevice = async (query: string) => {
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate()
|
||||||
const data = { ...formData, }
|
const data = { ...formData, }
|
||||||
await apiProductBind(data)
|
await apiProductBind(data)
|
||||||
popupRef.value?.close()
|
popupRef.value?.close()
|
||||||
emit('success')
|
emit('success')
|
||||||
|
|
|
@ -1,84 +1,45 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-popup">
|
<div class="edit-popup">
|
||||||
<popup
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
|
||||||
ref="popupRef"
|
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||||
:title="popupTitle"
|
<el-form-item label="产品名称" prop="name">
|
||||||
:async="true"
|
<el-input v-model="formData.name" clearable placeholder="请输入产品名称" />
|
||||||
width="550px"
|
</el-form-item>
|
||||||
@confirm="handleSubmit"
|
<el-form-item label="产品编号" prop="code">
|
||||||
@close="handleClose"
|
<el-input v-model="formData.code" clearable disabled placeholder="请输入产品编号" />
|
||||||
>
|
</el-form-item>
|
||||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
<el-form-item label="产品介绍" prop="desc">
|
||||||
<el-form-item label="产品名称" prop="name">
|
<el-input v-model="formData.desc" />
|
||||||
<el-input v-model="formData.name" clearable placeholder="请输入产品名称" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="产品图" prop="image">
|
||||||
<el-form-item label="产品编号" prop="code">
|
<el-upload class="avatar-uploader" :accept="acceptFileTypes" v-model="formData.image" :data="{ cid: 1 }"
|
||||||
<el-input v-model="formData.code" clearable disabled placeholder="请输入产品编号" />
|
:headers="{ Token: userStore.token }" :action="action" :show-file-list="false"
|
||||||
</el-form-item>
|
:on-success="handleAvatarSuccessAvatar">
|
||||||
<el-form-item label="产品介绍" prop="desc">
|
<img v-if="formData.image" :src="formData.image" class="avatar" />
|
||||||
<el-input v-model="formData.desc" />
|
<div v-else class="avatar-uploader-icon">
|
||||||
</el-form-item>
|
<el-icon>
|
||||||
<el-form-item label="产品图" prop="image">
|
<Plus />
|
||||||
<el-upload
|
</el-icon>
|
||||||
class="avatar-uploader"
|
</div>
|
||||||
:accept="acceptFileTypes"
|
</el-upload>
|
||||||
v-model="formData.image"
|
|
||||||
:data="{ cid: 1 }"
|
|
||||||
:headers="{ Token: userStore.token }"
|
|
||||||
:action="action"
|
|
||||||
:show-file-list="false"
|
|
||||||
:on-success="handleAvatarSuccessAvatar"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
v-if="formData.image"
|
|
||||||
:src="formData.image"
|
|
||||||
class="avatar"
|
|
||||||
/>
|
|
||||||
<div v-else class="avatar-uploader-icon">
|
|
||||||
<el-icon>
|
|
||||||
<Plus />
|
|
||||||
</el-icon>
|
|
||||||
</div>
|
|
||||||
</el-upload>
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="formData.root == 1" label="所属用户" prop="user_id">
|
<el-form-item v-if="formData.root == 1" label="所属用户" prop="user_id">
|
||||||
<el-select
|
<el-select v-model="formData.user_id" remote filterable placeholder="请输入用户信息" :remote-method="queryUser"
|
||||||
v-model="formData.user_id"
|
@change="selectedUser" :loading="loading">
|
||||||
remote
|
<el-option v-for="(item, index) in optionsData.user" :key="index" :label="item.userinfo"
|
||||||
filterable
|
:value="item.id" />
|
||||||
placeholder="请输入用户信息"
|
</el-select>
|
||||||
:remote-method="queryUser"
|
</el-form-item>
|
||||||
@change="selectedUser"
|
|
||||||
:loading="loading"
|
|
||||||
>
|
|
||||||
<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="land_id">
|
<el-form-item label="所属土地" prop="land_id">
|
||||||
<el-select
|
<el-select v-model="formData.land_id" remote filterable placeholder="请输入土地信息" :remote-method="queryLand"
|
||||||
v-model="formData.land_id"
|
:loading="loading">
|
||||||
remote
|
<el-option v-for="(item, index) in optionsData.land" :key="index" :label="item.landinfo"
|
||||||
filterable
|
:value="item.id" />
|
||||||
placeholder="请输入土地信息"
|
</el-select>
|
||||||
:remote-method="queryLand"
|
</el-form-item>
|
||||||
:loading="loading"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in optionsData.land"
|
|
||||||
:key="index"
|
|
||||||
:label="item.landinfo"
|
|
||||||
:value="item.id"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</popup>
|
</popup>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,16 +47,17 @@
|
||||||
|
|
||||||
<script lang="ts" setup name="productEdit">
|
<script lang="ts" setup name="productEdit">
|
||||||
import { useDictOptions } from '@/hooks/useDictOptions'
|
import { useDictOptions } from '@/hooks/useDictOptions'
|
||||||
import { type FormInstance,
|
import {
|
||||||
type UploadProps,
|
type FormInstance,
|
||||||
ElMessage,
|
type UploadProps,
|
||||||
} from 'element-plus'
|
ElMessage,
|
||||||
|
} from 'element-plus'
|
||||||
import Popup from '@/components/popup/index.vue'
|
import Popup from '@/components/popup/index.vue'
|
||||||
import { apiProductAdd, apiProductEdit, apiProductDetail, getUserList, getUserInfo, apiLandLists } from '@/api/product'
|
import { apiProductAdd, apiProductEdit, apiProductDetail, getUserList, getUserInfo, apiLandLists } from '@/api/product'
|
||||||
import { timeFormat } from '@/utils/util'
|
import { timeFormat } from '@/utils/util'
|
||||||
import useUserStore from "@/stores/modules/user";
|
import useUserStore from "@/stores/modules/user";
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import {ref} from "vue";
|
import { ref } from "vue";
|
||||||
import config from "@/config";
|
import config from "@/config";
|
||||||
defineProps({
|
defineProps({
|
||||||
dictData: {
|
dictData: {
|
||||||
|
@ -115,11 +77,11 @@ const handleAvatarSuccessAvatar: UploadProps["onSuccess"] = (
|
||||||
response,
|
response,
|
||||||
uploadFile
|
uploadFile
|
||||||
) => {
|
) => {
|
||||||
if (response.code == 0) {
|
if (response.code == 0) {
|
||||||
ElMessage.error(response.msg);
|
ElMessage.error(response.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formData.image = response.data.uri;
|
formData.image = response.data.uri;
|
||||||
};
|
};
|
||||||
// 弹窗标题
|
// 弹窗标题
|
||||||
const popupTitle = computed(() => {
|
const popupTitle = computed(() => {
|
||||||
|
@ -164,7 +126,7 @@ const setFormData = async (data: Record<any, any>) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
formData.create_time = timeFormat(formData.create_time,'yyyy-mm-dd hh:MM:ss')
|
formData.create_time = timeFormat(formData.create_time, 'yyyy-mm-dd hh:MM:ss')
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDetail = async (row: Record<string, any>) => {
|
const getDetail = async (row: Record<string, any>) => {
|
||||||
|
@ -261,33 +223,33 @@ defineExpose({
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.avatar-uploader .avatar {
|
.avatar-uploader .avatar {
|
||||||
width: 178px;
|
width: 178px;
|
||||||
height: 178px;
|
height: 178px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.avatar-uploader .el-upload {
|
.avatar-uploader .el-upload {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 130px;
|
height: 130px;
|
||||||
border: 1px dashed var(--el-border-color);
|
border: 1px dashed var(--el-border-color);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: var(--el-transition-duration-fast);
|
transition: var(--el-transition-duration-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-uploader .el-upload:hover {
|
.avatar-uploader .el-upload:hover {
|
||||||
border-color: var(--el-color-primary);
|
border-color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-icon.avatar-uploader-icon {
|
.el-icon.avatar-uploader-icon {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
color: #8c939d;
|
color: #8c939d;
|
||||||
width: 178px;
|
width: 178px;
|
||||||
height: 178px;
|
height: 178px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -1,40 +1,29 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card class="!border-none mb-4" shadow="never">
|
<el-card class="!border-none mb-4" shadow="never">
|
||||||
<el-form
|
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||||
class="mb-[-16px]"
|
|
||||||
:model="queryParams"
|
|
||||||
inline
|
|
||||||
>
|
|
||||||
<el-form-item label="用户ID" prop="user_id">
|
<el-form-item label="用户ID" prop="user_id">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.user_id" clearable placeholder="请输入用户ID" />
|
<el-input class="w-[280px]" v-model="queryParams.user_id" clearable placeholder="请输入用户ID" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="土地ID" prop="land_id">
|
<el-form-item label="土地ID" prop="land_id">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.land_id" clearable placeholder="请输入土地ID" />
|
<el-input class="w-[280px]" v-model="queryParams.land_id" clearable placeholder="请输入土地ID" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="产品编号" prop="code">
|
<el-form-item label="产品编号" prop="code">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入产品编号" />
|
<el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入产品编号" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="产品名称" prop="name">
|
<el-form-item label="产品名称" prop="name">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入产品名称" />
|
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入产品名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="产品状态" prop="status">
|
<el-form-item label="产品状态" prop="status">
|
||||||
<el-select class="w-[280px]" v-model="queryParams.status" clearable placeholder="请选择产品状态">
|
<el-select class="w-[280px]" v-model="queryParams.status" clearable placeholder="请选择产品状态">
|
||||||
<el-option label="全部" value=""></el-option>
|
<el-option label="全部" value=""></el-option>
|
||||||
<el-option
|
<el-option v-for="(item, index) in dictData.product_status" :key="index" :label="item.name"
|
||||||
v-for="(item, index) in dictData.product_status"
|
:value="item.value" />
|
||||||
:key="index"
|
</el-select>
|
||||||
:label="item.name"
|
</el-form-item>
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间" prop="create_time">
|
<el-form-item label="创建时间" prop="create_time">
|
||||||
<daterange-picker
|
<daterange-picker v-model:startTime="queryParams.start_time" v-model:endTime="queryParams.end_time" />
|
||||||
v-model:startTime="queryParams.start_time"
|
</el-form-item>
|
||||||
v-model:endTime="queryParams.end_time"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||||
|
@ -49,11 +38,7 @@
|
||||||
</template>
|
</template>
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.product/delete']" :disabled="!selectData.length" @click="handleDelete(selectData)">
|
||||||
v-perms="['land.product/delete']"
|
|
||||||
:disabled="!selectData.length"
|
|
||||||
@click="handleDelete(selectData)"
|
|
||||||
>
|
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
|
@ -75,51 +60,34 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="产品状态" align="center" prop="status">
|
<el-table-column label="产品状态" align="center" prop="status">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<dict-value :options="dictData.product_status" :value="row.status" />
|
<dict-value :options="dictData.product_status" :value="row.status" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" width="180" align="center" prop="create_time">
|
<el-table-column label="创建时间" width="180" align="center" prop="create_time">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<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="300" align="center" fixed="right">
|
<el-table-column label="操作" width="300" align="center" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button
|
<el-button v-perms="['land.product/edit']" type="primary" link @click="handleEdit(row)">
|
||||||
v-perms="['land.product/edit']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleEdit(row)"
|
|
||||||
>
|
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.product/bind']" type="primary" link @click="handleBind(row)">
|
||||||
v-perms="['land.product/bind']"
|
|
||||||
type="primary"
|
|
||||||
link
|
|
||||||
@click="handleBind(row)"
|
|
||||||
>
|
|
||||||
绑定设备
|
绑定设备
|
||||||
</el-button>
|
</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="{
|
path: getRoutePath('device.device/lists'),
|
||||||
path: getRoutePath('device.device/lists'),
|
query: {
|
||||||
query: {
|
product_id: row.id
|
||||||
product_id: row.id
|
}
|
||||||
}
|
}">
|
||||||
}"
|
|
||||||
>
|
|
||||||
设备管理
|
设备管理
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button v-perms="['land.product/delete']" type="danger" link @click="handleDelete(row.id)">
|
||||||
v-perms="['land.product/delete']"
|
|
||||||
type="danger"
|
|
||||||
link
|
|
||||||
@click="handleDelete(row.id)"
|
|
||||||
>
|
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -148,7 +116,7 @@ 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 bindRef = shallowRef<InstanceType<typeof BindPopup>>()
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
const bindEdit = ref(false)
|
const bindEdit = ref(false)
|
||||||
|
|
Loading…
Reference in New Issue