移动端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

contractorLandDetail.vue 16 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar left-arrow fixed placeholder @click-left="goBack" >
  4. <template #title>
  5. <div class="tb_main">
  6. {{ titleName }}
  7. </div>
  8. </template>
  9. </van-nav-bar>
  10. <div class="list_main">
  11. <van-form ref="formData">
  12. <van-field v-model="form.dkbm" label="地块代码:" placeholder="请选择地块代码" required :rules="[{ required: true }]" :border="false"
  13. input-align="right" right-icon="arrow-down" readonly clickable @click="openLandCodePopup" :disabled="isDisabled" maxlength="19" />
  14. <van-popup v-model="showLandCode" position="bottom">
  15. <van-search v-model="searchKeyword" placeholder="请输入地块名称搜索" />
  16. <van-picker
  17. ref="landCodePicker"
  18. show-toolbar
  19. :columns="filteredLandList"
  20. @confirm="onConfirmLandCodeOptions"
  21. @cancel="showLandCode = false"
  22. >
  23. <template #option="option">
  24. <div style="display: flex; flex-direction: column; align-items: center;">
  25. <div>{{option.dkmc}}-{{option.dkbm}}</div>
  26. </div>
  27. </template>
  28. </van-picker>
  29. </van-popup>
  30. <van-field v-model="form.dkmc" label="地块名称:" placeholder="请输入地块名称" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />
  31. <van-field
  32. v-model="tdlylxText"
  33. label="土地利用类型:"
  34. placeholder="请选择土地利用类型"
  35. required
  36. :rules="[{ required: true }]"
  37. :border="false"
  38. input-align="right"
  39. right-icon="arrow-down"
  40. readonly
  41. clickable
  42. @click="showLandUseType = true"
  43. />
  44. <van-popup v-model="showLandUseType" position="bottom">
  45. <van-picker
  46. show-toolbar
  47. :columns="tdlylxOptions"
  48. value-key="dictLabel"
  49. @confirm="onConfirmLandUseTypeOptions"
  50. @cancel="showLandUseType = false"
  51. />
  52. </van-popup>
  53. <van-field
  54. v-model="dldjText"
  55. label="地力等级:"
  56. placeholder="请选择地力等级"
  57. required
  58. :rules="[{ required: true }]"
  59. :border="false"
  60. input-align="right"
  61. right-icon="arrow-down"
  62. readonly
  63. clickable
  64. @click="showLandGrade = true"
  65. />
  66. <van-popup v-model="showLandGrade" position="bottom">
  67. <van-picker
  68. show-toolbar
  69. :columns="dldjOptions"
  70. value-key="dictLabel"
  71. @confirm="onConfirmLandGradeOptions"
  72. @cancel="showLandGrade = false"
  73. />
  74. </van-popup>
  75. <van-field
  76. v-model="tdytText"
  77. label="土地用途:"
  78. placeholder="请选择土地用途"
  79. required
  80. :rules="[{ required: true }]"
  81. :border="false"
  82. input-align="right"
  83. right-icon="arrow-down"
  84. readonly
  85. clickable
  86. @click="showLandPurpose = true"
  87. />
  88. <van-popup v-model="showLandPurpose" position="bottom">
  89. <van-picker
  90. show-toolbar
  91. :columns="tdytOptions"
  92. value-key="dictLabel"
  93. @confirm="onConfirmTDYTOptions"
  94. @cancel="showLandPurpose = false"
  95. />
  96. </van-popup>
  97. <van-field v-model="form.sfjbnt" label="基本农田:" placeholder="请选择基本农田" required :rules="[{ required: true }]" :border="false" input-align="right">
  98. <template #input>
  99. <van-radio-group v-model="form.sfjbnt" direction="horizontal">
  100. <van-radio v-for="item in sfjbntOptions" :key="item.dictValue" :name="item.dictValue">{{ item.dictLabel }}</van-radio>
  101. </van-radio-group>
  102. </template>
  103. </van-field>
  104. <van-field v-model="form.htmjm" type="number" label="合同面积(亩):" placeholder="请输入合同面积(亩)" required :rules="[{ required: true }]" :border="false" input-align="right" />
  105. <van-field v-model="form.zjrxm" label="指界人姓名:" placeholder="请输入指界人姓名" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="100" />
  106. <van-field v-model="form.dkdz" label="地块东至:" placeholder="请输入地块东至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />
  107. <van-field v-model="form.dkxz" label="地块西至:" placeholder="请输入地块西至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />
  108. <van-field v-model="form.dknz" label="地块南至:" placeholder="请输入地块南至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />
  109. <van-field v-model="form.dkbz" label="地块北至:" placeholder="请输入地块北至" required :rules="[{ required: true }]" :border="false" input-align="right" maxlength="50" />
  110. <van-field v-model="form.dkbzxx" label="地块备注信息:" placeholder="请输入地块备注信息" type="textarea" rows="3" :border="false" input-align="right" maxlength="250" />
  111. <div class="mapBox">
  112. <common-map ref="contractedLandMap" :minMapZoom="15" :maxMapZoom="18" :allowDraw="true" @drawFinished="onMapDrawFinished" />
  113. </div>
  114. </van-form>
  115. <p class="btn" @click="submitForm" v-if="taskStatus === '2' && $route.params.surveyStatus !== '3'">保存</p>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import Cookies from "js-cookie";
  121. import { getCbdkxx, addCbdkxx, updateCbdkxx } from "@/api/contracted/cbdkxx";
  122. import { listDk } from "@/api/contracted/dk";
  123. import { getDept } from "@/api/contracted";
  124. import CommonMap from "@/components/house/CommonMap";
  125. export default {
  126. name: "contractedVillageContractor",
  127. components: {
  128. CommonMap
  129. },
  130. data() {
  131. return {
  132. titleName: '', // 标题信息
  133. isDisabled: false, // 是否禁用
  134. form: {}, // 承包地信息表单
  135. showLandCode: false, // 控制地块代码弹出层的显示和隐藏
  136. tdlylxOptions: [], // 土地利用类型字典
  137. tdlylxText: null, // 土地利用类型标签名
  138. showLandUseType: false, // 控制土地利用类型字典弹出层的显示和隐藏
  139. dldjOptions: [], // 地力等级字典
  140. dldjText: null, // 地力等级标签名
  141. showLandGrade: false, // 控制地力等级字典弹出层的显示和隐藏
  142. tdytOptions: [], // 土地用途字典
  143. tdytText: null, // 土地用途标签名
  144. showLandPurpose: false, // 控制土地用途字典弹出层的显示和隐藏
  145. sfjbntOptions: [], // 是否基本农田字典
  146. landList: [], // 地块信息列表
  147. taskStatus: null, // 调查任务的完成状态:1表示已完成,2表示未完成
  148. searchKeyword: '', // 弹出框查询关键字
  149. };
  150. },
  151. created() {
  152. this.taskStatus = Cookies.get('taskStatus');
  153. this.getDicts("land_use").then(response => {
  154. this.tdlylxOptions = response.data;
  155. });
  156. this.getDicts("land_grade").then(response => {
  157. this.dldjOptions = response.data;
  158. });
  159. this.getDicts("use_code").then(response => {
  160. this.tdytOptions = response.data;
  161. });
  162. this.getDicts("is_common").then(response => {
  163. this.sfjbntOptions = response.data;
  164. });
  165. },
  166. mounted() {
  167. if (this.$route.params.id) {
  168. this.titleName = '修改承包地信息';
  169. this.isDisabled = true;
  170. setTimeout(() => {
  171. this.getDetail();
  172. }, 500)
  173. } else {
  174. this.titleName = '新增承包地信息';
  175. this.resetForm();
  176. this.getCoordinates();
  177. this.getLandList();
  178. }
  179. },
  180. computed: {
  181. filteredLandList() {
  182. return this.landList.filter(item => {
  183. return item.dkmc.indexOf(this.searchKeyword) !== -1;
  184. })
  185. }
  186. },
  187. methods: {
  188. getCoordinates() {
  189. getDept(this.$route.params.deptId).then(response => {
  190. const lng = response.data.lng;
  191. const lat = response.data.lat;
  192. if (lng && lat) {
  193. this.$nextTick(() => {
  194. this.$refs.contractedLandMap.setCoord(lng, lat);
  195. });
  196. }
  197. });
  198. },
  199. getLandList() {
  200. // 查询出非承包地块(dklb != '10')且未流转(dkzt = '1')的地块信息
  201. listDk({deptId: this.$route.params.deptId, jtdklb: '10', dkzt: '1'}).then(response => {
  202. this.landList = response.rows;
  203. });
  204. },
  205. getDetail(){
  206. getCbdkxx(this.$route.params.id).then(response => {
  207. this.form = response.data;
  208. this.tdlylxText = this.selectDictLabel(this.tdlylxOptions, response.data.tdlylx);
  209. this.dldjText = this.selectDictLabel(this.dldjOptions, response.data.dldj);
  210. this.tdytText = this.selectDictLabel(this.tdytOptions, response.data.tdyt);
  211. if (response.data.theGeomJson) {
  212. this.form.theGeom = JSON.stringify(JSON.parse(response.data.theGeomJson).coordinates);
  213. this.$nextTick(() => {
  214. this.$refs.contractedLandMap.setLayer('_Draw_layer', response.data.theGeomJson);
  215. });
  216. } else {
  217. this.getCoordinates();
  218. }
  219. });
  220. },
  221. resetForm() {
  222. this.form = {
  223. deptId: null,
  224. cbfbm: null,
  225. dkbm: null,
  226. dkmc: null,
  227. tdlylx: null,
  228. dldj: null,
  229. tdyt: null,
  230. sfjbnt: null,
  231. htmjm: null,
  232. zjrxm: null,
  233. dkdz: null,
  234. dkxz: null,
  235. dknz: null,
  236. dkbz: null,
  237. dkbzxx: null,
  238. theGeom: null
  239. };
  240. },
  241. openLandCodePopup() {
  242. /* if (this.form.dkbm) {
  243. const index = this.landList.findIndex(item => item.dkbm === this.form.dkbm);
  244. this.$refs.landCodePicker.setColumnIndex(0, index);
  245. } */
  246. if (!this.isDisabled) {
  247. this.showLandCode = true;
  248. this.searchKeyword = '';
  249. }
  250. },
  251. onConfirmLandCodeOptions(value) {
  252. this.form.dkbm = value.dkbm;
  253. this.form.dkmc = value.dkmc;
  254. this.form.tdlylx = value.tdlylx;
  255. this.tdlylxText = this.selectDictLabel(this.tdlylxOptions, value.tdlylx);
  256. this.form.dldj = value.dldj;
  257. this.dldjText = this.selectDictLabel(this.dldjOptions, value.dldj);
  258. this.form.tdyt = value.tdyt
  259. this.tdytText = this.selectDictLabel(this.tdytOptions, value.tdyt);
  260. this.form.sfjbnt = value.sfjbnt;
  261. this.form.htmjm = value.scmjm;
  262. this.form.zjrxm = value.zjrxm;
  263. this.form.dkdz = value.dkdz;
  264. this.form.dkxz = value.dkxz
  265. this.form.dknz = value.dknz;
  266. this.form.dkbz = value.dkbz;
  267. this.form.dkbzxx = value.dkbzxx;
  268. if (value.theGeomJson) {
  269. this.form.theGeom = JSON.stringify(JSON.parse(value.theGeomJson).coordinates);
  270. this.$refs.contractedLandMap.setLayer('_Draw_layer', value.theGeomJson);
  271. } else {
  272. this.form.theGeom = null;
  273. }
  274. this.showLandCode = false;
  275. },
  276. onConfirmLandUseTypeOptions(value) {
  277. this.form.tdlylx = value.dictValue;
  278. this.tdlylxText = value.dictLabel;
  279. this.showLandUseType = false;
  280. },
  281. onConfirmLandGradeOptions(value) {
  282. this.form.dldj = value.dictValue;
  283. this.dldjText = value.dictLabel;
  284. this.showLandGrade = false;
  285. },
  286. onConfirmTDYTOptions(value){
  287. this.form.tdyt = value.dictValue;
  288. this.tdytText = value.dictLabel;
  289. this.showLandPurpose = false;
  290. },
  291. goBack() {
  292. this.$router.push({
  293. name: 'contractedVillageContractorLand',
  294. params: {
  295. deptId: this.$route.params.deptId,
  296. cbfbm: this.$route.params.cbfbm,
  297. cbfmc: this.$route.params.cbfmc,
  298. surveyStatus: this.$route.params.surveyStatus
  299. }
  300. });
  301. },
  302. submitForm() {
  303. this.$refs.formData.validate().then(() => {
  304. if (this.$route.params.id) {
  305. updateCbdkxx(this.form).then(response => {
  306. if (response.code == 200) {
  307. this.$toast({
  308. icon: 'success',
  309. message: '保存成功',
  310. duration:"1000",
  311. onClose: () => {
  312. this.goBack();
  313. }
  314. });
  315. }
  316. });
  317. } else {
  318. this.form.deptId = this.$route.params.deptId;
  319. this.form.cbfbm = this.$route.params.cbfbm;
  320. addCbdkxx(this.form).then(response => {
  321. if (response.code == 200) {
  322. this.$toast({
  323. icon: 'success',
  324. message: '保存成功',
  325. duration:"1000",
  326. onClose: () => {
  327. this.goBack();
  328. }
  329. });
  330. }
  331. });
  332. }
  333. }).catch(() => {
  334. this.$notify({ type: 'danger', message: '请填写完整的表单项' });
  335. });
  336. },
  337. onMapDrawFinished(data) {
  338. if (data) {
  339. this.form.theGeom = JSON.stringify(data);
  340. } else {
  341. this.form.theGeom = null;
  342. }
  343. },
  344. },
  345. };
  346. </script>
  347. <style scoped lang="scss">
  348. .app-container{
  349. background: #fff url("../../../../../static/images/contracted/contracted_index_bg.png") no-repeat center;
  350. background-size: 100% 100%;
  351. height: 100vh;
  352. padding: 0 4vw;
  353. overflow: hidden;
  354. }
  355. /deep/ .van-nav-bar{
  356. background: transparent;
  357. }
  358. /deep/ .van-nav-bar .van-icon{
  359. color: #000000;
  360. }
  361. /deep/ .van-hairline--bottom::after{
  362. border: none;
  363. }
  364. /deep/ .van-ellipsis{
  365. overflow: initial;
  366. }
  367. /deep/ .van-field--disabled .van-field__label {
  368. color: #646566;
  369. }
  370. /deep/ .van-field__label {
  371. width: 7em;
  372. }
  373. .tb_main{
  374. position: relative;
  375. p{
  376. position: absolute;
  377. display: inline-block;
  378. margin-left: 10PX;
  379. }
  380. }
  381. .tb{
  382. font-size: 12px;
  383. color: #ff8900;
  384. background: #daf6e7;
  385. border: 1px solid #d7be6e;
  386. padding: 2PX 8PX;
  387. border-radius: 50PX;
  388. margin-right: 5PX;
  389. }
  390. .tap_block{
  391. width: 100%;
  392. display: flex;
  393. justify-content: space-between;
  394. background: #ebfaf2;
  395. padding: 2PX 4PX;
  396. border-radius: 10PX;
  397. margin-top: 1vh;
  398. .active{
  399. background-image: linear-gradient(to right,#c6fe8b,#48e5a2);
  400. box-shadow: 0 0 10PX #cccccc;
  401. color: #333333;
  402. }
  403. p{
  404. width: 25%;
  405. text-align: center;
  406. padding: 5PX 0;
  407. border-radius: 10PX;
  408. color: #666666;
  409. }
  410. }
  411. .search_main{
  412. display: flex;
  413. margin-top: 2vh;
  414. .search_btn{
  415. background: rgba(255,255,255,.5);
  416. width: 25%;
  417. border-radius: 50PX;
  418. margin-left: 10PX;
  419. padding: 2PX;
  420. .active{
  421. background-image: linear-gradient(to right,#c6fe8b,#48e5a2);
  422. color: #333333;
  423. border-radius: 50PX;
  424. display: flex;
  425. align-items: center;
  426. justify-content: center;
  427. height: 100%;
  428. }
  429. }
  430. }
  431. .second_tap{
  432. display: flex;
  433. align-items: center;
  434. margin-top: 1vh;
  435. p{
  436. background: #dbf1ea;
  437. border: 1px solid #cdcdcd;
  438. color: #5f5f5f;
  439. padding: 5PX 15PX;
  440. margin-right: 3vw;
  441. border-radius: 50PX;
  442. }
  443. .active{
  444. background: #99eecb;
  445. border-color: #48e5a2;
  446. color: #333333;
  447. }
  448. }
  449. .list_main{
  450. margin-top: 2vh;
  451. overflow-y: scroll;
  452. text-align: center;
  453. background: #ffffff;
  454. border-top-left-radius: 10PX;
  455. border-top-right-radius: 10PX;
  456. height: 88vh;
  457. .btn{
  458. background-image: linear-gradient(to right,#c6fe8b,#48e5a2);
  459. box-shadow: 0 0 10PX #cccccc;
  460. padding: 10PX 0PX;
  461. border-radius: 50PX;
  462. display: inline-block;
  463. width: 40%;
  464. margin-top: 2vh;
  465. }
  466. }
  467. .mapBox{
  468. width: 94%;
  469. height: 50vw;
  470. background-image: linear-gradient(to right,#c6fe8b,#48e5a2);
  471. border-radius: 10PX;
  472. margin: 2vh auto;
  473. }
  474. </style>