07dc0ed62293db9a08c5aba8f81a0beb597d71de.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <el-row>
  3. <el-col :span="3">
  4. <div>
  5. <provTreeList :rootCode="rootCode" :rootType="rootType" @provTreeSelectChange="provTreeSelectChangeHandler"
  6. :style="{'max-height':dxdcAsideHeight+'px'}"
  7. >
  8. </provTreeList>
  9. </div>
  10. </el-col>
  11. <el-col :span="21">
  12. <el-card class="ducha_form" :body-style="{ 'padding': '20px 5px' }" :style="formStyle">
  13. <el-form :inline="true" :model="formInline" class="sh-form-inline">
  14. <!--<el-form-item label="水库编码" style="margin-left: 5px">-->
  15. <!--<el-input v-model="formInline.rsCode" :placeholder="autoInput" clearable></el-input>-->
  16. <!--</el-form-item>-->
  17. <el-form-item label="水闸名称">
  18. <el-input v-model="formInline.gateName" :placeholder="autoInput" clearable></el-input>
  19. </el-form-item>
  20. <el-form-item label="水闸类型">
  21. <el-select v-model="formInline.gateType" :placeholder="autoSort" clearable >
  22. <el-option v-for="item in options"
  23. :key="item.value"
  24. :label="item.label"
  25. :value="item.value"
  26. >
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="工程规模">
  31. <el-select v-model="formInline.engScal" :placeholder="autoSort" clearable >
  32. <el-option v-for="item in engScalOptions"
  33. :key="item.value"
  34. :label="item.label"
  35. :value="item.value"
  36. >
  37. </el-option>
  38. </el-select>
  39. </el-form-item>
  40. <!-- <el-form-item label="行政区划">
  41. <el-input v-model="formInline.adCode" :placeholder="autoInput" clearable ></el-input>
  42. </el-form-item> -->
  43. <el-form-item style="margin: 0">
  44. <el-button type="primary" @click="onSearch" icon="el-icon-search">查询</el-button>
  45. </el-form-item>
  46. <el-form-item style="margin: 0 5px">
  47. <el-button type="info" plain @click="empty" icon="el-icon-refresh">重置</el-button>
  48. </el-form-item>
  49. <el-form-item style="margin: 0">
  50. <el-button type="success" @click="exportExcel" icon="el-icon-sort-up">导出Excel</el-button>
  51. </el-form-item>
  52. <el-form-item>
  53. <el-button type="primary" @click="showDialog(1,null)" icon="el-icon-edit">批量编辑</el-button>
  54. </el-form-item>
  55. <!-- <el-form-item style="margin: 0 5px" v-if="ownPriv('manage')">
  56. <el-button type="info" plain @click="batchImport" icon="el-icon-menu">导入</el-button>
  57. </el-form-item> -->
  58. <!-- 水闸基础信息批量导入弹窗 -->
  59. <shui-zha-cha-xun-pl v-if="showShuiZhaChaXunPl" @closePlDialog="closePlDialog"
  60. :gateNameStr="formInline.gateName"
  61. :gateTypeStr="formInline.gateType"
  62. :pageStr="page.pageNum"
  63. :adCode="formInline.adCode"
  64. ></shui-zha-cha-xun-pl>
  65. </el-form>
  66. </el-card>
  67. <el-card class="ducha_table" :body-style="{ 'padding': '0 5px' }">
  68. <el-main style="padding: 5px!important;">
  69. <el-table :data="tableList" style="width: 100%" :row-class-name="tableRowClassName"
  70. ref="singleTable"
  71. v-loading="tableLoading"
  72. border
  73. @selection-change="handleSelectionChange"
  74. :height="dxdcMainHeight+'px'"
  75. :render-header="renderHeader"
  76. >
  77. <el-table-column
  78. type="selection"
  79. min-width="55">
  80. </el-table-column>
  81. <el-table-column type="index" min-width="80" :index="getIndex" label="序号" show-overflow-tooltip></el-table-column>
  82. <el-table-column prop="objCode" label="水闸编码" min-width="130" show-overflow-tooltip></el-table-column>
  83. <el-table-column prop="gateName" label="水闸名称" min-width="130" show-overflow-tooltip></el-table-column>
  84. <el-table-column prop="gateType" label="水闸类型" min-min-width="80" :formatter="formatRsType" show-overflow-tooltip></el-table-column>
  85. <el-table-column prop="gateAdmName" label="管理单位名称" min-width="180" show-overflow-tooltip></el-table-column>
  86. <el-table-column prop="adCode" label="行政区划" min-width="130" show-overflow-tooltip></el-table-column>
  87. <el-table-column prop="provincial" label="是否省属" width="100" >
  88. <template slot-scope="scope">
  89. <span v-if="scope.row.provincial=='1'">是</span>
  90. <span v-if="scope.row.provincial=='2'">否</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="engScal"
  94. label="工程规模"
  95. min-width="130"
  96. :formatter="formatEngScal"
  97. show-overflow-tooltip
  98. >
  99. </el-table-column>
  100. <el-table-column label="操作" align="center" fixed="right" width="100">
  101. <template slot-scope="scope">
  102. <el-button type="primary" icon="el-icon-edit" @click="showDialog(0,scope.row)">编辑</el-button>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. </el-main>
  107. <el-footer class="el-footer-style">
  108. <el-pagination
  109. style="text-align:center;"
  110. small
  111. background
  112. :current-page.sync="page.pageNum"
  113. :page-size="page.pageSize"
  114. :page-sizes="[10, 20, 30, 40, 50, 100]"
  115. layout="sizes, total, prev, pager, next,jumper"
  116. :total="showResultCount"
  117. @current-change="pageIndexChange"
  118. @size-change="handleSizeChange"
  119. ></el-pagination>
  120. </el-footer>
  121. </el-card>
  122. </el-col>
  123. <el-dialog
  124. class="outerDialog custom_dialog"
  125. title="编辑是否省属"
  126. width="400px"
  127. :visible.sync="isVisible">
  128. <div style="width: 100%;height:100%;">
  129. <el-form ref="addForm" label-width="80px">
  130. <el-form-item label="是否省属" required>
  131. <el-select v-model="provincial" clearable placeholder="请选择" style="width: 100%;">
  132. <el-option label="是" value="1"></el-option>
  133. <el-option label="否" value="2"></el-option>
  134. </el-select>
  135. </el-form-item>
  136. <el-form-item style="text-align: center">
  137. <el-button @click="isVisible=false" style="margin-bottom: 30px;">取消</el-button>
  138. <el-button type="primary" @click="submit" style="margin-bottom: 30px;">确定</el-button>
  139. </el-form-item>
  140. </el-form>
  141. </div>
  142. </el-dialog>
  143. </el-row>
  144. </template>
  145. <style>
  146. .el-table .warning-row {
  147. background: oldlace;
  148. }
  149. .el-table .success-row {
  150. background: #f0f9eb;
  151. }
  152. .ducha_form .el-input {
  153. width: 150px !important;
  154. }
  155. .el-footer-style {
  156. text-align: center;
  157. width:100%;
  158. }
  159. </style>
  160. <script>
  161. // 水闸类型 1:分(泄)洪闸;2:节制闸;3:排(退)水闸;4:引(进)水闸;5:挡潮闸;6:船闸;9:其他
  162. const options = [{
  163. value: '1',
  164. label: '分(泄)洪闸'
  165. }, {
  166. value: '2',
  167. label: '节制闸'
  168. },{
  169. value: '3',
  170. label: '排(退)水闸'
  171. },{
  172. value: '4',
  173. label: '引(进)水闸'
  174. },{
  175. value: '5',
  176. label: '挡潮闸'
  177. },{
  178. value: '6',
  179. label: '船闸'
  180. },{
  181. value: '9',
  182. label: '其他'
  183. }];
  184. // 工程规模
  185. const engScalLabels = ['大型','中型','小型'];
  186. const engScalValues = ['1','2','3'];
  187. let engScalOptions = [engScalLabels.length];
  188. for(let i=0;i<engScalLabels.length;i++){
  189. engScalOptions[i] = {'label':engScalLabels[i],'value':engScalValues[i]};
  190. }
  191. import provTreeList from '../../../widgets/provTreeList';
  192. import request from '../../../utils/gw_ajax_request.js';
  193. import shuiZhaChaXunPl from './shuiZhaChaXun_piliang';
  194. import { exportModel } from "@util/gw_exportModel";
  195. export default {
  196. name: "shuiZhaChaXun",
  197. components:{
  198. provTreeList: provTreeList,
  199. shuiZhaChaXunPl: shuiZhaChaXunPl
  200. },
  201. data() {
  202. return {
  203. tableLoading:true,
  204. tableList: [],
  205. page:{
  206. pageNum: 1,
  207. pageSize: 20,
  208. },
  209. showResultCount: 0,
  210. options: options,
  211. engScalOptions: engScalOptions,
  212. autoSort: '请选择',
  213. autoInput: '请输入',
  214. formInline: {
  215. gateName: '',
  216. gateType: '',
  217. adCode: '',
  218. engScal: '',
  219. },
  220. rootCode:'000000',
  221. rootType:'2',
  222. formStyle: {
  223. width: '100%',
  224. height: '70px',
  225. },
  226. dxdcMainHeight: window.innerHeight - 197,
  227. dxdcAsideHeight: window.innerHeight - 90,
  228. showShuiZhaChaXunPl: false,
  229. multipleSelection:[],
  230. isVisible:false,
  231. provincial:"",
  232. isMul:false,
  233. currentRow:{}
  234. }
  235. },
  236. mounted() {
  237. this.getShuiKuList()
  238. },
  239. activated(){
  240. this.getShuiKuList()
  241. },
  242. methods: {
  243. submit(){
  244. if(!this.provincial){
  245. this.$message.warning("请选择是否省属");
  246. return false;
  247. }
  248. if(this.isMul){
  249. var list = [];
  250. this.multipleSelection.forEach((item,index)=>{
  251. list.push(item.objCode);
  252. })
  253. request.put('/att/waga/base/provincial',{provincial: this.provincial,objCodes:list}).then((res)=>{
  254. if(res.success){
  255. this.multipleSelection = [];
  256. this.isVisible = false;
  257. this.getShuiKuList();
  258. }
  259. })
  260. }else{
  261. var params = {
  262. objCodes:[this.currentRow.objCode],
  263. provincial:this.provincial
  264. }
  265. request.put('/att/waga/base/provincial',params).then((res)=>{
  266. if(res.success){
  267. this.isVisible = false;
  268. this.getShuiKuList();
  269. }
  270. })
  271. }
  272. },
  273. showDialog(t,row){
  274. if(t==1){
  275. this.provincial = "";
  276. this.isMul = true;
  277. if(!this.multipleSelection || this.multipleSelection.length==0){
  278. this.$message.warning("请选择数据");
  279. return false;
  280. }
  281. }else{
  282. this.currentRow = row;
  283. this.isMul = false;
  284. }
  285. this.isVisible = true;
  286. },
  287. handleSelectionChange(val) {
  288. this.multipleSelection = val;
  289. },
  290. empty(){
  291. this.formInline = {};
  292. },
  293. formatRsType(row,column){
  294. let gateType = row.gateType;
  295. let _gateType = '';
  296. switch (gateType) {
  297. case '1' : _gateType = '分(泄)洪闸';break;
  298. case '2' : _gateType = '节制闸';break;
  299. case '3' : _gateType = '排(退)水闸';break;
  300. case '4' : _gateType = '引(进)水闸';break;
  301. case '5' : _gateType = '挡潮闸';break;
  302. case '6' : _gateType = '船闸';break;
  303. case '9' : _gateType = '其他';break;
  304. }
  305. return _gateType;
  306. },
  307. formatEngScal(row,column){
  308. let engScal = row.engScal;
  309. let _engScal = '';
  310. switch (engScal) {
  311. case '1' : _engScal = '大型';break;
  312. case '2' : _engScal = '中型';break;
  313. case '3' : _engScal = '小型';break;
  314. }
  315. return _engScal;
  316. },
  317. provTreeSelectChangeHandler: function(params) {
  318. this.formInline.adCode = params.likeCode;
  319. this.getShuiKuList();
  320. },
  321. getIndex(index){
  322. return (index + this.page.pageSize * (this.page.pageNum - 1)) + 1
  323. },
  324. onSearch(){
  325. this.getShuiKuList();
  326. },
  327. pageIndexChange(val){
  328. this.page.pageNum = val;
  329. this.getShuiKuList();
  330. },
  331. handleSizeChange(val){
  332. this.page.pageSize = val;
  333. this.getShuiKuList();
  334. },
  335. renderHeader(){
  336. },
  337. // 隔行换色
  338. tableRowClassName({row, rowIndex}) {
  339. // if (rowIndex%2 === 0) {
  340. // return 'warning-row';
  341. // }else {
  342. // return 'success-row';
  343. // }
  344. return '';
  345. },
  346. getShuiKuList(){
  347. let params = {
  348. 'pageSize': this.page.pageSize,
  349. 'pageNum': this.page.pageNum,
  350. 'gateName': this.formInline.gateName,
  351. 'gateType': this.formInline.gateType,
  352. 'adCode': this.formInline.adCode,
  353. 'engScal': this.formInline.engScal,
  354. };
  355. var _self = this;
  356. request.post('/att/waga/base/getWagaBasePageList',params).then((res)=>{
  357. let data = res.data
  358. this.tableList = data.list
  359. this.showResultCount = data.total
  360. this.tableLoading = false
  361. this.$nextTick(()=>{
  362. _self.$refs.singleTable.clearSelection();
  363. })
  364. })
  365. },
  366. batchImport(){
  367. this.showShuiZhaChaXunPl = true
  368. },
  369. closePlDialog(){
  370. this.showShuiZhaChaXunPl = false
  371. },
  372. getStrParams(obj) {
  373. let str = '?';
  374. for(let key of Object.keys(obj)) {
  375. str += `${key}=${obj[key]}&`;
  376. }
  377. str = str.slice(0, str.length - 1);
  378. return str;
  379. },
  380. // 导出Excel
  381. async exportExcel(){
  382. this.tableLoading = true;
  383. let type = "get";
  384. let url = `/pdcApi/dc/export/attWagaBase${this.getStrParams(Object.assign(this.formInline, this.page))}`;
  385. let downloadName = "Excel.xls";
  386. await exportModel(type,url,downloadName).catch((err) => {
  387. this.$message.error("导出失败");
  388. this.tableLoading = false;
  389. })
  390. this.$message.success("导出成功");
  391. this.tableLoading = false;
  392. }
  393. },
  394. computed: {
  395. },
  396. watch: {
  397. },
  398. }
  399. </script>