管理系统PC端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.vue 49 KiB

3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
  5. <!--部门数据-->
  6. <pane size="16">
  7. <el-col>
  8. <div class="head-container">
  9. <el-input v-model="deptName" placeholder="请输入区划名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
  10. </div>
  11. <div class="head-container container_main">
  12. <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
  13. </div>
  14. </el-col>
  15. </pane>
  16. <!--用户数据-->
  17. <pane size="84">
  18. <el-col>
  19. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  20. <el-form-item label="地块代码" prop="dkbm">
  21. <el-input v-model="queryParams.dkbm" placeholder="请输入地块代码" clearable @keyup.enter.native="handleQuery"/>
  22. </el-form-item>
  23. <el-form-item label="地块名称" prop="dkmc">
  24. <el-input v-model="queryParams.dkmc" placeholder="请输入地块名称" clearable @keyup.enter.native="handleQuery"/>
  25. </el-form-item>
  26. <el-form-item label="权属性质" prop="syqxz">
  27. <el-select v-model="queryParams.syqxz" placeholder="请选择所有权性质" clearable>
  28. <el-option v-for="dict in dict.type.ownership_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="地块类别" prop="dklb">
  32. <el-select v-model="queryParams.dklb" placeholder="请选择地块类别" clearable>
  33. <el-option v-for="dict in dict.type.land_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="利用类型" prop="tdlylx">
  37. <el-select v-model="queryParams.tdlylx" placeholder="请选择土地利用类型" clearable>
  38. <el-option v-for="dict in dict.type.land_use" :key="dict.value" :label="dict.label" :value="dict.value"/>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="地力等级" prop="dldj">
  42. <el-select v-model="queryParams.dldj" placeholder="请选择地力等级" clearable>
  43. <el-option v-for="dict in dict.type.land_grade_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="土地用途" prop="tdyt">
  47. <el-select v-model="queryParams.tdyt" placeholder="请选择土地用途" clearable>
  48. <el-option v-for="dict in dict.type.land_use_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="基本农田" prop="sfjbnt">
  52. <el-select v-model="queryParams.sfjbnt" placeholder="请选择是否基本农田" clearable>
  53. <el-option v-for="dict in dict.type.is_common" :key="dict.value" :label="dict.label" :value="dict.value"/>
  54. </el-select>
  55. </el-form-item>
  56. <!--<el-form-item label="是账外地" prop="sfzwd">
  57. <el-select v-model="queryParams.sfzwd" placeholder="请选择是否账外地" clearable>
  58. <el-option v-for="dict in dict.type.is_common" :key="dict.value" :label="dict.label" :value="dict.value"/>
  59. </el-select>
  60. </el-form-item>-->
  61. <el-form-item label="调查状态" prop="surveyStatus">
  62. <el-select v-model="queryParams.surveyStatus" placeholder="请选择调查状态" clearable>
  63. <el-option v-for="dict in dict.type.survey_status" :key="dict.value" :label="dict.label" :value="dict.value"/>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item>
  67. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  68. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  69. </el-form-item>
  70. </el-form>
  71. <el-row :gutter="10" class="mb8">
  72. <el-col :span="1.5">
  73. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['resource:land:add']">新增</el-button>
  74. </el-col>
  75. <!--
  76. <el-col :span="1.5">
  77. <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['resource:land:edit']">修改</el-button>
  78. </el-col>
  79. <el-col :span="1.5">
  80. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['resource:land:remove']">删除</el-button>
  81. </el-col>
  82. -->
  83. <el-col :span="1.5">
  84. <el-button type="success" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['resource:land:import']">导入</el-button>
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['resource:land:export']">导出</el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button type="info" plain icon="el-icon-printer" size="mini" @click="handlePrint()" v-hasPermi="['resource:land:print']">打印</el-button>
  91. </el-col>
  92. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  93. </el-row>
  94. <!-- 数据列表 列属性 min-width="60" show-overflow-tooltip @selection-change="handleSelectionChange" -->
  95. <el-table v-loading="loading" :data="landList" border>
  96. <!--<el-table-column type="selection" width="55" align="center" />
  97. <el-table-column label="fid " align="center" prop="fid" min-width="60"/>-->
  98. <el-table-column label="地块代码" align="center" prop="dkbm" min-width="180" show-overflow-tooltip />
  99. <el-table-column label="地块名称" align="left" prop="dkmc" min-width="120" show-overflow-tooltip />
  100. <!-- <el-table-column label="所有权性质" align="center" prop="syqxz">
  101. <template slot-scope="scope">
  102. <dict-tag :options="dict.type.ownership_type" :value="scope.row.syqxz"/>
  103. </template>
  104. </el-table-column>-->
  105. <el-table-column label="地块类别" align="center" prop="dklb" min-width="80" show-overflow-tooltip>
  106. <template slot-scope="scope">
  107. <dict-tag :options="dict.type.land_type" :value="scope.row.dklb"/>
  108. </template>
  109. </el-table-column>
  110. <!--<el-table-column label="土地利用类型" align="center" prop="tdlylx">
  111. <template slot-scope="scope">
  112. <dict-tag :options="dict.type.land_use" :value="scope.row.tdlylx"/>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="地力等级" align="center" prop="dldj">
  116. <template slot-scope="scope">
  117. <dict-tag :options="dict.type.land_grade_type" :value="scope.row.dldj"/>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="土地用途" align="center" prop="tdyt">
  121. <template slot-scope="scope">
  122. <dict-tag :options="dict.type.land_use_type" :value="scope.row.tdyt"/>
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="是否基本农田" align="center" prop="sfjbnt">
  126. <template slot-scope="scope">
  127. <dict-tag :options="dict.type.is_common" :value="scope.row.sfjbnt"/>
  128. </template>
  129. </el-table-column>-->
  130. <el-table-column label="地块四至" align="center">
  131. <el-table-column label="地块东至" align="left" prop="dkdz" min-width="100" show-overflow-tooltip />
  132. <el-table-column label="地块西至" align="left" prop="dkxz" min-width="100" show-overflow-tooltip />
  133. <el-table-column label="地块南至" align="left" prop="dknz" min-width="100" show-overflow-tooltip />
  134. <el-table-column label="地块北至" align="left" prop="dkbz" min-width="100" show-overflow-tooltip />
  135. </el-table-column>
  136. <!--<el-table-column label="备注信息" align="center" prop="dkbzxx" />
  137. <el-table-column label="指界人姓名" align="center" prop="zjrxm" />
  138. <el-table-column label="图显面积 " align="center" prop="txmj" />-->
  139. <el-table-column label="实测面积" align="center" prop="scmjm" min-width="80" show-overflow-tooltip/>
  140. <el-table-column label="调查状态" align="center" prop="surveyStatus" min-width="80" show-overflow-tooltip>
  141. <template slot-scope="scope">
  142. <dict-tag :options="dict.type.survey_status" :value="scope.row.surveyStatus"/>
  143. </template>
  144. </el-table-column>
  145. <!--<el-table-column label="部门级联代码" align="center" prop="importCode" />
  146. <el-table-column label="区域位置名称" align="center" prop="deptName" />-->
  147. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="170">
  148. <template slot-scope="scope">
  149. <el-button size="mini" type="text" icon="el-icon-view" @click="handleLook(scope.row)" v-hasPermi="['resource:land:query']">查看</el-button>
  150. <el-button size="mini" type="text" icon="el-icon-s-promotion" @click="handleMap(scope.row)" v-hasPermi="['resource:land:map']">地图</el-button>
  151. <el-dropdown size="mini" v-hasPermi="['resource:land:remove']">
  152. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  153. <el-dropdown-menu slot="dropdown" style="padding: 5px">
  154. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['resource:land:edit']">修改</el-button>
  155. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['resource:land:remove']">删除</el-button>
  156. </el-dropdown-menu>
  157. </el-dropdown>
  158. </template>
  159. </el-table-column>
  160. </el-table>
  161. <!-- 分页插件 -->
  162. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
  163. </el-col>
  164. </pane>
  165. </splitpanes>
  166. </el-row>
  167. <!-- 导入EXCEL组件 -->
  168. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  169. <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  170. <i class="el-icon-upload"></i>
  171. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  172. <div class="el-upload__tip text-left" slot="tip">
  173. <div class="el-upload__tip" slot="tip">
  174. <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的地块属性
  175. </div>
  176. <p style="color: red">1、仅允许导入xls、xlsx格式文件;</p>
  177. <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
  178. </div>
  179. </el-upload>
  180. <div slot="footer" class="dialog-footer">
  181. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  182. <el-button @click="upload.open = false">取 消</el-button>
  183. </div>
  184. </el-dialog>
  185. <!-- 查看地块属性对话框 -->
  186. <el-dialog :title="title" :visible.sync="viewOpen" width="800px" append-to-body>
  187. <el-descriptions title="地块信息" border :column="2" class="margin-top">
  188. <el-descriptions-item label="区域位置名称">{{ form.deptName }}</el-descriptions-item>
  189. <el-descriptions-item label="标识码">{{ form.bsm }}</el-descriptions-item>
  190. <el-descriptions-item label="要素代码">{{ form.ysdm }}</el-descriptions-item>
  191. <el-descriptions-item label="地块代码">{{ form.dkbm }}</el-descriptions-item>
  192. <el-descriptions-item label="地块名称">{{ form.dkmc }}</el-descriptions-item>
  193. <el-descriptions-item label="所有权性质">{{ form.syqxz }}</el-descriptions-item>
  194. <el-descriptions-item label="地块类别">{{ form.dklb }}</el-descriptions-item>
  195. <el-descriptions-item label="土地利用类型">{{ form.tdlylx }}</el-descriptions-item>
  196. <el-descriptions-item label="地力等级">{{ form.dldj }}</el-descriptions-item>
  197. <el-descriptions-item label="土地用途">{{ form.tdyt }}</el-descriptions-item>
  198. <el-descriptions-item label="是否基本农田">{{ form.sfjbnt }}</el-descriptions-item>
  199. <el-descriptions-item label="地块东至">{{ form.dkdz }}</el-descriptions-item>
  200. <el-descriptions-item label="地块西至">{{ form.dkxz }}</el-descriptions-item>
  201. <el-descriptions-item label="地块南至">{{ form.dknz }}</el-descriptions-item>
  202. <el-descriptions-item label="地块北至">{{ form.dkbz }}</el-descriptions-item>
  203. <el-descriptions-item label="备注信息">{{ form.dkbzxx }}</el-descriptions-item>
  204. <el-descriptions-item label="指界人姓名">{{ form.zjrxm }}</el-descriptions-item>
  205. <el-descriptions-item label="图显面积">{{ form.txmj }}</el-descriptions-item>
  206. <el-descriptions-item label="实测面积">{{ form.scmjm }}</el-descriptions-item>
  207. <el-descriptions-item label="是否账外地">{{ form.sfzwd }}</el-descriptions-item>
  208. </el-descriptions>
  209. <el-descriptions title="经营数据" border :column="2" class="margin-top">
  210. <el-descriptions-item label="经营面积(亩)">{{ form.jymj }}</el-descriptions-item>
  211. <el-descriptions-item label="经营方式">{{ form.jyfs }}</el-descriptions-item>
  212. <el-descriptions-item label="经营对象类型">{{ form.jydxlx }}</el-descriptions-item>
  213. <el-descriptions-item label="经营对象名称">{{ form.jydxmc }}</el-descriptions-item>
  214. <el-descriptions-item label="证件类型">{{ form.jydxzjlx }}</el-descriptions-item>
  215. <el-descriptions-item label="证件号码">{{ form.jydxzjhm }}</el-descriptions-item>
  216. <el-descriptions-item label="是否签订合同">{{ form.sfqdht }}</el-descriptions-item>
  217. <el-descriptions-item label="经营开始时间">{{ form.jykssj }}</el-descriptions-item>
  218. <el-descriptions-item label="经营结束时间">{{ form.jyjssj }}</el-descriptions-item>
  219. <el-descriptions-item label="承包金额(元)">{{ form.cbje }}</el-descriptions-item>
  220. <el-descriptions-item label="兑现金额(元)">{{ form.dxje }}</el-descriptions-item>
  221. <el-descriptions-item label="尚欠金额(元)">{{ form.sqje }}</el-descriptions-item>
  222. <el-descriptions-item label="年收益(元)">{{ form.nsy }}</el-descriptions-item>
  223. <el-descriptions-item label="备注">{{ form.bz }}</el-descriptions-item>
  224. <el-descriptions-item label="调查状态">{{ form.surveyStatus }}</el-descriptions-item>
  225. <el-descriptions-item label="实物图">
  226. <div v-if="!!form.dkImg">
  227. <el-tooltip effect="light" :content="item" placement="bottom" v-for="(item, index) in form.dkImg.split(',')" :key="index">
  228. <el-image style="height: 64px; width: 64px; margin: 2px; display: inline-block;" fit="scale-down" :src="baseRoutingUrll + item" :preview-src-list="form.dkImg.split(',').map((x) => baseRoutingUrll + x)"/>
  229. </el-tooltip>
  230. </div>
  231. </el-descriptions-item>
  232. </el-descriptions>
  233. <!-- 弹框操作按钮 -->
  234. <div slot="footer" class="dialog-footer">
  235. <el-button @click="doPrint">打 印</el-button>
  236. <el-button @click="cancelDetail">关 闭</el-button>
  237. </div>
  238. </el-dialog>
  239. <!-- 添加或修改地块属性对话框 -->
  240. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  241. <el-form ref="form" :model="form" :rules="rules" :inline="true" label-width="120px">
  242. <el-form-item label="区域位置" prop="deptName">
  243. <el-input v-model="form.deptName" placeholder="请输入区域位置名称" show-word-limit :maxlength="100"/>
  244. </el-form-item>
  245. <el-form-item label="地块代码" prop="dkbm">
  246. <el-input v-model="form.dkbm" placeholder="地块代码不输入时,系统自动分配" show-word-limit :maxlength="19"/>
  247. </el-form-item>
  248. <el-form-item label="地块名称" prop="dkmc">
  249. <el-input v-model="form.dkmc" placeholder="请输入地块名称" show-word-limit :maxlength="50"/>
  250. </el-form-item>
  251. <el-form-item label="所有权性质" prop="syqxz">
  252. <el-select v-model="form.syqxz" placeholder="请选择所有权性质">
  253. <el-option v-for="dict in dict.type.ownership_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  254. </el-select>
  255. </el-form-item>
  256. <el-form-item label="地块类别" prop="dklb">
  257. <el-select v-model="form.dklb" placeholder="请选择地块类别">
  258. <el-option v-for="dict in dict.type.land_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  259. </el-select>
  260. </el-form-item>
  261. <el-form-item label="土地利用类型" prop="tdlylx">
  262. <el-select v-model="form.tdlylx" placeholder="请选择土地利用类型">
  263. <el-option v-for="dict in dict.type.land_use" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  264. </el-select>
  265. </el-form-item>
  266. <el-form-item label="地力等级" prop="dldj">
  267. <el-select v-model="form.dldj" placeholder="请选择地力等级">
  268. <el-option v-for="dict in dict.type.land_grade_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  269. </el-select>
  270. </el-form-item>
  271. <el-form-item label="土地用途" prop="tdyt">
  272. <el-select v-model="form.tdyt" placeholder="请选择土地用途">
  273. <el-option v-for="dict in dict.type.land_use_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  274. </el-select>
  275. </el-form-item>
  276. <el-form-item label="是否基本农田" prop="sfjbnt">
  277. <el-radio-group v-model="form.sfjbnt">
  278. <el-radio v-for="dict in dict.type.is_common" :key="dict.value" :label="dict.value">{{dict.label}}</el-radio>
  279. </el-radio-group>
  280. </el-form-item>
  281. <el-form-item label="地块东至" prop="dkdz">
  282. <el-input v-model="form.dkdz" placeholder="请输入地块东至" show-word-limit :maxlength="50"/>
  283. </el-form-item>
  284. <el-form-item label="地块西至" prop="dkxz">
  285. <el-input v-model="form.dkxz" placeholder="请输入地块西至" show-word-limit :maxlength="50"/>
  286. </el-form-item>
  287. <el-form-item label="地块南至" prop="dknz">
  288. <el-input v-model="form.dknz" placeholder="请输入地块南至" show-word-limit :maxlength="50"/>
  289. </el-form-item>
  290. <el-form-item label="地块北至" prop="dkbz">
  291. <el-input v-model="form.dkbz" placeholder="请输入地块北至" show-word-limit :maxlength="50"/>
  292. </el-form-item>
  293. <el-form-item label="备注信息" prop="dkbzxx">
  294. <el-input v-model="form.dkbzxx" placeholder="请输入备注信息" show-word-limit :maxlength="254"/>
  295. </el-form-item>
  296. <el-form-item label="指界人姓名" prop="zjrxm">
  297. <el-input v-model="form.zjrxm" placeholder="请输入指界人姓名" show-word-limit :maxlength="100"/>
  298. </el-form-item>
  299. <el-form-item label="图显面积" prop="txmj">
  300. <el-input-number v-model="form.txmj" placeholder="请输入图显面积" controls-position="right" :precision="2"/>
  301. </el-form-item>
  302. <el-form-item label="实测面积" prop="scmjm">
  303. <el-input-number v-model="form.scmjm" placeholder="请输入实测面积" controls-position="right" :precision="3"/>
  304. </el-form-item>
  305. <el-form-item label="是否账外地" prop="sfzwd">
  306. <el-radio-group v-model="form.sfzwd">
  307. <el-radio v-for="dict in dict.type.is_common" :key="dict.value" :label="dict.value">{{dict.label}}</el-radio>
  308. </el-radio-group>
  309. </el-form-item>
  310. <el-form-item label="调查状态" prop="surveyStatus">
  311. <el-radio-group v-model="form.surveyStatus">
  312. <el-radio v-for="dict in dict.type.survey_status" :key="dict.value" :label="dict.value">{{dict.label}}</el-radio>
  313. </el-radio-group>
  314. </el-form-item>
  315. </el-form>
  316. <div slot="footer" class="dialog-footer">
  317. <el-button type="primary" @click="submitForm">确 定</el-button>
  318. <el-button @click="cancel">取 消</el-button>
  319. </div>
  320. </el-dialog>
  321. <!-- 地图对话框 -->
  322. <el-dialog :title="title" :visible.sync="openMap" width="1200px" append-to-body>
  323. <el-divider><h3 class="header-anchor">地图信息:黄色地块表示该地块,青色表示本组织已标记的其他地块</h3></el-divider>
  324. <div id="full-screen-acceptance" style="width: 100%;height:65vh;">
  325. <!--<div id="landMapDiv"></div>-->
  326. <div id="mapWrap"></div>
  327. <div id='land-btn-wrap'>
  328. <el-row>
  329. <input id="drawPolygon" class="ant-btn ant-btn-red" type="button" value="开启画图"/>&nbsp;&nbsp;
  330. <!--<input id="drawRemove" type="button" class="ant-btn ant-btn-red" value="关闭画图"/>&nbsp;&nbsp; -->
  331. <input id="drawReset" type="button" class="ant-btn ant-btn-red" value="还原图层"/>
  332. </el-row>
  333. </div>
  334. </div>
  335. <div slot="footer" class="dialog-footer">
  336. <el-button type="primary" @click="submitFormMap">确 定</el-button>
  337. <el-button type="danger" @click="clearMapLayer">清除图层</el-button>
  338. <el-button @click="cancelMap">关 闭</el-button>
  339. </div>
  340. </el-dialog>
  341. </div>
  342. </template>
  343. <script>
  344. import { listLand, listLandQuery,getLand, getLandDetail, getLandDetailByDkbm, delLand, addLand, updateLand, printLand } from "@/api/resource/land"
  345. import { areaSavePri, cleanSavePri } from "@/api/gis/map"
  346. import { getToken } from "@/utils/auth"
  347. import Treeselect from "@riophae/vue-treeselect";
  348. import { Splitpanes, Pane } from "splitpanes"
  349. import "@riophae/vue-treeselect/dist/vue-treeselect.css"
  350. import "splitpanes/dist/splitpanes.css"
  351. import { deptTreeSelect } from "@/api/system/user"
  352. import {getConfigKey} from "@/api/system/config";
  353. import {getDept, getInfoByImportCode} from "@/api/system/dept";
  354. import $ from "jquery";
  355. export default {
  356. name: "Land",
  357. dicts: ['ownership_type', 'land_use_type', 'survey_status', 'is_common', 'land_grade_type', 'land_type', 'land_use'],
  358. components: { Treeselect, Splitpanes, Pane },
  359. data() {
  360. return {
  361. // 遮罩层
  362. loading: true,
  363. // 导出遮罩层
  364. exportLoading: false,
  365. // 选中数组
  366. ids: [],
  367. // 非单个禁用
  368. single: true,
  369. // 非多个禁用
  370. multiple: true,
  371. // 显示搜索条件
  372. showSearch: true,
  373. // 总条数
  374. total: 0,
  375. // 地块属性表格数据
  376. landList: [],
  377. // 弹出层标题
  378. title: "",
  379. // 是否显示弹出层
  380. open: false,
  381. // 详情组件列数
  382. descColumn: 2,
  383. // 详情组件Label所占百分比, 最大={100 / descColumn}. 内容所占百分比={100 / descColumn - descLabelWidth}
  384. descLabelWidth: 15,
  385. // 对话框显示只读的详情
  386. viewOpen: false,
  387. // 项目路径
  388. baseRoutingUrll: process.env.VUE_APP_BASE_API,
  389. // 所有部门树选项
  390. deptOptions: undefined,
  391. // 过滤掉已禁用部门树选项
  392. enabledDeptOptions: undefined,
  393. // 筛选部门名称
  394. deptName: undefined,
  395. // 选中的部门
  396. selectDeptName: null,
  397. defaultProps: {
  398. children: "children",
  399. label: "label"
  400. },
  401. //地图参数
  402. openMap: false,
  403. mapTheGeomId: null,
  404. mapTheGeom: null,
  405. drawInsert:null,
  406. jingdu: null,
  407. weidu: null,
  408. // 查询参数
  409. queryParams: {
  410. pageNum: 1,
  411. pageSize: 10,
  412. // 查询排序
  413. //orderByColumn: "id",
  414. //isAsc: "desc",
  415. // 翻译字典
  416. //toTranslateDict: "1",
  417. dkbm: null,
  418. dkmc: null,
  419. syqxz: null,
  420. dklb: null,
  421. tdlylx: null,
  422. dldj: null,
  423. tdyt: null,
  424. sfjbnt: null,
  425. surveyStatus: null,
  426. importCode: null,
  427. sfzwd: null,
  428. },
  429. // 表单参数
  430. form: {},
  431. // 表单校验
  432. rules: {
  433. dkmc: [
  434. { required: true, message: "地块名称不能为空", trigger: "blur" }
  435. ],
  436. scmjm: [
  437. { required: true, message: "实测面积不能为空", trigger: "blur" }
  438. ],
  439. },
  440. // EXCEL导入
  441. upload: {
  442. // 是否显示弹出层(用户导入)
  443. open: false,
  444. // 弹出层标题(用户导入)
  445. title: "",
  446. // 是否禁用上传
  447. isUploading: false,
  448. // 是否更新已经存在的用户数据
  449. updateSupport: 0,
  450. // 设置上传的请求头部
  451. headers: { Authorization: "Bearer " + getToken() },
  452. // 上传的地址
  453. url: process.env.VUE_APP_BASE_API + "/resource/land/importData"
  454. },
  455. }
  456. },
  457. watch: {
  458. // 根据名称筛选部门树
  459. deptName(val) {
  460. this.$refs.tree.filter(val)
  461. }
  462. },
  463. created() {
  464. this.getDeptTree()
  465. this.getList()
  466. // 获取geoserver的地址
  467. this.getGeoServerUrl();
  468. // 获取地块图层名称
  469. this.getLandLayerName();
  470. // 获取村边界的图层名称
  471. this.getVillageBorderLayerName();
  472. // 获取当前部门的位置
  473. // this.getCurrentDeptLocation();
  474. },
  475. methods: {
  476. /** 查询地块属性列表 */
  477. getList() {
  478. this.loading = true
  479. listLand(this.queryParams).then(response => {
  480. this.landList = response.rows
  481. this.total = response.total
  482. this.loading = false
  483. })
  484. },
  485. // 取消按钮
  486. cancel() {
  487. this.open = false
  488. this.reset()
  489. },
  490. // 取消地图按钮
  491. cancelMap() {
  492. this.openMap = false;
  493. this.reset();
  494. },
  495. cancelDetail() {
  496. this.viewOpen = false
  497. },
  498. // 表单重置
  499. reset() {
  500. this.form = {
  501. bsm: null,
  502. ysdm: '211011',
  503. dkbm: null,
  504. dkmc: null,
  505. syqxz: '30',
  506. dklb: '22',
  507. tdlylx: '01',
  508. dldj: '01',
  509. tdyt: '1',
  510. sfjbnt: '1',
  511. dkdz: null,
  512. dkxz: null,
  513. dknz: null,
  514. dkbz: null,
  515. dkbzxx: null,
  516. zjrxm: null,
  517. txmj: null,
  518. scmjm: null,
  519. theGeom: null,
  520. surveyStatus: '1',
  521. importCode: null,
  522. deptName: null,
  523. sfzwd: '2'
  524. }
  525. this.resetForm("form")
  526. },
  527. /** 搜索按钮操作 */
  528. handleQuery() {
  529. this.queryParams.pageNum = 1
  530. this.getList()
  531. },
  532. /** 重置按钮操作 */
  533. resetQuery() {
  534. this.resetForm("queryForm")
  535. this.handleQuery()
  536. },
  537. // 多选框选中数据
  538. handleSelectionChange(selection) {
  539. this.ids = selection.map(item => item.fid)
  540. this.single = selection.length!==1
  541. this.multiple = !selection.length
  542. },
  543. /** 新增按钮操作 */
  544. handleAdd() {
  545. if(this.selectDeptName == null || this.selectDeptName == ''){
  546. this.$modal.msgWarning("请先选择村/组行政区划!")
  547. return
  548. }
  549. this.reset()
  550. this.form.deptId = this.queryParams.deptId;
  551. this.form.deptName = this.selectDeptName;
  552. this.open = true
  553. this.title = "添加地块属性"
  554. },
  555. /** 修改按钮操作 */
  556. handleUpdate(row) {
  557. this.reset()
  558. const fid = row.fid || this.ids
  559. getLand(fid).then(response => {
  560. this.form = response.data
  561. this.open = true
  562. this.title = "修改地块属性"
  563. })
  564. },
  565. /** 查看按钮操作 */
  566. handleLook(row) {
  567. getLandDetailByDkbm(row.dkbm).then(response => {
  568. this.form = response.data;
  569. this.viewOpen = true;
  570. this.title = "查看地块属性";
  571. });
  572. },
  573. /** 提交按钮 */
  574. submitForm() {
  575. this.$refs["form"].validate(valid => {
  576. if (valid) {
  577. if (this.form.fid != null) {
  578. updateLand(this.form).then(response => {
  579. this.$modal.msgSuccess("修改成功")
  580. this.open = false
  581. this.getList()
  582. })
  583. } else {
  584. addLand(this.form).then(response => {
  585. this.$modal.msgSuccess("新增成功")
  586. this.open = false
  587. this.getList()
  588. })
  589. }
  590. }
  591. })
  592. },
  593. /** 删除按钮操作 */
  594. handleDelete(row) {
  595. const fids = row.fid || this.ids
  596. this.$modal.confirm('是否确认删除地块属性编号为"' + fids + '"的数据项?').then(function() {
  597. return delLand(fids)
  598. }).then(() => {
  599. this.getList()
  600. this.$modal.msgSuccess("删除成功")
  601. }).catch(() => {})
  602. },
  603. /** 导出按钮操作 */
  604. handleExport() {
  605. this.download('resource/land/export', {
  606. ...this.queryParams
  607. }, `地块属性_${new Date().getTime()}.xlsx`)
  608. },
  609. /** 打印表单 */
  610. doPrint() {
  611. const originalTitle = document.title;
  612. try {
  613. document.title = this.title || '打印详情';
  614. const printElement = document.getElementById('printDetail');
  615. const printFrame = document.createElement('iframe');
  616. printFrame.style.position = 'absolute';
  617. printFrame.style.width = '0';
  618. printFrame.style.height = '0';
  619. printFrame.style.border = 'none';
  620. printFrame.style.left = '-9999px';
  621. printFrame.onload = function() {
  622. try {
  623. const frameDoc = printFrame.contentDocument || printFrame.contentWindow.document;
  624. const contentClone = printElement.cloneNode(true);
  625. const style = document.createElement('style');
  626. style.innerHTML = `
  627. @page {
  628. size: auto;
  629. margin: 10mm;
  630. }
  631. body {
  632. font-family: Arial, sans-serif;
  633. line-height: 1.5;
  634. margin: 0;
  635. padding: 0;
  636. }
  637. .el-descriptions {
  638. width: 100% !important;
  639. }
  640. .el-descriptions-item__label {
  641. width: ${this.descLabelWidth}% !important;
  642. }
  643. .el-descriptions-item__content {
  644. width: ${(100 / this.descColumn) - this.descLabelWidth}% !important;
  645. }
  646. /* 确保图片在打印时显示完整 */
  647. img, .el-image {
  648. max-width: 100% !important;
  649. height: auto !important;
  650. }
  651. `;
  652. frameDoc.head.appendChild(style);
  653. frameDoc.body.appendChild(contentClone);
  654. setTimeout(() => {
  655. printFrame.contentWindow.focus();
  656. printFrame.contentWindow.print();
  657. setTimeout(() => {
  658. document.body.removeChild(printFrame);
  659. document.title = originalTitle;
  660. }, 1000);
  661. }, 500);
  662. } catch (e) {
  663. document.body.removeChild(printFrame);
  664. document.title = originalTitle;
  665. this.$message.error('打印过程中发生错误');
  666. }
  667. };
  668. document.body.appendChild(printFrame);
  669. } catch (e) {
  670. document.title = originalTitle;
  671. this.$message.error('打印过程中发生错误');
  672. }
  673. },
  674. /** 打印按钮操作 */
  675. handlePrint() {
  676. printLand(this.queryParams).then(response => {})
  677. },
  678. /* 导入EXCEL组件 */
  679. handleImport() {
  680. this.upload.title = "地块属性导入"
  681. this.upload.open = true
  682. },
  683. /** 下载模板操作 */
  684. importTemplate() {
  685. this.download('resource/land/importTemplate', {
  686. }, `地块属性_template.xlsx`)
  687. },
  688. // 文件上传中处理
  689. handleFileUploadProgress(event, file, fileList) {
  690. this.upload.isUploading = true
  691. },
  692. // 文件上传成功处理
  693. handleFileSuccess(response, file, fileList) {
  694. this.upload.open = false
  695. this.upload.isUploading = false
  696. this.$refs.upload.clearFiles()
  697. this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
  698. this.getList()
  699. },
  700. // 提交上传文件
  701. submitFileForm() {
  702. this.$refs.upload.submit()
  703. },
  704. /** 查询部门下拉树结构 */
  705. getDeptTree() {
  706. deptTreeSelect().then(response => {
  707. this.deptOptions = response.data
  708. this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
  709. })
  710. },
  711. // 过滤禁用的部门
  712. filterDisabledDept(deptList) {
  713. return deptList.filter(dept => {
  714. if (dept.disabled) {
  715. return false
  716. }
  717. if (dept.children && dept.children.length) {
  718. dept.children = this.filterDisabledDept(dept.children)
  719. }
  720. return true
  721. })
  722. },
  723. // 筛选节点
  724. filterNode(value, data) {
  725. if (!value) return true
  726. return data.label.indexOf(value) !== -1
  727. },
  728. // 节点单击事件
  729. handleNodeClick(data) {
  730. this.queryParams.deptId = data.id
  731. this.selectDeptName = data.label
  732. this.handleQuery()
  733. },
  734. // 获取geoserver的地址
  735. getGeoServerUrl() {
  736. getConfigKey("system.geoServer.url").then(response => {
  737. this.mapGeoServerUrl = response.msg;
  738. });
  739. },
  740. // 获取地块图层名称
  741. getLandLayerName() {
  742. getConfigKey("geoserver.layer.dk").then(response => {
  743. this.landLayerName = response.msg;
  744. });
  745. },
  746. // 获取村边界的图层名称
  747. getVillageBorderLayerName() {
  748. getConfigKey("geoserver.layer.villageBorder").then(response => {
  749. this.villageBorderLayerName = response.msg;
  750. });
  751. },
  752. // 获取当前部门的位置
  753. getCurrentDeptLocation() {
  754. var deptId = this.queryParams.deptId;
  755. if(deptId){
  756. deptId = 100;
  757. }
  758. getDept(deptId).then(response => {
  759. let insertCode = response.data;
  760. if (insertCode != null) {
  761. this.weidu = insertCode.latitude;
  762. this.jingdu = insertCode.longitude;
  763. }
  764. });
  765. },
  766. /** 地图修改按钮操作 */
  767. handleMap(row) {
  768. this.mapTheGeomId = row;
  769. getInfoByImportCode(row.importCode).then((res) => {
  770. let insertCode = res.data;
  771. if (insertCode != null) {
  772. this.weidu = insertCode.latitude;
  773. this.jingdu = insertCode.longitude;
  774. }
  775. const tableRow = { importCode: row.importCode };
  776. listLandQuery(tableRow).then(response => {
  777. this.openMap = true;
  778. this.title = "修改地图";
  779. setTimeout(() => {
  780. this.pointDarw(response.rows);
  781. }, 500);
  782. });
  783. });
  784. },
  785. /** 地图提交按钮 */
  786. submitFormMap() {
  787. if(this.drawInsert !=null && this.drawInsert !=""){
  788. this.mapTheGeomId.theGeom = JSON.stringify(this.drawInsert);
  789. }else{
  790. this.mapTheGeomId.theGeom = this.mapTheGeomId.theGeomText
  791. }
  792. let sysGis = { tableName: 't_resource_land', priId: 'fid', id: this.mapTheGeomId.fid, theGeom: this.mapTheGeomId.theGeom };
  793. if (this.mapTheGeomId != null) {
  794. areaSavePri(sysGis).then(response => {
  795. this.$modal.msgSuccess("修改成功");
  796. this.openMap = false;
  797. //this.getList();
  798. });
  799. }
  800. },
  801. /** 清除坐标点图层 */
  802. clearMapLayer() {
  803. let sysGis = { tableName: 't_resource_land', priId: 'fid', id: this.mapTheGeomId.fid};
  804. cleanSavePri(sysGis).then(response => {
  805. this.$modal.msgSuccess("清除成功");
  806. this.openMap = false;
  807. //this.getList();
  808. });
  809. },
  810. pointDarw(resourceList) {
  811. //加载地图编辑
  812. var that = this;
  813. var map;
  814. var draw;
  815. var vector_drawing;
  816. var startDarw =false;
  817. var openDarw = false;
  818. this.mapTheGeomId = resourceList.find((land) => {
  819. //model就是上面的数据源
  820. return land.fid === this.mapTheGeomId.fid;
  821. });
  822. if (this.mapTheGeomId.theGeom != null && this.mapTheGeomId.theGeom != ""
  823. && this.mapTheGeomId.theGeom != undefined) {
  824. startDarw = true;
  825. openDarw = false;
  826. } else {
  827. startDarw = false;
  828. openDarw = true;
  829. }
  830. if (startDarw) {
  831. document.getElementById("mapWrap").innerHTML = '';
  832. var thePolygon;
  833. var draw; // global so we can remove it later
  834. var vector_drawing;
  835. var projection = new ol.proj.Projection({
  836. //地图投影类型
  837. code: "EPSG:3857",
  838. units: "degrees",
  839. //extent:extent
  840. });
  841. var aerial = new ol.layer.Tile({
  842. source: new ol.source.XYZ({
  843. url: "http://t0.tianditu.gov.cn/img_w/wmts?" +
  844. "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
  845. "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cc4aba6e967096098249efa069733067",
  846. }),
  847. isGroup: true,
  848. name: "卫星影像图",
  849. });
  850. var yingxzi = new ol.layer.Tile({
  851. source: new ol.source.XYZ({
  852. url: "https://t0.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
  853. }),
  854. isGroup: true,
  855. name: "天地图文字标注--卫星影像图",
  856. });
  857. //加载地图
  858. map = new ol.Map({
  859. controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]), //隐藏放大缩小按钮
  860. layers: [aerial, yingxzi],
  861. projection: projection,
  862. target: "mapWrap",
  863. view: new ol.View({
  864. //center: ol.proj.fromLonLat([115.452752, 31.789033]),
  865. zoom: 17.8,
  866. minZoom: 0,
  867. maxZoom: 18.3,
  868. }),
  869. });
  870. // 添加村边界
  871. let mapBorder = new ol.layer.Image({
  872. source: new ol.source.ImageWMS({
  873. url: this.mapGeoServerUrl + '/wms',
  874. params: {
  875. LAYERS: this.villageBorderLayerName,
  876. cql_filter: "import_code = '" + this.mapTheGeomId.importCode + "'",
  877. SRID: 3857,
  878. },
  879. }),
  880. name: 'villageBorderLayer'
  881. });
  882. map.addLayer(mapBorder);
  883. // 添加已经存在的资源图层
  884. let vectorSource = new ol.source.Vector();
  885. for (let resource of resourceList) {
  886. if (resource.theGeom && resource.fid !== this.mapTheGeomId.fid) {
  887. let feature = new ol.Feature({
  888. geometry: new ol.geom.MultiPolygon(JSON.parse(resource.theGeom).coordinates),
  889. // permanentName: permanent.name
  890. });
  891. vectorSource.addFeature(feature);
  892. }
  893. }
  894. let resourceLayer = new ol.layer.Vector({
  895. source: vectorSource,
  896. style: (feature, resolution) => {
  897. return new ol.style.Style({
  898. fill: new ol.style.Fill({
  899. //矢量图层填充颜色,以及透明度
  900. color: "rgba(0, 218, 255, 0.3)",
  901. }),
  902. stroke: new ol.style.Stroke({
  903. //边界样式
  904. color: "#00DAFF",
  905. width: 3,
  906. }),
  907. })
  908. }
  909. });
  910. map.addLayer(resourceLayer);
  911. //当前图层查询定位
  912. thePolygon = new ol.layer.Vector({
  913. title: "add Layer",
  914. source: new ol.source.Vector({
  915. projection: projection,
  916. features: new ol.format.GeoJSON().readFeatures("{\n" +
  917. " \"type\": \"Feature\",\n" +
  918. " \"geometry\":" + this.mapTheGeomId.theGeom + "}"),
  919. }),
  920. style: new ol.style.Style({
  921. fill: new ol.style.Fill({
  922. //矢量图层填充颜色,以及透明度
  923. color: "yellow",
  924. }),
  925. stroke: new ol.style.Stroke({
  926. //边界样式
  927. color: "yellow",
  928. width: 3,
  929. }),
  930. }),
  931. });
  932. map.addLayer(thePolygon);
  933. var maxXMap = thePolygon.values_.source.featuresRtree_.rbush_.data.maxX;
  934. var maxYMap = thePolygon.values_.source.featuresRtree_.rbush_.data.maxY;
  935. var minXMap = thePolygon.values_.source.featuresRtree_.rbush_.data.minX;
  936. var minYMap = thePolygon.values_.source.featuresRtree_.rbush_.data.minY;
  937. var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]);
  938. map.getView().animate({
  939. center: center,
  940. zoom: 17.8,
  941. rotation: undefined,
  942. duration: 1000,
  943. });
  944. //开始绘制地图
  945. $("#drawPolygon").off("click").on("click", function () {
  946. map.removeLayer(thePolygon);
  947. map.removeLayer(vector_drawing);
  948. that.drawInsert = null;
  949. //var source = new ol.source.Vector({wrapX: false});
  950. vector_drawing = new ol.layer.Vector({
  951. source: new ol.source.Vector(),
  952. });
  953. map.addLayer(vector_drawing);
  954. function addInteraction() {
  955. draw = new ol.interaction.Draw({
  956. source: vector_drawing.getSource(),
  957. type: "Polygon"
  958. });
  959. draw.on('drawend', function (evt) {
  960. map.removeInteraction(draw);
  961. var feature = evt.feature;
  962. var geometry = feature.getGeometry();
  963. var coordinate = geometry.getCoordinates();
  964. that.drawInsert = coordinate;
  965. });
  966. map.addInteraction(draw);
  967. }
  968. addInteraction();
  969. });
  970. //清除画图鼠标点击事件
  971. $("#drawRemove").off("click").on("click", function () {
  972. //map.addLayer(thePolygon);
  973. map.removeInteraction(draw);
  974. //map.removeLayer(vector_drawing);
  975. });
  976. //还原之前图层
  977. $("#drawReset").off("click").on("click", function () {
  978. map.removeInteraction(draw);
  979. map.removeLayer(vector_drawing);
  980. map.addLayer(thePolygon);
  981. that.drawInsert = null;
  982. });
  983. }
  984. if (openDarw) {
  985. document.getElementById("mapWrap").innerHTML = '';
  986. var projection = new ol.proj.Projection({
  987. //地图投影类型
  988. code: "EPSG:3857",
  989. units: "degrees",
  990. //extent:extent
  991. });
  992. var aerial = new ol.layer.Tile({
  993. source: new ol.source.XYZ({
  994. url: "http://t0.tianditu.gov.cn/img_w/wmts?" +
  995. "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
  996. "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cc4aba6e967096098249efa069733067",
  997. }),
  998. isGroup: true,
  999. name: "卫星影像图",
  1000. });
  1001. var yingxzi = new ol.layer.Tile({
  1002. source: new ol.source.XYZ({
  1003. url: "https://t0.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
  1004. }),
  1005. isGroup: true,
  1006. name: "天地图文字标注--卫星影像图",
  1007. });
  1008. //获取坐标是否存在
  1009. var Zb;
  1010. if (this.jingdu != null && this.jingdu !="") {
  1011. Zb = [this.jingdu, this.weidu]
  1012. } else {
  1013. Zb = [115.452752, 31.789033];
  1014. }
  1015. //加载地图
  1016. map = new ol.Map({
  1017. controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]), //隐藏放大缩小按钮
  1018. layers: [aerial, yingxzi],
  1019. projection: projection,
  1020. logo: 'false',
  1021. target: "mapWrap",
  1022. view: new ol.View({
  1023. center: ol.proj.fromLonLat(Zb),
  1024. //center: ol.proj.fromLonLat([115.452752, 31.789033]),
  1025. zoom: 17.8,
  1026. minZoom: 0, //地图缩小限制
  1027. maxZoom: 18, //地图放大限制
  1028. }),
  1029. });
  1030. // 添加村边界
  1031. let mapBorder = new ol.layer.Image({
  1032. source: new ol.source.ImageWMS({
  1033. url: this.mapGeoServerUrl + '/wms',
  1034. params: {
  1035. LAYERS: this.villageBorderLayerName,
  1036. cql_filter: "import_code = '" + this.mapTheGeomId.importCode + "'",
  1037. SRID: 3857,
  1038. },
  1039. }),
  1040. name: 'villageBorderLayer'
  1041. });
  1042. map.addLayer(mapBorder);
  1043. // 添加已经存在的资源图层
  1044. let vectorSource = new ol.source.Vector();
  1045. for (let resource of resourceList) {
  1046. if (resource.theGeom && resource.fid !== this.mapTheGeomId.fid) {
  1047. let feature = new ol.Feature({
  1048. geometry: new ol.geom.MultiPolygon(JSON.parse(resource.theGeom).coordinates),
  1049. // permanentName: permanent.name
  1050. });
  1051. vectorSource.addFeature(feature);
  1052. }
  1053. }
  1054. let resourceLayer = new ol.layer.Vector({
  1055. source: vectorSource,
  1056. style: (feature, resolution) => {
  1057. return new ol.style.Style({
  1058. fill: new ol.style.Fill({
  1059. //矢量图层填充颜色,以及透明度
  1060. color: "rgba(0, 218, 255, 0.3)",
  1061. }),
  1062. stroke: new ol.style.Stroke({
  1063. //边界样式
  1064. color: "#00DAFF",
  1065. width: 3,
  1066. }),
  1067. })
  1068. }
  1069. });
  1070. map.addLayer(resourceLayer);
  1071. //开始绘制地图
  1072. $("#drawPolygon").off("click").on("click", function () {
  1073. //map.removeLayer(thePolygon);
  1074. map.removeLayer(vector_drawing);
  1075. that.drawInsert = null;
  1076. map.removeInteraction(draw);
  1077. var source = new ol.source.Vector({wrapX: false});
  1078. vector_drawing = new ol.layer.Vector({
  1079. source: source,
  1080. });
  1081. map.addLayer(vector_drawing);
  1082. var typeSelect = "Polygon";
  1083. function addInteraction() {
  1084. var value = typeSelect;
  1085. draw = new ol.interaction.Draw({
  1086. source: source,
  1087. type: typeSelect
  1088. });
  1089. draw.on('drawend', function (evt) {
  1090. //map.removeLayer(vector_drawing);
  1091. var feature = evt.feature;
  1092. var geometry = feature.getGeometry();
  1093. var coordinate = geometry.getCoordinates();
  1094. that.drawInsert = coordinate;
  1095. map.removeInteraction(draw);
  1096. });
  1097. map.addInteraction(draw);
  1098. }
  1099. addInteraction();
  1100. });
  1101. //清除画图鼠标点击事件
  1102. $("#drawRemove").off("click").on("click", function () {
  1103. //map.addLayer(thePolygon);
  1104. map.removeInteraction(draw);
  1105. //map.removeLayer(vector_drawing);
  1106. });
  1107. //还原之前图层
  1108. $("#drawReset").off("click").on("click", function () {
  1109. map.removeInteraction(draw);
  1110. map.removeLayer(vector_drawing);
  1111. //map.addLayer(thePolygon);
  1112. that.drawInsert = null;
  1113. });
  1114. }
  1115. },
  1116. }
  1117. }
  1118. </script>
  1119. <style scoped type="scss">
  1120. .container_main{
  1121. height: 75vh;
  1122. overflow-y: scroll;
  1123. }
  1124. #land-btn-wrap {
  1125. position: relative;
  1126. width: 40%;
  1127. left: 60%;
  1128. bottom: 95%;
  1129. z-index: 2000;
  1130. }
  1131. #mapWrap {
  1132. width: 100%;
  1133. height: 100%;
  1134. }
  1135. .ant-btn-red {
  1136. position: relative;
  1137. display: inline-block;
  1138. background: #D0EEFF;
  1139. border: 1px solid #99D3F5;
  1140. border-radius: 4px;
  1141. padding: 4px 12px;
  1142. overflow: hidden;
  1143. color: #1E88C7;
  1144. text-decoration: none;
  1145. text-indent: 0;
  1146. line-height: 20px;
  1147. right: -36%;
  1148. }
  1149. </style>