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