土地巡查接口
This commit is contained in:
parent
4288429981
commit
5586c66710
@ -58,7 +58,7 @@ export function exportAnnua(params = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function delAnnual(params) {
|
export function delAnnual(params) {
|
||||||
return request('/trace/code/annualManage/delete/' + params.id, {
|
return request('land-resource/annualManage/delete/' + params.id, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -193,3 +193,25 @@ export function importLands(data) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//土地巡查相关
|
||||||
|
export function getlandInspection(params = {}) {
|
||||||
|
return request('land-resource/landInspection/page', {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function savelandInspection(data) {
|
||||||
|
return request('land-resource/landInspection/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editlandInspection(data = {}) {
|
||||||
|
return request('land-resource/landInspection/update', {
|
||||||
|
method: 'PUT',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -30,75 +30,39 @@
|
|||||||
<el-tag v-if="row.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
|
<el-tag v-if="row.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #menu="scope">
|
<template #growthCycle-form="{ row, column, value, type }">
|
||||||
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
<el-input-number v-model="growthCycleVal[0]" :disabled="type == 'view' ? true : false" :min="1" :max="30" style="width: 130px">
|
||||||
</template>
|
|
||||||
</avue-crud>
|
|
||||||
|
|
||||||
<el-dialog v-model="infoVisible" title="年度种植计划" width="1000" center>
|
|
||||||
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="计划名称:" prop="planName">
|
|
||||||
<el-input v-model="infoData.planName" placeholder="请输入" style="width: 240px"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="种植面积" prop="plantingArea">
|
|
||||||
<el-input-number v-model="infoData.plantingArea" :min="1" :max="10000">
|
|
||||||
<template #suffix>
|
|
||||||
<span>亩</span>
|
|
||||||
</template>
|
|
||||||
</el-input-number>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="适宜种植月份" prop="plantingMonths">
|
|
||||||
<el-select v-model="infoData.plantingMonths" placeholder="请选择月份" style="width: 240px" :clearable="true" :multiple="true">
|
|
||||||
<el-option v-for="item in monthsOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="生长周期" prop="growthCycleVal">
|
|
||||||
<el-input-number v-model="infoData.growthCycleVal[0]" :min="1" :max="30">
|
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span>周</span>
|
<span>周</span>
|
||||||
</template>
|
</template>
|
||||||
</el-input-number>
|
</el-input-number>
|
||||||
-
|
-
|
||||||
<el-input-number v-model="infoData.growthCycleVal[1]" :min="1" :max="30">
|
<el-input-number v-model="growthCycleVal[1]" :min="1" :disabled="type == 'view' ? true : false" :max="30" style="width: 130px">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span>周</span>
|
<span>周</span>
|
||||||
</template>
|
</template>
|
||||||
</el-input-number>
|
</el-input-number>
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="备注" prop="note">
|
|
||||||
<el-input v-model="infoData.note" type="textarea" placeholder="请输入备注" style="width: 240px"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="infoCancel">取消</el-button>
|
|
||||||
<el-button type="primary" @click="subMitInfo(infoRef)"> 确认 </el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
|
||||||
|
<template #plantingMonths-form="{ row, column, value, type }">
|
||||||
|
<el-select
|
||||||
|
v-model="plantingMonths"
|
||||||
|
placeholder="请选择月份"
|
||||||
|
:disabled="type == 'view' ? true : false"
|
||||||
|
style="width: 200px"
|
||||||
|
:clearable="true"
|
||||||
|
:multiple="true"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in monthsOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
|
||||||
<el-dialog v-model="examVisible" title="审核计划" width="500" center>
|
<el-dialog v-model="examVisible" title="审核计划" width="500" center>
|
||||||
<!-- <el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="备注" prop="note">
|
|
||||||
<el-input v-model="infoData.note" type="textarea" placeholder="请输入备注" style="width: 240px"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form> -->
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="danger" @click="examCancel">审核拒绝</el-button>
|
<el-button type="danger" @click="examCancel">审核拒绝</el-button>
|
||||||
@ -106,29 +70,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog v-model="detailVisible" title="年度计划详情" width="800" center>
|
|
||||||
<el-descriptions :title="currentRow.planName || ''">
|
|
||||||
<el-descriptions-item label="计划编号">{{ currentRow.id || '--' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="计划名称">{{ currentRow.planName || '--' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="种植面积">{{ currentRow.plantingArea || '--' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="种植月份">{{ currentRow.plantingMonths || '--' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="生长周期">{{ currentRow.growthCycle || '--' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="备注">{{ currentRow.note || '--' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="计划进度">{{ currentRow.planProgress || '--' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="状态">
|
|
||||||
<el-tag v-if="currentRow.planStatus == '1'" type="warning" size="small">待提交</el-tag>
|
|
||||||
<el-tag v-if="currentRow.planStatus == '2'" type="primary" size="small">审核中</el-tag>
|
|
||||||
<el-tag v-if="currentRow.planStatus == '3'" type="success" size="small">通过</el-tag>
|
|
||||||
<el-tag v-if="currentRow.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
|
|
||||||
</el-descriptions-item>
|
|
||||||
</el-descriptions>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="toBack"> 返回 </el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -138,7 +79,6 @@ import { CRUD_OPTIONS } from '@/config';
|
|||||||
import { isEmpty, downloadFile } from '@/utils';
|
import { isEmpty, downloadFile } from '@/utils';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
import { compact } from 'lodash';
|
import { compact } from 'lodash';
|
||||||
import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity, ExportEntity } from '@/apis/grid';
|
|
||||||
import { getAnnualList, saveAnnual, editAnnual, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
|
import { getAnnualList, saveAnnual, editAnnual, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
|
||||||
|
|
||||||
const { VITE_APP_BASE_API } = import.meta.env;
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
@ -146,8 +86,6 @@ const app = useApp();
|
|||||||
const UserStore = useUserStore();
|
const UserStore = useUserStore();
|
||||||
const crudRef = ref(null);
|
const crudRef = ref(null);
|
||||||
|
|
||||||
const infoVisible = ref(false);
|
|
||||||
const infoRef = ref();
|
|
||||||
const monthsOptions = reactive([
|
const monthsOptions = reactive([
|
||||||
{ label: '1月份', value: '1月' },
|
{ label: '1月份', value: '1月' },
|
||||||
{ label: '2月份', value: '2月' },
|
{ label: '2月份', value: '2月' },
|
||||||
@ -163,26 +101,11 @@ const monthsOptions = reactive([
|
|||||||
{ label: '12月份', value: '12月' },
|
{ label: '12月份', value: '12月' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let infoData = reactive({
|
let infoData = reactive({ id: '' });
|
||||||
planName: '',
|
|
||||||
plantingArea: 0,
|
|
||||||
plantingMonths: [],
|
|
||||||
growthCycle: '',
|
|
||||||
note: '',
|
|
||||||
growthCycleVal: [0, 0],
|
|
||||||
});
|
|
||||||
|
|
||||||
const infoRules = reactive({
|
|
||||||
planName: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
|
||||||
plantingArea: [{ required: true, message: '请输入种植面积', trigger: 'blur' }],
|
|
||||||
plantingMonths: [{ required: true, message: '请选择种植月份', trigger: 'blur' }],
|
|
||||||
growthCycleVal: [{ required: true, message: '请输入生长周期', trigger: 'blur' }],
|
|
||||||
note: [{ required: true, message: '请输入备注', trigger: 'blur' }],
|
|
||||||
});
|
|
||||||
|
|
||||||
const examVisible = ref(false);
|
const examVisible = ref(false);
|
||||||
const detailVisible = ref(false);
|
let growthCycleVal = reactive([0, 0]);
|
||||||
let currentRow = reactive({});
|
let plantingMonths = ref([]);
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -197,14 +120,76 @@ const state = reactive({
|
|||||||
addBtnText: '',
|
addBtnText: '',
|
||||||
addBtn: false,
|
addBtn: false,
|
||||||
column: [
|
column: [
|
||||||
{ label: '计划编号', prop: 'id', width: '200px', showOverflowTooltip: true },
|
{ label: '计划编号', prop: 'id', width: '200px', showOverflowTooltip: true, addDisplay: false, editDisplay: false },
|
||||||
{ label: '计划名称', prop: 'planName', width: '200px', showOverflowTooltip: true, search: true },
|
{
|
||||||
{ label: '种植面积', prop: 'plantingArea' },
|
label: '计划名称',
|
||||||
{ label: '种植月份', prop: 'plantingMonths', width: '120px' },
|
prop: 'planName',
|
||||||
{ label: '生长周期', prop: 'growthCycle', width: '120px' },
|
width: '200px',
|
||||||
{ label: '备注', prop: 'note', width: '180px', showOverflowTooltip: true },
|
showOverflowTooltip: true,
|
||||||
{ label: '计划进度', prop: 'planProgress' },
|
search: true,
|
||||||
{ label: '状态', prop: 'planStatus' },
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植面积',
|
||||||
|
prop: 'plantingArea',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植月份',
|
||||||
|
prop: 'plantingMonths',
|
||||||
|
width: '120px',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (!plantingMonths.value.length) {
|
||||||
|
callback(new Error('请输入'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '生长周期',
|
||||||
|
prop: 'growthCycle',
|
||||||
|
width: '120px',
|
||||||
|
viewDisabled: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (growthCycleVal[0] < 1 || growthCycleVal[1] < 1) {
|
||||||
|
callback(new Error('请输入'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
prop: 'note',
|
||||||
|
width: '180px',
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: '计划进度', prop: 'planProgress', addDisplay: false, editDisplay: false },
|
||||||
|
{ label: '状态', prop: 'planStatus', addDisplay: false, editDisplay: false },
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
@ -297,43 +282,62 @@ const selectionChange = (rows) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onAdd = () => {
|
const onAdd = () => {
|
||||||
infoVisible.value = true;
|
afterSub();
|
||||||
|
crudRef.value.rowAdd();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
const rowSave = (row, done, loading) => {
|
const rowSave = (row, done, loading) => {
|
||||||
console.info('新增');
|
row.growthCycle = growthCycleVal[0] + '周' + ',' + growthCycleVal[1] + '周';
|
||||||
|
row.plantingMonths = plantingMonths.value.length ? plantingMonths.value.toString() : '';
|
||||||
|
saveAnnual(row)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
};
|
||||||
|
const beforeMsg = (row) => {
|
||||||
|
growthCycleVal = row.growthCycle.split(',').map((m) => {
|
||||||
|
return Number(m.replace(/[^0-9]/gi, ''));
|
||||||
|
});
|
||||||
|
plantingMonths.value = row.plantingMonths.split(',');
|
||||||
|
};
|
||||||
|
|
||||||
|
const afterSub = () => {
|
||||||
|
growthCycleVal = [0, 0];
|
||||||
|
plantingMonths.value = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const rowEdit = (row) => {
|
const rowEdit = (row) => {
|
||||||
console.info('编辑');
|
console.info('编辑');
|
||||||
// crudRef.value.rowEdit(row);
|
beforeMsg(row);
|
||||||
infoData = reactive({
|
crudRef.value.rowEdit(row);
|
||||||
...row,
|
|
||||||
plantingMonths: row.plantingMonths.split(','),
|
|
||||||
growthCycleVal: row.growthCycle.split(',').map((m) => {
|
|
||||||
return Number(m.replace(/[^0-9]/gi, ''));
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
infoVisible.value = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowUpdate = (row, index, done, loading) => {
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
console.info('更新');
|
console.info('更新');
|
||||||
// UpdateEntity(row)
|
editAnnual(row)
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// app.$message.success('更新成功!');
|
app.$message.success('更新成功!');
|
||||||
// done();
|
done();
|
||||||
// loadData();
|
loadData();
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
.catch((err) => {
|
||||||
// app.$message.error(err.msg);
|
app.$message.error(err.msg);
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// loading();
|
loading();
|
||||||
// });
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
@ -347,17 +351,17 @@ const rowDel = (row, index, done) => {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.info('删除');
|
console.info('删除');
|
||||||
// delAnnual({ id: row.id })
|
delAnnual({ id: row.id })
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// app.$message.success('删除成功!');
|
app.$message.success('删除成功!');
|
||||||
// done();
|
// done();
|
||||||
// loadData();
|
loadData();
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
.catch((err) => {
|
||||||
// app.$message.error(err.msg);
|
app.$message.error(err.msg);
|
||||||
// });
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
@ -387,70 +391,12 @@ const onExport = () => {
|
|||||||
|
|
||||||
const doExam = (row) => {
|
const doExam = (row) => {
|
||||||
examVisible.value = true;
|
examVisible.value = true;
|
||||||
infoData = reactive({
|
infoData.id = row.id || '';
|
||||||
...row,
|
|
||||||
plantingMonths: row.plantingMonths.split(','),
|
|
||||||
growthCycleVal: row.growthCycle.split(',').map((m) => {
|
|
||||||
return Number(m.replace(/[^0-9]/gi, ''));
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const doDetail = (row) => {
|
const doDetail = (row) => {
|
||||||
detailVisible.value = true;
|
beforeMsg(row);
|
||||||
currentRow = reactive({ ...row });
|
crudRef.value.rowView(row);
|
||||||
};
|
|
||||||
const subMitInfo = (formEl) => {
|
|
||||||
if (!formEl) return;
|
|
||||||
formEl.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
let parmer = {
|
|
||||||
...infoData,
|
|
||||||
plantingMonths: infoData.plantingMonths.toString(),
|
|
||||||
growthCycle: infoData.growthCycleVal[0] + '周' + ',' + infoData.growthCycleVal[1] + '周',
|
|
||||||
};
|
|
||||||
|
|
||||||
parmer.growthCycleVal && delete parmer.growthCycleVal;
|
|
||||||
if (parmer.id) {
|
|
||||||
editAnnual(parmer)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
app.$message.success('编辑成功!');
|
|
||||||
loadData();
|
|
||||||
infoHide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
app.$message.error(err.msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
} else {
|
|
||||||
saveAnnual(parmer)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
app.$message.success('添加成功!');
|
|
||||||
loadData();
|
|
||||||
infoHide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
app.$message.error(err.msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('error submit!');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const infoCancel = () => {
|
|
||||||
infoHide();
|
|
||||||
};
|
|
||||||
|
|
||||||
const infoHide = () => {
|
|
||||||
infoRef.value && infoRef.value.resetFields();
|
|
||||||
infoVisible.value = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const examCancel = () => {
|
const examCancel = () => {
|
||||||
@ -491,8 +437,4 @@ const toDoexam = (id, status, tips) => {
|
|||||||
const examHide = () => {
|
const examHide = () => {
|
||||||
examVisible.value = false;
|
examVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const toBack = () => {
|
|
||||||
detailVisible.value = false;
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -341,7 +341,7 @@ const stageInfoRules = reactive({
|
|||||||
|
|
||||||
// 加载
|
// 加载
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
state.loading = true;
|
// state.loading = true;
|
||||||
// getOperationRecord(state.query)
|
// getOperationRecord(state.query)
|
||||||
// .then((res) => {
|
// .then((res) => {
|
||||||
// if (res.code === 200) {
|
// if (res.code === 200) {
|
||||||
@ -427,7 +427,7 @@ const onExport = () => {
|
|||||||
app.$message.error('当前暂时没有可供导出的数据!');
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.loading = true;
|
// state.loading = true;
|
||||||
const fileName = '土地巡查明细表';
|
const fileName = '土地巡查明细表';
|
||||||
// exportOperationRecord(state.query)
|
// exportOperationRecord(state.query)
|
||||||
// .then((res) => {
|
// .then((res) => {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
@current-change="currentChange"
|
@current-change="currentChange"
|
||||||
@size-change="sizeChange"
|
@size-change="sizeChange"
|
||||||
@row-save="rowSave"
|
@row-save="rowSave"
|
||||||
|
@row-update="rowUpdate"
|
||||||
>
|
>
|
||||||
<template #menu-left>
|
<template #menu-left>
|
||||||
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
@ -74,15 +75,7 @@ import { CRUD_OPTIONS } from '@/config';
|
|||||||
import { isEmpty, downloadFile } from '@/utils';
|
import { isEmpty, downloadFile } from '@/utils';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
import { compact } from 'lodash';
|
import { compact } from 'lodash';
|
||||||
import {
|
import { getlandInspection, savelandInspection, editlandInspection, exportOperationRecord, getAddrCropByLand } from '@/apis/land';
|
||||||
getOperationRecord,
|
|
||||||
saveOperationRecord,
|
|
||||||
editOperationRecord,
|
|
||||||
delOperationRecord,
|
|
||||||
exportOperationRecord,
|
|
||||||
getAddrCropByLand,
|
|
||||||
importOperationRecord,
|
|
||||||
} from '@/apis/land';
|
|
||||||
|
|
||||||
const { VITE_APP_BASE_API } = import.meta.env;
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
@ -115,6 +108,9 @@ const state = reactive({
|
|||||||
query: {
|
query: {
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
|
taskCode: '',
|
||||||
|
taskName: '',
|
||||||
|
taskMembers: '',
|
||||||
},
|
},
|
||||||
form: {},
|
form: {},
|
||||||
selection: [],
|
selection: [],
|
||||||
@ -124,8 +120,9 @@ const state = reactive({
|
|||||||
column: [
|
column: [
|
||||||
{
|
{
|
||||||
label: '任务编号',
|
label: '任务编号',
|
||||||
prop: 'executor',
|
prop: 'taskCode',
|
||||||
fixed: true,
|
fixed: true,
|
||||||
|
search: true,
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -134,7 +131,8 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '任务名称',
|
label: '任务名称',
|
||||||
prop: 'address',
|
prop: 'taskName',
|
||||||
|
search: true,
|
||||||
width: '240px',
|
width: '240px',
|
||||||
showOverflowTooltip: true,
|
showOverflowTooltip: true,
|
||||||
rules: {
|
rules: {
|
||||||
@ -145,7 +143,8 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '任务成员',
|
label: '任务成员',
|
||||||
prop: 'crop',
|
search: true,
|
||||||
|
prop: 'taskMembers',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
@ -155,7 +154,7 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '巡查类型',
|
label: '巡查类型',
|
||||||
prop: 'inputName',
|
prop: 'inspectionType',
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -164,7 +163,7 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '巡查对象',
|
label: '巡查对象',
|
||||||
prop: 'inputBrand',
|
prop: 'inspectionTarget',
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -173,7 +172,7 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '注意事项',
|
label: '注意事项',
|
||||||
prop: 'inputBrand',
|
prop: 'notes',
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
rows: 1,
|
rows: 1,
|
||||||
rules: {
|
rules: {
|
||||||
@ -218,26 +217,26 @@ const infoRules = reactive({
|
|||||||
|
|
||||||
// 加载
|
// 加载
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
// state.loading = true;
|
state.loading = true;
|
||||||
// getOperationRecord(state.query)
|
getlandInspection(state.query)
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// const { current, size, total, records } = res.data;
|
const { current, size, total, records } = res.data;
|
||||||
// state.data = records;
|
state.data = records;
|
||||||
// state.pageData = {
|
state.pageData = {
|
||||||
// currentPage: current || 1,
|
currentPage: current || 1,
|
||||||
// pageSize: size || 10,
|
pageSize: size || 10,
|
||||||
// total: total,
|
total: total,
|
||||||
// };
|
};
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
.catch((err) => {
|
||||||
// app.$message.error(err.msg);
|
app.$message.error(err.msg);
|
||||||
// state.data = [];
|
state.data = [];
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// state.loading = false;
|
state.loading = false;
|
||||||
// });
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
loadData();
|
loadData();
|
||||||
@ -276,7 +275,7 @@ const selectionChange = (rows) => {
|
|||||||
// 新增
|
// 新增
|
||||||
const rowSave = (row, done, loading) => {
|
const rowSave = (row, done, loading) => {
|
||||||
// console.info('新增', row);
|
// console.info('新增', row);
|
||||||
saveOperationRecord(row)
|
savelandInspection(row)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
app.$message.success('添加成功!');
|
app.$message.success('添加成功!');
|
||||||
@ -295,7 +294,26 @@ const rowSave = (row, done, loading) => {
|
|||||||
// 编辑
|
// 编辑
|
||||||
const doEnroll = (row) => {
|
const doEnroll = (row) => {
|
||||||
console.info('doEnroll', row);
|
console.info('doEnroll', row);
|
||||||
infoVisible.value = true;
|
// infoVisible.value = true;
|
||||||
|
crudRef.value.rowEdit(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
|
console.info('更新');
|
||||||
|
editlandInspection(row)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('更新成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 导出
|
// 导出
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
v-model="state.form"
|
v-model="state.form"
|
||||||
v-model:search="state.query"
|
v-model:search="state.query"
|
||||||
v-model:page="state.pageData"
|
v-model:page="state.pageData"
|
||||||
:table-loading="state.loading"
|
|
||||||
:data="state.data"
|
:data="state.data"
|
||||||
:option="state.options"
|
:option="state.options"
|
||||||
@refresh-change="refreshChange"
|
@refresh-change="refreshChange"
|
||||||
@ -31,43 +30,9 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #menu="scope">
|
<template #planDate-form="{ row, column, value }">
|
||||||
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
|
||||||
</template>
|
|
||||||
</avue-crud>
|
|
||||||
|
|
||||||
<el-dialog v-model="infoVisible" title="种植规划" width="800" center>
|
|
||||||
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<!--<el-col :span="12">
|
|
||||||
<el-form-item label="地块:" prop="landId">
|
|
||||||
<CustomSelect
|
|
||||||
v-model:value="infoData.landId"
|
|
||||||
:set="{
|
|
||||||
url: 'land-resource/landManage/page',
|
|
||||||
props: {
|
|
||||||
value: 'id',
|
|
||||||
label: 'landName',
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
placeholder="请选择地块"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="面积" prop="gridName">
|
|
||||||
<el-input v-model="infoData.gridName" placeholder="请输入面积" style="width: 240px"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col> -->
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="种植产物" prop="crop">
|
|
||||||
<el-input v-model="infoData.crop" placeholder="请输入种植产物" style="width: 240px"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="种植日期" prop="planDate">
|
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="infoData.planDate"
|
v-model="infoFirst.planDate"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="请选择种植日期"
|
placeholder="请选择种植日期"
|
||||||
:disabled-date="disabledDate"
|
:disabled-date="disabledDate"
|
||||||
@ -75,41 +40,21 @@
|
|||||||
value-format="YYYY/MM/DD"
|
value-format="YYYY/MM/DD"
|
||||||
:size="size"
|
:size="size"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="种子供应商" prop="seedSupplier">
|
|
||||||
<el-input v-model="infoData.seedSupplier" placeholder="请输入种子供应商" style="width: 240px"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="年度计划" prop="planId">
|
|
||||||
<CustomSelect
|
|
||||||
v-model:value="infoData.planId"
|
|
||||||
:set="{
|
|
||||||
url: 'land-resource/annualManage/page',
|
|
||||||
props: {
|
|
||||||
value: 'id',
|
|
||||||
label: 'planName',
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
placeholder="请选择种植计划"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="infoCancel">取消</el-button>
|
|
||||||
<el-button type="primary" @click="subMitInfo(infoRef)"> 确认 </el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
|
||||||
|
<template #planId="{ row }">
|
||||||
|
{{ row.planName }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
|
||||||
<el-text class="mx-1" size="large">种植阶段详情</el-text>
|
<el-text class="mx-1" size="large">种植阶段详情</el-text>
|
||||||
<div style="margin-top: 16px">
|
<div style="margin-top: 16px">
|
||||||
<avue-crud
|
<avue-crud
|
||||||
ref="crudRef"
|
ref="stateCrudRef"
|
||||||
v-model="stageState.form"
|
v-model="stageState.form"
|
||||||
v-model:search="stageState.query"
|
v-model:search="stageState.query"
|
||||||
v-model:page="stageState.pageData"
|
v-model:page="stageState.pageData"
|
||||||
@ -123,6 +68,8 @@
|
|||||||
@current-change="stageCurrent"
|
@current-change="stageCurrent"
|
||||||
@size-change="stageSize"
|
@size-change="stageSize"
|
||||||
@row-del="stageRowDel"
|
@row-del="stageRowDel"
|
||||||
|
@row-save="stageRowSave"
|
||||||
|
@row-update="stageRowUpdate"
|
||||||
>
|
>
|
||||||
<template #menu-left>
|
<template #menu-left>
|
||||||
<el-button type="primary" icon="Plus" @click="onStateAdd">新增</el-button>
|
<el-button type="primary" icon="Plus" @click="onStateAdd">新增</el-button>
|
||||||
@ -137,7 +84,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
|
|
||||||
<el-dialog v-model="stageInfoVisible" title="种植阶段" width="800" center>
|
<!-- <el-dialog v-model="stageInfoVisible" title="种植阶段" width="800" center>
|
||||||
<el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules">
|
<el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -173,10 +120,6 @@
|
|||||||
:set="{
|
:set="{
|
||||||
url: '',
|
url: '',
|
||||||
options: workOptions,
|
options: workOptions,
|
||||||
props: {
|
|
||||||
value: 'id',
|
|
||||||
label: 'planName',
|
|
||||||
},
|
|
||||||
}"
|
}"
|
||||||
placeholder="请选择作业计划"
|
placeholder="请选择作业计划"
|
||||||
/>
|
/>
|
||||||
@ -190,7 +133,7 @@
|
|||||||
<el-button type="primary" @click="subMitStateInfo(stageInfoRef)"> 确认 </el-button>
|
<el-button type="primary" @click="subMitStateInfo(stageInfoRef)"> 确认 </el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -219,12 +162,18 @@ const { VITE_APP_BASE_API } = import.meta.env;
|
|||||||
const app = useApp();
|
const app = useApp();
|
||||||
const UserStore = useUserStore();
|
const UserStore = useUserStore();
|
||||||
const crudRef = ref(null);
|
const crudRef = ref(null);
|
||||||
|
const stateCrudRef = ref(null);
|
||||||
const stageOptions = reactive([
|
const stageOptions = reactive([
|
||||||
{ value: '0', label: '苗期' },
|
{ value: '0', label: '苗期' },
|
||||||
{ value: '1', label: '花果期' },
|
{ value: '1', label: '花果期' },
|
||||||
{ value: '2', label: '采收期' },
|
{ value: '2', label: '采收期' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const workOptions = reactive([
|
||||||
|
{ label: '作业计划1', value: '000001' },
|
||||||
|
{ label: '作业计划2', value: '000002' },
|
||||||
|
]);
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
query: {
|
query: {
|
||||||
@ -233,25 +182,29 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
form: {},
|
form: {},
|
||||||
selection: [],
|
selection: [],
|
||||||
tableClumn: [
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtn: false,
|
||||||
|
rowKey: 'landId',
|
||||||
|
column: [
|
||||||
{
|
{
|
||||||
label: '地块名',
|
label: '地块名',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
prop: 'landName',
|
prop: 'landName',
|
||||||
disabled: true,
|
|
||||||
search: true,
|
search: true,
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ label: '地址', prop: 'address', width: '240px', showOverflowTooltip: true, disabled: true },
|
{ label: '地址', prop: 'address', width: '240px', showOverflowTooltip: true, addDisplay: false, editDisplay: false },
|
||||||
{
|
{
|
||||||
label: '种植产物',
|
label: '种植产物',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
prop: 'crop',
|
prop: 'crop',
|
||||||
disabled: true,
|
|
||||||
search: true,
|
search: true,
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
@ -263,8 +216,9 @@ const state = reactive({
|
|||||||
label: '产权人',
|
label: '产权人',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
prop: 'owner',
|
prop: 'owner',
|
||||||
disabled: true,
|
|
||||||
search: true,
|
search: true,
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -274,48 +228,70 @@ const state = reactive({
|
|||||||
{
|
{
|
||||||
label: '农用地分类',
|
label: '农用地分类',
|
||||||
prop: 'landClassificationType',
|
prop: 'landClassificationType',
|
||||||
disabled: true,
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '面积',
|
label: '面积',
|
||||||
prop: 'area',
|
prop: 'area',
|
||||||
disabled: true,
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
},
|
},
|
||||||
{ label: '坐标', prop: 'coordinate', disabled: true, width: '120px', showOverflowTooltip: true },
|
{ label: '坐标', prop: 'coordinate', width: '120px', showOverflowTooltip: true, addDisplay: false, editDisplay: false },
|
||||||
{
|
{
|
||||||
label: '土壤类型',
|
label: '土壤类型',
|
||||||
prop: 'soilType',
|
prop: 'soilType',
|
||||||
disabled: true,
|
addDisplay: false,
|
||||||
},
|
editDisplay: false,
|
||||||
{
|
|
||||||
label: '种植产物',
|
|
||||||
prop: 'crop',
|
|
||||||
rules: {
|
|
||||||
required: true,
|
|
||||||
message: '请输入',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '种子供应商',
|
label: '种子供应商',
|
||||||
prop: 'seedSupplier',
|
prop: 'seedSupplier',
|
||||||
disabled: true,
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '年度计划',
|
label: '年度计划',
|
||||||
prop: 'planName',
|
prop: 'planId',
|
||||||
disabled: true,
|
type: 'select',
|
||||||
|
remote: false,
|
||||||
|
props: {
|
||||||
|
label: 'planName',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
dicHeaders: {
|
||||||
|
authorization: UserStore.token,
|
||||||
|
},
|
||||||
|
dicUrl: `${VITE_APP_BASE_API}/land-resource/annualManage/page`,
|
||||||
|
dicFormatter: (res) => res.data.records ?? [],
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '种植日期',
|
label: '种植日期',
|
||||||
prop: 'planDate',
|
prop: 'planDate',
|
||||||
disabled: true,
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (!infoFirst.value.planDate || infoFirst.value.planDate == '') {
|
||||||
|
callback(new Error('请选择'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
options: {
|
|
||||||
...CRUD_OPTIONS,
|
|
||||||
addBtn: false,
|
|
||||||
column: [],
|
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
name: '编辑',
|
name: '编辑',
|
||||||
@ -363,9 +339,20 @@ const stageState = reactive({
|
|||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ label: '作业计划', prop: 'area', disabled: true },
|
{
|
||||||
{ label: '作业时间', prop: 'coordinate', disabled: true },
|
label: '作业计划',
|
||||||
{ label: '结束时间', prop: 'createTime', disabled: true },
|
prop: 'workId',
|
||||||
|
type: 'select',
|
||||||
|
search: true,
|
||||||
|
dicData: workOptions,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: '作业时间', prop: 'coordinate', addDisplay: false, editDisplay: false },
|
||||||
|
{ label: '结束时间', prop: 'createTime', addDisplay: false, editDisplay: false },
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
@ -401,14 +388,9 @@ const landClassificationType = reactive({
|
|||||||
7: '农村宅基地',
|
7: '农村宅基地',
|
||||||
});
|
});
|
||||||
|
|
||||||
const infoVisible = ref(false);
|
let infoFirst = ref({
|
||||||
const infoRef = ref();
|
|
||||||
let infoData = reactive({
|
|
||||||
landId: [], //土地主键id
|
|
||||||
planId: '', //种植规划主键id
|
planId: '', //种植规划主键id
|
||||||
crop: '', //种植产物
|
planDate: '',
|
||||||
seedSupplier: '', //供应商
|
|
||||||
planDate: '', //种植时间
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const infoRules = reactive({
|
const infoRules = reactive({
|
||||||
@ -423,10 +405,6 @@ const stageObj = reactive({
|
|||||||
1: '花果期',
|
1: '花果期',
|
||||||
2: '采收期',
|
2: '采收期',
|
||||||
});
|
});
|
||||||
const workOptions = reactive([
|
|
||||||
{ planName: '作业计划1', id: '000001' },
|
|
||||||
{ planName: '作业计划2', id: '000002' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
let stageInfoVisible = ref(false);
|
let stageInfoVisible = ref(false);
|
||||||
const stageInfoRef = ref();
|
const stageInfoRef = ref();
|
||||||
@ -447,7 +425,6 @@ const stageInfoRules = reactive({
|
|||||||
// 加载
|
// 加载
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
state.options.column = JSON.parse(JSON.stringify(state.tableClumn));
|
|
||||||
getPlanList(state.query)
|
getPlanList(state.query)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
@ -500,64 +477,63 @@ const refreshChange = () => {
|
|||||||
// 选择
|
// 选择
|
||||||
const selectionChange = (rows) => {
|
const selectionChange = (rows) => {
|
||||||
state.selection = rows;
|
state.selection = rows;
|
||||||
|
console.info('selectionChange', state.selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCity = (row) => {
|
const handleIds = () => {
|
||||||
if (!isEmpty(row.cities)) {
|
let datalist = state.selection.map((m) => {
|
||||||
row.provinceCode = row?.cities[0] ?? null;
|
return { landId: m.landId, landName: m.landName };
|
||||||
row.cityCode = row?.cities[1] ?? null;
|
});
|
||||||
row.gridAreaCode = row?.cities[2] ?? null;
|
|
||||||
row.townCode = row?.cities[3] ?? null;
|
|
||||||
row.village = row?.cities[3] ?? null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
let selectIdlist = uniqueObjects(datalist, 'landId');
|
||||||
|
let selectIdsVal = selectIdlist.map((n) => {
|
||||||
|
return n.landId;
|
||||||
|
});
|
||||||
|
|
||||||
|
return selectIdsVal.toString() || '';
|
||||||
|
};
|
||||||
// 新增
|
// 新增
|
||||||
const rowSave = (row, done, loading) => {
|
const rowSave = (row, done, loading) => {
|
||||||
state.options.column = JSON.parse(JSON.stringify(state.tableClumn));
|
console.info('新增', infoFirst.value);
|
||||||
console.info('新增');
|
row.planDate = infoFirst.value.planDate || '';
|
||||||
// savePlan(row)
|
row.landId = handleIds();
|
||||||
// .then((res) => {
|
savePlan(row)
|
||||||
// if (res.code === 200) {
|
.then((res) => {
|
||||||
// app.$message.success('添加成功!');
|
if (res.code === 200) {
|
||||||
// done();
|
app.$message.success('添加成功!');
|
||||||
// loadData();
|
done();
|
||||||
// }
|
loadData();
|
||||||
// })
|
}
|
||||||
// .catch((err) => {
|
})
|
||||||
// app.$message.error(err.msg);
|
.catch((err) => {
|
||||||
// })
|
app.$message.error(err.msg);
|
||||||
// .finally(() => {
|
})
|
||||||
// loading();
|
.finally(() => {
|
||||||
// });
|
loading();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const rowEdit = (row) => {
|
const rowEdit = (row) => {
|
||||||
infoVisible.value = true;
|
console.info('编辑', row);
|
||||||
infoData = reactive({
|
crudRef.value.rowEdit(row);
|
||||||
...row,
|
|
||||||
});
|
|
||||||
// console.info('编辑');
|
|
||||||
// row.cities = compact([row.provinceCode, row.cityCode, row.gridAreaCode ?? '', row.townCode ?? '', row.village ?? '']);
|
|
||||||
// crudRef.value.rowEdit(row);
|
|
||||||
};
|
};
|
||||||
const rowUpdate = (row, index, done, loading) => {
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
console.info('更新');
|
console.info('更新');
|
||||||
// editAlan(row)
|
editAlan(row)
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// app.$message.success('更新成功!');
|
app.$message.success('更新成功!');
|
||||||
// done();
|
done();
|
||||||
// loadData();
|
loadData();
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
.catch((err) => {
|
||||||
// app.$message.error(err.msg);
|
app.$message.error(err.msg);
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// loading();
|
loading();
|
||||||
// });
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
@ -575,7 +551,7 @@ const rowDel = (row, index, done) => {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
app.$message.success('删除成功!');
|
app.$message.success('删除成功!');
|
||||||
done();
|
// done();
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -612,70 +588,12 @@ const onExport = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onAdd = () => {
|
const onAdd = () => {
|
||||||
infoVisible.value = true;
|
infoFirst.value.planDate = infoFirst.value.planId = '';
|
||||||
};
|
let ids = handleIds();
|
||||||
const subMitInfo = (formEl) => {
|
if (ids == '') {
|
||||||
if (!formEl) return;
|
return app.$message.error('先选择土地!');
|
||||||
formEl.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
let parmer = {
|
|
||||||
...infoData,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!parmer.id) {
|
|
||||||
let datalist = state.selection.map((m) => {
|
|
||||||
return { landId: m.landId, landName: m.landName };
|
|
||||||
});
|
|
||||||
|
|
||||||
let selectIdlist = uniqueObjects(datalist, 'landId');
|
|
||||||
let selectIdsVal = selectIdlist.map((n) => {
|
|
||||||
return n.landId;
|
|
||||||
});
|
|
||||||
|
|
||||||
parmer.landId = selectIdsVal.toString() || '';
|
|
||||||
}
|
}
|
||||||
|
crudRef.value.rowAdd();
|
||||||
console.info('新增种植计划', parmer);
|
|
||||||
|
|
||||||
if (parmer.id) {
|
|
||||||
editAlan(parmer)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
app.$message.success('编辑成功!');
|
|
||||||
loadData();
|
|
||||||
infoHide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
app.$message.error(err.msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
} else {
|
|
||||||
savePlan(parmer)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
loadData();
|
|
||||||
infoHide();
|
|
||||||
app.$message.success('添加成功!');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
app.$message.error(err.msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('error submit!');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const infoCancel = () => {
|
|
||||||
infoHide();
|
|
||||||
};
|
|
||||||
|
|
||||||
const infoHide = () => {
|
|
||||||
infoVisible.value = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function uniqueObjects(arr, key) {
|
function uniqueObjects(arr, key) {
|
||||||
@ -769,61 +687,7 @@ const stageRowDel = (row, index, done) => {
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
const stageRowEdit = (row) => {
|
const stageRowEdit = (row) => {
|
||||||
stageInfoData.landName = row.landName ? row.landName : state.currentRow.landName || '';
|
stateCrudRef.value.rowEdit(row);
|
||||||
stageInfoData.landId = row.landId ? row.landId : state.currentRow.landId || '';
|
|
||||||
stageInfoData.crop = row.crop ? row.crop : state.currentRow.crop || '';
|
|
||||||
stageInfoData.stage = row.stage.toString() || '0';
|
|
||||||
stageInfoVisible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const stageinfoHide = () => {
|
|
||||||
stageInfoRef.value && stageInfoRef.value.resetFields();
|
|
||||||
stageInfoVisible.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const subMitStateInfo = (formEl) => {
|
|
||||||
if (!formEl) return;
|
|
||||||
formEl.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
let parmer = {
|
|
||||||
planId: state.currentRow.id || '', //种植规划主键id
|
|
||||||
stage: stageInfoData.stage || 0, //种植阶段:0->苗期,1>花果期,2->采收期
|
|
||||||
workId: stageInfoData.workId || '',
|
|
||||||
};
|
|
||||||
|
|
||||||
console.info('新增种植阶段', parmer);
|
|
||||||
|
|
||||||
if (parmer.id) {
|
|
||||||
editPlantingStage(parmer)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
app.$message.success('编辑成功!');
|
|
||||||
getStageList();
|
|
||||||
stageinfoHide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
app.$message.error(err.msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
} else {
|
|
||||||
savePlantingStage(parmer)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
getStageList();
|
|
||||||
stageinfoHide();
|
|
||||||
app.$message.success('添加成功!');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
app.$message.error(err.msg);
|
|
||||||
})
|
|
||||||
.finally(() => {});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('error submit!');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onStateAdd = () => {
|
const onStateAdd = () => {
|
||||||
@ -831,10 +695,43 @@ const onStateAdd = () => {
|
|||||||
app.$message.error('请选择种植规划');
|
app.$message.error('请选择种植规划');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
stateCrudRef.value.rowAdd();
|
||||||
|
};
|
||||||
|
|
||||||
console.info('onStateAdd', state.currentRow);
|
const stageRowSave = (row, done, loading) => {
|
||||||
stageInfoData.landName = state.currentRow.landName || '';
|
row.planId = state.currentRow.planId;
|
||||||
stageInfoData.crop = state.currentRow.crop || '';
|
console.info('stageRowSave', row);
|
||||||
stageInfoVisible.value = true;
|
savePlantingStage({ ...row })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
done();
|
||||||
|
getStageList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageRowUpdate = (row, index, done, loading) => {
|
||||||
|
console.info('stageRowUpdate');
|
||||||
|
editPlantingStage(row)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('更新成功!');
|
||||||
|
done();
|
||||||
|
getStageList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user