Pārlūkot izejas kodu

地图bug修复

刘浩男 1 gadu atpakaļ
vecāks
revīzija
cbb2dc4481
1 mainītis faili ar 294 papildinājumiem un 268 dzēšanām
  1. 294 268
      data-ui/src/views/data/digitalagriculture/farmland/index.vue

+ 294 - 268
data-ui/src/views/data/digitalagriculture/farmland/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"  @submit.native.prevent>
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" @submit.native.prevent>
       <el-form-item label="地块名称" prop="name">
         <el-input
           v-model="queryParams.name"
@@ -21,8 +21,8 @@
       </el-form-item>
       <el-form-item prop="deptId">
         <template slot="label">
-          <span @click="changeQueryType" v-if="queryParams.deptName == 0">本级及下级</span>
-          <span @click="changeQueryType" v-if="queryParams.deptName == 1">只查询本级</span>
+          <span @click="changeQueryType" v-if="queryParams.deptName === 0">本级及下级</span>
+          <span @click="changeQueryType" v-if="queryParams.deptName === 1">只查询本级</span>
         </template>
         <treeselect v-model="queryParams.deptId" :options="deptOptions" multiple:false :show-count="true"
                     placeholder="请选择部门" @select="hx" :noResultsText="'空'" :noOptionsText="'空'" style="width: 240px"/>
@@ -157,7 +157,8 @@
               <el-input v-model="form.supermapCode" placeholder="请输入地图编码" maxlength="20"/>
             </el-form-item>
             <el-form-item label="面积(单位㎡)" prop="area">
-              <el-input v-model="form.area" placeholder="请输入面积" onkeyup="this.value=this.value.replace(/[^\d.]/g,'');"  maxlength="20"/>
+              <el-input v-model="form.area" placeholder="请输入面积"
+                        onkeyup="this.value=this.value.replace(/[^\d.]/g,'');" maxlength="20"/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -180,7 +181,7 @@
                 ></el-option>
               </el-select>
             </el-form-item>
-            <el-form-item label="所属部门" prop="deptId"  class="form-style">
+            <el-form-item label="所属部门" prop="deptId" class="form-style">
               <deptselector :setValue=setDataDeptId :dataDeptId="form.deptId"></deptselector>
             </el-form-item>
           </el-col>
@@ -192,8 +193,10 @@
       </div>
     </el-dialog>
     <!-- 添加区域标记 -->
-    <el-dialog :title="titleLongitude":visible.sync="regionalFlagOpen" width="1000px" >
-      <areaSupermap ref="fireAreaSupermap"  v-if="regionalFlagOpen"  style="width: 100%;height:74vh" :mapDiv="'farmlandSuperMap'" :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"  :showAreaLatLng="showAreaLatLng"></areaSupermap>
+    <el-dialog :title="titleLongitude" :visible.sync="regionalFlagOpen" width="1000px">
+      <areaSupermap ref="fireAreaSupermap" v-if="regionalFlagOpen" style="width: 100%;height:74vh"
+                    :mapDiv="'farmlandSuperMap'" :mapSite="{doubleClickZoom:false}" :codes="['9fa5']"
+                    :isSideBySide="false" :showAreaLatLng="showAreaLatLng"></areaSupermap>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitRegionalFlag">确 定</el-button>
         <el-button @click="cancelRegionalFlag">取 消</el-button>
@@ -203,269 +206,292 @@
 </template>
 
 <script>
-    import {
-        listFarmland,
-        getFarmland,
-        delFarmland,
-        addFarmland,
-        updateFarmland
-    } from "@/api/data/digitalagriculture/farmland/farmland";
-    import deptselector from '@/views/components/deptselector'
-    import areaSupermap from '@/views/components/supermap'
+import {
+  listFarmland,
+  getFarmland,
+  delFarmland,
+  addFarmland,
+  updateFarmland
+} from "@/api/data/digitalagriculture/farmland/farmland";
+import deptselector from '@/views/components/deptselector'
+import areaSupermap from '@/views/components/supermap'
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {
+  addRegionalFlag,
+  getRegionalFlag,
+  delRegionalFlag
+} from "@/api/data/digitalresources/info";
+import {format_date} from "@/views/data/common/dateExport";
+import {treeselect} from "@/api/system/dept";
+import {getSysUserList} from "@/api/data/digitalwater/task";
 
-    import {addRegionalFlag,
-        getRegionalFlag,
-        delRegionalFlag } from "@/api/data/digitalresources/info";
-    import {format_date} from "@/views/data/common/dateExport";
+export default {
+  components: {deptselector, areaSupermap,Treeselect},
+  name: "Farmland",
+  dicts: ['farm_field_attribute', 'sys_normal_disable'],
 
-    export default {
-        components: {deptselector,areaSupermap},
-        name: "Farmland",
-        dicts: ['farm_field_attribute', 'sys_normal_disable'],
+  data() {
+    return {
+      //区域标记
+      regionalFlagObj: {
+        eventId: null,
+        array: [],
+        type: '2',
+      },
+      regionalFlagOpen: false,
 
-        data() {
-            return {
-                //区域标记
-                regionalFlagObj:{
-                    eventId:null,
-                    array:[],
-                    type:'2',
-                },
-              regionalFlagOpen:false,
-
-              titleLongitude:'永久基本农田管理区域标记',
-                // 遮罩层
-                loading: true,
-                // 选中数组
-                ids: [],
-                // 非单个禁用
-                single: true,
-                // 非多个禁用
-                multiple: true,
-                // 显示搜索条件
-                showSearch: true,
-                // 总条数
-                total: 0,
-                // 永久基本农田管理表格数据
-                farmlandList: [],
-                // 弹出层标题
-                title: "",
-                // 是否显示弹出层
-                open: false,
-                // 查询参数
-                queryParams: {
-                    pageNum: 1,
-                    pageSize: 10,
-                    name: null,
-                    code: null,
-                    attribute: null,
-                    city: null,
-                    district: null,
-                    village: null,
-                    area: null,
-                    type: null,
-                    supermapCode: null,
-                    createDate: null,
-                    updateDate: null,
-                    remarks: null,
-                    deptId: null,
-                    deptName: 0
-                },
-                // 表单参数
-                form: {},
-                // 表单校验
-                rules: {
-                  name: [
-                    {required: true, message: "地块名称不能为空", trigger: "blur"}
-                  ],
-                  code: [
-                    {required: true, message: "地块编码不能为空", trigger: "blur"}
-                  ],
-                  supermapCode: [
-                    {required: true, message: "地图编码不能为空", trigger: "blur"}
-                  ],
-                  attribute: [
-                    {required: true, message: "地块属性不能为空", trigger: "blur"}
-                  ],
-                  city: [
-                    {required: true, message: "城市不能为空", trigger: "blur"}
-                  ],
-                  type: [
-                    {required: true, message: "状态不能为空", trigger: "blur"}
-                  ],
-                  area: [
-                    {required: true, message: "面积不能为空", trigger: "blur"}
-                  ],
-                  deptId: [
-                    {required: true, message: "所属部门不能为空", trigger: "change"}
-                  ],
-                }
-            };
-        },
-        created() {
-            this.getList();
-        },
-        methods: {
-            showAreaLatLng: function(latlng) {
-                console.log(latlng);
-                this.regionalFlagObj.array = latlng;
-                this.$modal.msgSuccess("获取成功");
-            },
-            showLineLatLng: function(latlng) {
-                // this.form.longitude = latlng
-                alert(latlng)
-            },
-            /** 区域标记按钮操作 */
-            regionalFlagAdd(row){
-                const eventId = row.id;
-                getRegionalFlag(eventId).then(response =>{
-                    console.log(response);
-                    if(response != null && response.length>0){
-                        setTimeout(() => {
-                            this.$refs.fireAreaSupermap.setGraphicsList(response,"red")
-                        }, 1000);
-                        this.regionalFlagObj.array = response;
-                    }else{
-                        this.regionalFlagObj.array = null;
-                    }
-                    this.regionalFlagObj.eventId = eventId;
-                })
-                this.regionalFlagOpen = true;
-                console.log(this.regionalFlagObj)
-            },
-            /** 区域标记取消按钮操作 */
-            cancelRegionalFlag(){
-                this.regionalFlagOpen = false;
-            },
-            /** 区域标记确定按钮操作 */
-            submitRegionalFlag(){
-                delRegionalFlag(this.regionalFlagObj.eventId);
-                addRegionalFlag(this.regionalFlagObj).then(response =>{
-                    this.$modal.msgSuccess("操作成功");
-                    this.regionalFlagOpen = false;
-                });
-            },
-            setDataDeptId(e) {
-                this.form.deptId = e.deptId
-                this.form.deptName = e.deptName
-            },
-            hx(node) {
-
-                this.form.deptId = node.id
-                this.form.deptName = node.label
-            },
-            /** 查询永久基本农田管理列表 */
-            getList() {
-                this.loading = true;
-                listFarmland(this.queryParams).then(response => {
-                    this.farmlandList = response.rows;
-                    this.total = response.total;
-                    this.loading = false;
-                });
-            },
-            // 取消按钮
-            cancel() {
-                this.open = false;
-                this.reset();
-            },
-            // 表单重置
-            reset() {
-                this.form = {
-                    id: null,
-                    name: null,
-                    code: null,
-                    attribute: null,
-                    city: null,
-                    district: null,
-                    village: null,
-                    area: null,
-                    type: null,
-                    supermapCode: null,
-                    createBy: null,
-                    createDate: null,
-                    updateBy: null,
-                    updateDate: null,
-                    remarks: null,
-                    delFlag: null,
-                    deptId: null,
-                    deptName: null
-                };
-                this.resetForm("form");
-            },
-            /** 搜索按钮操作 */
-            handleQuery() {
-                this.queryParams.pageNum = 1;
-                this.getList();
-            },
-          /** 重置按钮操作 */
-          resetQuery() {
-            this.queryParams.deptName = 0;
-            this.resetForm("queryForm");
-            this.handleQuery();
-          },
-          // 点击按钮修改是否只查询本级部门用户
-          changeQueryType() {
-            this.queryParams.deptName = this.queryParams.deptName == 0 ? 1 : 0;
-          },
-            // 多选框选中数据
-            handleSelectionChange(selection) {
-                this.ids = selection.map(item => item.id)
-                this.single = selection.length !== 1
-                this.multiple = !selection.length
-            },
-            /** 新增按钮操作 */
-            handleAdd() {
-                this.reset();
-                this.open = true;
-                this.title = "添加永久基本农田管理";
-            },
-            /** 修改按钮操作 */
-            handleUpdate(row) {
-                this.reset();
-                const id = row.id || this.ids
-                getFarmland(id).then(response => {
-                    this.form = response.data;
-                    this.open = true;
-                    this.title = "修改永久基本农田管理";
-                });
-            },
-            /** 提交按钮 */
-            submitForm() {
-                this.$refs["form"].validate(valid => {
-                    if (valid) {
-                        if (this.form.id != null) {
-                            updateFarmland(this.form).then(response => {
-                                this.$modal.msgSuccess("修改成功");
-                                this.open = false;
-                                this.getList();
-                            });
-                        } else {
-                            addFarmland(this.form).then(response => {
-                                this.$modal.msgSuccess("新增成功");
-                                this.open = false;
-                                this.getList();
-                            });
-                        }
-                    }
-                });
-            },
-            /** 删除按钮操作 */
-            handleDelete(row) {
-                const ids = row.id || this.ids;
-                this.$modal.confirm('是否确认删除选中的数据项?').then(function () {
-                    return delFarmland(ids);
-                }).then(() => {
-                    this.getList();
-                    this.$modal.msgSuccess("删除成功");
-                }).catch(() => {
-                });
-            },
-            /** 导出按钮操作 */
-            handleExport() {
-                this.download('center-data/farmland/export', {
-                    ...this.queryParams
-                }, `永久基本农田管理_${format_date(new Date())}.xlsx`)
-            }
-        }
+      titleLongitude: '永久基本农田管理区域标记',
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      deptOptions: [],
+      // 永久基本农田管理表格数据
+      farmlandList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        code: null,
+        attribute: null,
+        city: null,
+        district: null,
+        village: null,
+        area: null,
+        type: null,
+        supermapCode: null,
+        createDate: null,
+        updateDate: null,
+        remarks: null,
+        deptId: null,
+        deptName: 0
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        name: [
+          {required: true, message: "地块名称不能为空", trigger: "blur"}
+        ],
+        code: [
+          {required: true, message: "地块编码不能为空", trigger: "blur"}
+        ],
+        supermapCode: [
+          {required: true, message: "地图编码不能为空", trigger: "blur"}
+        ],
+        attribute: [
+          {required: true, message: "地块属性不能为空", trigger: "blur"}
+        ],
+        city: [
+          {required: true, message: "城市不能为空", trigger: "blur"}
+        ],
+        type: [
+          {required: true, message: "状态不能为空", trigger: "blur"}
+        ],
+        area: [
+          {required: true, message: "面积不能为空", trigger: "blur"}
+        ],
+        deptId: [
+          {required: true, message: "所属部门不能为空", trigger: "change"}
+        ],
+      }
     };
+  },
+  created() {
+    this.getList();
+    this.getTreeselect();
+  },
+  methods: {
+    showAreaLatLng: function (latlng) {
+      console.log(latlng);
+      this.regionalFlagObj.array = latlng;
+      this.$modal.msgSuccess("获取成功");
+    },
+    showLineLatLng: function (latlng) {
+      // this.form.longitude = latlng
+      alert(latlng)
+    },
+    /** 区域标记按钮操作 */
+    regionalFlagAdd(row) {
+      const eventId = row.id;
+      getRegionalFlag(eventId).then(response => {
+        console.log(response);
+        if (response != null && response.length > 0) {
+          setTimeout(() => {
+            this.$refs.fireAreaSupermap.setGraphicsList(response, "red")
+          }, 1000);
+          this.regionalFlagObj.array = response;
+        } else {
+          this.regionalFlagObj.array = null;
+        }
+        this.regionalFlagObj.eventId = eventId;
+      })
+      this.regionalFlagOpen = true;
+      console.log(this.regionalFlagObj)
+    },
+    /** 区域标记取消按钮操作 */
+    cancelRegionalFlag() {
+      this.regionalFlagOpen = false;
+    },
+    /** 区域标记确定按钮操作 */
+    submitRegionalFlag() {
+      delRegionalFlag(this.regionalFlagObj.eventId);
+      addRegionalFlag(this.regionalFlagObj).then(response => {
+        this.$modal.msgSuccess("操作成功");
+        this.regionalFlagOpen = false;
+      });
+    },
+    hx(node) {
+      this.form.dataDeptId = node.id
+      this.form.deptId = node.id
+      this.form.deptName = node.label
+      this.$refs.form.validateField("deptId")
+    },
+    setDataDeptId(e) {
+      this.form.deptId = e.deptId;
+      this.form.deptName = e.deptName;
+      if (e.deptId !== '') {
+        this.getSysUserList(e.deptId)
+      }
+    },
+    getSysUserList(deptId) {
+      const params = Object.assign({})
+      params.deptId = deptId
+      getSysUserList(params).then(response => {
+        this.userList = response.data;
+      })
+    },
+    getTreeselect() {
+      treeselect().then(response => {
+        this.deptOptions = response.data
+      })
+    },
+    /** 查询永久基本农田管理列表 */
+    getList() {
+      this.loading = true;
+      listFarmland(this.queryParams).then(response => {
+        this.farmlandList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        name: null,
+        code: null,
+        attribute: null,
+        city: null,
+        district: null,
+        village: null,
+        area: null,
+        type: null,
+        supermapCode: null,
+        createBy: null,
+        createDate: null,
+        updateBy: null,
+        updateDate: null,
+        remarks: null,
+        delFlag: null,
+        deptId: null,
+        deptName: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams.deptName = 0;
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 点击按钮修改是否只查询本级部门用户
+    changeQueryType() {
+      this.queryParams.deptName = this.queryParams.deptName == 0 ? 1 : 0;
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加永久基本农田管理";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getFarmland(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改永久基本农田管理";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateFarmland(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addFarmland(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除选中的数据项?').then(function () {
+        return delFarmland(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('center-data/farmland/export', {
+        ...this.queryParams
+      }, `永久基本农田管理_${format_date(new Date())}.xlsx`)
+    }
+  }
+};
 </script>