feat:种源管理接口对接完成

This commit is contained in:
李想 2025-04-01 17:33:12 +08:00
parent a40e213446
commit 60911cf223
16 changed files with 841 additions and 182 deletions

View File

@ -29,7 +29,10 @@ export function pesticideReportSave(data) {
method: 'PUT',
});
}
/* 删除农药 */
export function delPesticide(ids) {
return request(`/inputGoods/pesticide/delete/${ids}`);
}
// #endregion
/* ------ 肥料 ------ */
@ -45,6 +48,10 @@ export function addFertilizer(data) {
data,
});
}
/* 删除肥料 */
export function delFretilize(ids) {
return request(`/inputGoods/fertilize/delete/${ids}`);
}
// #endregion
/* ------ 兽药 ------ */
// #region
@ -60,6 +67,29 @@ export function addAnimalMedicine(data) {
data,
});
}
/* 删除兽药 */
export function delAnimalMedicine(ids) {
return request(`/inputGoods/animalMedicine/delete/${ids}`);
}
// #endregion
/* ------ 种源 ------ */
// #region
/* 查询种源 */
export function getSeedList(params) {
return request('/inputGoods/provenance/page', {
params,
});
}
/* 新增种源 */
export function seedSave(data) {
return request('/inputGoods/provenance/save', {
method: 'POST',
data,
});
}
/* 删除种源 */
export function delSeed(ids) {
return request(`/inputGoods/provenance/delete/${ids}`);
}
// #endregion
//

View File

@ -1,4 +1,5 @@
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
import { ref } from 'vue';
const { VITE_APP_MIAN, VITE_APP_NAME } = import.meta.env;
export const GenKey = (key, prefix = VITE_APP_NAME) => {
@ -68,3 +69,9 @@ export function customRules(set = { disabled: false }) {
}
return rulesArr;
}
export const pageData = ref({
currentPage: 1,
size: 10,
total: 0,
});

View File

@ -46,59 +46,26 @@ const inputSuppliesRoutes = [
component: () => import('@/views/inputSuppliesManage/material/ratPoison/index.vue'),
meta: { title: '兽药管理', icon: 'Document' },
},
// {
// path: '/sub-government-affairs-service/material/farmMachinery',
// name: 'input-supplies-farmMachinery',
// component: () => import('@/views/inputSuppliesManage/material/farmMachinery/index.vue'),
// meta: { title: '农机管理', icon: 'Document' },
// },
// {
// path: '/sub-government-affairs-service/material/seed',
// name: 'input-supplies-seed',
// component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
// meta: { title: '种源管理', icon: 'Document' },
// },
{
path: '/sub-government-affairs-service/material/seed',
name: 'input-supplies-seed',
component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
meta: { title: '种源管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/material/farmMachinery',
name: 'input-supplies-farmMachinery',
component: () => import('@/views/inputSuppliesManage/material/farmMachinery/index.vue'),
meta: { title: '农机管理', icon: 'Document' },
},
],
},
// {
// 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/productionDealer',
name: 'productionDealer',
component: () => import('@/views/inputSuppliesManage/productionDealer/index.vue'),
meta: { title: '企业经销商管理', icon: 'Document' },
},
// {
// path: '/sub-government-affairs-service/enterpriseDealerCheck',
// name: 'enterpriseDealerCheck',

View File

@ -1,6 +1,13 @@
<template>
<section class="custom_number_select_" style="">
<el-input-number v-model="data.num" :precision="2" :step="1" :min="1" controls-position="right" @change="handleChange"></el-input-number>
<el-input-number
v-model="data.num"
:precision="_numberSet.precision"
:step="_numberSet.step"
:min="_numberSet.min"
:controls-position="_numberSet.controlsPosition"
@change="handleChange"
></el-input-number>
<el-select v-model="data.type" @change="handleChange">
<el-option v-for="item in props.options" :key="'custom_' + Date.now() + item.value" :label="item.label" :value="item.value" />
</el-select>
@ -38,6 +45,12 @@ const props = defineProps({
},
],
},
set: {
type: Object,
default: () => {
return {};
},
},
numberSet: {
type: Object,
default: () => {
@ -47,9 +60,8 @@ const props = defineProps({
});
const _numberSet = ref({
precision: 2,
setp: 1,
step: 1,
min: 1,
max: 100,
controlsPosition: 'right',
});
const data = ref({
@ -58,7 +70,8 @@ const data = ref({
});
watchEffect(() => {
data.value = Object.assign(data.value, props.value);
_numberSet.value = Object.assign(_numberSet.value, props.set);
_numberSet.value = Object.assign(_numberSet.value, props.numberSet);
console.log('_numberSet.value', _numberSet.value);
});
function handleChange() {
emit('update:value', data.value);

View File

@ -1,6 +1,8 @@
import { ref, onMounted, reactive } from 'vue';
import inputSuppliesApis from '@/apis/inputSuppliesApi';
import { ElMessage, ElMessageBox } from 'element-plus';
const { getMaterailTypes } = inputSuppliesApis;
export function useBasicInfo(set = {}) {
const loadFinish = ref(false);
const searchCondition = Object.assign(
@ -161,6 +163,19 @@ export function useBasicInfo(set = {}) {
});
return _t;
}
function handleDelFn(ids, _fetch, _callback) {
ElMessageBox.confirm('确定删除该数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
let res = await _fetch(ids);
if (res.code == 200) {
ElMessage.success('删除成功');
_callback();
}
});
}
// #endregion
onMounted(getmaterialType);
@ -176,5 +191,6 @@ export function useBasicInfo(set = {}) {
filterTypes,
handleShowName,
handleNumUnit,
handleDelFn,
};
}

View File

@ -1,21 +1,413 @@
<template>
<section class="custom-page">
<section>农机</section>
<h2>农机基本信息</h2>
<TypeMenu v-if="materialTypes['5'].length > 1" v-model:type="_type" :types="materialTypes['5']" />
<br />
<avue-crud
ref="crudRef"
v-model:page="pageData"
v-model:search="searchCondition"
:table-loading="_loading"
:before-close="handleCloseDialog"
:data="data"
:option="option"
@search-change="
(form, done) => {
getData(1);
done();
}
"
@search-reset="getData(1)"
@refresh-change="getData"
@current-change="getData"
@size-change="getData(1)"
@row-save="handleRowSave"
@row-update="handleRowUpdate"
>
<template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" />
</template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
</template>
<template #checkUnitStamp-form="{ type }">
<section style="display: flex">
<el-input v-model="checkUnitStamp" style="width: 40%"></el-input>
<Attrs v-model:attrs="attrs" style="width: 40%" type="add" :limit="1" />
</section>
</template>
</avue-crud>
</section>
</template>
<script setup>
import { ref } from 'vue';
import { ref, reactive, onMounted, watch } from 'vue';
import TypeMenu from '../../common/TypeMenu.vue';
import { CRUD_OPTIONS, pageData, customRules } from '@/config';
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
const { defaultGet, loadFinish, materialTypes, goodsUnitOptions, handleNumUnit, handleShowName, targetName } = useBasicInfo({
moduleType: '5',
});
const _allTypes = ref([]);
watch(
() => loadFinish.value,
(bol) => {
if (bol) {
option.value.column.forEach((v) => {
if (v.prop === '_classifyId') {
_allTypes.value = materialTypes['5'].filter((v, i) => i > 0) ?? [];
console.log('_allTypes', _allTypes.value);
v.dicData = _allTypes.value;
}
});
}
}
);
onMounted(getData);
/* --------------- data --------------- */
// #region
const _type = ref('0');
const crudRef = ref();
const _loading = ref(true);
const searchCondition = ref({
keywords: '',
});
const processCustomized = reactive([
{
label: '可定制',
value: '0',
},
{
label: '不可定制',
value: '1',
},
]);
const afterSales = reactive([
{
label: '全国联保',
value: '0',
},
{
label: '国家三包规定',
value: '1',
},
{
label: '品牌官方售后',
value: '2',
},
{
label: '上门服务',
value: '3',
},
{
label: '远程技术支持',
value: '4',
},
{
label: '依旧换新',
value: '5',
},
]);
const subsidy = reactive([
{
label: '有补贴',
value: '0',
},
{
label: '无补贴',
value: '1',
},
]);
const data = ref([{}]);
const option = ref({
...CRUD_OPTIONS,
dialogWidth: '50%',
column: [
{
label: '农机名称',
prop: 'keywords',
hide: true,
search: true,
addDisplay: false,
viewDisplay: false,
editDisplay: false,
},
{
label: '农机名称',
prop: 'animalMedicineName',
rules: customRules({ msg: '请输入农机名称' }),
editDisplay: false,
},
{
label: '品牌',
prop: 'animalMedicineVariety',
rules: customRules({ msg: '请输入品牌' }),
editDisplay: false,
},
{
hide: true,
label: '农机图片',
prop: 'photoUrl',
editDisplay: false,
},
{
prop: 'manufacturer',
label: '厂家',
rules: customRules({ msg: '请输入厂家名称' }),
editDisplay: false,
},
{
prop: 'distributor',
label: '经销商',
editDisplay: false,
},
{
label: '分类',
prop: '_classifyId',
type: 'cascader',
expandTrigger: 'click',
dicData: [],
rules: customRules({ msg: '请选择分类' }),
editDisplay: false,
},
{
hide: true,
label: '驱动方式',
prop: 'driveMode',
editDisplay: false,
},
{
hide: true,
label: '加工定制',
prop: 'processCustomized',
type: 'select',
dicData: processCustomized,
editDisplay: false,
},
{
hide: true,
label: '农机补贴',
prop: 'subsidy',
type: 'select',
dicData: subsidy,
editDisplay: false,
},
{
hide: true,
label: '售后服务',
prop: 'afterSales',
type: 'select',
dicData: afterSales,
multiple: true,
value: [],
editDisplay: false,
},
{
hide: true,
label: '质保期',
prop: 'expiryDate',
editDisplay: false,
},
{
hide: true,
label: '水分管理',
prop: 'mainCharacteristic',
span: 24,
type: 'textarea',
editDisplay: false,
},
{
hide: true,
label: '病虫害防治',
prop: 'functionConfig',
span: 24,
type: 'textarea',
editDisplay: false,
},
{
hide: true,
label: '注意事项',
prop: 'useRange',
span: 24,
type: 'textarea',
editDisplay: false,
},
],
group: [
{
label: '基本信息',
prop: 'basicInfo',
addDisplay: false,
viewDisplay: false,
column: [
{
label: '农机型号',
prop: 'specification',
rules: customRules({ msg: '请输入农机型号' }),
},
{
label: '农机牌照号',
prop: 'specification',
rules: customRules({ msg: '请输入农机牌照号' }),
},
{
label: '权属人',
prop: 'specification',
rules: customRules({ msg: '请输入权属人' }),
},
{
label: '联系电话',
prop: 'specification',
rules: customRules({ msg: '请输入联系电话' }),
},
{
label: '联系地址',
prop: 'specification',
rules: customRules({ msg: '请输入联系地址' }),
},
],
},
{
label: '年检信息',
prop: 'yearCheckInfo',
addDisplay: false,
viewDisplay: false,
column: [
{
label: '年检地点',
prop: 'address',
rules: customRules({ msg: '请输入年检地点' }),
},
{
label: '年检时间',
prop: 'checkDate',
rules: customRules({ msg: '请输入年检时间' }),
},
{
label: '外观检查',
prop: 'appearanceCheck',
span: 24,
type: 'textarea',
},
{
label: '技术检测',
prop: 'technologyCheck',
span: 24,
type: 'textarea',
},
{
label: '安全装置检查',
prop: 'safetyDeviceCheck',
span: 24,
type: 'textarea',
},
],
},
{
label: '年检结论',
prop: 'yearCheckResult',
addDisplay: false,
viewDisplay: false,
column: [
{
label: '结论',
prop: 'result',
},
{
label: '检测员签名',
prop: 'checkPersonSign',
},
{
label: '检测单位盖章',
prop: 'checkUnitStamp',
span: 24,
},
],
},
],
});
const actions = reactive([
{
name: '上传报告',
icon: 'view',
event: ({ row }) => handleCheck(row),
},
{
name: '详情',
icon: 'view',
event: ({ row }) => handleInfo(row),
},
{
type: 'danger',
name: '删除',
icon: 'delete',
// event: ({ row }) => handleDelFn(row.id, delPesticide, getData),
},
]);
const attrs = ref([]);
const checkUnitStamp = ref('');
// #endregion
/* --------------- methods --------------- */
// #region
function getData(reset) {
_loading.value = true;
reset == 1 && (pageData.value.currentPage = 1);
let params = {
current: pageData.value.currentPage,
size: pageData.value.size,
animalName: searchCondition.value.keywords,
};
console.log('getData', params);
_loading.value = false;
}
function handleCheck(row) {
handleAttrs(row);
crudRef.value.rowEdit(row);
}
function handleInfo(row) {
handleAttrs(row);
crudRef.value.rowView(row);
}
function handleRowUpdate(row, index, done, loading) {
console.log('update', row);
loading();
// done();
}
function handleRowSave(row, done, loading) {
console.log('save', row);
loading();
}
/* 处理展示附件 */
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()}`,
};
});
}
}
function handleCloseDialog(done) {
attrs.value = [];
done();
}
// #endregion
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
h2 {
font-size: 24px;
font-weight: bold;
font-family: '黑体';
}
</style>

View File

@ -24,7 +24,8 @@
@row-save="handleRowSave"
>
<template #menu="{ row }">
<el-button @click="handleInfo(row)">详情</el-button>
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
<el-button @click="handleDelFn(row.id, delFretilize, getData)">删除</el-button>
</template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
@ -51,8 +52,9 @@ import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
import { ElMessage } from 'element-plus';
const { getFertilizreList, addFertilizer } = inputSuppliesApi;
const { loadFinish, materialTypes, materialTwoLevel, targetName, goodsUnitOptions, useDosageUnit, handleShowName, handleNumUnit } = useBasicInfo();
const { getFertilizreList, addFertilizer, delFretilize } = inputSuppliesApi;
const { loadFinish, materialTypes, materialTwoLevel, targetName, goodsUnitOptions, useDosageUnit, handleShowName, handleNumUnit, handleDelFn } =
useBasicInfo();
onMounted(getData);
watch(
@ -94,6 +96,7 @@ const pageData = ref({
const option = ref({
...CRUD_OPTIONS,
selection: false,
menuWidth: 160,
column: [
{
hide: true,

View File

@ -24,9 +24,8 @@
@row-save="handleRowSave"
@row-update="handleRowUpdate"
>
<template #menu="{ row }">
<el-button type="primary" @click="handleEdit(row)">上传报告</el-button>
<el-button @click="handleInfo(row)">详情</el-button>
<template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" />
</template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
@ -64,13 +63,23 @@ import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';
import { ElMessage, ElMessageBox } from 'element-plus';
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, handleNumUnit, handleShowName, targetName } =
useBasicInfo({
moduleType: '1',
});
const { getPesticideList, addPesticide, pesticideReportSave } = inputSuppliesApi;
const {
defaultGet,
loadFinish,
materialTypes,
materialTwoLevel,
goodsUnitOptions,
useDosageUnit,
handleNumUnit,
handleShowName,
targetName,
handleDelFn,
} = useBasicInfo({
moduleType: '1',
});
const { getPesticideList, addPesticide, pesticideReportSave, delPesticide } = inputSuppliesApi;
/* --------------- data --------------- */
// #region
@ -117,9 +126,8 @@ const option = ref({
labelWidth: 124,
editBtn: false,
delBtn: false,
menuWidth: 220,
dialogWidth: '60%',
editBtnText: '上传报告',
updateBtnText: '上传报告',
column: [
{
hide: true,
@ -419,7 +427,24 @@ const useDosage = ref({
num: 1,
type: '1',
});
const actions = ref([
{
name: '上传报告',
icon: 'view',
event: ({ row }) => handleEdit(row),
},
{
name: '详情',
icon: 'view',
event: ({ row }) => handleInfo(row),
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => handleDelFn(row.id, delPesticide, getData),
},
]);
// #endregion
/* --------------- methods --------------- */

View File

@ -24,7 +24,8 @@
@row-save="handleRowSave"
>
<template #menu="{ row }">
<el-button @click="handleInfo(row)">详情</el-button>
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
<el-button @click="handleDelFn(row.id, delAnimalMedicine, getData)">删除</el-button>
</template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
@ -47,8 +48,9 @@ import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, handleNumUnit, handleShowName, targetName } = useBasicInfo();
const { getAnimalMedicineList, addAnimalMedicine } = inputSuppliesApi;
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, handleNumUnit, handleShowName, targetName, handleDelFn } =
useBasicInfo();
const { getAnimalMedicineList, addAnimalMedicine, delAnimalMedicine } = inputSuppliesApi;
/* --------------- data --------------- */
// #region
@ -78,7 +80,7 @@ const option = ref({
labelWidth: 124,
editBtn: false,
delBtn: false,
menuWidth: 220,
menuWidth: 160,
dialogWidth: '50%',
column: [
{

View File

@ -1,20 +1,262 @@
<template>
<section class="custom-page">
<section>种子</section>
<h2>种源基本信息</h2>
<TypeMenu v-if="materialTypes['4'].length > 1" v-model:type="_type" :types="materialTypes['4']" />
<br />
<avue-crud
ref="crudRef"
v-model:page="pageData"
v-model:search="searchCondition"
:table-loading="_loading"
:before-close="handleCloseDialog"
:data="data"
:option="option"
@search-change="
(form, done) => {
getData(1);
done();
}
"
@search-reset="getData(1)"
@refresh-change="getData"
@current-change="getData"
@size-change="getData(1)"
@row-save="handleRowSave"
>
<template #menu="{ row }">
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
<el-button @click="handleDelFn(row.id, delSeed, getData)">删除</el-button>
</template>
<template #photoUrl-form="{ type }"> <Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" /> </template>
</avue-crud>
</section>
</template>
<script setup>
import { ref } from 'vue';
import { ref, onMounted, watch, pushScopeId } from 'vue';
import TypeMenu from '../../common/TypeMenu.vue';
import { CRUD_OPTIONS, pageData, customRules } from '@/config';
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
import inputSuppliesapi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';
const { getSeedList, seedSave, delSeed } = inputSuppliesapi;
const { loadFinish, materialTypes, targetName, handleDelFn } = useBasicInfo({
moduleType: '4',
});
const _allTypes = ref([]);
watch(
() => loadFinish.value,
(bol) => {
if (bol) {
option.value.column.forEach((v) => {
if (v.prop === '_classifyId') {
_allTypes.value = materialTypes['4'].filter((v, i) => i > 0) ?? [];
v.dicData = _allTypes.value;
}
});
}
}
);
onMounted(getData);
/* --------------- data --------------- */
// #region
const _type = ref('0');
const crudRef = ref();
const _loading = ref(true);
const searchCondition = ref({
keywords: '',
});
const data = ref([]);
const option = ref({
...CRUD_OPTIONS,
selection: false,
menuWidth: 160,
column: [
{
label: '种源名称',
prop: 'keywords',
hide: true,
search: true,
addDisplay: false,
viewDisplay: false,
editDisplay: false,
},
{
label: '种源名称',
prop: 'seedName',
rules: customRules({ msg: '请输入种源名称' }),
},
{
prop: 'manufacturer',
label: '厂家',
rules: customRules({ msg: '请输入厂家名称' }),
},
{
label: '品牌名称',
prop: 'brand',
rules: customRules({ msg: '请输入品牌名称' }),
},
{
label: '品种名称',
prop: 'varietyName',
rules: customRules({ msg: '请输入品种名称' }),
},
{
hide: true,
label: '图片',
prop: 'photoUrl',
},
{
label: '分类',
prop: '_classifyId',
type: 'cascader',
expandTrigger: 'click',
dicData: [],
rules: customRules({ msg: '请选择分类' }),
render: ({ row }) => row.classifyName ?? '',
},
{
prop: 'distributor',
label: '经销商',
},
{
prop: 'productUnit',
width: '100',
label: '产品规格',
// editDisplay: false,
},
{
label: '种植时间',
prop: 'sowingTime',
span: 24,
type: 'textarea',
},
{
hide: true,
label: '种植密度',
prop: 'plantDensity',
span: 24,
type: 'textarea',
},
{
hide: true,
label: '施肥管理',
prop: 'fertilizeManage',
span: 24,
type: 'textarea',
},
{
hide: true,
label: '水分管理',
prop: 'waterManage',
span: 24,
type: 'textarea',
},
{
hide: true,
label: '病虫害防治',
prop: 'pestControl',
span: 24,
type: 'textarea',
},
{
hide: true,
label: '注意事项',
prop: 'precautions',
span: 24,
type: 'textarea',
},
],
});
const attrs = ref([]);
// #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,
seedName: searchCondition.value.keywords,
};
if (_type.value != '0') params['classifyId'] = _type.value;
let res = await getSeedList(params);
if (res.code == 200) {
data.value = res.data.records ?? [];
pageData.value.total = res.data.total;
}
_loading.value = false;
}
function handleInfo(row) {
columnSpanChange(true);
handleAttrs(row);
crudRef.value.rowView(row);
}
async function handleRowSave(form, done, loading) {
const data = Object.assign({}, form);
delete data.keywords;
if (attrs.value.length) {
data.photoUrl = attrs.value.map((v) => v.url).join();
}
if (data._classifyId.length) {
data.photoUrl = attrs.value.map((v) => v.url).join();
}
data.classifyId = JSON.stringify(data._classifyId);
delete data._classifyId;
data.classifyName = targetName(_allTypes.value, form._classifyId, '');
let res = await seedSave(data);
if (res.code == 200) {
ElMessage.success('新增成功');
getData();
done();
}
loading();
}
/* 处理展示附件 */
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()}`,
};
});
}
}
function handleCloseDialog(done) {
columnSpanChange();
attrs.value = [];
done();
}
function columnSpanChange(row = false) {
let arr = ['photoUrl'];
option.value.column.forEach((v) => {
if (arr.includes(v.prop)) {
if (row) {
v.span = 24;
} else {
delete v.span;
}
}
});
}
// #endregion
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
h2 {
font-size: 24px;
font-weight: bold;
font-family: '黑体';
}
</style>

View File

@ -1,19 +0,0 @@
<template>
<section class="custom-page"> 农机生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,19 +0,0 @@
<template>
<section class="custom-page"> 肥料生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,13 +1,70 @@
<template>
<section class="custom-page"> 生产经销商管理 </section>
<section class="custom-page">
<avue-crud
ref="crudRef"
v-model:page="pageData"
v-model:search="searchCondition"
:table-loading="_loading"
:data="data"
:option="option"
></avue-crud>
</section>
</template>
<script setup>
import { ref } from 'vue';
import { ref, onMounted } from 'vue';
import { CRUD_OPTIONS, pageData } from '@/config';
onMounted(() => {
minitor.value?.currentUav?.videoUrl[0] ?? false;
console.log('test', minitor.value?.currentUav?.videoUrl[0] ?? false);
});
/* --------------- data --------------- */
// #region
const crudRef = ref(null);
const _loading = ref(false);
const searchCondition = ref({
keywords: '',
});
let minitor = ref({
currentUav: { videoUrl: ['12312'] },
});
const data = ref([{}]);
const option = ref({
...CRUD_OPTIONS,
column: [
{
hide: true,
search: true,
label: '经销商名称',
prop: 'keywords',
searchLabelWidth: 120,
},
{
hide: true,
search: true,
label: '经销商类型',
prop: '_dealerType',
searchLabelWidth: 120,
type: 'select',
dicData: [
{ label: '农药生产经销商', value: '1' },
{ label: '肥料生产经销商', value: '2' },
{ label: '兽药生产经销商', value: '3' },
{ label: '种源生产经销商', value: '4' },
{ label: '农机生产经销商', value: '5' },
],
},
{
label: '经销商名称',
prop: 'dealerName',
},
{
label: '经销商类型',
prop: 'dealerType',
},
],
});
// #endregion
/* --------------- methods --------------- */

View File

@ -1,19 +0,0 @@
<template>
<section class="custom-page"> 农药生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,19 +0,0 @@
<template>
<section class="custom-page"> 兽药生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,19 +0,0 @@
<template>
<section class="custom-page"> 种子生产经销商 </section>
</template>
<script setup>
import { ref } from 'vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>