3 files modified
3 files added
| New file |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/farmPaper/page', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/api/farmPaper/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const save = (row) => { |
| | | return request({ |
| | | url: '/api/farmPaper/save', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/api/farmPaper/update', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const getDetail = (id) => { |
| | | return request({ |
| | | url: '/api/farmPaper/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/land/land/list', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | return request({ |
| | | url: '/api/land/land/list', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const getDetail = (id) => { |
| | | return request({ |
| | | url: '/api/land/land/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | return request({ |
| | | url: '/api/land/land/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/api/land/land/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | return request({ |
| | | url: '/api/land/land/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/api/land/land/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | return request({ |
| | | url: '/api/land/land/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/api/land/land/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | return request({ |
| | | url: '/api/land/land/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | |
| | | </basic-container> |
| | | </el-tab-pane> |
| | | <!-- 检测报告信息 --> |
| | | <el-tab-pane :label="tab2label" name="tab2"> </el-tab-pane> |
| | | <el-tab-pane label="检测报告信息" name="tab2"> |
| | | <farmReport |
| | | :farmId="farmId" |
| | | ></farmReport> |
| | | </el-tab-pane> |
| | | <!-- 认证证书信息 --> |
| | | <el-tab-pane label="认证证书信息" name="tab3"> |
| | | <farmPaper |
| | | :farmId="farmId" |
| | | ></farmPaper> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import getMapDataInThere from "./getMapDataInThere.vue"; |
| | | import farmPaper from "./farmPaper.vue"; |
| | | import farmReport from "./farmReport.vue"; |
| | | import { update, getDetails } from "@/api/farm/farm"; |
| | | // import manager from "./manager.vue"; |
| | | import { mapGetters } from "vuex"; |
| | | |
| | | export default { |
| | | components: { |
| | | getMapDataInThere, |
| | | farmPaper, |
| | | farmReport |
| | | }, |
| | | data() { |
| | | return { |
| | | tab2label: "检测报告/认证证书信息", |
| | | farmId:"", |
| | | activeName: "tab1", |
| | | objBase: {}, |
| | | optionBase: { |
| | |
| | | label: "农场环境图片", |
| | | prop: "picture", |
| | | type: "upload", |
| | | listType: "picture-img", |
| | | labelWidth: 145, |
| | | dataType: "string", |
| | | span: 24, |
| | | propsHttp: { |
| | | res: "data", |
| | | }, |
| | | limit: 5, |
| | | listType: "picture-card", |
| | | tip: "建议上传手机横屏拍摄的照片,宽高比16:9,最多上传5张", |
| | | canvasOption: { |
| | | text: "", |
| | | ratio: 1.0, |
| | | }, |
| | | labelWidth: 145, |
| | | tip: "只能上传jpg/png格式图片,且不超过2Mb", |
| | | action: "/api/blade-resource/oss/endpoint/put-files", |
| | | disabled: false, |
| | | propsHttp: { |
| | | res: "data", |
| | | url: "url" |
| | | }, |
| | | action: "/api/blade-resource/oss/endpoint/put-file" |
| | | }, |
| | | { |
| | | label: "农场位置", |
| | |
| | | getDetails(this.userInfo.user_id).then((res) => { |
| | | if (res.data.code == 200) { |
| | | that.objBase = res.data.data; |
| | | that.farmId = that.objBase.id; |
| | | let usePolygons = that.objBase.position |
| | | .split("POLYGON((")[1] |
| | | .split("))")[0] |
| New file |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | ref="crud" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | @click="handleDelete" |
| | | >删 除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDetail, getList, update, remove, save } from "@/api/farm/farmPaper"; |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | props: ["farmId"], |
| | | data() { |
| | | return { |
| | | visible: true, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | excelBox: false, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | selectionList: [], |
| | | option: { |
| | | tip: false, |
| | | searchSize: "mini", |
| | | searchMenuSpan: 8, |
| | | height: "auto", |
| | | editBtn: true, |
| | | delBtn: true, |
| | | viewBtn: true, |
| | | menuWidth: 200, |
| | | menuAlign: "center", |
| | | align: "center", |
| | | selection: true, |
| | | column: [ |
| | | { |
| | | label: "证书名称", |
| | | prop: "name", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入证书名称", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "颁证机构", |
| | | prop: "organName", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入颁证机构", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "证书编号", |
| | | prop: "code", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入证书编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "颁证日期", |
| | | prop: "time", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择颁证日期", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "证书图片", |
| | | prop: "pictures", |
| | | type: "upload", |
| | | dataType: "string", |
| | | span: 24, |
| | | limit: 3, |
| | | listType: "picture-card", |
| | | tip: "只能上传jpg/png文件,最多上传3张", |
| | | propsHttp: { |
| | | res: "data", |
| | | url: "url" |
| | | }, |
| | | action: "/api/blade-resource/oss/endpoint/put-file" |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | }; |
| | | }, |
| | | created() {}, |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | // permissionList() { |
| | | // return { |
| | | // addBtn: this.vaildData(this.permission.social_add, true), |
| | | // viewBtn: this.vaildData(this.permission.social_view, false), |
| | | // delBtn: this.vaildData(this.permission.social_delete, false), |
| | | // editBtn: this.vaildData(this.permission.social_edit, false), |
| | | // }; |
| | | // }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | }, |
| | | mounted() {}, |
| | | methods: { |
| | | //新增 |
| | | rowSave(row, done, loading) { |
| | | row["farmId"] = this.farmId; |
| | | row["type"] = 2; |
| | | save(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | loading(); |
| | | window.console.log(error); |
| | | } |
| | | ); |
| | | }, |
| | | //修改 |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | loading(); |
| | | console.log(error); |
| | | } |
| | | ); |
| | | }, |
| | | //删除 |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | }); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then((res) => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | params['type'] = 2; |
| | | params['farmId'] = this.farmId; |
| | | this.loading = true; |
| | | getList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query) |
| | | ).then((res) => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| New file |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | ref="crud" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | @click="handleDelete" |
| | | >删 除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDetail, getList, update, remove, save } from "@/api/farm/farmPaper"; |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | props: ["farmId"], |
| | | data() { |
| | | return { |
| | | visible: true, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | excelBox: false, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | selectionList: [], |
| | | option: { |
| | | tip: false, |
| | | searchSize: "mini", |
| | | searchMenuSpan: 8, |
| | | height: "auto", |
| | | editBtn: true, |
| | | delBtn: true, |
| | | viewBtn: true, |
| | | menuWidth: 200, |
| | | menuAlign: "center", |
| | | align: "center", |
| | | selection: true, |
| | | column: [ |
| | | { |
| | | label: "检测项目", |
| | | prop: "name", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入检测项目", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "检测机构", |
| | | prop: "organName", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入检测机构", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "报告编号", |
| | | prop: "code", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入报告编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "颁发日期", |
| | | prop: "time", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择颁发日期", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "报告图片", |
| | | prop: "pictures", |
| | | type: "upload", |
| | | dataType: "string", |
| | | span: 24, |
| | | limit: 3, |
| | | listType: "picture-card", |
| | | tip: "只能上传jpg/png文件,最多上传3张", |
| | | propsHttp: { |
| | | res: "data", |
| | | url: "url" |
| | | }, |
| | | action: "/api/blade-resource/oss/endpoint/put-file" |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | }; |
| | | }, |
| | | created() {}, |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | // permissionList() { |
| | | // return { |
| | | // addBtn: this.vaildData(this.permission.social_add, true), |
| | | // viewBtn: this.vaildData(this.permission.social_view, false), |
| | | // delBtn: this.vaildData(this.permission.social_delete, false), |
| | | // editBtn: this.vaildData(this.permission.social_edit, false), |
| | | // }; |
| | | // }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | }, |
| | | mounted() {}, |
| | | methods: { |
| | | //新增 |
| | | rowSave(row, done, loading) { |
| | | row["farmId"] = this.farmId; |
| | | row["type"] = 1; |
| | | save(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | loading(); |
| | | window.console.log(error); |
| | | } |
| | | ); |
| | | }, |
| | | //修改 |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | loading(); |
| | | console.log(error); |
| | | } |
| | | ); |
| | | }, |
| | | //删除 |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | }); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then((res) => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | params['type'] = 1; |
| | | params['farmId'] = this.farmId; |
| | | getList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query) |
| | | ).then((res) => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | ref="crud" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad"> |
| | | <avue-crud |
| | | class="tablesss" |
| | | :before-open="beforeOpen" |
| | | :option="option" |
| | | :data="data" |
| | | :page.sync="page" |
| | | v-model="form" |
| | | ref="crud" |
| | | :permission="permissionList" |
| | | @on-load="onLoad" |
| | | :table-loading="loading" |
| | | @row-save="rowSave" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @row-update="rowUpdate" |
| | | @row-del="rowDel" |
| | | @selection-change="selectionChange" |
| | | @refresh-change="refreshChange" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | v-if="permission.land_delete" |
| | | @click="handleDelete">删 除 |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | plain |
| | | icon="el-icon-delete" |
| | | v-if="permission.rail_delete" |
| | | @click="handleDelete" |
| | | >删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{}" slot="position"> |
| | | <!-- 地图插入 --> |
| | | <template slot-scope="{ type, disabled }" slot="lineForm"> |
| | | <getMapDataInThere |
| | | ref="getMapData" |
| | | id="getMapData" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {getList, getDetail, add, update, remove} from "@/api/land/land"; |
| | | import {mapGetters} from "vuex"; |
| | | import { getList, add, update, remove, getRailTree } from "@/api/land/land"; |
| | | import getMapDataInThere from "./getMapDataInThere.vue"; |
| | | |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | components: { |
| | | getMapDataInThere, |
| | | getMapDataInThere |
| | | }, |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | selectionList: [], |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | form: {}, |
| | | query: {}, |
| | | data: [], |
| | | option: { |
| | | height: 'auto', |
| | | calcHeight: 30, |
| | | index: true, |
| | | tip: false, |
| | | searchShow: true, |
| | | addBtn: true, |
| | | viewBtn: true, |
| | | searchMenuSpan: 6, |
| | | height: 583, |
| | | menuWidth: 300, |
| | | border: true, |
| | | align: "center", |
| | | addBtn: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | selection: true, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | // { |
| | | // label: "用户id", |
| | | // prop: "userId", |
| | | // rules: [{ |
| | | // required: true, |
| | | // message: "请输入用户id", |
| | | // trigger: "blur" |
| | | // }] |
| | | // }, |
| | | { |
| | | label: "地块名称", |
| | | search: true, |
| | |
| | | span: 5, |
| | | }, |
| | | { |
| | | label: "农场位置", |
| | | prop: "position", |
| | | label: "路线展示", |
| | | labelWidth: "0", |
| | | prop: "line", |
| | | className: "mapClass", |
| | | hide: true, |
| | | display: true, |
| | | span: 24, |
| | | formslot: true, |
| | | labelWidth: 145, |
| | | }, |
| | | ] |
| | | }, |
| | | data: [] |
| | | addDisplay: true |
| | | } |
| | | ], |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | // this.getRailLazyTree(); |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["userInfo", "permission", "polygons"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.land_add, false), |
| | | viewBtn: this.vaildData(this.permission.land_view, false), |
| | | delBtn: this.vaildData(this.permission.land_delete, false), |
| | | editBtn: this.vaildData(this.permission.land_edit, false) |
| | | }; |
| | | }, |
| | | // permissionList() { |
| | | // return { |
| | | // addBtn: this.vaildData(this.permission.rail_add, true), |
| | | // viewBtn: this.vaildData(this.permission.rail_view, false), |
| | | // delBtn: this.vaildData(this.permission.rail_delete, false), |
| | | // editBtn: this.vaildData(this.permission.rail_edit, false) |
| | | // }; |
| | | // }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | mounted() { |
| | | }, |
| | | methods: { |
| | | rowSave(row, done, loading) { |
| | | add(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | beforeOpen(done, type) { |
| | | if (type == "edit") { |
| | | // this.$refs.getMapData.doThat(this.polygons); |
| | | done(); |
| | | }, error => { |
| | | } else if (type == "add") { |
| | | this.$store.commit("setpolygon", []); //用vuex传最终数据 |
| | | done(); |
| | | } |
| | | }, |
| | | setMapData(val) { |
| | | this.LineData = val[0]; |
| | | this.PointData = val[1]; |
| | | }, |
| | | //dom获取、 |
| | | checkDom(name, fn) { |
| | | // 声明定时器 |
| | | let that = this; |
| | | var timer = null; |
| | | // 检查dom是否执行完成 |
| | | function checkDom() { |
| | | let dom = that.$refs[name]; |
| | | if (dom) { |
| | | // 执行dom加载完成后的操作 |
| | | // 清除定时器 |
| | | if (!timer) { |
| | | clearTimeout(timer); |
| | | } |
| | | if (fn) { |
| | | //回调函数 |
| | | fn(dom); |
| | | return; |
| | | } else { |
| | | return dom; |
| | | } |
| | | } else { |
| | | // 自我调用 |
| | | timer = setTimeout(checkDom, 100); |
| | | } |
| | | } |
| | | // 首次执行 |
| | | checkDom(); |
| | | }, |
| | | sizeChange(val) { |
| | | this.page1.currentPage = 1; |
| | | this.page1.pageSize = val; |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | currentChange(val) { |
| | | this.page1.currentPage = val; |
| | | // this.getData(); |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | rowSave(form, done, loading) { |
| | | if (this.polygons.length == 0) { |
| | | //没有面的数据 |
| | | this.$refs.getMapData.isCheck = true; |
| | | loading(); |
| | | window.console.log(error); |
| | | return; |
| | | } |
| | | let pol = this.polygons; |
| | | // console.log(pol); |
| | | let polLength = this.polygons.length - 1; |
| | | let usePolygons = ""; |
| | | for (let k in pol) { |
| | | usePolygons += pol[k].lng + "," + pol[k].lat; |
| | | if (k != polLength) { |
| | | usePolygons += ";"; |
| | | } |
| | | } |
| | | // console.log(form); |
| | | let data = { |
| | | name: form.name, |
| | | type: form.type, |
| | | companyId: form.companyId, |
| | | coordinate: usePolygons |
| | | }; |
| | | // return; |
| | | add(data).then(res => { |
| | | if (res.data.success) { |
| | | this.$message({ |
| | | message: "操作成功", |
| | | type: "success" |
| | | }); |
| | | this.refreshChange(); |
| | | done(); |
| | | } else { |
| | | this.$message({ |
| | | message: "操作失败", |
| | | type: "warning" |
| | | }); |
| | | done(); |
| | | } |
| | | }); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | if (this.polygons.length == 0) { |
| | | //没有面的数据 |
| | | this.$refs.getMapData.isCheck = true; |
| | | loading(); |
| | | console.log(error); |
| | | }); |
| | | return; |
| | | } |
| | | let pol = this.polygons; |
| | | // console.log(pol); |
| | | let polLength = this.polygons.length - 1; |
| | | let usePolygons = ""; |
| | | for (let k in pol) { |
| | | usePolygons += pol[k].lng + "," + pol[k].lat; |
| | | if (k != polLength) { |
| | | usePolygons += ";"; |
| | | } |
| | | } |
| | | row.coordinate = usePolygons; |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | this.$confirm("确定删除当前合同信息数据?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | console.log(row); |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | this.$confirm("确定批量将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | return remove(this.ids).then(res => { |
| | | this.refreshChange(); |
| | | }); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | if (type == "add") { |
| | | this.$store.commit("setpolygon", []); //用vuex传最终数据 |
| | | done(); |
| | | } |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | this.$refs.crudrec.toggleSelection(); |
| | | }) |
| | | .catch(res => {}); |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | getList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query) |
| | | ).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | setMapData(val) { |
| | | this.LineData = val[0]; |
| | | this.PointData = val[1]; |
| | | }, |
| | | |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | <style lang="scss"> |
| | | |
| | | .mapClass div label { |
| | | display: none; |
| | | } |
| | | |
| | | .mapClassMain { |
| | | padding-left: 5rem !important; |
| | | } |
| | | |
| | | |
| | | #getMapData { |
| | | width: 80%; |
| | | width: calc(100% + 90px); |
| | | position: relative; |
| | | height: 500px; |
| | | top: 10px; |
| | | left: -90px; |
| | | height: 400px; |
| | | } |
| | | </style> |