e9e164376043d942a3215e4d64a7b64803feccd4.svn-base 13 KB

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