| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738 |
- <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
- highlight-current
- :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.uswtName }}
- <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="addNtsl">添加</el-button>
- </div>
- <ul class="ul_height">
- <li v-for="(item,index) in ntslList" :key="index" class="text item lh40">
- <p @click="ntslRow(item)">
- <span class="ml5v">{{item.name}}</span>
- <span>{{ntslProject(item.type)}}</span>
- <span class="flr"><i class="el-icon-delete" @click.stop="ntslDelete(item)"></i></span>
- </p>
- </li>
- </ul>
- </el-card>
- </el-main>
- </el-container>
- <!--用水户-->
- <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>
- <!-- 用水户填报信息弹窗 -->
- <el-dialog title="用水户信息填报" :visible.sync="waterUserTianBaoVisible" :close-on-click-modal="false"
- width="50%"
- :modal-append-to-body="true"
- :append-to-body="true">
- <householdIrrigation
- v-if="waterUserTianBaoVisible"
- @addShuiKuSuccess="addShuiKuSuccess"
- :currentObjectRgstrId="currentObjectRgstrId"
- :currentResCode="currentResCode"
- :currentObjectName="currentObjectName"
- :currentObjectId="currentObjectId"
- :rowId="yshRowData.id">
- </householdIrrigation>
- </el-dialog>
- <!-- 工程填报信息弹窗 -->
- <el-dialog :title="titleText" :visible.sync="dialogProjectVisible" :close-on-click-modal="false"
- width="50%"
- :modal-append-to-body="true"
- :append-to-body="true">
- <component
- v-if="dialogProjectVisible"
- :is="componentId"
- @addShuiKuSuccess="closeDialog"
- :currentObjectRgstrId="currentObjectRgstrId"
- :currentResCode="currentResCode"
- :currentObjectName="titleText"
- :currentObjectId="currentObjectId"
- :rowId="ntslRowId"
- :adFullName="adFullName">
- </component>
- </el-dialog>
- <!--添加行政村-->
- <addVillage v-if="villageVisible"
- :currentObjectRgstrId="currentObjectRgstrId"
- :currentObjectName="currentObjectName"
- :currentResCode="currentResCode"
- :currentObjectId="currentObjectId"
- :rowData="rowData"
- @closeDialogVillageTowns="closeDialogVillageTowns"
- @addVillageSuccess="addVillageSuccess"></addVillage>
- <!--添加农田水利工程-->
- <el-dialog title="添加农田水利工程" :visible.sync="addRsvrVisible" append-to-body width="40%" >
- <el-form label-width="200px" :model="formObj" ref="formObj" :rules="rulesProject">
- <el-form-item label="工程名称" prop="name">
- <el-input v-model="formObj.name" clearable autocomplete="off" style="width:60%;"></el-input>
- </el-form-item>
- <el-form-item label="工程类型" prop="type">
- <el-select v-model="formObj.type" clearable placeholder="请选择" autocomplete="off" style="width:60%;">
- <el-option
- v-for="item in projectList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="addRsvrVisible = false">取 消</el-button>
- <el-button type="primary" @click="addNewRsvr('formObj')">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import inputWith from "@widget/inuptWith.vue"
- import request from "@util/gw_ajax_request.js"
- import addVillage from './addVillage'
- export default {
- components: {
- inputWith: inputWith,
- addVillage: addVillage,
- householdIrrigation: resolve => {
- require(["./householdIrrigation.vue"], resolve);
- },
- engineeringOperationQd: resolve => {
- require(["./engineeringOperationQd.vue"], resolve);
- },
- engineeringOperationGd: resolve => {
- require(["./engineeringOperationGd.vue"], resolve);
- },
- engineeringOperationPg: resolve => {
- require(["./engineeringOperationPg.vue"], resolve);
- },
- engineeringOperationWg: resolve => {
- require(["./engineeringOperationWg.vue"], resolve);
- },
- engineeringOperationBz: resolve => {
- require(["./engineeringOperationBz.vue"], resolve);
- },
- engineeringOperationTb: resolve => {
- require(["./engineeringOperationTb.vue"], resolve);
- },
- engineeringOperationSjSc: resolve => {
- require(["./engineeringOperationSjSc.vue"], resolve);
- },
- engineeringOperationYz: resolve => {
- require(["./engineeringOperationYz.vue"], resolve);
- },
- engineeringOperationJiJing: resolve => {
- require(["./engineeringOperationJiJing.vue"], resolve);
- },
- },
- 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: [],
- ntslList: [],
- 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: 'attCountryDtoList',
- label: 'adName'
- },
- townName: "",
- adName: "",
- adCode: "",
- yshRowData: null,
- gsgcRowData: null,
- rules: {
- telphone: [{
- validator: checkTel,
- trigger: 'change',
- }],
- },
- oriFatherName: "",
- pageNum: 1,
- pageSize: 10,
- dialogProjectVisible: false,
- titleText: "",
- componentId: '', //当前弹窗加载的组件
- rowId: "",
- projectName: "",
- addRsvrVisible: false,
- formObj: {
- "name": "",
- "type": ""
- },
- projectList: [
- {
- label: "机井",
- value: "2"
- },
- {
- label: "堰闸",
- value: "3"
- },
- {
- label: "水窖、水池等小型蓄水设施",
- value: "4"
- },
- {
- label: "塘坝",
- value: "5"
- },
- {
- label: "泵站",
- value: "6"
- },
- {
- label: "微灌",
- value: "7"
- },
- {
- label: "喷灌",
- value: "8"
- },
- {
- label: "管道",
- value: "9"
- },
- {
- label: "渠道",
- value: "10"
- }
- ],
- rulesProject: {
- name: [
- {required: true, message: '请输入工程名称', trigger: 'blur'},
- ],
- type: [
- {required: true, message: '请选择工程类型', trigger: 'change'}
- ]
- },
- ntslRowId: null,
- deleteUrl: null,
- adFullName: null
- }
- },
- computed: {
- recPersId() {
- return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
- }
- },
- created() {
- },
- mounted() {
- this.getLeftTreeData();
- },
- methods: {
- //添加行政村
- addVillage() {
- this.villageVisible = true;
- this.getVillageTreeList();
- },
- 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;
- }
- })
- }
- })
- },
- //左侧树数据
- getLeftTreeData() {
- request.post(`/bis/insp/irr/towns/dsu/tree`, {"rgstrId": this.rowData.rgstrId})
- .then(res => {
- if (res.success && res.data) {
- this.$nextTick(()=>{
- this.treeData = res.data;
- this.adCode = this.treeData[0].attCountryDtoList[0].adCode ? this.treeData[0].attCountryDtoList[0].adCode : "";
- this.adName = this.treeData[0].attCountryDtoList[0].adName ? this.treeData[0].attCountryDtoList[0].adName : "";
- this.oriFatherName = this.treeData[0].adName ? this.treeData[0].adName : "";
- this.getYsNtslList();
- })
- }
- })
- },
- //获取用水户、供水单位列表
- getYsNtslList() {
- request.post(`/bis/insp/irr/towns/dsu/findProjectList`, {
- "adCode": this.adCode,
- "rgstrId": this.rowData.rgstrId
- }).then(res => {
- if (res.success) {
- this.$nextTick(() => {
- this.ntslList = 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;
- }
- // if (!this.wateruserForm.telphone) {
- // this.$message.warning("请填写用水户户主联系方式");
- // return;
- // }
- let obj = {
- adName: this.adFullName,
- adCode: this.adCode,
- uswtName: this.wateruserForm.userNm,
- uswtPhone: this.wateruserForm.telphone,
- objId: this.rowData.objId,
- rgstrId: this.rowData.rgstrId,
- persId: this.recPersId
- }
- request.post(`/bis/insp/irr/wtusr`, obj)
- .then(res => {
- if (res.success) {
- this.$message.success("添加用水户成功");
- this.wateruserVisible = false;
- this.getYsNtslList();
- }
- })
- },
- //用水户row
- yshRow(row) {
- this.yshRowData = row;
- this.waterUserTianBaoVisible = true;
- },
- //用水户删除
- yshDelete(row) {
- this.$confirm('确定要删除该数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.get(`/bis/insp/irr/wtusr/del/${row.id}`)
- .then(res => {
- if (res.success) {
- this.$message.success("删除成功");
- this.getYsNtslList();
- } else {
- this.$message.warning(res.message);
- }
- })
- .catch(err => {
- console.log(err);
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- //供水单位添加
- addNtsl() {
- if (this.adCode) {
- this.addRsvrVisible = true;
- } else {
- this.$message.warning("请选择左侧行政村");
- }
- },
- //供水单位row
- ntslRow(row) {
- this.ntslRowId = row.id;
- this.titleText = row.name;
- let val = row.type;
- switch (val) {
- case '10' :
- this.componentId = 'engineeringOperationQd';
- break;
- case '9' :
- this.componentId = 'engineeringOperationGd';
- break;
- case '8' :
- this.componentId = 'engineeringOperationPg';
- break;
- case '7' :
- this.componentId = 'engineeringOperationWg';
- break;
- case '6' :
- this.componentId = 'engineeringOperationBz';
- break;
- case '5' :
- this.componentId = 'engineeringOperationTb';
- break;
- case '4' :
- this.componentId = 'engineeringOperationSjSc';
- break;
- case '3' :
- this.componentId = 'engineeringOperationYz';
- break;
- case '2' :
- this.componentId = 'engineeringOperationJiJing';
- break;
- }
- this.dialogProjectVisible = true;
- },
- //供水单位删除
- ntslDelete(row) {
- let rowId = row.id;
- let val = row.type;
- switch (val) {
- case '10' :
- this.deleteUrl = '/bis/insp/irr/chan/del/';
- break;
- case '9' :
- this.deleteUrl = '/bis/insp/irr/pipe/del/';
- break;
- case '8' :
- this.deleteUrl = '/bis/insp/irr/spray/del/';
- break;
- case '7' :
- this.deleteUrl = '/bis/insp/irr/micro/del/';
- break;
- case '6' :
- this.deleteUrl = '/bis/insp/irr/pust/del/';
- break;
- case '5' :
- this.deleteUrl = '/bis/insp/irr/pond/del/';
- break;
- case '4' :
- this.deleteUrl = '/bis/insp/irr/pit/del/';
- break;
- case '3' :
- this.deleteUrl = '/bis/insp/irr/was/del/';
- break;
- case '2' :
- this.deleteUrl = '/bis/insp/irr/well/del/';
- break;
- }
- this.getMoveRow(rowId,this.deleteUrl);
- },
- getMoveRow(rowId,url){
- this.$confirm('确定要删除该工程, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.get(url + rowId)
- .then(res =>{
- if(res.success){
- this.$message.success("删除成功");
- this.getYsNtslList();
- }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.adName) {
- this.oriFatherName = data.parent.data.adName;
- this.adCode = node.adCode;
- this.adName = node.adName;
- this.getYsNtslList();
- }
- })
- },
- closeGsGcDialog(val) {
- this.countryProTianBaoVisible = false;
- if (val === "success") {
- this.getYsNtslList();
- }
- },
- addShuiKuSuccess() {
- this.waterUserTianBaoVisible = false;
- },
- // 删除左侧树行政村
- removeNode(node, data) {
- if (data.id) {
- this.$confirm('确定清空督查数据并将该村从督查任务中删除, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.post(`/bis/insp/irr/towns/dsu/delTown/${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.getYsNtslList();
- },
- closeDuChaDuiXiangDialog() {
- this.gsgcVisible = false;
- },
- // handleSizeChange(val) {
- // this.pageSize = val;
- // this.getNoticeList();
- // },
- // handleCurrentChange(val) {
- // this.pageNum = val;
- // this.getNoticeList();
- // },
- ntslProject(row) {
- return row == "2" ? "机井" : row == "3" ? "堰闸" : row == "4" ? "水窖、水池等小型蓄水设施" : row == "5" ? "塘坝" : row == "6" ? "泵站" : row == "7" ? "微灌" : row == "8" ? "喷灌" : row == "9" ? "管道" : row == "10" ? "渠道" : "";
- },
- closeDialog() {
- this.dialogProjectVisible = false;
- // this.getTableDataList();
- },
- closeDialogVillageTowns() {
- this.villageVisible = false;
- },
- addVillageSuccess() {
- this.villageVisible = false;
- this.getLeftTreeData();
- },
- addNewRsvr(formName) {
- let obj = {
- "adCode": this.adCode,
- "adName": this.adFullName,
- "name": this.formObj.name,
- "objId": this.rowData.objId,
- "persId": this.rowData.rgstrId,
- "rgstrId": this.rowData.rgstrId,
- "type": this.formObj.type
- }
- this.$refs[formName].validate((valid) => {
- if (valid) {
- request.post('/bis/insp/irr/towns/dsu/addProject', obj).then(res => {
- if (res.success) {
- this.$message.success('添加成功');
- this.getYsNtslList();
- this.addRsvrVisible = false;
- } else {
- _this.$message.error(res.message)
- }
- }).catch(res => {
- this.$message.error(res.message)
- })
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- },
- watch:{
- adName(val){
- if(val) this.adFullName = this.currentObjectName + '-' + this.oriFatherName + '-' + val;
- }
- }
- }
- </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;
- }
- .ml5v {
- width: 10vw;
- display: inline-block;
- }
- /*}*/
- </style>
|