c6e77fcca99bf149a8f2ce4e02065b4de8ecc43f.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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="nm"
  51. label="行政区划名称"
  52. min-width="100"
  53. ></el-table-column>
  54. <!--<el-table-column-->
  55. <!--align="center"-->
  56. <!--show-overflow-tooltip-->
  57. <!--prop="adFull Name"-->
  58. <!--label="全称"-->
  59. <!--min-width="100"-->
  60. <!--&gt;</el-table-column>-->
  61. </el-table>
  62. <div
  63. class="block"
  64. style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;"
  65. >
  66. <el-pagination
  67. small
  68. @current-change="handleCurrentChange"
  69. :pager-count="5"
  70. :current-page.sync="pageIndex"
  71. :page-size="pageSize"
  72. layout="total, prev, pager, next"
  73. :total="total"
  74. ></el-pagination>
  75. </div>
  76. </div>
  77. </el-form>
  78. </el-main>
  79. </el-container>
  80. <div slot="footer" class="dialog-footer">
  81. <el-button @click="dialogFormVisible = false">取 消</el-button>
  82. <el-button type="primary" @click="saveChange">确 定</el-button>
  83. </div>
  84. </el-dialog>
  85. </template>
  86. <script>
  87. import request from '@util/gw_ajax_request.js';
  88. import provTreeList from "@widget/provTreeList.vue";
  89. import {
  90. getObjListNotInspGroupId,
  91. addDcAndObjRel
  92. } from "@api/duChaDuiXiang_xsk_API.js";
  93. import {getSupObjListNotInspGroupId} from '@api/duChaPlan.js'
  94. export default {
  95. components: {
  96. provTreeList: provTreeList,
  97. provTreeListQy: resolve => {
  98. require(['@widget/provTreeList_quyu.vue'], resolve)
  99. },
  100. },
  101. props: ["dczId", "dczName", "plnaId", "objType","adCodes","isNewPlan"],
  102. computed: {},
  103. data() {
  104. return {
  105. addOnce: false,
  106. searchNameOfSzName: "",
  107. searchNameOfAdName: "",
  108. searchNameOfwtdstNm: "",
  109. rsAdmDep: "",
  110. engScal: "",
  111. wtdstState: "",
  112. engLevel: "",
  113. wtdstType: "",
  114. stnm: '',
  115. pageIndex: 1,
  116. pageSize: 10,
  117. total: 0,
  118. currentShowList: [],
  119. dialogFormVisible: false,
  120. formLabelWidth: "120",
  121. addArr: "",
  122. addName: "",
  123. addLttd: "",
  124. addLgtd: "",
  125. multipleSelection: [],
  126. searchProvTreeListCode: "",
  127. qyDataList: [],
  128. loading: false,
  129. showLeftTree: true,
  130. addRsvrVisible: false,
  131. props: {
  132. value: 'id',
  133. label: 'label',
  134. children: 'cities'
  135. },
  136. provList: [],
  137. cityList: [],
  138. countryList: [],
  139. }
  140. },
  141. watch: {
  142. dczId: function (n, o) {
  143. this.searchProvTreeListCode = "";
  144. },
  145. objType: function (n, o) {
  146. this.searchProvTreeListCode = "";
  147. this.objType = n;
  148. },
  149. qyDataList(n, o) {
  150. if (this.qyDataList.length == 0) {
  151. this.showLeftTree = false;
  152. } else {
  153. this.showLeftTree = true;
  154. }
  155. console.log("区域树" + n.length + this.showLeftTree + this.objType);
  156. this.getTableData_sz();
  157. // this.getAreaList()
  158. }
  159. },
  160. mounted() {
  161. this.getTableData_sz();
  162. },
  163. computed: {
  164. userId: function () {
  165. return localStorage.getItem("userid") ? localStorage.getItem("userid") : '1098101939614724096'
  166. },
  167. },
  168. methods: {
  169. showDialog() {
  170. this.dialogFormVisible = true;
  171. if (this.$refs['provTreeListQyRef']) {
  172. this.$refs['provTreeListQyRef'].getQyList();
  173. }
  174. // this.getTableData_sz();
  175. },
  176. saveChange() {
  177. this.addObjectChange();
  178. },
  179. treeDataEmit(item) {
  180. this.qyDataList = item;
  181. if (this.qyDataList.length == 0) {
  182. this.showLeftTree = false;
  183. } else {
  184. this.showLeftTree = true;
  185. }
  186. },
  187. getTableData_sz() {
  188. if (!this.searchProvTreeListCode) {
  189. this.showLeftTree = false;
  190. } else {
  191. this.showLeftTree = true;
  192. }
  193. let _self = this;
  194. getSupObjListNotInspGroupId(_self.searchProvTreeListCode, _self.dczId, '', _self.pageSize, _self.pageIndex, _self.objType, _self.searchNameOfSzName, _self.engScal).then((res) => {
  195. if (res.success) {
  196. this.$nextTick(() => {
  197. _self.loading = false;
  198. _self.currentShowList = res.data.list;
  199. _self.currentShowList.forEach((element, index) => {
  200. element["index"] = _self.pageSize * (_self.pageIndex - 1) + index + 1;
  201. });
  202. _self.total = res.data.total;
  203. })
  204. }
  205. })
  206. },
  207. handleSelectionChange(val) {
  208. this.multipleSelection = val;
  209. },
  210. handleCurrentChange(val) {
  211. console.log(`当前页: ${val}`);
  212. this.refreshCurrentShow();
  213. },
  214. refreshCurrentShow: function () {
  215. if (this.searchProvTreeListCode) {
  216. this.getTableData_sz();
  217. } else {
  218. this.getTableData_sz();
  219. }
  220. },
  221. toAddNewRsvr() {
  222. for (var obj in this.formObj) {
  223. this.formObj[obj] = '';
  224. }
  225. this.addRsvrVisible = true;
  226. },
  227. addNewRsvr(formName) {
  228. let _this = this
  229. if (!this.formObj.sapName) {
  230. this.$message.warning('请输入堤防险工险段名称')
  231. return
  232. }
  233. if (!this.formObj.diskName) {
  234. this.$message.warning('请输入所在堤防')
  235. return
  236. }
  237. if (!this.formObj.dikeGrad) {
  238. this.$message.warning('请选择堤防等级')
  239. return
  240. }
  241. // if (!this.formObj.sapLen) {
  242. // this.$message.warning('请输入险工险段长度')
  243. // return
  244. // }
  245. if (!this.formObj.sapType) {
  246. this.$message.warning('请输入险工险段类型')
  247. return
  248. }
  249. this.formObj.adCode = this.searchProvTreeListCode;
  250. this.$refs[formName].validate((valid) => {
  251. if (valid) {
  252. request.post('/att/waga/sap/base', this.formObj).then(res => {
  253. if (res.success) {
  254. _this.$message.success('添加成功')
  255. this.getTableData_sz();
  256. _this.addRsvrVisible = false;
  257. } else {
  258. _this.$message.error(res.message)
  259. }
  260. }).catch(res => {
  261. _this.$message.error('请求错误' + res.message)
  262. })
  263. } else {
  264. console.log('error submit!!');
  265. return false;
  266. }
  267. });
  268. },
  269. addObjectChange: function () {
  270. //提交当前选中对象
  271. var _self = this;
  272. var names = [];
  273. if (_self.addOnce) {
  274. _self.addOnce = false;
  275. return;
  276. }
  277. _self.addOnce = true
  278. var objArr = [];
  279. const length = _self.multipleSelection.length;
  280. for (let i = 0; i < length; i++) {
  281. var obj = {};
  282. obj['code'] = _self.multipleSelection[i].adCode;
  283. obj['name'] = _self.multipleSelection[i].nm;
  284. obj['ptype'] = '32';
  285. objArr.push(obj);
  286. names.push(_self.multipleSelection[i].nm);
  287. }
  288. if(this.isNewPlan){
  289. var obj = {
  290. persid: this.userId,
  291. nm: this.dczName,
  292. id: this.dczId,
  293. persAllAreaDtoList: [],
  294. persAllDtoList: [],
  295. persAllObjDtoList: objArr
  296. };
  297. this.addOnce = false;
  298. this.dialogFormVisible = false;
  299. this.$message.success("选择成功");
  300. this.$emit("addSuccess",{obj:obj,names:names.join(",")});
  301. return;
  302. }
  303. try {
  304. request.post("/supervision/plan/insertSupervisionObj", {
  305. persid: this.userId,
  306. nm: this.dczName,
  307. id: this.dczId,
  308. persAllAreaDtoList: [],
  309. persAllDtoList: [],
  310. persAllObjDtoList: objArr
  311. }).then(response => {
  312. if (response.success == true) {
  313. _self.addOnce = false;
  314. _self.dialogFormVisible = false;
  315. _self.$message.success("添加成功");
  316. _self.$emit("addSuccess");
  317. }
  318. });
  319. } catch (e) {
  320. alert("暂无数据");
  321. }
  322. },
  323. provTreeSelectChangeHandler_qy(params) {
  324. this.searchProvTreeListCode = params.code;
  325. this.getTableData_sz();
  326. },
  327. }
  328. };
  329. </script>
  330. <style>
  331. </style>