e861a8b8cb025e0088d36e05b60ea098f19f330f.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <el-form ref="problemForm" :rules="rules" :model="problemForm" label-width="100px">
  3. <!-- <el-form-item label="取水口名称" style="text-align:left" v-if="rowData.wintName">-->
  4. <!-- <p>{{rowData.wintName}}</p>-->
  5. <!-- </el-form-item>-->
  6. <el-form-item label="问题类别" style="text-align:left">
  7. <el-select v-model="t1" value-key="items" placeholder="请选择" @change="problemListChange">
  8. <el-option v-for="(item,index) in problemList" :key="index" :label="item.name" :value="item">
  9. </el-option>
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="检查项目" style="text-align:left">
  13. <el-select v-model="t2" placeholder="请选择" value-key="items" @change="currentCheckPointListChange">
  14. <el-option v-for="(item,index) in currentCheckPointList" :key="index" :label="item.name" :value="item">
  15. </el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="问题描述" style=" text-align:left">
  19. <el-select v-model="t3" placeholder="请选择" value-key="pblmDesc" @change="currentProblemDescListChange" style="max-width: 500px">
  20. <el-option v-for="(item,index) in currentProblemDescList" :key="index" :label="item.pblmDesc" :value="item" :title="item.pblmDesc" style="max-width: 500px">
  21. </el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="详细描述">
  25. <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="problemForm.inspPblmDesc" required>
  26. </el-input>
  27. </el-form-item>
  28. <el-form-item label="严重程度:" style="text-align:left" prop="inspPblmCate">
  29. <p v-if="inspPblmCate == 0" >一般</p>
  30. <p v-if="inspPblmCate == 1" >较重</p>
  31. <p v-if="inspPblmCate == 2" >严重</p>
  32. <p v-if="inspPblmCate == 3" >特别严重</p>
  33. </el-form-item>
  34. <el-form-item label="列为典型问题" style="text-align:left">
  35. <el-radio v-model="problemForm.ifCasePblm" label="1">是</el-radio>
  36. <el-radio v-model="problemForm.ifCasePblm" label="0">否</el-radio>
  37. </el-form-item>
  38. <el-form-item label="上传照片">
  39. <upload ref="uploadFile" :url="`/pdcApi/file/insert?bizId=`" @uploadOver="removeNewSupervision"></upload>
  40. </el-form-item>
  41. <el-form-item style="margin-top: 50px">
  42. <el-button type="primary" @click="onSubmit('problemForm')" style="width: 100px;float:right" :loading="saveLoading">保存</el-button>
  43. </el-form-item>
  44. </el-form>
  45. </template>
  46. <script>
  47. import request from '@util/gw_ajax_request.js'
  48. import {
  49. submitUpload
  50. } from "@api/duChaAPI.js";
  51. export default {
  52. props: ['objId', 'objName', 'villType', 'objType', 'problemMiddleType', 'problemSmallType', 'engId', 'currentObjectRgstrId','problData','rowData'],
  53. data() {
  54. return {
  55. problemForm: {
  56. t1: '',
  57. t2: '',
  58. t3: '',
  59. objId: "",
  60. regid: '',
  61. objType: "",
  62. // inspPblmName: "",
  63. inspPblmCate: "",
  64. inspPblmDesc: "",
  65. ifCasePblm: '0',
  66. pblmStat: "",
  67. dataStat: "",
  68. nm: "",
  69. recPers: "",
  70. note: "",
  71. gwComFiles: [{
  72. id: "",
  73. filePath: "",
  74. bizId: ""
  75. }]
  76. },
  77. inspPblmCate:"",
  78. imgList: [],
  79. videoList: [],
  80. audioList: [],
  81. pblmStat: '',
  82. gwComFiles: [],
  83. problemList: [],
  84. currentCheckPointList: [],
  85. currentProblemDescList: [],
  86. t1: '',
  87. t2: '',
  88. t3: '',
  89. xiangqingmiaoshu: '',
  90. wenTiLeiBie:"",
  91. jianChaXiangMu:"",
  92. rules: {
  93. inspPblmDesc: [{
  94. required: true,
  95. message: '请输入描述',
  96. trigger: 'blur'
  97. },
  98. ],
  99. },
  100. saveLoading: false
  101. }
  102. },
  103. components: {
  104. upload: resolve => {
  105. require(["@widget/uploadFile.vue"], resolve);
  106. },
  107. },
  108. computed: {
  109. recPers() {
  110. return localStorage.getItem('userid') ? localStorage.getItem('userid') : '';
  111. }
  112. },
  113. created() {
  114. if(this.problData){
  115. this.getproblemSmallType();
  116. }else{
  117. this.getproblemType();
  118. }
  119. },
  120. methods:{
  121. getproblemSmallType() {
  122. var _self = this;
  123. request.get(`/dc/insp/pblms/getPblmsByQuesNum/${_self.problData}/32`)
  124. .then(res => {
  125. if (res.success) {
  126. this.problemList = res.data;
  127. this.t1 = this.problemList[0]
  128. this.currentCheckPointList = this.problemList[0].items
  129. this.t2 = this.currentCheckPointList[0]
  130. this.currentProblemDescList = this.problemList[0].items[0].items
  131. this.t3 = this.currentProblemDescList[0]
  132. }
  133. })
  134. },
  135. getproblemType() {
  136. let result = [];
  137. request.get('/dc/insp/pblms/getPblmType', {
  138. params: {
  139. type: '32',
  140. pguid: '32000000000000000000000000000000'
  141. }
  142. }).then(res => {
  143. if (res.success) {
  144. res.data.forEach((ele) => {
  145. let haveinspPblmsName = false;
  146. result.forEach((inspPblm) => {
  147. if (inspPblm['name'] == ele.inspPblmsName) {
  148. //
  149. let havechekPoint = false;
  150. inspPblm['items'].forEach((chekPoint) => {
  151. if (chekPoint['name'] == ele.checkPoint) {
  152. //
  153. chekPoint['items'].push({
  154. pblmDesc: ele.pblmDesc,
  155. sn: ele.sn,
  156. guid: ele.guid,
  157. });
  158. havechekPoint = true;
  159. }
  160. });
  161. if (!havechekPoint) {
  162. let newCheckPoint = {};
  163. newCheckPoint['name'] = ele.checkPoint;
  164. newCheckPoint['sort2'] = ele.sort2;
  165. newCheckPoint['items'] = [{
  166. pblmDesc: ele.pblmDesc,
  167. sn: ele.sn,
  168. guid: ele.guid,
  169. }]
  170. inspPblm['items'].push(newCheckPoint);
  171. }
  172. haveinspPblmsName = true;
  173. }
  174. });
  175. if (!haveinspPblmsName) {
  176. let haveinspPblmsObj = {};
  177. haveinspPblmsObj['name'] = ele.inspPblmsName;
  178. haveinspPblmsObj['sort1'] = ele.sort1;
  179. haveinspPblmsObj['items'] = [{
  180. name: ele.checkPoint,
  181. sort2: ele.sort2,
  182. items: [{
  183. pblmDesc: ele.pblmDesc,
  184. sn: ele.sn,
  185. guid: ele.guid,
  186. }]
  187. }];
  188. // if(haveinspPblmsObj.name == '取用水管控及地下水监管')
  189. result.push(haveinspPblmsObj);
  190. }
  191. })
  192. this.problemList = result;
  193. }
  194. })
  195. },
  196. getYanZhongChengDu(){
  197. request.post('/dc/insp/pblms/getPblmsByType', {
  198. inspPblmsName: this.wenTiLeiBie,
  199. checkPoint: this.jianChaXiangMu,
  200. pblmDesc: this.xiangqingmiaoshu,
  201. type: "32"
  202. }).then(res => {
  203. if (res.success) {
  204. this.inspPblmCate = res.data.inspPblmCate;
  205. }
  206. })
  207. },
  208. onSubmit(problemForm) {
  209. this.$refs[problemForm].validate((valid) => {
  210. if (valid) {
  211. this.problemForm.recPers = this.recPers
  212. this.problemForm.objId = this.objId;
  213. this.problemForm.regid = this.currentObjectRgstrId;
  214. this.problemForm.nm = this.objName
  215. this.problemForm.objType = '32';
  216. this.problemForm.pblmStat = "0";
  217. this.problemForm['inspPblmName'] = this.t1.name;
  218. this.problemForm['inspPblmsName'] = this.t2.name;//检查项目
  219. this.problemForm['checkPoint'] = this.t2.name;//add by lch
  220. this.problemForm['inspPblmDesc'] = this.problemForm.inspPblmDesc;
  221. this.problemForm['inspPlbmType'] = this.t2.sort;
  222. this.problemForm['inspPblmCode'] = this.t3.sn;
  223. this.problemForm['pblmsTypeId'] = this.t3.guid;
  224. this.problemForm['reviConc'] = "0";
  225. this.problemForm['inspPblmCate'] = this.inspPblmCate;
  226. this.problemForm['villageCode'] = this.rowData.wintCode ? this.rowData.wintCode : "";
  227. this.problemForm['newVillName'] = this.rowData.wintName ? this.rowData.wintName : "";
  228. console.log(this.problemForm)
  229. if (!this.problemForm.inspPblmName) {
  230. this.$message.info('请选择问题类别')
  231. return
  232. }
  233. if (!this.problemForm.inspPblmsName) {
  234. this.$message.info('请选择检查项目')
  235. return
  236. }
  237. if (!this.problemForm.checkPoint) {
  238. this.$message.info('请选择检查项目')
  239. return
  240. }
  241. if (!this.problemForm.inspPblmName) {
  242. this.$message.info('请选择检查事项')
  243. return
  244. }
  245. if (!this.problemForm.inspPblmDesc) {
  246. this.$message.info('请填写详细描述')
  247. return
  248. }
  249. if(!this.saveLoading){
  250. this.saveLoading = true
  251. request.post('/dc/insp/pblm', this.problemForm).then(res => {
  252. if (res.success) {
  253. this.pblmId = res.data.pblmId;
  254. this.gwComFiles = [];
  255. this.pblmStat = res.data.pblmStat;
  256. if (this.$refs.uploadFile.submitUpload(res.data.pblmId)) {
  257. this.removeNewSupervision();
  258. }
  259. }
  260. this.saveLoading = false
  261. }).catch(err=>{
  262. this.saveLoading = false
  263. });
  264. }
  265. } else {
  266. console.log('error submit!!');
  267. return false;
  268. }
  269. });
  270. },
  271. // 文件上传
  272. submitUpload() {
  273. this.$refs.upload.submit();
  274. },
  275. updatefilelist(arg) {
  276. request.post('/dc/insp/pblm/update', {
  277. pblmId: this.pblmId,
  278. gwComFiles: arg,
  279. pblmStat: this.pblmStat
  280. }).then(res => {
  281. this.removeNewSupervision()
  282. });
  283. },
  284. removeNewSupervision(arg) {
  285. if (arg) {
  286. console.log(arg);
  287. var args = this.gwComFiles.concat(arg);
  288. this.updatefilelist(args);
  289. }
  290. this.$message.success('保存成功')
  291. this.$emit('closeDialog')
  292. this.gwComFiles = [];
  293. this.$refs.uploadFile.init();
  294. },
  295. problemListChange: function (item) {
  296. this.t1 = item
  297. this.currentCheckPointList = item.items;
  298. },
  299. currentCheckPointListChange: function (item) {
  300. this.t2 = item
  301. this.currentProblemDescList = item.items;
  302. },
  303. currentProblemDescListChange: function (item) {
  304. console.log(item);
  305. },
  306. },
  307. watch: {
  308. 't1': {
  309. handler: function (val, oldVal) {
  310. // console.log("详情"+val.pblmDesc)
  311. this.wenTiLeiBie = val.name;
  312. this.getYanZhongChengDu()
  313. },
  314. deep: true
  315. },
  316. 't2': {
  317. handler: function (val, oldVal) {
  318. this.jianChaXiangMu = val.name;
  319. this.getYanZhongChengDu()
  320. },
  321. deep: true
  322. },
  323. 't3': {
  324. handler: function (val, oldVal) {
  325. this.xiangqingmiaoshu = val.pblmDesc;
  326. this.getYanZhongChengDu()
  327. },
  328. deep: true
  329. },
  330. },
  331. }
  332. </script>
  333. <style>
  334. .media_item {
  335. float: left;
  336. width: 60px;
  337. font-size: 32px;
  338. }
  339. /*.el-select--mini {*/
  340. /*width: 100%;*/
  341. /*}*/
  342. </style>