|
@@ -2,99 +2,42 @@
|
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
<el-form-item label="任务名称" prop="taskName">
|
|
<el-form-item label="任务名称" prop="taskName">
|
|
|
- <el-input
|
|
|
|
|
- v-model="queryParams.taskName"
|
|
|
|
|
- placeholder="请输入任务名称"
|
|
|
|
|
- clearable
|
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-input v-model="queryParams.taskName" placeholder="请输入任务名称" clearable @keyup.enter.native="handleQuery" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="任务类型" prop="taskType">
|
|
|
|
|
- <el-select v-model="queryParams.taskType" placeholder="请选择任务类型" clearable>
|
|
|
|
|
- <el-option label="施肥" value="0" />
|
|
|
|
|
- <el-option label="灌溉" value="1" />
|
|
|
|
|
- <el-option label="打药" value="2" />
|
|
|
|
|
- <el-option label="采摘" value="3" />
|
|
|
|
|
- <el-option label="巡检" value="4" />
|
|
|
|
|
- <el-option label="除草" value="5" />
|
|
|
|
|
- <el-option label="其他" value="6" />
|
|
|
|
|
|
|
+ <el-form-item label="任务类型" prop="typeName">
|
|
|
|
|
+ <el-select v-model="queryParams.typeName" placeholder="请选择任务类型" clearable>
|
|
|
|
|
+ <el-option v-for="dict in dict.type.task_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属地块" prop="plotNames">
|
|
|
|
|
- <el-select
|
|
|
|
|
- v-model="queryParams.plotNames"
|
|
|
|
|
- placeholder="请选择地块"
|
|
|
|
|
- multiple
|
|
|
|
|
- collapse-tags
|
|
|
|
|
- clearable
|
|
|
|
|
- style="width: 200px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in plotOptions"
|
|
|
|
|
- :key="item.value"
|
|
|
|
|
- :label="item.label"
|
|
|
|
|
- :value="item.value"
|
|
|
|
|
- />
|
|
|
|
|
- <div v-if="plotOptions.length === 0" style="text-align: center; padding: 20px; color: #999;">
|
|
|
|
|
- 暂无数据
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="所属地块" prop="fieldIdList">
|
|
|
|
|
+ <el-select v-model="queryParams.fieldIdList" placeholder="请选择地块" multiple collapse-tags filterable clearable>
|
|
|
|
|
+ <el-option v-for="dict in fieldIdList" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属农场" prop="farmNames">
|
|
|
|
|
- <el-select
|
|
|
|
|
- v-model="queryParams.farmNames"
|
|
|
|
|
- placeholder="请选择农场"
|
|
|
|
|
- multiple
|
|
|
|
|
- collapse-tags
|
|
|
|
|
- clearable
|
|
|
|
|
- style="width: 200px"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in farmOptions"
|
|
|
|
|
- :key="item.value"
|
|
|
|
|
- :label="item.label"
|
|
|
|
|
- :value="item.value"
|
|
|
|
|
- />
|
|
|
|
|
- <div v-if="farmOptions.length === 0" style="text-align: center; padding: 20px; color: #999;">
|
|
|
|
|
- 暂无数据
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-select>
|
|
|
|
|
|
|
+ <el-form-item label="所属农场" prop="deptIdList">
|
|
|
|
|
+ <treeselect v-model="queryParams.deptIdList" :options="deptOptions" multiple :flat="true" :limit="1"
|
|
|
|
|
+ :limitText="count => `+${count}`" style="width:200px" :show-count="true" placeholder="请选所属农场" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="执行人" prop="executor">
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="queryParams.executor"
|
|
|
|
|
- placeholder="请输入执行人"
|
|
|
|
|
- clearable
|
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="执行人" prop="assigneeName">
|
|
|
|
|
+ <el-input v-model="queryParams.assigneeName" placeholder="请输入执行人" clearable @keyup.enter.native="handleQuery" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="任务状态" prop="taskStatus">
|
|
<el-form-item label="任务状态" prop="taskStatus">
|
|
|
<el-select v-model="queryParams.taskStatus" placeholder="请选择任务状态" clearable>
|
|
<el-select v-model="queryParams.taskStatus" placeholder="请选择任务状态" clearable>
|
|
|
- <el-option label="待完成" value="0" />
|
|
|
|
|
- <el-option label="已完成" value="1" />
|
|
|
|
|
|
|
+ <el-option v-for="dict in dict.type.task_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
<el-form-item label="执行时间" prop="executeTimeRange">
|
|
<el-form-item label="执行时间" prop="executeTimeRange">
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="queryParams.executeTimeRange"
|
|
|
|
|
- type="datetimerange"
|
|
|
|
|
- range-separator="至"
|
|
|
|
|
- start-placeholder="开始时间"
|
|
|
|
|
- end-placeholder="结束时间"
|
|
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
- clearable
|
|
|
|
|
|
|
+ <el-date-picker v-model="executeTimeRange" type="datetimerange" range-separator="至"
|
|
|
|
|
+ start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss" clearable
|
|
|
style="width: 350px">
|
|
style="width: 350px">
|
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="完成时间" prop="completionTimeRange">
|
|
<el-form-item label="完成时间" prop="completionTimeRange">
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="queryParams.completionTimeRange"
|
|
|
|
|
- type="datetimerange"
|
|
|
|
|
- range-separator="至"
|
|
|
|
|
- start-placeholder="开始时间"
|
|
|
|
|
- end-placeholder="结束时间"
|
|
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
- clearable
|
|
|
|
|
|
|
+ <el-date-picker v-model="completionTimeRange" type="datetimerange" range-separator="至"
|
|
|
|
|
+ start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss" clearable
|
|
|
style="width: 350px">
|
|
style="width: 350px">
|
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -106,36 +49,17 @@
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
- <el-button
|
|
|
|
|
- type="primary"
|
|
|
|
|
- plain
|
|
|
|
|
- icon="el-icon-plus"
|
|
|
|
|
- size="mini"
|
|
|
|
|
- @click="handleAdd"
|
|
|
|
|
- v-hasPermi="['base:tasks:add']"
|
|
|
|
|
- >新增</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
|
|
|
|
+ v-hasPermi="['base:tasks:add']">新增</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
- <el-button
|
|
|
|
|
- type="danger"
|
|
|
|
|
- plain
|
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
|
- size="mini"
|
|
|
|
|
- :disabled="multiple"
|
|
|
|
|
- @click="handleDelete"
|
|
|
|
|
- v-hasPermi="['base:tasks:remove']"
|
|
|
|
|
- >删除</el-button>
|
|
|
|
|
|
|
+ <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
|
|
|
|
+ v-hasPermi="['base:tasks:remove']">删除</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
- <el-button
|
|
|
|
|
- type="warning"
|
|
|
|
|
- plain
|
|
|
|
|
- icon="el-icon-download"
|
|
|
|
|
- size="mini"
|
|
|
|
|
- @click="handleExport"
|
|
|
|
|
- v-hasPermi="['base:tasks:export']"
|
|
|
|
|
- >导出</el-button>
|
|
|
|
|
|
|
+ <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
|
|
|
|
+ v-hasPermi="['base:tasks:export']">导出</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -143,74 +67,66 @@
|
|
|
<el-table v-loading="loading" :data="tasksList" @selection-change="handleSelectionChange">
|
|
<el-table v-loading="loading" :data="tasksList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="任务名称" align="center" prop="taskName" />
|
|
<el-table-column label="任务名称" align="center" prop="taskName" />
|
|
|
- <el-table-column label="任务类型" align="center" prop="taskType" width="100">
|
|
|
|
|
|
|
+ <el-table-column label="任务类型" align="center" prop="typeName">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-tag :type="getTaskTypeTagType(scope.row.taskType)" size="small">
|
|
|
|
|
- {{ getTaskTypeName(scope.row.taskType) }}
|
|
|
|
|
- </el-tag>
|
|
|
|
|
|
|
+ <dict-tag :options="dict.type.task_type" :value="scope.row.typeName" />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="作物名称" align="center" prop="cropName" />
|
|
|
|
|
- <el-table-column label="所属地块" align="center" prop="plotName" />
|
|
|
|
|
- <el-table-column label="所属农场" align="center" prop="farmName" />
|
|
|
|
|
- <el-table-column label="执行人" align="center" prop="executor" />
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-table-column label="作物名称" align="center" prop="growCrops" />
|
|
|
|
|
+ <el-table-column label="所属地块" align="center" prop="fieldName" />
|
|
|
|
|
+ <el-table-column label="所属农场" align="center" prop="deptName" />
|
|
|
|
|
+ <el-table-column label="执行人" align="center" prop="assigneeName" />
|
|
|
<el-table-column label="执行时间" align="center" prop="executeTime" width="180">
|
|
<el-table-column label="执行时间" align="center" prop="executeTime" width="180">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<span>{{ parseTime(scope.row.executeTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
<span>{{ parseTime(scope.row.executeTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="任务状态" align="center" prop="taskStatus" width="100">
|
|
|
|
|
|
|
+ <!-- <el-table-column label="任务状态" align="center" prop="taskStatus" width="100">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-tag :type="scope.row.taskStatus === 1 ? 'success' : 'warning'" size="small">
|
|
<el-tag :type="scope.row.taskStatus === 1 ? 'success' : 'warning'" size="small">
|
|
|
{{ scope.row.taskStatus === 1 ? '已完成' : '待完成' }}
|
|
{{ scope.row.taskStatus === 1 ? '已完成' : '待完成' }}
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ </el-table-column> -->
|
|
|
|
|
+
|
|
|
|
|
+ <el-table-column label="任务状态" align="center" prop="taskStatus">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <dict-tag :options="dict.type.task_status" :value="scope.row.taskStatus" />
|
|
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="任务说明" align="center" prop="taskDescription" width="150" show-overflow-tooltip />
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-table-column label="任务说明" align="center" prop="remark" width="150" show-overflow-tooltip />
|
|
|
<el-table-column label="完成时间" align="center" prop="completionTime" width="180">
|
|
<el-table-column label="完成时间" align="center" prop="completionTime" width="180">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.completionTime ? parseTime(scope.row.completionTime, '{y}-{m}-{d} {h}:{i}:{s}') : '-' }}</span>
|
|
|
|
|
|
|
+ <span>{{ scope.row.completionTime ? parseTime(scope.row.completionTime, '{y}-{m}-{d} {h}:{i}:{s}') : '-'
|
|
|
|
|
+ }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="完成说明" align="center" prop="completionDescription" width="150" show-overflow-tooltip />
|
|
|
|
|
- <el-table-column label="附件" align="center" prop="attachmentImages" width="80">
|
|
|
|
|
|
|
+ <el-table-column label="完成说明" align="center" prop="completionDesc" width="150" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column label="附件" align="center" prop="imageCount" width="80">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.attachmentImages && scope.row.attachmentImages.length > 0" type="success" size="mini">
|
|
|
|
|
- {{ scope.row.attachmentImages.length }}张
|
|
|
|
|
|
|
+ <el-tag v-if="scope.row.imageCount && scope.row.imageCount > 0" type="success" size="mini">
|
|
|
|
|
+ {{ scope.row.imageCount }}张
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
<span v-else style="color: #999;">-</span>
|
|
<span v-else style="color: #999;">-</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
|
|
- size="mini"
|
|
|
|
|
- type="text"
|
|
|
|
|
- icon="el-icon-edit"
|
|
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
|
|
- v-hasPermi="['base:tasks:edit']"
|
|
|
|
|
- >修改</el-button>
|
|
|
|
|
- <el-button
|
|
|
|
|
- size="mini"
|
|
|
|
|
- type="text"
|
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
|
|
- v-hasPermi="['base:tasks:remove']"
|
|
|
|
|
- >删除</el-button>
|
|
|
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
|
|
|
+ v-hasPermi="['base:tasks:edit']">修改</el-button>
|
|
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
|
|
|
|
+ v-hasPermi="['base:tasks:remove']">删除</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
-
|
|
|
|
|
- <pagination
|
|
|
|
|
- v-show="total>0"
|
|
|
|
|
- :total="total"
|
|
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
|
|
- @pagination="getList"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
|
|
+ @pagination="getList" />
|
|
|
|
|
|
|
|
<!-- 添加或修改农事任务对话框 -->
|
|
<!-- 添加或修改农事任务对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
|
|
|
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body @opened="queryMachineNameFieldUserTe()">
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
@@ -219,74 +135,48 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="任务类型" prop="taskType">
|
|
|
|
|
- <el-select v-model="form.taskType" placeholder="请选择任务类型">
|
|
|
|
|
- <el-option label="施肥" value="0" />
|
|
|
|
|
- <el-option label="灌溉" value="1" />
|
|
|
|
|
- <el-option label="打药" value="2" />
|
|
|
|
|
- <el-option label="采摘" value="3" />
|
|
|
|
|
- <el-option label="巡检" value="4" />
|
|
|
|
|
- <el-option label="除草" value="5" />
|
|
|
|
|
- <el-option label="其他" value="6" />
|
|
|
|
|
|
|
+ <el-form-item label="任务类型" prop="typeName">
|
|
|
|
|
+ <el-select v-model="form.typeName" placeholder="请选择任务类型">
|
|
|
|
|
+ <el-option v-for="dict in dict.type.task_type" :key="dict.value" :label="dict.label"
|
|
|
|
|
+ :value="dict.value"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="所属地块" prop="plotName">
|
|
|
|
|
- <el-select v-model="form.plotName" placeholder="请选择地块" clearable style="width: 100%">
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in plotOptions"
|
|
|
|
|
- :key="item.value"
|
|
|
|
|
- :label="item.label"
|
|
|
|
|
- :value="item.value"
|
|
|
|
|
- />
|
|
|
|
|
- <div v-if="plotOptions.length === 0" style="text-align: center; padding: 20px; color: #999;">
|
|
|
|
|
- 暂无数据
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-select>
|
|
|
|
|
|
|
+ <el-form-item label="所属农场" prop="farmId">
|
|
|
|
|
+ <treeselect v-model="form.farmId" :options="enabledDeptOptions" :show-count="true"
|
|
|
|
|
+ @input="queryMachineNameFieldUser(form.farmId)" placeholder="请先选择所属农场" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="所属农场" prop="farmName">
|
|
|
|
|
- <el-select v-model="form.farmName" placeholder="请选择农场" clearable style="width: 100%">
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in farmOptions"
|
|
|
|
|
- :key="item.value"
|
|
|
|
|
- :label="item.label"
|
|
|
|
|
- :value="item.value"
|
|
|
|
|
- />
|
|
|
|
|
- <div v-if="farmOptions.length === 0" style="text-align: center; padding: 20px; color: #999;">
|
|
|
|
|
- 暂无数据
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="所属地块" prop="plotIds">
|
|
|
|
|
+ <!-- <el-select v-model="form.fieldName" placeholder="请选择作业地块" style="width: 100%" :disabled="!form.farmName">
|
|
|
|
|
+ <el-option v-for="field in filteredFieldOptions" :key="field.value" :label="field.label"
|
|
|
|
|
+ :value="field.value" />
|
|
|
|
|
+ </el-select> -->
|
|
|
|
|
+
|
|
|
|
|
+ <el-select v-model="form.plotId" placeholder="请选择作业地块" :disabled="!form.farmId">
|
|
|
|
|
+ <el-option v-for="item in fields" :key="item.id" :label="item.fieldName" :value="item.id">
|
|
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="执行人" prop="executor">
|
|
|
|
|
- <el-select v-model="form.executor" placeholder="请选择执行人" clearable style="width: 100%">
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in executorOptions"
|
|
|
|
|
- :key="item.value"
|
|
|
|
|
- :label="item.label"
|
|
|
|
|
- :value="item.value"
|
|
|
|
|
- />
|
|
|
|
|
- <div v-if="executorOptions.length === 0" style="text-align: center; padding: 20px; color: #999;">
|
|
|
|
|
- 暂无数据
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <el-form-item label="执行人" prop="assigneeId">
|
|
|
|
|
+ <el-select v-model="form.assigneeId" placeholder="请选择操作员" :disabled="!form.farmId">
|
|
|
|
|
+ <el-option v-for="item in userName" :key="item.userId" :label="item.nickName" :value="item.userId">
|
|
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="执行时间" prop="executeTime">
|
|
<el-form-item label="执行时间" prop="executeTime">
|
|
|
- <el-date-picker clearable
|
|
|
|
|
- v-model="form.executeTime"
|
|
|
|
|
- type="datetime"
|
|
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
- placeholder="请选择执行时间"
|
|
|
|
|
|
|
+ <el-date-picker clearable v-model="form.executeTime" type="datetime" placeholder="请选择执行时间"
|
|
|
style="width: 100%">
|
|
style="width: 100%">
|
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -296,38 +186,38 @@
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="任务状态" prop="taskStatus">
|
|
<el-form-item label="任务状态" prop="taskStatus">
|
|
|
<el-select v-model="form.taskStatus" placeholder="请选择任务状态" style="width: 100%">
|
|
<el-select v-model="form.taskStatus" placeholder="请选择任务状态" style="width: 100%">
|
|
|
- <el-option label="待完成" value="0" />
|
|
|
|
|
- <el-option label="已完成" value="1" />
|
|
|
|
|
|
|
+ <el-option v-for="dict in dict.type.task_status" :key="dict.value" :label="dict.label"
|
|
|
|
|
+ :value="dict.value"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="作物名称" prop="growCrops">
|
|
|
|
|
+ <el-input v-model="form.growCrops" placeholder="请输入作物名称" />
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
- <el-form-item label="任务说明" prop="taskDescription">
|
|
|
|
|
- <el-input v-model="form.taskDescription" type="textarea" :rows="3" placeholder="请输入任务说明" />
|
|
|
|
|
|
|
+ <el-form-item label="任务说明" prop="remark">
|
|
|
|
|
+ <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入任务说明" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-row :gutter="20" v-if="form.taskStatus == 1">
|
|
<el-row :gutter="20" v-if="form.taskStatus == 1">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="完成时间" prop="completionTime">
|
|
<el-form-item label="完成时间" prop="completionTime">
|
|
|
- <el-date-picker clearable
|
|
|
|
|
- v-model="form.completionTime"
|
|
|
|
|
- type="datetime"
|
|
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
- placeholder="请选择完成时间"
|
|
|
|
|
|
|
+ <el-date-picker clearable v-model="form.completionTime"
|
|
|
|
|
+ type="datetime"
|
|
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
+ placeholder="请选择完成时间"
|
|
|
style="width: 100%">
|
|
style="width: 100%">
|
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
- <el-form-item label="完成说明" prop="completionDescription" v-if="form.taskStatus == 1">
|
|
|
|
|
- <el-input v-model="form.completionDescription" type="textarea" :rows="3" placeholder="请输入完成说明" />
|
|
|
|
|
|
|
+ <el-form-item label="完成说明" prop="completionDesc" v-if="form.taskStatus == 1">
|
|
|
|
|
+ <el-input v-model="form.completionDesc" type="textarea" :rows="3" placeholder="请输入完成说明" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="上传附件" prop="attachmentImages" v-if="form.taskStatus == 1">
|
|
|
|
|
- <image-upload
|
|
|
|
|
- v-model="form.attachmentImages"
|
|
|
|
|
- :limit="5"
|
|
|
|
|
- :fileSize="10"
|
|
|
|
|
- :fileType="['jpg', 'jpeg', 'png', 'gif']"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <el-form-item label="上传附件" prop="taskImages" v-if="form.taskStatus == 1">
|
|
|
|
|
+ <image-upload v-model="form.taskImages" :limit="5" :fileSize="10" :fileType="['jpg', 'jpeg', 'png', 'gif']" />
|
|
|
<div style="color: #999; font-size: 12px; margin-top: 5px;">
|
|
<div style="color: #999; font-size: 12px; margin-top: 5px;">
|
|
|
支持jpg、jpeg、png、gif格式,单张图片不超过10MB,最多上传5张
|
|
支持jpg、jpeg、png、gif格式,单张图片不超过10MB,最多上传5张
|
|
|
</div>
|
|
</div>
|
|
@@ -338,18 +228,28 @@
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import { getMachineNameFieldUser,MachineNameFieldUserText } from "@/api/base/machineWorkRecords"
|
|
|
import { listTasks, getTasks, delTasks, addTasks, updateTasks } from "@/api/base/tasks"
|
|
import { listTasks, getTasks, delTasks, addTasks, updateTasks } from "@/api/base/tasks"
|
|
|
|
|
+import { deptTreeSelect } from "@/api/system/user";
|
|
|
|
|
+import { listFieldName } from "@/api/base/field"
|
|
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
import ImageUpload from "@/components/ImageUpload"
|
|
import ImageUpload from "@/components/ImageUpload"
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "Tasks",
|
|
name: "Tasks",
|
|
|
components: {
|
|
components: {
|
|
|
- ImageUpload
|
|
|
|
|
|
|
+ ImageUpload,
|
|
|
|
|
+ Treeselect
|
|
|
},
|
|
},
|
|
|
|
|
+ dicts: ['task_type', 'task_status', 'field_soil_type', 'sys_field_type'],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
// 遮罩层
|
|
// 遮罩层
|
|
@@ -368,8 +268,10 @@ export default {
|
|
|
tasksList: [],
|
|
tasksList: [],
|
|
|
// 弹出层标题
|
|
// 弹出层标题
|
|
|
title: "",
|
|
title: "",
|
|
|
|
|
+ titleSet: "",
|
|
|
// 是否显示弹出层
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
open: false,
|
|
|
|
|
+ openSet: false,
|
|
|
// 查询参数
|
|
// 查询参数
|
|
|
queryParams: {
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
@@ -380,8 +282,7 @@ export default {
|
|
|
farmNames: [],
|
|
farmNames: [],
|
|
|
executor: null,
|
|
executor: null,
|
|
|
taskStatus: null,
|
|
taskStatus: null,
|
|
|
- executeTimeRange: null,
|
|
|
|
|
- completionTimeRange: null,
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
// 地块选项
|
|
// 地块选项
|
|
|
plotOptions: [],
|
|
plotOptions: [],
|
|
@@ -391,21 +292,35 @@ export default {
|
|
|
executorOptions: [],
|
|
executorOptions: [],
|
|
|
// 表单参数
|
|
// 表单参数
|
|
|
form: {},
|
|
form: {},
|
|
|
|
|
+ formSet: {},
|
|
|
|
|
+ // 部门树选项
|
|
|
|
|
+ deptOptions: undefined,
|
|
|
|
|
+ // 过滤掉已禁用部门树选项
|
|
|
|
|
+ enabledDeptOptions: undefined,
|
|
|
|
|
+ // 所属地块
|
|
|
|
|
+ fieldIdList: [],
|
|
|
|
|
+
|
|
|
|
|
+ fields: [],
|
|
|
|
|
+ userName: [],
|
|
|
|
|
+ executeTimeRange: [],
|
|
|
|
|
+ completionTimeRange: [],
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 表单校验
|
|
// 表单校验
|
|
|
rules: {
|
|
rules: {
|
|
|
taskName: [
|
|
taskName: [
|
|
|
{ required: true, message: "任务名称不能为空", trigger: "blur" }
|
|
{ required: true, message: "任务名称不能为空", trigger: "blur" }
|
|
|
],
|
|
],
|
|
|
- taskType: [
|
|
|
|
|
|
|
+ typeName: [
|
|
|
{ required: true, message: "任务类型不能为空", trigger: "change" }
|
|
{ required: true, message: "任务类型不能为空", trigger: "change" }
|
|
|
],
|
|
],
|
|
|
- plotName: [
|
|
|
|
|
|
|
+ plotId: [
|
|
|
{ required: true, message: "所属地块不能为空", trigger: "change" }
|
|
{ required: true, message: "所属地块不能为空", trigger: "change" }
|
|
|
],
|
|
],
|
|
|
- farmName: [
|
|
|
|
|
|
|
+ farmId: [
|
|
|
{ required: true, message: "所属农场不能为空", trigger: "change" }
|
|
{ required: true, message: "所属农场不能为空", trigger: "change" }
|
|
|
],
|
|
],
|
|
|
- executor: [
|
|
|
|
|
|
|
+ assigneeId: [
|
|
|
{ required: true, message: "执行人不能为空", trigger: "change" }
|
|
{ required: true, message: "执行人不能为空", trigger: "change" }
|
|
|
],
|
|
],
|
|
|
executeTime: [
|
|
executeTime: [
|
|
@@ -418,10 +333,67 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- this.getList()
|
|
|
|
|
- this.initOptions()
|
|
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ this.getDeptTree();
|
|
|
|
|
+ this.getFieldNameList();
|
|
|
|
|
+ // this.initOptions()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+
|
|
|
|
|
+ queryMachineNameFieldUser(farmId) {
|
|
|
|
|
+ console.log("queryMachineNameFieldUser")
|
|
|
|
|
+ this.form.plotId = null;
|
|
|
|
|
+ this.form.assigneeId = null;
|
|
|
|
|
+ if (farmId != undefined) {
|
|
|
|
|
+ const data = {
|
|
|
|
|
+ deptId: farmId
|
|
|
|
|
+ }
|
|
|
|
|
+ getMachineNameFieldUser(data).then(response => {
|
|
|
|
|
+ this.fields = response.data.fields
|
|
|
|
|
+ this.userName = response.data.users
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ queryMachineNameFieldUserTe() {
|
|
|
|
|
+ console.log("queryMachineNameFieldUserTe")
|
|
|
|
|
+ const id = this.form.id;
|
|
|
|
|
+ if (id != undefined) {
|
|
|
|
|
+ getTasks(id).then(response => {
|
|
|
|
|
+ this.form.plotId = response.data.plotId
|
|
|
|
|
+ this.form.assigneeId = response.data.assigneeId
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 查询部门下拉树结构 */
|
|
|
|
|
+ getDeptTree() {
|
|
|
|
|
+ deptTreeSelect().then(response => {
|
|
|
|
|
+ this.deptOptions = response.data;
|
|
|
|
|
+ this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ filterDisabledDept(deptList) {
|
|
|
|
|
+ return deptList.filter(dept => {
|
|
|
|
|
+ if (dept.disabled) {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (dept.children && dept.children.length) {
|
|
|
|
|
+ dept.children = this.filterDisabledDept(dept.children)
|
|
|
|
|
+ }
|
|
|
|
|
+ return true
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /** 查询地块名称 **/
|
|
|
|
|
+ getFieldNameList() {
|
|
|
|
|
+ listFieldName().then(res => {
|
|
|
|
|
+ this.fieldIdList = res;
|
|
|
|
|
+ this.fieldIdList.forEach(x => {
|
|
|
|
|
+ x.value = x.id;
|
|
|
|
|
+ x.label = x.fieldName;
|
|
|
|
|
+ })
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
/** 初始化下拉选项 */
|
|
/** 初始化下拉选项 */
|
|
|
initOptions() {
|
|
initOptions() {
|
|
|
// 为了支持修改表单回填,这里提供一些模拟数据
|
|
// 为了支持修改表单回填,这里提供一些模拟数据
|
|
@@ -438,7 +410,7 @@ export default {
|
|
|
{ label: "葡萄园A区", value: "葡萄园A区" },
|
|
{ label: "葡萄园A区", value: "葡萄园A区" },
|
|
|
{ label: "机械库房", value: "机械库房" }
|
|
{ label: "机械库房", value: "机械库房" }
|
|
|
]
|
|
]
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.farmOptions = [
|
|
this.farmOptions = [
|
|
|
{ label: "阳光农场", value: "阳光农场" },
|
|
{ label: "阳光农场", value: "阳光农场" },
|
|
|
{ label: "绿野农场", value: "绿野农场" },
|
|
{ label: "绿野农场", value: "绿野农场" },
|
|
@@ -451,7 +423,7 @@ export default {
|
|
|
{ label: "智慧农场", value: "智慧农场" },
|
|
{ label: "智慧农场", value: "智慧农场" },
|
|
|
{ label: "酒庄农场", value: "酒庄农场" }
|
|
{ label: "酒庄农场", value: "酒庄农场" }
|
|
|
]
|
|
]
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.executorOptions = [
|
|
this.executorOptions = [
|
|
|
{ label: "张三", value: "张三" },
|
|
{ label: "张三", value: "张三" },
|
|
|
{ label: "李四", value: "李四" },
|
|
{ label: "李四", value: "李四" },
|
|
@@ -469,7 +441,7 @@ export default {
|
|
|
getTaskTypeName(type) {
|
|
getTaskTypeName(type) {
|
|
|
const typeMap = {
|
|
const typeMap = {
|
|
|
'0': '施肥',
|
|
'0': '施肥',
|
|
|
- '1': '灌溉',
|
|
|
|
|
|
|
+ '1': '灌溉',
|
|
|
'2': '打药',
|
|
'2': '打药',
|
|
|
'3': '采摘',
|
|
'3': '采摘',
|
|
|
'4': '巡检',
|
|
'4': '巡检',
|
|
@@ -494,176 +466,20 @@ export default {
|
|
|
/** 查询农事任务列表 */
|
|
/** 查询农事任务列表 */
|
|
|
getList() {
|
|
getList() {
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
- // 模拟假数据,实际开发中应该调用真实的API
|
|
|
|
|
- const mockData = {
|
|
|
|
|
- rows: [
|
|
|
|
|
- {
|
|
|
|
|
- id: 1,
|
|
|
|
|
- taskName: "水稻施肥作业",
|
|
|
|
|
- taskType: "0",
|
|
|
|
|
- cropName: "水稻",
|
|
|
|
|
- plotName: "东区1号田",
|
|
|
|
|
- farmName: "阳光农场",
|
|
|
|
|
- executor: "张三",
|
|
|
|
|
- executeTime: "2024-01-15 09:00:00",
|
|
|
|
|
- taskStatus: 1,
|
|
|
|
|
- taskDescription: "对水稻进行有机肥施肥,提高产量和品质,需要注意施肥量的控制,避免过量施肥导致烧苗",
|
|
|
|
|
- completionTime: "2024-01-15 11:30:00",
|
|
|
|
|
- completionDescription: "已完成有机肥施肥,共施肥50亩,肥料用量符合标准要求,苗情良好",
|
|
|
|
|
- attachmentImages: ["https://example.com/images/fertilizer1.jpg", "https://example.com/images/fertilizer2.jpg"]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 2,
|
|
|
|
|
- taskName: "玉米灌溉任务",
|
|
|
|
|
- taskType: "1",
|
|
|
|
|
- cropName: "玉米",
|
|
|
|
|
- plotName: "西区2号田",
|
|
|
|
|
- farmName: "绿野农场",
|
|
|
|
|
- executor: "李四",
|
|
|
|
|
- executeTime: "2024-01-16 06:30:00",
|
|
|
|
|
- taskStatus: 0,
|
|
|
|
|
- taskDescription: "对玉米田进行滴灌作业,确保土壤湿度适宜",
|
|
|
|
|
- completionTime: null,
|
|
|
|
|
- completionDescription: null,
|
|
|
|
|
- attachmentImages: null
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 3,
|
|
|
|
|
- taskName: "果园病虫害防治",
|
|
|
|
|
- taskType: "2",
|
|
|
|
|
- cropName: "苹果",
|
|
|
|
|
- plotName: "南区果园",
|
|
|
|
|
- farmName: "丰收农场",
|
|
|
|
|
- executor: "王五",
|
|
|
|
|
- executeTime: "2024-01-17 07:00:00",
|
|
|
|
|
- taskStatus: 1,
|
|
|
|
|
- taskDescription: "对苹果树进行病虫害防治,使用生物农药,确保果实品质安全",
|
|
|
|
|
- completionTime: "2024-01-17 10:45:00",
|
|
|
|
|
- completionDescription: "病虫害防治作业完成,使用生物农药150公斤,覆盖果园100亩",
|
|
|
|
|
- attachmentImages: ["https://example.com/images/pesticide1.jpg"]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 4,
|
|
|
|
|
- taskName: "草莓采摘作业",
|
|
|
|
|
- taskType: "3",
|
|
|
|
|
- cropName: "草莓",
|
|
|
|
|
- plotName: "温室大棚A区",
|
|
|
|
|
- farmName: "田园农场",
|
|
|
|
|
- executor: "赵六",
|
|
|
|
|
- executeTime: "2024-01-18 05:00:00",
|
|
|
|
|
- taskStatus: 0,
|
|
|
|
|
- taskDescription: "对成熟草莓进行采摘,注意保持果实完整性,分级包装",
|
|
|
|
|
- completionTime: null,
|
|
|
|
|
- completionDescription: null,
|
|
|
|
|
- attachmentImages: null
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 5,
|
|
|
|
|
- taskName: "大棚设施巡检",
|
|
|
|
|
- taskType: "4",
|
|
|
|
|
- cropName: "番茄",
|
|
|
|
|
- plotName: "智能温室B区",
|
|
|
|
|
- farmName: "科技农场",
|
|
|
|
|
- executor: "钱七",
|
|
|
|
|
- executeTime: "2024-01-19 08:00:00",
|
|
|
|
|
- taskStatus: 1,
|
|
|
|
|
- taskDescription: "对温室大棚设施进行全面巡检,检查通风、灌溉、温控等系统运行状态",
|
|
|
|
|
- completionTime: "2024-01-19 12:00:00",
|
|
|
|
|
- completionDescription: "巡检完成,发现2号风机需要维护,其他设施运行正常",
|
|
|
|
|
- attachmentImages: ["https://example.com/images/inspection1.jpg", "https://example.com/images/inspection2.jpg", "https://example.com/images/inspection3.jpg"]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 6,
|
|
|
|
|
- taskName: "蔬菜田除草工作",
|
|
|
|
|
- taskType: "5",
|
|
|
|
|
- cropName: "白菜",
|
|
|
|
|
- plotName: "北区菜地",
|
|
|
|
|
- farmName: "有机农场",
|
|
|
|
|
- executor: "孙八",
|
|
|
|
|
- executeTime: "2024-01-20 07:30:00",
|
|
|
|
|
- taskStatus: 0,
|
|
|
|
|
- taskDescription: "对白菜田进行人工除草,清除田间杂草,提高蔬菜生长环境",
|
|
|
|
|
- completionTime: null,
|
|
|
|
|
- completionDescription: null,
|
|
|
|
|
- attachmentImages: null
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 7,
|
|
|
|
|
- taskName: "农机设备维护",
|
|
|
|
|
- taskType: "6",
|
|
|
|
|
- cropName: "小麦",
|
|
|
|
|
- plotName: "机械库房",
|
|
|
|
|
- farmName: "现代农场",
|
|
|
|
|
- executor: "周九",
|
|
|
|
|
- executeTime: "2024-01-21 09:00:00",
|
|
|
|
|
- taskStatus: 1,
|
|
|
|
|
- taskDescription: "对收割机进行定期维护保养,更换机油、清洁滤芯、检查传动系统",
|
|
|
|
|
- completionTime: "2024-01-21 16:30:00",
|
|
|
|
|
- completionDescription: "设备维护完成,更换机油20升,清洁空气滤芯,传动系统正常",
|
|
|
|
|
- attachmentImages: ["https://example.com/images/maintenance1.jpg"]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 8,
|
|
|
|
|
- taskName: "有机肥料施用",
|
|
|
|
|
- taskType: "0",
|
|
|
|
|
- cropName: "茄子",
|
|
|
|
|
- plotName: "有机种植区",
|
|
|
|
|
- farmName: "生态农场",
|
|
|
|
|
- executor: "吴十",
|
|
|
|
|
- executeTime: "2024-01-22 08:30:00",
|
|
|
|
|
- taskStatus: 0,
|
|
|
|
|
- taskDescription: "为茄子田施用有机肥料,改善土壤结构,提供充足养分支持茄子生长发育",
|
|
|
|
|
- completionTime: null,
|
|
|
|
|
- completionDescription: null,
|
|
|
|
|
- attachmentImages: null
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 9,
|
|
|
|
|
- taskName: "精准灌溉系统调试",
|
|
|
|
|
- taskType: "1",
|
|
|
|
|
- cropName: "黄瓜",
|
|
|
|
|
- plotName: "智能温室C区",
|
|
|
|
|
- farmName: "智慧农场",
|
|
|
|
|
- executor: "郑十一",
|
|
|
|
|
- executeTime: "2024-01-23 10:00:00",
|
|
|
|
|
- taskStatus: 1,
|
|
|
|
|
- taskDescription: "调试精准灌溉系统,设置不同生长期的灌溉参数,确保黄瓜水分需求得到满足",
|
|
|
|
|
- completionTime: "2024-01-23 14:20:00",
|
|
|
|
|
- completionDescription: "灌溉系统调试完成,设置了3个不同生长期的灌溉方案,系统运行稳定",
|
|
|
|
|
- attachmentImages: ["https://example.com/images/irrigation1.jpg", "https://example.com/images/irrigation2.jpg"]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- id: 10,
|
|
|
|
|
- taskName: "葡萄园修剪作业",
|
|
|
|
|
- taskType: "6",
|
|
|
|
|
- cropName: "葡萄",
|
|
|
|
|
- plotName: "葡萄园A区",
|
|
|
|
|
- farmName: "酒庄农场",
|
|
|
|
|
- executor: "冯十二",
|
|
|
|
|
- executeTime: "2024-01-24 07:00:00",
|
|
|
|
|
- taskStatus: 0,
|
|
|
|
|
- taskDescription: "对葡萄藤进行冬季修剪,去除病枝、弱枝,保持树形美观,为来年丰产奠定基础",
|
|
|
|
|
- completionTime: null,
|
|
|
|
|
- completionDescription: null,
|
|
|
|
|
- attachmentImages: null
|
|
|
|
|
- }
|
|
|
|
|
- ],
|
|
|
|
|
- total: 10
|
|
|
|
|
|
|
+ this.queryParams.params = {}
|
|
|
|
|
+ if (null != this.executeTimeRange && '' != this.executeTimeRange) {
|
|
|
|
|
+ this.queryParams.params["beginExecuteTime"] = this.executeTimeRange[0];
|
|
|
|
|
+ this.queryParams.params["endExecuteTime"] = this.executeTimeRange[1];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 模拟网络延迟
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.tasksList = mockData.rows
|
|
|
|
|
- this.total = mockData.total
|
|
|
|
|
|
|
+ if (null != this.completionTimeRange && '' != this.completionTimeRange) {
|
|
|
|
|
+ this.queryParams.params["beginCompletionTime"] = this.completionTimeRange[0];
|
|
|
|
|
+ this.queryParams.params["endCompletionTime"] = this.completionTimeRange[1];
|
|
|
|
|
+ }
|
|
|
|
|
+ listTasks(this.queryParams).then(response => {
|
|
|
|
|
+ this.tasksList = response.rows
|
|
|
|
|
+ this.total = response.total
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
- }, 500)
|
|
|
|
|
-
|
|
|
|
|
- // 真实API调用 (注释掉,用于实际开发)
|
|
|
|
|
- // listTasks(this.queryParams).then(response => {
|
|
|
|
|
- // this.tasksList = response.rows
|
|
|
|
|
- // this.total = response.total
|
|
|
|
|
- // this.loading = false
|
|
|
|
|
- // })
|
|
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
// 取消按钮
|
|
// 取消按钮
|
|
|
cancel() {
|
|
cancel() {
|
|
@@ -675,17 +491,25 @@ export default {
|
|
|
this.form = {
|
|
this.form = {
|
|
|
id: null,
|
|
id: null,
|
|
|
taskName: null,
|
|
taskName: null,
|
|
|
- taskType: null,
|
|
|
|
|
|
|
+ typeName: null,
|
|
|
plotName: null,
|
|
plotName: null,
|
|
|
- farmName: null,
|
|
|
|
|
- executor: null,
|
|
|
|
|
|
|
+ farmId: null,
|
|
|
|
|
+ plotId: null,
|
|
|
|
|
+ assigneeId: null,
|
|
|
executeTime: null,
|
|
executeTime: null,
|
|
|
|
|
+ growCrops: null,
|
|
|
|
|
+ remark: null,
|
|
|
taskStatus: "0",
|
|
taskStatus: "0",
|
|
|
taskDescription: null,
|
|
taskDescription: null,
|
|
|
completionTime: null,
|
|
completionTime: null,
|
|
|
- completionDescription: null,
|
|
|
|
|
- attachmentImages: null
|
|
|
|
|
|
|
+ completionDesc: null,
|
|
|
|
|
+ field: null,
|
|
|
|
|
+ fieldName: null,
|
|
|
|
|
+ assigneeId: null,
|
|
|
|
|
+ assigneeName: null,
|
|
|
|
|
+ imageCount: null
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
this.resetForm("form")
|
|
this.resetForm("form")
|
|
|
},
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
@@ -695,13 +519,15 @@ export default {
|
|
|
},
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
resetQuery() {
|
|
|
|
|
+ this.executeTimeRange = []
|
|
|
|
|
+ this.completionTimeRange = []
|
|
|
this.resetForm("queryForm")
|
|
this.resetForm("queryForm")
|
|
|
this.handleQuery()
|
|
this.handleQuery()
|
|
|
},
|
|
},
|
|
|
// 多选框选中数据
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
handleSelectionChange(selection) {
|
|
|
this.ids = selection.map(item => item.id)
|
|
this.ids = selection.map(item => item.id)
|
|
|
- this.single = selection.length!==1
|
|
|
|
|
|
|
+ this.single = selection.length !== 1
|
|
|
this.multiple = !selection.length
|
|
this.multiple = !selection.length
|
|
|
},
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
@@ -710,53 +536,67 @@ export default {
|
|
|
this.open = true
|
|
this.open = true
|
|
|
this.title = "添加农事任务"
|
|
this.title = "添加农事任务"
|
|
|
},
|
|
},
|
|
|
- /** 格式化表单数据 */
|
|
|
|
|
- formatFormData(rowData) {
|
|
|
|
|
- return {
|
|
|
|
|
- id: rowData.id,
|
|
|
|
|
- taskName: rowData.taskName || '',
|
|
|
|
|
- taskType: rowData.taskType ? rowData.taskType.toString() : '',
|
|
|
|
|
- plotName: rowData.plotName || '',
|
|
|
|
|
- farmName: rowData.farmName || '',
|
|
|
|
|
- executor: rowData.executor || '',
|
|
|
|
|
- executeTime: rowData.executeTime || null,
|
|
|
|
|
- taskStatus: rowData.taskStatus ? rowData.taskStatus.toString() : '0',
|
|
|
|
|
- taskDescription: rowData.taskDescription || '',
|
|
|
|
|
- completionTime: rowData.completionTime || null,
|
|
|
|
|
- completionDescription: rowData.completionDescription || '',
|
|
|
|
|
- attachmentImages: rowData.attachmentImages || null
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
|
|
|
+ if (row.farmId != undefined) {
|
|
|
|
|
+ const data = {
|
|
|
|
|
+ deptId: row.farmId
|
|
|
|
|
+ }
|
|
|
|
|
+ MachineNameFieldUserText(data).then(response => {
|
|
|
|
|
+ this.fields = response.data.fields
|
|
|
|
|
+ this.userName = response.data.users
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
this.reset()
|
|
this.reset()
|
|
|
|
|
+ console.log(row)
|
|
|
const id = row.id || this.ids
|
|
const id = row.id || this.ids
|
|
|
-
|
|
|
|
|
- // 如果是从表格行点击修改,直接使用行数据回填
|
|
|
|
|
- if (row && row.id) {
|
|
|
|
|
- this.form = this.formatFormData(row)
|
|
|
|
|
|
|
+ // 如果是批量修改或者需要从服务器获取数据
|
|
|
|
|
+ getTasks(id).then(response => {
|
|
|
|
|
+ this.form = response.data
|
|
|
this.open = true
|
|
this.open = true
|
|
|
this.title = "修改农事任务"
|
|
this.title = "修改农事任务"
|
|
|
- } else {
|
|
|
|
|
- // 如果是批量修改或者需要从服务器获取数据
|
|
|
|
|
- getTasks(id).then(response => {
|
|
|
|
|
- this.form = this.formatFormData(response.data)
|
|
|
|
|
- this.open = true
|
|
|
|
|
- this.title = "修改农事任务"
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
|
|
+ formatDateTime(dateString) {
|
|
|
|
|
+ const date = new Date(dateString);
|
|
|
|
|
+ return date.toISOString().replace('T', ' ').substring(0, 16);
|
|
|
|
|
+ },
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
|
|
+ console.log("提交按钮")
|
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
if (this.form.id != null) {
|
|
if (this.form.id != null) {
|
|
|
|
|
+ this.form.field = this.form.plotId
|
|
|
|
|
+ const selectedUser = this.userName.find(user => user.userId === this.form.assigneeId);
|
|
|
|
|
+ if (selectedUser) {
|
|
|
|
|
+ this.form.assigneeName = selectedUser.nickName;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const selectedfieldName = this.fields.find(field => field.id === this.form.plotId);
|
|
|
|
|
+ if (selectedfieldName) {
|
|
|
|
|
+ this.form.fieldName = selectedfieldName.fieldName;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.form.executeTime = this.formatDateTime(this.form.executeTime);
|
|
|
updateTasks(this.form).then(response => {
|
|
updateTasks(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功")
|
|
this.$modal.msgSuccess("修改成功")
|
|
|
this.open = false
|
|
this.open = false
|
|
|
this.getList()
|
|
this.getList()
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ this.form.field = this.form.plotId
|
|
|
|
|
+ const selectedUser = this.userName.find(user => user.userId === this.form.assigneeId);
|
|
|
|
|
+ if (selectedUser) {
|
|
|
|
|
+ this.form.assigneeName = selectedUser.nickName;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const selectedfieldName = this.fields.find(field => field.id === this.form.plotId);
|
|
|
|
|
+ if (selectedfieldName) {
|
|
|
|
|
+ this.form.fieldName = selectedfieldName.fieldName;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.form.executeTime = this.formatDateTime(this.form.executeTime);
|
|
|
addTasks(this.form).then(response => {
|
|
addTasks(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("新增成功")
|
|
this.$modal.msgSuccess("新增成功")
|
|
|
this.open = false
|
|
this.open = false
|
|
@@ -769,12 +609,12 @@ export default {
|
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids
|
|
const ids = row.id || this.ids
|
|
|
- this.$modal.confirm('是否确认删除农事任务编号为"' + ids + '"的数据项?').then(function() {
|
|
|
|
|
|
|
+ this.$modal.confirm('是否确认删除农事任务编号为"' + ids + '"的数据项?').then(function () {
|
|
|
return delTasks(ids)
|
|
return delTasks(ids)
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
this.getList()
|
|
this.getList()
|
|
|
this.$modal.msgSuccess("删除成功")
|
|
this.$modal.msgSuccess("删除成功")
|
|
|
- }).catch(() => {})
|
|
|
|
|
|
|
+ }).catch(() => { })
|
|
|
},
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
handleExport() {
|