This commit is contained in:
wangzenghua 2025-04-02 02:52:41 +01:00
parent 553b872003
commit 6c013883b3
4 changed files with 29 additions and 12 deletions

View File

@ -23,8 +23,8 @@
</template> </template>
<template #status="{ row }"> <template #status="{ row }">
<el-tag v-if="row.status == 1" type="success" size="small">启用</el-tag> <el-tag v-if="row.status == 1" type="success">启用</el-tag>
<el-tag v-if="row.status == 0" type="danger" size="small">禁用</el-tag> <el-tag v-if="row.status == 0" type="danger">禁用</el-tag>
</template> </template>
<template #menu="scope"> <template #menu="scope">
@ -34,12 +34,13 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive } from 'vue'; import { ref, reactive, onMounted } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useApp } from '@/hooks'; import { useApp } from '@/hooks';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { CRUD_OPTIONS } from '@/config'; import { CRUD_OPTIONS } from '@/config';
import { isEmpty, setDicData, debounce } from '@/utils'; import { isEmpty, setDicData, debounce } from '@/utils';
import { CommonDicData } from '@/apis';
import { getLandsList } from '@/apis/land'; import { getLandsList } from '@/apis/land';
import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity, UpdateStatus } from '@/apis/plantingAndBreeding/base'; import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity, UpdateStatus } from '@/apis/plantingAndBreeding/base';
@ -233,10 +234,23 @@ const state = reactive({
pageSize: 10, pageSize: 10,
}, },
data: [], data: [],
currentRow: {}, unitList: [],
}); });
// //
const getUnit = async () => {
CommonDicData('sys_unit_type')
.then((res) => {
console.log(250, res);
if (res.code === 200) {
state.unitList = res.data;
}
})
.catch((err) => {
app.$message.error(err.msg);
});
};
const loadData = async () => { const loadData = async () => {
state.loading = true; state.loading = true;
GetEntityList(state.query) GetEntityList(state.query)
@ -262,6 +276,10 @@ const loadData = async () => {
loadData(); loadData();
onMounted(() => {
getUnit();
});
// //
const currentChange = (current) => { const currentChange = (current) => {
state.query.current = current; state.query.current = current;
@ -384,7 +402,6 @@ const rowDel = (row, index, done) => {
// //
const remoteLandList = async (val) => { const remoteLandList = async (val) => {
if (!isEmpty(val)) return;
const query = { landName: val, current: 1, size: 20 }; const query = { landName: val, current: 1, size: 20 };
const res = await getLandsList(query); const res = await getLandsList(query);
if (res.code === 200) { if (res.code === 200) {
@ -399,8 +416,8 @@ const selectedChange = ({ item, value, dic }) => {
crudRef.value.tableForm.landName = item?.landName; crudRef.value.tableForm.landName = item?.landName;
crudRef.value.tableForm.address = item?.address; crudRef.value.tableForm.address = item?.address;
crudRef.value.tableForm.area = item?.area; crudRef.value.tableForm.area = item?.area;
crudRef.value.tableForm.unit = item?.landUnit;
crudRef.value.tableForm.provinceCode = item?.provinceCode; crudRef.value.tableForm.provinceCode = item?.provinceCode;
// crudRef.value.tableForm.provinceName = item?.provinceName;
crudRef.value.tableForm.cityCode = item?.cityCode; crudRef.value.tableForm.cityCode = item?.cityCode;
crudRef.value.tableForm.districtCode = item?.county; crudRef.value.tableForm.districtCode = item?.county;
crudRef.value.tableForm.townCode = item?.townCode; crudRef.value.tableForm.townCode = item?.townCode;

View File

@ -16,8 +16,8 @@
@row-del="rowDel" @row-del="rowDel"
> >
<template #status="{ row }"> <template #status="{ row }">
<el-tag v-if="row.status == 0" type="success" size="small">启用</el-tag> <el-tag v-if="row.status == 0" type="success">启用</el-tag>
<el-tag v-if="row.status == 1" type="danger" size="small">禁用</el-tag> <el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
</template> </template>
<template #menu="scope"> <template #menu="scope">

View File

@ -19,8 +19,8 @@
@row-del="rowDel" @row-del="rowDel"
> >
<template #status="{ row }"> <template #status="{ row }">
<el-tag v-if="row.status == 0" type="success" size="small">启用</el-tag> <el-tag v-if="row.status == 0" type="success">启用</el-tag>
<el-tag v-if="row.status == 1" type="danger" size="small">禁用</el-tag> <el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
</template> </template>
<template #menu="scope"> <template #menu="scope">

View File

@ -19,8 +19,8 @@
@row-del="rowDel" @row-del="rowDel"
> >
<template #status="{ row }"> <template #status="{ row }">
<el-tag v-if="row.status == 0" type="success" size="small">启用</el-tag> <el-tag v-if="row.status == 0" type="success">启用</el-tag>
<el-tag v-if="row.status == 1" type="danger" size="small">禁用</el-tag> <el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
</template> </template>
<template #menu="scope"> <template #menu="scope">