Merge branch 'dev' of http://192.168.18.88:8077/sznyb/daimp-front into dev
This commit is contained in:
commit
c525285857
@ -10,4 +10,4 @@ VITE_APP_SUB_GSS = '//localhost:9529/sub-government-screen-service/'
|
|||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
||||||
VITE_APP_UPLOAD_API = '/uploadApis'
|
VITE_APP_UPLOAD_API = '/uploadApis'
|
||||||
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:9300'
|
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
|
@ -39,7 +39,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
[VITE_APP_UPLOAD_API]: {
|
[VITE_APP_UPLOAD_API]: {
|
||||||
target: VITE_APP_UPLOAD_URL,
|
target: VITE_APP_UPLOAD_URL,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/uploadApis/, ''),
|
// rewrite: (path) => path.replace(/^\/uploadApis/, ''),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import request from '@/utils/axios';
|
import request from '@/utils/axios';
|
||||||
import { isEmpty } from '@/utils';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Title: 获取字典
|
* @Title: 获取字典
|
||||||
*/
|
*/
|
||||||
export function CommonDicData(params = { pageNum: 1, pageSize: 20, dictType: null }) {
|
export function CommonDicData(dictType) {
|
||||||
if (isEmpty(params?.dictType)) return;
|
return request(`/system/dict/data/type/${dictType}`, {
|
||||||
return request(`/system/dict/data/list`, {
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
apisType: 'dicData',
|
|
||||||
params,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,3 +12,10 @@ export function getPesticideList(params) {
|
|||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/* 新增农药 */
|
||||||
|
export function addPesticide(data) {
|
||||||
|
return request('/inputGoods/pesticide/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2022-02-23 21:12:37
|
* @Date: 2022-02-23 21:12:37
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2025-02-18 09:47:41
|
* @LastEditTime: 2025-03-26 10:02:18
|
||||||
*/
|
*/
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ElNotification } from 'element-plus';
|
import { ElNotification } from 'element-plus';
|
||||||
@ -51,10 +51,6 @@ publicAxios.interceptors.request.use(async (config) => {
|
|||||||
config.headers['Content-Type'] = config.uploadType;
|
config.headers['Content-Type'] = config.uploadType;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'dicData': {
|
|
||||||
config.baseURL = VITE_APP_DICDATA_API;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
default: {
|
||||||
config.baseURL = VITE_APP_BASE_API;
|
config.baseURL = VITE_APP_BASE_API;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-menu mode="horizontal" class="input_supplies_type_menu_" @select="handleTypeSelect">
|
<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}`">
|
<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" :index="item.value">{{ item.label }}</el-menu-item>
|
||||||
<SubMenu v-else :types="item" />
|
<SubMenu v-else :types="item" />
|
||||||
@ -8,6 +8,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
import SubMenu from './SubMenu.vue';
|
import SubMenu from './SubMenu.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['update:type']);
|
const emit = defineEmits(['update:type']);
|
||||||
@ -59,7 +60,12 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: '0',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
const ac = ref(props.type);
|
||||||
function handleTypeSelect(key) {
|
function handleTypeSelect(key) {
|
||||||
emit('update:type', key);
|
emit('update:type', key);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ export function useBasicInfo(set = {}) {
|
|||||||
},
|
},
|
||||||
set
|
set
|
||||||
);
|
);
|
||||||
|
|
||||||
/* ------ data ------ */
|
/* ------ data ------ */
|
||||||
// #region
|
// #region
|
||||||
const materialTypes = reactive({
|
const materialTypes = reactive({
|
||||||
@ -19,6 +20,7 @@ export function useBasicInfo(set = {}) {
|
|||||||
4: [{ value: '0', label: '全部' }],
|
4: [{ value: '0', label: '全部' }],
|
||||||
5: [{ value: '0', label: '全部' }],
|
5: [{ value: '0', label: '全部' }],
|
||||||
});
|
});
|
||||||
|
/* 不包含顶级 */
|
||||||
const materialTwoLevel = ref({});
|
const materialTwoLevel = ref({});
|
||||||
|
|
||||||
/* ------ 农药 ------ */
|
/* ------ 农药 ------ */
|
||||||
@ -37,19 +39,26 @@ export function useBasicInfo(set = {}) {
|
|||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
/* ------ ------ */
|
||||||
|
// #region
|
||||||
|
|
||||||
|
/* 获取物资类型 */
|
||||||
async function getmaterialType(_set = {}) {
|
async function getmaterialType(_set = {}) {
|
||||||
let params = Object.assign(searchCondition, _set);
|
let params = Object.assign(searchCondition, _set);
|
||||||
let res = await getMaterailTypes(params);
|
let res = await getMaterailTypes(params);
|
||||||
console.log('two --- ', res);
|
|
||||||
if (res && res?.code == 200) {
|
if (res && res?.code == 200) {
|
||||||
res.data.forEach((item) => {
|
res.data.forEach((item) => {
|
||||||
const { moduleType, children } = item;
|
const { moduleType, children } = item;
|
||||||
materialTypes[moduleType].push(...handleTypes(children));
|
materialTypes[moduleType].push(...handleTypes(children));
|
||||||
|
// materialTwoLevel.value[moduleType] = handleTypes(children);
|
||||||
handleTwoLevel();
|
handleTwoLevel();
|
||||||
});
|
});
|
||||||
|
console.log('materialTypes --- ', materialTypes);
|
||||||
|
console.log('materialTwoLevel --- ', materialTwoLevel.value);
|
||||||
}
|
}
|
||||||
loadFinish.value = true;
|
loadFinish.value = true;
|
||||||
}
|
}
|
||||||
|
/* 将所有的数据处理成value label格式,方便其他地方指直接使用 */
|
||||||
function handleTypes(arr) {
|
function handleTypes(arr) {
|
||||||
arr.forEach((item) => {
|
arr.forEach((item) => {
|
||||||
item.value = item.id;
|
item.value = item.id;
|
||||||
@ -60,6 +69,7 @@ export function useBasicInfo(set = {}) {
|
|||||||
});
|
});
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
/* 处理二级及以下的联动数据 */
|
||||||
function handleTwoLevel() {
|
function handleTwoLevel() {
|
||||||
for (let key in materialTypes) {
|
for (let key in materialTypes) {
|
||||||
materialTwoLevel.value[key] = {};
|
materialTwoLevel.value[key] = {};
|
||||||
@ -70,6 +80,22 @@ 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;
|
||||||
|
} else {
|
||||||
|
let obj = arr.find((v) => v.value == _ids[0]) || { value: '', label: '', children: [] };
|
||||||
|
name = _name + (_name ? '/' : '') + obj.label;
|
||||||
|
_ids.splice(0, 1);
|
||||||
|
if (_ids.length > 0) {
|
||||||
|
name = targetName(obj.children, _ids, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
function filterTypes(_set = {}) {
|
function filterTypes(_set = {}) {
|
||||||
let filterType = Object.assign(
|
let filterType = Object.assign(
|
||||||
{
|
{
|
||||||
@ -81,7 +107,6 @@ export function useBasicInfo(set = {}) {
|
|||||||
let all = materialTypes[filterType.moduleType];
|
let all = materialTypes[filterType.moduleType];
|
||||||
let _arr = [];
|
let _arr = [];
|
||||||
all.forEach((item) => {
|
all.forEach((item) => {
|
||||||
console.log('item', item);
|
|
||||||
if (filterType.dataType == item.dataType) {
|
if (filterType.dataType == item.dataType) {
|
||||||
_arr = item.children;
|
_arr = item.children;
|
||||||
}
|
}
|
||||||
@ -89,6 +114,7 @@ export function useBasicInfo(set = {}) {
|
|||||||
return _arr;
|
return _arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #endregion
|
||||||
onMounted(getmaterialType);
|
onMounted(getmaterialType);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -98,6 +124,7 @@ export function useBasicInfo(set = {}) {
|
|||||||
goodsUnitOptions,
|
goodsUnitOptions,
|
||||||
useDosageUnit,
|
useDosageUnit,
|
||||||
getmaterialType,
|
getmaterialType,
|
||||||
|
targetName,
|
||||||
filterTypes,
|
filterTypes,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -37,12 +37,16 @@ const option = ref({
|
|||||||
CRUD_OPTIONS,
|
CRUD_OPTIONS,
|
||||||
selection: false,
|
selection: false,
|
||||||
column: [
|
column: [
|
||||||
|
{
|
||||||
|
prop: 'keywords',
|
||||||
|
label: '关键字',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: '',
|
||||||
label: '编号',
|
label: '编号',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: '',
|
prop: 'xxxName',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<CustomCard>
|
<CustomCard>
|
||||||
<h2>农药基本信息</h2>
|
<h2>农药基本信息</h2>
|
||||||
<TypeMenu v-if="materialTypes.length > 1" v-model:type="_type" :types="materialTypes['1']" />
|
<TypeMenu v-if="materialTypes[1].length > 1" v-model:type="_type" :types="materialTypes['1']" />
|
||||||
<br />
|
<br />
|
||||||
<avue-crud
|
<avue-crud
|
||||||
ref="crud"
|
ref="crud"
|
||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
|
v-model:search="searchCondition"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:data="data"
|
:data="data"
|
||||||
:option="option"
|
:option="option"
|
||||||
:before-close="handleCloseDialog"
|
:before-close="handleCloseDialog"
|
||||||
|
@search-change="
|
||||||
|
(form, done) => {
|
||||||
|
getData(1);
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@search-reset="getData(1)"
|
||||||
@refresh-change="getData"
|
@refresh-change="getData"
|
||||||
|
@current-change="getData"
|
||||||
|
@size-change="getData(1)"
|
||||||
@row-save="handleRowSave"
|
@row-save="handleRowSave"
|
||||||
@row-update="handleRowUpdate"
|
@row-update="handleRowUpdate"
|
||||||
>
|
>
|
||||||
@ -45,35 +55,34 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, watch, onMounted, h, computed } from 'vue';
|
import { reactive, ref, watch, onMounted, h } from 'vue';
|
||||||
import CustomCard from '@/components/CustomCard.vue';
|
import CustomCard from '@/components/CustomCard.vue';
|
||||||
import TypeMenu from '../../common/TypeMenu.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 { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
|
||||||
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
|
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
|
||||||
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
|
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
|
||||||
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
|
||||||
const { loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, filterTypes } = useBasicInfo({
|
const { loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, targetName, filterTypes } = useBasicInfo({
|
||||||
moduleType: '1',
|
moduleType: '1',
|
||||||
});
|
});
|
||||||
const { getPesticideList } = inputSuppliesApi;
|
const { getPesticideList, addPesticide } = inputSuppliesApi;
|
||||||
onMounted(getData);
|
onMounted(getData);
|
||||||
|
|
||||||
/* --------------- data --------------- */
|
/* --------------- data --------------- */
|
||||||
// #region
|
// #region
|
||||||
const _type = ref('');
|
const _type = ref('0');
|
||||||
watch(
|
watch(
|
||||||
() => _type.value,
|
() => _type.value,
|
||||||
() => {
|
() => getData(1),
|
||||||
console.log(_type.value);
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
deep: true,
|
deep: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const searchCondition = ref({
|
const searchCondition = ref({
|
||||||
pesticideName: '',
|
keywords: '',
|
||||||
});
|
});
|
||||||
const crud = ref();
|
const crud = ref();
|
||||||
const _loading = ref(false);
|
const _loading = ref(false);
|
||||||
@ -83,6 +92,24 @@ const pageData = ref({
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const dicDatas = ref({
|
||||||
|
_targetPests: {
|
||||||
|
one: '1',
|
||||||
|
two: '1',
|
||||||
|
dic: [],
|
||||||
|
},
|
||||||
|
_mainComponent: {
|
||||||
|
one: '1',
|
||||||
|
two: '2',
|
||||||
|
dic: [],
|
||||||
|
},
|
||||||
|
_produceDosage: {
|
||||||
|
one: '1',
|
||||||
|
two: '3',
|
||||||
|
dic: [],
|
||||||
|
},
|
||||||
|
});
|
||||||
const option = ref({
|
const option = ref({
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
selection: false,
|
selection: false,
|
||||||
@ -95,6 +122,7 @@ const option = ref({
|
|||||||
{
|
{
|
||||||
hide: true,
|
hide: true,
|
||||||
label: '关键字',
|
label: '关键字',
|
||||||
|
prop: 'keywords',
|
||||||
search: true,
|
search: true,
|
||||||
addDisplay: false,
|
addDisplay: false,
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
@ -109,6 +137,7 @@ const option = ref({
|
|||||||
prop: 'pesticideName',
|
prop: 'pesticideName',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
|
rules: customRules({ msg: '请输入农药名称' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hide: true,
|
hide: true,
|
||||||
@ -116,6 +145,7 @@ const option = ref({
|
|||||||
label: '产品标准证号',
|
label: '产品标准证号',
|
||||||
viewDisplay: false,
|
viewDisplay: false,
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
|
rules: customRules({ msg: '请输入产品标准证号' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hide: true,
|
hide: true,
|
||||||
@ -129,11 +159,13 @@ const option = ref({
|
|||||||
label: '农药登记证号',
|
label: '农药登记证号',
|
||||||
viewDisplay: false,
|
viewDisplay: false,
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
|
rules: customRules({ msg: '请输登记证号' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'manufacturer',
|
prop: 'manufacturer',
|
||||||
label: '生产厂家',
|
label: '生产厂家',
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
|
rules: customRules({ msg: '请输入生产厂家' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'distributor',
|
prop: 'distributor',
|
||||||
@ -144,55 +176,80 @@ const option = ref({
|
|||||||
prop: 'productSpecification',
|
prop: 'productSpecification',
|
||||||
label: '产品规格',
|
label: '产品规格',
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
|
render: ({ row }) => {
|
||||||
|
return `${row.productSpecification}${goodsUnitOptions.find((v) => v.value == row.productUnit).label}`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'toxicityLevel',
|
prop: 'toxicityLevel',
|
||||||
label: '毒性',
|
label: '毒性',
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
|
value: '无毒',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'dosage',
|
prop: 'dosage',
|
||||||
label: '建议用量',
|
label: '建议用量',
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
|
render: ({ row }) => {
|
||||||
|
return `${row.suggestDosage}${useDosageUnit.find((v) => v.value == row.suggestUnit).label}`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'validity',
|
prop: 'expiryDate',
|
||||||
label: '保质期',
|
label: '保质期',
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'preventTargets',
|
prop: 'targetPests',
|
||||||
label: '防治对象',
|
label: '防治对象',
|
||||||
type: 'cascader',
|
|
||||||
checkStrictly: true,
|
|
||||||
multiple: true,
|
|
||||||
dicData: [],
|
|
||||||
span: 24,
|
|
||||||
editDisplay: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'mainComponents',
|
prop: 'mainComponent',
|
||||||
label: '化学成分',
|
label: '化学成分',
|
||||||
type: 'cascader',
|
|
||||||
checkStrictly: true,
|
|
||||||
multiple: true,
|
|
||||||
dicData: materialTwoLevel.value?.['1']?.['2'] ?? [],
|
|
||||||
span: 24,
|
|
||||||
editDisplay: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'dosageForm',
|
prop: 'produceDosage',
|
||||||
label: '加工剂型',
|
label: '加工剂型',
|
||||||
type: 'cascader',
|
|
||||||
checkStrictly: true,
|
|
||||||
multiple: true,
|
|
||||||
dicData: materialTwoLevel.value?.['1']?.['3'] ?? [],
|
|
||||||
span: 24,
|
|
||||||
editDisplay: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hide: true,
|
hide: true,
|
||||||
prop: 'useMethods',
|
prop: '_targetPests',
|
||||||
|
label: '防治对象',
|
||||||
|
type: 'cascader',
|
||||||
|
multiple: true,
|
||||||
|
dicData: [],
|
||||||
|
value: [],
|
||||||
|
span: 24,
|
||||||
|
editDisplay: false,
|
||||||
|
rules: customRules({ msg: '请选择防治对象' }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hide: true,
|
||||||
|
prop: '_mainComponent',
|
||||||
|
label: '化学成分',
|
||||||
|
type: 'cascader',
|
||||||
|
multiple: true,
|
||||||
|
dicData: [],
|
||||||
|
value: [],
|
||||||
|
span: 24,
|
||||||
|
editDisplay: false,
|
||||||
|
rules: customRules({ msg: '请选择主要成分' }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hide: true,
|
||||||
|
prop: '_produceDosage',
|
||||||
|
label: '加工剂型',
|
||||||
|
type: 'cascader',
|
||||||
|
multiple: true,
|
||||||
|
dicData: [],
|
||||||
|
value: [],
|
||||||
|
span: 24,
|
||||||
|
editDisplay: false,
|
||||||
|
rules: customRules({ msg: '加工剂型' }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hide: true,
|
||||||
|
prop: 'usageMethod',
|
||||||
label: '使用方法',
|
label: '使用方法',
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
span: 24,
|
span: 24,
|
||||||
@ -201,7 +258,7 @@ const option = ref({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
hide: true,
|
hide: true,
|
||||||
prop: 'tips',
|
prop: 'precautions',
|
||||||
label: '注意事项',
|
label: '注意事项',
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
span: 24,
|
span: 24,
|
||||||
@ -287,18 +344,15 @@ watch(
|
|||||||
() => loadFinish.value,
|
() => loadFinish.value,
|
||||||
() => {
|
() => {
|
||||||
if (loadFinish.value) {
|
if (loadFinish.value) {
|
||||||
let newDicName = [
|
for (let key in dicDatas.value) {
|
||||||
{ key: '', one: '1', two: '1' },
|
|
||||||
{ key: '', one: '1', two: '2' },
|
|
||||||
{ key: '', one: '1', two: '3' },
|
|
||||||
];
|
|
||||||
newDicName.forEach((v) => {
|
|
||||||
option.value.column.forEach((item) => {
|
option.value.column.forEach((item) => {
|
||||||
if (item.prop === v.key) {
|
if (item.prop === key) {
|
||||||
item.dicData = materialTwoLevel?.[v.one]?.[v.two] ?? [];
|
let dic = materialTwoLevel.value?.[dicDatas.value[key].one]?.[dicDatas.value[key].two] ?? [];
|
||||||
|
dicDatas.value[key].dic = dic;
|
||||||
|
item.dicData = dic;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -323,8 +377,9 @@ async function getData(reset) {
|
|||||||
let params = {
|
let params = {
|
||||||
current: pageData.value.currentPage,
|
current: pageData.value.currentPage,
|
||||||
size: pageData.value.size,
|
size: pageData.value.size,
|
||||||
...searchCondition.value,
|
pesticideName: searchCondition.value.keywords,
|
||||||
};
|
};
|
||||||
|
_type.value != '0' && (params.classifyId = _type.value);
|
||||||
let res = await getPesticideList(params);
|
let res = await getPesticideList(params);
|
||||||
console.log('res --- ', res);
|
console.log('res --- ', res);
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
@ -334,14 +389,68 @@ async function getData(reset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handleCloseDialog(done) {
|
function handleCloseDialog(done) {
|
||||||
|
resetOtherInfo();
|
||||||
handleCheckInfoChange();
|
handleCheckInfoChange();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRowSave(form, done, loading) {
|
async function handleRowSave(form, done, loading) {
|
||||||
console.log('handleRowSave', form);
|
console.log('handleRowSave', form);
|
||||||
|
let data = {
|
||||||
|
pesticideName: form.pesticideName,
|
||||||
|
productStandCode: form.productStandCode,
|
||||||
|
pesticideRegistCode: form.pesticideRegistCode,
|
||||||
|
manufacturer: form.manufacturer,
|
||||||
|
distributor: form.distributor,
|
||||||
|
toxicityLevel: form.toxicityLevel,
|
||||||
|
usageMethod: form.usageMethod,
|
||||||
|
precautions: form.precautions,
|
||||||
|
expiryDate: form.expiryDate,
|
||||||
|
productSpecification: productSpecification.value.num,
|
||||||
|
productUnit: productSpecification.value.type,
|
||||||
|
suggestDosage: useDosage.value.num,
|
||||||
|
suggestUnit: useDosage.value.type,
|
||||||
|
};
|
||||||
|
if (attrs.value.length) {
|
||||||
|
data.pesticidePhoto = attrs.value.map((v) => v.url).join();
|
||||||
|
}
|
||||||
|
if (form._targetPests.length) {
|
||||||
|
let names = [];
|
||||||
|
form._targetPests.forEach((item) => {
|
||||||
|
names.push(targetName(dicDatas.value._targetPests.dic, item, ''));
|
||||||
|
});
|
||||||
|
data.targetPests = JSON.stringify(form._targetPests) + '|' + JSON.stringify(names);
|
||||||
|
}
|
||||||
|
if (form._mainComponent.length) {
|
||||||
|
let names = [];
|
||||||
|
form._mainComponent.forEach((item) => {
|
||||||
|
names.push(targetName(dicDatas.value._mainComponent.dic, item, ''));
|
||||||
|
});
|
||||||
|
data.mainComponent = JSON.stringify(form._mainComponent) + '|' + JSON.stringify(names);
|
||||||
|
}
|
||||||
|
if (form._produceDosage.length) {
|
||||||
|
let names = [];
|
||||||
|
form._produceDosage.forEach((item) => {
|
||||||
|
names.push(targetName(dicDatas.value._produceDosage.dic, item, ''));
|
||||||
|
});
|
||||||
|
data.produceDosage = JSON.stringify(form._produceDosage) + '|' + JSON.stringify(names);
|
||||||
|
}
|
||||||
|
let res = await addPesticide(data);
|
||||||
|
if (res.code == 200) {
|
||||||
|
ElMessage.success('保存成功');
|
||||||
|
getData();
|
||||||
|
// resetOtherInfo();
|
||||||
|
// done();
|
||||||
|
}
|
||||||
loading();
|
loading();
|
||||||
}
|
}
|
||||||
|
function resetOtherInfo() {
|
||||||
|
let obj = { num: 1, type: '1' };
|
||||||
|
attrs.value = [];
|
||||||
|
productSpecification.value = obj;
|
||||||
|
useDosage.value = obj;
|
||||||
|
}
|
||||||
|
|
||||||
function handleEdit(row) {
|
function handleEdit(row) {
|
||||||
console.log('handleEdit', row);
|
console.log('handleEdit', row);
|
||||||
handleCheckInfoChange('open');
|
handleCheckInfoChange('open');
|
||||||
@ -389,6 +498,11 @@ async function handleRowUpdate(form, done, loading) {
|
|||||||
console.log('update from -- ', form);
|
console.log('update from -- ', form);
|
||||||
loading();
|
loading();
|
||||||
}
|
}
|
||||||
|
function handleShowName(text = '') {
|
||||||
|
if (!text || text.includes('|')) return false;
|
||||||
|
let names = text.split('|')[1];
|
||||||
|
console.log('names', names);
|
||||||
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -0,0 +1,449 @@
|
|||||||
|
<template>
|
||||||
|
<div class="custom-page">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<splitpanes class="default-theme">
|
||||||
|
<pane size="16">
|
||||||
|
<el-col :span="4">
|
||||||
|
<custom-table-tree title="种养殖基地分类" :data="treeData" :option="treeOption" @node-click="onNodeClick">
|
||||||
|
<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"
|
||||||
|
v-model:page="state.pageData"
|
||||||
|
:table-loading="state.loading"
|
||||||
|
:data="state.data"
|
||||||
|
:option="state.options"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@search-reset="searchChange"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@row-del="rowDel"
|
||||||
|
@row-save="rowSave"
|
||||||
|
@row-update="rowUpdate"
|
||||||
|
>
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="danger" icon="delete" @click="onDel(state.selection)">批量删除</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #status="{ row }">
|
||||||
|
<el-tag v-if="row.status == 1" type="success" size="small">启用</el-tag>
|
||||||
|
<el-tag v-if="row.status == 0" type="danger" size="small">禁用</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
</el-col>
|
||||||
|
</pane>
|
||||||
|
</splitpanes>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { isEmpty, mockData, sleep, setDicData } from '@/utils';
|
||||||
|
import { CommonDicData } from '@/apis';
|
||||||
|
import { getLandsList } from '@/apis/land';
|
||||||
|
|
||||||
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
|
const app = useApp();
|
||||||
|
const UserStore = useUserStore();
|
||||||
|
const router = useRouter();
|
||||||
|
const crudRef = ref(null);
|
||||||
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
selection: true,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '基地名称',
|
||||||
|
prop: 'p1',
|
||||||
|
search: true,
|
||||||
|
width: 200,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
overHidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '基地分类',
|
||||||
|
prop: 'type',
|
||||||
|
type: 'select',
|
||||||
|
props: {
|
||||||
|
label: 'landName',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
dicUrl: `${VITE_APP_BASE_API}/land-resource/landManage/page?current=1&size=20`,
|
||||||
|
dicHeaders: {
|
||||||
|
authorization: UserStore.token,
|
||||||
|
},
|
||||||
|
dicFormatter: (res) => res.data?.records ?? [],
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '地块名',
|
||||||
|
prop: 'landName',
|
||||||
|
width: 200,
|
||||||
|
type: 'select',
|
||||||
|
props: {
|
||||||
|
label: 'landName',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
dicUrl: `${VITE_APP_BASE_API}/land-resource/landManage/page?current=1&size=20`,
|
||||||
|
dicHeaders: {
|
||||||
|
authorization: UserStore.token,
|
||||||
|
},
|
||||||
|
dicFormatter: (res) => res.data?.records ?? [],
|
||||||
|
filterable: true,
|
||||||
|
remote: true,
|
||||||
|
clearable: true,
|
||||||
|
remoteMethod: (val) => remoteLandList(val),
|
||||||
|
change: (val) => selectedChange(val),
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
// addDisplay: true,
|
||||||
|
// editDisplay: true,
|
||||||
|
// viewDisplay: false,
|
||||||
|
// overHidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '区域位置',
|
||||||
|
prop: 'p3',
|
||||||
|
width: 200,
|
||||||
|
overHidden: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '区域面积',
|
||||||
|
prop: 'p4',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '状态',
|
||||||
|
prop: 'status',
|
||||||
|
type: 'select',
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: '启用',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '禁用',
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '负责人',
|
||||||
|
prop: 'p5',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '联系电话',
|
||||||
|
prop: 'p6',
|
||||||
|
width: 150,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建时间',
|
||||||
|
prop: 'createTime',
|
||||||
|
width: 150,
|
||||||
|
// search: true,
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '更新时间',
|
||||||
|
prop: 'updateTime',
|
||||||
|
width: 150,
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '查看',
|
||||||
|
icon: 'view',
|
||||||
|
event: ({ row }) => rowView(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => rowEdit(row),
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: 'success',
|
||||||
|
// name: ({ row }) => {
|
||||||
|
// return row.status === 1 ? '禁用' : '启用';
|
||||||
|
// },
|
||||||
|
// icon: ({ row }) => {
|
||||||
|
// return row.status === 1 ? 'turnOff' : 'open';
|
||||||
|
// },
|
||||||
|
// event: ({ row }) => rowStatus(row),
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => rowDel(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
// tree
|
||||||
|
const treeData = ref([]);
|
||||||
|
const treeOption = ref({
|
||||||
|
nodeKey: 'id',
|
||||||
|
props: { label: 'dictLabel', id: 'dictValue' },
|
||||||
|
});
|
||||||
|
const treeSelected = ref({});
|
||||||
|
const getTree = async () => {
|
||||||
|
try {
|
||||||
|
const res = await CommonDicData({ dictType: 'sys_base_type' });
|
||||||
|
if (res.code == 200) {
|
||||||
|
treeData.value = res.data.records;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getTree();
|
||||||
|
|
||||||
|
// 加载
|
||||||
|
const loadData = async () => {
|
||||||
|
//state.loading = true;
|
||||||
|
// GetEntityList(state.query)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// const { current, size, total, records } = res.data;
|
||||||
|
// state.data = records;
|
||||||
|
// state.pageData = {
|
||||||
|
// currentPage: current || 1,
|
||||||
|
// pageSize: size || 10,
|
||||||
|
// total: total,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// state.data = [];
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// state.loading = false;
|
||||||
|
// });
|
||||||
|
|
||||||
|
state.loading = true;
|
||||||
|
await sleep(500);
|
||||||
|
state.data = mockData(
|
||||||
|
{
|
||||||
|
p1: '耿马镇一号基地',
|
||||||
|
landName: '耿马镇2025001号地块',
|
||||||
|
p3: '耿马傣族佤族自治县/耿马镇',
|
||||||
|
p4: '1000',
|
||||||
|
p5: '张三',
|
||||||
|
p6: '13837633838',
|
||||||
|
status: 1,
|
||||||
|
type: 1,
|
||||||
|
createTime: '2025-01-01',
|
||||||
|
updateTime: '2025-01-15',
|
||||||
|
},
|
||||||
|
10
|
||||||
|
);
|
||||||
|
state.loading = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
loadData();
|
||||||
|
|
||||||
|
const onNodeClick = (data) => {
|
||||||
|
console.log(300, data);
|
||||||
|
treeSelected.value = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查看
|
||||||
|
const rowView = (row) => {
|
||||||
|
crudRef.value.rowView(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 启用、禁用
|
||||||
|
// const rowStatus = (row) => {
|
||||||
|
// console.info('操作状态');
|
||||||
|
// };
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
// const onAdd = () => {
|
||||||
|
// crudRef.value && crudRef.value.rowAdd();
|
||||||
|
// };
|
||||||
|
const rowSave = (row, done, loading) => {
|
||||||
|
// AddEntity(row)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// app.$message.success('添加成功!');
|
||||||
|
// done();
|
||||||
|
// loadData();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// loading();
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const rowEdit = (row) => {
|
||||||
|
crudRef.value && crudRef.value.rowEdit(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
|
// UpdateEntity(row)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// app.$message.success('更新成功!');
|
||||||
|
// done();
|
||||||
|
// loadData();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// loading();
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const onDel = (rows = []) => {
|
||||||
|
if (isEmpty(rows)) return;
|
||||||
|
const ids = rows.map((item) => item.id);
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
// DeleteEntity({ ids: ids.join(',') })
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// app.$message.success('删除成功!');
|
||||||
|
// loadData();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// });
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowDel = (row, index, done) => {
|
||||||
|
onDel([row]);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 远程搜搜
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择赋值
|
||||||
|
const selectedChange = ({ value, item }) => {
|
||||||
|
console.log(430, value, item, item.landName, item.address, item.area);
|
||||||
|
};
|
||||||
|
</script>
|
@ -1,10 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="custom-page">
|
<div class="custom-page">
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="4">
|
|
||||||
<custom-table-tree title="种养殖基地分类" :data="treeData" @node-click="onNodeClick" />
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="20">
|
|
||||||
<avue-crud
|
<avue-crud
|
||||||
ref="crudRef"
|
ref="crudRef"
|
||||||
v-model="state.form"
|
v-model="state.form"
|
||||||
@ -36,8 +31,6 @@
|
|||||||
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
</template>
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -49,21 +42,11 @@ import { CRUD_OPTIONS } from '@/config';
|
|||||||
import { isEmpty, mockData, sleep, setDicData } from '@/utils';
|
import { isEmpty, mockData, sleep, setDicData } from '@/utils';
|
||||||
import { getLandsList } from '@/apis/land';
|
import { getLandsList } from '@/apis/land';
|
||||||
|
|
||||||
const { VITE_APP_BASE_API, VITE_APP_NAME } = import.meta.env;
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
const UserStore = useUserStore();
|
const UserStore = useUserStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const crudRef = ref(null);
|
const crudRef = ref(null);
|
||||||
const treeData = ref([
|
|
||||||
{
|
|
||||||
label: '基地分类',
|
|
||||||
id: null,
|
|
||||||
children: [
|
|
||||||
{ label: '种植基地', id: '1', children: [], pid: null },
|
|
||||||
{ label: '养殖基地', id: '2', children: [], pid: null },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
query: {
|
query: {
|
||||||
@ -74,8 +57,6 @@ const state = reactive({
|
|||||||
selection: [],
|
selection: [],
|
||||||
options: {
|
options: {
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
addBtnText: '添加',
|
|
||||||
// addBtn: false,
|
|
||||||
selection: true,
|
selection: true,
|
||||||
column: [
|
column: [
|
||||||
{
|
{
|
||||||
@ -94,16 +75,16 @@ const state = reactive({
|
|||||||
label: '基地分类',
|
label: '基地分类',
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
dicData: [
|
search: true,
|
||||||
{
|
props: {
|
||||||
label: '种植基地',
|
label: 'dictLabel',
|
||||||
value: 1,
|
value: 'dictValue',
|
||||||
},
|
},
|
||||||
{
|
dicUrl: `${VITE_APP_BASE_API}/system/dict/data/type/sys_base_type`,
|
||||||
label: '养殖基地',
|
dicHeaders: {
|
||||||
value: 2,
|
authorization: UserStore.token,
|
||||||
},
|
},
|
||||||
],
|
dicFormatter: (res) => res.data ?? [],
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -250,6 +231,7 @@ const state = reactive({
|
|||||||
currentRow: {},
|
currentRow: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 加载
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
//state.loading = true;
|
//state.loading = true;
|
||||||
// GetEntityList(state.query)
|
// GetEntityList(state.query)
|
||||||
@ -283,7 +265,7 @@ const loadData = async () => {
|
|||||||
p5: '张三',
|
p5: '张三',
|
||||||
p6: '13837633838',
|
p6: '13837633838',
|
||||||
status: 1,
|
status: 1,
|
||||||
type: 1,
|
type: 'base_plant',
|
||||||
createTime: '2025-01-01',
|
createTime: '2025-01-01',
|
||||||
updateTime: '2025-01-15',
|
updateTime: '2025-01-15',
|
||||||
},
|
},
|
||||||
@ -294,10 +276,6 @@ const loadData = async () => {
|
|||||||
|
|
||||||
loadData();
|
loadData();
|
||||||
|
|
||||||
const onNodeClick = (data) => {
|
|
||||||
console.log('onNodeClick', data);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 页数
|
// 页数
|
||||||
const currentChange = (current) => {
|
const currentChange = (current) => {
|
||||||
state.query.current = current;
|
state.query.current = current;
|
||||||
@ -335,15 +313,14 @@ const rowView = (row) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 启用、禁用
|
// 启用、禁用
|
||||||
const rowStatus = (row) => {
|
// const rowStatus = (row) => {
|
||||||
console.info('操作状态');
|
// console.info('操作状态');
|
||||||
};
|
// };
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
const onAdd = () => {
|
// const onAdd = () => {
|
||||||
crudRef.value && crudRef.value.rowAdd();
|
// crudRef.value && crudRef.value.rowAdd();
|
||||||
};
|
// };
|
||||||
|
|
||||||
const rowSave = (row, done, loading) => {
|
const rowSave = (row, done, loading) => {
|
||||||
// AddEntity(row)
|
// AddEntity(row)
|
||||||
// .then((res) => {
|
// .then((res) => {
|
||||||
|
@ -123,7 +123,7 @@ const state = reactive({
|
|||||||
label: 'dictLabel',
|
label: 'dictLabel',
|
||||||
value: 'dictValue',
|
value: 'dictValue',
|
||||||
},
|
},
|
||||||
dicUrl: `${VITE_APP_BASE_API}/system/dict/data/list?pageNum=1&pageSize=20&dictType=sys_product_type`,
|
dicUrl: `${VITE_APP_BASE_API}/system/dict/data/type/sys_product_type`,
|
||||||
dicHeaders: {
|
dicHeaders: {
|
||||||
authorization: UserStore.token,
|
authorization: UserStore.token,
|
||||||
},
|
},
|
||||||
@ -152,7 +152,7 @@ const state = reactive({
|
|||||||
label: 'dictLabel',
|
label: 'dictLabel',
|
||||||
value: 'dictValue',
|
value: 'dictValue',
|
||||||
},
|
},
|
||||||
dicUrl: `${VITE_APP_BASE_API}/system/dict/data/list?pageNum=1&pageSize=20&dictType=sys_unit_type`,
|
dicUrl: `${VITE_APP_BASE_API}/system/dict/data/type/sys_unit_type`,
|
||||||
dicHeaders: {
|
dicHeaders: {
|
||||||
authorization: UserStore.token,
|
authorization: UserStore.token,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user