47db88017c7a00a82dbea257469424c288bbaf26.svn-base 13 KB

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