Merge branch 'dev' of http://192.168.18.88:8077/sznyb/daimp-front into dev
This commit is contained in:
commit
95bb9ab404
@ -132,6 +132,57 @@ export function delLand(id) {
|
|||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//作业记录相关
|
||||||
|
export function getOperationRecord(params = {}) {
|
||||||
|
return request('land-resource/operationRecord/page', {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function saveOperationRecord(data) {
|
||||||
|
return request('land-resource/operationRecord/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editOperationRecord(data = {}) {
|
||||||
|
return request('land-resource/operationRecord/update', {
|
||||||
|
method: 'PUT',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function delOperationRecord(id) {
|
||||||
|
return request('land-resource/operationRecord/delete/' + id, {
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exportOperationRecord(params = {}) {
|
||||||
|
return request('/land-resource/operationRecord/export', {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
responseType: 'blob',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function importOperationRecord(data = {}) {
|
||||||
|
return request('/land-resource/operationRecord/import', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//通过土地获取产物和位置
|
||||||
|
export function getAddrCropByLand(landId) {
|
||||||
|
return request('land-resource/operationRecord/workArea/' + landId, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
}
|
||||||
/* 导入土地 */
|
/* 导入土地 */
|
||||||
export function importLands(data) {
|
export function importLands(data) {
|
||||||
return request('land-resource/landManage/import', {
|
return request('land-resource/landManage/import', {
|
||||||
|
@ -296,16 +296,6 @@ const selectionChange = (rows) => {
|
|||||||
state.selection = rows;
|
state.selection = rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCity = (row) => {
|
|
||||||
if (!isEmpty(row.cities)) {
|
|
||||||
row.provinceCode = row?.cities[0] ?? null;
|
|
||||||
row.cityCode = row?.cities[1] ?? null;
|
|
||||||
row.gridAreaCode = row?.cities[2] ?? null;
|
|
||||||
row.townCode = row?.cities[3] ?? null;
|
|
||||||
row.village = row?.cities[3] ?? null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onAdd = () => {
|
const onAdd = () => {
|
||||||
infoVisible.value = true;
|
infoVisible.value = true;
|
||||||
};
|
};
|
||||||
|
@ -1,65 +1,633 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="custom-page">
|
||||||
|
<avue-crud
|
||||||
|
ref="crudRef"
|
||||||
|
v-model="state.form"
|
||||||
|
v-model:search="state.query"
|
||||||
|
v-model:page="state.pageData"
|
||||||
|
:table-loading="state.loading"
|
||||||
|
:data="state.data"
|
||||||
|
:option="state.options"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@search-reset="searchChange"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@row-save="rowSave"
|
||||||
|
@row-update="rowUpdate"
|
||||||
|
@row-click="rowClick"
|
||||||
|
>
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #status="{ row }">
|
||||||
|
{{ !row.status ? '是' : '否' }}
|
||||||
|
</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>
|
||||||
|
<div style="margin-top: 16px">
|
||||||
|
<avue-crud
|
||||||
|
ref="crudRef"
|
||||||
|
v-model="stageState.form"
|
||||||
|
v-model:search="stageState.query"
|
||||||
|
v-model:page="stageState.pageData"
|
||||||
|
:table-loading="stageState.loading"
|
||||||
|
:data="stageState.data"
|
||||||
|
:option="stageState.options"
|
||||||
|
@refresh-change="stageRefresh"
|
||||||
|
@search-reset="stageSearch"
|
||||||
|
@search-change="stageSearch"
|
||||||
|
@selection-change="stageSelection"
|
||||||
|
@current-change="stageCurrent"
|
||||||
|
@size-change="stageSize"
|
||||||
|
@row-del="stageRowDel"
|
||||||
|
>
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="primary" icon="Plus" @click="onStateAdd">新增</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #stage="{ row }">
|
||||||
|
<el-tag size="small">{{ stageObj[row.stage] }}</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="stageState.options.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
|
||||||
|
<el-dialog v-model="stageInfoVisible" title="种植阶段" width="800" center>
|
||||||
|
<el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="6">
|
<el-col :span="12">
|
||||||
<el-tree style="max-width: 600px" :data="typeTree" :props="{ children: 'children', label: 'label' }" @node-click="handleNodeClick" />
|
<el-form-item label="地块:" prop="landName">
|
||||||
|
<el-input v-model="stageInfoData.landName" placeholder="请输入地块" style="width: 240px" :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种植产物" prop="crop">
|
||||||
|
<el-input v-model="stageInfoData.crop" placeholder="请输入种植产物" style="width: 240px" :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种植阶段" prop="stage">
|
||||||
|
<CustomSelect
|
||||||
|
v-model:value="stageInfoData.stage"
|
||||||
|
:set="{
|
||||||
|
url: '',
|
||||||
|
options: stageOptions,
|
||||||
|
props: {
|
||||||
|
value: 'value',
|
||||||
|
label: 'label',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
placeholder="请选择种植阶段"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="作业计划" prop="workId">
|
||||||
|
<CustomSelect
|
||||||
|
v-model:value="stageInfoData.workId"
|
||||||
|
:set="{
|
||||||
|
url: '',
|
||||||
|
options: workOptions,
|
||||||
|
props: {
|
||||||
|
value: 'id',
|
||||||
|
label: 'planName',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
placeholder="请选择作业计划"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="18"></el-col>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="stageCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="subMitStateInfo(stageInfoRef)"> 确认 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script setup>
|
||||||
import { ref, reactive } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { isEmpty, downloadFile } from '@/utils';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
import { compact } from 'lodash';
|
||||||
|
import {
|
||||||
|
getOperationRecord,
|
||||||
|
saveOperationRecord,
|
||||||
|
editOperationRecord,
|
||||||
|
delOperationRecord,
|
||||||
|
exportOperationRecord,
|
||||||
|
getAddrCropByLand,
|
||||||
|
importOperationRecord,
|
||||||
|
} from '@/apis/land';
|
||||||
|
|
||||||
/* --------------- data --------------- */
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
// #region
|
const app = useApp();
|
||||||
|
const UserStore = useUserStore();
|
||||||
|
const crudRef = ref(null);
|
||||||
|
const handleLandChange = async (value, form, done) => {
|
||||||
|
if (!value || !value.item || !value.item.id) return; // 如果没有选择任何地块,则直接返回
|
||||||
|
let val = {};
|
||||||
|
getAddrCropByLand(value.item?.id || '')
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
val = res.data || {};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
val = {};
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
state.form.crop = val?.crop || value.item?.crop;
|
||||||
|
state.form.address = val?.county + val?.town + val?.village || value.item?.address;
|
||||||
|
};
|
||||||
|
|
||||||
let typeTree = reactive([
|
const jobTypeOptions = reactive([
|
||||||
{
|
{ label: '施肥', value: '0' },
|
||||||
label: 'Level one 1',
|
{ label: '杀虫', value: '1' },
|
||||||
children: [
|
{ label: '灌溉', value: '2' },
|
||||||
{
|
|
||||||
label: 'Level two 1-1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 1-1-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Level one 2',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level two 2-1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 2-1-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Level two 2-2',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 2-2-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// #endregion
|
const stageOptions = reactive([
|
||||||
|
{ value: '0', label: '苗期' },
|
||||||
|
{ value: '1', label: '花果期' },
|
||||||
|
{ value: '2', label: '采收期' },
|
||||||
|
]);
|
||||||
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtnText: '新增',
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '编号',
|
||||||
|
prop: 'executor',
|
||||||
|
fixed: true,
|
||||||
|
addDisplay: false,
|
||||||
|
editDisabled: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植产物',
|
||||||
|
prop: 'crop',
|
||||||
|
width: '240px',
|
||||||
|
editDisabled: true,
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植时间',
|
||||||
|
prop: 'operationDate',
|
||||||
|
type: 'date',
|
||||||
|
format: 'YYYY-MM-DD',
|
||||||
|
valueFormat: 'YYYY-MM-DD',
|
||||||
|
width: 200,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择作业日期',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '状态',
|
||||||
|
prop: 'status',
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
searchColumn: [],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => rowEdit(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
const infoVisible = ref(false);
|
||||||
|
const infoRef = ref();
|
||||||
|
const infoData = reactive({
|
||||||
|
num: '',
|
||||||
|
name: '',
|
||||||
|
member: [],
|
||||||
|
type: '',
|
||||||
|
mark: '',
|
||||||
|
target: '',
|
||||||
|
});
|
||||||
|
|
||||||
/* --------------- methods --------------- */
|
const infoRules = reactive({
|
||||||
const handleNodeClick = (data) => {
|
num: [{ required: true, message: '请选择是否违法', trigger: 'blur' }],
|
||||||
console.log(data);
|
mark: [{ required: true, message: '请输入巡查情况', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
const stageState = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtn: false,
|
||||||
|
selection: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '所属阶段',
|
||||||
|
prop: 'stage',
|
||||||
|
type: 'select',
|
||||||
|
search: true,
|
||||||
|
dicData: stageOptions,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: '作业计划', prop: 'area', disabled: true },
|
||||||
|
{ label: '作业时间', prop: 'coordinate', disabled: true },
|
||||||
|
{ label: '结束时间', prop: 'createTime', disabled: true },
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => stageRowEdit(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => stageRowDel(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
const stageObj = reactive({
|
||||||
|
0: '苗期',
|
||||||
|
1: '花果期',
|
||||||
|
2: '采收期',
|
||||||
|
});
|
||||||
|
const workOptions = reactive([
|
||||||
|
{ planName: '作业计划1', id: '000001' },
|
||||||
|
{ planName: '作业计划2', id: '000002' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
let stageInfoVisible = ref(false);
|
||||||
|
const stageInfoRef = ref();
|
||||||
|
let stageInfoData = reactive({
|
||||||
|
landId: '', //土地主键id
|
||||||
|
planId: '', //种植规划主键id
|
||||||
|
crop: '', //种植产物
|
||||||
|
stage: '', //所属阶段
|
||||||
|
workId: '', //作业计划Id
|
||||||
|
landName: '', //地块
|
||||||
|
});
|
||||||
|
|
||||||
|
const stageInfoRules = reactive({
|
||||||
|
stage: [{ required: true, message: '请选择所属阶段', trigger: 'blur' }],
|
||||||
|
workId: [{ required: true, message: '请选择作业计划', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 加载
|
||||||
|
const loadData = () => {
|
||||||
|
state.loading = true;
|
||||||
|
// getOperationRecord(state.query)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// const { current, size, total, records } = res.data;
|
||||||
|
// state.data = records;
|
||||||
|
// state.pageData = {
|
||||||
|
// currentPage: current || 1,
|
||||||
|
// pageSize: size || 10,
|
||||||
|
// total: total,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// state.data = [];
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// state.loading = false;
|
||||||
|
// });
|
||||||
};
|
};
|
||||||
// #region
|
|
||||||
|
|
||||||
// #endregion
|
loadData();
|
||||||
|
|
||||||
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const rowSave = (row, done, loading) => {
|
||||||
|
// console.info('新增', row);
|
||||||
|
saveOperationRecord(row)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const rowEdit = (row) => {
|
||||||
|
console.info('编辑', row);
|
||||||
|
crudRef.value.rowEdit(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
const onExport = () => {
|
||||||
|
if (isEmpty(state.data)) {
|
||||||
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.loading = true;
|
||||||
|
const fileName = '土地巡查明细表';
|
||||||
|
// exportOperationRecord(state.query)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.status === 200) {
|
||||||
|
// downloadFile(res.data, `${fileName}.xlsx`, 'blob');
|
||||||
|
// app.$message.success('导出成功!');
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error('导出失败!');
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// state.loading = false;
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
const subMitInfo = (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
infoHide();
|
||||||
|
console.log('submit!');
|
||||||
|
} else {
|
||||||
|
console.log('error submit!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoCancel = () => {
|
||||||
|
infoHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoHide = () => {
|
||||||
|
infoRef.value && infoRef.value.resetFields();
|
||||||
|
infoVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
|
console.info('更新');
|
||||||
|
// editOperationRecord(row)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// app.$message.success('更新成功!');
|
||||||
|
// done();
|
||||||
|
// loadData();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// loading();
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
//种植阶段相关
|
||||||
|
// 刷新
|
||||||
|
const stageRefresh = () => {
|
||||||
|
// loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowClick = (row) => {
|
||||||
|
state.currentRow = { ...row };
|
||||||
|
console.info('rowClick', state.currentRow);
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
async function getStageList() {
|
||||||
|
// stageState.loading = true;
|
||||||
|
// getPlantingStage({ ...stageState.query, planId: state.currentRow.id })
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// const { current, size, total, records } = res.data;
|
||||||
|
// stageState.data = records || [];
|
||||||
|
// stageState.pageData = {
|
||||||
|
// currentPage: current || 1,
|
||||||
|
// pageSize: size || 10,
|
||||||
|
// total: total,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// stageState.data = [];
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// stageState.loading = false;
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
const stageSearch = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
stageState.query = params;
|
||||||
|
stageState.query.current = 1;
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageSelection = (rows) => {
|
||||||
|
stageState.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageCurrent = (current) => {
|
||||||
|
stageState.query.current = current;
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageSize = (size) => {
|
||||||
|
stageState.query.size = size;
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageRowDel = (row, index, done) => {
|
||||||
|
if (isEmpty(row)) return;
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
console.info('删除');
|
||||||
|
// delPlantingStage({ id: row.id })
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// app.$message.success('删除成功!');
|
||||||
|
// getStageList();
|
||||||
|
// done();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// });
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
const stageRowEdit = (row) => {
|
||||||
|
stageInfoData.landName = row.landName ? row.landName : state.currentRow.landName || '';
|
||||||
|
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 = () => {
|
||||||
|
if (!state.currentRow.id) {
|
||||||
|
app.$message.error('请选择种植产物');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stageInfoData.landName = state.currentRow.landName || '';
|
||||||
|
stageInfoData.crop = state.currentRow.crop || '';
|
||||||
|
stageInfoVisible.value = true;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<CustomCard>
|
<CustomCard>
|
||||||
|
<div>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<el-tree style="max-width: 600px" :data="typeTree" :props="{ children: 'children', label: 'label' }" @node-click="handleNodeClick" />
|
<el-tree style="max-width: 600px" :data="typeTree" :props="{ children: 'children', label: 'label' }" @node-click="handleNodeClick" />
|
||||||
@ -19,8 +20,6 @@
|
|||||||
@selection-change="selectionChange"
|
@selection-change="selectionChange"
|
||||||
@current-change="currentChange"
|
@current-change="currentChange"
|
||||||
@size-change="sizeChange"
|
@size-change="sizeChange"
|
||||||
@row-save="rowSave"
|
|
||||||
@row-update="rowUpdate"
|
|
||||||
@row-del="rowDel"
|
@row-del="rowDel"
|
||||||
>
|
>
|
||||||
<template #menu-left>
|
<template #menu-left>
|
||||||
@ -34,13 +33,52 @@
|
|||||||
</avue-crud>
|
</avue-crud>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<el-dialog v-model="infoVisible" title="新增土地分类" width="800" center>
|
||||||
|
<div>
|
||||||
|
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col v-if="infoData.classifyId == ''" :span="12">
|
||||||
|
<el-form-item label="土地分类:" prop="classifyName">
|
||||||
|
<el-input v-model="infoData.classifyName" placeholder="请输入" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col v-if="infoData.classifyId != ''" :span="12">
|
||||||
|
<el-form-item label="土地分类" prop="classifyId">
|
||||||
|
<el-select
|
||||||
|
v-model="infoData.classifyId"
|
||||||
|
placeholder="请选择土地分类"
|
||||||
|
:disabled="true"
|
||||||
|
style="width: 240px"
|
||||||
|
:clearable="true"
|
||||||
|
:multiple="false"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in landUsedOptions" :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="category">
|
||||||
|
<el-input v-model="infoData.category" placeholder="请输入" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="infoCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="subMitInfo(infoRef)"> 确认 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</CustomCard>
|
</CustomCard>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
import { useApp } from '@/hooks';
|
import { useApp } from '@/hooks';
|
||||||
import { ref, reactive } from 'vue';
|
|
||||||
import CustomCard from '@/components/CustomCard.vue';
|
|
||||||
import { CRUD_OPTIONS } from '@/config';
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import CustomCard from '@/components/CustomCard.vue';
|
||||||
|
|
||||||
const { VITE_APP_BASE_API } = import.meta.env;
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
@ -95,46 +133,107 @@ const state = reactive({
|
|||||||
|
|
||||||
let typeTree = reactive([
|
let typeTree = reactive([
|
||||||
{
|
{
|
||||||
label: 'Level one 1',
|
label: '农用地',
|
||||||
|
id: '0',
|
||||||
children: [
|
children: [
|
||||||
{
|
{ label: '耕地', id: '01', children: [], pId: '0' },
|
||||||
label: 'Level two 1-1',
|
{ label: '园地', children: [], id: '02', pId: '0' },
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 1-1-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Level one 2',
|
label: '建设用地',
|
||||||
children: [
|
id: '1',
|
||||||
{
|
children: [{ label: '城乡建设用地', children: [], id: '11', pId: '10' }],
|
||||||
label: 'Level two 2-1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 2-1-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Level two 2-2',
|
label: '住宅用地',
|
||||||
children: [
|
id: '2',
|
||||||
{
|
children: [],
|
||||||
label: 'Level three 2-2-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const infoVisible = ref(false);
|
||||||
|
const infoRef = ref();
|
||||||
|
const landUsedOptions = reactive([
|
||||||
|
{ label: '农用地', value: '0' },
|
||||||
|
{ label: '建设用地', value: '1' },
|
||||||
|
{ label: '住宅用地', value: '2' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
let infoData = reactive({
|
||||||
|
classifyId: '',
|
||||||
|
category: '',
|
||||||
|
classifyName: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const infoRules = reactive({
|
||||||
|
planName: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
/* --------------- methods --------------- */
|
/* --------------- methods --------------- */
|
||||||
|
const loadData = () => {
|
||||||
|
//state.loading = true;
|
||||||
|
// getAnnualList(state.query)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// const { current, size, total, records } = res.data;
|
||||||
|
// state.data = records;
|
||||||
|
// state.pageData = {
|
||||||
|
// currentPage: current || 1,
|
||||||
|
// pageSize: size || 10,
|
||||||
|
// total: total,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// state.data = [];
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// state.loading = false;
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadData();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
const handleNodeClick = (data) => {
|
const handleNodeClick = (data) => {
|
||||||
console.log(data);
|
infoData.classifyId = data.pId ? data.pId : data.id;
|
||||||
|
console.log(infoData);
|
||||||
};
|
};
|
||||||
// 编辑
|
// 编辑
|
||||||
const rowStatus = (row) => {
|
const rowStatus = (row) => {
|
||||||
@ -154,9 +253,22 @@ const getStatusButtonText = (status) => {
|
|||||||
|
|
||||||
const rowEdit = () => {};
|
const rowEdit = () => {};
|
||||||
|
|
||||||
const onAdd = () => {};
|
const onAdd = () => {
|
||||||
|
infoVisible.value = true;
|
||||||
|
};
|
||||||
const onExport = () => {};
|
const onExport = () => {};
|
||||||
|
|
||||||
|
const subMitInfo = (formEl) => {};
|
||||||
|
|
||||||
|
const infoCancel = () => {
|
||||||
|
infoHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoHide = () => {
|
||||||
|
infoRef.value && infoRef.value.resetFields();
|
||||||
|
infoVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
// #region
|
// #region
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
@ -1,3 +1,304 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>行政区域信息</div>
|
<CustomCard>
|
||||||
|
<div>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-tree style="max-width: 600px" :data="typeTree" :props="{ children: 'children', label: 'label' }" @node-click="handleNodeClick" />
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="18">
|
||||||
|
<avue-crud
|
||||||
|
ref="crudRef"
|
||||||
|
v-model="state.form"
|
||||||
|
v-model:search="state.query"
|
||||||
|
v-model:page="state.pageData"
|
||||||
|
:table-loading="state.loading"
|
||||||
|
:data="state.data"
|
||||||
|
:option="state.options"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@search-reset="searchChange"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@row-del="rowDel"
|
||||||
|
>
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="primary" icon="Plus" @click="onAdd">新增</el-button>
|
||||||
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<el-dialog v-model="infoVisible" title="新增行政区域信息" width="800" center>
|
||||||
|
<div>
|
||||||
|
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col v-if="infoData.countyId != ''" :span="12">
|
||||||
|
<el-form-item label="县" prop="countyId">
|
||||||
|
<el-select
|
||||||
|
v-model="infoData.countyId"
|
||||||
|
placeholder="请选择县"
|
||||||
|
:disabled="true"
|
||||||
|
style="width: 240px"
|
||||||
|
:clearable="true"
|
||||||
|
:multiple="false"
|
||||||
|
>
|
||||||
|
<el-option v-for="item in countyOptions" :key="item.id" :label="item.label" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col v-if="infoData.townId != ''" :span="12">
|
||||||
|
<el-form-item label="镇" prop="townId">
|
||||||
|
<el-select v-model="infoData.townId" placeholder="请选择镇" :disabled="true" style="width: 240px" :clearable="true" :multiple="false">
|
||||||
|
<el-option v-for="item in townOptions" :key="item.id" :label="item.label" :value="item.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="名称:" prop="name">
|
||||||
|
<el-input v-model="infoData.name" placeholder="请输入" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="infoCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="subMitInfo(infoRef)"> 确认 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</CustomCard>
|
||||||
</template>
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import CustomCard from '@/components/CustomCard.vue';
|
||||||
|
|
||||||
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
|
const app = useApp();
|
||||||
|
|
||||||
|
/* --------------- data --------------- */
|
||||||
|
// #region
|
||||||
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtnText: '',
|
||||||
|
addBtn: false,
|
||||||
|
column: [
|
||||||
|
{ label: '编号', prop: 'gridManager' },
|
||||||
|
{ label: '所属区县', prop: 'gridManager' },
|
||||||
|
{ label: '所属乡镇', prop: 'gridManager' },
|
||||||
|
{ label: '村名', prop: 'gridManager' },
|
||||||
|
{ label: '状态', prop: 'gridManager' },
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: (row) => getStatusButtonText(row.status),
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => rowStatus(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => rowEdit(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => rowDel(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
let typeTree = reactive([
|
||||||
|
{
|
||||||
|
label: '耿马县',
|
||||||
|
id: '0',
|
||||||
|
level: '0',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
label: '镇1',
|
||||||
|
level: '1',
|
||||||
|
id: '01',
|
||||||
|
children: [
|
||||||
|
{ label: '村1', children: [], id: '0101', pId: '01', level: '2' },
|
||||||
|
{ label: '村2', children: [], id: '0102', pId: '01', level: '2' },
|
||||||
|
],
|
||||||
|
pId: '0',
|
||||||
|
},
|
||||||
|
{ label: '镇2', level: '1', children: [], id: '02', pId: '0' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '县1',
|
||||||
|
id: '1',
|
||||||
|
level: '0',
|
||||||
|
children: [{ label: '镇1', children: [], id: '11', pId: '10', level: '1' }],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const infoVisible = ref(false);
|
||||||
|
const infoRef = ref();
|
||||||
|
const countyOptions = reactive([
|
||||||
|
{ label: '耿马县', id: '0' },
|
||||||
|
{ label: '县1', id: '1' },
|
||||||
|
]);
|
||||||
|
let townOptions = reactive([]);
|
||||||
|
|
||||||
|
let infoData = reactive({
|
||||||
|
countyId: '',
|
||||||
|
townId: '',
|
||||||
|
name: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const infoRules = reactive({
|
||||||
|
planName: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
/* --------------- methods --------------- */
|
||||||
|
const loadData = () => {
|
||||||
|
//state.loading = true;
|
||||||
|
// getAnnualList(state.query)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// const { current, size, total, records } = res.data;
|
||||||
|
// state.data = records;
|
||||||
|
// state.pageData = {
|
||||||
|
// currentPage: current || 1,
|
||||||
|
// pageSize: size || 10,
|
||||||
|
// total: total,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// state.data = [];
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// state.loading = false;
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadData();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleNodeClick = (data) => {
|
||||||
|
if (data.level == '2') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// console.info('data', data);
|
||||||
|
if (data.level == '0') {
|
||||||
|
infoData.countyId = data.id;
|
||||||
|
infoData.townId = '';
|
||||||
|
}
|
||||||
|
if (data.level == '1') {
|
||||||
|
let countys =
|
||||||
|
typeTree.filter((m) => {
|
||||||
|
return m.id == data.pId;
|
||||||
|
}) || [];
|
||||||
|
|
||||||
|
let town = countys[0] && countys[0].children ? countys[0].children : [];
|
||||||
|
townOptions = town;
|
||||||
|
infoData.townId = data.id;
|
||||||
|
infoData.countyId = data.pId;
|
||||||
|
}
|
||||||
|
// console.info('infoData', infoData);
|
||||||
|
};
|
||||||
|
// 编辑
|
||||||
|
const rowStatus = (row) => {
|
||||||
|
console.info('操作状态');
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowDel = (row) => {};
|
||||||
|
|
||||||
|
const getStatusButtonText = (status) => {
|
||||||
|
switch (status) {
|
||||||
|
case 'active':
|
||||||
|
return '启用';
|
||||||
|
case 'inactive':
|
||||||
|
return '禁用';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowEdit = () => {};
|
||||||
|
|
||||||
|
const onAdd = () => {
|
||||||
|
infoVisible.value = true;
|
||||||
|
};
|
||||||
|
const onExport = () => {};
|
||||||
|
|
||||||
|
const subMitInfo = (formEl) => {};
|
||||||
|
|
||||||
|
const infoCancel = () => {
|
||||||
|
infoHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoHide = () => {
|
||||||
|
infoRef.value && infoRef.value.resetFields();
|
||||||
|
infoVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// #region
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
|
@ -0,0 +1,199 @@
|
|||||||
|
<template>
|
||||||
|
<div class="options_btns">
|
||||||
|
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" @click="item.method">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="list">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column type="index"> </el-table-column>
|
||||||
|
<el-table-column label="任务编号" prop="landName" show-overflow-tooltip />
|
||||||
|
<el-table-column label="任务名称" prop="address" show-overflow-tooltip />
|
||||||
|
<el-table-column label="任务成员" prop="owner" show-overflow-tooltip />
|
||||||
|
<el-table-column label="巡查类型" prop="landClassificationType" show-overflow-tooltip />
|
||||||
|
<el-table-column label="巡查注意事项" prop="978.2" show-overflow-tooltip />
|
||||||
|
<el-table-column label="巡查对象" prop="coordinate" show-overflow-tooltip />
|
||||||
|
<el-table-column label="是否违法" prop="landTransfer" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ !row.landTransfer ? '是' : '否' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" prop="landTransfer" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ !row.landTransfer ? '是' : '否' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column fixed="right" label="操作" width="200" show-overflow-tooltip>
|
||||||
|
<el-button type="primary" @click="doResults()">登记结果</el-button>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagina :page-data="pageData" />
|
||||||
|
<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="num">
|
||||||
|
<el-input v-model="infoData.num" placeholder="请输入" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="任务名称" prop="name">
|
||||||
|
<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="member">
|
||||||
|
<el-select v-model="infoData.member" :multiple="true" placeholder="请选择任务成员" style="width: 240px" :clearable="true">
|
||||||
|
<el-option v-for="item in memberOptions" :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="gridName">
|
||||||
|
<el-select v-model="infoData.type" placeholder="请选择巡查类型" style="width: 240px" :clearable="true">
|
||||||
|
<el-option v-for="item in typeOptions" :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="gridName">
|
||||||
|
<el-input
|
||||||
|
v-model="infoData.mark"
|
||||||
|
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||||
|
type="textarea"
|
||||||
|
laceholder="请输入巡查注意事项"
|
||||||
|
style="width: 240px"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="巡查对象" prop="gridName">
|
||||||
|
<el-select v-model="infoData.target" placeholder="请选择巡查对象" style="width: 240px" :clearable="true">
|
||||||
|
<el-option v-for="item in objOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</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>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
|
||||||
|
/* --------------- data --------------- */
|
||||||
|
// #region
|
||||||
|
const btns = reactive([
|
||||||
|
{
|
||||||
|
label: '新增巡查',
|
||||||
|
method: function () {
|
||||||
|
console.log('add');
|
||||||
|
infoVisible.value = true;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '导出',
|
||||||
|
disabled: true,
|
||||||
|
method: function () {
|
||||||
|
console.log('export');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const pageData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0,
|
||||||
|
});
|
||||||
|
const list = ref([]);
|
||||||
|
const infoVisible = ref(false);
|
||||||
|
const infoRef = ref();
|
||||||
|
const infoData = reactive({
|
||||||
|
num: '',
|
||||||
|
name: '',
|
||||||
|
member: [],
|
||||||
|
type: '',
|
||||||
|
mark: '',
|
||||||
|
target: '',
|
||||||
|
});
|
||||||
|
const infoRules = reactive({
|
||||||
|
num: [{ required: true, message: '请输入编号', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
const memberOptions = reactive([
|
||||||
|
{
|
||||||
|
value: '成员1',
|
||||||
|
label: 'Option1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '成员2',
|
||||||
|
label: 'Option2',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const typeOptions = reactive([
|
||||||
|
{
|
||||||
|
value: '巡查类型1',
|
||||||
|
label: 'Option1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '巡查类型2',
|
||||||
|
label: 'Option2',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const objOptions = reactive([
|
||||||
|
{
|
||||||
|
value: '巡查对象1',
|
||||||
|
label: 'Option1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '巡查对象2',
|
||||||
|
label: 'Option2',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
/* --------------- methods --------------- */
|
||||||
|
|
||||||
|
const doResults = () => {
|
||||||
|
console.info('登记结果');
|
||||||
|
};
|
||||||
|
|
||||||
|
const subMitInfo = (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
infoHide();
|
||||||
|
console.log('submit!');
|
||||||
|
} else {
|
||||||
|
console.log('error submit!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoCancel = () => {
|
||||||
|
infoHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoHide = () => {
|
||||||
|
infoRef.value && infoRef.value.resetFields();
|
||||||
|
infoVisible.value = false;
|
||||||
|
};
|
||||||
|
// #region
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.options_btns {
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,80 +1,61 @@
|
|||||||
<template>
|
<template>
|
||||||
<section>土地巡查</section>
|
<div class="custom-page">
|
||||||
<div class="options_btns">
|
<avue-crud
|
||||||
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" @click="item.method">
|
ref="crudRef"
|
||||||
{{ item.label }}
|
v-model="state.form"
|
||||||
</el-button>
|
v-model:search="state.query"
|
||||||
</div>
|
v-model:page="state.pageData"
|
||||||
<el-table :data="list">
|
:table-loading="state.loading"
|
||||||
<el-table-column type="selection" width="55" />
|
:data="state.data"
|
||||||
<el-table-column type="index"> </el-table-column>
|
:option="state.options"
|
||||||
<el-table-column label="任务编号" prop="landName" show-overflow-tooltip />
|
@refresh-change="refreshChange"
|
||||||
<el-table-column label="任务名称" prop="address" show-overflow-tooltip />
|
@search-reset="searchChange"
|
||||||
<el-table-column label="任务成员" prop="owner" show-overflow-tooltip />
|
@search-change="searchChange"
|
||||||
<el-table-column label="巡查类型" prop="landClassificationType" show-overflow-tooltip />
|
@selection-change="selectionChange"
|
||||||
<el-table-column label="巡查注意事项" prop="978.2" show-overflow-tooltip />
|
@current-change="currentChange"
|
||||||
<el-table-column label="巡查对象" prop="coordinate" show-overflow-tooltip />
|
@size-change="sizeChange"
|
||||||
<el-table-column label="是否违法" prop="landTransfer" show-overflow-tooltip>
|
@row-save="rowSave"
|
||||||
<template #default="{ row }">
|
>
|
||||||
{{ !row.landTransfer ? '是' : '否' }}
|
<template #menu-left>
|
||||||
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="状态" prop="landTransfer" show-overflow-tooltip>
|
<template #menu="scope">
|
||||||
<template #default="{ row }">
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
{{ !row.landTransfer ? '是' : '否' }}
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</avue-crud>
|
||||||
<el-table-column fixed="right" label="操作" width="200" show-overflow-tooltip>
|
|
||||||
<el-button type="primary" @click="doResults()">登记结果</el-button>
|
<el-dialog v-model="infoVisible" title="巡查任务" width="800" center>
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<Pagina :page-data="pageData" />
|
|
||||||
<el-dialog v-model="infoVisible" title="新增巡查" width="1000" center>
|
|
||||||
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
|
<el-descriptions :title="infoData.planName || ''" :column="2">
|
||||||
|
<el-descriptions-item label="任务编号">{{ infoData.id || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="任务名称">{{ infoData.planName || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="任务成员">{{ infoData.plantingArea || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="巡查类型">{{ infoData.plantingMonths || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="注意事项">{{ infoData.growthCycle || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="巡查对象">{{ infoData.note || '--' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<el-descriptions :title="'巡查信息登记'"> </el-descriptions>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="任务编号:" prop="num">
|
<el-form-item label="是否违法:" prop="num">
|
||||||
<el-input v-model="infoData.num" placeholder="请输入" style="width: 240px"></el-input>
|
<el-radio-group v-model="radio1">
|
||||||
|
<el-radio value="1" size="large">是</el-radio>
|
||||||
|
<el-radio value="2" size="large">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="任务名称" prop="name">
|
<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="member">
|
|
||||||
<el-select v-model="infoData.member" :multiple="true" placeholder="请选择任务成员" style="width: 240px" :clearable="true">
|
|
||||||
<el-option v-for="item in memberOptions" :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="gridName">
|
|
||||||
<el-select v-model="infoData.type" placeholder="请选择巡查类型" style="width: 240px" :clearable="true">
|
|
||||||
<el-option v-for="item in typeOptions" :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="gridName">
|
|
||||||
<el-input
|
<el-input
|
||||||
v-model="infoData.mark"
|
v-model="infoData.mark"
|
||||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
laceholder="请输入巡查注意事项"
|
laceholder="请输入巡查情况"
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="巡查对象" prop="gridName">
|
|
||||||
<el-select v-model="infoData.target" placeholder="请选择巡查对象" style="width: 240px" :clearable="true">
|
|
||||||
<el-option v-for="item in objOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -84,36 +65,141 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { isEmpty, downloadFile } from '@/utils';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
import { compact } from 'lodash';
|
||||||
|
import {
|
||||||
|
getOperationRecord,
|
||||||
|
saveOperationRecord,
|
||||||
|
editOperationRecord,
|
||||||
|
delOperationRecord,
|
||||||
|
exportOperationRecord,
|
||||||
|
getAddrCropByLand,
|
||||||
|
importOperationRecord,
|
||||||
|
} from '@/apis/land';
|
||||||
|
|
||||||
<script lang="ts" setup>
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
import { ref, reactive } from 'vue';
|
const app = useApp();
|
||||||
|
const UserStore = useUserStore();
|
||||||
|
const crudRef = ref(null);
|
||||||
|
const handleLandChange = async (value, form, done) => {
|
||||||
|
if (!value || !value.item || !value.item.id) return; // 如果没有选择任何地块,则直接返回
|
||||||
|
let val = {};
|
||||||
|
getAddrCropByLand(value.item?.id || '')
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
val = res.data || {};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
val = {};
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
state.form.crop = val?.crop || value.item?.crop;
|
||||||
|
state.form.address = val?.county + val?.town + val?.village || value.item?.address;
|
||||||
|
};
|
||||||
|
|
||||||
/* --------------- data --------------- */
|
const jobTypeOptions = reactive([
|
||||||
// #region
|
{ label: '施肥', value: '0' },
|
||||||
const btns = reactive([
|
{ label: '杀虫', value: '1' },
|
||||||
{
|
{ label: '灌溉', value: '2' },
|
||||||
label: '新增巡查',
|
|
||||||
method: function () {
|
|
||||||
console.log('add');
|
|
||||||
infoVisible.value = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '导出',
|
|
||||||
disabled: true,
|
|
||||||
method: function () {
|
|
||||||
console.log('export');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
const state = reactive({
|
||||||
const pageData = reactive({
|
loading: false,
|
||||||
page: 1,
|
query: {
|
||||||
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtnText: '新增',
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '任务编号',
|
||||||
|
prop: 'executor',
|
||||||
|
fixed: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '任务名称',
|
||||||
|
prop: 'address',
|
||||||
|
width: '240px',
|
||||||
|
showOverflowTooltip: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '任务成员',
|
||||||
|
prop: 'crop',
|
||||||
|
disabled: false,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '巡查类型',
|
||||||
|
prop: 'inputName',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '巡查对象',
|
||||||
|
prop: 'inputBrand',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '注意事项',
|
||||||
|
prop: 'inputBrand',
|
||||||
|
type: 'textarea',
|
||||||
|
rows: 1,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
searchColumn: [],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '登记结果',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => doEnroll(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
total: 0,
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
});
|
});
|
||||||
const list = ref([]);
|
|
||||||
const infoVisible = ref(false);
|
const infoVisible = ref(false);
|
||||||
const infoRef = ref();
|
const infoRef = ref();
|
||||||
const infoData = reactive({
|
const infoData = reactive({
|
||||||
@ -124,48 +210,115 @@ const infoData = reactive({
|
|||||||
mark: '',
|
mark: '',
|
||||||
target: '',
|
target: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const infoRules = reactive({
|
const infoRules = reactive({
|
||||||
num: [{ required: true, message: '请输入编号', trigger: 'blur' }],
|
num: [{ required: true, message: '请选择是否违法', trigger: 'blur' }],
|
||||||
|
mark: [{ required: true, message: '请输入巡查情况', trigger: 'blur' }],
|
||||||
});
|
});
|
||||||
const memberOptions = reactive([
|
|
||||||
{
|
|
||||||
value: '成员1',
|
|
||||||
label: 'Option1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '成员2',
|
|
||||||
label: 'Option2',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const typeOptions = reactive([
|
// 加载
|
||||||
{
|
const loadData = () => {
|
||||||
value: '巡查类型1',
|
// state.loading = true;
|
||||||
label: 'Option1',
|
// getOperationRecord(state.query)
|
||||||
},
|
// .then((res) => {
|
||||||
{
|
// if (res.code === 200) {
|
||||||
value: '巡查类型2',
|
// const { current, size, total, records } = res.data;
|
||||||
label: 'Option2',
|
// state.data = records;
|
||||||
},
|
// state.pageData = {
|
||||||
]);
|
// currentPage: current || 1,
|
||||||
|
// pageSize: size || 10,
|
||||||
|
// total: total,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// state.data = [];
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// state.loading = false;
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
const objOptions = reactive([
|
loadData();
|
||||||
{
|
|
||||||
value: '巡查对象1',
|
|
||||||
label: 'Option1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: '巡查对象2',
|
|
||||||
label: 'Option2',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
// #endregion
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
/* --------------- methods --------------- */
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
const doResults = () => {
|
// 搜索
|
||||||
console.info('登记结果');
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const rowSave = (row, done, loading) => {
|
||||||
|
// console.info('新增', row);
|
||||||
|
saveOperationRecord(row)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const doEnroll = (row) => {
|
||||||
|
console.info('doEnroll', row);
|
||||||
|
infoVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
const onExport = () => {
|
||||||
|
if (isEmpty(state.data)) {
|
||||||
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.loading = true;
|
||||||
|
const fileName = '土地巡查明细表';
|
||||||
|
exportOperationRecord(state.query)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
downloadFile(res.data, `${fileName}.xlsx`, 'blob');
|
||||||
|
app.$message.success('导出成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error('导出失败!');
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const subMitInfo = (formEl) => {
|
const subMitInfo = (formEl) => {
|
||||||
@ -188,13 +341,4 @@ const infoHide = () => {
|
|||||||
infoRef.value && infoRef.value.resetFields();
|
infoRef.value && infoRef.value.resetFields();
|
||||||
infoVisible.value = false;
|
infoVisible.value = false;
|
||||||
};
|
};
|
||||||
// #region
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.options_btns {
|
|
||||||
margin: 16px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
@row-del="rowDel"
|
@row-del="rowDel"
|
||||||
>
|
>
|
||||||
<template #menu-left>
|
<template #menu-left>
|
||||||
|
<el-button type="primary" icon="Upload" @click="onImport">导入</el-button>
|
||||||
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -26,6 +27,29 @@
|
|||||||
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
</template>
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
|
|
||||||
|
<el-dialog v-model="importVisible" title="导入文件" width="800" center>
|
||||||
|
<!-- <el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules"> -->
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<!-- <el-form-item label="文件:" prop="landName"> -->
|
||||||
|
<el-upload ref="upload" class="upload-demo" action="" :limit="1" :auto-upload="false" :on-change="fileChange" :file-list="fileList">
|
||||||
|
<el-button type="primary">点击上传</el-button>
|
||||||
|
<template #tip>
|
||||||
|
<div class="el-upload__tip">只能上传 xls/xlsx/csv 文件,且不超过 500kb</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
<!-- </el-form-item> -->
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<!-- </el-form> -->
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="importCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="subMitImport"> 确认 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -35,22 +59,44 @@ 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 {
|
||||||
|
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();
|
||||||
const UserStore = useUserStore();
|
const UserStore = useUserStore();
|
||||||
const crudRef = ref(null);
|
const crudRef = ref(null);
|
||||||
const handleLandChange = async (value, form, done) => {
|
const handleLandChange = async (value, form, done) => {
|
||||||
if (!value) return; // 如果没有选择任何地块,则直接返回
|
if (!value || !value.item || !value.item.id) return; // 如果没有选择任何地块,则直接返回
|
||||||
state.form.address = value.item?.address || '';
|
let val = {};
|
||||||
|
getAddrCropByLand(value.item?.id || '')
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
val = res.data || {};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
val = {};
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
state.form.crop = val?.crop || value.item?.crop;
|
||||||
|
state.form.address = val?.county + val?.town + val?.village || value.item?.address;
|
||||||
};
|
};
|
||||||
|
|
||||||
const JobTypeChange = async (value, form, done) => {
|
const jobTypeOptions = reactive([
|
||||||
if (!value) return;
|
{ label: '施肥', value: '0' },
|
||||||
state.form.productName = value.item?.productName || '';
|
{ label: '杀虫', value: '1' },
|
||||||
};
|
{ label: '灌溉', value: '2' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const importVisible = ref(false);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
query: {
|
query: {
|
||||||
@ -65,7 +111,7 @@ const state = reactive({
|
|||||||
column: [
|
column: [
|
||||||
{
|
{
|
||||||
label: '作业日期',
|
label: '作业日期',
|
||||||
prop: 'buyTime',
|
prop: 'operationDate',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
valueFormat: 'YYYY-MM-DD',
|
valueFormat: 'YYYY-MM-DD',
|
||||||
@ -78,17 +124,10 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '执行人',
|
label: '执行人',
|
||||||
prop: 'user',
|
prop: 'executor',
|
||||||
type: 'select',
|
|
||||||
search: true,
|
|
||||||
dicData: [
|
|
||||||
{ label: '小A', value: 0 },
|
|
||||||
{ label: '小B', value: 1 },
|
|
||||||
{ label: '小C', value: 2 },
|
|
||||||
],
|
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择',
|
message: '请输入',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -96,7 +135,7 @@ const state = reactive({
|
|||||||
label: '地块',
|
label: '地块',
|
||||||
prop: 'landId',
|
prop: 'landId',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
remote: true,
|
remote: false,
|
||||||
props: {
|
props: {
|
||||||
label: 'landName',
|
label: 'landName',
|
||||||
value: 'id',
|
value: 'id',
|
||||||
@ -104,7 +143,7 @@ const state = reactive({
|
|||||||
dicHeaders: {
|
dicHeaders: {
|
||||||
authorization: UserStore.token,
|
authorization: UserStore.token,
|
||||||
},
|
},
|
||||||
dicUrl: `${VITE_APP_BASE_API}/land-resource/landManage/page?current=1&size=10&draftsSaveType=0&landType=1&landName=&gridName=&owner=`,
|
dicUrl: `${VITE_APP_BASE_API}/land-resource/landManage/page?current=1&size=9999&draftsSaveType=0&landName=&gridName=&owner=`,
|
||||||
dicFormatter: (res) => res.data.records ?? [],
|
dicFormatter: (res) => res.data.records ?? [],
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
@ -118,6 +157,8 @@ const state = reactive({
|
|||||||
{
|
{
|
||||||
label: '位置',
|
label: '位置',
|
||||||
prop: 'address',
|
prop: 'address',
|
||||||
|
width: '240px',
|
||||||
|
showOverflowTooltip: true,
|
||||||
fixed: true,
|
fixed: true,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
rules: {
|
rules: {
|
||||||
@ -128,7 +169,8 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '产物',
|
label: '产物',
|
||||||
prop: 'gridManager',
|
prop: 'crop',
|
||||||
|
disabled: false,
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -137,24 +179,19 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '作业类型',
|
label: '作业类型',
|
||||||
prop: 'jobType',
|
prop: 'operationType',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
search: true,
|
search: true,
|
||||||
dicData: [
|
dicData: jobTypeOptions,
|
||||||
{ label: '育苗', value: 0, productName: '旱地水稻' },
|
|
||||||
{ label: '灌溉', value: 1, productName: '化肥水' },
|
|
||||||
{ label: '施肥', value: 2, productName: '氮肥' },
|
|
||||||
],
|
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择',
|
message: '请选择',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
change: JobTypeChange,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '投入品名',
|
label: '投入品名',
|
||||||
prop: 'productName',
|
prop: 'inputName',
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -163,7 +200,7 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '投入品牌',
|
label: '投入品牌',
|
||||||
prop: 'contactInfo',
|
prop: 'inputBrand',
|
||||||
rules: {
|
rules: {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入',
|
message: '请输入',
|
||||||
@ -171,6 +208,20 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
searchColumn: [
|
||||||
|
{ label: '地块名', prop: 'landName', search: true },
|
||||||
|
{ label: '种植产物', prop: 'crop', search: true },
|
||||||
|
{
|
||||||
|
label: '作业类型',
|
||||||
|
prop: 'operationType',
|
||||||
|
type: 'select',
|
||||||
|
search: true,
|
||||||
|
dicData: jobTypeOptions,
|
||||||
|
},
|
||||||
|
{ label: '投入品名', prop: 'inputName', search: true },
|
||||||
|
{ label: '投入品牌名', prop: 'inputBrand', search: true },
|
||||||
|
{ label: '执行人', prop: 'executor', search: true },
|
||||||
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
name: '编辑',
|
name: '编辑',
|
||||||
@ -194,28 +245,32 @@ const state = reactive({
|
|||||||
currentRow: {},
|
currentRow: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 文件列表
|
||||||
|
const fileList = ref([]);
|
||||||
|
const upload = ref(null);
|
||||||
|
|
||||||
// 加载
|
// 加载
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
// state.loading = true;
|
state.loading = true;
|
||||||
// GetEntityList(state.query)
|
getOperationRecord(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();
|
||||||
@ -251,57 +306,46 @@ const selectionChange = (rows) => {
|
|||||||
state.selection = rows;
|
state.selection = rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setCity = (row) => {
|
|
||||||
if (!isEmpty(row.cities)) {
|
|
||||||
row.provinceCode = row?.cities[0] ?? null;
|
|
||||||
row.cityCode = row?.cities[1] ?? null;
|
|
||||||
row.gridAreaCode = row?.cities[2] ?? null;
|
|
||||||
row.townCode = row?.cities[3] ?? null;
|
|
||||||
row.village = row?.cities[3] ?? null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
const rowSave = (row, done, loading) => {
|
const rowSave = (row, done, loading) => {
|
||||||
console.info('新增');
|
// console.info('新增', row);
|
||||||
// AddEntity(row)
|
saveOperationRecord(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();
|
||||||
// });
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const rowEdit = (row) => {
|
const rowEdit = (row) => {
|
||||||
console.info('编辑');
|
console.info('编辑', row);
|
||||||
// row.cities = compact([row.provinceCode, row.cityCode, row.gridAreaCode ?? '', row.townCode ?? '', row.village ?? '']);
|
|
||||||
crudRef.value.rowEdit(row);
|
crudRef.value.rowEdit(row);
|
||||||
};
|
};
|
||||||
const rowUpdate = (row, index, done, loading) => {
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
console.info('更新');
|
console.info('更新');
|
||||||
// UpdateEntity(row)
|
editOperationRecord(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();
|
||||||
// });
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
@ -314,18 +358,18 @@ const rowDel = (row, index, done) => {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.info('删除');
|
console.info('删除', row.recordId);
|
||||||
// DeleteEntity({ id: row.id })
|
delOperationRecord(row.recordId || '')
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// app.$message.success('删除成功!');
|
app.$message.success('删除成功!');
|
||||||
// done();
|
loadData();
|
||||||
// loadData();
|
done();
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
.catch((err) => {
|
||||||
// app.$message.error(err.msg);
|
app.$message.error(err.msg);
|
||||||
// });
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
@ -338,18 +382,60 @@ const onExport = () => {
|
|||||||
}
|
}
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
const fileName = '作业记录明细表';
|
const fileName = '作业记录明细表';
|
||||||
// ExportEntity(state.query)
|
exportOperationRecord(state.query)
|
||||||
// .then((res) => {
|
.then((res) => {
|
||||||
// if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
// downloadFile(res.data, `${fileName}.xlsx`, 'blob');
|
downloadFile(res.data, `${fileName}.xlsx`, 'blob');
|
||||||
// app.$message.success('导出成功!');
|
app.$message.success('导出成功!');
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((err) => {
|
.catch((err) => {
|
||||||
// app.$message.error('导出失败!');
|
app.$message.error('导出失败!');
|
||||||
// })
|
})
|
||||||
// .finally(() => {
|
.finally(() => {
|
||||||
// state.loading = false;
|
state.loading = false;
|
||||||
// });
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onImport = () => {
|
||||||
|
importVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const fileChange = (file, List) => {
|
||||||
|
console.info('文件选择变化:', file, List);
|
||||||
|
fileList.value = List;
|
||||||
|
};
|
||||||
|
|
||||||
|
const subMitImport = () => {
|
||||||
|
if (!upload.value || !fileList.value.length) {
|
||||||
|
app.$message.error('请选择要上传的文件');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', fileList.value[0].raw);
|
||||||
|
// console.info('fileList:', fileList.value[0].raw);
|
||||||
|
importOperationRecord(formData)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('上传成功!');
|
||||||
|
importHide();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
const importCancel = () => {
|
||||||
|
importHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const importHide = () => {
|
||||||
|
upload.value && upload.value.clearFiles();
|
||||||
|
fileList.value = [];
|
||||||
|
importVisible.value = false;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -831,6 +831,8 @@ const onStateAdd = () => {
|
|||||||
app.$message.error('请选择种植规划');
|
app.$message.error('请选择种植规划');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.info('onStateAdd', state.currentRow);
|
||||||
stageInfoData.landName = state.currentRow.landName || '';
|
stageInfoData.landName = state.currentRow.landName || '';
|
||||||
stageInfoData.crop = state.currentRow.crop || '';
|
stageInfoData.crop = state.currentRow.crop || '';
|
||||||
stageInfoVisible.value = true;
|
stageInfoVisible.value = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user