| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- <template>
- <!-- 弹出窗 -->
- <el-dialog title="添加稽察对象" :visible.sync="dialogFormVisible" width="80%" @close="CloseDialog" :modal-append-to-body="true" :append-to-body="true">
- <el-container>
- <el-aside width="200px" style="border:1px solid #d5d5ff">
- <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">
- <i class="el-icon-share"></i>所属机构
- </p>
- <!--<provTreeList-->
- <!--rootCode="000000"-->
- <!--style="max-height:485px;"-->
- <!--@provTreeSelectChange="provTreeSelectChangeHandler">-->
- <!--</provTreeList>-->
- <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" default-expand-all="true"></el-tree>
- </el-aside>
- <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
- <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">督查对象</p>
- <el-form style="padding:10px">
- <div>
- <el-form size="mini" :inline="true" class="demo-form-inline">
- <el-form-item label="项目名称">
- <el-input style="width:140px;" v-model="searchNameOfSzName" clearable placeholder="请输入项目名称" ></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="refreshCurrentShow">查询</el-button>
- </el-form-item>
- <!-- <el-form-item>
- <el-button type="primary" @click="toAddNewObj">添加</el-button>
- </el-form-item>-->
- </el-form>
- <el-table
- border
- v-loading="loading"
- :data="currentShowList"
- tooltip-effect="dark"
- style="width: 100%"
- @selection-change="handleSelectionChange">
- <el-table-column align="center" type="selection" width="60"></el-table-column>
- <el-table-column align="center" prop="index" label="序号" min-width="40"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="name" label="项目名称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="type" label="项目类型" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="location" label="位置" min-width="150"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="admOrg" label="所属流域机构" min-width="100"></el-table-column>
- <!--<el-table-column align="center" fixed="right" prop="address" label="操作" min-width="60">
- <!–<el-table-column align="center" fixed="right" prop="address" label="操作" min-width="60" v-if="ownPriv('manage')">–>
- <template slot-scope="scope">
- <el-button @click="editHandler(scope.row)" type="text" size="small">编辑</el-button>
- <el-button @click="deleteHandler(scope.row)" type="text" size="small">删除</el-button>
- </template>
- </el-table-column>-->
- </el-table>
- <div class="block"
- style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;">
- <el-pagination
- small
- @current-change="handleCurrentChange"
- :pager-count="5"
- :current-page.sync="pageIndex"
- :page-size="pageSize"
- layout="total, prev, pager, next"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </el-form>
- </el-main>
- </el-container>
- <el-dialog title="添加项目" :visible.sync="addObjDialogVisible" append-to-body>
- <el-form label-width="120px" :model="formObj" ref="formObj">
- <el-form-item label="项目名称" required >
- <el-input v-model="formObj.name" autocomplete="off" style="width:70%;"></el-input>
- </el-form-item>
- <el-form-item label="项目类型" required>
- <el-input v-model="formObj.type" autocomplete="off" style="width:70%;"></el-input>
- <!-- <el-select v-model="formObj.type" placeholder="请选择">
- <el-option v-for="item in gongchengguimo" :key="item.value" :label="item.label" :value="item.value"></el-option>
- </el-select> -->
- </el-form-item>
- <el-form-item label="行政区域" required>
- <div>
- <el-select v-model="provName" placeholder="选择省" @change="provChange" style="width:20%">
- <el-option
- v-for="item in provList"
- :key="item.adCode"
- :label="item.adName"
- :value="item.adCode">
- </el-option>
- </el-select>
- <el-select v-model="cityName" placeholder="选择市" @change="cityChange" style="width:20%">
- <el-option
- v-for="item in cityList"
- :key="item.adCode"
- :label="item.adName"
- :value="item.adCode">
- </el-option>
- </el-select>
- <el-select v-model="countryName" placeholder="选择县" @change="countryChange" style="width:20%">
- <el-option
- v-for="item in countryList"
- :key="item.adCode"
- :label="item.adName"
- :value="item.adCode">
- </el-option>
- </el-select>
- </div>
- </el-form-item>
- <el-form-item label="所在地点" required >
- <el-input v-model="formObj.location" autocomplete="off" style="width:70%;"></el-input>
- </el-form-item>
- <el-form-item label="流域机构" >
- <el-input v-model="formObj.admOrg" autocomplete="off" style="width:70%;"></el-input>
- </el-form-item>
- <!-- <el-form-item label="创建时间" >
- <el-date-picker v-model="formObj.intm" type="date" value-format="yyyy-MM-dd" placeholder="选择日期">
- </el-date-picker>
- </el-form-item> -->
- <el-form-item label="经度">
- <el-input v-model="formObj.centerX" autocomplete="off" style="width:70%;"></el-input>
- </el-form-item>
- <el-form-item label="纬度">
- <el-input v-model="formObj.centerY" autocomplete="off" style="width:70%;"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="addObjDialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="addNewJcObj('formObj')">确 定</el-button>
- </div>
- </el-dialog>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveChange">确 定</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import request from '../../utils/gw_ajax_request.js';
- import provTreeList from "../../widgets/provTreeList.vue";
- export default {
- components: {
- provTreeList: provTreeList,
- provTreeListQy:resolve => {require(['../../widgets/provTreeList_quyu.vue'],resolve)},
- },
- props: ["dczId", "dczName", "plnaId", "objType","nodeAreaList","nodeRow"],
- computed: {
- userId:function(){
- return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
- }
- },
- data() {
- return {
- addOnce:false,
- searchNameOfSzName: "",
- searchNameOfAdName: "",
- searchNameOfwtdstNm: "",
- rsAdmDep: "",
- type: "",
- wtdstState: "",
- engLevel: "",
- wtdstType: "",
- stnm:'',
- pageIndex: 1,
- pageSize: 10,
- total: 0,
- currentShowList: [],
- dialogFormVisible: true,
- formLabelWidth: "120",
- addArr: "",
- addName:"",
- addLttd:"",
- addLgtd:"",
- multipleSelection: [],
- gongchengguimo:[
- {
- value: "类型一",
- label: "类型一"
- },
- {
- value: "类型二",
- label: "类型二"
- }
- ],
- searchProvTreeListCode: "",
- qyDataList:[],
- loading:false,
- showLeftTree:true,
- addObjDialogVisible: false,
- formObj: {
- "name": '',
- "admOrg": "",
- "rsLoc": "",
- "location": '',
- "intm": "",
- "type": "",
- "regCode": "",
- "centerX": "",
- "centerY": "",
- "adCode": ""
- },
- currentAdCode:'',
- props: {
- value: 'id',
- label: 'label',
- children: 'cities'
- },
- provList: [],
- cityList: [],
- countryList: [],
- provName: '',
- cityName: '',
- countryName: '',
- provNames: '',
- cityNames: '',
- countryNames: '',
- curSelectItem: 0,
- treeData:[],
- defaultProps: {
- label: "adName"
- },
- leftAdCode:"",
- ifLeftClick: true
- }
- },
- watch: {
- nodeAreaList(n){
- this.$nextTick(()=>{
- this.treeData = n;
- })
- },
- leftAdCode(){
- this.getTableData_jc();
- }
- },
- mounted() {
- this.$nextTick(()=>{
- this.getTableData_jc();
- this.treeData = this.nodeAreaList;
- })
- },
- computed:{
- userId:function(){
- return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
- },
- },
- methods: {
- gateTypeFormatter(row,column){
- return row.gateType == '1'? "分(泄)洪闸":
- row.gateType == '2'? "节制闸":
- row.gateType == '3'? "排(退)水闸":
- row.gateType == '4'? "引(进)水闸":
- row.gateType == '5'? "挡潮闸":
- row.gateType == '6'? "船闸":
- row.gateType == '9'? "其它": '';
- },
- showDialog() {
- this.dialogFormVisible = true;
- if(this.$refs['provTreeListQyRef']){
- this.$refs['provTreeListQyRef'].getQyList();
- }
- this.getTableData_jc();
- },
- saveChange() {
- this.addObjectChange();
- },
- treeDataEmit(item){
- this.qyDataList = item;
- if(this.qyDataList.length == 0){
- this.showLeftTree = false;
- }else{
- this.showLeftTree = true;
- }
- },
- getTableData_jc(){
- let _self = this;
- let str = "";
- if(this.ifLeftClick){
- if(this.nodeAreaList && this.nodeAreaList.length > 0){
- _self.nodeAreaList.forEach(item =>{
- str += item.adCode + ",";
- })
- }
- _self.leftAdCode = str.substring(0, str.length - 1);
- }else{
- _self.leftAdCode = _self.leftAdCode;
- }
- request.post(`/tac/insp/year/batch/obj/getBaseNotInGroupPageByGroupId`,{
- 'adCode': this.leftAdCode,
- 'ojbNm': this.searchNameOfSzName,
- 'pageSize': this.pageSize,
- 'pageNum': this.pageIndex,
- 'groupId': this.nodeRow.id,
- }).then(res =>{
- if(res.success){
- _self.$nextTick(() =>{
- _self.loading = false;
- _self.currentShowList = res.data.list;
- _self.currentShowList.forEach((element, index) => {
- element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
- });
- _self.total = res.data.total;
- })
- }
- })
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- handleCurrentChange(val) {
- console.log(`当前页: ${val}`);
- this.refreshCurrentShow();
- },
- refreshCurrentShow: function() {
- if(this.searchProvTreeListCode){
- this.getTableData_jc1();
- }else{
- this.getTableData_jc();
- }
- },
- toAddNewObj(){
- this.provName = "";
- this.cityName = "";
- this.countryName = "";
- for(var obj in this.formObj){
- this.formObj[obj] ='';
- }
- this.addObjDialogVisible = true;
- this.curSelectItem = null;
- this.getAreaList();
- },
- addNewJcObj(formName){
- let _this = this
- if(!this.formObj.name){
- this.$message.warning('请输入项目名称')
- return
- }
- if(!this.formObj.type){
- this.$message.warning('请选择项目类型')
- return
- }
-
- if(!this.formObj.location){
- this.$message.warning('请输入所在地')
- return
- }
- if(!this.provName){
- this.$message.warning('请选择省')
- return
- }
- this.formObj.adCode = this.currentAdCode
- this.formObj.persId = this.userId;
- this.$refs[formName].validate((valid) => {
- if (valid) {
- request.post('/tac/att/pawp/base',this.formObj).then(res=>{
- if(res.success){
- _this.$message.success('添加成功')
- _this.getTableData_jc();
- _this.addObjDialogVisible = false
- _this.formObj = {
- "name": '',
- "admOrg": "",
- "rsLoc": "",
- "location": '',
- "type": "",
- "regCode": "",
- "intm": "",
- "adCode": "",
- "centerX": "",
- "centerY": "",
- };
- }else{
- _this.$message.error(res.message)
- }
- }).catch(res=>{
- _this.$message.error('请求错误'+ res.message)
- })
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- editHandler(row){
- let rowObj = {};
- Object.assign(rowObj, row);
- this.formObj = rowObj;
- this.addObjDialogVisible = true;
- this.curSelectItem = null;
- this.getAreaList();
- },
- deleteHandler(row){
- var _self = this;
- var url = '/tac/att/pawp/base/del/'+row.id
- _self.$confirm('是否确认删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- request.get(url,{}).then(res=>{
- if(res.success){
- _self.$message.success('删除成功')
- _self.getTableData_jc();
- }else{
- _this.$message.error('删除失败')
- }
- })
- }).catch(() => {
- _self.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
-
- },
- addObjectChange: function() {
- //提交当前选中对象
- var _self = this;
- try {
- request.post("/tac/insp/year/batch/obj/inesrtBatchObj", {
- "groupNm": _self.nodeRow.group,
- "groupId": _self.nodeRow.id,
- "persId": _self.userId,
- "yearBatchId": _self.nodeRow.yearBatchId,
- "baseList": _self.multipleSelection
- }).then(response => {
- if (response.success == true) {
- // _self.addOnce = false;
- _self.dialogFormVisible = false;
- _self.$message.success("添加成功");
- _self.$emit("closeDialog");
- }
- });
- } catch (e) {
- alert("暂无数据");
- }
- },
- provTreeSelectChangeHandler: function(params) {
- this.searchProvTreeListCode = params.code;
- this.getTableData_jc1();
- },
- provTreeSelectChangeHandler_qy(params){
- this.searchProvTreeListCode = params.code;
- this.getTableData_jc1();
- },
- getAreaList(val){
- let adCode = ''
- if(!val){
- adCode = '000000000000'
- }else{
- adCode = val
- }
- request.get('/dc/ad/base/getAdData',{params:{'adCode':adCode}}).then(res=>{
- if(res.success){
- if(this.curSelectItem == 1){
- this.cityList = res.data
- }else if(this.curSelectItem == 2){
- this.countryList = res.data
- }else{
- this.provList = res.data
- }
- }
- })
- },
- provChange(val){
- this.curSelectItem = 1
- this.cityName = ''
- this.countryName = ''
- this.formObj.adCode = val
- this.currentAdCode = val
- this.provList.forEach(ele=>{
- if(ele.adCode == this.provName){
- this.provNames = ele.adName
- }
- })
- this.formObj.location = this.provNames
- this.getAreaList(val)
- },
- cityChange(val){
- this.curSelectItem = 2
- if(val && val != ''){
- this.formObj.adCode = val
- this.currentAdCode = val
- this.countryName = ''
- this.cityList.forEach(ele=>{
- if(ele.adCode == this.cityName){
- this.cityNames = ele.adName
- }
- })
- this.formObj.location = this.provNames + this.cityNames
- this.getAreaList(val)
- }
- },
- countryChange(val){
- if(val && val != ''){
- this.formObj.adCode = val
- this.currentAdCode = val
- this.countryList.forEach(ele=>{
- if(ele.adCode == this.countryName){
- this.countryNames = ele.adName
- }
- })
- this.formObj.location = this.provNames + this.cityNames + this.countryNames
- }
- },
- handleNodeClick(node,data){
- this.leftAdCode = "";
- console.log(node, data);
- this.leftAdCode = node.adCode;
- this.ifLeftClick = false;
- },
- CloseDialog(){
- this.$emit("closeDialog")
- }
- }
- };
- </script>
- <style>
- </style>
|