| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <template>
- <div>
- <!--添加行政村-->
- <el-dialog
- class="outerDialog custom_dialog add_village"
- title="添加行政村"
- width="40%"
- :visible.sync="villageVisible"
- :modal-append-to-body="true"
- :append-to-body="true"
- @close="closeDialog">
- <el-row class="text_end">
- <el-col>
- <el-button type="primary" @click="addvillagesTowns">新增</el-button>
- </el-col>
- </el-row>
- <el-container style="height:520px;">
- <el-aside width="300px" style="border:1px solid #d5d5ff">
- <p class="aside_title village_title">{{rowData.nm}}</p>
- <el-tree :data="villageTreeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
- </el-aside>
- <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0;">
- <el-table
- ref="multipleTable"
- :data="villageTableData"
- tooltip-effect="dark"
- max-height="510"
- style="width: 100%"
- @selection-change="handleSelectionChange">
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- prop="adName"
- label="行政村名称"
- min-width="120"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="isPoveryt"
- label="是否贫困村"
- min-width="120">
- <template slot-scope="scope">
- <span>{{ scope.row.isPoveryt == '1' ? "是" : "否"}}</span>
- </template>
- </el-table-column>
- </el-table>
- </el-main>
- </el-container>
- <span slot="footer">
- <el-button style="margin-top:5px;" @click="villageSave">确定</el-button>
- </span>
- </el-dialog>
- <!--新增行政村-->
- <add-new-division v-if="showAddDivisionDialog" :rootCode="currentResCode" @addSuccess="addSuccess" @handleClose="handleClose"></add-new-division>
- </div>
- </template>
- <script>
- import inputWith from "@widget/inuptWith.vue"
- import request from "@util/gw_ajax_request.js"
- import addNewDivision from './components/addNewDivision.vue'
- export default {
- components: {
- addNewDivision: addNewDivision,
- inputWith: inputWith,
- },
- props: ['currentObjectId', 'currentObjectName', 'currentObjectRgstrId', 'currentResCode', 'rowData'],
- data() {
- return {
- wateruserVisible: false,
- villageVisible: true,
- villageTreeData: [],
- villageTableData: [],
- defaultProps: {
- // children: 'children',
- label: 'adName'
- },
- townName: "",
- townCode: "",
- showAddDivisionDialog: false,
- multipleSelection: []
- }
- },
- computed: {
- recPersId() {
- return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
- }
- },
- created() {
- },
- mounted() {
- this.getVillageTreeList();
- },
- watch: {
- },
- methods: {
- getVillageTreeList() {
- request.get(`/bis/insp/irr/towns/dsu/findCheckTree/${this.rowData.code}/${this.rowData.rgstrId}`)
- .then(res => {
- if (res.success && res.data) {
- this.$nextTick(() => {
- if (res.data.length) {
- this.villageTreeData = res.data;
- this.villageTableData = res.data[0].attCountryDtoList;
- this.townName = res.data[0].adName;
- this.townCode = res.data[0].adCode;
- }
- })
- }
- })
- },
- //villageSave添加行政村确定
- villageSave() {
- if (!this.multipleSelection.length) {
- this.$message.warning("请至少选择一个行政村");
- return;
- }
- let obj = {
- "rgstrId": this.rowData.rgstrId,
- "objId": this.rowData.objId,
- "attCountryDtoList": this.multipleSelection,
- "adName": this.townName,
- "adCode": this.townCode
- }
- request.post(`/bis/insp/irr/towns/dsu/addTownList`, obj)
- .then(res => {
- if (res.success) {
- this.$message.success("添加行政村成功");
- this.$emit("addVillageSuccess");
- this.villageVisible = false;
- } else {
- this.$message.warning(res.message);
- }
- })
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- handleNodeClick(data) {
- this.$nextTick(() => {
- this.townName = data.adName;
- this.townCode = data.adCode;
- this.villageTableData = data.attCountryDtoList;
- })
- },
- closeDialog() {
- this.$emit("closeDialogVillageTowns");
- },
- addvillagesTowns(){
- this.showAddDivisionDialog = true;
- },
- addSuccess(){
- this.showAddDivisionDialog = false;
- this.getVillageTreeList();
- },
- handleClose(){
- this.showAddDivisionDialog = false;
- }
- }
- }
- </script>
- <style lang="scss">
- .add_village .el-dialog__body {
- padding: 0 20px !important;
- }
- .text_end{
- text-align: end;
- margin-bottom: 10px;
- }
- /*.nygs{*/
- .aside_title {
- padding-right: 10px;
- height: 30px;
- line-height: 30px;
- text-align: end;
- border-bottom: 1px solid rgb(235, 238, 245);
- background-color: #d5d5ff;
- }
- .village_title {
- text-align: center;
- }
- .ul_height {
- height: 160px;
- overflow: auto;
- }
- .box-card {
- /*height: 200px;*/
- overflow: auto;
- }
- .flr {
- float: right;
- margin-right: 20px;
- }
- .mr10 {
- margin-right: 20px;
- float: right;
- }
- .ml5v {
- width: 10vw;
- display: inline-block;
- }
- /*}*/
- </style>
|