c290c4f145184ec1335bfce49bccb070917cde1e.svn-base 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  1. <template>
  2. <div class="problem_dialog">
  3. <el-form ref="problemForm" :rules="rules" :model="problemForm" label-width="120px">
  4. <el-form-item>
  5. <el-button type="text" @click="selectPblm" style="float: left;">选择问题</el-button>
  6. </el-form-item>
  7. <el-form-item label="检查对象" style="text-align:left">
  8. <el-select v-model="t1" value-key="inspPblmsName" placeholder="请选择" disabled>
  9. <el-option v-for="(item,index) in problemList" :key="index" :label="item.inspPblmsName" :value="item">
  10. </el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="检查项目" style="text-align:left">
  14. <el-select v-model="t2" placeholder="请选择" value-key="checkPointName" disabled>
  15. <el-option v-for="(item,index) in currentCheckPointList" :key="index" :label="item.checkPointName" :value="item">
  16. </el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="问题名称和描述" style="text-align:left">
  20. <el-input v-model="t3" type="textarea" :rows="4" placeholder="" disabled></el-input>
  21. </el-form-item>
  22. <el-form-item label="检查对象名称" style="text-align:left">
  23. <div v-if="showStation">
  24. <el-select v-model="problemForm.cwsCode" placeholder="请选择" clearable :disabled="stationDisabled" @change="stationChange">
  25. <el-option v-for="(item,index) in stationList" :key="index" :label="item.inspObjName" :value="item.id">
  26. </el-option>
  27. </el-select>
  28. <el-button
  29. v-if="!stationDisabled"
  30. @click="toAddNewStation"
  31. type="text">
  32. <i class="el-icon-circle-plus"></i>
  33. </el-button>
  34. </div>
  35. <div v-if="showTown">
  36. <el-select v-model="townSelected" value-key="adName" placeholder="请选择" clearable>
  37. <el-option v-for="(item,index) in townList" :key="index" :label="item.adName" :value="item">
  38. </el-option>
  39. </el-select>
  40. <el-button
  41. @click="toAddNewTown"
  42. type="text">
  43. <i class="el-icon-circle-plus"></i>
  44. </el-button>
  45. </div>
  46. <div v-if="showVillage">
  47. <el-select v-model="villageSelected" value-key="inspObjName" placeholder="请选择" clearable>
  48. <el-option v-for="(item,index) in villageList" :key="index" :label="item.inspObjName" :value="item">
  49. </el-option>
  50. </el-select>
  51. <el-button
  52. @click="toAddNewVillage"
  53. type="text">
  54. <i class="el-icon-circle-plus"></i>
  55. </el-button>
  56. </div>
  57. </el-form-item>
  58. <el-form-item label="行政区划" style="text-align:left">
  59. <el-input v-model="problemForm.inspAddDesc" type="text" placeholder="" readonly></el-input>
  60. </el-form-item>
  61. <el-form-item label="严重程度:" style="text-align:left" prop="inspPblmCate">
  62. <div v-if="t3 && t3.indexOf('[其他]') == -1">
  63. <p v-if="inspPblmCate == 0" style="color: green">一般</p>
  64. <p v-if="inspPblmCate == 1" style="color: orange">较重</p>
  65. <p v-if="inspPblmCate == 2" style="color: red">严重</p>
  66. </div>
  67. <el-select
  68. v-else
  69. v-model="inspPblmCate"
  70. clearable
  71. placeholder="请选择">
  72. <el-option
  73. v-for="item in supervisionState"
  74. :key="item.value"
  75. :label="item.label"
  76. :value="item.value"
  77. ></el-option>
  78. </el-select>
  79. </el-form-item>
  80. <el-form-item label="典型问题" style="text-align:left">
  81. <el-radio v-model="problemForm.ifCasePblm" label="1">是</el-radio>
  82. <el-radio v-model="problemForm.ifCasePblm" label="0">否</el-radio>
  83. </el-form-item>
  84. <el-form-item label="详细描述" prop="inspPblmDesc">
  85. <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="problemForm.inspPblmDesc" required>
  86. </el-input>
  87. </el-form-item>
  88. <el-form-item label="原因分析" prop="pblmReason">
  89. <el-input
  90. type="textarea"
  91. :rows="2"
  92. placeholder="请输入内容"
  93. v-model="problemForm.pblmReason">
  94. </el-input>
  95. </el-form-item>
  96. <el-form-item label="整改建议" prop="pblmSggtn">
  97. <el-input
  98. type="textarea"
  99. :rows="2"
  100. placeholder="请输入内容"
  101. v-model="problemForm.pblmSggtn">
  102. </el-input>
  103. </el-form-item>
  104. <el-form-item label="上传照片">
  105. <upload ref="uploadFile" :url="`/pdcApi/file/insert?bizId=`" @uploadOver="removeNewSupervision"></upload>
  106. </el-form-item>
  107. <el-form-item style="margin-top: 50px">
  108. <el-button type="primary" @click="onSubmit('problemForm')" style="width: 100px;float:right">保存</el-button>
  109. </el-form-item>
  110. </el-form>
  111. <el-dialog
  112. class="pblmEascader"
  113. title="选择问题"
  114. width="60%"
  115. append-to-body
  116. :visible.sync="pblmEascaderVisible">
  117. <pblmEascader :objType="27" @modelData="modelData" :vmodelData="newPblmValue" :t3="t3"></pblmEascader>
  118. <span slot="footer">
  119. <el-button @click="pblmEascaderVisible=false">返 回</el-button>
  120. <el-button type="primary" @click="submitEascader">确 定</el-button>
  121. </span>
  122. </el-dialog>
  123. <el-dialog
  124. :title="isStation ? '新增监测站点' : '新增接收端'"
  125. width="60%"
  126. append-to-body
  127. :visible.sync="addNewStationVisible">
  128. <el-form :model="newStationObj" label-width="120px" :rules="stationRule" ref="stationForm">
  129. <el-form-item :label="isStation ? '站点名称' : '接收端名称'" prop="inspObjName">
  130. <el-input type="text" placeholder="请输入站点名称" v-model="newStationObj.inspObjName" required>
  131. </el-input>
  132. </el-form-item>
  133. <!-- <el-form-item label="所在地点">
  134. <el-input type="text" placeholder="请输入所在地点" v-model="newStationObj.location">
  135. </el-input>
  136. </el-form-item> -->
  137. <el-form-item label="行政区划">
  138. <el-input type="text" placeholder="" readonly v-model="newStationObj.location">
  139. </el-input>
  140. <div style="margin: 5px 0;">
  141. <span>选择乡</span>
  142. <el-select v-model="townSelectedStation" value-key="adName" placeholder="请选择" clearable>
  143. <el-option v-for="(item,index) in townsList" :key="index" :label="item.adName" :value="item">
  144. </el-option>
  145. </el-select>
  146. <!-- <el-button
  147. @click="toAddNewTown"
  148. type="text">
  149. <i class="el-icon-circle-plus"></i>
  150. </el-button> -->
  151. &#x3000;
  152. <span>选择村</span>
  153. <el-select v-model="villageSelectedStation" value-key="adName" placeholder="请选择" clearable>
  154. <el-option v-for="(item,index) in villagesList" :key="index" :label="item.adName" :value="item">
  155. </el-option>
  156. </el-select>
  157. <!-- <el-button
  158. @click="toAddNewVillage"
  159. type="text">
  160. <i class="el-icon-circle-plus"></i>
  161. </el-button> -->
  162. </div>
  163. </el-form-item>
  164. </el-form>
  165. <span slot="footer">
  166. <el-button @click="addNewStationVisible=false">返 回</el-button>
  167. <el-button type="primary" @click="addNewStation">确 定</el-button>
  168. </span>
  169. </el-dialog>
  170. <el-dialog
  171. title="新增乡镇"
  172. width="60%"
  173. append-to-body
  174. :visible.sync="addNewTownVisible">
  175. <div style="margin: 10px; cursor: pointer; color: #5cb6ff">
  176. <span @click="addCustomDivision('town')"><i class="el-icon-circle-plus"></i> 新增</span>
  177. </div>
  178. <div class="radio_wrapper">
  179. <el-radio v-model="addTownValue" style="margin: 10px" v-for="(town,index) in townsList" :label="town.adCode" :key="index">{{town.adName}}</el-radio>
  180. </div>
  181. <span slot="footer">
  182. <el-button @click="addNewTownVisible=false">返 回</el-button>
  183. <el-button type="primary" @click="addNewTown">确 定</el-button>
  184. </span>
  185. </el-dialog>
  186. <add-custom-division-com v-if="customDiviDialogVisible" :rootCode="rootCode" @addSuccess="addSuccess" @cancelHundler="cancelHundler"></add-custom-division-com>
  187. <el-dialog
  188. title="新增村"
  189. width="60%"
  190. append-to-body
  191. :visible.sync="addNewVillageVisible">
  192. <div style="margin: 10px; cursor: pointer; color: #5cb6ff">
  193. <span @click="addCustomDivision('village')"><i class="el-icon-circle-plus"></i> 新增</span>
  194. </div>
  195. <el-cascader-panel :props="villageProps" v-model="addVillageValue" ref="cascaderRef"></el-cascader-panel>
  196. <span slot="footer">
  197. <el-button @click="addNewVillageVisible=false">返 回</el-button>
  198. <el-button type="primary" @click="addNewVillage">确 定</el-button>
  199. </span>
  200. </el-dialog>
  201. </div>
  202. </template>
  203. <script>
  204. import request from '@util/gw_ajax_request.js'
  205. import pblmEascader from '../../duChaTianBao/project/pblmEascader'
  206. import addCustomDivisionCom from '../../duChaTianBao/shanhong/addCustomDivisionCom'
  207. import {
  208. submitUpload,
  209. getAdXBaseData
  210. } from "@api/duChaAPI.js";
  211. import {
  212. getStationListApi,
  213. addNewStationApi,
  214. getTownsListApi,
  215. getVillageListApi
  216. } from "@api/duChaTianBao.js";
  217. export default {
  218. props: ['objId', 'objName', 'villType', 'objType', 'engId', 'regId','newModelData','adCode','adName'],
  219. data() {
  220. let _this = this
  221. return {
  222. problemForm: {
  223. t1: '',
  224. t2: '',
  225. t3: '',
  226. villType: '',
  227. objId: "",
  228. regid: '',
  229. objType: "",
  230. // inspPblmName: "",
  231. inspPblmCate:"",
  232. inspPblmDesc: "",
  233. inspAddDesc: '', //行政区划详细地址
  234. ifCasePblm: '0',
  235. pblmStat: "",
  236. dataStat: "",
  237. nm: "",
  238. recPers: "",
  239. note: "",
  240. gwComFiles: []
  241. },
  242. inspPblmCate:"",
  243. imgList: [],
  244. videoList: [],
  245. audioList: [],
  246. pblmStat: '',
  247. gwComFiles: [],
  248. problemList: [],
  249. tempResult:[], // add by lch
  250. currentCheckPointList: [],
  251. currentProblemDescList: [],
  252. t1: '',
  253. t2: '',
  254. t3: '',
  255. xiangqingmiaoshu: '',
  256. wenTiLeiBie:"",
  257. jianChaXiangMu:"",
  258. supervisionState: [
  259. {
  260. value: "0",
  261. label: "一般"
  262. },
  263. {
  264. value: "1",
  265. label: "较重"
  266. },
  267. {
  268. value: "2",
  269. label: "严重"
  270. }
  271. ],
  272. rules: {
  273. inspPblmDesc: [{
  274. required: true,
  275. message: '请输入问题描述',
  276. trigger: 'blur'
  277. },
  278. ],
  279. pblmReason: [{
  280. required: true,
  281. message: '请输入问题描述',
  282. trigger: 'blur'
  283. },
  284. ],
  285. pblmSggtn: [{
  286. required: true,
  287. message: '请输入问题描述',
  288. trigger: 'blur'
  289. },
  290. ],
  291. },
  292. stationRule: {
  293. inspObjName: [{
  294. required: true,
  295. message: '请输入站点名称',
  296. trigger: 'blur'
  297. },
  298. ],
  299. },
  300. isClicked: false,
  301. pblmEascaderVisible: false,
  302. newPblmValue: [],
  303. stationList: [],
  304. addNewStationVisible: false,
  305. addNewTownVisible: false,
  306. addNewVillageVisible: false,
  307. newStationObj: {
  308. inspObjName: '', //暗访对象名称
  309. location: '', //详细地址
  310. adCode: '',
  311. adName: ''
  312. },
  313. townAdName: '',
  314. townList: [], //乡镇列表
  315. townsList: [], //乡镇列表
  316. townSelected: null,
  317. selectAdCode: '',
  318. villageList: [], //村列表
  319. villagesList: [],
  320. villageSelected: '',
  321. townaddObj: null,
  322. addTownValue: '', //添加乡镇时所选乡镇的adCode
  323. addVillageValue: '',
  324. villageProps: {
  325. lazy: true,
  326. lazyLoad (node, resolve) {
  327. _this.curNode = node
  328. _this.curResolve = resolve
  329. const { level } = node;
  330. if(level < 1){
  331. _this.cascaderTown(node, resolve)
  332. }else{
  333. _this.cascaderVillage(node, resolve)
  334. }
  335. }
  336. },
  337. townSelectedStation: null, //监测站行政区划
  338. villageSelectedStation: null, //监测站行政区划
  339. customDiviDialogVisible: false,
  340. rootCode: '',
  341. curNode: null,
  342. curResolve: null,
  343. curTownName: '',
  344. adFullName: ''
  345. }
  346. },
  347. components: {
  348. upload: resolve => {
  349. require(["@widget/uploadFile.vue"], resolve);
  350. },
  351. pblmEascader,
  352. addCustomDivisionCom
  353. },
  354. computed: {
  355. recPers() {
  356. return localStorage.getItem('userid') ? localStorage.getItem('userid') : '';
  357. },
  358. stationDisabled(){
  359. return this.t1.indexOf('县') > -1
  360. },
  361. showStation(){
  362. if(this.t1){
  363. return this.t1.indexOf('站') > -1 || this.t1.indexOf('接收') > -1 || this.t1.indexOf('县') > -1
  364. }
  365. },
  366. showTown(){
  367. if(this.t1){
  368. return this.t1.indexOf('乡') > -1
  369. }
  370. },
  371. showVillage(){
  372. if(this.t1){
  373. return this.t1.indexOf('村') > -1
  374. }
  375. },
  376. isStation(){
  377. return this.t1.indexOf('站') > -1
  378. },
  379. isReceive(){
  380. return this.t1.indexOf('接收') > -1
  381. },
  382. },
  383. mounted() {
  384. this.newPblmValue = this.newModelData;
  385. if(this.newPblmValue){
  386. this.t1 = this.newPblmValue.model[0];
  387. this.t2 = this.newPblmValue.model[1];
  388. this.t3 = this.newPblmValue.label;
  389. this.getYanZhongChengDu();
  390. }
  391. this.problemForm.inspAddDesc = this.adName
  392. this.newStationObj.location = this.adName
  393. this.getStationList()
  394. this.getTownList()
  395. },
  396. methods:{
  397. cascaderTown(node, resolve){
  398. let adCode = this.adCode
  399. let townsList = []
  400. getTownsListApi(adCode,this.regId).then(
  401. (res) => {
  402. if (res.success && res.data) {
  403. this.townsList = res.data;
  404. this.townsList.forEach(item=>{
  405. townsList.push({value: item.adCode,label: item.adName, leaf: node.level})
  406. })
  407. } else {
  408. this.townsList = [];
  409. }
  410. console.log(townsList)
  411. resolve(townsList)
  412. },
  413. (err) => {
  414. }
  415. );
  416. },
  417. cascaderVillage(node, resolve, resolveLast){
  418. let villagesList = []
  419. console.log(node)
  420. this.rootCode = node.value
  421. getVillageListApi(node.value,this.regId).then(
  422. (res) => {
  423. if (res.success && res.data) {
  424. this.villagesList = res.data;
  425. this.villagesList.forEach(item=>{
  426. villagesList.push({value: item.adCode,label: item.adName, leaf: node.level})
  427. })
  428. } else {
  429. this.villagesList = [];
  430. }
  431. if(resolveLast){
  432. let newItemIndex = villagesList.length - 1
  433. let newItemArray = [villagesList[newItemIndex]]
  434. resolve(newItemArray)
  435. }else{
  436. resolve(villagesList)
  437. }
  438. },
  439. (err) => {
  440. }
  441. );
  442. },
  443. getYanZhongChengDu(){
  444. request.post('/dc/insp/pblms/getPblmsByType', {
  445. inspPblmsName:this.t1,
  446. checkPoint:this.t2,
  447. pblmDesc:this.t3,
  448. type: this.objType
  449. }).then(res => {
  450. if (res.success) {
  451. this.inspPblmCate=res.data.inspPblmCate;
  452. }
  453. })
  454. },
  455. toAddNewStation(){
  456. this.getTownsList()
  457. this.addNewStationVisible = true
  458. },
  459. // 添加监测站/接收端
  460. addNewStation(){
  461. let inspObjType
  462. if(this.t1.indexOf('站') > -1){
  463. inspObjType = 1
  464. }else if(this.t1.indexOf('接收') > -1){
  465. inspObjType = 2
  466. }
  467. this.$refs.stationForm.validate(valid=>{
  468. if(valid){
  469. let data = {
  470. inspObjType: inspObjType,
  471. rgstrId: this.regId,
  472. recPersId: this.recPers
  473. }
  474. Object.assign(data,this.newStationObj)
  475. addNewStationApi(data).then(
  476. (res) => {
  477. if (res.success) {
  478. this.$message.success('添加成功')
  479. this.getStationList()
  480. this.addNewStationVisible = false
  481. } else {
  482. this.$message.success(res.message)
  483. }
  484. },
  485. (err) => {
  486. }
  487. );
  488. }else{
  489. return false
  490. }
  491. })
  492. },
  493. toAddNewTown(){
  494. this.getTownsList()
  495. this.addNewTownVisible = true
  496. },
  497. addNewTown(){
  498. if(!this.addTownValue){
  499. this.$message.warning('请选择乡镇')
  500. return
  501. }
  502. let adName
  503. this.townsList.forEach(ele=>{
  504. if(ele.adCode == this.addTownValue){
  505. adName = ele.adName
  506. }
  507. })
  508. let data = {
  509. adCode: this.addTownValue,
  510. adName: adName,
  511. inspObjName: adName,
  512. inspObjType: 3,
  513. rgstrId: this.regId,
  514. recPersId: this.recPers
  515. }
  516. addNewStationApi(data).then(
  517. (res) => {
  518. if (res.success) {
  519. this.$message.success('添加成功')
  520. this.getTownList()
  521. this.addNewTownVisible = false
  522. } else {
  523. this.$message.success(res.message)
  524. }
  525. },
  526. (err) => {
  527. }
  528. );
  529. },
  530. toAddNewVillage(){
  531. this.addNewVillageVisible = true
  532. },
  533. addNewVillage(){
  534. let addVillageValue = this.addVillageValue[1]
  535. if(!addVillageValue){
  536. this.$message.warning('请选择村')
  537. return
  538. }
  539. let adName
  540. this.villagesList.forEach(ele=>{
  541. if(ele.adCode == addVillageValue){
  542. adName = ele.adName
  543. }
  544. })
  545. let cascaderNodes = this.$refs.cascaderRef.getCheckedNodes()
  546. this.curTownName = cascaderNodes[0].parent.data.label
  547. let data = {
  548. adCode: addVillageValue,
  549. adName: `${this.curTownName}-${adName}`,
  550. inspObjName: adName,
  551. inspObjType: 4,
  552. rgstrId: this.regId,
  553. recPersId: this.recPers
  554. }
  555. addNewStationApi(data).then(
  556. (res) => {
  557. if (res.success) {
  558. this.$message.success('添加成功')
  559. this.getVillageList()
  560. this.addNewVillageVisible = false
  561. } else {
  562. this.$message.success(res.message)
  563. }
  564. },
  565. (err) => {
  566. }
  567. );
  568. },
  569. // 问题提交
  570. onSubmit(problemForm) {
  571. let _self = this;
  572. if(this.showStation){
  573. this.stationList.forEach(ele=>{
  574. if(ele.id == this.problemForm.cwsCode){
  575. this.problemForm['newVillName'] = ele.inspObjName
  576. }
  577. })
  578. }else if(this.showTown){
  579. this.townList.forEach(ele=>{
  580. if(ele.adCode == this.problemForm.cwsCode){
  581. this.problemForm['newVillName'] = ele.inspObjName
  582. }
  583. })
  584. }else if(this.showVillage){
  585. this.villageList.forEach(ele=>{
  586. if(ele.adCode == this.problemForm.cwsCode){
  587. this.problemForm['newVillName'] = ele.inspObjName
  588. }
  589. })
  590. }
  591. this.problemForm['adCode'] = this.adCode
  592. this.problemForm['adFullName'] = this.adName
  593. if(!_self.isClicked){
  594. _self.$refs[problemForm].validate((valid) => {
  595. if (valid) {
  596. _self.problemForm.villType = '27';
  597. _self.problemForm.recPers = _self.recPers
  598. _self.problemForm.objId = _self.objId;
  599. _self.problemForm.regid = _self.regId;
  600. _self.problemForm.nm = _self.objName
  601. _self.problemForm.objType = '27';
  602. _self.problemForm.pblmStat = "0";
  603. _self.problemForm['inspPblmCate'] = _self.inspPblmCate;// add by lch 解决添加问题时 该字段不能为空的错
  604. _self.problemForm['inspPblmName'] = _self.t1;
  605. _self.problemForm['inspPblmDesc'] = _self.problemForm.inspPblmDesc;
  606. _self.problemForm['inspPlbmType'] = _self.t2;
  607. // this.problemForm['inspPblmName'] = this.t3.pblmDesc;
  608. _self.problemForm['inspPblmCode'] = _self.t3;
  609. _self.problemForm['pblmsTypeId'] = _self.newPblmValue.model[2];
  610. if (!_self.problemForm.inspPblmName) {
  611. _self.$message.info('问题类别不能为空')
  612. return
  613. }
  614. if (!_self.problemForm.inspPlbmType) {
  615. _self.$message.info('检查项目不能为空')
  616. return
  617. }
  618. if (!_self.problemForm.inspPblmCode) {
  619. _self.$message.info('问题描述不能为空')
  620. return
  621. }
  622. _self.isClicked = true
  623. request.post('/dc/insp/pblm', _self.problemForm).then(res => {
  624. if (res.success) {
  625. _self.pblmId = res.data.pblmId;
  626. _self.gwComFiles = [];
  627. _self.pblmStat = res.data.pblmStat;
  628. if (_self.$refs.uploadFile.submitUpload(res.data.pblmId)) {
  629. _self.removeNewSupervision();
  630. }
  631. }
  632. _self.isClicked = false
  633. })
  634. } else {
  635. console.log('error submit!!');
  636. return false;
  637. }
  638. });
  639. }
  640. },
  641. // 获取监测站/接收端列表数据
  642. getStationList(){
  643. let inspObjType
  644. if(this.t1.indexOf('站') > -1){
  645. inspObjType = 1
  646. }else if(this.t1.indexOf('接收') > -1){
  647. inspObjType = 2
  648. }
  649. let data = {
  650. inspObjType: inspObjType,
  651. rgstrId: this.regId
  652. }
  653. getStationListApi(data).then(
  654. (res) => {
  655. if (res.success && res.data) {
  656. this.stationList = res.data;
  657. } else {
  658. this.stationList = [];
  659. }
  660. },
  661. (err) => {
  662. }
  663. );
  664. },
  665. // 获取乡镇数据
  666. getTownList(){
  667. let data = {
  668. inspObjType: 3,
  669. rgstrId: this.regId
  670. }
  671. getStationListApi(data).then(
  672. (res) => {
  673. if (res.success && res.data) {
  674. this.townList = res.data;
  675. } else {
  676. this.townList = [];
  677. }
  678. },
  679. (err) => {
  680. }
  681. );
  682. },
  683. // 获取村数据
  684. getVillageList(){
  685. let data = {
  686. inspObjType: 4,
  687. rgstrId: this.regId
  688. }
  689. getStationListApi(data).then(
  690. (res) => {
  691. if (res.success && res.data) {
  692. this.villageList = res.data;
  693. } else {
  694. this.villageList = [];
  695. }
  696. },
  697. (err) => {
  698. }
  699. );
  700. },
  701. // 获取乡镇列表数据
  702. getTownsList(){
  703. let adCode = this.adCode
  704. getAdXBaseData(adCode).then(
  705. (res) => {
  706. if (res.success && res.data) {
  707. this.townsList = res.data;
  708. this.adFullName = res.data[0].adFullName
  709. } else {
  710. this.townsList = [];
  711. }
  712. },
  713. (err) => {
  714. }
  715. );
  716. },
  717. // 获取村列表数据
  718. getVillagesList(){
  719. let adCode = this.selectAdCode
  720. getAdXBaseData(adCode).then(
  721. (res) => {
  722. if (res.success && res.data) {
  723. this.villagesList = res.data;
  724. this.adFullName = res.data[0].adFullName
  725. } else {
  726. this.villagesList = [];
  727. }
  728. },
  729. (err) => {
  730. }
  731. );
  732. },
  733. // 文件上传
  734. submitUpload() {
  735. this.$refs.upload.submit();
  736. },
  737. updatefilelist(arg) {
  738. request.post('/dc/insp/pblm/update', {
  739. pblmId: this.pblmId,
  740. gwComFiles: arg,
  741. pblmStat: this.pblmStat
  742. }).then(res => {
  743. this.removeNewSupervision()
  744. });
  745. },
  746. removeNewSupervision(arg) {
  747. if (arg) {
  748. console.log(arg);
  749. var args = this.gwComFiles.concat(arg);
  750. this.updatefilelist(args);
  751. return;
  752. }
  753. this.$message.success('保存成功')
  754. this.$emit('closeDialog')
  755. this.gwComFiles = [];
  756. this.$refs.uploadFile.init();
  757. },
  758. problemListChange: function (item) {
  759. this.currentCheckPointList = item.checkPoints;
  760. },
  761. currentCheckPointListChange: function (item) {
  762. this.currentProblemDescList = item.pblmDescs;
  763. },
  764. modelData(val){
  765. this.newPblmValue = val;
  766. this.t1 = this.newPblmValue.model[0];
  767. this.t2 = this.newPblmValue.model[1];
  768. this.t3 = this.newPblmValue.label;
  769. },
  770. selectPblm(){
  771. this.pblmEascaderVisible = true;
  772. },
  773. submitEascader(){
  774. if(!this.newPblmValue.model.length){
  775. this.$message.warning('问题不能为空');
  776. return;
  777. }
  778. this.pblmEascaderVisible = false;
  779. },
  780. stationChange(val){
  781. this.stationList.forEach(ele=>{
  782. if(ele.id == val){
  783. this.problemForm.inspAddDesc = ele.location
  784. }
  785. })
  786. },
  787. addCustomDivision(type){
  788. if(type == 'town'){
  789. this.rootCode = this.adCode
  790. }
  791. this.customDiviDialogVisible = true
  792. },
  793. // 添加自定义行政区划成功
  794. addSuccess(){
  795. if(this.curNode){
  796. let cascaderNodes = this.$refs.cascaderRef.getCheckedNodes()
  797. this.cascaderVillage(cascaderNodes[0], this.curResolve, 'resolveLast')
  798. }else{
  799. this.getTownsList()
  800. }
  801. this.customDiviDialogVisible = false
  802. },
  803. cancelHundler(){
  804. this.customDiviDialogVisible = false
  805. }
  806. },
  807. watch: {
  808. townSelected(val){
  809. if(val){
  810. this.townAdName = `${this.adName}-${val.adName}`
  811. this.problemForm.inspAddDesc = this.townAdName
  812. this.selectAdCode = val.adCode
  813. this.problemForm.cwsCode = val.adCode
  814. }else{
  815. this.selectAdCode = this.adCode
  816. this.problemForm.inspAddDesc = this.adName
  817. }
  818. },
  819. villageSelected(val){
  820. if(val){
  821. let adName = `${this.adName}-${val.adName}`
  822. this.problemForm.inspAddDesc = adName
  823. this.selectAdCode = val.adCode
  824. this.problemForm.cwsCode = val.adCode
  825. }else{
  826. this.selectAdCode = this.townSelected.adCode
  827. this.problemForm.inspAddDesc = this.townAdName
  828. }
  829. },
  830. t1(val){
  831. if(val){
  832. if(val.indexOf('站') > -1 || val.indexOf('接收') > -1){
  833. this.getStationList()
  834. }else if(val.indexOf('乡') > -1){
  835. this.getTownList()
  836. }else if(val.indexOf('村') > -1){
  837. this.getVillageList()
  838. }else{
  839. this.problemForm.inspAddDesc = this.adName
  840. }
  841. this.problemForm.cwsCode = ''
  842. }
  843. },
  844. townSelectedStation(val){
  845. if(val){
  846. this.newStationObj.adName = val.adName
  847. this.newStationObj.adCode = val.adCode
  848. this.newStationObj.location = `${this.adName}-${val.adName}`
  849. this.selectAdCode = val.adCode
  850. this.getVillagesList()
  851. }else{
  852. this.newStationObj.adName = this.adName
  853. this.newStationObj.adCode = this.adCode
  854. this.newStationObj.location = this.adName
  855. }
  856. },
  857. villageSelectedStation(val){
  858. if(val){
  859. this.newStationObj.adName = val.adName
  860. this.newStationObj.adCode = val.adCode
  861. this.newStationObj.location = `${this.adName}-${this.townSelectedStation.adName}-${val.adName}`
  862. }else{
  863. this.newStationObj.adName = this.adName
  864. this.newStationObj.adCode = this.adCode
  865. this.newStationObj.location = this.townSelectedStation.adName
  866. }
  867. }
  868. },
  869. }
  870. </script>
  871. <style>
  872. .media_item {
  873. float: left;
  874. width: 60px;
  875. font-size: 32px;
  876. }
  877. .pblmEascader .el-dialog__body {
  878. height: 15vh;
  879. overflow: auto;
  880. }
  881. .problem_dialog .el-icon-circle-plus{
  882. font-size: 16px;
  883. }
  884. </style>