| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <template>
- <!-- 弹出窗 -->
- <el-dialog title="添加督查对象" :visible.sync="dialogFormVisible" width="80%" modal-append-to-body append-to-body>
- <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>
- <provTreeListQy
- ref="provTreeListQyRef"
- v-show="showLeftTree"
- :ddczId='dczId'
- rootCode="000000"
- :adCodes="adCodes"
- rootType="1"
- style="max-height:485px;"
- @treeDataEmit="treeDataEmit"
- @provTreeSelectChange="provTreeSelectChangeHandler_qy">
- </provTreeListQy>
- </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>
- <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="nm"
- label="行政区划名称"
- min-width="100"
- ></el-table-column>
- <!--<el-table-column-->
- <!--align="center"-->
- <!--show-overflow-tooltip-->
- <!--prop="adFull Name"-->
- <!--label="全称"-->
- <!--min-width="100"-->
- <!--></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>
- <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 '@util/gw_ajax_request.js';
- import provTreeList from "@widget/provTreeList.vue";
- import {
- getObjListNotInspGroupId,
- addDcAndObjRel
- } from "@api/duChaDuiXiang_xsk_API.js";
- import {getSupObjListNotInspGroupId} from '@api/duChaPlan.js'
- export default {
- components: {
- provTreeList: provTreeList,
- provTreeListQy: resolve => {
- require(['@widget/provTreeList_quyu.vue'], resolve)
- },
- },
- props: ["dczId", "dczName", "plnaId", "objType","adCodes","isNewPlan"],
- computed: {},
- data() {
- return {
- addOnce: false,
- searchNameOfSzName: "",
- searchNameOfAdName: "",
- searchNameOfwtdstNm: "",
- rsAdmDep: "",
- engScal: "",
- wtdstState: "",
- engLevel: "",
- wtdstType: "",
- stnm: '',
- pageIndex: 1,
- pageSize: 10,
- total: 0,
- currentShowList: [],
- dialogFormVisible: false,
- formLabelWidth: "120",
- addArr: "",
- addName: "",
- addLttd: "",
- addLgtd: "",
- multipleSelection: [],
- searchProvTreeListCode: "",
- qyDataList: [],
- loading: false,
- showLeftTree: true,
- addRsvrVisible: false,
- props: {
- value: 'id',
- label: 'label',
- children: 'cities'
- },
- provList: [],
- cityList: [],
- countryList: [],
- }
- },
- watch: {
- dczId: function (n, o) {
- this.searchProvTreeListCode = "";
- },
- objType: function (n, o) {
- this.searchProvTreeListCode = "";
- this.objType = n;
- },
- qyDataList(n, o) {
- if (this.qyDataList.length == 0) {
- this.showLeftTree = false;
- } else {
- this.showLeftTree = true;
- }
- console.log("区域树" + n.length + this.showLeftTree + this.objType);
- this.getTableData_sz();
- // this.getAreaList()
- }
- },
- mounted() {
- this.getTableData_sz();
- },
- computed: {
- userId: function () {
- return localStorage.getItem("userid") ? localStorage.getItem("userid") : '1098101939614724096'
- },
- },
- methods: {
- showDialog() {
- this.dialogFormVisible = true;
- if (this.$refs['provTreeListQyRef']) {
- this.$refs['provTreeListQyRef'].getQyList();
- }
- // this.getTableData_sz();
- },
- saveChange() {
- this.addObjectChange();
- },
- treeDataEmit(item) {
- this.qyDataList = item;
- if (this.qyDataList.length == 0) {
- this.showLeftTree = false;
- } else {
- this.showLeftTree = true;
- }
- },
- getTableData_sz() {
- if (!this.searchProvTreeListCode) {
- this.showLeftTree = false;
- } else {
- this.showLeftTree = true;
- }
- let _self = this;
- getSupObjListNotInspGroupId(_self.searchProvTreeListCode, _self.dczId, '', _self.pageSize, _self.pageIndex, _self.objType, _self.searchNameOfSzName, _self.engScal).then((res) => {
- if (res.success) {
- this.$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_sz();
- } else {
- this.getTableData_sz();
- }
- },
- toAddNewRsvr() {
- for (var obj in this.formObj) {
- this.formObj[obj] = '';
- }
- this.addRsvrVisible = true;
- },
- addNewRsvr(formName) {
- let _this = this
- if (!this.formObj.sapName) {
- this.$message.warning('请输入堤防险工险段名称')
- return
- }
- if (!this.formObj.diskName) {
- this.$message.warning('请输入所在堤防')
- return
- }
- if (!this.formObj.dikeGrad) {
- this.$message.warning('请选择堤防等级')
- return
- }
- // if (!this.formObj.sapLen) {
- // this.$message.warning('请输入险工险段长度')
- // return
- // }
- if (!this.formObj.sapType) {
- this.$message.warning('请输入险工险段类型')
- return
- }
- this.formObj.adCode = this.searchProvTreeListCode;
- this.$refs[formName].validate((valid) => {
- if (valid) {
- request.post('/att/waga/sap/base', this.formObj).then(res => {
- if (res.success) {
- _this.$message.success('添加成功')
- this.getTableData_sz();
- _this.addRsvrVisible = false;
- } else {
- _this.$message.error(res.message)
- }
- }).catch(res => {
- _this.$message.error('请求错误' + res.message)
- })
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- addObjectChange: function () {
- //提交当前选中对象
- var _self = this;
- var names = [];
- if (_self.addOnce) {
- _self.addOnce = false;
- return;
- }
- _self.addOnce = true
- var objArr = [];
- const length = _self.multipleSelection.length;
- for (let i = 0; i < length; i++) {
- var obj = {};
- obj['code'] = _self.multipleSelection[i].adCode;
- obj['name'] = _self.multipleSelection[i].nm;
- obj['ptype'] = '32';
- objArr.push(obj);
- names.push(_self.multipleSelection[i].nm);
- }
- if(this.isNewPlan){
- var obj = {
- persid: this.userId,
- nm: this.dczName,
- id: this.dczId,
- persAllAreaDtoList: [],
- persAllDtoList: [],
- persAllObjDtoList: objArr
- };
- this.addOnce = false;
- this.dialogFormVisible = false;
- this.$message.success("选择成功");
- this.$emit("addSuccess",{obj:obj,names:names.join(",")});
- return;
- }
- try {
- request.post("/supervision/plan/insertSupervisionObj", {
- persid: this.userId,
- nm: this.dczName,
- id: this.dczId,
- persAllAreaDtoList: [],
- persAllDtoList: [],
- persAllObjDtoList: objArr
- }).then(response => {
- if (response.success == true) {
- _self.addOnce = false;
- _self.dialogFormVisible = false;
- _self.$message.success("添加成功");
- _self.$emit("addSuccess");
- }
- });
- } catch (e) {
- alert("暂无数据");
- }
- },
- provTreeSelectChangeHandler_qy(params) {
- this.searchProvTreeListCode = params.code;
- this.getTableData_sz();
- },
- }
- };
- </script>
- <style>
- </style>
|