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 @@ + + + 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 @@ - - - - - - + + + + + + + + - + - - + + @@ -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; } + + + } };