This commit is contained in:
wangzenghua 2025-04-02 10:13:20 +01:00
parent edf016b1c7
commit b204de0dc7

View File

@ -34,20 +34,18 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue'; import { ref, reactive } from 'vue';
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 { 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';
const { VITE_APP_BASE_API } = import.meta.env; const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp(); const app = useApp();
const UserStore = useUserStore(); const UserStore = useUserStore();
const router = useRouter();
const crudRef = ref(null); const crudRef = ref(null);
const state = reactive({ const state = reactive({
loading: false, loading: false,
@ -147,8 +145,9 @@ const state = reactive({
disabled: true, disabled: true,
labelTip: '请先选择地块!', labelTip: '请先选择地块!',
formatter: (row) => { formatter: (row) => {
const item = state.unitList.find((v) => v.dictValue == row.unit); // const item = state.unitList.find((v) => v.dictValue == row.unit);
return row.area + (!isEmpty(item) ? item.dictLabel : '平方米'); // return row.area + (!isEmpty(item) ? item.dictLabel : '');
return row.area + (!isEmpty(row.unit) ? row.unit : '平方米');
}, },
}, },
{ {
@ -243,18 +242,18 @@ const state = reactive({
}); });
// //
const getUnit = async () => { // const getUnit = async () => {
CommonDicData('sys_unit_type') // CommonDicData('sys_unit_type')
.then((res) => { // .then((res) => {
console.log(250, res); // console.log(250, res);
if (res.code === 200) { // if (res.code === 200) {
state.unitList = res.data; // state.unitList = res.data;
} // }
}) // })
.catch((err) => { // .catch((err) => {
app.$message.error(err.msg); // app.$message.error(err.msg);
}); // });
}; // };
const loadData = async () => { const loadData = async () => {
state.loading = true; state.loading = true;
@ -281,9 +280,9 @@ const loadData = async () => {
loadData(); loadData();
onMounted(() => { // onMounted(() => {
getUnit(); // getUnit();
}); // });
// //
const currentChange = (current) => { const currentChange = (current) => {