| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448 |
- <template>
- <div class="nygs">
- <el-container style="height:520px;">
- <el-aside width="300px" style="border:1px solid #d5d5ff">
- <p class="aside_title">
- <el-button type="text" @click="addVillage">添加行政村</el-button>
- </p>
- <el-tree :data="treeData" :props="defaultPropsXzc" @node-click="handleNodeClickXzc"
- node-key="id"
- default-expand-all
- :expand-on-click-node="false">
- <span class="custom-tree-node" slot-scope="{ node, data }">
- <span>{{ node.label }}</span>
- <span class="mr10">
- <i class="el-icon-delete" @click.stop="removeNode(node, data)"></i>
- </span>
- </span>
- </el-tree>
- </el-aside>
- <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0;">
- <el-card class="box-card mt20">
- <div slot="header" class="clearfix">
- <span>供水工程</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="addGsdw">添加</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.projectNm }}
- <span class="flr"><i class="el-icon-delete" @click.stop="gsdwDelete(item)"></i></span>
- </p>
- </li>
- </ul>
- </el-card>
- </el-main>
- </el-container>
- <!--添加行政村-->
- <el-dialog
- class="outerDialog custom_dialog"
- title="添加行政村"
- width="40%"
- :visible.sync="villageVisible"
- :modal-append-to-body="true"
- :append-to-body="true">
- <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:0px;">
- <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>
- <countryPro v-if="countryProTianBaoVisible" :gsgcRowData="gsgcRowData" :rowData="rowData" @closeDialog="closeGsGcDialog"
- @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId" :oriFatherName="oriFatherName" :villageNm="villageNm" :villageAdCode="adCode"></countryPro>
- <!--添加供水工程-->
- <editDcdxInfo v-if="gsgcVisible" ref="editDcdxInfoRef" objType="41" :rowData="rowData" :villageAdCode="adCode"
- @addSuccess="DuiXiangAddSuccessHandler"
- @closeDuChaDuiXiangDialog="closeDuChaDuiXiangDialog"></editDcdxInfo>
- </div>
- </template>
- <script>
- import inputWith from "@widget/inuptWith.vue"
- import request from "@util/gw_ajax_request.js"
- import countryPro from "./countryPro"
- export default {
- components: {
- inputWith: inputWith,
- // problemDialog
- editDcdxInfo: resolve => {
- require(['./editDcdxInfo.vue'], resolve)
- },//添加供水工程
- countryPro
- },
- props: ['currentObjectId', 'currentObjectName', 'currentObjectRgstrId', 'currentResCode', 'rowData'],
- data() {
- var checkTel = (rule, value, callback) => {
- if (value == '') {
- callback();
- }
- if (isNaN(value)) {
- callback(new Error('请输入合理电话'));
- }
- var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/; //座机
- var isMob = /^[1][3,4,5,7,8][0-9]{9}$/; // 座机格式
- if (!isMob.test(value) && !isPhone.test(value)) {
- callback(new Error('请输入合理电话'));
- } else {
- callback();
- }
- };
- return {
- yshList: [],
- gsdwList: [],
- wateruserVisible: false,
- villageVisible: false,
- waterUserTianBaoVisible: false,
- countryProTianBaoVisible: false,
- gsgcVisible: false,
- waterUserDialog: false,
- villageTableData: [],
- multipleSelection: [],
- wateruserForm: {
- userNm: "",
- telphone: "",
- },
- treeData: [],
- villageTreeData: [],
- defaultProps: {
- // children: 'children',
- label: 'adName'
- },
- defaultPropsXzc: {
- children: 'dcuserRelVilles',
- label: 'townName'
- },
- adCodes: "",
- townName: "",
- villageNm: "",
- adCode: "",
- yshRowData: null,
- gsgcRowData: null,
- rules: {
- telphone: [{
- validator: checkTel,
- trigger: 'change',
- }],
- },
- oriFatherName: ""
- }
- },
- computed: {
- recPersId() {
- return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
- }
- },
- created() {
- },
- mounted() {
- this.getLeftTreeData();
- this.getYsGsdwList(this.rowData.code, this.rowData.rgstrId);
- },
- watch: {
- // currentObjectRgstrId(n, o) {
- // this.getRgstridObj();
- // },
- },
- methods: {
- //添加行政村
- addVillage() {
- this.villageVisible = true;
- this.getVillageTreeList();
- },
- getVillageTreeList() {
- request.get(`/bis/zhejiang/vill/rgstr/findCheckTree/${this.rowData.code}/${this.rowData.rgstrId}`)
- .then(res => {
- if (res.success && res.data) {
- this.$nextTick(() => {
- if(res.data.length){
- this.villageTreeData = res.data;
- let length = this.villageTreeData - 1
- this.villageTableData = res.data[length].attCountryDtoList;
- this.townName = res.data[length].adName;
- }
- })
- }
- })
- },
- //villageSave添加行政村确定
- villageSave() {
- if (!this.multipleSelection.length) {
- this.$message.warning("请至少选择一个行政村");
- return;
- }
- let obj = [{
- "codes": this.adCodes,
- "regstrId": this.rowData.rgstrId,
- "townName": this.townName
- }]
- request.post(`/bis/zhejiang/dcuser/rel/vill/addbatch`, obj)
- .then(res => {
- if (res.success) {
- this.$message.success("添加行政村成功");
- this.getLeftTreeData();
- this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
- this.villageVisible = false;
- } else {
- this.$message.warning(res.message);
- }
- })
- },
- handleSelectionChange(val) {
- this.adCodes = "";
- this.multipleSelection = val;
- this.multipleSelection.map(i => {
- return this.adCodes += i.adCode + ";";
- })
- this.adCodes = this.adCodes.substr(0, this.adCodes.length - 1);
- },
- //左侧树数据
- getLeftTreeData() {
- request.get(`/bis/zhejiang/vill/rgstr/findTree/${this.rowData.code}/${this.rowData.rgstrId}`)
- .then(res => {
- if (res.success && res.data) {
- this.treeData = res.data;
- this.treeData.forEach(i => {
- if (i["dcuserRelVilles"]) {
- i["dcuserRelVilles"].forEach(j => {
- j.townName = j.villageNm;
- })
- }
- })
- this.adCode = this.treeData[0].dcuserRelVilles[0].adCode ? this.treeData[0].dcuserRelVilles[0].adCode : "";
- this.villageNm = this.treeData[0].dcuserRelVilles[0].villageNm ? this.treeData[0].dcuserRelVilles[0].villageNm : "";
- this.oriFatherName = this.treeData[0].townName ? this.treeData[0].townName : "";
- console.log(this.villageNm,this.oriFatherName);
- }
- })
- },
- //获取用水户、供水工程列表
- getYsGsdwList(code, rgstrId) {
- request.get(`/bis/zhejiang/vill/rgstr/findNode/${code}/${rgstrId}`)
- .then(res => {
- if (res.success) {
- this.$nextTick(() => {
- this.gsdwList = res.data.countryPro;
- this.yshList = res.data.waterUsers;
- })
- }
- })
- },
- //供水工程添加
- addGsdw() {
- if(this.adCode){
- this.gsgcVisible = true;
- }else{
- this.$message.warning("请选择左侧行政村");
- }
- },
- //供水工程row
- gsdwRow(row) {
- this.gsgcRowData = row;
- this.countryProTianBaoVisible = true;
- },
- //供水工程删除
- gsdwDelete(row) {
- this.$confirm('确定要删除该数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.get(`/bis/zhejiang/country/fee/del/${row.id}`)
- .then(res => {
- if (res.success) {
- this.$message.success("删除成功");
- this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
- } else {
- this.$message.warning(res.message);
- }
- })
- .catch(err => {
- console.log(err);
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- handleNodeClick(data) {
- this.$nextTick(() => {
- this.townName = data.adName;
- this.villageTableData = data.attCountryDtoList;
- })
- },
- handleNodeClickXzc(node, data) {
- this.$nextTick(() => {
- console.log(node,data);
- if (node.adCode && node.villageNm) {
- this.oriFatherName = data.parent.data.townName;
- this.adCode = node.adCode;
- this.villageNm = node.villageNm;
- this.getYsGsdwList(node.adCode, node.rgstrId);
- }
- })
- },
- closeDialog() {
- this.waterUserTianBaoVisible = false;
- },
- closeGsGcDialog(val) {
- this.countryProTianBaoVisible = false;
- if (val === "success") {
- this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
- }
- },
- addShuiKuSuccess() {
- this.waterUserTianBaoVisible = false;
- },
- // 删除左侧树行政村
- removeNode(node, data) {
- if (data.id) {
- this.$confirm('确定清空督查数据并将该村从督查任务中删除, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.get(`/bis/zhejiang/dcuser/rel/vill/del/${data.id}`)
- .then(res => {
- if (res.success) {
- this.$message.success("删除成功");
- this.getLeftTreeData();
- } else {
- this.$message.warning(res.message);
- }
- })
- .catch(err => {
- console.log(err);
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- }
- },
- DuiXiangAddSuccessHandler: function () {
- this.gsgcVisible = false;
- this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
- },
- closeDuChaDuiXiangDialog() {
- this.gsgcVisible = false;
- }
- }
- }
- </script>
- <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: 420px;
- 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;
- }
- /*}*/
- </style>
|