This commit is contained in:
lzc 2025-04-02 13:46:53 +08:00
commit f637bec8f5
27 changed files with 2108 additions and 406 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,5 +48,48 @@ export function addFertilizer(data) {
data,
});
}
/* 删除肥料 */
export function delFretilize(ids) {
return request(`/inputGoods/fertilize/delete/${ids}`);
}
// #endregion
/* ------ 兽药 ------ */
// #region
export function getAnimalMedicineList(params) {
return request('/inputGoods/animalMedicine/page', {
params,
});
}
export function addAnimalMedicine(data) {
return request('/inputGoods/animalMedicine/save', {
method: 'POST',
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

@ -0,0 +1,51 @@
import request from '@/utils/axios';
/**
* @Title: 列表
*/
export function GetEntityList(params = {}) {
return request('/cultivation-keep/api/cultivationbreedingbase/list', {
method: 'POST',
params,
});
}
/**
* @Title: 新增
*/
export function AddEntity(data = {}) {
return request('/cultivation-keep/api/cultivationbreedingbase/add', {
method: 'POST',
data,
});
}
/**
* @Title: 修改
*/
export function UpdateEntity(data = {}) {
return request('/cultivation-keep/api/cultivationbreedingbase/update', {
method: 'POST',
data,
});
}
/**
* @Title: 删除
*/
export function DeleteEntity(params = {}) {
return request('/cultivation-keep/api/cultivationbreedingbase/del', {
method: 'POST',
params,
});
}
/**
* @Title: 更改状态
*/
export function UpdateStatus(params = {}) {
return request('/cultivation-keep/api/cultivationbreedingbase/changeStatus', {
method: 'POST',
params,
});
}

View File

@ -10,15 +10,6 @@ export function GetEntityList(params = {}) {
});
}
/**
* @Title: 信息
*/
export function GetEntity(id) {
return request(`/system/dept/list/exclude/${id}`, {
method: 'GET',
});
}
/**
* @Title: 新增
*/
@ -43,7 +34,7 @@ export function UpdateEntity(data = {}) {
* @Title: 删除
*/
export function DeleteEntity(params = {}) {
return request(`/system/dict/type/${params.id}`, {
return request(`/system/dept/${params.id}`, {
method: 'DELETE',
});
}
@ -56,3 +47,12 @@ export function GetDeptExcludeChild(id) {
method: 'GET',
});
}
/**
* @Title: 信息
*/
export function GetDept(id) {
return request(`/system/dept/list/exclude/${id}`, {
method: 'GET',
});
}

View File

@ -0,0 +1,62 @@
import request from '@/utils/axios';
/**
* @Title: 列表
*/
export function GetEntityList(params = {}) {
return request('/system/menu/list', {
method: 'GET',
params,
});
}
/**
* @Title: 新增
*/
export function AddEntity(data = {}) {
return request('/system/menu', {
method: 'POST',
data,
});
}
/**
* @Title: 修改
*/
export function UpdateEntity(data = {}) {
return request('/system/menu', {
method: 'PUT',
data,
});
}
/**
* @Title: 删除
*/
export function DeleteEntity(params = {}) {
return request(`/system/menu/${params.id}`, {
method: 'DELETE',
});
}
// 查询菜单详细
export function GetMenu(dictType) {
return request(`/system/menu/${dictType}`, {
method: 'GET',
});
}
// 查询菜单下拉树结构
// 返回parentId
export function GetMenuTree() {
return request('/system/menu/treeselect', {
method: 'GET',
});
}
// 根据角色ID查询菜单下拉树结构
export function GetRoleMenu(roleId) {
return request(`/system/menu/roleMenuTreeselect/${roleId}`, {
method: 'GET',
});
}

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

@ -34,71 +34,38 @@ 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/ratPoison',
// name: 'input-supplies-ratPoison',
// 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/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',
component: () => import('@/views/inputSuppliesManage/material/ratPoison/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

@ -20,6 +20,18 @@ export default [
name: 'system-dict',
meta: { title: '字典管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/system-menu',
component: () => import('@/views/system/menu/index.vue'),
name: 'system-menu',
meta: { title: '菜单管理', icon: 'Document' },
},
// {
// path: '/sub-government-affairs-service/system-dept',
// component: () => import('@/views/system/dept/index.vue'),
// name: 'system-dept',
// meta: { title: '部门管理', icon: 'Document' },
// },
],
},
];

View File

@ -51,12 +51,6 @@ export default [
},
],
},
{
path: '/sub-government-affairs-service/trace-manage',
name: 'trace-manage',
component: Views,
meta: { title: '溯源查询和统计', icon: 'Document' },
children: [
{
path: '/sub-government-affairs-service/trace-search',
name: 'trace-search',
@ -70,8 +64,6 @@ export default [
meta: { title: '溯源详情', icon: 'Document' },
hidden: true,
},
],
},
{
path: '/sub-government-affairs-service/trace-statistic',
name: 'trace-statistic',

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(
@ -23,9 +25,6 @@ export function useBasicInfo(set = {}) {
/* 不包含顶级 */
const materialTwoLevel = reactive({});
/* ------ 农药 ------ */
// #region
const pesticideTypes = reactive({});
const goodsUnitOptions = reactive([
{ value: '1', label: 'ml/瓶' },
{ value: '2', label: 'mg/盒' },
@ -36,7 +35,6 @@ export function useBasicInfo(set = {}) {
{ value: '2', label: '/平方米' },
{ value: '3', label: '/株' },
]);
// #endregion
// #endregion
/* ------ ------ */
@ -85,10 +83,14 @@ export function useBasicInfo(set = {}) {
}
/* 获取标签的名字 */
function targetName(arr, ids, _name) {
let _ids = JSON.parse(JSON.stringify(ids));
let name = '';
if (!arr || !arr.length || _ids.length < 1) {
return;
if (!arr || !arr.length || ids.length < 1) {
return name;
}
let _ids = JSON.parse(JSON.stringify(ids));
if (typeof ids == 'string') {
let obj = arr.find((v) => v.value == _ids) || { value: '', label: '', children: [] };
name = obj.label;
} else {
let obj = arr.find((v) => v.value == _ids[0]) || { value: '', label: '', children: [] };
name = _name + (_name ? '/' : '') + obj.label;
@ -128,18 +130,52 @@ export function useBasicInfo(set = {}) {
}, 200);
}
/* t 1规格 2用量 */
function handleNumUnit(num, unit, t) {
function handleNumUnit(_info = {}) {
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}`;
}
if (!_info.type || !_info.type < -1) return text;
const info = Object.assign(
{
num1: '',
unit1: '',
num2: '',
unit2: '',
type: -2,
},
_info
);
if (info.type == -1) {
let u1 = (goodsUnitOptions.find((_v) => _v.value == info.unit1) || { label: '' }).label;
let u2 = (useDosageUnit.find((_v) => _v.value == info.unit2) || { label: '' }).label;
text = `${info.num2}${u1.split('/')[1]}${u2}`;
} else if (info.type == 1) {
text = `${info.num1}${(goodsUnitOptions.find((_v) => _v.value == info.unit1) || { label: '' }).label}`;
} else if (info.type == 2) {
text = `${info.num2}${(useDosageUnit.find((_v) => _v.value == info.unit2) || { label: '' }).label}`;
}
return text;
}
function handleShowName(text = '') {
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;
}
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);
@ -153,6 +189,8 @@ export function useBasicInfo(set = {}) {
getmaterialType,
targetName,
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

@ -10,14 +10,22 @@
:data="data"
:table-loading="_loading"
:option="option"
:before-close="handleCloseDialog"
@search-change="
(form, done) => {
getData(1);
done();
}
"
@refresh-change="getData"
@search-reset="getData(1)"
@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> -->
<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" />
@ -42,9 +50,11 @@ 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';
import { ElMessage } from 'element-plus';
const { getFertilizreList, addFertilizer } = inputSuppliesApi;
const { loadFinish, materialTypes, materialTwoLevel, targetName, goodsUnitOptions, useDosageUnit, handleNumUnit } = useBasicInfo();
const { getFertilizreList, addFertilizer, delFretilize } = inputSuppliesApi;
const { loadFinish, materialTypes, materialTwoLevel, targetName, goodsUnitOptions, useDosageUnit, handleShowName, handleNumUnit, handleDelFn } =
useBasicInfo();
onMounted(getData);
watch(
@ -86,6 +96,7 @@ const pageData = ref({
const option = ref({
...CRUD_OPTIONS,
selection: false,
menuWidth: 160,
column: [
{
hide: true,
@ -117,15 +128,19 @@ const option = ref({
label: '经销商',
},
{
prop: 'classifyName',
prop: '_classifyId',
label: '分类',
type: 'cascader',
clearable: false,
dicData: () => [],
rules: customRules({ msg: '请选择肥料分类' }),
expandTrigger: 'click',
render: ({ row }) => {
return row.classifyName;
},
},
{
prop: 'mainComponents',
prop: 'mainComponent',
label: '化学成分',
rules: customRules({ msg: '请输入化学成分' }),
},
@ -142,8 +157,8 @@ const option = ref({
{
hide: true,
prop: '_suggest',
label: '建议用量',
viewDisplay: true,
label: '建议用量1',
viewDisplay: false,
},
{
prop: 'productSpecification',
@ -158,10 +173,22 @@ const option = ref({
editDisplay: false,
},
{
hide: true,
prop: '_produceDosage',
label: '剂型',
type: 'cascader',
dicData: [],
viewDisplay: false,
expandTrigger: 'click',
},
{
prop: 'produceDosage',
label: '剂型',
addDisplay: false,
editDisplay: false,
render: ({ row }) => {
return row.produceDosage;
},
},
{
prop: 'expiryDate',
@ -206,26 +233,25 @@ async function getData(reset) {
};
_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);
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
v.suggest = handleNumUnit({ unit1: v.productUnit, num2: v.suggestDosage, unit2: v.suggestUnit, type: -1 });
v.produceDosage = handleShowName(v.produceDosage);
return v;
});
pageData.value.total = res.data.total;
}
}
function handleRowSave(form, done, loading) {
console.log('form', form);
async function handleRowSave(form, done, loading) {
let data = {
fertilizeName: form.fertilizeName,
manufacturer: form.manufacturer,
distributor: form.distributor,
classifyId: form.classifyName,
mainComponents: form.mainComponents,
classifyId: form._classifyId[0],
classifyName: targetName(option.value.column[5].dicData, form._classifyId, ''),
mainComponent: form.mainComponent,
productSpecification: productSpecification.value.num,
productUnit: productSpecification.value.type,
suggestDosage: useDosage.value.num,
@ -241,14 +267,46 @@ function handleRowSave(form, done, loading) {
if (form._produceDosage.length) {
let names = [];
form._produceDosage.forEach((item) => {
names.push(targetName(option.value.column, item, ''));
names.push(targetName(option.value.column[12].dicData, item, ''));
});
data.produceDosage = JSON.stringify(form._produceDosage) + '|' + JSON.stringify(names);
}
console.log('data', data);
let res = await addFertilizer(data);
loading();
if (res.code == 200) {
ElMessage.success('添加成功');
resetOtherInfo();
getData();
done();
}
}
function handleInfo(row) {
if (row.photoUrl) {
attrs.value = row.photoUrl.split(',').map((v, i) => {
return { url: v, uid: `photo_${i}_${Date.now()}` };
});
}
crud.value.rowView(row);
for (let i = 0; i < option.value.column.length; i++) {
option.value.column[i].span = 24;
if (option.value.column[i].prop == 'photoUrl') {
return;
}
}
}
function resetOtherInfo() {
attrs.value = [];
productSpecification.value = { num: 1, type: '1' };
useDosage.value = { num: 1, type: '1' };
}
function handleCloseDialog(done) {
resetOtherInfo();
done();
for (let i = 0; i < option.value.column.length; i++) {
delete option.value.column[i].span;
if (option.value.column[i].prop == 'photoUrl') return;
}
}
// #endregion
</script>

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" />
@ -57,19 +56,30 @@
</template>
<script setup>
import { ref, watch, onMounted } from 'vue';
import { ref, watch } from 'vue';
import TypeMenu from '../../common/TypeMenu.vue';
import { CRUD_OPTIONS, 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';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';
import { ElMessage, ElMessageBox } from 'element-plus';
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, targetName, filterTypes } = useBasicInfo({
const {
defaultGet,
loadFinish,
materialTypes,
materialTwoLevel,
goodsUnitOptions,
useDosageUnit,
handleNumUnit,
handleShowName,
targetName,
handleDelFn,
} = useBasicInfo({
moduleType: '1',
});
const { getPesticideList, addPesticide, pesticideReportSave } = inputSuppliesApi;
const { getPesticideList, addPesticide, pesticideReportSave, delPesticide } = inputSuppliesApi;
/* --------------- data --------------- */
// #region
@ -116,9 +126,8 @@ const option = ref({
labelWidth: 124,
editBtn: false,
delBtn: false,
menuWidth: 220,
dialogWidth: '60%',
editBtnText: '上传报告',
updateBtnText: '上传报告',
column: [
{
hide: true,
@ -171,13 +180,13 @@ const option = ref({
{
prop: 'manufacturer',
label: '生产厂家',
width: '120',
width: '220',
editDisplay: false,
rules: customRules({ msg: '请输入生产厂家' }),
},
{
prop: 'distributor',
width: '120',
width: '220',
label: '经销商',
editDisplay: false,
},
@ -189,14 +198,14 @@ const option = ref({
},
{
prop: 'toxicityLevel',
width: '100',
width: '140',
label: '毒性',
editDisplay: false,
value: '无毒',
},
{
prop: 'dosage',
width: '100',
width: '140',
label: '建议用量',
editDisplay: false,
},
@ -239,6 +248,7 @@ const option = ref({
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '请选择防治对象' }),
expandTrigger: 'click',
},
{
hide: true,
@ -252,6 +262,7 @@ const option = ref({
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '请选择主要成分' }),
expandTrigger: 'click',
},
{
hide: true,
@ -265,6 +276,7 @@ const option = ref({
viewDisplay: false,
editDisplay: false,
rules: customRules({ msg: '加工剂型' }),
expandTrigger: 'click',
},
{
hide: true,
@ -415,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 --------------- */
@ -437,8 +466,8 @@ async function getData(reset) {
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.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
v.dosage = handleNumUnit({ unit1: v.productUnit, num2: v.suggestDosage, unit2: v.suggestUnit, type: -1 });
v.targetPests = handleShowName(v.targetPests);
v.mainComponent = handleShowName(v.mainComponent);
v.produceDosage = handleShowName(v.produceDosage);
@ -584,15 +613,6 @@ async function handleRowUpdate(form, index, done, loading) {
done();
}
}
function handleShowName(text = '') {
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,21 +1,314 @@
<template>
<section class="custom-page">
<section>兽药</section>
<h2>兽药基本信息</h2>
<TypeMenu v-if="materialTypes['3'].length > 1" v-model:type="_type" :types="materialTypes['3']" />
<br />
<avue-crud
ref="crud"
v-model:page="pageData"
v-model:search="searchCondition"
:table-loading="_loading"
:data="data"
:option="option"
:before-close="handleCloseDialog"
@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, delAnimalMedicine, getData)">删除</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>
</avue-crud>
</section>
</template>
<script setup>
import { ref } from 'vue';
import { ref, watch } from 'vue';
import TypeMenu from '../../common/TypeMenu.vue';
import { CRUD_OPTIONS, 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';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import { ElMessage } from 'element-plus';
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, handleNumUnit, handleShowName, targetName, handleDelFn } =
useBasicInfo();
const { getAnimalMedicineList, addAnimalMedicine, delAnimalMedicine } = inputSuppliesApi;
/* --------------- data --------------- */
// #region
const _type = ref('0');
watch(
() => _type.value,
() => getData(1),
{
deep: true,
}
);
const searchCondition = ref({
keywords: '',
});
const crud = ref();
const _loading = ref(true);
const data = ref([]);
const pageData = ref({
total: 0,
currentPage: 1,
size: 10,
});
const option = ref({
...CRUD_OPTIONS,
selection: false,
labelWidth: 124,
editBtn: false,
delBtn: false,
menuWidth: 160,
dialogWidth: '50%',
column: [
{
hide: true,
label: '关键字',
prop: 'keywords',
search: true,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
searchPlaceholder: '输入药品名称',
},
{
prop: 'animalName',
label: '名称',
width: '120',
editDisplay: false,
rules: customRules({ msg: '请输入药品名称' }),
},
{
prop: 'manufacturer',
label: '厂家',
rules: customRules({ msg: '请输入厂家名称' }),
},
{
hide: true,
prop: 'photoUrl',
label: '兽药图片',
editDisplay: false,
},
{
prop: 'distributor',
label: '经销商',
},
{
prop: 'mainComponent',
width: '200',
label: '主要成分',
},
{
prop: '_classifyId',
label: '分类',
type: 'cascader',
viewDisplay: false,
rules: customRules({ msg: '请选择分类' }),
expandTrigger: 'click',
render: ({ row }) => row.classifyName,
},
{
prop: 'productSpecification',
width: '100',
label: '产品规格',
editDisplay: false,
},
{
prop: 'produceDosage',
width: '200',
label: '加工剂型',
addDisplay: false,
editDisplay: false,
},
{
hide: true,
prop: '_produceDosage',
label: '加工剂型',
type: 'cascader',
dicData: [],
value: [],
viewDisplay: false,
editDisplay: false,
expandTrigger: 'click',
rules: customRules({ msg: '加工剂型' }),
},
{
prop: 'adaptAnimal',
label: '适用动物',
},
{
prop: 'expiryDate',
label: '保质期',
},
{
hide: true,
prop: 'purpose',
label: '作用与用途',
type: 'textarea',
span: 24,
},
{
hide: true,
prop: 'usageMethod',
label: '使用方法',
type: 'textarea',
span: 24,
},
{
hide: true,
prop: 'precautions',
label: '注意事项',
type: 'textarea',
span: 24,
},
],
});
const _allTypes = ref([]);
const _suggest = ref([]);
watch(
() => loadFinish.value,
() => {
if (loadFinish.value) {
option.value.column.forEach((v) => {
if (v.prop === '_classifyId') {
_allTypes.value = materialTypes['3'].filter((v, i) => i > 0) ?? [];
v.dicData = _allTypes.value;
}
if (v.prop === '_produceDosage') {
_suggest.value = materialTwoLevel?.['1']?.['3'] ?? [];
v.dicData = _suggest.value;
}
});
}
}
);
const attrs = ref([]);
const productSpecification = ref({
num: 1,
type: '1',
});
// #endregion
/* --------------- methods --------------- */
// #region
defaultGet(getData);
async 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,
};
_type.value != '0' && (params.classifyId = _type.value);
let res = await getAnimalMedicineList(params);
_loading.value = false;
if (res && res.code === 200) {
data.value = res.data.records;
data.value.forEach((v) => {
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
v.produceDosage = handleShowName(v.produceDosage);
});
pageData.value.total = res.data.total;
}
}
function handleCloseDialog(done) {
delete option.value.column[3].span;
resetOtherInfo();
done();
}
async function handleRowSave(form, done, loading) {
let data = {
animalName: form.animalName,
manufacturer: form.manufacturer,
distributor: form.distributor,
mainComponent: form.mainComponent,
classifyId: JSON.stringify(form._classifyId),
classifyName: targetName(_allTypes.value, form._classifyId, ''),
productSpecification: productSpecification.value.num,
productUnit: productSpecification.value.type,
adaptAnimal: form.adaptAnimal,
purpose: form.purpose,
usageMethod: form.usageMethod,
precautions: form.precautions,
expiryDate: form.expiryDate,
};
if (form._produceDosage.length) {
let names = [];
form._produceDosage.forEach((item) => {
names.push(targetName(_suggest.value, item, ''));
});
data.produceDosage = JSON.stringify(form._produceDosage) + '|' + JSON.stringify(names);
}
if (attrs.value.length) {
data.photoUrl = attrs.value.map((v) => v.url).join();
}
let res = await addAnimalMedicine(data);
loading();
if (res.code == 200) {
ElMessage.success('保存成功');
getData();
resetOtherInfo();
done();
}
}
function resetOtherInfo() {
let obj = { num: 1, type: '1' };
attrs.value = [];
productSpecification.value = obj;
}
function handleInfo(row) {
handleAttrs(row);
option.value.column[3].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()}`,
};
});
}
}
// #endregion
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
h2 {
font-size: 24px;
font-weight: bold;
font-family: '黑体';
}
</style>

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>

View File

@ -23,8 +23,8 @@
</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>
<el-tag v-if="row.status == 1" type="success">启用</el-tag>
<el-tag v-if="row.status == 0" type="danger">禁用</el-tag>
</template>
<template #menu="scope">
@ -34,13 +34,15 @@
</div>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { ref, reactive, onMounted } 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, setDicData } from '@/utils';
import { isEmpty, setDicData, debounce } from '@/utils';
import { CommonDicData } from '@/apis';
import { getLandsList } from '@/apis/land';
import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity, UpdateStatus } from '@/apis/plantingAndBreeding/base';
const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp();
@ -61,7 +63,7 @@ const state = reactive({
column: [
{
label: '基地名称',
prop: 'p1',
prop: 'baseName',
search: true,
width: 200,
rules: {
@ -72,8 +74,8 @@ const state = reactive({
overHidden: true,
},
{
label: '基地类',
prop: 'type',
label: '基地',
prop: 'baseType',
type: 'select',
search: true,
props: {
@ -95,7 +97,20 @@ const state = reactive({
label: '地块名',
prop: 'landName',
width: 200,
addDisplay: false,
editDisplay: false,
viewDisplay: true,
overHidden: true,
},
{
label: '地块名',
prop: 'landId',
width: 200,
type: 'select',
hide: true,
addDisplay: true,
editDisplay: true,
viewDisplay: false,
props: {
label: 'landName',
value: 'id',
@ -108,37 +123,28 @@ const state = reactive({
filterable: true,
remote: true,
clearable: true,
remoteMethod: (val) => remoteLandList(val),
remoteMethod: (val) => debounce(remoteLandList(val), 200),
change: (val) => selectedChange(val),
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
// addDisplay: true,
// editDisplay: true,
// viewDisplay: false,
// overHidden: true,
},
{
label: '区域位置',
prop: 'p3',
prop: 'address',
width: 200,
overHidden: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
disabled: true,
labelTip: '请先选择地块!',
},
{
label: '区域面积',
prop: 'p4',
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
prop: 'area',
width: 100,
disabled: true,
labelTip: '请先选择地块!',
},
{
label: '状态',
@ -154,6 +160,7 @@ const state = reactive({
value: 0,
},
],
value: 1,
rules: {
required: true,
message: '请输入',
@ -162,7 +169,7 @@ const state = reactive({
},
{
label: '负责人',
prop: 'p5',
prop: 'contactPerson',
rules: {
required: true,
message: '请输入',
@ -171,7 +178,7 @@ const state = reactive({
},
{
label: '联系电话',
prop: 'p6',
prop: 'contactPhone',
width: 150,
rules: {
required: true,
@ -181,15 +188,14 @@ const state = reactive({
},
{
label: '创建时间',
prop: 'createTime',
width: 150,
// search: true,
prop: 'createdAt',
width: 200,
display: false,
},
{
label: '更新时间',
prop: 'updateTime',
width: 150,
prop: 'updatedAt',
width: 200,
display: false,
},
],
@ -204,16 +210,16 @@ const state = reactive({
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: 'primary',
name: ({ row }) => {
return row.status === 1 ? '禁用' : '启用';
},
icon: ({ row }) => {
return row.status === 1 ? 'turnOff' : 'open';
},
event: ({ row }) => rowStatus(row),
},
{
type: 'danger',
name: '删除',
@ -228,54 +234,52 @@ const state = reactive({
pageSize: 10,
},
data: [],
currentRow: {},
unitList: [],
});
//
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;
// });
const getUnit = async () => {
CommonDicData('sys_unit_type')
.then((res) => {
console.log(250, res);
if (res.code === 200) {
state.unitList = res.data;
}
})
.catch((err) => {
app.$message.error(err.msg);
});
};
const loadData = async () => {
state.loading = true;
await sleep(500);
state.data = mockData(
{
p1: '耿马镇一号基地',
landName: '耿马镇2025001号地块',
p3: '耿马傣族佤族自治县/耿马镇',
p4: '1000',
p5: '张三',
p6: '13837633838',
status: 1,
type: 'base_plant',
createTime: '2025-01-01',
updateTime: '2025-01-15',
},
10
);
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;
});
};
loadData();
onMounted(() => {
getUnit();
});
//
const currentChange = (current) => {
state.query.current = current;
@ -313,29 +317,36 @@ const rowView = (row) => {
};
//
// const rowStatus = (row) => {
// console.info('');
// };
const rowStatus = (row) => {
let status = row.status === 1 ? 0 : 1;
UpdateStatus({ id: row.id, status })
.then((res) => {
if (res.code === 200) {
app.$message.success('状态更改成功!');
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
};
//
// 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();
// });
AddEntity(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('添加成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
//
@ -344,20 +355,20 @@ const 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();
// });
UpdateEntity(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
//
@ -371,16 +382,16 @@ const onDel = (rows = []) => {
type: 'warning',
})
.then(() => {
// DeleteEntity({ ids: ids.join(',') })
// .then((res) => {
// if (res.code === 200) {
// app.$message.success('');
// loadData();
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// });
DeleteEntity({ ids: ids.join(',') })
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
};
@ -391,16 +402,25 @@ const rowDel = (row, index, done) => {
//
const remoteLandList = async (val) => {
if (isEmpty(val)) return;
const query = { landName: val, current: 1, size: 20 };
const res = await getLandsList(query);
if (res.code === 200) {
setDicData(state.options.column, 'landName', res.data.records);
setDicData(state.options.column, 'landId', res.data.records);
}
};
//
const selectedChange = ({ value, item }) => {
console.log(430, value, item, item.landName, item.address, item.area);
const selectedChange = ({ item, value, dic }) => {
// console.log(390, value, item);
crudRef.value.tableForm.landId = item?.id;
crudRef.value.tableForm.landName = item?.landName;
crudRef.value.tableForm.address = item?.address;
crudRef.value.tableForm.area = item?.area;
crudRef.value.tableForm.unit = item?.landUnit;
crudRef.value.tableForm.provinceCode = item?.provinceCode;
crudRef.value.tableForm.cityCode = item?.cityCode;
crudRef.value.tableForm.districtCode = item?.county;
crudRef.value.tableForm.townCode = item?.townCode;
crudRef.value.tableForm.villageCode = item?.villageCode;
};
</script>

View File

@ -15,6 +15,11 @@
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #status="{ row }">
<el-tag v-if="row.status == 0" type="success">启用</el-tag>
<el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
@ -26,9 +31,12 @@ import { reactive, ref } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, getTree } from '@/utils';
import { useUserStore } from '@/store/modules/user';
import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity } from '@/apis/system/dept';
const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const crudRef = ref(null);
const state = reactive({
loading: false,
@ -40,18 +48,39 @@ const state = reactive({
rowKey: 'deptId',
index: false,
selection: false,
expand: true,
tree: true,
defaultExpandAll: true,
treeProps: { children: 'children', hasChildren: 'hasChildren' },
column: [
{
label: '部门名称',
prop: 'deptName',
search: true,
width: 200,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '上级部门',
prop: 'parentId',
type: 'select',
hide: true,
props: {
label: 'deptName',
value: 'deptId',
},
dicUrl: `${VITE_APP_BASE_API}/system/dept/list`,
dicHeaders: {
authorization: UserStore.token,
},
dicFormatter: (res) => {
const data = [{ deptId: 0, deptName: '根目录' }, ...res.data];
return data;
},
},
{
label: '状态',
prop: 'status',
@ -70,7 +99,7 @@ const state = reactive({
value: '0',
rules: {
required: true,
message: '请输入',
message: '请选择',
trigger: 'blur',
},
},
@ -137,7 +166,6 @@ const loadData = () => {
.then((res) => {
if (res.code === 200) {
state.data = getTree(res.data, 'deptId');
console.log(139, state.data);
}
})
.catch((err) => {
@ -223,7 +251,7 @@ const rowDel = (row, index, done) => {
type: 'warning',
})
.then(() => {
DeleteEntity({ id: row.id })
DeleteEntity({ id: row.deptId })
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');

View File

@ -18,6 +18,11 @@
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #status="{ row }">
<el-tag v-if="row.status == 0" type="success">启用</el-tag>
<el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
@ -48,13 +53,6 @@ const state = reactive({
...CRUD_OPTIONS,
selection: false,
column: [
// {
// label: '',
// prop: 'dictCode',
// addDisplay: false,
// editDisplay: false,
// viewDisplay: false,
// },
{
label: '字典名称',
prop: 'dictLabel',
@ -116,6 +114,12 @@ const state = reactive({
trigger: 'blur',
},
},
{
label: '排序',
prop: 'dictSort',
type: 'number',
hide: true,
},
{
label: '备注',
prop: 'remark',

View File

@ -18,6 +18,11 @@
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #status="{ row }">
<el-tag v-if="row.status == 0" type="success">启用</el-tag>
<el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>

View File

@ -0,0 +1,490 @@
<template>
<div class="custom-page">
<el-row :gutter="20">
<splitpanes class="default-theme">
<pane size="16">
<el-col>
<custom-table-tree title="应用分类" :data="treeData" :option="treeOption" filter @node-click="handleNodeClick">
<template #default="{ data }">
<div :class="{ 'text-primary': data.dictValue == treeSelected.dictValue }">
{{ data.dictLabel }}
</div>
</template>
</custom-table-tree>
</el-col>
</pane>
<pane size="84">
<el-col>
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:search="state.query"
:table-loading="state.loading"
:data="state.data"
:option="state.options"
@refresh-change="refreshChange"
@search-reset="searchChange"
@search-change="searchChange"
@selection-change="selectionChange"
@row-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #menuType="{ row }">
<el-tag v-if="row.menuType == 'M'" type="primary">目录</el-tag>
<el-tag v-if="row.menuType == 'C'" type="success">菜单</el-tag>
<el-tag v-if="row.menuType == 'F'" type="info">按钮</el-tag>
</template>
<template #status="{ row }">
<el-tag v-if="row.status == 0" type="success">启用</el-tag>
<el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
</avue-crud>
</el-col>
</pane>
</splitpanes>
</el-row>
</div>
</template>
<script setup>
import { computed, onMounted, reactive, ref } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, getTree, getParentIds, setPropDisplay } from '@/utils';
import { useUserStore } from '@/store/modules/user';
import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity } from '@/apis/system/menu';
import { CommonDicData } from '@/apis';
const { VITE_APP_BASE_API, VITE_APP_NAME } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const crudRef = ref(null);
const treeData = ref([]);
const treeOption = ref({
nodeKey: 'id',
props: { children: 'children', label: 'dictLabel', id: 'dictValue' },
});
const treeSelected = ref({});
const dicUrl = computed(() => `${VITE_APP_BASE_API}/system/menu/treeselect?appId=${treeSelected.value?.dictValue ?? VITE_APP_NAME}`);
const state = reactive({
loading: false,
query: {},
form: {},
selection: [],
options: {
...CRUD_OPTIONS,
rowKey: 'menuId',
index: false,
selection: false,
tree: true,
defaultExpandAll: false,
treeProps: { children: 'children', hasChildren: 'hasChildren' },
column: [
{
label: '菜单名称',
prop: 'menuName',
search: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '菜单分类',
prop: 'appId',
type: 'select',
hide: true,
props: {
label: 'dictLabel',
value: 'dictValue',
},
dicUrl: `${VITE_APP_BASE_API}/system/dict/data/type/sys_app_type`,
dicHeaders: {
authorization: UserStore.token,
},
dicFormatter: (res) => {
return res.data;
},
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
},
{
label: '菜单类型',
prop: 'menuType',
type: 'select',
dicData: [
{
label: '目录',
value: 'M',
},
{
label: '菜单',
value: 'C',
},
{
label: '按钮',
value: 'F',
},
],
change: (val) => changeMenuType(val),
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
},
{
label: '上级菜单',
prop: 'pids',
type: 'cascader',
checkStrictly: true,
hide: true,
props: {
label: 'label',
value: 'id',
},
dicUrl: dicUrl,
dicFlag: true,
dicHeaders: {
authorization: UserStore.token,
},
dicFormatter: (res) => {
return res.data;
},
},
{
label: '菜单图标',
prop: 'icon',
hide: true,
},
{
label: '路由名称',
prop: 'routeName',
width: 200,
overHidden: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '路由地址',
prop: 'path',
width: 200,
overHidden: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '组件路径',
prop: 'component',
hide: true,
},
{
label: '路由参数',
prop: 'query',
hide: true,
},
{
label: '权限标识',
prop: 'perms',
},
{
label: '菜单状态',
prop: 'status',
type: 'select',
search: true,
dicData: [
{
label: '启用',
value: '0',
},
{
label: '禁用',
value: '1',
},
],
value: '0',
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
},
{
label: '菜单顺序',
prop: 'orderNum',
type: 'number',
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '是否外链',
prop: 'isFrame',
type: 'select',
hide: true,
// labelTip: '`http(s)://`',
dicData: [
{
label: '是',
value: '0',
},
{
label: '否',
value: '1',
},
],
value: '1',
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
},
{
label: '显示状态',
prop: 'visible',
type: 'select',
hide: true,
dicData: [
{
label: '显示',
value: '0',
},
{
label: '隐藏',
value: '1',
},
],
value: '0',
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
},
{
label: '是否缓存',
prop: 'isCache',
type: 'select',
hide: true,
dicData: [
{
label: '缓存',
value: '0',
},
{
label: '不缓存',
value: '1',
},
],
value: '0',
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
},
],
actions: [
{
name: '查看',
icon: 'view',
event: ({ row }) => rowView(row),
},
{
name: '编辑',
icon: 'edit',
event: ({ row }) => rowEdit(row),
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => rowDel(row),
},
],
},
data: [],
});
// tree
const getMenuTree = async () => {
try {
const res = await CommonDicData('sys_app_type');
if (res.code == 200) {
treeData.value = res.data;
}
} catch (err) {
app.$message.error(err.msg);
}
};
const handleNodeClick = (data) => {
treeSelected.value = data;
state.query.appId = data.dictValue;
loadData();
};
getMenuTree();
//
const loadData = () => {
state.loading = true;
GetEntityList(state.query)
.then((res) => {
if (res.code === 200) {
state.data = getTree(res.data, 'menuId');
}
})
.catch((err) => {
app.$message.error(err.msg);
state.data = [];
})
.finally(() => {
state.loading = false;
});
};
onMounted(() => {
loadData();
});
//
const searchChange = (params, done) => {
if (done) done();
state.query = params;
loadData();
};
//
const refreshChange = () => {
loadData();
app.$message.success('刷新成功');
};
//
const selectionChange = (rows) => {
state.selection = rows;
};
const changeMenuType = ({ value }) => {
console.log(value);
switch (value) {
case 'M': {
const fields = ['routeName', 'component', 'perms', 'query', 'isCache'];
setPropDisplay(state.options.column, fields);
break;
}
case 'C': {
const fields = [];
setPropDisplay(state.options.column, fields);
break;
}
case 'F': {
const fields = ['icon', 'routeName', 'path', 'component', 'query', 'isFrame', 'visible', 'isCache'];
setPropDisplay(state.options.column, fields);
break;
}
}
};
//
const rowView = (row) => {
crudRef.value.rowView(row);
};
const setPid = (row) => {
if (!isEmpty(row.pids)) {
const len = row.pids.length;
row.parentId = row?.pids[len - 1] ?? 0;
}
};
//
const rowSave = (row, done, loading) => {
setPid(row);
AddEntity(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('添加成功!');
done();
getMenuTree();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
//
const rowEdit = (row) => {
// row.pids = getParentIds(treeData.value, row.menuId, 'menuId');
row.pids = getParentIds(state.data, row.menuId, 'menuId');
crudRef.value.rowEdit(row);
};
const rowUpdate = (row, index, done, loading) => {
setPid(row);
UpdateEntity(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
done();
getMenuTree();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
//
const rowDel = (row, index, done) => {
if (isEmpty(row)) return;
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
DeleteEntity({ id: row.menuId })
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
getMenuTree();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
};
</script>

View File

@ -156,7 +156,7 @@ const state = reactive({
dicHeaders: {
authorization: UserStore.token,
},
dicFormatter: (res) => res?.data?.records ?? [],
dicFormatter: (res) => res?.data ?? [],
rules: {
required: true,
message: '请选择',