7dd98122a76e4df2d6d7e412266f7bbc346ec49c.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <el-container style="height:100%;">
  3. <el-header style="display:flex;align-items:center;">
  4. <p>督查对象类别</p>
  5. <el-select v-model="currentDCType" placeholder="请选择督查类型" style="margin-left:10px;">
  6. <el-option
  7. v-for="item in DCTypeOption"
  8. :key="item.value"
  9. :label="item.label"
  10. :value="item.value">
  11. </el-option>
  12. </el-select>
  13. <p>督查组分类</p>
  14. <el-select v-model="currentDcTermId" placeholder="请选择督查组分类" style="margin-left:10px;">
  15. <el-option
  16. v-for="item in DCTermOption"
  17. :key="item.id"
  18. :label="item.nm"
  19. :value="item.id">
  20. </el-option>
  21. </el-select>
  22. <el-button type="primary" style="margin-left:10px;" plain @click="addPICIDialogVisible = true;">添加督查组分类</el-button>
  23. </el-header>
  24. <el-main id="dcjhMain" @click="mainClickToCleanRow">
  25. <!-- cleanCurrentSelectedRow -->
  26. <el-button type="primary" @click="addDCTerm" style="margin-left:10px;float:right;">添加督查组</el-button>
  27. <editTable ref="et" :columnData='currentDcTableDataEditTableConfigObject' :tableData="currentDcTableData" :tableOtherParams="tableOtherParams" style="overflow:auto;"
  28. @rowEditDone="refreshAfterEdit"
  29. @rowDelete="deleteRow"
  30. :style="{'height':dcjhMainHeight+'px','max-height':dcjhMainHeight+'px'}"></editTable>
  31. <!-- <el-pagination
  32. small
  33. @current-change="handleCurrentChange"
  34. :pager-count="5"
  35. :current-page.sync="pageObject['pageIndex']"
  36. :page-size="pageObject['pageSize']"
  37. layout="total, prev, pager, next"
  38. :total="pageObject['total']">
  39. </el-pagination> -->
  40. </el-main>
  41. <el-footer>
  42. </el-footer>
  43. <el-dialog title="新建督查组分类" :visible.sync="addPICIDialogVisible">
  44. <el-form :model="piciForm" >
  45. <el-form-item label= '分类名称'>
  46. <el-input v-model="piciForm.name" placeholder="请输入内容"></el-input>
  47. </el-form-item>
  48. <el-form-item label="时间范围" >
  49. <el-date-picker
  50. v-model="piciForm.startDate"
  51. type="daterange"
  52. range-separator="至"
  53. start-placeholder="开始日期"
  54. end-placeholder="结束日期"
  55. value-format="yyyy-MM-dd"
  56. >
  57. </el-date-picker>
  58. </el-form-item>
  59. </el-form>
  60. <div slot="footer" class="dialog-footer">
  61. <el-button @click="addPICIDialogVisible = false">取 消</el-button>
  62. <el-button type="primary" @click="appendPICI" >确 定</el-button>
  63. </div>
  64. </el-dialog>
  65. </el-container>
  66. </template>
  67. <script>
  68. import request from '../../utils/gw_ajax_request.js';
  69. import {getArenGrpMen, addDczOthersMens,getPlanNodeByPersid,getTermByPersid,getPersPlanType} from "@api/duChaPlan.js";
  70. import editTable from '@widget/editableTable.vue'
  71. import {planMangeOneConfig} from './planMangeOneConfig.js'
  72. export default {
  73. props: [],
  74. components: {
  75. 'editTable':editTable,
  76. },
  77. data() {
  78. return {
  79. currentDCType:'1',
  80. DCTypeOption:[
  81. {value:'1',label:'小水库督查'},
  82. {value:'2',label:'人饮督查'},
  83. {value:'3',label:'水毁督查'}
  84. ],
  85. pageObject:{
  86. pageSize:10,
  87. pageIndex:1,
  88. total:0,
  89. },
  90. jihuaId:'',
  91. dcjhMainHeight:0,
  92. currentDcTermId:'',
  93. currentDcTermObject:'',
  94. DCTermOption:[],
  95. currentDcTableData:[],
  96. planMangeOneConfig:planMangeOneConfig,
  97. currentDcTableDataEditTableConfigObject:planMangeOneConfig['xiaoshuiku'],
  98. addPICIDialogVisible:false,
  99. piciForm:{
  100. name:'',
  101. startDate:'',
  102. endDate:'',
  103. },
  104. }
  105. },
  106. computed:{
  107. tableOtherParams:function(){
  108. return {'userId':this.userId};
  109. },
  110. userId:function(){
  111. return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
  112. },
  113. userInAllNode:function(){//当前登录用户所在的所有组信息
  114. return JSON.parse(localStorage.getItem("allNode"))? JSON.parse(localStorage.getItem("allNode")): []
  115. },
  116. guId:function(){
  117. return localStorage.getItem("guid")? localStorage.getItem("guid"): '000'
  118. },
  119. orgName(){
  120. return localStorage.getItem("orgName")? localStorage.getItem("orgName"): ''
  121. },
  122. userType(){
  123. return localStorage.getItem("userType")? localStorage.getItem("userType"): '1'
  124. },
  125. currentShowLists:function(){
  126. return this.currentShowList.filter(item => item.persName.indexOf(this.member_search) > -1)
  127. },
  128. isAdmin:function(){
  129. return localStorage.getItem("isAdmin")? localStorage.getItem("isAdmin"): ''
  130. },
  131. },
  132. watch:{
  133. currentDCType:function(){
  134. console.log('点选了新的督查类型');
  135. if(this.currentDCType=='1'){
  136. this.currentDcTableDataEditTableConfigObject = planMangeOneConfig['xiaoshuiku']
  137. }else if(this.currentDCType=='2'){
  138. this.currentDcTableDataEditTableConfigObject = planMangeOneConfig['renyin']
  139. }else if(this.currentDCType=='3'){
  140. this.currentDcTableDataEditTableConfigObject = planMangeOneConfig['shuihui']
  141. }else if(this.currentDCType=='4'){
  142. this.currentDcTableDataEditTableConfigObject = planMangeOneConfig['shuiligongchengjianshe']
  143. }else if(this.currentDCType=='5'){
  144. this.currentDcTableDataEditTableConfigObject = planMangeOneConfig['dixiahsui']
  145. }else if(this.currentDCType=='6'){
  146. this.currentDcTableDataEditTableConfigObject = planMangeOneConfig['shuizha']
  147. }else if(this.currentDCType=='7'){
  148. this.currentDcTableDataEditTableConfigObject = planMangeOneConfig['shuiligongchengyunxing']
  149. }
  150. this.test_getDuChaPlanInformation();
  151. },
  152. currentDcTermId:function(){
  153. console.log('点选了新的督查组分类');
  154. this.getTermInformation();
  155. }
  156. },
  157. mounted(){
  158. this.getUserPlanType();
  159. this.dcjhMainHeight =700;
  160. },
  161. activated(){
  162. this.test_getDuChaPlanInformation();
  163. },
  164. methods:{
  165. getUserPlanType:function(){
  166. let _self = this;
  167. getPersPlanType(this.userId).then(res =>{
  168. this.DCTypeOption = res.data;
  169. this.DCTypeOption.forEach((option)=>{
  170. option['value'] = Number(option['id']) + '';
  171. option['label'] = option['name'];
  172. });
  173. this.currentDCType = this.DCTypeOption[0].value;
  174. // this.
  175. this.test_getDuChaPlanInformation();
  176. });
  177. },
  178. test_getDuChaPlanInformation:function(){
  179. //当下折中方案,需要后续更改,提供所需接口后进行抛弃 @wxcwater
  180. getPlanNodeByPersid(this.userId,this.currentDCType).then((res)=>{
  181. console.log(res);
  182. this.DCTermOption = res.data;
  183. this.currentDcTermId = this.DCTermOption.length>0?this.DCTermOption[0].id:'';
  184. this.jihuaId = this.DCTermOption.length>0?this.DCTermOption[0].pid:'';
  185. this.getTermInformation();
  186. });
  187. // getTermByPersid().then((res)=>{});
  188. },
  189. mainClickToCleanRow:function(){
  190. console.log('outerClick');
  191. this.$refs['et'].cleanCurrentSelectedRow();
  192. },
  193. getTermInformation:function(termId){
  194. getTermByPersid(this.userId,this.currentDCType,this.currentDcTermId).then((res)=>{
  195. this.currentDcTableData = res.data;
  196. console.log('当前督查批次信息'+this.currentDcTermObject);
  197. this.pageObject. pageIndex = 1;
  198. this.pageObject.total = this.currentDcTableData.length;
  199. this.currentDcTableData.forEach((element)=>{
  200. element['leader'] = null;
  201. element['exp'] = null;
  202. element['teamMember'] = [];
  203. element['concat'] = null;
  204. element['persAllDtoList'].forEach((per)=>{
  205. if(per.persType=='1'){
  206. element['leader'] = per;
  207. }else if(per.persType=='4'){
  208. element['exp'] = per;
  209. }else if(per.persType=='3'){
  210. element['concat'] = per;
  211. }else if(per.persType=='2'){
  212. element['teamMember'].push(per);
  213. }
  214. });
  215. });
  216. console.log(this.currentDcTableData);
  217. });
  218. // this.currentDcTableData = this.currentDcTermObject.children;
  219. },
  220. refreshAfterEdit:function(){
  221. this.getTermInformation();
  222. },
  223. handleCurrentChange:function(){},
  224. addDCTerm:function(){
  225. this.appendZU();
  226. },
  227. appendPICI() {
  228. // console.log(this.addPICITreeNode)
  229. var _self = this;
  230. // let params = {
  231. // 'guid': this.addPICITreeNode.code,
  232. // 'prsnTitle': this.piciForm.name,
  233. // 'prsnId': this.userId,
  234. // 'palnSttm': this.piciForm.startDate[0],
  235. // 'palnEntm': this.piciForm.startDate[1]
  236. // }
  237. let params = {
  238. 'prsnTitle': this.piciForm.name,
  239. 'orgId':this.guId,
  240. 'objType':this.currentDCType,
  241. 'palnSttm': this.piciForm.startDate[0],
  242. 'palnEntm': this.piciForm.startDate[1],
  243. 'orgName':this.orgName,
  244. 'persId':this.userId
  245. }
  246. request.post('/dc/insp/plan/addInspPlanBatch',params).then((res)=>{
  247. // const newChild = { id:res.data.code , pid:_self.addPICITreeNode.id,pnm:_self.piciForm.name,sttm:'',entm:'', children: [] };
  248. //to-do wxcwater 改这里。
  249. _self.test_getDuChaPlanInformation();
  250. _self.addPICIDialogVisible = false;
  251. });
  252. },
  253. appendZU() {
  254. console.log(this.currentDcTermId);
  255. let params = {
  256. 'prsnTitle': '新建督查组',
  257. 'guid': this.currentDcTermId,
  258. // 'palnSttm': this.piciForm.startDate[0],
  259. // 'palnEntm': this.piciForm.startDate[1]
  260. }
  261. request.post('/dc/insp/plan/addBisInspPlan',params).then((res)=>{
  262. const newChild = { nm:res.data.name ,id:res.data.code,type:res.data.type};
  263. //to-do 改这里
  264. this.$refs['et'].addOneRow(newChild);
  265. this.addZuDialogVisible = false;
  266. })
  267. },
  268. deleteRow:function(params){
  269. this.$confirm('是否删除督查组:'+params.row.nm+'?', '提示', {
  270. confirmButtonText: '确定',
  271. cancelButtonText: '取消',
  272. type: 'warning'
  273. }).then(() => {
  274. request.post(`/dc/insp/group/delete?id=${params.row.id}`).then((res)=>{
  275. if(res.code!=50001&&res.code!='50001'){
  276. this.$message({
  277. type: 'success',
  278. message: '删除成功!'
  279. });
  280. }else{
  281. this.$message({
  282. type: 'error',
  283. message: '请先清空相关填报内容!'
  284. });
  285. }
  286. this.refreshAfterEdit();
  287. })
  288. }).catch(() => {
  289. this.$message({
  290. type: 'info',
  291. message: '已取消删除'
  292. });
  293. });
  294. },
  295. deleteZU:function(node,data){
  296. },
  297. },
  298. }
  299. </script>
  300. <style>
  301. </style>