This commit is contained in:
“13713575202” 2025-04-09 17:24:52 +08:00
commit f4fcba7ee1
20 changed files with 398 additions and 405 deletions

View File

@ -0,0 +1,22 @@
import request from '@/utils/axios';
export function getEnterpriseDealerCheck(params) {
return request('/inputGoods/distributorCheck/page', {
params,
});
}
export function addEnterpriseDealerCheck(data) {
return request('/inputGoods/distributorCheck/page', {
method: 'POST',
data,
});
}
export function delEnterpriseDealerCheck(ids) {
return request(`/inputGoods/distributorCheck/page/${ids}`);
}
export function editEnterpriseDealerCheck(data) {
return request('/inputGoods/distributorCheck/page', {
method: 'POST',
data,
});
}

View File

@ -3,6 +3,8 @@ import * as materialApi from './material';
import * as knowledgeApi from './knowledge';
import * as leaseSuperviseApi from './leaseSupervise';
import * as productionDealerApi from './productionDealer';
import * as useSuperviseApi from './useSupervise';
import * as enteroriseDealerCheckApi from './enterpriseDealerCheck';
export default {
...materialApi,
@ -10,4 +12,6 @@ export default {
...knowledgeApi,
...leaseSuperviseApi,
...productionDealerApi,
...useSuperviseApi,
...enteroriseDealerCheckApi,
};

View File

@ -0,0 +1,24 @@
import request from '@/utils/axios';
export function getUseSuperviseList(params) {
return request('/inputGoods/supervise/page', {
params,
});
}
export function delUseSupervise(ids) {
return request(`/inputGoods/supervise/delete/${ids}`);
}
export function addUseSupervise(data) {
return request('/inputGoods/supervise/save', {
method: 'POST',
data,
});
}
export function editUseSupervise(data) {
return request('/inputGoods/supervise/edit', {
method: 'PUT',
data,
});
}

View File

@ -15,12 +15,6 @@ const inputSuppliesRoutes = [
// component: () => import('@/views/inputSuppliesManage/inputDataView/index.vue'),
// meta: { title: '投入品资源一张图', icon: 'Document' },
// },
// {
// path: '/sub-government-affairs-service/materialManage',
// name: 'materialManage',
// component: () => import('@/views/inputSuppliesManage/materialManage/index.vue'),
// meta: { title: '物资管理融合', icon: 'Document' },
// },
{
path: '/sub-government-affairs-service/material',
name: 'material',
@ -66,12 +60,12 @@ const inputSuppliesRoutes = [
component: () => import('@/views/inputSuppliesManage/productionDealer/index.vue'),
meta: { title: '企业经销商管理', icon: 'Document' },
},
// {
// path: '/sub-government-affairs-service/enterpriseDealerCheck',
// name: 'enterpriseDealerCheck',
// component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
// meta: { title: '企业经销商抽检', icon: 'Document' },
// },
{
path: '/sub-government-affairs-service/enterpriseDealerCheck',
name: 'enterpriseDealerCheck',
component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
meta: { title: '企业经销商抽检', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/useSupervise',
name: 'useSupervise',

View File

@ -7,14 +7,20 @@
:min="_numberSet.min"
:controls-position="_numberSet.controlsPosition"
@change="handleChange"
></el-input-number>
>
</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-option
v-for="item in props.options"
:key="'custom_' + Date.now() + item[props.prop.value]"
:label="item[props.prop.label]"
:value="item[props.prop.value]"
/>
</el-select>
</section>
</template>
<script lang="ts" setup>
<script setup>
import { ref, watchEffect } from 'vue';
const emit = defineEmits(['update:value']);
@ -57,6 +63,12 @@ const props = defineProps({
return {};
},
},
prop: {
type: Object,
default: () => {
return { label: 'label', value: 'value' };
},
},
});
const _numberSet = ref({
precision: 2,
@ -71,7 +83,9 @@ const data = ref({
watchEffect(() => {
data.value = Object.assign(data.value, props.value);
_numberSet.value = Object.assign(_numberSet.value, props.numberSet);
console.log('_numberSet.value', _numberSet.value);
if (data.value.num === null) {
data.value.num = _numberSet.value.min;
}
});
function handleChange() {
emit('update:value', data.value);

View File

@ -5,7 +5,7 @@
<avue-crud
v-model:search="searchCondition"
v-model:page="pageData"
:data="data"
:data="tableData"
:option="option"
:loading="_loading"
@search-change="
@ -20,8 +20,8 @@
@row-save="handleRowSave"
@row-update="handleRowUpdate"
>
<template #menu="{ row }">
<el-button type="primary">详情</el-button>
<template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" />
</template>
</avue-crud>
</section>
@ -29,8 +29,10 @@
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { CRUD_OPTIONS } from '@/config';
import { CRUD_OPTIONS, pageData } from '@/config';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
const { getEnterpriseDealerCheck, addEnterpriseDealerCheck, delEnterpriseDealerCheck, editEnterpriseDealerCheck } = inputSuppliesApi;
onMounted(getData);
/* --------------- data --------------- */
@ -40,12 +42,7 @@ const _loading = ref(false);
const searchCondition = ref({
keywords: '',
});
const pageData = ref({
currentPage: 1,
pageSize: 10,
total: 0,
});
const data = ref([]);
const tableData = ref([]);
const option = reactive({
...CRUD_OPTIONS,
selection: false,
@ -138,6 +135,24 @@ const option = reactive({
},
],
});
const actions = reactive([
{
name: '详情',
icon: 'view',
event: ({ row }) => row,
},
{
name: '编辑',
icon: 'edit',
event: ({ row }) => row,
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => row,
},
]);
// #endregion
@ -146,26 +161,20 @@ const option = reactive({
async function getData(resetPage) {
resetPage === 1 && (pageData.value.currentPage = 1);
_loading.value = true;
let params = Object.assign(
{
currentPage: pageData.value.currentPage,
size: pageData.value.pageSize,
},
searchCondition.value
);
console.log('params', params);
for (let i = 0; i < 14; i++) {
data.value.push({
taskNum: '20220101' + `${i}${i}${i}${i}${i}`,
taskType: i % 2 == 0 ? '0' : '1',
enterpriseName: '上海XX有限公司',
enterpriseOwner: '张三',
phone: '123456789',
status: i % 2 == 0 ? '0' : '1',
});
let params = {
currentPage: pageData.value.currentPage,
size: pageData.value.pageSize,
companyName: searchCondition.value.keywords,
};
let res = await getEnterpriseDealerCheck(params);
if (res.code == 200) {
tableData.value = res.data.records;
pageData.value.total = res.data.total;
}
pageData.value.total = data.value.length;
_loading.value = false;
console.log('params', params);
pageData.value.total = tableData.value.length;
}
function handleRowSave(row, done, loading) {

View File

@ -81,7 +81,7 @@ export function useBasicInfo(set = {}) {
}
}
/* 获取标签的名字 */
function targetName(arr, ids, _name) {
function targetName(arr, ids, _name = '') {
let name = '';
if (!arr || !arr.length || ids.length < 1) {
return name;

View File

@ -6,7 +6,7 @@
ref="crudRef"
v-model:search="searchCondition"
v-model:page="pageData"
:data="data"
:data="tableData"
:option="option"
:table-loading="_loading"
:before-close="handleDialogClose"
@ -55,7 +55,7 @@ const pageData = ref({
pageSize: 10,
total: 0,
});
const data = ref([]);
const tableData = ref([]);
const option = reactive({
...CRUD_OPTIONS,
selection: false,
@ -195,7 +195,7 @@ async function getData(resetPage) {
let res = await inputSuppliesApi.getLeaseSuperviseList(params);
_loading.value = false;
if (res.code == 200) {
data.value = res.data.records.map((v) => {
tableData.value = res.data.records.map((v) => {
let d = leaseDate(v.startEndTime);
let obj = {
...v,

View File

@ -9,7 +9,7 @@
v-model:search="searchCondition"
:table-loading="_loading"
:before-close="handleCloseDialog"
:data="data"
:data="tableData"
:option="option"
@search-change="
(form, done) => {
@ -140,7 +140,7 @@ const subsidy = reactive([
value: '0',
},
]);
const data = ref([{}]);
const tableData = ref([{}]);
const option = ref({
...CRUD_OPTIONS,
dialogWidth: '50%',
@ -441,7 +441,7 @@ async function getData(reset) {
let res = await getMachineryList(params);
_loading.value = false;
if (res.code == 200) {
data.value = res.data.records;
tableData.value = res.data.records;
pageData.value.total = res.data.total;
}
}

View File

@ -7,7 +7,7 @@
ref="crud"
v-model:page="pageData"
v-model:search="searchCondition"
:data="data"
:data="tableData"
:table-loading="_loading"
:option="option"
:before-close="handleCloseDialog"
@ -85,7 +85,7 @@ watch(
const crud = ref();
const _loading = ref(false);
const data = ref([]);
const tableData = ref([]);
const searchCondition = ref({
keywords: '',
});
@ -236,7 +236,7 @@ async function getData(reset) {
let res = await getFertilizreList(params);
_loading.value = false;
if (res.code == 200) {
data.value = res.data.records.map((v) => {
tableData.value = res.data.records.map((v) => {
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);

View File

@ -8,7 +8,7 @@
v-model:page="pageData"
v-model:search="searchCondition"
:table-loading="_loading"
:data="data"
:data="tableData"
:option="option"
:before-close="handleCloseDialog"
@search-change="
@ -63,7 +63,7 @@ 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, ElMessageBox } from 'element-plus';
import { ElMessage } from 'element-plus';
import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn';
const { deleteFn } = new assistFn();
@ -88,7 +88,7 @@ const searchCondition = ref({
});
const crud = ref();
const _loading = ref(true);
const data = ref([]);
const tableData = ref([]);
const pageData = ref({
total: 0,
currentPage: 1,
@ -456,8 +456,8 @@ async function getData(reset) {
console.log('res --- ', res);
_loading.value = false;
if (res && res.code === 200) {
data.value = res.data.records;
data.value.forEach((v) => {
tableData.value = res.data.records;
tableData.value.forEach((v) => {
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);

View File

@ -8,7 +8,7 @@
v-model:page="pageData"
v-model:search="searchCondition"
:table-loading="_loading"
:data="data"
:data="tableData"
:option="option"
:before-close="handleCloseDialog"
@search-change="
@ -68,7 +68,7 @@ const searchCondition = ref({
});
const crud = ref();
const _loading = ref(true);
const data = ref([]);
const tableData = ref([]);
const pageData = ref({
total: 0,
currentPage: 1,
@ -229,8 +229,8 @@ async function getData(reset) {
let res = await getAnimalMedicineList(params);
_loading.value = false;
if (res && res.code === 200) {
data.value = res.data.records;
data.value.forEach((v) => {
tableData.value = res.data.records;
tableData.value.forEach((v) => {
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
v.produceDosage = handleShowName(v.produceDosage);
});

View File

@ -9,7 +9,7 @@
v-model:search="searchCondition"
:table-loading="_loading"
:before-close="handleCloseDialog"
:data="data"
:data="tableData"
:option="option"
@search-change="
(form, done) => {
@ -27,7 +27,9 @@
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
<el-button @click="deleteFn(row.id, delSeed, getData)">删除</el-button>
</template>
<template #photoUrl-form="{ type }"> <Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" /> </template>
<template #photoUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
</template>
</avue-crud>
</section>
</template>
@ -70,7 +72,7 @@ const _loading = ref(true);
const searchCondition = ref({
keywords: '',
});
const data = ref([]);
const tableData = ref([]);
const option = ref({
...CRUD_OPTIONS,
selection: false,
@ -189,7 +191,7 @@ async function getData(reset) {
if (_type.value != '0') params['classifyId'] = _type.value;
let res = await getSeedList(params);
if (res.code == 200) {
data.value = res.data.records ?? [];
tableData.value = res.data.records ?? [];
pageData.value.total = res.data.total;
}
_loading.value = false;

View File

@ -1,58 +0,0 @@
<template>
<section class="custom-page">
<!-- <section style="width: 600px; height: 400px">
<custom-rich-editor />
</section> -->
<avue-crud
ref="curdRef"
v-model:page="pageData"
:data="data"
:before-close="handleDialogClose"
:option="option"
:table-loading="_loading"
@search-change="handleSearch"
@search-reset="handleSearchReset"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
@row-save="handleRowSave"
@row-update="handleRowUpdate"
>
<template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" />
</template>
</avue-crud>
</section>
</template>
<script setup>
import { ref } from 'vue';
import { useMaterialHook } from './useMaterialHook';
const {
curdRef,
_loading,
data,
pageData,
option,
actions,
handleDialogClose,
handleSearch,
handleRowSave,
handleRowUpdate,
handleSearchReset,
handleCurrentChange,
handleSizeChange,
} = useMaterialHook();
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -1,197 +0,0 @@
import { ref, reactive, onMounted } from 'vue';
import { CRUD_OPTIONS } from '@/config';
import inputSuppliesApis from '@/apis/inputSuppliesApi';
const { getMaterailTypes } = inputSuppliesApis;
export const useMaterialHook = () => {
onMounted(() => {
getData();
getTypes();
});
/* ------ data ------ */
// #region
const currentType = ref('0');
const curdRef = ref();
const _loading = ref(false);
const materialTypes = reactive([
{
id: '0',
dataName: '全部',
},
]);
const pageData = ref({
currentPage: 1,
pageSize: 10,
total: 0,
});
const testData = reactive([
{ type: '1', id: 1, name: '物资1', producer: '生产厂家1', dealer: '经销商1' },
{ type: '2', id: 2, name: '物资2', producer: '生产厂家2', dealer: '经销商2' },
{ type: '3', id: 3, name: '物资3', producer: '生产厂家3', dealer: '经销商3' },
{ type: '4', id: 4, name: '物资4', producer: '生产厂家4', dealer: '经销商4' },
{ type: '5', id: 4, name: '物资4', producer: '生产厂家4', dealer: '经销商4' },
]);
const data = ref([]);
const option = reactive({
...CRUD_OPTIONS,
selection: false,
column: [
{
label: '物资类型',
prop: 'materailType',
hide: false,
search: true,
type: 'cascader',
dicData: materialTypes,
checkStrictly: true,
props: {
value: 'id',
label: 'dataName',
},
},
{
label: '物资编号',
prop: 'id',
},
{
label: '物资编号',
prop: 'name',
},
{
label: '生产厂家',
prop: 'producer',
},
{
label: '经销商',
prop: 'dealer',
},
// {
// label: '物资编号',
// prop: '',
// },
// {
// label: '物资编号',
// prop: 'id',
// },
// {
// label: '物资编号',
// prop: 'id',
// },
],
});
const actions = reactive([
{
auth: ({ row }) => row.type == '1',
name: 'custom',
icon: 'edit',
event: handleCustomFn,
},
{
name: '编辑',
icon: 'edit',
event: handleEdit,
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: handleDel,
},
]);
// #endregion
/* ------ methods ------ */
// #region
async function getTypes() {
let res = await getMaterailTypes();
if (res.code == 200) {
materialTypes.push(...res.data);
console.log('types', materialTypes);
}
}
function getData() {
let params = {
currentPage: pageData.value.currentPage,
pageSize: pageData.value.pageSize,
type: currentType.value,
};
console.log('get params -- ', params);
if (currentType.value == '0') {
data.value = testData.map((v) => v);
} else {
data.value = testData.filter((item) => item.type == currentType.value);
}
console.log('data', data.value);
}
function handleSearch(form, done) {
if (!form.materailType || !form.materailType.length) {
currentType.value = '0';
} else {
currentType.value = form.materailType[0];
}
console.log('search --- ', form);
getData();
done();
}
function handleSearchReset() {
resetPage();
}
async function handleDialogClose(done) {
done();
console.log('dialog close');
}
/* 新建行数据 */
async function handleRowSave(form, done, loading) {
console.log('save', form);
loading();
}
/* */
function handleCustomFn({ row }) {
console.log('custom', row);
}
/* 行编辑 */
function handleEdit({ row }) {
console.log('edit', row);
}
/* 更新行数据 */
async function handleRowUpdate(form, done, loading) {
console.log('update', form);
loading();
}
/* 行删除 */
function handleDel({ row }) {
console.log('del', row);
}
function handleCurrentChange(val) {
pageData.value.currentPage = val;
getData();
}
function handleSizeChange(val) {
pageData.value.currentPage = 1;
pageData.value.size = val;
getData();
}
function resetPage() {
currentType.value = '0';
pageData.value.currentPage = 1;
pageData.value.pageSize = 10;
getData();
}
// #endregion
return {
curdRef,
_loading,
data,
pageData,
option,
actions,
handleSearch,
handleDialogClose,
handleRowSave,
handleRowUpdate,
handleSearchReset,
handleCurrentChange,
handleSizeChange,
};
};

View File

@ -1,5 +1,5 @@
<template>
<section class="custom-page">巡查与案件 </section>
<section class="custom-page">巡查与案件</section>
</template>
<script setup>

View File

@ -5,7 +5,7 @@
v-model:page="pageData"
v-model:search="searchCondition"
:table-loading="_loading"
:data="data"
:data="tableData"
:option="option"
:before-close="
(done) => {
@ -68,7 +68,7 @@ const searchCondition = ref({
_dealerType: '',
keywords: '',
});
const data = ref([{}]);
const tableData = ref([{}]);
const option = reactive({
...CRUD_OPTIONS,
dialogWidth: '50%',
@ -339,7 +339,7 @@ async function getData(reset) {
};
let res = await getProductionDealerList(params);
if (res.code == 200) {
data.value = res.data.records;
tableData.value = res.data.records;
pageData.value.total = res.data.total;
}
_loading.value = false;

View File

@ -6,7 +6,8 @@
v-model:page="pageData"
:table-loading="_loading"
:option="option"
:data="data"
:data="tableData"
:before-close="(done) => (handleOtherInfo(), done())"
@search-change="
(form, done) => {
getData(1);
@ -20,30 +21,61 @@
@row-save="handleRowSave"
@row-update="handleRowUpdate"
>
<template #land-form="{ type }">
<!-- <template #land-form="{ type }">
<section if="type == 'add'">地块</section>
</template> -->
<template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" />
</template>
<template #report-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type" />
</template>
<template #buyNumber-form="{ type }">
<NumberSelect v-if="type != 'view'" v-model:value="buyNumber" :options="useNumberOptions" :prop="useNumebrProp" />
<span v-else>{{ buyNumber + buyUnit }}</span>
</template>
<template #useNumber-form="{ type }">
<NumberSelect v-if="type != 'view'" v-model:value="useNumber" :options="useNumberOptions" :prop="useNumebrProp" />
<span v-else>{{ useNumber + useUnit }}</span>
</template>
</avue-crud>
</section>
</template>
<script setup>
import { reactive, ref, watch } from 'vue';
import { CRUD_OPTIONS, pageData } from '@/config';
import { reactive, ref, onMounted } from 'vue';
import { CRUD_OPTIONS, pageData, customRules } from '@/config';
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
import inputSuppliesApi from '@/apis/inputSuppliesApi';
import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn';
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
import { ElMessage } from 'element-plus';
import { GetEntityList } from '@/apis/system/dict';
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
const { loadFinish, materialTwoLevel, materialTypes } = useBasicInfo();
const { deleteFn } = new assistFn();
const { getUseSuperviseList, delUseSupervise, addUseSupervise, editUseSupervise } = inputSuppliesApi;
const { materialTypes, targetName } = useBasicInfo();
watch(
() => loadFinish.value,
(bol) => {
if (loadFinish.value) {
console.log('material', materialTypes);
}
}
);
/* --------------- data --------------- */
onMounted(() => {
getData();
getUseNumberDict();
});
/* --------------- tableData --------------- */
// #region
const useNumebrProp = reactive({
label: 'dictLabel',
value: 'dictValue',
});
const useNumberOptions = ref([]);
const buyNumber = ref({
num: 1,
type: '1',
});
const useNumber = ref({
num: 1,
type: '1',
});
const crudRef = ref(null);
const _loading = ref(true);
const searchCondition = ref({
@ -55,7 +87,7 @@ const types = reactive([
{ label: '肥料监管', value: '2' },
{ label: '兽药监管', value: '3' },
]);
const data = ref([{}]);
const tableData = ref([{}]);
const option = ref({
...CRUD_OPTIONS,
selection: false,
@ -88,48 +120,78 @@ const option = ref({
clearable: false,
value: '1',
change: handleTypeChange,
width: 120,
},
{
label: '姓名',
label: '使用者名称',
prop: 'name',
width: 240,
rules: customRules({ msg: '请输入名称' }),
},
{
label: '联系方式',
prop: 'phone',
width: 120,
rules: customRules({ msg: '请输入联系方式' }),
},
{
label: '投入品名称',
prop: 'materialName',
prop: 'inputName',
width: 240,
rules: customRules({ msg: '请输入投入品名称' }),
},
{
hide: true,
label: '分类',
prop: '_classifyId',
type: 'cascader',
dicData: [],
value: [],
rules: customRules({ msg: '请选择分类' }),
viewDisplay: false,
},
{
label: '分类',
prop: 'type',
type: 'cascader',
dicData: [],
prop: 'classifyName',
width: 200,
overHidden: true,
addDisplay: false,
editDisplay: false,
},
{
label: '购买量',
prop: 't1',
prop: 'buyNumber',
render: ({ row }) => row.buyNumber + row.buyUnit,
},
{
label: '购买时间',
prop: 't2',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
width: 140,
prop: 'buyTime',
rules: customRules({ msg: '请选择购买时间' }),
},
{
label: '使用量',
prop: 't3',
prop: 'useNumber',
render: ({ row }) => row.useNumber + row.useUnit,
},
{
label: '使用时间',
prop: 't4',
type: 'date',
width: 140,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
prop: 'useTime',
},
{
label: '使用对象',
prop: 't5',
prop: 'useObject',
},
{
label: '关联地块',
prop: 'land',
prop: 'landName',
},
],
group: [
@ -141,59 +203,169 @@ const option = ref({
column: [
{
label: '检测时间',
prop: 'checkTime',
span: 24,
prop: 'detectionTime',
type: 'date',
valueFormat: 'yyyy-MM-dd',
format: 'yyyy-MM-dd',
valueFormat: 'YYYY-MM-DD',
format: 'YYYY-MM-DD',
},
{
label: '检测结果',
prop: 'result',
span: 24,
prop: 'detectionResult',
type: 'select',
dicData: [
{
label: '合格',
value: '0',
},
{
label: '不合格',
value: '1',
},
],
},
{
label: '投入品名称',
prop: 'unit',
span: 24,
prop: 'detectionUnit',
},
{
label: '检测报告',
prop: 'report',
span: 24,
},
],
},
],
});
const attrs = ref([]);
const actions = reactive([
{
name: '详情',
icon: 'view',
event: ({ row }) => {
handleOtherInfo(row);
crudRef.value.rowView(row);
},
},
{
name: '编辑',
icon: 'edit',
event: ({ row }) => {
handleOtherInfo(row);
crudRef.value.rowEdit(row);
},
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => deleteFn(row.id, delUseSupervise, getData),
},
]);
const typeDictData = ref([]);
// #endregion
/* --------------- methods --------------- */
// #region
function getData(reset = 1) {
reset == 1 && (pageData.value.currentPage = 1);
console.log('get data');
async function getUseNumberDict() {
let res = await GetEntityList({
dictType: 'sys_use_supervise_number',
current: 1,
size: 1000,
});
useNumberOptions.value = res?.data?.records ?? [];
if (useNumberOptions.value.length) {
buyNumber.value.type = useNumberOptions.value[0].dictValue;
useNumber.value.type = useNumberOptions.value[0].dictValue;
}
}
async function getData(reset = 0) {
_loading.value = true;
reset === 1 && (pageData.value.currentPage = 1);
let res = await getUseSuperviseList({
current: pageData.value.currentPage,
size: pageData.value.pageSize,
dataType: searchCondition.value.searchType,
name: searchCondition.value.keywords,
});
_loading.value = false;
if (res.code == 200) {
tableData.value = res.data.records.map((v) => {
return {
...v,
_classifyId: v.classifyId.split(','),
};
});
pageData.value.total = res.data.total;
}
}
function handleTypeChange(val) {
console.log(
'dicData',
materialTypes[val.value].filter((v) => v.value != '0')
);
option.value.column[6].dicData = materialTypes[val.value].filter((v) => v.value != '0');
option.value.group[0].addDisplay = val.value == '1';
option.value.group[0].editDisplay = val.value == '1';
option.value.group[0].viewDisplay = val.value == '1';
typeDictData.value = materialTypes[val.value].filter((v) => v.value != '0') || [];
option.value.column[6].dicData = typeDictData.value;
}
function handleData(val) {
console.log('handleData', val);
let _data = Object.assign({}, val);
_data.buyNumber = buyNumber.value.num;
_data.buyUnit = buyNumber.value.type;
_data.useNumber = useNumber.value.num;
_data.useUnit = useNumber.value.type;
_data.classifyId = val._classifyId.join();
_data.classifyName = targetName(typeDictData.value, val._classifyId);
if (attrs.value.length) {
_data.detectionReport = attrs.value.map((v) => v.url).join();
}
delete _data.keywords;
delete _data.searchType;
delete _data._classifyId;
return _data;
}
function handleRowSave(row, done, laoding) {
handleData(row);
laoding();
}
function handleRowUpdate(row, index, done, loading) {
handleData(row);
async function handleRowSave(row, done, loading) {
let data = handleData(row);
let res = await addUseSupervise(data);
loading();
if (res.code == 200) {
ElMessage.success('保存成功');
getData();
done();
}
}
async function handleRowUpdate(row, index, done, loading) {
let data = handleData(row);
let res = await editUseSupervise(data);
loading();
if (res.code == 200) {
ElMessage.success('保存成功');
getData();
done();
}
}
function handleOtherInfo(obj = {}) {
if (!Object.keys(obj).length) {
attrs.value = [];
buyNumber.value = { num: 1, type: useNumberOptions.value?.[0].dictValue ?? '1' };
useNumber.value = { num: 1, type: useNumberOptions.value?.[0].dictValue ?? '1' };
return;
}
if (obj.detectionReport) {
attrs.value = obj.detectionReport.split(',').map((v, i) => {
{
return {
name: '检测报告' + i,
url: v,
uid: 'id_' + i + Date.now(),
};
}
});
}
buyNumber.value = {
num: +obj.buyNumber,
type: obj.buyUnit,
};
useNumber.value = {
num: +obj.useNumber,
type: obj.useUnit,
};
}
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -37,13 +37,16 @@
<el-button type="success" icon="download" @click="handleExport">导出</el-button>
<el-button type="success" icon="upload" @click="onUpload">导入</el-button>
</template>
<template #area-form>
<section class="area_form_">
<template #area-form="{ type }">
<section v-show="type != 'view'" class="area_form_">
<el-input-number v-model="landArea" :precision="2" :step="1" :min="1" controls-position="right"></el-input-number>
<el-select v-model="unitValue">
<el-option v-for="item in unitOptions" :key="'unitOptions_' + item.value" :label="item.label" :value="item.label" />
</el-select>
</section>
<section v-show="type == 'view'">
{{ landArea + unitValue }}
</section>
</template>
<template #propertyCertificateUrl-form="{ type }">
<Attrs v-model:attrs="attrs" :type="type" />
@ -269,9 +272,10 @@ const option = reactive({
trigger: 'blur',
},
],
change: handleChangeGrid,
},
{
label: '用地分类1',
label: '用地分类',
prop: 'landTypeId',
type: 'cascader',
dicData: landTreeDic,
@ -306,6 +310,14 @@ const option = reactive({
trigger: 'blur',
},
],
viewDisplay: false,
},
{
hide: true,
label: '位置',
prop: 'address',
addDisplay: false,
editDisplay: false,
},
{
label: '是否土地流转',
@ -476,35 +488,27 @@ async function getList(reset = 1) {
v.coordinateView = v.coordinate;
v.soilTypeName = v.soilType;
v.soilTypeId = v.soilId;
v._villageCode = handleArea(v);
v._villageCode = v.villageCode;
v.landTypeId = [v.pid, v.landType];
console.log('vvv', v);
});
pageData.value.total = total;
}
}
function handleGetGrid(res) {
console.log('res', res);
return res.records ?? [];
return res?.data?.records ?? [];
}
function handleChangeGrid(val) {
val.item && filterArea(val.item.townCode);
}
function filterArea(id) {
option.group[0].column[4].dicData = regionData.value.find((v) => v.areaCode == id)?.areaChildVOS ?? [];
}
async function handleGetRegion() {
let res = await getRegion();
if (res.code == 200) {
option.group[0].column[5];
regionData.value = res?.data?.[0].areaChildVOS?.[0].areaChildVOS?.[0].areaChildVOS ?? [];
}
console.log('region', res);
}
function handleArea(v) {
const { provinceCode, cityCode, county, townCode, villageCode } = v;
let _area = [provinceCode, cityCode, county, townCode, villageCode];
let _arr = [];
for (let i = 0; i < _area.length; i++) {
if (!_area[i]) return;
_arr.push(_area[i]);
}
return _arr;
}
function handleSizeChange(val) {
pageData.value.pageSize = val;
getList();
@ -581,7 +585,7 @@ function handleData(val) {
data.propertyCertificateUrl = urls.join();
data.landCertificateUrl = landOwnerUrls.join();
data.landUrl = landUrls.join();
data.villageCode = data._villageCode[data._villageCode.length - 1] || '';
data.villageCode = data._villageCode;
data.landTypeId = data.landTypeId[data.landTypeId.length - 1];
data.soilType = data.soilTypeId;
if (local.value.length != 0) {
@ -617,14 +621,13 @@ async function handleRowUpdate(form, index, done, loading) {
}
async function rowEdit(row) {
console.log('rowEdit', row);
handleOtherInfo(row);
filterArea(row.townCode);
crudRef.value.rowEdit(row);
}
function handleOtherInfo(obj) {
landArea.value = obj.area;
unitValue.value = obj.landUnit;
console.log('option', obj._villageCode, option.group[0].column[4]);
if (obj.propertyCertificateUrl) {
attrs.value = obj.propertyCertificateUrl.split(',').map((v, i) => {
return {

View File

@ -81,14 +81,15 @@ const keyword = ref('');
const meuns = ref([
{
label: '智慧种植',
path: '/login',
path: '/sub-operation-service/ecommerce',
},
{
label: '农事服务',
path: '/sub-admin/home',
path: '/sub-operation-service/ecommerce',
},
{
label: '涉农金融',
path: '/sub-operation-service/ecommerce',
},
{
label: '电商交易',
@ -96,12 +97,15 @@ const meuns = ref([
},
{
label: '分拣包装',
path: '/sub-operation-service/ecommerce',
},
{
label: '仓储物流',
path: '/sub-operation-service/ecommerce',
},
{
label: '公共品牌运营',
path: '/sub-operation-service/ecommerce',
},
]);
@ -111,7 +115,7 @@ function Search() {
const toHome = () => {
console.info('toHome', router);
router.push('/');
router.push('/sub-operation-service/home');
};
</script>