This commit is contained in:
lzc 2025-03-20 14:55:42 +08:00
commit 141a3553e0
21 changed files with 844 additions and 156 deletions

View File

@ -4,6 +4,7 @@ VITE_APP_TITLE = '数字农业产业管理平台'
VITE_APP_SUB_OS = '//192.168.18.99:88/sub-operation-service/' VITE_APP_SUB_OS = '//192.168.18.99:88/sub-operation-service/'
VITE_APP_SUB_ADMIN = '//192.168.18.99:88/sub-admin/' VITE_APP_SUB_ADMIN = '//192.168.18.99:88/sub-admin/'
VITE_APP_SUB_GAS = '//192.168.18.99:88/sub-government-affairs-service/' VITE_APP_SUB_GAS = '//192.168.18.99:88/sub-government-affairs-service/'
VITE_APP_SUB_GSS = '//192.168.18.99:88/sub-government-screen-service/'
# 接口 # 接口
VITE_APP_BASE_API = '/apis' VITE_APP_BASE_API = '/apis'
VITE_APP_BASE_URL = '' VITE_APP_BASE_URL = ''

View File

@ -4,8 +4,9 @@ VITE_APP_TITLE = '数字农业产业管理平台'
VITE_APP_SUB_OS = '//localhost:8090/sub-operation-service/' VITE_APP_SUB_OS = '//localhost:8090/sub-operation-service/'
VITE_APP_SUB_ADMIN = '//localhost:8090/sub-admin/' VITE_APP_SUB_ADMIN = '//localhost:8090/sub-admin/'
VITE_APP_SUB_GAS = '//localhost:8090/sub-government-affairs-service/' VITE_APP_SUB_GAS = '//localhost:8090/sub-government-affairs-service/'
VITE_APP_SUB_GSS = '//localhost:8090/sub-government-screen-service/'
# 接口 # 接口
VITE_APP_BASE_API = '/apis' VITE_APP_BASE_API = '/apis'
VITE_APP_BASE_URL = '' VITE_APP_BASE_URL = ''
VITE_APP_UPLOAD_API = '/uploadApis' VITE_APP_UPLOAD_API = '/uploadApis'
VITE_APP_UPLOAD_URL = '' VITE_APP_UPLOAD_URL = ''

View File

@ -0,0 +1,15 @@
import request from '@/utils/axios';
/**
* @Title: 上传图片
*/
export function CommonUpload(data, params) {
return request({
url: `/upload`,
method: 'POST',
apisType: 'upload',
uploadType: 'multipart/form-data',
data,
params,
});
}

View File

@ -0,0 +1,39 @@
<template>
<iframe v-if="state.url" :src="state.url" frameborder="0" width="100%" height="100%" @load="onLoad"></iframe>
</template>
<script setup name="custom-iframe">
import { reactive, watch } from 'vue';
import { isExternal } from '@/utils/validate';
const props = defineProps({
url: {
type: String,
required: true,
},
});
const emit = defineEmits(['on-load']);
const state = reactive({
url: '',
loaded: false,
});
watch(
() => props.url,
(val) => {
if (isExternal(val)) {
state.url = val;
}
},
{
immediate: true,
}
);
const onLoad = () => {
state.loaded = true;
emit('on-load', state.loaded);
};
</script>

View File

@ -7,7 +7,7 @@
--> -->
<template> <template>
<section class="rich-editor"> <section class="rich-editor">
<Toolbar class="rich-editor-toolbar" :editor="refEditor" :default-config="options.toolbarConfig" :mode="mode" /> <Toolbar v-show="toolbarShow" class="rich-editor-toolbar" :editor="refEditor" :default-config="options.toolbarConfig" :mode="mode" />
<Editor <Editor
v-model="valueHtml" v-model="valueHtml"
class="rich-editor-toolbar" class="rich-editor-toolbar"
@ -29,6 +29,7 @@ import { shallowRef, ref, computed, nextTick, onBeforeUnmount, onMounted } from
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'; import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
import { isEmpty } from '@/utils'; import { isEmpty } from '@/utils';
// import { CommonUpload, UploadImageFromEditor } from '@/apis/common'; // import { CommonUpload, UploadImageFromEditor } from '@/apis/common';
import { imageUpload } from './upFile';
const { VITE_APP_OSS_URL } = import.meta.env; const { VITE_APP_OSS_URL } = import.meta.env;
@ -63,29 +64,17 @@ export default {
maxFileSize: 10 * 1024 * 1024, //10M maxFileSize: 10 * 1024 * 1024, //10M
maxNumberOfFiles: 10, maxNumberOfFiles: 10,
allowedFileTypes: ['image/*'], allowedFileTypes: ['image/*'],
async customUpload(file, insertFn) { customUpload: imageUpload,
// if (isEmpty(file.name)) return;
// const data = {
// key: file.name,
// size: file.size,
// contentType: file.type,
// expiresInSecond: 3600,
// };
// const res = await UploadImageFromEditor(data);
// if (res.code === 200) {
// await CommonUpload({
// url: res.data.url,
// file,
// });
// insertFn(VITE_APP_OSS_URL + res.data.key, file.name, res.data.key);
// }
},
}, },
}, },
}, },
}; };
}, },
}, },
toolbarShow: {
type: Boolean,
default: true,
},
}, },
emits: ['focus', 'blur', 'change', 'update:value'], emits: ['focus', 'blur', 'change', 'update:value'],
setup(props, cxt) { setup(props, cxt) {

View File

@ -0,0 +1,10 @@
import { CommonUpload } from '../../apis/common';
export async function imageUpload(file, insertFn) {
let formData = new FormData();
formData.append('file', file);
let res = await CommonUpload(formData);
if (res.code == 200) {
insertFn(res.data.url, file.name, res.data.key);
}
}

View File

@ -1,4 +1,5 @@
import SvgIcon from './svg-icon'; import SvgIcon from './svg-icon';
import CustomIframe from './custom-iframe';
import CustomTableOperate from './custom-table-operate'; import CustomTableOperate from './custom-table-operate';
import CustomTableTree from './custom-table-tree'; import CustomTableTree from './custom-table-tree';
import CustomCarouselPicture from './custom-carousel-picture'; import CustomCarouselPicture from './custom-carousel-picture';
@ -16,6 +17,7 @@ import CustomEchartPie3d from './custom-echart-pie-3d';
export { export {
SvgIcon, SvgIcon,
CustomIframe,
CustomTableOperate, CustomTableOperate,
CustomTableTree, CustomTableTree,
CustomCarouselPicture, CustomCarouselPicture,

View File

@ -14,7 +14,7 @@ import { usePermissionStore } from '@/store/modules/permission';
NProgress.configure({ showSpinner: false }); NProgress.configure({ showSpinner: false });
const { VITE_APP_TITLE } = import.meta.env; const { VITE_APP_TITLE } = import.meta.env;
const whiteList = ['/login']; const whiteList = ['/login', '/sub-government-affairs-service/trace-info'];
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
NProgress.start(); NProgress.start();

View File

@ -45,7 +45,7 @@ export function isHttp(url) {
* @returns {Boolean} * @returns {Boolean}
*/ */
export function isExternal(path) { export function isExternal(path) {
return /^(https?:|mailto:|tel:)/.test(path); return /^(http?:|https?:|mailto:|tel:)/.test(path);
} }
/** /**

View File

@ -1,7 +1,9 @@
import * as redBlackApi from './redAndBlank'; import * as redBlackApi from './redAndBlank';
import * as materialApi from './material'; import * as materialApi from './material';
import * as knowledgeApi from './knowledge';
export default { export default {
...materialApi, ...materialApi,
...redBlackApi, ...redBlackApi,
...knowledgeApi,
}; };

View File

@ -0,0 +1,14 @@
import request from '@/utils/axios';
export function getQuestionList(params) {
return request('/input/knowledge/page', {
params,
});
}
export function getQuestionReply(data) {
return request('/input/knowledge/reply', {
data,
method: 'PUT',
});
}

View File

@ -2,8 +2,7 @@ import request from '@/utils/axios';
/* 获取物资类型 */ /* 获取物资类型 */
export function getMaterailTypes(params) { export function getMaterailTypes(params) {
return request({ return request('/input/common/getList', {
url: '/input/common/getList',
params, params,
}); });
} }

View File

@ -60,51 +60,51 @@ const inputSuppliesRoutes = [
}, },
], ],
}, },
{
path: '/sub-government-affairs-service/productionDealer',
name: 'productionDealer',
component: Views,
meta: { title: '生产经销商管理', icon: 'Document' },
redirect: '/sub-government-affairs-service/productionDealer/pesticideDealer',
children: [
{
path: '/sub-government-affairs-service/productionDealer/pesticideDealer',
name: 'input-supplies-pesticide-dealer',
component: () => import('@/views/inputSuppliesManage/productionDealer/pesticideDealer/index.vue'),
meta: { title: '农药经销商管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/productionDealer/fertilizerDealer',
name: 'input-supplies-fertilizer-dealer',
component: () => import('@/views/inputSuppliesManage/productionDealer/fertilizerDealer/index.vue'),
meta: { title: '肥料经销商管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/productionDealer/ratPoisonDealer',
name: 'input-supplies-ratPoison-dealer',
component: () => import('@/views/inputSuppliesManage/productionDealer/ratPoisonDealer/index.vue'),
meta: { title: '兽药经销商管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/productionDealer/farmMachineryDealer',
name: 'input-supplies-farmMachinery-dealer',
component: () => import('@/views/inputSuppliesManage/productionDealer/farmMachineryDealer/index.vue'),
meta: { title: '农机经销商管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/productionDealer/seedDealer',
name: 'input-supplies-seed-dealer',
component: () => import('@/views/inputSuppliesManage/productionDealer/seedDealer/index.vue'),
meta: { title: '种源经销商管理', icon: 'Document' },
},
],
},
// { // {
// path: '/sub-government-affairs-service/enterpriseDealer', // path: '/sub-government-affairs-service/productionDealer',
// name: 'enterpriseDealer', // name: 'productionDealer',
// component: () => import('@/views/inputSuppliesManage/enterpriseDealer/index.vue'), // component: Views,
// meta: { title: '企业经销商抽检', icon: 'Document' }, // meta: { title: '生产经销商管理', icon: 'Document' },
// redirect: '/sub-government-affairs-service/productionDealer/pesticideDealer',
// children: [
// {
// path: '/sub-government-affairs-service/productionDealer/pesticideDealer',
// name: 'input-supplies-pesticide-dealer',
// component: () => import('@/views/inputSuppliesManage/productionDealer/pesticideDealer/index.vue'),
// meta: { title: '农药经销商管理', icon: 'Document' },
// },
// {
// path: '/sub-government-affairs-service/productionDealer/fertilizerDealer',
// name: 'input-supplies-fertilizer-dealer',
// component: () => import('@/views/inputSuppliesManage/productionDealer/fertilizerDealer/index.vue'),
// meta: { title: '肥料经销商管理', icon: 'Document' },
// },
// {
// path: '/sub-government-affairs-service/productionDealer/ratPoisonDealer',
// name: 'input-supplies-ratPoison-dealer',
// component: () => import('@/views/inputSuppliesManage/productionDealer/ratPoisonDealer/index.vue'),
// meta: { title: '兽药经销商管理', icon: 'Document' },
// },
// {
// path: '/sub-government-affairs-service/productionDealer/farmMachineryDealer',
// name: 'input-supplies-farmMachinery-dealer',
// component: () => import('@/views/inputSuppliesManage/productionDealer/farmMachineryDealer/index.vue'),
// meta: { title: '农机经销商管理', icon: 'Document' },
// },
// {
// path: '/sub-government-affairs-service/productionDealer/seedDealer',
// name: 'input-supplies-seed-dealer',
// component: () => import('@/views/inputSuppliesManage/productionDealer/seedDealer/index.vue'),
// meta: { title: '种源经销商管理', icon: 'Document' },
// },
// ],
// }, // },
{
path: '/sub-government-affairs-service/enterpriseDealerCheck',
name: 'enterpriseDealerCheck',
component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
meta: { title: '企业经销商抽检', icon: 'Document' },
},
// { // {
// path: '/sub-government-affairs-service/useSupervise', // path: '/sub-government-affairs-service/useSupervise',
// name: 'useSupervise', // name: 'useSupervise',

View File

@ -33,12 +33,12 @@ export default [
component: () => import('@/views/plantingAndBreeding/epidemicDisease/index.vue'), component: () => import('@/views/plantingAndBreeding/epidemicDisease/index.vue'),
meta: { title: '疫病监测信息', icon: 'Document' }, meta: { title: '疫病监测信息', icon: 'Document' },
}, },
// { {
// path: '/sub-government-affairs-service/breeding-base-information', path: '/sub-government-affairs-service/breeding-base-information',
// name: 'breeding-base-information', name: 'breeding-base-information',
// component: () => import('@/views/plantingAndBreeding/base/index.vue'), component: () => import('@/views/plantingAndBreeding/base/index.vue'),
// meta: { title: '种养殖基地', icon: 'Document' }, meta: { title: '种养殖基地', icon: 'Document' },
// }, },
], ],
}, },
]; ];

View File

@ -1,20 +0,0 @@
<template>
<CustomCard> 企业经销商抽检 </CustomCard>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,183 @@
<template>
<CustomCard>
<h2>企业经销商抽检</h2>
<br />
<avue-crud
v-model:search="searchCondition"
v-model:page="pageData"
:data="data"
:option="option"
:loading="_loading"
@search-change="
(form, done) => {
getData(1);
done();
}
"
@search-reset="() => getData(1)"
@current-change="getData"
@size-change="getData"
@row-save="handleRowSave"
@row-update="handleRowUpdate"
>
<template #emnu="{ row }">
<el-button>button</el-button>
</template>
</avue-crud>
</CustomCard>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { CRUD_OPTIONS } from '@/config';
import { size } from 'lodash';
onMounted(getData);
/* --------------- data --------------- */
// #region
const _loading = ref(false);
const searchCondition = ref({
keywords: '',
});
const pageData = ref({
currentPage: 1,
pageSize: 10,
total: 0,
});
const data = ref([]);
const option = reactive({
...CRUD_OPTIONS,
selection: false,
column: [
{
hide: true,
search: true,
label: '关键字',
prop: 'keywords',
},
{
label: '任务编号',
prop: 'taskNum',
rules: [
{
required: true,
message: '请选择任务类型',
trigger: 'change',
},
],
},
{
label: '任务类型',
prop: 'taskType',
type: 'select',
render: ({ row }) => {
return row.taskType == '0' ? '直接创建' : '民众投诉';
},
dicData: [
{ label: '直接创建', value: '0' },
{ label: '民众投诉', value: '1' },
],
rules: [
{
required: true,
message: '请选择任务类型',
trigger: 'change',
},
],
},
{
label: '企业名称',
prop: 'enterpriseName',
rules: [
{
required: true,
message: '请选择任务类型',
trigger: 'change',
},
],
},
{
label: '企业法人',
prop: 'enterpriseOwner',
rules: [
{
required: true,
message: '请选择任务类型',
trigger: 'change',
},
],
},
{
label: '联系电话',
prop: 'phone',
rules: [
{
required: true,
message: '请选择任务类型',
trigger: 'change',
},
],
},
{
label: '状态',
prop: 'status',
render: ({ row }) => {
return row.status == '0' ? '未完成' : '已完成';
},
rules: [
{
required: true,
message: '请选择任务类型',
trigger: 'change',
},
],
},
],
});
// #endregion
/* --------------- methods --------------- */
// #region
async function getData(resetPage) {
resetPage === 1 && (pageData.value.currentPage = 1);
_loading.value = true;
let params = Object.assign(
{
currentPage: pageData.value.currentPage,
size: pageData.value.pageSize,
},
searchCondition.value
);
console.log('params', params);
for (let i = 0; i < 14; i++) {
data.value.push({
taskNum: '20220101' + `${i}${i}${i}${i}${i}`,
taskType: i % 2 == 0 ? '0' : '1',
enterpriseName: '上海XX有限公司',
enterpriseOwner: '张三',
phone: '123456789',
status: i % 2 == 0 ? '0' : '1',
});
}
pageData.value.total = data.value.length;
_loading.value = false;
}
function handleRowSave(row, done, loading) {
console.log('row', row);
loading();
done();
}
function handleRowUpdate(row, index, done, loading) {
console.log('row', row);
loading();
done();
}
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -7,6 +7,7 @@
:data="data" :data="data"
:option="option" :option="option"
:table-loading="_loading" :table-loading="_loading"
:before-close="handleDialogClose"
@search-change="handleSearch" @search-change="handleSearch"
@search-reset="handleSearchReset" @search-reset="handleSearchReset"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
@ -17,8 +18,14 @@
<template #menu="scope"> <template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" /> <custom-table-operate :actions="actions" :data="scope" />
</template> </template>
<template #replyContent-form> <template #replyContent-form="{ type }">
<custom-rich-editor v-model:value="richText" :read-only="true" /> <custom-rich-editor
v-show="richText || type != 'view'"
v-model:value="richText"
:toolbar-show="type != 'view'"
:read-only="type == 'view'"
:style="{ margin: `${type != 'view' ? '0' : 14}px 0` }"
/>
</template> </template>
</avue-crud> </avue-crud>
</CustomCard> </CustomCard>
@ -28,6 +35,8 @@
import { ref, reactive, onMounted, h } from 'vue'; import { ref, reactive, onMounted, h } from 'vue';
import CustomCard from '@/components/CustomCard.vue'; import CustomCard from '@/components/CustomCard.vue';
import { CRUD_OPTIONS } from '@/config'; import { CRUD_OPTIONS } from '@/config';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';
onMounted(getData); onMounted(getData);
/* --------------- data --------------- */ /* --------------- data --------------- */
@ -36,19 +45,19 @@ const curdRef = ref();
const _loading = ref(false); const _loading = ref(false);
const data = ref([]); const data = ref([]);
const searchCondition = ref({ const searchCondition = ref({
keywords: '', problemName: '',
status: '', status: '',
}); });
const option = reactive({ const option = reactive({
...CRUD_OPTIONS, ...CRUD_OPTIONS,
addBtn: false, addBtn: false,
selection: false, selection: false,
dialogWidth: 800, dialogWidth: '60%',
editTitle: '回复', editTitle: '回复',
column: [ column: [
{ {
label: '关键词', label: '关键词',
prop: 'keywords', prop: 'problemName',
hide: true, hide: true,
search: true, search: true,
editDisplay: false, editDisplay: false,
@ -69,46 +78,46 @@ const option = reactive({
}, },
{ {
label: '名称', label: '名称',
prop: 'question', prop: 'problemName',
renderForm: ({ row }) => { renderForm: ({ row }) => {
return h('span', {}, row.question); return h('span', {}, row.problemName);
}, },
span: 24, span: 24,
}, },
{ {
label: '提问时间', label: '提问时间',
prop: 'questionDate', prop: 'createTime',
viewDisplay: false, viewDisplay: false,
renderForm: ({ row }) => { renderForm: ({ row }) => {
return h('span', {}, row.questionDate); return h('span', {}, row.createTime);
}, },
span: 24, span: 24,
}, },
{
hide: true,
label: '回复内容',
prop: 'replyContent',
span: 24,
},
{ {
label: '专家姓名', label: '专家姓名',
prop: 'expertName', prop: 'expertName',
editDisplay: false, editDisplay: false,
viewDisplay: false, span: 24,
}, },
{ {
label: '回复时间', label: '回复时间',
prop: 'replyDate', prop: 'updateTime',
editDisplay: false, editDisplay: false,
viewDisplay: false,
},
{
label: '回复内容Text',
prop: 'replyContentText',
editDisplay: false,
viewDisplay: false,
},
{
hide: true,
label: '回复内容',
prop: 'replyContent',
viewDisplay: false,
span: 24, span: 24,
}, },
// {
// label: 'Text',
// prop: 'replyContentText',
// editDisplay: false,
// viewDisplay: false,
// render: ({ row }) => row.replyContent,
// },
], ],
}); });
const pageData = reactive({ const pageData = reactive({
@ -135,7 +144,8 @@ const richText = ref();
/* --------------- methods --------------- */ /* --------------- methods --------------- */
// #region // #region
function getData() { async function getData() {
_loading.value = true;
let params = Object.assign( let params = Object.assign(
{ {
currentPage: pageData.currentPage, currentPage: pageData.currentPage,
@ -143,19 +153,23 @@ function getData() {
}, },
searchCondition.value searchCondition.value
); );
console.log('params', params); let res = await inputSuppliesApi.getQuestionList(params);
_loading.value = false;
for (let i = 0; i < 13; i++) { if (res.code == 200) {
data.value.push({ data.value = res.data.records;
id: i + Date.now(), pageData.total = res.data.total;
question: '我是问题' + i,
questionDate: '2022-01-01',
expertName: '专家' + i,
replyDate: '2022-01-01',
replyContent: `<ol><li>${i}${i}${i}${i}${i}</li></ol><ul><li>😂😂</li></ul><p><strong>333</strong></p><p><span style="color: rgb(9, 109, 217);">4534</span></p>`,
status: !(i % 2) ? '0' : '1',
});
} }
// for (let i = 0; i < 13; i++) {
// data.value.push({
// id: i + Date.now(),
// problemName: '' + i,
// createTime: '2022-01-01',
// expertName: '' + i,
// updateTime: '2022-01-01',
// replyContent: `<ol><li>${i}${i}${i}${i}${i}</li></ol><ul><li>😂😂</li></ul><p><strong>333</strong></p><p><span style="color: rgb(9, 109, 217);">4534</span></p>`,
// status: !(i % 2) ? '0' : '1',
// });
// }
} }
function handleSearch(form, done) { function handleSearch(form, done) {
resetGet(); resetGet();
@ -165,31 +179,45 @@ function handleSearchReset() {
resetGet(); resetGet();
} }
function handleCurrentChange(val) { function handleCurrentChange(val) {
console.log(val); pageData.currentPage = val;
getData();
} }
function handleSizeChange(val) { function handleSizeChange(val) {
console.log(val); pageData.size = val;
resetGet();
} }
function handleRowUpdate(form, done, loading) { async function handleRowUpdate(form, index, done, loading) {
console.log('rich', richText.value); let data = {
console.log('update ', form); id: form.id,
replyContent: richText.value,
};
let res = await inputSuppliesApi.getQuestionReply(data);
loading(); loading();
if (res.code == 200) {
ElMessage.success('回复成功!');
getData();
done();
}
} }
function handleRowSave(form, done, loading) { function handleRowSave(form, done, loading) {
loading(); loading();
} }
function resetGet() { function resetGet() {
pageData.currentPage = 1; pageData.currentPage = 1;
getData; getData();
} }
function handleReply({ row }) { function handleReply({ row }) {
console.log('reply', row);
curdRef.value.rowEdit(row); curdRef.value.rowEdit(row);
} }
function handleInfo(row) { function handleInfo({ row }) {
console.log('info', row); richText.value = row.replyContent;
curdRef.value.rowView(row); curdRef.value.rowView(row);
} }
function handleDialogClose(done) {
richText.value = '';
done();
}
// #endregion // #endregion
</script> </script>

View File

@ -1,6 +1,411 @@
<template> <template>
<div class="custom-page">种养殖基地信息</div> <div class="custom-page">
<el-row :gutter="20">
<el-col :span="4">
<custom-table-tree title="种养殖基地分类" :data="landTypeData" @node-click="onNodeClick" />
</el-col>
<el-col :span="20">
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:search="state.query"
v-model:page="state.pageData"
:table-loading="state.loading"
:data="state.data"
:option="state.options"
@refresh-change="refreshChange"
@search-reset="searchChange"
@search-change="searchChange"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@row-del="rowDel"
@row-save="rowSave"
@row-update="rowUpdate"
>
<template #menu-left>
<!-- <el-button type="primary" icon="plus" @click="rowAdd">添加</el-button> -->
<el-button type="danger" icon="delete" @click="onDel(state.selection)">批量删除</el-button>
</template>
<template #status="{ row }">
<el-tag v-if="row.status == 1" type="success" size="small">启用</el-tag>
<el-tag v-if="row.status == 0" type="danger" size="small">禁用</el-tag>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
</avue-crud>
</el-col>
</el-row>
</div>
</template> </template>
<script setup> <script setup>
import { ref, computed, watch } from 'vue'; import { ref, reactive } from 'vue';
import { useRouter } from 'vue-router';
import { useApp } from '@/hooks';
import { useUserStore } from '@/store/modules/user';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, mockData, sleep } from '@/utils';
const { VITE_APP_BASE_API, VITE_APP_NAME } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const router = useRouter();
const crudRef = ref(null);
const landTypeData = ref([
{
label: '基地分类',
id: '0',
children: [
{ label: '种植基地', id: '01', children: [], pId: '0' },
{ label: '养殖基地', id: '02', children: [], pId: '0' },
],
},
]);
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
},
form: {},
selection: [],
options: {
...CRUD_OPTIONS,
addBtnText: '添加',
// addBtn: false,
selection: true,
column: [
{
label: '基地名称',
prop: 'p1',
search: true,
width: 200,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
overHidden: true,
},
{
label: '地块名',
prop: 'p2',
width: 200,
type: 'cascader',
// hide: true,
// addDisplay: true,
// editDisplay: true,
// viewDisplay: false,
// props: {
// label: 'areaName',
// value: 'areaCode',
// children: 'areaChildVOS',
// },
// dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
// dicHeaders: {
// authorization: UserStore.token,
// },
// dicFormatter: (res) => res.data ?? [],
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
overHidden: true,
},
{
label: '区域位置',
prop: 'p3',
width: 200,
overHidden: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '区域面积',
prop: 'p4',
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '基地分类',
prop: 'type',
type: 'select',
dicData: [
{
label: '种植基地',
value: 1,
},
{
label: '养殖基地',
value: 2,
},
],
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '状态',
prop: 'status',
type: 'select',
dicData: [
{
label: '启用',
value: 1,
},
{
label: '禁用',
value: 0,
},
],
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '负责人',
prop: 'p5',
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '联系电话',
prop: 'p6',
width: 150,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '创建时间',
prop: 'createTime',
width: 150,
// search: true,
display: false,
},
{
label: '更新时间',
prop: 'updateTime',
width: 150,
display: false,
},
],
actions: [
{
name: '查看',
icon: 'view',
event: ({ row }) => rowView(row),
},
{
name: '编辑',
icon: 'edit',
event: ({ row }) => rowEdit(row),
},
// {
// type: 'success',
// name: ({ row }) => {
// return row.status === 1 ? '' : '';
// },
// icon: ({ row }) => {
// return row.status === 1 ? 'turnOff' : 'open';
// },
// event: ({ row }) => rowStatus(row),
// },
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => rowDel(row),
},
],
},
pageData: {
total: 0,
currentPage: 1,
pageSize: 10,
},
data: [],
currentRow: {},
});
const loadData = async () => {
//state.loading = true;
// GetEntityList(state.query)
// .then((res) => {
// if (res.code === 200) {
// const { current, size, total, records } = res.data;
// state.data = records;
// state.pageData = {
// currentPage: current || 1,
// pageSize: size || 10,
// total: total,
// };
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// state.data = [];
// })
// .finally(() => {
// state.loading = false;
// });
state.loading = true;
await sleep(500);
state.data = mockData(
{
p1: '202501基地',
p2: '耿马镇1号地块',
p3: '耿马傣族佤族自治县/耿马镇',
p4: '1000',
p5: '张三',
p6: '13837633838',
status: 1,
type: 1,
createTime: '2025-01-01',
updateTime: '2025-01-15',
},
10
);
state.loading = false;
};
loadData();
const onNodeClick = (data) => {
console.log('onNodeClick', data);
};
//
const currentChange = (current) => {
state.query.current = current;
loadData();
};
//
const sizeChange = (size) => {
state.query.size = size;
loadData();
};
//
const searchChange = (params, done) => {
if (done) done();
state.query = params;
state.query.current = 1;
loadData();
};
//
const refreshChange = () => {
loadData();
app.$message.success('刷新成功');
};
//
const selectionChange = (rows) => {
state.selection = rows;
};
//
const rowView = (row) => {
crudRef.value.rowView(row);
};
//
const rowStatus = (row) => {
console.info('操作状态');
};
//
const onAdd = () => {
crudRef.value && crudRef.value.rowAdd();
};
const rowSave = (row, done, loading) => {
// AddEntity(row)
// .then((res) => {
// if (res.code === 200) {
// app.$message.success('');
// done();
// loadData();
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// })
// .finally(() => {
// loading();
// });
};
//
const rowEdit = (row) => {
crudRef.value && crudRef.value.rowEdit(row);
};
const rowUpdate = (row, index, done, loading) => {
// UpdateEntity(row)
// .then((res) => {
// if (res.code === 200) {
// app.$message.success('');
// done();
// loadData();
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// })
// .finally(() => {
// loading();
// });
};
//
const onDel = (rows = []) => {
if (isEmpty(rows)) return;
const ids = rows.map((item) => item.id);
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
// DeleteEntity({ ids: ids.join(',') })
// .then((res) => {
// if (res.code === 200) {
// app.$message.success('');
// loadData();
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// });
})
.catch(() => {});
};
const rowDel = (row, index, done) => {
onDel([row]);
};
</script> </script>

View File

@ -56,16 +56,26 @@ const landTypeData = ref([
id: '0', id: '0',
children: [ children: [
{ label: '耕地', id: '01', children: [], pId: '0' }, { label: '耕地', id: '01', children: [], pId: '0' },
{ label: '园地', children: [], id: '02', pId: '0' }, { label: '林地', children: [], id: '02', pId: '0' },
{ label: '草地', children: [], id: '03', pId: '0' },
{ label: '农田水利用地', children: [], id: '04', pId: '0' },
{ label: '养殖水面', children: [], id: '05', pId: '0' },
], ],
}, },
{ {
label: '建设用地', label: '建设用地',
id: '1', id: '1',
children: [{ label: '城乡建设用地', children: [], id: '11', pId: '10' }], children: [
{ label: '城乡住宅用地', children: [], id: '11', pId: '10' },
{ label: '公共设施用地', children: [], id: '11', pId: '10' },
{ label: '工矿仓储用地', children: [], id: '11', pId: '10' },
{ label: '交通水利设施用地', children: [], id: '11', pId: '10' },
{ label: '旅游用地', children: [], id: '11', pId: '10' },
{ label: '军事设施用地', children: [], id: '11', pId: '10' },
],
}, },
{ {
label: '住宅用地', label: '未利用地',
id: '2', id: '2',
children: [], children: [],
}, },

View File

@ -109,16 +109,16 @@ const UserStore = useUserStore();
const router = useRouter(); const router = useRouter();
const crudRef = ref(null); const crudRef = ref(null);
const landTypeData = ref([ const landTypeData = ref([
{ // {
label: '疫病分类', // label: '',
id: '0', // id: '0',
children: [ // children: [
{ label: '家禽类', id: '01', children: [], pId: '0' }, { label: '家禽类', id: '01', children: [], pId: '0' },
{ label: '家畜类', id: '02', children: [], pId: '0' }, { label: '家畜类', id: '02', children: [], pId: '0' },
{ label: '水产类', id: '03', children: [], pId: '0' }, { label: '水产类', id: '03', children: [], pId: '0' },
{ label: '特种养殖类', id: '04', children: [], pId: '0' }, { label: '特种养殖类', id: '04', children: [], pId: '0' },
], // ],
}, // },
]); ]);
const state = reactive({ const state = reactive({
loading: false, loading: false,

View File

@ -53,16 +53,26 @@ const landTypeData = ref([
id: '0', id: '0',
children: [ children: [
{ label: '耕地', id: '01', children: [], pId: '0' }, { label: '耕地', id: '01', children: [], pId: '0' },
{ label: '园地', children: [], id: '02', pId: '0' }, { label: '林地', children: [], id: '02', pId: '0' },
{ label: '草地', children: [], id: '03', pId: '0' },
{ label: '农田水利用地', children: [], id: '04', pId: '0' },
{ label: '养殖水面', children: [], id: '05', pId: '0' },
], ],
}, },
{ {
label: '建设用地', label: '建设用地',
id: '1', id: '1',
children: [{ label: '城乡建设用地', children: [], id: '11', pId: '10' }], children: [
{ label: '城乡住宅用地', children: [], id: '11', pId: '10' },
{ label: '公共设施用地', children: [], id: '11', pId: '10' },
{ label: '工矿仓储用地', children: [], id: '11', pId: '10' },
{ label: '交通水利设施用地', children: [], id: '11', pId: '10' },
{ label: '旅游用地', children: [], id: '11', pId: '10' },
{ label: '军事设施用地', children: [], id: '11', pId: '10' },
],
}, },
{ {
label: '住宅用地', label: '未利用地',
id: '2', id: '2',
children: [], children: [],
}, },