| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- <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">
- <div slot="header" class="clearfix">
- <span>贫困户</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="addYsh">添加</el-button>
- </div>
- <ul class="ul_height">
- <li v-for="(item,index) in yshList" :key="index" class="text item lh40">
- <p @click="yshRow(item)">
- {{ item.userNm }}
- <span class="flr"><i class="el-icon-delete" @click.stop="yshDelete(item)"></i></span>
- </p>
- </li>
- </ul>
- </el-card>
- <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.prjNm }}
- <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>
- <!--贫困户-->
- <el-dialog
- class="outerDialog custom_dialog"
- title="添加贫困户"
- width="40%"
- :visible.sync="wateruserVisible"
- :close-on-click-modal="false"
- :modal-append-to-body="true"
- :append-to-body="true">
- <el-form :model="wateruserForm" ref="wateruserForm" label-width="200px">
- <el-form-item label="户主姓名" required>
- <el-input type="text" v-model="wateruserForm.userNm" clearable placeholder="请输入户主姓名"
- style="width:60%;"></el-input>
- </el-form-item>
- <el-form-item label="联系方式">
- <el-input type="text" v-model="wateruserForm.telphone" clearable placeholder="请输入联系方式"
- style="width:60%;"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer">
- <el-button style="margin-top:5px;" @click="waterUserSave">确定</el-button>
- </span>
- </el-dialog>
- <waterUser v-if="waterUserTianBaoVisible" :yshRowData="yshRowData" :rowData="rowData" @closeDialog="closeDialog"
- @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId"
- :oriFatherName="oriFatherName" :villageNm="villageNm"></waterUser>
- <countryPro v-if="countryProTianBaoVisible" :gsgcRowData="gsgcRowData" :rowData="rowData"
- @closeDialog="closeGsGcDialog"
- @addShuiKuSuccess="addShuiKuSuccess" :currentObjectId="currentObjectId"
- :oriFatherName="oriFatherName" :villageNm="villageNm"></countryPro>
- <!--添加供水工程-->
- <editDcdxInfo v-if="gsgcVisible" ref="editDcdxInfoRef" objType="25" :rowData="rowData"
- :villageAdCode="villageAdCode"
- @addSuccess="DuiXiangAddSuccessHandler"
- @closeDuChaDuiXiangDialog="closeDuChaDuiXiangDialog"></editDcdxInfo>
- </div>
- </template>
- <script>
- import inputWith from "@widget/inuptWith.vue"
- import request from "@util/gw_ajax_request.js"
- import waterUser from "./waterUser"
- import countryPro from "./countryPro"
- export default {
- components: {
- inputWith: inputWith,
- // problemDialog
- waterUser: waterUser,//贫困户填报
- editDcdxInfo: resolve => {
- require(['./editDcdxInfo.vue'], resolve)
- },//添加供水工程
- countryPro
- },
- props: ['currentObjectId', 'currentObjectName', 'currentObjectRgstrId', '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,9][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: "",
- villageAdCode: ""
- }
- },
- computed: {
- recPersId() {
- return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
- }
- },
- created() {
- },
- mounted() {
- this.getLeftTreeData();
- },
- watch: {
- // currentObjectRgstrId(n, o) {
- // this.getRgstridObj();
- // },
- },
- methods: {
- //添加行政村
- addVillage() {
- this.villageVisible = true;
- this.getVillageTreeList();
- },
- getVillageTreeList() {
- request.get(`/bis/rdwsp/rgstr/findCheckTree/${this.rowData.code}/${this.currentObjectRgstrId}`)
- .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/rdwsp/rgstr/rel/vill/addbatch`, obj)
- .then(res => {
- if (res.success) {
- this.$message.success("添加行政村成功");
- this.getLeftTreeData();
- 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);
- },
- //左侧树数据
- async getLeftTreeData() {
- await request.get(`/bis/rdwsp/rgstr/findTree/${this.rowData.code}/${this.currentObjectRgstrId}`)
- .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.villageAdCode = 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);
- }
- })
- await this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
- },
- //获取贫困户、供水单位列表
- getYsGsdwList(code, regstrId) {
- request.get(`/bis/rdwsp/rgstr/findNode/${code}/${regstrId}`)
- .then(res => {
- if (res.success) {
- this.$nextTick(() => {
- this.gsdwList = res.data.countryPro;
- this.yshList = res.data.waterUsers;
- })
- }
- })
- },
- //贫困户添加
- addYsh() {
- if (this.adCode) {
- for (var obj in this.wateruserForm) {
- this.wateruserForm[obj] = '';
- }
- this.wateruserVisible = true;
- } else {
- this.$message.warning("请选择左侧行政村");
- }
- },
- //添加贫困户保存
- waterUserSave() {
- if (!this.wateruserForm.userNm) {
- this.$message.warning("请填写贫困户户主姓名");
- return;
- }
- let obj = {
- villageNm: this.villageNm,
- adCode: this.adCode,
- userNm: this.wateruserForm.userNm,
- telphone: this.wateruserForm.telphone,
- regstrId: this.rowData.rgstrId,
- }
- request.post(`/bis/rdwsp/rgstr/poor`, obj)
- .then(res => {
- if (res.success) {
- this.$message.success("添加贫困户成功");
- this.wateruserVisible = false;
- this.getYsGsdwList(this.adCode, this.rowData.rgstrId);
- this.yshRow(res.data);
- }
- })
- },
- //贫困户row
- yshRow(row) {
- this.yshRowData = row;
- this.waterUserTianBaoVisible = true;
- },
- //贫困户删除
- yshDelete(row) {
- this.$confirm('确定要删除该数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.get(`/bis/rdwsp/rgstr/poor/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: '已取消删除'
- });
- });
- },
- //供水单位添加
- 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/bis/rdwsp/rgstr/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.regstrId);
- this.villageAdCode = node.adCode;
- }
- })
- },
- 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/rdwsp/rgstr/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: 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;
- }
- /*}*/
- </style>
|