a1267d4417c13bf56c0b3f438c3ef61e9c6ef936.svn-base 16 KB

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