移动端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

540 lignes
18 KiB

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