feat:删除无用文件

This commit is contained in:
李想 2025-03-27 15:56:05 +08:00
parent b89b787838
commit b590d3671e
42 changed files with 474 additions and 1348 deletions

View File

@ -1,75 +0,0 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useId: typeof import('vue')['useId']
const useLink: typeof import('vue-router')['useLink']
const useModel: typeof import('vue')['useModel']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}

View File

@ -1,17 +0,0 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
CustomCard: typeof import('./src/components/CustomCard.vue')['default']
GridSelect: typeof import('./src/components/GridSelect.vue')['default']
LandType: typeof import('./src/components/LandType.vue')['default']
Pagina: typeof import('./src/components/Pagina.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}

View File

@ -6,6 +6,9 @@ export function getMaterailTypes(params) {
params,
});
}
/* ------ 农药 ------ */
// #region
/* 获取农药列表 */
export function getPesticideList(params) {
return request('/inputGoods/pesticide/page', {
@ -19,3 +22,28 @@ export function addPesticide(data) {
data,
});
}
/* 农药检测报告 */
export function pesticideReportSave(data) {
return request('/inputGoods/pesticide/uploadReport', {
data,
method: 'PUT',
});
}
// #endregion
/* ------ 肥料 ------ */
// #region
export function getFertilizreList(params) {
return request('/inputGoods/fertilize/page', {
params,
});
}
export function addFertilizer(data) {
return request('/inputGoods/fertilize/save', {
method: 'POST',
data,
});
}
// #endregion
//

View File

@ -1,21 +0,0 @@
<template>
<el-card body-class="custom_content_card_" :shadow="props.shadow">
<slot></slot>
</el-card>
</template>
<script setup>
const props = defineProps({
shadow: {
type: String,
default: 'never',
},
});
</script>
<style lang="scss">
.el-card:has(.custom_content_card_) {
border: none !important;
border-radius: 10px !important;
}
</style>

View File

@ -1,94 +0,0 @@
<template>
<el-select-v2
v-model="val"
:options="options"
:placeholder="props.set.placeholder"
:props="props.set.props"
:multiple="props.set.multiple"
@change="handleSelect"
/>
</template>
<script setup>
import { ref, onMounted, watch } from 'vue';
import request from '@/utils/axios';
const emit = defineEmits(['update:value']);
const props = defineProps({
set: {
type: Object,
default: () => {
return {
url: '',
options: [
{
value: '1',
label: 'label 1',
},
{
value: '2',
label: 'label 2',
},
{
value: '3',
label: 'label 3',
},
],
props: {
value: 'value',
label: 'label',
},
multiple: false,
placeholder: '请选择',
};
},
},
value: {
type: String || Array || null,
default: null,
},
});
onMounted(async () => {
if (props.set.multiple) val.value = [];
if (props.set.url) {
let res = await request(props.set.url, {
method: 'get',
data: { current: 1, size: 9999 },
});
if (res.code == 200) {
options.value = res.data.records;
}
} else {
options.value = props.set.options;
}
});
/* --------------- data --------------- */
// #region
const val = ref(null);
watch(
() => props.value,
() => {
val.value = props.value;
},
{
deep: true,
immediate: true,
}
);
const options = ref([]);
// #endregion
/* --------------- methods --------------- */
// #region
function handleSelect(val_) {
emit('update:value', val_);
}
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,44 +0,0 @@
<template>
<el-select-v2 v-model="val" :options="options" placeholder="请选择网格" :props="_props" @change="handleSelect" />
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { GetEntityList } from '@/apis/grid.js';
const emit = defineEmits(['update:value']);
const props = defineProps({
//
value: {
type: String || null,
default: null,
},
});
onMounted(async () => {
let res = await GetEntityList();
if (res.code == 200) {
options.value = res.data.records;
}
});
/* --------------- data --------------- */
// #region
const val = ref(null);
const options = ref([]);
const _props = {
value: 'id',
label: 'productName',
};
// #endregion
/* --------------- methods --------------- */
// #region
function handleSelect(val_) {
emit('update:value', val_);
}
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,60 +0,0 @@
<template>
<el-select v-model="val" @change="change">
<el-option v-for="item in options" :key="`land_type_${item.value}`" :value="item.value" :label="item.label" :placeholder="props.placeholder">
{{ item.label }}
</el-option>
</el-select>
</template>
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
//
value: {
type: String || Number || null,
default: null,
},
placeholder: {
type: String,
default: '请选择',
},
});
const emit = defineEmits(['update:value']);
/* --------------- data --------------- */
// #region
const val = ref(null);
watch(
() => props.value,
() => {
val.value = props.value || props.value == 0 ? String(props.value) : null;
},
{
deep: true,
immediate: true,
}
);
const options = ref([
{ label: '耕地', value: '0' },
{ label: '果园', value: '1' },
{ label: '茶园', value: '2' },
{ label: '其他园地', value: '3' },
{ label: '林地', value: '4' },
{ label: '草地', value: '5' },
{ label: '其他农用地', value: '6' },
{ label: '农村宅基地', value: '7' },
]);
// #endregion
/* --------------- methods --------------- */
// #region
function change(val_) {
val.value = val_;
emit('update:value', val_);
}
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,54 +0,0 @@
<template>
<el-select v-model="val" @change="change">
<el-option v-for="item in options" :key="`land_type_${item.value}`" :value="item.value" :label="item.label" :placeholder="props.placeholder">
{{ item.label }}
</el-option>
</el-select>
</template>
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
//
value: {
type: String || Number || null,
default: null,
},
placeholder: {
type: String,
default: '请选择',
},
});
const emit = defineEmits(['update:value']);
/* --------------- data --------------- */
// #region
const val = ref(null);
watch(
() => props.value,
() => {
val.value = props.value || props.value == 0 ? String(props.value) : null;
},
{
deep: true,
immediate: true,
}
);
const options = ref([
{ label: '是', value: '0' },
{ label: '否', value: '1' },
]);
// #endregion
/* --------------- methods --------------- */
// #region
function change(val_) {
val.value = val_;
emit('update:value', val_);
}
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,55 +0,0 @@
<template>
<el-select v-model="val" @change="change">
<el-option v-for="item in options" :key="`land_type_${item.value}`" :value="item.value" :label="item.label" :placeholder="props.placeholder">
{{ item.label }}
</el-option>
</el-select>
</template>
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
//
value: {
type: String || Number || null,
default: null,
},
placeholder: {
type: String,
default: '请选择',
},
});
const emit = defineEmits(['update:value']);
/* --------------- data --------------- */
// #region
const val = ref(null);
watch(
() => props.value,
() => {
val.value = props.value || props.value == 0 ? String(props.value) : null;
},
{
deep: true,
immediate: true,
}
);
const options = ref([
{ label: '农用地', value: '0' },
{ label: '住宅用地', value: '1' },
{ label: '园林', value: '2' },
]);
// #endregion
/* --------------- methods --------------- */
// #region
function change(val_) {
val.value = val_;
emit('update:value', val_);
}
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,72 +0,0 @@
<template>
<section :style="{ '--right': props.right ? 'flex-end' : 'unset' }">
<el-pagination
v-model:current-page="curPage"
v-model:page-size="curSize"
:page-sizes="[10, 20, 30, 40, 50, 100]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="curTotal"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</section>
</template>
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
pageData: {
type: Object,
default: () => {
return {
page: 1,
size: 10,
total: 0,
};
},
},
pageSizes: {
type: Array,
default: () => {
return [10, 20, 30, 40, 50, 100];
},
},
right: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['pageChange', 'sizeChange']);
const curPage = ref(1);
const curSize = ref(10);
const curTotal = ref(0);
watch(
() => props.pageData,
() => {
curPage.value = props.pageData.page || 1;
curSize.value = props.pageData.size || 10;
curTotal.value = props.pageData.total || 0;
},
{
deep: true,
immediate: true,
}
);
function handleCurrentChange(val) {
emit('pageChange', val);
}
function handleSizeChange(val) {
emit('sizeChange', val);
}
</script>
<style lang="scss" scoped>
section {
display: flex;
justify-content: var(--right);
}
</style>

View File

@ -44,28 +44,27 @@ export const CRUD_VIEW_OPTIONS = {
/**
* @Title: 生成avue校验规则
* @param {Object} set 校验配置对象
* @param {string} set.disabled 默认校验项是否禁用
* @param {string} set.msg 校验失败提示
* @param {Array<string>} set.trigger 校验触发条件
* @param {Array} set.otherRules 其他校验规则
* @returns {Array} 校验规则数组
*/
export function customRules(set = {}) {
const obj = Object.assign(
{
msg: '必要参数,不能为空',
trigger: ['change', 'blur'],
otherRules: [],
},
set
);
const { msg, trigger, otherRules } = obj;
let rulesArr = [
{
export function customRules(set = { disabled: false }) {
let _set = {
msg: '必要参数,不能为空',
trigger: ['change', 'blur'],
otherRules: [],
};
_set = Object.assign(_set, set);
const { msg, trigger, otherRules } = _set;
let rulesArr = [...otherRules];
if (!set.disabled) {
rulesArr.unshift({
required: true,
message: msg,
trigger,
},
...otherRules,
];
});
}
return rulesArr;
}

View File

@ -34,12 +34,12 @@ const inputSuppliesRoutes = [
component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
meta: { title: '农药管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/material/fertilizer',
name: 'input-supplies-fertilizer',
component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
meta: { title: '肥料管理', icon: 'Document' },
},
// {
// path: '/sub-government-affairs-service/material/fertilizer',
// name: 'input-supplies-fertilizer',
// component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
// meta: { title: '肥料管理', icon: 'Document' },
// },
// {
// path: '/sub-government-affairs-service/material/ratPoison',
// name: 'input-supplies-ratPoison',

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<el-form ref="searchRef" :model="searchCondition">
<el-row :gutter="20">
<el-col :span="6">
@ -117,13 +117,12 @@
</div>
</template>
</el-dialog>
</CustomCard>
</section>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import Pagina from '@/components/pagina.vue';
import CustomCard from '@/components/CustomCard.vue';
import { getAnnualList, saveAnnual, editAnnual, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
import { useApp } from '@/hooks';
import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils';

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<div>
<el-row :gutter="20">
<el-col :span="4">
@ -50,13 +50,12 @@
</el-col>
</el-row>
</div>
</CustomCard>
</section>
</template>
<script setup>
import { ref, reactive, onMounted, nextTick } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import CustomCard from '@/components/CustomCard.vue';
import { getLandTypeTree, landTypeSave, getLandType, exportLandType, delLandType, editLandType } from '@/apis/baseInfo';
import { ElMessage } from 'element-plus';

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<avue-crud
ref="crudRef"
v-model:page="pageData"
@ -23,11 +23,10 @@
<custom-table-operate :actions="actions" :data="scope" />
</template>
</avue-crud>
</CustomCard>
</section>
</template>
<script setup>
import CustomCard from '@/components/CustomCard.vue';
import useSoilTypeHook from './useSoilTypeHook';
const {

View File

@ -1,7 +1,7 @@
<template>
<el-menu mode="horizontal" class="input_supplies_type_menu_" :default-active="ac" @select="handleTypeSelect">
<template v-for="item in types" :key="`type_menu_${item.value}`">
<el-menu-item v-if="!item.children" :index="item.value">{{ item.label }}</el-menu-item>
<el-menu-item v-if="!item.children || !item.children.length" :index="item.value">{{ item.label }}</el-menu-item>
<SubMenu v-else :types="item" />
</template>
</el-menu>

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<h2>企业经销商抽检</h2>
<br />
<avue-crud
@ -24,12 +24,11 @@
<el-button type="primary">详情</el-button>
</template>
</avue-crud>
</CustomCard>
</section>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { CRUD_OPTIONS } from '@/config';
import { size } from 'lodash';

View File

@ -21,7 +21,7 @@ export function useBasicInfo(set = {}) {
5: [{ value: '0', label: '全部' }],
});
/* 不包含顶级 */
const materialTwoLevel = ref({});
const materialTwoLevel = reactive({});
/* ------ 农药 ------ */
// #region
@ -50,13 +50,16 @@ export function useBasicInfo(set = {}) {
res.data.forEach((item) => {
const { moduleType, children } = item;
materialTypes[moduleType].push(...handleTypes(children));
// materialTwoLevel.value[moduleType] = handleTypes(children);
handleTwoLevel();
});
console.log('materialTypes --- ', materialTypes);
console.log('materialTwoLevel --- ', materialTwoLevel.value);
console.log('materialTwoLevel --- ', materialTwoLevel);
}
loadFinish.value = true;
let t = setInterval(() => {
loadFinish.value = false;
clearInterval(t);
}, 1000);
}
/* 将所有的数据处理成value label格式方便其他地方指直接使用 */
function handleTypes(arr) {
@ -72,10 +75,10 @@ export function useBasicInfo(set = {}) {
/* 处理二级及以下的联动数据 */
function handleTwoLevel() {
for (let key in materialTypes) {
materialTwoLevel.value[key] = {};
materialTwoLevel[key] = {};
materialTypes[key].forEach((v) => {
if (v.value != 0) {
materialTwoLevel.value[key][v.dataType] = v.children;
materialTwoLevel[key][v.dataType] = v.children;
}
});
}
@ -113,11 +116,35 @@ export function useBasicInfo(set = {}) {
});
return _arr;
}
const _timer = ref(null);
function defaultGet(fc = () => {}) {
_timer.value = setTimeout(() => {
clearTimeout(_timer.value);
if (loadFinish.value) {
fc();
} else {
defaultGet(fc);
}
}, 200);
}
/* t 1规格 2用量 */
function handleNumUnit(num, unit, t) {
let text = '';
if (num && unit) {
if (t == 1) {
text = `${num}${(goodsUnitOptions.find((_v) => _v.value == unit) || { label: '' }).label}`;
} else {
console.log('goodsUnitOptions --- ', (useDosageUnit.find((_v) => _v.value == unit) || { label: '' }).label);
text = `${num}${(useDosageUnit.find((_v) => _v.value == unit) || { label: '' }).label}`;
}
}
return text;
}
// #endregion
onMounted(getmaterialType);
return {
defaultGet,
loadFinish,
materialTypes,
materialTwoLevel,
@ -126,5 +153,6 @@ export function useBasicInfo(set = {}) {
getmaterialType,
targetName,
filterTypes,
handleNumUnit,
};
}

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 投入品资源一张图 </CustomCard>
<section class="custom-page"> 投入品资源一张图 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<avue-crud
ref="curdRef"
v-model:page="pageData"
@ -28,12 +28,11 @@
/>
</template>
</avue-crud>
</CustomCard>
</section>
</template>
<script setup>
import { ref, reactive, onMounted, h } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { CRUD_OPTIONS } from '@/config';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<h2>农机租赁管理</h2>
<br />
<avue-crud
@ -31,12 +31,11 @@
<Attrs v-model:attrs="contractAttrs" :type="type" :file-num="2" />
</template>
</avue-crud>
</CustomCard>
</section>
</template>
<script setup>
import { ref, reactive, onMounted, h } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { CRUD_OPTIONS, customRules } from '@/config';
import Attrs from '../common/Attrs.vue';
import inputSuppliesApi from '@/apis/inputSuppliesApi';

View File

@ -1,12 +1,11 @@
<template>
<CustomCard>
<section class="custom-page">
<section>农机</section>
</CustomCard>
</section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,25 +1,71 @@
<template>
<CustomCard>
<section class="custom-page">
<h2>肥料基本信息</h2>
<TypeMenu v-model:type="type" />
<TypeMenu v-if="materialTypes[1].length > 1" v-model:type="_type" :types="materialTypes['2']" />
<br />
<avue-crud ref="crud" v-model:page="pageData" :data="data" :option="option"></avue-crud>
</CustomCard>
<avue-crud
ref="crud"
v-model:page="pageData"
v-model:search="searchCondition"
:data="data"
:table-loading="_loading"
:option="option"
@current-change="getData"
@size-change="getData(1)"
@row-save="handleRowSave"
>
<template #menu="{ row }">
aa
<!-- <el-button type="primary" @click="handleEdit(row)">上传报告</el-button> -->
<!-- <el-button @click="handleInfo(row)">详情</el-button> -->
</template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
</template>
<template #_productSpecification-form="{ value, type }">
<NumberSelect v-if="type == 'add'" v-model:value="productSpecification" :options="goodsUnitOptions" />
<span v-if="type == 'view'">{{ value }}</span>
</template>
<template #_suggest-form="{ value, type }">
<NumberSelect v-if="type == 'add'" v-model:value="useDosage" :options="useDosageUnit" />
<span v-if="type == 'view'">{{ value }}</span>
</template>
</avue-crud>
</section>
</template>
<script setup>
import { ref, watch } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { ref, watch, onMounted } from 'vue';
import TypeMenu from '../../common/TypeMenu.vue';
import { CRUD_OPTIONS } from '@/config';
import { CRUD_OPTIONS, customRules } from '@/config';
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
const { getFertilizreList, addFertilizer } = inputSuppliesApi;
const { loadFinish, materialTypes, materialTwoLevel, targetName, goodsUnitOptions, useDosageUnit, handleNumUnit } = useBasicInfo();
onMounted(getData);
watch(
() => loadFinish.value,
(bol) => {
if (bol) {
option.value.column[5].dicData = materialTypes['2'].filter((v, i) => i > 0) ?? [];
option.value.column[12].dicData = materialTwoLevel?.['1']?.['3'] ?? [];
}
},
{
deep: true,
}
);
/* --------------- data --------------- */
// #region
const type = ref('');
const _type = ref('');
watch(
() => type.value,
() => _type.value,
() => {
console.log(type.value);
getData(1);
},
{
deep: true,
@ -27,54 +73,181 @@ watch(
);
const crud = ref();
const _loading = ref(false);
const data = ref([]);
const searchCondition = ref({
keywords: '',
});
const pageData = ref({
total: 0,
currentPage: 1,
pageSize: 10,
size: 10,
});
const option = ref({
CRUD_OPTIONS,
...CRUD_OPTIONS,
selection: false,
column: [
{
hide: true,
prop: 'keywords',
label: '关键字',
addDisplay: false,
viewDisplay: false,
search: true,
searchPlaceholder: '输入肥料名称',
},
{
prop: '',
label: '编号',
},
{
prop: 'xxxName',
prop: 'fertilizeName',
label: '名称',
rules: customRules({ msg: '请输入肥料名称' }),
},
{
prop: '',
prop: 'manufacturer',
label: '厂家',
rules: customRules({ msg: '请输入厂家名称' }),
},
{
prop: '',
prop: 'photoUrl',
label: '肥料图片',
hide: true,
editDisplay: false,
},
{
prop: 'distributor',
label: '经销商',
},
{
prop: '',
prop: 'classifyName',
label: '分类',
type: 'cascader',
clearable: false,
dicData: () => [],
rules: customRules({ msg: '请选择肥料分类' }),
},
{
prop: 'mainComponents',
label: '化学成分',
rules: customRules({ msg: '请输入化学成分' }),
},
{
prop: '',
prop: 'adaptCrops',
label: '适用作物',
},
{
hide: true,
prop: '_productSpecification',
label: '产品规格',
viewDisplay: false,
},
{
prop: '',
hide: true,
prop: '_suggest',
label: '建议用量',
viewDisplay: true,
},
{
prop: 'productSpecification',
label: '产品规格',
addDisplay: false,
editDisplay: false,
},
{
prop: 'suggest',
label: '建议用量',
addDisplay: false,
editDisplay: false,
},
{
prop: '_produceDosage',
label: '剂型',
type: 'cascader',
dicData: [],
},
{
prop: 'expiryDate',
label: '保质期',
},
{
hide: true,
prop: 'usageMethod',
label: '使用方法',
type: 'textarea',
span: 24,
},
{
hide: true,
prop: 'precautions',
label: '注意事项',
type: 'textarea',
span: 24,
},
],
});
const attrs = ref([]);
const productSpecification = ref({
num: 1,
type: '1',
});
const useDosage = ref({
num: 1,
type: '1',
});
// #endregion
/* --------------- methods --------------- */
// #region
async function getData(reset) {
_loading.value = true;
reset == 1 && (pageData.value.currentPage = 1);
let params = {
current: pageData.value.currentPage,
size: pageData.value.size,
fertilizeName: searchCondition.value.keywords,
};
_type.value != '0' && (params.classifyId = _type.value);
let res = await getFertilizreList(params);
console.log('params --- ', params, res);
_loading.value = false;
if (res.code == 200) {
data.value = res.data.records.map((v) => {
console.log('v', v);
v.productSpecification = handleNumUnit(v.productSpecification, v.productUnit, 1);
v.suggest = handleNumUnit(v.suggestDosage, v.suggestUnit, 2);
return v;
});
pageData.value.total = res.data.total;
}
}
function handleRowSave(form, done, loading) {
console.log('form', form);
let data = {
fertilizeName: form.fertilizeName,
manufacturer: form.manufacturer,
distributor: form.distributor,
classifyId: form.classifyName,
mainComponents: form.mainComponents,
productSpecification: productSpecification.value.num,
productUnit: productSpecification.value.type,
suggestDosage: useDosage.value.num,
suggestUnit: useDosage.value.type,
usageMethod: form.usageMethod,
precautions: form.precautions,
expiryDate: form.expiryDate,
adaptCrops: form.adaptCrops,
};
if (attrs.value.length) {
data.photoUrl = attrs.value.map((v) => v.url).join();
}
if (form._produceDosage.length) {
let names = [];
form._produceDosage.forEach((item) => {
names.push(targetName(option.value.column, item, ''));
});
data.produceDosage = JSON.stringify(form._produceDosage) + '|' + JSON.stringify(names);
}
console.log('data', data);
loading();
}
// #endregion
</script>

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 物资信息 </CustomCard>
<section class="custom-page"> 物资信息 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<h2>农药基本信息</h2>
<TypeMenu v-if="materialTypes[1].length > 1" v-model:type="_type" :types="materialTypes['1']" />
<br />
@ -29,21 +29,23 @@
<el-button @click="handleInfo(row)">详情</el-button>
</template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" />
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
</template>
<template #checkInfo-form="{ row }">
<section style="text-align: center; line-height: 58px">
<el-button @click="handleCheckInfo('open')">查看报告</el-button>
</section>
</template>
<template #checkReport-form="{ type }">
<Attrs v-model:attrs="reportAttrs" :type="type" :up-btn="reportAttrs.length < 1" :file-num="reportAttrs.length > 0 ? 1 : 3" />
<template #detectionReport-form="{ type }">
<Attrs v-model:attrs="reportAttrs" :type="type" :up-btn="reportAttrs.length < 1" :file-num="reportAttrs.length > 0 ? 1 : 3" :limit="2" />
</template>
<template #productSpecification-form>
<NumberSelect v-model:value="productSpecification" :options="goodsUnitOptions" />
<template #productSpecification-form="{ value, type }">
<NumberSelect v-if="type == 'add'" v-model:value="productSpecification" :options="goodsUnitOptions" />
<span v-if="type == 'view'">{{ value }}</span>
</template>
<template #dosage-form>
<NumberSelect v-model:value="useDosage" :options="useDosageUnit" />
<template #dosage-form="{ value, type }">
<NumberSelect v-if="type == 'add'" v-model:value="useDosage" :options="useDosageUnit" />
<span v-if="type == 'view'">{{ value }}</span>
</template>
<template #checkBtn-form>
<section style="text-align: center; line-height: 58px">
@ -51,12 +53,11 @@
</section>
</template>
</avue-crud>
</CustomCard>
</section>
</template>
<script setup>
import { reactive, ref, watch, onMounted, h } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { ref, watch, onMounted } from 'vue';
import TypeMenu from '../../common/TypeMenu.vue';
import { CRUD_OPTIONS, customRules } from '@/config';
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
@ -65,11 +66,10 @@ import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';
const { loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, targetName, filterTypes } = useBasicInfo({
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, targetName, filterTypes } = useBasicInfo({
moduleType: '1',
});
const { getPesticideList, addPesticide } = inputSuppliesApi;
onMounted(getData);
const { getPesticideList, addPesticide, pesticideReportSave } = inputSuppliesApi;
/* --------------- data --------------- */
// #region
@ -85,7 +85,7 @@ const searchCondition = ref({
keywords: '',
});
const crud = ref();
const _loading = ref(false);
const _loading = ref(true);
const data = ref([]);
const pageData = ref({
total: 0,
@ -118,6 +118,7 @@ const option = ref({
delBtn: false,
menuWidth: 220,
dialogWidth: '60%',
editBtnText: '上传报告',
column: [
{
hide: true,
@ -126,16 +127,19 @@ const option = ref({
search: true,
addDisplay: false,
editDisplay: false,
searchPlaceholder: '输入肥料名称',
viewDisplay: false,
},
{
prop: 'id',
label: '农药编号',
addDisplay: false,
editDisplay: false,
},
// {
// prop: 'id',
// label: '',
// addDisplay: false,
// editDisplay: false,
// },
{
prop: 'pesticideName',
label: '名称',
width: '120',
editDisplay: false,
rules: customRules({ msg: '请输入农药名称' }),
},
@ -143,6 +147,7 @@ const option = ref({
hide: true,
prop: 'productStandCode',
label: '产品标准证号',
width: '120',
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '请输入产品标准证号' }),
@ -151,12 +156,14 @@ const option = ref({
hide: true,
prop: 'photoUrl',
label: '农药图片',
span: 24,
editDisplay: false,
},
{
hide: true,
prop: 'pesticideRegistCode',
label: '农药登记证号',
width: '120',
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '请输登记证号' }),
@ -164,52 +171,61 @@ const option = ref({
{
prop: 'manufacturer',
label: '生产厂家',
width: '120',
editDisplay: false,
rules: customRules({ msg: '请输入生产厂家' }),
},
{
prop: 'distributor',
width: '120',
label: '经销商',
editDisplay: false,
},
{
prop: 'productSpecification',
width: '100',
label: '产品规格',
editDisplay: false,
render: ({ row }) => {
return `${row.productSpecification}${goodsUnitOptions.find((v) => v.value == row.productUnit).label}`;
},
},
{
prop: 'toxicityLevel',
width: '100',
label: '毒性',
editDisplay: false,
value: '无毒',
},
{
prop: 'dosage',
width: '100',
label: '建议用量',
editDisplay: false,
render: ({ row }) => {
return `${row.suggestDosage}${useDosageUnit.find((v) => v.value == row.suggestUnit).label}`;
},
},
{
prop: 'expiryDate',
label: '保质期',
addDisplay: false,
editDisplay: false,
},
{
prop: 'targetPests',
width: '200',
label: '防治对象',
addDisplay: false,
editDisplay: false,
},
{
prop: 'mainComponent',
width: '200',
label: '化学成分',
addDisplay: false,
editDisplay: false,
},
{
prop: 'produceDosage',
width: '200',
label: '加工剂型',
addDisplay: false,
editDisplay: false,
},
{
hide: true,
@ -220,6 +236,7 @@ const option = ref({
dicData: [],
value: [],
span: 24,
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '请选择防治对象' }),
},
@ -232,6 +249,7 @@ const option = ref({
dicData: [],
value: [],
span: 24,
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '请选择主要成分' }),
},
@ -244,6 +262,7 @@ const option = ref({
dicData: [],
value: [],
span: 24,
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '加工剂型' }),
},
@ -282,24 +301,28 @@ const option = ref({
viewDisplay: false,
column: [
{
prop: 'name',
prop: 'pesticideName',
label: '农药名称',
editDisabled: true,
span: 24,
},
{
prop: 'manufacturer',
label: '生产商',
editDisabled: true,
},
{
prop: 'photoUrl',
label: '农药图片',
editDisabled: true,
span: 24,
},
{
prop: 'distributor',
label: '经销商',
editDisabled: true,
span: 24,
},
{
prop: 'photoUrl',
label: '农药图片',
editDisabled: true,
span: 24,
},
],
},
@ -310,25 +333,51 @@ const option = ref({
viewDisplay: false,
column: [
{
prop: 'checkDate',
label: '农药名称',
prop: 'detectionTime',
label: '检测时间',
type: 'date',
valueFormat: 'YYYY-MM-DD',
rules: customRules({ msg: '请选择检测时间' }),
},
{
prop: 'checkResult',
prop: 'detectionResult',
label: '检测结果',
type: 'select',
clearable: false,
rules: customRules({ msg: '请选择检测结果' }),
dicData: [
{ value: '0', label: '合格' },
{ value: '1', label: '不合格' },
],
value: '0',
},
{
prop: 'checkUnit',
prop: 'detectionUnit',
label: '检测单位',
rules: customRules({ msg: '请输入检测单位' }),
},
{
prop: 'checkConclusion',
prop: 'detectionConclusion',
label: '检测结论',
rules: customRules({ msg: '请输入检测结论' }),
},
{
prop: 'checkReport',
prop: 'detectionReport',
label: '质检报告',
span: 24,
rules: [
{
required: true,
trigger: ['blur', 'change'],
validator: (rule, value, callback) => {
if (!reportAttrs.value.length) {
callback(new Error('请上传检测报告'));
} else {
callback();
}
},
},
],
},
{
labelWidth: 0,
@ -347,7 +396,7 @@ watch(
for (let key in dicDatas.value) {
option.value.column.forEach((item) => {
if (item.prop === key) {
let dic = materialTwoLevel.value?.[dicDatas.value[key].one]?.[dicDatas.value[key].two] ?? [];
let dic = materialTwoLevel?.[dicDatas.value[key].one]?.[dicDatas.value[key].two] ?? [];
dicDatas.value[key].dic = dic;
item.dicData = dic;
}
@ -371,6 +420,8 @@ const useDosage = ref({
/* --------------- methods --------------- */
// #region
defaultGet(getData);
async function getData(reset) {
_loading.value = true;
reset == 1 && (pageData.value.currentPage = 1);
@ -385,17 +436,24 @@ async function getData(reset) {
_loading.value = false;
if (res && res.code === 200) {
data.value = res.data.records;
data.value.forEach((v) => {
v.productSpecification = `${v.productSpecification}${goodsUnitOptions.find((_v) => _v.value == v.productUnit).label}`;
v.dosage = `${v.suggestDosage}${useDosageUnit.find((_v) => _v.value == v.suggestUnit).label}`;
v.targetPests = handleShowName(v.targetPests);
v.mainComponent = handleShowName(v.mainComponent);
v.produceDosage = handleShowName(v.produceDosage);
});
pageData.value.total = res.data.total;
}
}
function handleCloseDialog(done) {
delete option.value.column[1].span;
resetOtherInfo();
handleCheckInfoChange();
done();
}
async function handleRowSave(form, done, loading) {
console.log('handleRowSave', form);
let data = {
pesticideName: form.pesticideName,
productStandCode: form.productStandCode,
@ -412,7 +470,7 @@ async function handleRowSave(form, done, loading) {
suggestUnit: useDosage.value.type,
};
if (attrs.value.length) {
data.pesticidePhoto = attrs.value.map((v) => v.url).join();
data.photoUrl = attrs.value.map((v) => v.url).join();
}
if (form._targetPests.length) {
let names = [];
@ -436,49 +494,63 @@ async function handleRowSave(form, done, loading) {
data.produceDosage = JSON.stringify(form._produceDosage) + '|' + JSON.stringify(names);
}
let res = await addPesticide(data);
loading();
if (res.code == 200) {
ElMessage.success('保存成功');
getData();
// resetOtherInfo();
// done();
resetOtherInfo();
done();
}
loading();
}
function resetOtherInfo() {
let obj = { num: 1, type: '1' };
attrs.value = [];
reportAttrs.value = [];
productSpecification.value = obj;
useDosage.value = obj;
}
function handleEdit(row) {
console.log('handleEdit', row);
handleAttrs(row);
option.value.group[1].column[0].value = row.detectionTime;
option.value.group[1].column[1].value = row.detectionResult;
option.value.group[1].column[2].value = row.detectionUnit;
option.value.group[1].column[3].value = row.detectionConclusion;
handleCheckInfoChange('open');
attrs.value = row.map((v) => {
return {
url: v,
uid: Date.now(),
};
});
reportAttrs.value = row.checkReport.map((v) => {
return {
url: v,
uid: Date.now(),
};
});
crud.value.rowEdit(row);
}
function handleInfo(row) {
console.log('row', row);
handleAttrs(row);
option.value.column[1].span = 24;
crud.value.rowView(row);
}
/* 处理展示附件 */
function handleAttrs(row = {}) {
if (!row) {
return;
}
if (row.photoUrl) {
attrs.value = row.photoUrl.split(',').map((v, i) => {
return {
url: v,
uid: `photo_${i}_${Date.now()}`,
};
});
}
if (row.detectionReport) {
reportAttrs.value = row.detectionReport.split(',').map((v, i) => {
return {
url: v,
uid: `report_${i}_${Date.now()}`,
};
});
}
}
function handleCheckInfo(type) {
console.log('checkInfo', type);
handleCheckInfoChange(type == 'open');
}
/* bol && 查看检测报告关闭其他信息 !bol && 关闭检测报告打开其他信息 */
function handleCheckInfoChange(bol = false) {
console.log('bol', bol);
option.value.group.forEach((v) => {
v.viewDisplay = bol;
});
@ -494,14 +566,32 @@ function handleCheckInfoChange(bol = false) {
});
}
}
async function handleRowUpdate(form, done, loading) {
async function handleRowUpdate(form, index, done, loading) {
console.log('update from -- ', form);
let data = {
id: form.id,
detectionTime: form.detectionTime,
detectionResult: form.detectionResult,
detectionUnit: form.detectionUnit,
detectionConclusion: form.detectionConclusion,
detectionReport: reportAttrs.value.map((v) => v.url).join(),
};
let res = await pesticideReportSave(data);
loading();
if (res.code == 200) {
ElMessage.success('检测报告保存成功');
getData();
done();
}
}
function handleShowName(text = '') {
if (!text || text.includes('|')) return false;
let names = text.split('|')[1];
console.log('names', names);
if (!text || !text.includes('|')) return false;
let names = JSON.parse(text.split('|')[1]);
let _t = '';
names.forEach((v, i) => {
_t += (i == 0 ? '' : '') + v;
});
return _t;
}
// #endregion
</script>

View File

@ -1,12 +1,11 @@
<template>
<CustomCard>
<section class="custom-page">
<section>兽药</section>
</CustomCard>
</section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,12 +1,11 @@
<template>
<CustomCard>
<section class="custom-page">
<section>种子</section>
</CustomCard>
</section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<!-- <section style="width: 600px; height: 400px">
<custom-rich-editor />
</section> -->
@ -21,12 +21,11 @@
<custom-table-operate :actions="actions" :data="scope" />
</template>
</avue-crud>
</CustomCard>
</section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import { useMaterialHook } from './useMaterialHook';

View File

@ -1,10 +1,9 @@
<template>
<CustomCard>巡查与案件 </CustomCard>
<section class="custom-page">巡查与案件 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 农机生产经销商 </CustomCard>
<section class="custom-page"> 农机生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 肥料生产经销商 </CustomCard>
<section class="custom-page"> 肥料生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 生产经销商管理 </CustomCard>
<section class="custom-page"> 生产经销商管理 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 农药生产经销商 </CustomCard>
<section class="custom-page"> 农药生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 兽药生产经销商 </CustomCard>
<section class="custom-page"> 兽药生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,10 +1,9 @@
<template>
<CustomCard> 种子生产经销商 </CustomCard>
<section class="custom-page"> 种子生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,15 +1,14 @@
<template>
<CustomCard>
<section class="custom-page">
<section class="rank_container">
<RankCard :data="data1" />
<RankCard :data="data2" type="2" />
</section>
</CustomCard>
</section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
import RankCard from './common/rankCard.vue';
/* --------------- data --------------- */

View File

@ -1,10 +1,9 @@
<template>
<CustomCard>使用监管 </CustomCard>
<section class="custom-page">使用监管 </section>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<avue-crud
ref="crudRef"
v-model:page="page"
@ -31,14 +31,13 @@
<FileUpload v-model:attrs="examineForm.attrs" :format="['rar', 'zip', 'doc', 'docx', 'pdf']" :type="type" />
</template>
</avue-crud>
</CustomCard>
</section>
<Register v-model:visible="caseInfo.visible" />
</template>
<script setup>
import { ref, reactive, h, onMounted, watch } from 'vue';
import { CRUD_OPTIONS } from '@/config';
import CustomCard from '@/components/CustomCard.vue';
import { useUserStore } from '@/store/modules/user';
import Register from './common/Register.vue';
import FileUpload from './common/FileUpload.vue';

View File

@ -1,5 +1,5 @@
<template>
<CustomCard>
<section class="custom-page">
<el-radio-group v-model="landType" class="lands_types" style="margin-bottom: 30px" @change="getList()">
<el-radio-button v-for="item in landsType" :key="'landsType_' + item.value" :value="item.value">
{{ item.label }}
@ -70,12 +70,11 @@
@on-download="onDownloadExcel"
@on-confirm="onUploadExcel"
/>
</CustomCard>
</section>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import CustomCard from '@/components/CustomCard';
import { CRUD_OPTIONS } from '@/config';
import { useUserStore } from '@/store/modules/user';
import { getLandsList, exportLands, delLand, saveLand, importLands } from '@/apis/land.js';

View File

@ -1,663 +0,0 @@
<!-- eslint-disCustomCardnst-assign -->
<template>
<CustomCard>
<el-form ref="searchRef" :model="searchCondition">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="地块名:" prop="landName">
<el-input v-model="searchCondition.landName" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="种植产物" prop="crop">
<el-input v-model="searchCondition.crop" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="产权人" prop="owner">
<el-input v-model="searchCondition.owner" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-button type="primary" @click="getList()">查询</el-button>
<el-button type="" @click="handleResetSearch">重置</el-button>
</el-col>
</el-row>
</el-form>
<div class="options_btns">
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" :loading="item.loading" @click="item.method">
{{ item.label }}
</el-button>
</div>
<el-table :data="list" @selection-change="selectionChange" @row-click="rowClick">
<el-table-column type="selection" width="55" />
<el-table-column type="index"> </el-table-column>
<el-table-column label="地块名" prop="landName" width="240" show-overflow-tooltip />
<el-table-column label="地址" prop="address" show-overflow-tooltip />
<el-table-column label="产权人" prop="owner" show-overflow-tooltip />
<el-table-column label="农用地分类" prop="landClassificationType" width="120" show-overflow-tooltip>
<template #default="{ row }">
<el-tag type="primary" :hit="true" size="small" effect="plain">{{ landClassificationType[row.landClassificationType] }}</el-tag>
</template>
</el-table-column>
<el-table-column label="面积" prop="area" show-overflow-tooltip />
<el-table-column label="坐标" prop="coordinate" show-overflow-tooltip />
<el-table-column label="土壤类型" prop="soilType" show-overflow-tooltip />
<el-table-column label="种植产物" prop="crop" show-overflow-tooltip />
<el-table-column label="种子供应商" prop="seedSupplier" show-overflow-tooltip />
<el-table-column label="年度计划" prop="planName" show-overflow-tooltip />
<el-table-column label="种植日期" prop="planDate" show-overflow-tooltip />
<el-table-column fixed="right" label="操作" width="160" show-overflow-tooltip>
<template #default="{ row }">
<el-button type="primary" size="small" @click="doEdit(row)">编辑</el-button>
<el-button type="danger" size="small" @click="doDel(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<Pagina :page-data="pageData" @page-change="pageChange" />
<el-dialog v-model="infoVisible" title="种植规划" width="1000" center>
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
<el-row :gutter="20">
<!--<el-col :span="12">
<el-form-item label="地块:" prop="landId">
<CustomSelect
v-model:value="infoData.landId"
:set="{
url: 'land-resource/landManage/page',
props: {
value: 'id',
label: 'landName',
},
}"
placeholder="请选择地块"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="面积" prop="gridName">
<el-input v-model="infoData.gridName" placeholder="请输入面积" style="width: 240px"></el-input>
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="种植产物" prop="crop">
<el-input v-model="infoData.crop" placeholder="请输入种植产物" style="width: 240px"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="种植日期" prop="planDate">
<el-date-picker
v-model="infoData.planDate"
type="date"
placeholder="请选择种植日期"
:disabled-date="disabledDate"
format="YYYY/MM/DD"
value-format="YYYY/MM/DD"
:size="size"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="种子供应商" prop="seedSupplier">
<el-input v-model="infoData.seedSupplier" placeholder="请输入种子供应商" style="width: 240px"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="年度计划" prop="planId">
<CustomSelect
v-model:value="infoData.planId"
:set="{
url: 'land-resource/annualManage/page',
props: {
value: 'id',
label: 'planName',
},
}"
placeholder="请选择种植计划"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="infoCancel">取消</el-button>
<el-button type="primary" @click="subMitInfo(infoRef)"> 确认 </el-button>
</div>
</template>
</el-dialog>
<div>
<el-text class="mx-1" size="large">种植阶段详情</el-text>
<div style="margin-top: 16px">
<el-form ref="stageRef" :model="stageInfo">
<el-row :gutter="20">
<el-col :span="6">
<el-button type="primary" @click="addSub">新增</el-button>
</el-col>
<el-col :span="6">
<el-form-item label="所属阶段" prop="gridName">
<el-select v-model="stageInfo.stage" placeholder="请选择所属阶段" style="width: 240px" :clearable="true">
<el-option v-for="item in stageOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-button type="primary" @click="handleSearchStage">查询</el-button>
<el-button type="" @click="handleResetStage">重置</el-button>
</el-col>
</el-row>
</el-form>
<el-table :data="sublist">
<el-table-column type="index"> </el-table-column>
<el-table-column label="所属阶段" prop="stage">
<template #default="{ row }">
<el-tag size="small">{{ stageObj[row.stage] }}</el-tag>
</template>
</el-table-column>
<el-table-column label="作业计划" prop="operationType" show-overflow-tooltip />
<el-table-column label="作业时间" prop="operationDate" show-overflow-tooltip />
<el-table-column label="结束时间" prop="createTime" show-overflow-tooltip />
<el-table-column fixed="right" label="操作" width="200" show-overflow-tooltip>
<template #default="{ row }">
<el-button type="primary" size="small" @click="doSubEdit(row)">编辑</el-button>
<el-button type="danger" size="small" @click="doSubDel(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<Pagina :page-data="subPageData" />
<el-dialog v-model="stageInfoVisible" title="种植阶段" width="800" center>
<el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="地块:" prop="landName">
<el-input v-model="stageInfoData.landName" placeholder="请输入地块" style="width: 240px" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="种植产物" prop="crop">
<el-input v-model="stageInfoData.crop" placeholder="请输入种植产物" style="width: 240px" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="种植阶段" prop="stage">
<CustomSelect
v-model:value="stageInfoData.stage"
:set="{
url: '',
options: stageOptions,
props: {
value: 'value',
label: 'label',
},
}"
placeholder="请选择种植阶段"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="作业计划" prop="workId">
<CustomSelect
v-model:value="stageInfoData.workId"
:set="{
url: '',
options: workOptions,
props: {
value: 'id',
label: 'planName',
},
}"
placeholder="请选择作业计划"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="infoCancel">取消</el-button>
<el-button type="primary" @click="subMitStateInfo(stageInfoRef)"> 确认 </el-button>
</div>
</template>
</el-dialog>
</div>
</div>
</CustomCard>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import Pagina from '@/components/pagina.vue';
import {
getPlanList,
savePlan,
exportPlan,
editAlan,
delPlan,
getPlantingStage,
savePlantingStage,
editPlantingStage,
delPlantingStage,
} from '@/apis/land.js';
import CustomCard from '@/components/CustomCard.vue';
import { useApp } from '@/hooks';
import CustomSelect from '@/components/CustomSelect.vue';
import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils';
onMounted(() => {
getList();
});
/* --------------- data --------------- */
// #region
const app = useApp();
const searchRef = ref();
const searchCondition = reactive({
landName: '',
owner: '',
crop: '',
});
const pageData = reactive({
page: 1,
size: 10,
total: 0,
});
const landClassificationType = reactive({
0: '耕地',
1: '果园',
2: '茶园',
3: '其他园地',
4: '林地',
5: '草地',
6: '其他农用地',
7: '农村宅基地',
});
let selectIds = ref('');
const infoVisible = ref(false);
const infoRef = ref();
const list = ref([]);
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
},
pageData: {
total: 0,
currentPage: 1,
pageSize: 10,
},
data: [],
currentRow: {},
});
const btns = reactive([
{
label: '新增种植规划',
loading: false,
method: function () {
console.log('add');
if (selectIds.value.length <= 0) {
app.$message.error('请先选择地块');
return;
}
infoVisible.value = true;
},
},
{
label: '导入',
disabled: false,
loading: false,
method: function () {
console.log('import');
},
},
{
label: '导出',
disabled: true,
loading: state.loading,
method: function () {
if (isEmpty(state.data)) {
app.$message.error('当前暂时没有可供导出的数据!');
return;
}
state.loading = true;
const fileName = '种植计划明细表';
exportPlan(state.query)
.then((res) => {
if (res.status === 200) {
downloadFile(res.data, `${fileName}.xlsx`, 'blob');
app.$message.success('导出成功!');
}
})
.catch((err) => {
app.$message.error('导出失败!');
})
.finally(() => {
state.loading = false;
});
},
},
]);
let infoData = reactive({
landId: [], //id
planId: '', //id
crop: '', //
seedSupplier: '', //
planDate: '', //
});
const infoRules = reactive({
crop: [{ required: true, message: '请输入种植产物', trigger: 'blur' }],
planId: [{ required: true, message: '请选择种植计划', trigger: 'blur' }],
seedSupplier: [{ required: true, message: '请输入供应商', trigger: 'blur' }],
planDate: [{ required: true, message: '请选择种植时间', trigger: 'blur' }],
});
const workOptions = reactive([
{ value: '作业计划1', label: 'Option1' },
{ value: '作业计划2', label: 'Option2' },
]);
const subPageData = reactive({
page: 1,
size: 10,
total: 0,
});
const sublist = ref([]);
const stageInfo = reactive({
stage: '',
});
const stageRef = ref();
const stageOptions = reactive([
{ value: '0', label: '苗期' },
{ value: '1', label: '花果期' },
{ value: '2', label: '采收期' },
]);
let currentRow = reactive({});
const stageObj = reactive({
0: '苗期',
1: '花果期',
2: '采收期',
});
let stageInfoVisible = ref(false);
const stageInfoRef = ref();
let stageInfoData = reactive({
landId: '', //id
planId: '', //id
crop: '', //
stage: '', //
workId: '', //Id
landName: '', //
});
const stageInfoRules = reactive({
stage: [{ required: true, message: '请选择所属阶段', trigger: 'blur' }],
workId: [{ required: true, message: '请选择作业计划', trigger: 'blur' }],
});
// #endregion
/* --------------- methods --------------- */
// #region
async function getList() {
const params = { current: pageData.page, size: pageData.size, ...searchCondition };
let { code, data, msg } = await getPlanList(params);
//console.log('res ---------', data);
list.value = data.records || [];
pageData.total = data.total;
state.data = data.records;
state.pageData = {
currentPage: data.current || 1,
pageSize: data.size || 10,
total: data.total,
};
}
function handleResetSearch() {
searchRef.value && searchRef.value.resetFields();
getList();
}
const selectionChange = (data) => {
let datalist = data.map((m) => {
return { landId: m.landId, landName: m.landName };
});
let selectIdlist = uniqueObjects(datalist, 'landId');
let selectIdsVal = selectIdlist.map((n) => {
return n.landId;
});
selectIds.value = selectIdsVal.toString();
console.info('selectionChange', selectIds.value);
};
const pageChange = (data) => {
console.info('pageChange', data);
pageData.page = data;
getList();
};
function uniqueObjects(arr, key) {
return arr.reduce((acc, current) => {
const duplicate = acc.find((element) => element[key] === current[key]);
if (!duplicate) {
acc.push(current);
}
return acc;
}, []);
}
function doEdit(row) {
infoVisible.value = true;
infoData = reactive({
...row,
});
console.info('编辑', infoData);
}
function doDel(row) {
console.info('删除');
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
delPlan({ id: row.id })
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
getList();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
}
const subMitInfo = (formEl) => {
if (!formEl) return;
formEl.validate((valid) => {
if (valid) {
let parmer = {
...infoData,
landId: selectIds.value || '',
};
console.info('新增种植计划', parmer);
if (parmer.id) {
editAlan(parmer)
.then((res) => {
if (res.code === 200) {
app.$message.success('编辑成功!');
getList();
infoHide();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {});
} else {
savePlan(parmer)
.then((res) => {
if (res.code === 200) {
getList();
infoHide();
app.$message.success('添加成功!');
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {});
}
} else {
console.log('error submit!');
}
});
};
const infoCancel = () => {
infoHide();
};
const infoHide = () => {
infoVisible.value = false;
};
const addSub = () => {
console.log('新增阶段');
if (!currentRow.id) {
app.$message.error('请选择种植规划');
return;
}
stageInfoData.landName = currentRow.landName || '';
stageInfoData.crop = currentRow.crop || '';
stageInfoVisible.value = true;
};
async function getStageList() {
const params = { current: subPageData.page, size: subPageData.size, planId: currentRow.id };
let { code, data, msg } = await getPlantingStage(params);
sublist.value = data.records || [];
subPageData.total = data.total;
}
function handleResetStage() {
stageRef.value && stageRef.value.resetFields();
stageInfo.stage = '';
console.info('重置所属阶段筛选条件');
getStageList();
}
const handleSearchStage = () => {
if (!currentRow.id) {
app.$message.error('请选择种植规划');
return;
}
getStageList();
};
const rowClick = (row) => {
currentRow = reactive({ ...row });
getStageList();
};
const doSubEdit = (row) => {
console.log('编辑sub');
stageInfoData.landName = row.landName || '';
stageInfoData.crop = row.crop || '';
stageInfoVisible.value = true;
};
const doSubDel = (row) => {
console.log('删除sub');
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
delPlantingStage({ id: row.id })
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
getStageList();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
};
const stageinfoHide = () => {
stageInfoRef.value && stageInfoRef.value.resetFields();
stageInfoVisible.value = false;
};
const subMitStateInfo = (formEl) => {
if (!formEl) return;
formEl.validate((valid) => {
if (valid) {
let parmer = {
planId: currentRow.id || '', //id
stage: stageInfoData.stage || 0, //:0->,1>,2->
workId: stageInfoData.workId || '',
};
console.info('新增种植阶段', parmer);
if (parmer.id) {
editPlantingStage(parmer)
.then((res) => {
if (res.code === 200) {
app.$message.success('编辑成功!');
getStageList();
stageinfoHide();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {});
} else {
savePlantingStage(parmer)
.then((res) => {
if (res.code === 200) {
getStageList();
stageinfoHide();
app.$message.success('添加成功!');
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {});
}
} else {
console.log('error submit!');
}
});
};
// #endregion
</script>
<style lang="scss" scoped>
.container {
border-radius: 4px;
background-color: #ffffff;
}
</style>

View File

@ -1,19 +0,0 @@
<template>
<router-view></router-view>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -5531,6 +5531,11 @@ split-string@^3.0.1, split-string@^3.0.2:
dependencies:
extend-shallow "^3.0.0"
splitpanes@^4.0.3:
version "4.0.3"
resolved "https://registry.npmmirror.com/splitpanes/-/splitpanes-4.0.3.tgz#342c2b57d906371c2ab44b4578333fbeb13aaa94"
integrity sha512-S/f1CoH2JroOib7kzQtTQNtQCa7VzNQ2qKOO5HNj/5EVVcNkfz1eX/sH+X3XKdBdDLihEKDekVGwrLADd2oirA==
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"