| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <template>
- <div class="nygs">
- <el-container style="height:520px;">
- <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0;overflow:hidden">
- <el-card class="box-card" style="height:255px;">
- <div slot="header" class="clearfix">
- <span>村</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="addXzc" v-if="openType">添加行政村</el-button>
- </div>
- <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClickXzc"
- node-key="id"
- class="left_tree"
- :expand-on-click-node="false">
- <span class="custom-tree-node" slot-scope="{ node, data }">
- <span>{{ node.label }}</span>
- <span>
- <el-button
- type="text"
- size="mini"
- v-if="data.children"
- @click.stop="() => addN(data,node)">
- 添加自然村
- </el-button>
- <el-button
- type="text"
- size="mini"
- @click.stop="() => removeNode(data,node)">
- 删除
- </el-button>
- </span>
- </span>
- </el-tree>
- </el-card>
- <el-card class="box-card mt20" style="height:255px;">
- <div slot="header" class="clearfix">
- <span>供水单位</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="addGsdw" v-if="openType">添加</el-button>
- </div>
- <ul class="ul_height">
- <li v-for="(item,index) in gsdwList" :key="index" class="text item lh40">
- <p @click="gsdwRow(item)">
- {{ item.nm }}
- <span class="flr">
- <el-button
- type="text"
- size="mini"
- @click.stop="() => gsdwDelete(item)">
- 删除
- </el-button>
- </span>
- </p>
- </li>
- </ul>
- <el-pagination
- small
- layout="prev, pager, next"
- :current-page="pageNum"
- :page-size="pageSize"
- :total="total"
- @current-change="pageIndexChange"
- @size-change="handleSizeChange">
- </el-pagination>
- </el-card>
- </el-main>
- </el-container>
- <el-dialog
- class="outerDialog custom_dialog"
- :title="anTitle"
- width="40%"
- :visible.sync="anVisible"
- :close-on-click-modal="false"
- :modal-append-to-body="true"
- :append-to-body="true">
- <el-form :model="anForm" ref="anForm" label-width="200px">
- <el-form-item label="名称">
- <el-input type="text" v-model="anForm.nm" clearable placeholder="请输入村名" style="width:60%;"></el-input>
- </el-form-item>
- <el-form-item label="地点">
- <el-input type="text" v-model="anForm.loc" clearable placeholder="请输入地点" style="width:60%;"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer">
- <el-button style="margin-top:5px;" @click="saveAn">确定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- class="outerDialog custom_dialog"
- title="添加供水工程"
- width="40%"
- :visible.sync="gcVisible"
- :close-on-click-modal="false"
- :modal-append-to-body="true"
- :append-to-body="true">
- <el-form :model="gcForm" ref="gcForm" label-width="200px">
- <el-form-item label="供水工程名称">
- <el-input type="text" v-model="gcForm.nm" clearable placeholder="请输入供水工程名称" style="width:60%;"></el-input>
- </el-form-item>
- <el-form-item label="供水工程规模">
- <el-select v-model="gcForm.designWaterSupply" clearable placeholder="请选择">
- <el-option label="万人工程" value="1"></el-option>
- <el-option label="千人工程" value="2"></el-option>
- <el-option label="千人以下集中供水工程" value="3"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="地点">
- <el-input type="text" v-model="gcForm.loc" clearable placeholder="请输入地点" style="width:60%;"></el-input>
- </el-form-item>
- <el-form-item label="运行管理单位名称">
- <el-input type="text" v-model="gcForm.runDep" clearable placeholder="请输入运行管理单位名称" style="width:60%;"></el-input>
- </el-form-item>
- <el-form-item label="管理人员数量">
- <el-input type="text" v-model="gcForm.mngSize" clearable placeholder="请输入管理人员数量" style="width:60%;"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer">
- <el-button style="margin-top:5px;" @click="saveGC">确定</el-button>
- </span>
- </el-dialog>
- <villT @closeDialogVill="closeDialogVill" v-if="isVisibleVillT" :currentVillDTitle="currentVillDTitle" :currentVillTitle="currentVillTitle" :currentVillId="currentVillId" :currentObjectId="currentObjectId" :currentObjectName="currentObjectName" :currentObjectRgstrId="currentObjectRgstrId" :rowData="rowData" :openType="openType"></villT>
- <gcTab @closeDialogGc="closeDialogGc" v-if="isVisibleGc" :currentGcTitle="currentGcTitle" :currentGcId="currentGcId" :currentObjectId="currentObjectId" :currentObjectName="currentObjectName" :currentObjectRgstrId="currentObjectRgstrId" :rowData="rowData" :openType="openType"></gcTab>
- </div>
- </template>
- <script>
- import inputWith from "@widget/inuptWith.vue"
- import request from "@util/gw_ajax_request.js"
- import villT from "./villT"
- import gcTab from "./gcTab"
- export default {
- components: {
- inputWith: inputWith,
- villT:villT,
- gcTab:gcTab
- },
- props: ['currentObjectId', 'currentObjectName', 'currentObjectRgstrId', 'rowData','openType'],
- data() {
- return {
- treeData: [],
- defaultProps: {
- children: 'children',
- label: 'nm'
- },
- anVisible:false,
- anTitle:"",
- villId:"",
- currentVillId:"",
- currentVillTitle:"",
- currentVillDTitle:"",
- currentGcId:"",
- currentGcTitle:"",
- currRow:{},
- anForm:{
- nm:"",
- loc:""
- },
- gsdwList:[],
- total:0,
- pageSize:5,
- pageNum:1,
- gcVisible:false,
- gcForm:{
- nm:"",
- designWaterSupply:"",
- loc:"",
- runDep:"",
- mngSize:""
- },
- isVisibleVillT:false,
- isVisibleGc:false,
- }
- },
- computed: {
- recPersId() {
- return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
- }
- },
- created() {
- },
- mounted() {
- this.getLeftTreeData();
- this.getGsdwList();
- },
- watch: {
- },
- methods: {
- gsdwRow(row){
- this.currentGcId = row.id;
- this.currentGcTitle = row.nm;
- this.isVisibleGc = true;
- },
- closeDialogVill(){
- this.isVisibleVillT = false;
- },
- closeDialogGc(){
- this.isVisibleGc = false;
- },
- addGsdw(){
- this.gcVisible = true;
- },
- saveGC(){
- var _self = this;
- var obj = this.gcForm;
- obj.rgstrId = this.rowData.rgstrId;
- request.post("/bis/insp/villgd/wtsp",this.gcForm).then(res => {
- if (res.success) {
- _self.gcForm = {};
- _self.gcVisible = false;
- _self.getGsdwList();
- }
- })
- },
- pageIndexChange(val){
- this.pageNum = val;
- this.getGsdwList();
- },
- handleSizeChange(val){
- this.pageSize = val;
- this.getGsdwList();
- },
- handleNodeClickXzc(node, data) {
- if(node.children){
- this.currentVillTitle = "行政村"
- }else{
- this.currentVillTitle = "自然村"
- }
- this.currentVillDTitle = node.nm;
- this.isVisibleVillT = true;
- this.currentVillId = node.id;
- },
- removeNode(row,node){
- var _self = this;
- var url = "";
- if(row.children){
- url = "/bis/insp/villgd/vill/delete/"+row.id;
- }else{
- url = "/bis/insp/villgd/nvill/delete/"+row.id;
- }
- request.post(url).then(res => {
- if (res.success) {
- const parent = node.parent;
- const children = parent.data.children || parent.data;
- const index = children.findIndex(d => d.id === row.id);
- children.splice(index, 1);
- }
- })
- },
- saveAn(){
- var _self = this;
- var obj = this.anForm;
- obj.rgstrId = this.rowData.rgstrId;
- var url = "";
- if(this.villId){
- url = "/bis/insp/villgd/nvill"
- obj.villId = this.villId;
- }else{
- url = "/bis/insp/villgd/vill"
- }
- request.post(url, obj).then(res => {
- if (res.success) {
- _self.anVisible = false;
- _self.anForm = {nm:"", loc:""};
- if(this.villId){
- const newChild = { id: res.data.id,nm:res.data.nm,loc:res.data.loc};
- this.currRow.children.push(newChild);
- }else{
- const newChild = { id: res.data.id,nm:res.data.nm,loc:res.data.loc,children: []};
- _self.treeData.push(newChild);
- }
- }
- })
- },
- addXzc(){
- this.currRow = {};
- this.villId = "";
- this.anTitle = "添加行政村";
- this.anVisible = true;
- },
- addN(row,node){
- this.currRow = row;
- this.villId = row.id;
- this.anTitle = "添加自然村";
- this.anVisible = true;
- },
- //左侧树数据
- getLeftTreeData() {
- var _self = this;
- request.get(`/bis/insp/villgd/getVillTree/${this.rowData.rgstrId}`)
- .then(res => {
- if (res.success && res.data) {
- if(res.data instanceof Array){
- _self.treeData = res.data;
- }else{
- _self.treeData = [];
- }
- }
- })
- },
- getGsdwList(){
- var _self = this;
- var obj = {
- rgstrId: this.rowData.rgstrId,
- pageNum:this.pageNum,
- pageSize:this.pageSize
- }
- request.post(`/bis/insp/villgd/wtsp/listOfPage`,obj).then(res => {
- if (res.success) {
- _self.gsdwList = res.data.list;
- _self.total = res.data.total;
- }
- })
- },
- //供水单位删除
- gsdwDelete(row) {
- this.$confirm('确定要删除该数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.post(`/bis/insp/villgd/wtsp/delete/${row.id}`)
- .then(res => {
- if (res.success) {
- this.$message.success("删除成功");
- this.getGsdwList();
- } else {
- this.$message.warning(res.message);
- }
- })
- .catch(err => {
- console.log(err);
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- }
- }
- }
- </script>
- <style scoped>
- .nygs >>> .el-card__body{
- padding: 5px;
- }
- </style>
- <style lang="scss">
- /*.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;
- }
- /*.mt20{*/
- /*margin-top: 20px;*/
- /*}*/
- .lh40 {
- list-style: none;
- height: 40px;
- line-height: 40px;
- cursor: pointer;
- padding: 0 10px;
- border-bottom: 1px solid rgb(235, 238, 245);
- }
- .flr {
- float: right;
- margin-right: 20px;
- }
- .nygs span.custom-tree-node {
- width: 100%;
- }
- .mr10 {
- margin-right: 20px;
- float: right;
- }
- .nygs .el-tree-node__content {
- height: 40px;
- line-height: 40px;
- }
- .nygs .el-tree > div > div:first-child .mr10 {
- display: none;
- }
- .nygs .el-tree-node.is-current > .el-tree-node__content {
- background-color: gainsboro !important;
- }
- .left_tree .custom-tree-node {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 14px;
- padding-right: 8px;
- }
- /*}*/
- </style>
|