3876750cef3d01e7080e5f44e8ace7ac78ec3df7.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div>
  3. <!--添加行政村-->
  4. <el-dialog
  5. class="outerDialog custom_dialog add_village"
  6. title="添加行政村"
  7. width="40%"
  8. :visible.sync="villageVisible"
  9. :modal-append-to-body="true"
  10. :append-to-body="true"
  11. @close="closeDialog">
  12. <el-row class="text_end">
  13. <el-col>
  14. <el-button type="primary" @click="addvillagesTowns">新增</el-button>
  15. </el-col>
  16. </el-row>
  17. <el-container style="height:520px;">
  18. <el-aside width="300px" style="border:1px solid #d5d5ff">
  19. <p class="aside_title village_title">{{rowData.nm}}</p>
  20. <el-tree :data="villageTreeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
  21. </el-aside>
  22. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0;">
  23. <el-table
  24. ref="multipleTable"
  25. :data="villageTableData"
  26. tooltip-effect="dark"
  27. max-height="510"
  28. style="width: 100%"
  29. @selection-change="handleSelectionChange">
  30. <el-table-column
  31. type="selection"
  32. width="55">
  33. </el-table-column>
  34. <el-table-column
  35. prop="adName"
  36. label="行政村名称"
  37. min-width="120"
  38. show-overflow-tooltip>
  39. </el-table-column>
  40. <el-table-column
  41. prop="isPoveryt"
  42. label="是否贫困村"
  43. min-width="120">
  44. <template slot-scope="scope">
  45. <span>{{ scope.row.isPoveryt == '1' ? "是" : "否"}}</span>
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. </el-main>
  50. </el-container>
  51. <span slot="footer">
  52. <el-button style="margin-top:5px;" @click="villageSave">确定</el-button>
  53. </span>
  54. </el-dialog>
  55. <!--新增行政村-->
  56. <add-new-division v-if="showAddDivisionDialog" :rootCode="currentResCode" @addSuccess="addSuccess" @handleClose="handleClose"></add-new-division>
  57. </div>
  58. </template>
  59. <script>
  60. import inputWith from "@widget/inuptWith.vue"
  61. import request from "@util/gw_ajax_request.js"
  62. import addNewDivision from './components/addNewDivision.vue'
  63. export default {
  64. components: {
  65. addNewDivision: addNewDivision,
  66. inputWith: inputWith,
  67. },
  68. props: ['currentObjectId', 'currentObjectName', 'currentObjectRgstrId', 'currentResCode', 'rowData'],
  69. data() {
  70. return {
  71. wateruserVisible: false,
  72. villageVisible: true,
  73. villageTreeData: [],
  74. villageTableData: [],
  75. defaultProps: {
  76. // children: 'children',
  77. label: 'adName'
  78. },
  79. townName: "",
  80. townCode: "",
  81. showAddDivisionDialog: false,
  82. multipleSelection: []
  83. }
  84. },
  85. computed: {
  86. recPersId() {
  87. return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
  88. }
  89. },
  90. created() {
  91. },
  92. mounted() {
  93. this.getVillageTreeList();
  94. },
  95. watch: {
  96. },
  97. methods: {
  98. getVillageTreeList() {
  99. request.get(`/bis/insp/irr/towns/dsu/findCheckTree/${this.rowData.code}/${this.rowData.rgstrId}`)
  100. .then(res => {
  101. if (res.success && res.data) {
  102. this.$nextTick(() => {
  103. if (res.data.length) {
  104. this.villageTreeData = res.data;
  105. this.villageTableData = res.data[0].attCountryDtoList;
  106. this.townName = res.data[0].adName;
  107. this.townCode = res.data[0].adCode;
  108. }
  109. })
  110. }
  111. })
  112. },
  113. //villageSave添加行政村确定
  114. villageSave() {
  115. if (!this.multipleSelection.length) {
  116. this.$message.warning("请至少选择一个行政村");
  117. return;
  118. }
  119. let obj = {
  120. "rgstrId": this.rowData.rgstrId,
  121. "objId": this.rowData.objId,
  122. "attCountryDtoList": this.multipleSelection,
  123. "adName": this.townName,
  124. "adCode": this.townCode
  125. }
  126. request.post(`/bis/insp/irr/towns/dsu/addTownList`, obj)
  127. .then(res => {
  128. if (res.success) {
  129. this.$message.success("添加行政村成功");
  130. this.$emit("addVillageSuccess");
  131. this.villageVisible = false;
  132. } else {
  133. this.$message.warning(res.message);
  134. }
  135. })
  136. },
  137. handleSelectionChange(val) {
  138. this.multipleSelection = val;
  139. },
  140. handleNodeClick(data) {
  141. this.$nextTick(() => {
  142. this.townName = data.adName;
  143. this.townCode = data.adCode;
  144. this.villageTableData = data.attCountryDtoList;
  145. })
  146. },
  147. closeDialog() {
  148. this.$emit("closeDialogVillageTowns");
  149. },
  150. addvillagesTowns(){
  151. this.showAddDivisionDialog = true;
  152. },
  153. addSuccess(){
  154. this.showAddDivisionDialog = false;
  155. this.getVillageTreeList();
  156. },
  157. handleClose(){
  158. this.showAddDivisionDialog = false;
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. .add_village .el-dialog__body {
  165. padding: 0 20px !important;
  166. }
  167. .text_end{
  168. text-align: end;
  169. margin-bottom: 10px;
  170. }
  171. /*.nygs{*/
  172. .aside_title {
  173. padding-right: 10px;
  174. height: 30px;
  175. line-height: 30px;
  176. text-align: end;
  177. border-bottom: 1px solid rgb(235, 238, 245);
  178. background-color: #d5d5ff;
  179. }
  180. .village_title {
  181. text-align: center;
  182. }
  183. .ul_height {
  184. height: 160px;
  185. overflow: auto;
  186. }
  187. .box-card {
  188. /*height: 200px;*/
  189. overflow: auto;
  190. }
  191. .flr {
  192. float: right;
  193. margin-right: 20px;
  194. }
  195. .mr10 {
  196. margin-right: 20px;
  197. float: right;
  198. }
  199. .ml5v {
  200. width: 10vw;
  201. display: inline-block;
  202. }
  203. /*}*/
  204. </style>