feat:经销商管理模块完成
This commit is contained in:
parent
e1d6d9da99
commit
9f09d313ee
@ -2,10 +2,12 @@ import * as redBlackApi from './redAndBlank';
|
||||
import * as materialApi from './material';
|
||||
import * as knowledgeApi from './knowledge';
|
||||
import * as leaseSuperviseApi from './leaseSupervise';
|
||||
import * as productionDealerApi from './productionDealer';
|
||||
|
||||
export default {
|
||||
...materialApi,
|
||||
...redBlackApi,
|
||||
...knowledgeApi,
|
||||
...leaseSuperviseApi,
|
||||
...productionDealerApi,
|
||||
};
|
||||
|
@ -92,4 +92,28 @@ export function delSeed(ids) {
|
||||
return request(`/inputGoods/provenance/delete/${ids}`);
|
||||
}
|
||||
// #endregion
|
||||
//
|
||||
|
||||
/* ------ 农机 ------ */
|
||||
// #region
|
||||
|
||||
export function getMachineryList(params) {
|
||||
return request('/inputGoods/farmMachine/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
export function addMachinery(data) {
|
||||
return request('/inputGoods/farmMachine/save', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
export function delMachinery(ids) {
|
||||
return request(`/inputGoods/farmMachine/delete/${ids}`);
|
||||
}
|
||||
export function machineryReport(data) {
|
||||
return request(`/inputGoods/farmMachine/uploadReport`, {
|
||||
method: 'PUT',
|
||||
data,
|
||||
});
|
||||
}
|
||||
// #endregion
|
||||
|
@ -0,0 +1,23 @@
|
||||
import request from '@/utils/axios';
|
||||
|
||||
export function getProductionDealerList(params) {
|
||||
return request('/inputGoods/distributor/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export function addProductionDealer(data) {
|
||||
return request('/inputGoods/distributor/save', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
export function delProductionDealer(ids) {
|
||||
return request(`/inputGoods/distributor/delete/${ids}`);
|
||||
}
|
||||
export function editProductionDealer(data) {
|
||||
return request('/inputGoods/distributor/edit', {
|
||||
method: 'PUT',
|
||||
data,
|
||||
});
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
import request from '@/utils/axios';
|
||||
|
||||
/* 土地列表 */
|
||||
/* ------ 土地信息 ------ */
|
||||
// #region
|
||||
|
||||
export function getLandsList(params = {}) {
|
||||
return request('land-resource/landManage/page', {
|
||||
method: 'GET',
|
||||
@ -14,6 +16,7 @@ export function saveLand(data = {}) {
|
||||
data,
|
||||
});
|
||||
}
|
||||
/* 导出土地 */
|
||||
export function exportLands(params = {}) {
|
||||
return request('/land-resource/landManage/export', {
|
||||
method: 'GET',
|
||||
@ -21,6 +24,32 @@ export function exportLands(params = {}) {
|
||||
responseType: 'blob',
|
||||
});
|
||||
}
|
||||
/* 编辑土地 */
|
||||
export function editLand(data = {}) {
|
||||
return request('/land-resource/landManage/edit', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
/* 导入土地 */
|
||||
export function importLands(data) {
|
||||
return request('land-resource/landManage/import', {
|
||||
method: 'POST',
|
||||
data,
|
||||
Headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/* 删除土地 */
|
||||
export function delLand(id) {
|
||||
return request('land-resource/landManage/delete/' + id, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
// #endregion
|
||||
/* 土地列表 */
|
||||
|
||||
//年度计划相关
|
||||
export function getAnnualList(params = {}) {
|
||||
@ -133,12 +162,6 @@ export function delPlantingStage(params) {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
/* 删除土地 */
|
||||
export function delLand(id) {
|
||||
return request('land-resource/landManage/delete/' + id, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
//作业记录相关
|
||||
export function getOperationRecord(params = {}) {
|
||||
@ -190,16 +213,6 @@ export function getAddrCropByLand(landId) {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
/* 导入土地 */
|
||||
export function importLands(data) {
|
||||
return request('land-resource/landManage/import', {
|
||||
method: 'POST',
|
||||
data,
|
||||
Headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
//土地巡查相关
|
||||
export function getlandInspection(params = {}) {
|
||||
|
@ -0,0 +1,19 @@
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
|
||||
export default class assistFn {
|
||||
deleteFn(ids = '', _fetch, _callback) {
|
||||
ElMessageBox.confirm('确定删除该数据吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
if (!_fetch) return;
|
||||
let res = await _fetch(ids);
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('删除成功');
|
||||
_callback && _callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// export
|
@ -163,19 +163,6 @@ export function useBasicInfo(set = {}) {
|
||||
});
|
||||
return _t;
|
||||
}
|
||||
function handleDelFn(ids, _fetch, _callback) {
|
||||
ElMessageBox.confirm('确定删除该数据吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
let res = await _fetch(ids);
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('删除成功');
|
||||
_callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endregion
|
||||
onMounted(getmaterialType);
|
||||
|
||||
@ -191,6 +178,5 @@ export function useBasicInfo(set = {}) {
|
||||
filterTypes,
|
||||
handleShowName,
|
||||
handleNumUnit,
|
||||
handleDelFn,
|
||||
};
|
||||
}
|
||||
|
@ -30,10 +30,27 @@
|
||||
<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" />
|
||||
<template #detectionUnit-form="{ type }">
|
||||
<section v-if="type == 'edit'" style="display: flex; width: 100%">
|
||||
<span style="width: calc(50% - 85px); height: 32px">
|
||||
<el-input v-model="checkUnitStamp" placeholder="请输入 检测单位"></el-input>
|
||||
</span>
|
||||
 
|
||||
<Attrs v-model:attrs="checkAttrs" style="flex: 1" type="add" :up-btn="checkAttrs < 1" :file-num="2" :limit="1" />
|
||||
</section>
|
||||
<section v-if="type == 'view'" style="position: relative">
|
||||
{{ checkUnitStamp }}
|
||||
<img :src="checkAttrs[0]?.url ?? ''" alt="" style="position: absolute; bottom: -10px; right: -10px" />
|
||||
</section>
|
||||
</template>
|
||||
<template #viewReport-form>
|
||||
<section style="text-align: center; line-height: 58px">
|
||||
<el-button type="primary" @click="handleCheckInfo(true)">查看报告</el-button>
|
||||
</section>
|
||||
</template>
|
||||
<template #closeReport-form="{ type }">
|
||||
<section v-if="type == 'view'" style="text-align: center; line-height: 58px">
|
||||
<el-button type="primary" @click="handleCheckInfo()">关闭</el-button>
|
||||
</section>
|
||||
</template>
|
||||
</avue-crud>
|
||||
@ -41,16 +58,19 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, watch } from 'vue';
|
||||
import { ref, reactive, onMounted, watch, h } 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({
|
||||
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import assistFn from '../hooks/useAssistFn';
|
||||
const { deleteFn } = new assistFn();
|
||||
const { loadFinish, materialTypes, targetName } = useBasicInfo({
|
||||
moduleType: '5',
|
||||
});
|
||||
const { getMachineryList, addMachinery, delMachinery, machineryReport } = inputSuppliesApi;
|
||||
const _allTypes = ref([]);
|
||||
watch(
|
||||
() => loadFinish.value,
|
||||
@ -59,7 +79,6 @@ watch(
|
||||
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;
|
||||
}
|
||||
});
|
||||
@ -75,7 +94,7 @@ const _loading = ref(true);
|
||||
const searchCondition = ref({
|
||||
keywords: '',
|
||||
});
|
||||
const processCustomized = reactive([
|
||||
const customize = reactive([
|
||||
{
|
||||
label: '可定制',
|
||||
value: '0',
|
||||
@ -85,46 +104,47 @@ const processCustomized = reactive([
|
||||
value: '1',
|
||||
},
|
||||
]);
|
||||
const afterSales = reactive([
|
||||
const afterService = reactive([
|
||||
{
|
||||
label: '全国联保',
|
||||
value: '0',
|
||||
},
|
||||
{
|
||||
label: '国家三包规定',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '品牌官方售后',
|
||||
label: '国家三包规定',
|
||||
value: '2',
|
||||
},
|
||||
{
|
||||
label: '上门服务',
|
||||
label: '品牌官方售后',
|
||||
value: '3',
|
||||
},
|
||||
{
|
||||
label: '远程技术支持',
|
||||
label: '上门服务',
|
||||
value: '4',
|
||||
},
|
||||
{
|
||||
label: '依旧换新',
|
||||
label: '远程技术支持',
|
||||
value: '5',
|
||||
},
|
||||
{
|
||||
label: '依旧换新',
|
||||
value: '6',
|
||||
},
|
||||
]);
|
||||
const subsidy = reactive([
|
||||
{
|
||||
label: '有补贴',
|
||||
value: '0',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
label: '无补贴',
|
||||
value: '1',
|
||||
value: '0',
|
||||
},
|
||||
]);
|
||||
const data = ref([{}]);
|
||||
const option = ref({
|
||||
...CRUD_OPTIONS,
|
||||
dialogWidth: '50%',
|
||||
selection: false,
|
||||
column: [
|
||||
{
|
||||
label: '农机名称',
|
||||
@ -136,35 +156,41 @@ const option = ref({
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
label: '农机名称',
|
||||
prop: 'animalMedicineName',
|
||||
prop: 'njName',
|
||||
rules: customRules({ msg: '请输入农机名称' }),
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
label: '品牌',
|
||||
prop: 'animalMedicineVariety',
|
||||
prop: 'brand',
|
||||
rules: customRules({ msg: '请输入品牌' }),
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '农机图片',
|
||||
prop: 'photoUrl',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
prop: 'manufacturer',
|
||||
label: '厂家',
|
||||
rules: customRules({ msg: '请输入厂家名称' }),
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
prop: 'distributor',
|
||||
label: '经销商',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
hide: true,
|
||||
label: '分类',
|
||||
prop: '_classifyId',
|
||||
type: 'cascader',
|
||||
@ -172,22 +198,34 @@ const option = ref({
|
||||
dicData: [],
|
||||
rules: customRules({ msg: '请选择分类' }),
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
render: ({ row }) => row.classifyName,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
label: '分类',
|
||||
prop: 'classifyName',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '驱动方式',
|
||||
prop: 'driveMode',
|
||||
prop: 'powerType',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '加工定制',
|
||||
prop: 'processCustomized',
|
||||
prop: 'customize',
|
||||
type: 'select',
|
||||
dicData: processCustomized,
|
||||
dicData: customize,
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '农机补贴',
|
||||
prop: 'subsidy',
|
||||
@ -196,45 +234,59 @@ const option = ref({
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
hide: true,
|
||||
label: '售后服务',
|
||||
prop: 'afterSales',
|
||||
type: 'select',
|
||||
dicData: afterSales,
|
||||
multiple: true,
|
||||
value: [],
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '质保期',
|
||||
prop: 'expiryDate',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '水分管理',
|
||||
prop: 'mainCharacteristic',
|
||||
label: '售后服务',
|
||||
prop: 'afterService',
|
||||
type: 'select',
|
||||
dicData: afterService,
|
||||
multiple: true,
|
||||
value: [],
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '主要特点',
|
||||
prop: 'mainFeature',
|
||||
span: 24,
|
||||
type: 'textarea',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '病虫害防治',
|
||||
label: '功能配置',
|
||||
prop: 'functionConfig',
|
||||
span: 24,
|
||||
type: 'textarea',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
label: '注意事项',
|
||||
prop: 'useRange',
|
||||
label: '适用范围',
|
||||
prop: 'adaptScope',
|
||||
span: 24,
|
||||
type: 'textarea',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
_customKey: 1,
|
||||
hide: true,
|
||||
labelWidth: 0,
|
||||
prop: 'viewReport',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
span: 24,
|
||||
},
|
||||
],
|
||||
group: [
|
||||
{
|
||||
@ -245,27 +297,27 @@ const option = ref({
|
||||
column: [
|
||||
{
|
||||
label: '农机型号',
|
||||
prop: 'specification',
|
||||
prop: 'njModel',
|
||||
rules: customRules({ msg: '请输入农机型号' }),
|
||||
},
|
||||
{
|
||||
label: '农机牌照号',
|
||||
prop: 'specification',
|
||||
prop: 'licenseNumber',
|
||||
rules: customRules({ msg: '请输入农机牌照号' }),
|
||||
},
|
||||
{
|
||||
label: '权属人',
|
||||
prop: 'specification',
|
||||
prop: 'owner',
|
||||
rules: customRules({ msg: '请输入权属人' }),
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
prop: 'specification',
|
||||
prop: 'phone',
|
||||
rules: customRules({ msg: '请输入联系电话' }),
|
||||
},
|
||||
{
|
||||
label: '联系地址',
|
||||
prop: 'specification',
|
||||
prop: 'address',
|
||||
rules: customRules({ msg: '请输入联系地址' }),
|
||||
},
|
||||
],
|
||||
@ -278,31 +330,37 @@ const option = ref({
|
||||
column: [
|
||||
{
|
||||
label: '年检地点',
|
||||
prop: 'address',
|
||||
prop: 'detectionAddress',
|
||||
rules: customRules({ msg: '请输入年检地点' }),
|
||||
},
|
||||
{
|
||||
label: '年检时间',
|
||||
prop: 'checkDate',
|
||||
prop: 'detectionTime',
|
||||
type: 'date',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
format: 'YYYY-MM-DD',
|
||||
rules: customRules({ msg: '请输入年检时间' }),
|
||||
},
|
||||
{
|
||||
label: '外观检查',
|
||||
prop: 'appearanceCheck',
|
||||
prop: 'inspection',
|
||||
span: 24,
|
||||
type: 'textarea',
|
||||
rules: customRules({ msg: '请输入外观检查' }),
|
||||
},
|
||||
{
|
||||
label: '技术检测',
|
||||
prop: 'technologyCheck',
|
||||
prop: 'technicalDetection',
|
||||
span: 24,
|
||||
type: 'textarea',
|
||||
rules: customRules({ msg: '请输入技术检测' }),
|
||||
},
|
||||
{
|
||||
label: '安全装置检查',
|
||||
prop: 'safetyDeviceCheck',
|
||||
prop: 'safetyDetector',
|
||||
span: 24,
|
||||
type: 'textarea',
|
||||
rules: customRules({ msg: '请输入安全装置检' }),
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -314,15 +372,24 @@ const option = ref({
|
||||
column: [
|
||||
{
|
||||
label: '结论',
|
||||
prop: 'result',
|
||||
prop: 'conclusion',
|
||||
rules: customRules({ msg: '请输入结论' }),
|
||||
},
|
||||
{
|
||||
label: '检测员签名',
|
||||
prop: 'checkPersonSign',
|
||||
prop: 'signature',
|
||||
rules: customRules({ msg: '请输入检测员签名' }),
|
||||
},
|
||||
{
|
||||
label: '检测单位盖章',
|
||||
prop: 'checkUnitStamp',
|
||||
prop: 'detectionUnit',
|
||||
span: 24,
|
||||
rules: customRules({ disabled: true, otherRules: [{ required: true, message: '', validator: handleDetection }] }),
|
||||
},
|
||||
{
|
||||
labelWidth: 0,
|
||||
label: '',
|
||||
prop: 'closeReport',
|
||||
span: 24,
|
||||
},
|
||||
],
|
||||
@ -344,50 +411,117 @@ const actions = reactive([
|
||||
type: 'danger',
|
||||
name: '删除',
|
||||
icon: 'delete',
|
||||
// event: ({ row }) => handleDelFn(row.id, delPesticide, getData),
|
||||
event: ({ row }) => deleteFn(row.id, delMachinery, getData),
|
||||
},
|
||||
]);
|
||||
const attrs = ref([]);
|
||||
const checkUnitStamp = ref('');
|
||||
const checkAttrs = ref([]);
|
||||
|
||||
// #endregion
|
||||
|
||||
/* --------------- methods --------------- */
|
||||
// #region
|
||||
|
||||
function getData(reset) {
|
||||
function handleDetection(rule, value, callback) {
|
||||
if (!checkUnitStamp.value || !checkAttrs.value.length) {
|
||||
callback(new Error());
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
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,
|
||||
njName: searchCondition.value.keywords,
|
||||
};
|
||||
console.log('getData', params);
|
||||
_type.value != '0' && (params.classifyId = _type.value);
|
||||
let res = await getMachineryList(params);
|
||||
_loading.value = false;
|
||||
if (res.code == 200) {
|
||||
data.value = res.data.records;
|
||||
pageData.value.total = res.data.total;
|
||||
}
|
||||
}
|
||||
|
||||
function handleCheck(row) {
|
||||
handleAttrs(row);
|
||||
handleOtherInfo(row);
|
||||
handleReportSpan(24);
|
||||
crudRef.value.rowEdit(row);
|
||||
}
|
||||
function handleInfo(row) {
|
||||
handleAttrs(row);
|
||||
handleSpanChange(true);
|
||||
handleOtherInfo(row);
|
||||
crudRef.value.rowView(row);
|
||||
}
|
||||
function handleRowUpdate(row, index, done, loading) {
|
||||
console.log('update', row);
|
||||
async function handleRowUpdate(form, index, done, loading) {
|
||||
let data = {
|
||||
id: form.id,
|
||||
njModel: form.njModel,
|
||||
licenseNumber: form.licenseNumber,
|
||||
owner: form.owner,
|
||||
phone: form.phone,
|
||||
address: form.address,
|
||||
detectionAddress: form.detectionAddress,
|
||||
detectionTime: form.detectionTime,
|
||||
inspection: form.inspection,
|
||||
technicalDetection: form.technicalDetection,
|
||||
safetyDetector: form.safetyDetector,
|
||||
conclusion: form.conclusion,
|
||||
signature: form.signature,
|
||||
detectionUnit: checkUnitStamp.value,
|
||||
sealUrl: checkAttrs.value[0].url,
|
||||
};
|
||||
let res = await machineryReport(data);
|
||||
loading();
|
||||
// done();
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('报告上传成功');
|
||||
done();
|
||||
}
|
||||
}
|
||||
function handleRowSave(row, done, loading) {
|
||||
console.log('save', row);
|
||||
async function handleRowSave(form, done, loading) {
|
||||
let data = {
|
||||
njName: form.njName,
|
||||
brand: form.brand,
|
||||
photoUrl: attrs.value.map((v) => v.url).join(','),
|
||||
powerType: form.powerType,
|
||||
manufacturer: form.manufacturer,
|
||||
distributor: form.distributor,
|
||||
customize: form.customize,
|
||||
afterService: form.afterService.join(),
|
||||
expiryDate: form.expiryDate,
|
||||
subsidy: form.subsidy,
|
||||
mainFeature: form.mainFeature,
|
||||
functionConfig: form.functionConfig,
|
||||
adaptScope: form.adaptScope,
|
||||
};
|
||||
data.classifyId = JSON.stringify(form._classifyId);
|
||||
data.classifyName = targetName(_allTypes.value, form._classifyId, '');
|
||||
let res = await addMachinery(data);
|
||||
loading();
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('新增成功');
|
||||
getData();
|
||||
clearAttrs();
|
||||
done();
|
||||
}
|
||||
}
|
||||
function handleCheckInfo(open = false) {
|
||||
option.value.column.forEach((v) => {
|
||||
if (v._customKey == 1) v.viewDisplay = !open;
|
||||
});
|
||||
option.value.group.forEach((v) => {
|
||||
v.viewDisplay = open;
|
||||
});
|
||||
}
|
||||
/* 处理展示附件 */
|
||||
function handleAttrs(row = {}) {
|
||||
function handleOtherInfo(row = {}) {
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
checkUnitStamp.value = row.detectionUnit;
|
||||
if (row.photoUrl) {
|
||||
attrs.value = row.photoUrl.split(',').map((v, i) => {
|
||||
return {
|
||||
@ -396,11 +530,36 @@ function handleAttrs(row = {}) {
|
||||
};
|
||||
});
|
||||
}
|
||||
if (row.sealUrl) {
|
||||
checkAttrs.value = [
|
||||
{
|
||||
url: row.sealUrl,
|
||||
uid: `seal_${Date.now()}`,
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
function clearAttrs() {
|
||||
attrs.value = [];
|
||||
handleReportSpan(12);
|
||||
}
|
||||
function handleCloseDialog(done) {
|
||||
attrs.value = [];
|
||||
done();
|
||||
}
|
||||
function handleSpanChange(bol = false) {
|
||||
let arr1 = ['photoUrl', 'afterService'];
|
||||
option.value.column.forEach((v) => {
|
||||
if (arr1.includes(v.prop)) {
|
||||
if (bol) v.span = 24;
|
||||
else delete v.span;
|
||||
}
|
||||
});
|
||||
}
|
||||
function handleReportSpan(s = 12) {
|
||||
option.value.group[2].column[0].span = s;
|
||||
option.value.group[2].column[1].span = s;
|
||||
}
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
>
|
||||
<template #menu="{ row }">
|
||||
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
|
||||
<el-button @click="handleDelFn(row.id, delFretilize, getData)">删除</el-button>
|
||||
<el-button @click="deleteFn(row.id, delFretilize, getData)">删除</el-button>
|
||||
</template>
|
||||
<template #photoUrl-form="{ type }">
|
||||
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
|
||||
@ -51,10 +51,11 @@ 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';
|
||||
import assistFn from '../hooks/useAssistFn';
|
||||
|
||||
const { deleteFn } = new assistFn();
|
||||
const { getFertilizreList, addFertilizer, delFretilize } = inputSuppliesApi;
|
||||
const { loadFinish, materialTypes, materialTwoLevel, targetName, goodsUnitOptions, useDosageUnit, handleShowName, handleNumUnit, handleDelFn } =
|
||||
useBasicInfo();
|
||||
const { loadFinish, materialTypes, materialTwoLevel, targetName, goodsUnitOptions, useDosageUnit, handleShowName, handleNumUnit } = useBasicInfo();
|
||||
|
||||
onMounted(getData);
|
||||
watch(
|
||||
|
@ -64,21 +64,13 @@ 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 assistFn from '../hooks/useAssistFn';
|
||||
const { deleteFn } = new assistFn();
|
||||
|
||||
const {
|
||||
defaultGet,
|
||||
loadFinish,
|
||||
materialTypes,
|
||||
materialTwoLevel,
|
||||
goodsUnitOptions,
|
||||
useDosageUnit,
|
||||
handleNumUnit,
|
||||
handleShowName,
|
||||
targetName,
|
||||
handleDelFn,
|
||||
} = useBasicInfo({
|
||||
moduleType: '1',
|
||||
});
|
||||
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, useDosageUnit, handleNumUnit, handleShowName, targetName } =
|
||||
useBasicInfo({
|
||||
moduleType: '1',
|
||||
});
|
||||
const { getPesticideList, addPesticide, pesticideReportSave, delPesticide } = inputSuppliesApi;
|
||||
|
||||
/* --------------- data --------------- */
|
||||
@ -442,7 +434,7 @@ const actions = ref([
|
||||
type: 'danger',
|
||||
name: '删除',
|
||||
icon: 'delete',
|
||||
event: ({ row }) => handleDelFn(row.id, delPesticide, getData),
|
||||
event: ({ row }) => deleteFn(row.id, delPesticide, getData),
|
||||
},
|
||||
]);
|
||||
// #endregion
|
||||
|
@ -25,7 +25,7 @@
|
||||
>
|
||||
<template #menu="{ row }">
|
||||
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
|
||||
<el-button @click="handleDelFn(row.id, delAnimalMedicine, getData)">删除</el-button>
|
||||
<el-button @click="deleteFn(row.id, delAnimalMedicine, getData)">删除</el-button>
|
||||
</template>
|
||||
<template #photoUrl-form="{ type }">
|
||||
<Attrs v-model:attrs="attrs" :type="type == 'add' ? 'add' : 'view'" :limit="2" />
|
||||
@ -47,9 +47,10 @@ 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 assistFn from '../hooks/useAssistFn';
|
||||
const { deleteFn } = new assistFn();
|
||||
|
||||
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, handleNumUnit, handleShowName, targetName, handleDelFn } =
|
||||
useBasicInfo();
|
||||
const { defaultGet, loadFinish, materialTypes, materialTwoLevel, goodsUnitOptions, handleNumUnit, handleShowName, targetName } = useBasicInfo();
|
||||
const { getAnimalMedicineList, addAnimalMedicine, delAnimalMedicine } = inputSuppliesApi;
|
||||
|
||||
/* --------------- data --------------- */
|
||||
|
@ -25,7 +25,7 @@
|
||||
>
|
||||
<template #menu="{ row }">
|
||||
<el-button type="primary" @click="handleInfo(row)">详情</el-button>
|
||||
<el-button @click="handleDelFn(row.id, delSeed, getData)">删除</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>
|
||||
</avue-crud>
|
||||
@ -40,9 +40,10 @@ 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';
|
||||
|
||||
import assistFn from '../hooks/useAssistFn';
|
||||
const { deleteFn } = new assistFn();
|
||||
const { getSeedList, seedSave, delSeed } = inputSuppliesapi;
|
||||
const { loadFinish, materialTypes, targetName, handleDelFn } = useBasicInfo({
|
||||
const { loadFinish, materialTypes, targetName } = useBasicInfo({
|
||||
moduleType: '4',
|
||||
});
|
||||
const _allTypes = ref([]);
|
||||
|
@ -7,39 +7,72 @@
|
||||
:table-loading="_loading"
|
||||
:data="data"
|
||||
:option="option"
|
||||
></avue-crud>
|
||||
:before-close="
|
||||
(done) => {
|
||||
handOtherInfo({}, true);
|
||||
done();
|
||||
}
|
||||
"
|
||||
@search-change="
|
||||
(form, done) => {
|
||||
getData(1);
|
||||
done();
|
||||
}
|
||||
"
|
||||
@search-reset="getData"
|
||||
@refresh-change="getData"
|
||||
@current-change="getData"
|
||||
@size-change="getData(1)"
|
||||
@row-save="handleRowSave"
|
||||
@row-update="handleRowUpdate"
|
||||
>
|
||||
<template #businessLicense-form="{ type }">
|
||||
<Attrs v-model:attrs="attrs1" :type="type" />
|
||||
</template>
|
||||
<template #productLicense-form="{ type }">
|
||||
<Attrs v-model:attrs="attrs2" :type="type" />
|
||||
</template>
|
||||
<template #registerCertificate-form="{ type }">
|
||||
<Attrs v-model:attrs="attrs3" :type="type" />
|
||||
</template>
|
||||
<template #menu="scope">
|
||||
<custom-table-operate :actions="actions" :data="scope" />
|
||||
</template>
|
||||
</avue-crud>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { CRUD_OPTIONS, pageData } from '@/config';
|
||||
import { ref, onMounted, reactive, render } from 'vue';
|
||||
import { CRUD_OPTIONS, pageData, customRules } from '@/config';
|
||||
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||
import Attrs from '../common/Attrs.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import assistFn from '../hooks/useAssistFn';
|
||||
const { getProductionDealerList, addProductionDealer, delProductionDealer, editProductionDealer } = inputSuppliesApi;
|
||||
const { deleteFn } = new assistFn();
|
||||
|
||||
onMounted(() => {
|
||||
minitor.value?.currentUav?.videoUrl[0] ?? false;
|
||||
console.log('test', minitor.value?.currentUav?.videoUrl[0] ?? false);
|
||||
});
|
||||
onMounted(getData);
|
||||
/* --------------- data --------------- */
|
||||
// #region
|
||||
const crudRef = ref(null);
|
||||
const _loading = ref(false);
|
||||
const dealerTypes = reactive([
|
||||
{ label: '农药生产经销商', value: '1' },
|
||||
{ label: '肥料生产经销商', value: '2' },
|
||||
{ label: '兽药生产经销商', value: '3' },
|
||||
{ label: '种源生产经销商', value: '4' },
|
||||
{ label: '农机生产经销商', value: '5' },
|
||||
]);
|
||||
const searchCondition = ref({
|
||||
_dealerType: '',
|
||||
keywords: '',
|
||||
});
|
||||
let minitor = ref({
|
||||
currentUav: { videoUrl: ['12312'] },
|
||||
});
|
||||
const data = ref([{}]);
|
||||
const option = ref({
|
||||
const option = reactive({
|
||||
...CRUD_OPTIONS,
|
||||
dialogWidth: '50%',
|
||||
column: [
|
||||
{
|
||||
hide: true,
|
||||
search: true,
|
||||
label: '经销商名称',
|
||||
prop: 'keywords',
|
||||
searchLabelWidth: 120,
|
||||
},
|
||||
{
|
||||
hide: true,
|
||||
search: true,
|
||||
@ -47,30 +80,335 @@ const option = ref({
|
||||
prop: '_dealerType',
|
||||
searchLabelWidth: 120,
|
||||
type: 'select',
|
||||
dicData: [
|
||||
{ label: '农药生产经销商', value: '1' },
|
||||
{ label: '肥料生产经销商', value: '2' },
|
||||
{ label: '兽药生产经销商', value: '3' },
|
||||
{ label: '种源生产经销商', value: '4' },
|
||||
{ label: '农机生产经销商', value: '5' },
|
||||
],
|
||||
dicData: dealerTypes,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
},
|
||||
{
|
||||
search: true,
|
||||
label: '经销商名称',
|
||||
prop: 'dealerName',
|
||||
prop: 'keywords',
|
||||
searchLabelWidth: 120,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
render: ({ row }) => row.companyName,
|
||||
},
|
||||
{
|
||||
label: '经销商类型',
|
||||
prop: 'dealerType',
|
||||
prop: 'text1',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
render: ({ row }) => dealerTypes.find((v) => v.value == row.dataType)?.label ?? '',
|
||||
},
|
||||
{
|
||||
label: '地址',
|
||||
prop: 'text2',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
render: ({ row }) => row.address,
|
||||
},
|
||||
{
|
||||
label: '证件资料',
|
||||
prop: 'text3',
|
||||
width: 280,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
render: ({ row }) => handleText3(row.dataType),
|
||||
},
|
||||
{
|
||||
label: '信息录入时间',
|
||||
prop: 'text4',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
render: ({ row }) => row.createTime || '',
|
||||
},
|
||||
{
|
||||
label: '信息更新时间',
|
||||
prop: 'text5',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
render: ({ row }) => row.updateTime || '',
|
||||
},
|
||||
],
|
||||
group: [
|
||||
{
|
||||
label: '企业信息',
|
||||
prop: 'dealerInfo',
|
||||
column: [
|
||||
{
|
||||
label: '企业类型',
|
||||
type: 'select',
|
||||
prop: 'dataType',
|
||||
dicData: dealerTypes,
|
||||
value: '1',
|
||||
clearable: false,
|
||||
change: (val) => handleShowColumn(val.value),
|
||||
},
|
||||
{
|
||||
label: '企业名称',
|
||||
prop: 'companyName',
|
||||
rules: customRules({ msg: '请输入企业名称' }),
|
||||
},
|
||||
{
|
||||
label: '地址',
|
||||
prop: 'address',
|
||||
rules: customRules({ msg: '请输入地址' }),
|
||||
},
|
||||
{
|
||||
label: '负责人',
|
||||
prop: 'chargePerson',
|
||||
rules: customRules({ msg: '请输入负责人' }),
|
||||
},
|
||||
{
|
||||
label: '联系方式',
|
||||
prop: 'phone',
|
||||
rules: customRules({ msg: '请输入联系方式' }),
|
||||
},
|
||||
{
|
||||
label: '经营产品',
|
||||
prop: 'operateProduct',
|
||||
rules: customRules({ msg: '请输入经营产品' }),
|
||||
},
|
||||
{
|
||||
label: '营业执照',
|
||||
prop: 'businessLicense',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请上传营业执照',
|
||||
trigger: ['change', 'blur'],
|
||||
validator: (rule, value, callback) => {
|
||||
if (attrs1.value.length === 0) {
|
||||
callback(new Error());
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '生产许可证',
|
||||
prop: 'productLicense',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请上传生产许可证',
|
||||
trigger: ['change', 'blur'],
|
||||
validator: (rule, value, callback) => {
|
||||
if (attrs2.value.length === 0) {
|
||||
callback(new Error());
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '登记证',
|
||||
prop: 'registerCertificate',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请上传登记证',
|
||||
trigger: ['change', 'blur'],
|
||||
validator: (rule, value, callback) => {
|
||||
if (attrs3.value.length === 0) {
|
||||
callback(new Error());
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '巡查信息',
|
||||
prop: 'checkInfo',
|
||||
column: [
|
||||
{
|
||||
label: '单位',
|
||||
prop: 'unit',
|
||||
rules: customRules({ msg: '请输入巡查单位' }),
|
||||
},
|
||||
{
|
||||
label: '部门',
|
||||
prop: 'dept',
|
||||
rules: customRules({ msg: '请输入巡查部门' }),
|
||||
},
|
||||
{
|
||||
label: '巡查人',
|
||||
prop: 'inspector',
|
||||
rules: customRules({ msg: '请输入巡查人' }),
|
||||
},
|
||||
{
|
||||
label: '巡查时间',
|
||||
prop: 'inspectTime',
|
||||
type: 'date',
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
rules: customRules({ msg: '请输入巡查时间' }),
|
||||
},
|
||||
{
|
||||
label: '巡查事件',
|
||||
prop: 'inspectIncident',
|
||||
rules: customRules({ msg: '请输入巡查事件' }),
|
||||
},
|
||||
{
|
||||
label: '产品是否违规',
|
||||
prop: 'isViolation',
|
||||
type: 'select',
|
||||
dicData: [
|
||||
{ label: '否', value: '0' },
|
||||
{ label: '是', value: '1' },
|
||||
],
|
||||
value: '0',
|
||||
rules: customRules({ msg: '请选择' }),
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
prop: 'remark',
|
||||
type: 'textarea',
|
||||
span: 24,
|
||||
rules: customRules({ msg: '请输入备注' }),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
const actions = reactive([
|
||||
{
|
||||
name: '编辑',
|
||||
icon: 'edit',
|
||||
event: ({ row }) => {
|
||||
handOtherInfo(row);
|
||||
crudRef.value.rowEdit(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '详情',
|
||||
icon: 'view',
|
||||
event: ({ row }) => {
|
||||
handOtherInfo(row);
|
||||
crudRef.value.rowView(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '删除',
|
||||
icon: 'delete',
|
||||
event: ({ row }) => {
|
||||
deleteFn(row.id, delProductionDealer, getData);
|
||||
},
|
||||
},
|
||||
]);
|
||||
const text3Names = reactive({
|
||||
1: '农药登记证',
|
||||
2: '肥料登记证',
|
||||
3: '兽药GMP证书',
|
||||
5: '3C认证证书',
|
||||
});
|
||||
const attrs1 = ref([]);
|
||||
const attrs2 = ref([]);
|
||||
const attrs3 = ref([]);
|
||||
// #endregion
|
||||
|
||||
/* --------------- methods --------------- */
|
||||
// #region
|
||||
|
||||
function handleShowColumn(t = '1') {
|
||||
option.group[0].column[8].addDisplay = t != '4';
|
||||
option.group[0].column[8].label = text3Names[t];
|
||||
}
|
||||
async function getData(reset) {
|
||||
_loading.value = true;
|
||||
reset == 1 && (pageData.value.currentPage = 1);
|
||||
let params = {
|
||||
current: pageData.value.currentPage,
|
||||
size: pageData.value.size,
|
||||
companyName: searchCondition.value.keywords,
|
||||
dataType: searchCondition.value._dealerType,
|
||||
};
|
||||
let res = await getProductionDealerList(params);
|
||||
if (res.code == 200) {
|
||||
data.value = res.data.records;
|
||||
pageData.value.total = res.data.total;
|
||||
}
|
||||
_loading.value = false;
|
||||
}
|
||||
function handleData(row) {
|
||||
let arr = ['text1', 'text2', 'text3', 'text4', 'text5', 'keywords', '_dealerType', 'createTime', 'updateTime'];
|
||||
let data = Object.assign({}, row);
|
||||
arr.forEach((v) => {
|
||||
delete data[v];
|
||||
});
|
||||
data.businessLicense = attrs1.value.map((v) => v.url).join();
|
||||
data.productLicense = attrs2.value.map((v) => v.url).join();
|
||||
data.registerCertificate = attrs3.value.map((v) => v.url).join();
|
||||
return data;
|
||||
}
|
||||
function handOtherInfo(row, reset = false) {
|
||||
if (reset) {
|
||||
attrs1.value = [];
|
||||
attrs2.value = [];
|
||||
attrs3.value = [];
|
||||
return;
|
||||
}
|
||||
attrs1.value = row.businessLicense
|
||||
? row.businessLicense.split(',').map((v, i) => {
|
||||
return {
|
||||
url: v,
|
||||
uid: `businessLicense_${i}_${Date.now()}`,
|
||||
};
|
||||
})
|
||||
: [];
|
||||
attrs2.value = row.productLicense
|
||||
? row.productLicense.split(',').map((v, i) => {
|
||||
return {
|
||||
url: v,
|
||||
uid: `productLicense_${i}_${Date.now()}`,
|
||||
};
|
||||
})
|
||||
: [];
|
||||
attrs3.value = row.registerCertificate
|
||||
? row.registerCertificate.split(',').map((v, i) => {
|
||||
return {
|
||||
url: v,
|
||||
uid: `registerCertificate_${i}_${Date.now()}`,
|
||||
};
|
||||
})
|
||||
: [];
|
||||
}
|
||||
async function handleRowSave(row, done, loading) {
|
||||
let res = await addProductionDealer(handleData(row));
|
||||
loading();
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('保存成功');
|
||||
getData();
|
||||
done();
|
||||
}
|
||||
}
|
||||
async function handleRowUpdate(row, index, done, loading) {
|
||||
let res = await editProductionDealer(handleData(row));
|
||||
loading();
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('修改成功');
|
||||
getData();
|
||||
done();
|
||||
}
|
||||
}
|
||||
function handleText3(t = '1') {
|
||||
let s = '营业执照、生产许可证';
|
||||
if (t != '4') s += `、${text3Names[t]}`;
|
||||
return s;
|
||||
}
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
@ -1,24 +1,31 @@
|
||||
<template>
|
||||
<section class="custom-page">
|
||||
<el-radio-group v-model="landType" class="lands_types" style="margin-bottom: 30px" @change="getList()">
|
||||
<el-radio-button v-for="item in landsType" :key="'landsType_' + item.value" :value="item.value">
|
||||
{{ item.label }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
<avue-crud
|
||||
ref="crudRef"
|
||||
v-model:page="pageData"
|
||||
v-model:search="searchData"
|
||||
v-model:search="searchCondition"
|
||||
class="custon_create_land_"
|
||||
:data="data"
|
||||
:option="option"
|
||||
:before-close="handleCloseFrom"
|
||||
:table-loading="loading"
|
||||
@current-change="handlePageChange"
|
||||
@refresh-change="getList()"
|
||||
@current-change="getList()"
|
||||
@size-change="handleSizeChange"
|
||||
@search-reset="handleResetSearch"
|
||||
@search-change="handleSearch"
|
||||
@search-reset="
|
||||
() => {
|
||||
resetLandType();
|
||||
getList(1);
|
||||
}
|
||||
"
|
||||
@search-change="
|
||||
(form, done) => {
|
||||
getList(1);
|
||||
done();
|
||||
}
|
||||
"
|
||||
@row-save="handleRowSave"
|
||||
@row-update="handleRowUpdate"
|
||||
>
|
||||
<template #landTransfer="{ row }">
|
||||
{{ row.landTransfer == '1' ? '是' : '否' }}
|
||||
@ -30,19 +37,11 @@
|
||||
<el-button type="success" icon="download" @click="handleExport">导出</el-button>
|
||||
<el-button type="success" icon="upload" @click="onUpload">导入</el-button>
|
||||
</template>
|
||||
<!-- <template #menu="{ row }">
|
||||
<el-button type="info" link @click="handleView(row)">查看</el-button>
|
||||
<el-popconfirm title="确定删除该土地?" @confirm="() => handleDelete(row.id)">
|
||||
<template #reference>
|
||||
<el-button type="danger" link>删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template> -->
|
||||
<template #area-form>
|
||||
<section 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.value" />
|
||||
<el-option v-for="item in unitOptions" :key="'unitOptions_' + item.value" :label="item.label" :value="item.label" />
|
||||
</el-select>
|
||||
</section>
|
||||
</template>
|
||||
@ -63,7 +62,6 @@
|
||||
<custom-table-operate :actions="option.actions" :data="scope" />
|
||||
</template>
|
||||
</avue-crud>
|
||||
|
||||
<custom-import-excel
|
||||
ref="importExcelRef"
|
||||
:template-url="getAssetsFile('template/土地模版表.xlsx')"
|
||||
@ -74,39 +72,38 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { ref, reactive, onMounted, watch } from 'vue';
|
||||
import { CRUD_OPTIONS } from '@/config';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { getLandsList, exportLands, delLand, saveLand, importLands } from '@/apis/land.js';
|
||||
import { getLandTypeTree } from '@/apis/baseInfo';
|
||||
import { getLandsList, exportLands, delLand, saveLand, importLands, editLand } from '@/apis/land.js';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import useLandHook from './useLandHook';
|
||||
import Attrs from './common/Attrs.vue';
|
||||
import { getAssetsFile, downloadFile } from '@/utils';
|
||||
import { useApp } from '@/hooks';
|
||||
import { get } from 'lodash';
|
||||
|
||||
const app = useApp();
|
||||
const { landType, landsType } = useLandHook();
|
||||
const { loadFinish, resetLandType, searchCondition, unitOptions, unitValue, landTreeDic } = useLandHook();
|
||||
const { VITE_APP_BASE_API } = import.meta.env;
|
||||
const UserStore = useUserStore();
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getLandTree();
|
||||
});
|
||||
watch(
|
||||
() => loadFinish.value,
|
||||
() => {
|
||||
if (loadFinish.value == 2) {
|
||||
getList();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const params = ref({
|
||||
zoom: 10,
|
||||
});
|
||||
const local_ = ref([102.833669, 24.88149, '昆明市']);
|
||||
const local = ref(JSON.parse(JSON.stringify(local_.value)));
|
||||
const landTreeDic = ref([]);
|
||||
const landArea = ref(1);
|
||||
const unitValue = ref('0');
|
||||
const unitOptions = reactive([
|
||||
{ label: '平方米', value: '0' },
|
||||
{ label: '亩', value: '1' },
|
||||
{ label: '公顷', value: '2' },
|
||||
]);
|
||||
|
||||
/* --------------- data --------------- */
|
||||
// #region
|
||||
const loading = ref(false);
|
||||
@ -122,6 +119,19 @@ const option = reactive({
|
||||
menuWidth: 120,
|
||||
selection: false,
|
||||
column: [
|
||||
{
|
||||
hide: true,
|
||||
label: '用地分类',
|
||||
prop: 'landType',
|
||||
search: true,
|
||||
type: 'cascader',
|
||||
dicData: landTreeDic,
|
||||
clearable: false,
|
||||
value: [],
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
label: '地块名',
|
||||
prop: 'landName',
|
||||
@ -129,6 +139,7 @@ const option = reactive({
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
label: '地址',
|
||||
@ -136,6 +147,7 @@ const option = reactive({
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
label: '产权人',
|
||||
@ -162,6 +174,7 @@ const option = reactive({
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
label: '面积',
|
||||
@ -172,7 +185,7 @@ const option = reactive({
|
||||
render: ({ row }) => {
|
||||
let s = '';
|
||||
if (row.area && row.landUnit) {
|
||||
s = row.area + unitOptions.find((v) => v.value == row.landUnit).label;
|
||||
s = row.area + row.landUnit;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
@ -183,6 +196,7 @@ const option = reactive({
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
label: '是否流转土地',
|
||||
@ -190,6 +204,7 @@ const option = reactive({
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
width: 140,
|
||||
},
|
||||
{
|
||||
label: '产权编号',
|
||||
@ -200,13 +215,9 @@ const option = reactive({
|
||||
},
|
||||
{
|
||||
label: '土壤类型',
|
||||
prop: 'soilType',
|
||||
prop: 'soilTypeName',
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
render: ({ row }) => {
|
||||
return row.soilType;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '是否上传附件',
|
||||
@ -214,6 +225,7 @@ const option = reactive({
|
||||
addDisplay: false,
|
||||
display: false,
|
||||
editDisplay: false,
|
||||
width: 140,
|
||||
},
|
||||
],
|
||||
group: [
|
||||
@ -291,7 +303,6 @@ const option = reactive({
|
||||
authorization: UserStore.token,
|
||||
},
|
||||
dicFormatter: (res) => res.data ?? [],
|
||||
// change: (o) => setCityChange(o),
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
@ -317,7 +328,7 @@ const option = reactive({
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '是否土地流转1',
|
||||
label: '是否土地流转',
|
||||
prop: 'isTransferView',
|
||||
addDisplay: false,
|
||||
},
|
||||
@ -348,11 +359,6 @@ const option = reactive({
|
||||
label: 'soilType',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '土壤类型',
|
||||
prop: 'soilType',
|
||||
addDisplay: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -426,11 +432,11 @@ const option = reactive({
|
||||
icon: 'view',
|
||||
event: ({ row }) => handleView(row),
|
||||
},
|
||||
// {
|
||||
// name: '编辑',
|
||||
// icon: 'edit',
|
||||
// event: ({ row }) => rowEdit(row),
|
||||
// },
|
||||
{
|
||||
name: '编辑',
|
||||
icon: 'edit',
|
||||
event: ({ row }) => rowEdit(row),
|
||||
},
|
||||
{
|
||||
type: 'danger',
|
||||
name: '删除',
|
||||
@ -439,11 +445,6 @@ const option = reactive({
|
||||
},
|
||||
],
|
||||
});
|
||||
const searchData = reactive({
|
||||
landName: '',
|
||||
gridName: '',
|
||||
owner: '',
|
||||
});
|
||||
const attrs = ref([]);
|
||||
const landOwnerAttrs = ref([]);
|
||||
const landAttrs = ref([]);
|
||||
@ -454,14 +455,18 @@ const importExcelRef = ref();
|
||||
/* --------------- methods --------------- */
|
||||
// #region
|
||||
|
||||
async function getList() {
|
||||
async function getList(reset = 1) {
|
||||
reset == 1 && (pageData.value.currentPage = 1);
|
||||
loading.value = true;
|
||||
const params = {
|
||||
current: pageData.value.currentPage,
|
||||
size: pageData.value.pageSize,
|
||||
landType: landType.value,
|
||||
...searchData,
|
||||
};
|
||||
let params = Object.assign(
|
||||
{},
|
||||
{
|
||||
current: pageData.value.currentPage,
|
||||
size: pageData.value.pageSize,
|
||||
...searchCondition.value,
|
||||
}
|
||||
);
|
||||
params.landType = searchCondition.value.landType[searchCondition.value.landType.length - 1];
|
||||
let res = await getLandsList(params);
|
||||
loading.value = false;
|
||||
if (res.code == 200) {
|
||||
@ -471,42 +476,23 @@ async function getList() {
|
||||
v.isTransfer = v.landTransfer || 1;
|
||||
v.isTransferView = v.landTransfer == 1 ? '否' : '是';
|
||||
v.coordinateView = v.coordinate;
|
||||
v.soilTypeName = v.soilType;
|
||||
v.soilTypeId = v.soilId;
|
||||
});
|
||||
pageData.value.total = total;
|
||||
}
|
||||
}
|
||||
function handlePageChange(val) {
|
||||
pageData.value.currentPage = val;
|
||||
getList();
|
||||
}
|
||||
|
||||
function handleSizeChange(val) {
|
||||
pageData.value.pageSize = val;
|
||||
getList();
|
||||
}
|
||||
async function handleSearch(form, done) {
|
||||
for (let key in form) {
|
||||
searchData[key] = form[key];
|
||||
}
|
||||
await getList();
|
||||
done();
|
||||
}
|
||||
async function handleResetSearch() {
|
||||
for (let key in searchData) {
|
||||
searchData[key] = '';
|
||||
}
|
||||
pageData.value.currentPage = 1;
|
||||
pageData.value.pageSize = 10;
|
||||
pageData.value.total = 0;
|
||||
await getList();
|
||||
}
|
||||
const attrNames = reactive(landsType.map((v) => v.label));
|
||||
async function handleExport() {
|
||||
let res = await exportLands({
|
||||
landType: landType.value,
|
||||
landType: searchCondition.value.landType[searchCondition.value.landType.length - 1],
|
||||
});
|
||||
if (res) {
|
||||
let a = document.createElement('a');
|
||||
a.download = attrNames.value[Number(landType.value)] + '.xlsx';
|
||||
a.download = 'test.xlsx';
|
||||
let blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
let link = window.URL.createObjectURL(blob);
|
||||
@ -539,34 +525,8 @@ function handleDelete(id) {
|
||||
.catch(() => {});
|
||||
}
|
||||
function handleView(obj) {
|
||||
handleAttrs(obj);
|
||||
rowData.value = obj;
|
||||
if (obj.propertyCertificateUrl) {
|
||||
attrs.value = obj.propertyCertificateUrl.split(',').map((v, i) => {
|
||||
return {
|
||||
name: `产权附件_${i}`,
|
||||
url: v,
|
||||
uid: 'id_' + Date.now(),
|
||||
};
|
||||
});
|
||||
}
|
||||
if (obj.landCertificateUrl) {
|
||||
landOwnerAttrs.value = obj.landCertificateUrl.split(',').map((v, i) => {
|
||||
return {
|
||||
name: `使用信息附件_${i}`,
|
||||
url: v,
|
||||
uid: 'id_' + Date.now(),
|
||||
};
|
||||
});
|
||||
if (obj.landUrl) {
|
||||
landAttrs.value = obj.landUrl.split(',').map((v, i) => {
|
||||
return {
|
||||
name: `位置附件_${i}`,
|
||||
url: v,
|
||||
uid: 'id_' + Date.now(),
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
crudRef.value.rowView(obj);
|
||||
}
|
||||
function handleCloseFrom(done) {
|
||||
@ -574,14 +534,14 @@ function handleCloseFrom(done) {
|
||||
attrs.value = [];
|
||||
landAttrs.value = [];
|
||||
landArea.value = 1;
|
||||
unitValue.value = '0';
|
||||
unitValue.value = unitOptions[0].label || '';
|
||||
local.value = JSON.parse(JSON.stringify(local_.value));
|
||||
done();
|
||||
}
|
||||
async function handleRowSave(val, done, loading) {
|
||||
function handleData(val) {
|
||||
let data = JSON.parse(JSON.stringify(val));
|
||||
data.isDraftsSave = 0;
|
||||
data.landType = landType.value;
|
||||
data.landType = searchCondition.value.landType[searchCondition.value.landType.length - 1];
|
||||
let urls = [];
|
||||
let landOwnerUrls = [];
|
||||
let landUrls = [];
|
||||
@ -601,19 +561,70 @@ async function handleRowSave(val, done, loading) {
|
||||
data.landUrl = landUrls.join();
|
||||
data.villageCode = data.villageCode[data.villageCode.length - 1] || '';
|
||||
data.landTypeId = data.landTypeId[data.landTypeId.length - 1];
|
||||
data.soilType = data.soilTypeId;
|
||||
if (local.value.length != 0) {
|
||||
data.coordinate = `${local.value[0]}E,${local.value[1]}N`;
|
||||
}
|
||||
const res = await saveLand(data);
|
||||
return data;
|
||||
}
|
||||
async function handleRowSave(val, done, loading) {
|
||||
console.log('save', val);
|
||||
let data = handleData(val);
|
||||
console.log('save -data', data);
|
||||
// const res = await saveLand(data);
|
||||
loading();
|
||||
// if (res.code == 200) {
|
||||
// ElMessage.success('保存成功');
|
||||
// getList();
|
||||
// attrs.value = [];
|
||||
// landOwnerAttrs.value = [];
|
||||
// done();
|
||||
// }
|
||||
}
|
||||
async function handleRowUpdate(form, index, done, loading) {
|
||||
let data = handleData(form);
|
||||
let res = await editLand(data);
|
||||
loading();
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('保存成功');
|
||||
getList();
|
||||
attrs.value = [];
|
||||
landOwnerAttrs.value = [];
|
||||
ElMessage.success('编辑成功');
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
async function rowEdit(obj) {
|
||||
console.log('rowEdit', obj);
|
||||
handleAttrs(obj);
|
||||
crudRef.value.rowEdit(obj);
|
||||
}
|
||||
function handleAttrs(obj) {
|
||||
if (obj.propertyCertificateUrl) {
|
||||
attrs.value = obj.propertyCertificateUrl.split(',').map((v, i) => {
|
||||
return {
|
||||
name: `产权附件_${i}`,
|
||||
url: v,
|
||||
uid: 'id_' + Date.now(),
|
||||
};
|
||||
});
|
||||
}
|
||||
if (obj.landCertificateUrl) {
|
||||
landOwnerAttrs.value = obj.landCertificateUrl.split(',').map((v, i) => {
|
||||
return {
|
||||
name: `使用信息附件_${i}`,
|
||||
url: v,
|
||||
uid: 'id_' + Date.now(),
|
||||
};
|
||||
});
|
||||
}
|
||||
if (obj.landUrl) {
|
||||
landAttrs.value = obj.landUrl.split(',').map((v, i) => {
|
||||
return {
|
||||
name: `位置附件_${i}`,
|
||||
url: v,
|
||||
uid: 'id_' + Date.now(),
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
// 导入
|
||||
const onUpload = () => {
|
||||
importExcelRef?.value && importExcelRef.value.show();
|
||||
@ -622,7 +633,7 @@ const onDownloadExcel = (url) => {
|
||||
downloadFile(url, `土地模版表.xlsx`);
|
||||
};
|
||||
const onUploadExcel = (formData) => {
|
||||
formData.append('landType', landType.value);
|
||||
formData.append('landType', searchCondition.value.landType[searchCondition.value.landType.length - 1]);
|
||||
importLands(formData)
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
@ -637,43 +648,11 @@ const onUploadExcel = (formData) => {
|
||||
importExcelRef.value.hide();
|
||||
});
|
||||
};
|
||||
async function getLandTree() {
|
||||
let res = await getLandTypeTree();
|
||||
if (res.code == 200) {
|
||||
landTreeDic.value = newTree(res.data, 0);
|
||||
console.log('landTreeDic', landTreeDic.value);
|
||||
}
|
||||
}
|
||||
function newTree(arr, i) {
|
||||
arr.forEach((v) => {
|
||||
if (i == 0) {
|
||||
v.value = v.id;
|
||||
v.label = v.landType;
|
||||
v.disabled = !v.children || !v.children.length;
|
||||
} else {
|
||||
v.value = v.id;
|
||||
v.label = v.landType;
|
||||
}
|
||||
if (v.children) v.children = newTree(v.children, i + 1);
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.lands_types {
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
> label {
|
||||
width: 12%;
|
||||
::v-deep() {
|
||||
.el-radio-button__inner {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.area_form_ {
|
||||
display: grid;
|
||||
grid-template-columns: 75% 25%;
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { GetEntityList } from '@/apis/system/dict';
|
||||
import { getLandTypeTree } from '@/apis/baseInfo';
|
||||
|
||||
export default function useLandHook() {
|
||||
const loadFinish = ref(0);
|
||||
const landType = ref('0');
|
||||
const landsType = reactive([
|
||||
{
|
||||
@ -15,8 +19,82 @@ export default function useLandHook() {
|
||||
label: '园林',
|
||||
},
|
||||
]);
|
||||
const _landType = ref([]);
|
||||
const searchCondition = ref({
|
||||
landName: '',
|
||||
gridName: '',
|
||||
owner: '',
|
||||
landType: [],
|
||||
});
|
||||
const landTreeDic = ref([]);
|
||||
const unitOptions = reactive([]);
|
||||
const unitValue = ref('');
|
||||
async function getAreaUnit() {
|
||||
let res = await GetEntityList({
|
||||
current: 1,
|
||||
size: 1000,
|
||||
dictType: 'sys_area_unit',
|
||||
});
|
||||
loadFinish.value += 1;
|
||||
if (res.code == 200) {
|
||||
res.data.records.forEach((v) => {
|
||||
unitOptions.push({
|
||||
label: v.dictLabel,
|
||||
value: v.dictValue,
|
||||
});
|
||||
if (unitOptions.length) unitValue.value = unitOptions[0].label;
|
||||
});
|
||||
}
|
||||
}
|
||||
async function getLandTree() {
|
||||
let res = await getLandTypeTree();
|
||||
if (res.code == 200) {
|
||||
landTreeDic.value = newTree(res.data, 0);
|
||||
_landType.value = defaultLandType(landTreeDic.value);
|
||||
resetLandType();
|
||||
loadFinish.value += 1;
|
||||
}
|
||||
}
|
||||
function resetLandType() {
|
||||
searchCondition.value.landType = JSON.parse(JSON.stringify(_landType.value));
|
||||
}
|
||||
function defaultLandType(_data = []) {
|
||||
let _arr = [];
|
||||
if (_data.length > 0) {
|
||||
_arr.push(_data[0].value);
|
||||
if (_data[0]?.children?.length ?? false) {
|
||||
_arr.push(...defaultLandType(_data[0].children));
|
||||
}
|
||||
}
|
||||
return _arr;
|
||||
}
|
||||
function newTree(arr, i) {
|
||||
arr.forEach((v) => {
|
||||
if (i == 0) {
|
||||
v.value = v.id;
|
||||
v.label = v.landType;
|
||||
// v.disabled = !v.children || !v.children.length;
|
||||
} else {
|
||||
v.value = v.id;
|
||||
v.label = v.landType;
|
||||
}
|
||||
if (v.children) v.children = newTree(v.children, i + 1);
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getAreaUnit();
|
||||
getLandTree();
|
||||
});
|
||||
return {
|
||||
loadFinish,
|
||||
landType,
|
||||
landsType,
|
||||
searchCondition,
|
||||
unitOptions,
|
||||
unitValue,
|
||||
landTreeDic,
|
||||
resetLandType,
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user