0c55d00a5e150fa69697202ee1680c7b875d20ae.svn-base 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <!-- 弹出窗 -->
  3. <el-dialog title="添加督查对象" :visible.sync="dialogFormVisible" width="80%" modal-append-to-body append-to-body>
  4. <el-container>
  5. <el-aside width="200px" style="border:1px solid #d5d5ff">
  6. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">
  7. <i class="el-icon-share"></i>所属机构
  8. </p>
  9. <provTreeListQy
  10. ref="provTreeListQyRef"
  11. v-show="showLeftTree"
  12. :ddczId='dczId'
  13. rootCode="000000"
  14. :adCodes="adCodes"
  15. rootType="1"
  16. style="max-height:485px;"
  17. @treeDataEmit="treeDataEmit"
  18. @provTreeSelectChange="provTreeSelectChangeHandler_qy">
  19. </provTreeListQy>
  20. </el-aside>
  21. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
  22. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">督查对象</p>
  23. <el-form style="padding:10px">
  24. <div>
  25. <el-form size="mini" :inline="true" class="demo-form-inline">
  26. <el-form-item label="行政区名称">
  27. <el-input
  28. style="width:140px;"
  29. v-model="searchNameOfSzName"
  30. clearable
  31. placeholder="行政区名称"
  32. ></el-input>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" @click="refreshCurrentShow">查询</el-button>
  36. </el-form-item>
  37. </el-form>
  38. <el-table
  39. border
  40. v-loading="loading"
  41. :data="currentShowList"
  42. tooltip-effect="dark"
  43. style="width: 100%"
  44. @selection-change="handleSelectionChange">
  45. <el-table-column align="center" type="selection" width="60"></el-table-column>
  46. <el-table-column align="center" prop="index" label="序号" min-width="40"></el-table-column>
  47. <el-table-column
  48. align="center"
  49. show-overflow-tooltip
  50. prop="name"
  51. label="行政区划名称"
  52. min-width="100"
  53. ></el-table-column>
  54. <el-table-column
  55. align="center"
  56. show-overflow-tooltip
  57. prop="adFullName"
  58. label="全称"
  59. min-width="100"
  60. ></el-table-column>
  61. <el-table-column
  62. align="center"
  63. show-overflow-tooltip
  64. prop="adGrad"
  65. label="行政区划级别"
  66. min-width="100"
  67. :formatter="adGradFormatter">
  68. </el-table-column>
  69. </el-table>
  70. <div
  71. class="block"
  72. style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;"
  73. >
  74. <el-pagination
  75. small
  76. @current-change="handleCurrentChange"
  77. :pager-count="5"
  78. :current-page.sync="pageIndex"
  79. :page-size="pageSize"
  80. layout="total, prev, pager, next"
  81. :total="total"
  82. ></el-pagination>
  83. </div>
  84. </div>
  85. </el-form>
  86. </el-main>
  87. </el-container>
  88. <div slot="footer" class="dialog-footer">
  89. <el-button @click="dialogFormVisible = false">取 消</el-button>
  90. <el-button type="primary" @click="saveChange">确 定</el-button>
  91. </div>
  92. </el-dialog>
  93. </template>
  94. <script>
  95. import request from '@util/gw_ajax_request.js';
  96. import provTreeList from "@widget/provTreeList.vue";
  97. import {
  98. getObjListNotInspGroupId,
  99. addDcAndObjRel
  100. } from "@api/duChaDuiXiang_xsk_API.js";
  101. import {getSupObjListNotInspGroupId} from '@api/duChaPlan.js'
  102. export default {
  103. components: {
  104. provTreeList: provTreeList,
  105. provTreeListQy: resolve => {
  106. require(['@widget/provTreeList_quyu.vue'], resolve)
  107. },
  108. },
  109. props: ["dczId", "dczName", "plnaId", "objType","adCodes","isNewPlan"],
  110. computed: {},
  111. data() {
  112. return {
  113. addOnce: false,
  114. searchNameOfSzName: "",
  115. searchNameOfAdName: "",
  116. searchNameOfwtdstNm: "",
  117. rsAdmDep: "",
  118. engScal: "",
  119. wtdstState: "",
  120. engLevel: "",
  121. wtdstType: "",
  122. stnm: '',
  123. pageIndex: 1,
  124. pageSize: 10,
  125. total: 0,
  126. currentShowList: [],
  127. dialogFormVisible: false,
  128. formLabelWidth: "120",
  129. addArr: "",
  130. addName: "",
  131. addLttd: "",
  132. addLgtd: "",
  133. multipleSelection: [],
  134. searchProvTreeListCode: "",
  135. qyDataList: [],
  136. loading: false,
  137. showLeftTree: true,
  138. addRsvrVisible: false,
  139. props: {
  140. value: 'id',
  141. label: 'label',
  142. children: 'cities'
  143. },
  144. provList: [],
  145. cityList: [],
  146. countryList: [],
  147. }
  148. },
  149. watch: {
  150. dczId: function (n, o) {
  151. this.searchProvTreeListCode = "";
  152. },
  153. objType: function (n, o) {
  154. this.searchProvTreeListCode = "";
  155. this.objType = n;
  156. },
  157. qyDataList(n, o) {
  158. if (this.qyDataList.length == 0) {
  159. this.showLeftTree = false;
  160. } else {
  161. this.showLeftTree = true;
  162. }
  163. console.log("区域树" + n.length + this.showLeftTree + this.objType);
  164. this.getTableData_sz();
  165. // this.getAreaList()
  166. }
  167. },
  168. mounted() {
  169. this.getTableData_sz();
  170. },
  171. computed: {
  172. userId: function () {
  173. return localStorage.getItem("userid") ? localStorage.getItem("userid") : '1098101939614724096'
  174. },
  175. },
  176. methods: {
  177. adGradFormatter: function(row, column) {
  178. return row.adGrad == 1
  179. ? "国家级"
  180. : row.adGrad == 2
  181. ? "省级"
  182. : row.adGrad == 3
  183. ? "地市级"
  184. : row.adGrad == 4
  185. ? "县级"
  186. : row.adGrad == 5
  187. ? "乡级"
  188. : row.adGrad == 6
  189. ? "村"
  190. : "村组";
  191. },
  192. showDialog() {
  193. this.dialogFormVisible = true;
  194. if (this.$refs['provTreeListQyRef']) {
  195. this.$refs['provTreeListQyRef'].getQyList();
  196. }
  197. this.getTableData_sz();
  198. },
  199. saveChange() {
  200. this.addObjectChange();
  201. },
  202. treeDataEmit(item) {
  203. this.qyDataList = item;
  204. if (this.qyDataList.length == 0) {
  205. this.showLeftTree = false;
  206. } else {
  207. this.showLeftTree = true;
  208. }
  209. },
  210. getTableData_sz() {
  211. var _self = this;
  212. if (_self.qyDataList.length == 0) {
  213. _self.showLeftTree = false;
  214. } else {
  215. _self.showLeftTree = true;
  216. }
  217. _self.loading = true;
  218. var str = '';
  219. for (var i = 0; i < _self.qyDataList.length; i++) {
  220. str += _self.qyDataList[i].adCode + ',';
  221. }
  222. str = str.substring(0, str.length - 1);
  223. getSupObjListNotInspGroupId(str, _self.dczId, '', _self.pageSize, _self.pageIndex, _self.objType, _self.searchNameOfSzName, _self.engScal).then((res) => {
  224. _self.loading = false;
  225. _self.currentShowList = res.data.list;
  226. _self.currentShowList.forEach((element, index) => {
  227. element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
  228. });
  229. _self.total = res.data.total;
  230. })
  231. },
  232. getTableData_sz1() {
  233. var _self = this;
  234. getSupObjListNotInspGroupId(_self.searchProvTreeListCode, _self.dczId, '', _self.pageSize, _self.pageIndex, _self.objType, _self.searchNameOfSzName, _self.engScal).then((res) => {
  235. _self.loading = false;
  236. _self.currentShowList = res.data.list;
  237. _self.currentShowList.forEach((element, index) => {
  238. element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
  239. });
  240. _self.total = res.data.total;
  241. })
  242. },
  243. handleSelectionChange(val) {
  244. this.multipleSelection = val;
  245. },
  246. handleCurrentChange(val) {
  247. console.log(`当前页: ${val}`);
  248. this.refreshCurrentShow();
  249. },
  250. refreshCurrentShow: function () {
  251. if (this.searchProvTreeListCode) {
  252. this.getTableData_sz1();
  253. } else {
  254. this.getTableData_sz();
  255. }
  256. },
  257. toAddNewRsvr() {
  258. for(var obj in this.formObj){
  259. this.formObj[obj] = '';
  260. }
  261. this.addRsvrVisible = true;
  262. },
  263. addNewRsvr(formName) {
  264. let _this = this
  265. if (!this.formObj.sapName) {
  266. this.$message.warning('请输入堤防险工险段名称')
  267. return
  268. }
  269. if (!this.formObj.diskName) {
  270. this.$message.warning('请输入所在堤防')
  271. return
  272. }
  273. if (!this.formObj.dikeGrad) {
  274. this.$message.warning('请选择堤防等级')
  275. return
  276. }
  277. // if (!this.formObj.sapLen) {
  278. // this.$message.warning('请输入险工险段长度')
  279. // return
  280. // }
  281. if (!this.formObj.sapType) {
  282. this.$message.warning('请输入险工险段类型')
  283. return
  284. }
  285. this.formObj.adCode = this.searchProvTreeListCode;
  286. this.$refs[formName].validate((valid) => {
  287. if (valid) {
  288. request.post('/att/waga/sap/base', this.formObj).then(res => {
  289. if (res.success) {
  290. _this.$message.success('添加成功')
  291. this.getTableData_sz1();
  292. _this.addRsvrVisible = false;
  293. } else {
  294. _this.$message.error(res.message)
  295. }
  296. }).catch(res => {
  297. _this.$message.error('请求错误' + res.message)
  298. })
  299. } else {
  300. console.log('error submit!!');
  301. return false;
  302. }
  303. });
  304. },
  305. addObjectChange: function () {
  306. //提交当前选中对象
  307. var _self = this;
  308. var names = [];
  309. if (_self.addOnce) {
  310. _self.addOnce = false;
  311. return;
  312. }
  313. _self.addOnce = true
  314. var objArr = [];
  315. const length = _self.multipleSelection.length;
  316. for (let i = 0; i < length; i++) {
  317. var obj = {};
  318. obj['code'] = _self.multipleSelection[i].code;
  319. obj['name'] = _self.multipleSelection[i].name;
  320. obj['ptype'] = _self.objType;
  321. objArr.push(obj);
  322. names.push(_self.multipleSelection[i].name);
  323. }
  324. if(this.isNewPlan){
  325. var obj = {
  326. persid: this.userId,
  327. nm: this.dczName,
  328. id: this.dczId,
  329. persAllAreaDtoList: [],
  330. persAllDtoList: [],
  331. persAllObjDtoList: objArr
  332. };
  333. this.addOnce = false;
  334. this.dialogFormVisible = false;
  335. this.$message.success("选择成功");
  336. this.$emit("addSuccess",{obj:obj,names:names.join(",")});
  337. return;
  338. }
  339. try {
  340. request.post("/supervision/plan/insertSupervisionObj", {
  341. persid: this.userId,
  342. nm: this.dczName,
  343. id: this.dczId,
  344. persAllAreaDtoList: [],
  345. persAllDtoList: [],
  346. persAllObjDtoList: objArr
  347. }).then(response => {
  348. if (response.success == true) {
  349. _self.addOnce = false;
  350. _self.dialogFormVisible = false;
  351. _self.$message.success("添加成功");
  352. _self.$emit("addSuccess");
  353. }
  354. });
  355. } catch (e) {
  356. alert("暂无数据");
  357. }
  358. },
  359. provTreeSelectChangeHandler: function (params) {
  360. this.searchProvTreeListCode = params.code;
  361. this.getTableData_sz1();
  362. },
  363. provTreeSelectChangeHandler_qy(params) {
  364. this.searchProvTreeListCode = params.code;
  365. this.getTableData_sz1();
  366. },
  367. }
  368. };
  369. </script>
  370. <style>
  371. </style>