From bc9b444cc849ff28bfbc93db913bb3e4c0f5d983 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E4=B9=85=E5=93=A5?= <787952492@qq.com>
Date: Tue, 19 Apr 2022 10:15:56 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8C=BA=E5=9F=9F=E9=80=89?=
=?UTF-8?q?=E6=8B=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/farm/area.js | 54 ++++++++
src/views/farm/area/index.vue | 214 +++++++++++++++++++++++++++++++
src/views/farm/project/index.vue | 92 +++++++++++--
3 files changed, 346 insertions(+), 14 deletions(-)
create mode 100644 src/api/farm/area.js
create mode 100644 src/views/farm/area/index.vue
diff --git a/src/api/farm/area.js b/src/api/farm/area.js
new file mode 100644
index 0000000..5ce8b36
--- /dev/null
+++ b/src/api/farm/area.js
@@ -0,0 +1,54 @@
+import request from '@/utils/request'
+
+// 创建
+export function createArea(data) {
+ return request({
+ url: '/farm/area/create',
+ method: 'post',
+ data: data
+ })
+}
+
+// 更新
+export function updateArea(data) {
+ return request({
+ url: '/farm/area/update',
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除
+export function deleteArea(id) {
+ return request({
+ url: '/farm/area/delete?id=' + id,
+ method: 'delete'
+ })
+}
+
+// 获得
+export function getArea(id) {
+ return request({
+ url: '/farm/area/get?id=' + id,
+ method: 'get'
+ })
+}
+
+// 获得分页
+export function getAreaPage(query) {
+ return request({
+ url: '/farm/area/page',
+ method: 'get',
+ params: query
+ })
+}
+
+// 导出 Excel
+export function exportAreaExcel(query) {
+ return request({
+ url: '/farm/area/export-excel',
+ method: 'get',
+ params: query,
+ responseType: 'blob'
+ })
+}
diff --git a/src/views/farm/area/index.vue b/src/views/farm/area/index.vue
new file mode 100644
index 0000000..158c4c6
--- /dev/null
+++ b/src/views/farm/area/index.vue
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+
+ 新增
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+ {{ parseTime(scope.row.createTime) }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/farm/project/index.vue b/src/views/farm/project/index.vue
index a2c4043..a4885fd 100644
--- a/src/views/farm/project/index.vue
+++ b/src/views/farm/project/index.vue
@@ -3,6 +3,11 @@
+
+
+
+
+
@@ -45,23 +50,27 @@
-
-
-
-
-
-
+
+
+
+
+
+ {{resourceList.find(t=>t.id == scope.row.resources ).name}}
+
+
+
+
{{ parseTime(scope.row.planStartTime) }}
-
+
{{ parseTime(scope.row.planEndTime) }}
-
-
+
+
{{ parseTime(scope.row.createTime) }}
@@ -88,10 +97,22 @@
-
-
-
-
+
+
+
+
+ 全选
+
+
+
+ {{col.name}}
+
+
+
@@ -116,6 +137,7 @@
import { createProject, updateProject, deleteProject, getProject, getProjectPage, exportProjectExcel } from "@/api/farm/project";
import ImageUpload from '@/components/ImageUpload';
import Editor from '@/components/Editor';
+import { getResourcePage } from "@/api/farm/resource";
export default {
name: "Project",
@@ -156,11 +178,16 @@ export default {
form: {},
// 表单校验
rules: {
- }
+ },
+ resourceList:[],
+ checkAll: false,
+ isIndeterminate: true
+
};
},
created() {
this.getList();
+ this.getResource();
},
methods: {
/** 查询列表 */
@@ -178,6 +205,17 @@ export default {
this.loading = false;
});
},
+ /**查询资源*/
+ getResource(){
+ getResourcePage({
+ pageNo: 1,
+ pageSize: 10,
+ name: null,
+ }).then(res=>{
+ this.resourceList = res.data.list;
+ })
+ },
+
/** 取消按钮 */
cancel() {
this.open = false;
@@ -229,11 +267,15 @@ export default {
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
+ console.log(this.form.resources);
+ console.log("sssss");
if (!valid) {
return;
}
+ console.log("22222222222");
// 修改的提交
if (this.form.id != null) {
+ console.log("3333333333")
updateProject(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
@@ -243,6 +285,10 @@ export default {
}
// 添加的提交
createProject(this.form).then(response => {
+ console.log("111111111");
+ this.form.resources = JSON.stringify(this.form.resources);
+ console.log(this.form.getResource);
+ console.log(this.form.resources);
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@@ -276,7 +322,25 @@ export default {
this.$download.excel(response, '${table.classComment}.xls');
this.exportLoading = false;
}).catch(() => {});
+ },
+
+ handleCheckAllChange(val) { //监听全选按钮的变化
+ console.log("全选", val);
+ console.log(this.resourceList);
+ console.log(val = this.resourceList);
+ this.resourceList = val ? this.resourceList : [];
+ this.isIndeterminate = false;
+ },
+ handleFilter(value) { //监听所有数据的被选择情况
+ console.log("AAAAAAAAA");
+ console.log(value);
+ let checkedCount = value.length;
+ this.checkAll = checkedCount === this.resourceList.length;
+ this.isIndeterminate = checkedCount > 0 && checkedCount < this.resourceList.length;
}
+
+
+
}
};