409407cdd94b545ee876b2accda3e24c81e9e055.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <el-form ref="problemForm" :rules="rules" :model="problemForm" label-width="100px">
  3. <el-form-item label="问题类别">
  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">保存</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','rowData'],
  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. }
  98. },
  99. components: {
  100. upload: resolve => {
  101. require(["../../../widgets/uploadFile.vue"], resolve);
  102. },
  103. },
  104. computed: {
  105. recPers() {
  106. return localStorage.getItem('userid') ? localStorage.getItem('userid') : '';
  107. }
  108. },
  109. created() {
  110. if(this.problData){
  111. this.getproblemSmallType();
  112. }else{
  113. this.getproblemType();
  114. }
  115. },
  116. methods:{
  117. getproblemSmallType() {
  118. var _self = this;
  119. request.get(`/dc/insp/pblms/getPblmsByQuesNum/${_self.problData}/16`)
  120. .then(res => {
  121. if (res.success) {
  122. this.problemList = res.data;
  123. this.problemList = res.data;
  124. this.t1 = this.problemList[0]
  125. this.currentCheckPointList = this.problemList[0].items
  126. this.t2 = this.currentCheckPointList[0]
  127. this.currentProblemDescList = this.problemList[0].items[0].items
  128. this.t3 = this.currentProblemDescList[0]
  129. }
  130. })
  131. },
  132. getproblemType() {
  133. let result = [];
  134. request.get('/dc/insp/pblms/getPblmType', {
  135. params: {
  136. type: '16',
  137. pguid: '16000000000000000000000000000000'
  138. }
  139. }).then(res => {
  140. if (res.success) {
  141. res.data.forEach((ele) => {
  142. let haveinspPblmsName = false;
  143. result.forEach((inspPblm) => {
  144. if (inspPblm['name'] == ele.inspPblmsName) {
  145. //
  146. let havechekPoint = false;
  147. inspPblm['items'].forEach((chekPoint) => {
  148. if (chekPoint['name'] == ele.checkPoint) {
  149. //
  150. chekPoint['items'].push({
  151. pblmDesc: ele.pblmDesc,
  152. sn: ele.sn,
  153. guid: ele.guid,
  154. });
  155. havechekPoint = true;
  156. }
  157. });
  158. if (!havechekPoint) {
  159. let newCheckPoint = {};
  160. newCheckPoint['name'] = ele.checkPoint;
  161. newCheckPoint['sort2'] = ele.sort2;
  162. newCheckPoint['items'] = [{
  163. pblmDesc: ele.pblmDesc,
  164. sn: ele.sn,
  165. guid: ele.guid,
  166. }]
  167. inspPblm['items'].push(newCheckPoint);
  168. }
  169. haveinspPblmsName = true;
  170. }
  171. });
  172. if (!haveinspPblmsName) {
  173. let haveinspPblmsObj = {};
  174. haveinspPblmsObj['name'] = ele.inspPblmsName;
  175. haveinspPblmsObj['sort1'] = ele.sort1;
  176. haveinspPblmsObj['items'] = [{
  177. name: ele.checkPoint,
  178. sort2: ele.sort2,
  179. items: [{
  180. pblmDesc: ele.pblmDesc,
  181. sn: ele.sn,
  182. guid: ele.guid,
  183. }]
  184. }];
  185. result.push(haveinspPblmsObj);
  186. }
  187. })
  188. if(this.rowData.utPpt == '2'){
  189. this.problemList.push(result[0]);
  190. }else{
  191. this.problemList = result;
  192. }
  193. }
  194. })
  195. },
  196. getYanZhongChengDu(){
  197. this.inspPblmCate = this.t3.inspPblmCate;
  198. },
  199. onSubmit(problemForm) {
  200. this.$refs[problemForm].validate((valid) => {
  201. if (valid) {
  202. this.problemForm.recPers = this.recPers
  203. this.problemForm.objId = this.objId;
  204. this.problemForm.regid = this.currentObjectRgstrId;
  205. this.problemForm.nm = this.objName
  206. this.problemForm.objType = '16';
  207. this.problemForm.pblmStat = "0";
  208. this.problemForm['inspPblmName'] = this.t1.name;
  209. this.problemForm['inspPblmsName'] = this.t2.name;//检查项目
  210. this.problemForm['inspPblmDesc'] = this.problemForm.inspPblmDesc;
  211. this.problemForm['inspPlbmType'] = this.t2.sort;
  212. this.problemForm['inspPblmCode'] = this.t3.sn;
  213. this.problemForm['pblmsTypeId'] = this.t3.guid;
  214. this.problemForm['reviConc'] = "0";
  215. console.log(this.problemForm)
  216. if (!this.problemForm.inspPblmName) {
  217. this.$message.info('请选择问题类别')
  218. return
  219. }
  220. if (!this.problemForm.inspPblmsName) {
  221. this.$message.info('请选择检查项目')
  222. return
  223. }
  224. if (!this.problemForm.inspPblmName) {
  225. this.$message.info('请选择检查事项')
  226. return
  227. }
  228. if (!this.problemForm.inspPblmDesc) {
  229. this.$message.info('请填写详细描述')
  230. return
  231. }
  232. request.post('/dc/insp/pblm', this.problemForm).then(res => {
  233. if (res.success) {
  234. this.pblmId = res.data.pblmId;
  235. this.gwComFiles = [];
  236. this.pblmStat = res.data.pblmStat;
  237. if (this.$refs.uploadFile.submitUpload(res.data.pblmId)) {
  238. this.removeNewSupervision();
  239. }
  240. }
  241. })
  242. } else {
  243. console.log('error submit!!');
  244. return false;
  245. }
  246. });
  247. },
  248. // 文件上传
  249. submitUpload() {
  250. this.$refs.upload.submit();
  251. },
  252. updatefilelist(arg) {
  253. request.post('/dc/insp/pblm/update', {
  254. pblmId: this.pblmId,
  255. gwComFiles: arg,
  256. pblmStat: this.pblmStat
  257. }).then(res => {
  258. this.removeNewSupervision()
  259. });
  260. },
  261. removeNewSupervision(arg) {
  262. if (arg) {
  263. console.log(arg);
  264. var args = this.gwComFiles.concat(arg);
  265. this.updatefilelist(args);
  266. }
  267. this.$message.success('保存成功')
  268. this.$emit('closeDialog')
  269. this.gwComFiles = [];
  270. this.$refs.uploadFile.init();
  271. },
  272. problemListChange: function (item) {
  273. this.t1 = item
  274. this.currentCheckPointList = item.items;
  275. },
  276. currentCheckPointListChange: function (item) {
  277. this.t2 = item
  278. this.currentProblemDescList = item.items;
  279. },
  280. currentProblemDescListChange: function (item) {
  281. console.log(item);
  282. },
  283. },
  284. watch: {
  285. 't1': {
  286. handler: function (val, oldVal) {
  287. // console.log("详情"+val.pblmDesc)
  288. this.wenTiLeiBie = val.inspPblmsName;
  289. this.getYanZhongChengDu()
  290. },
  291. deep: true
  292. },
  293. 't2': {
  294. handler: function (val, oldVal) {
  295. this.jianChaXiangMu = val.checkPointName;
  296. this.getYanZhongChengDu()
  297. },
  298. deep: true
  299. },
  300. 't3': {
  301. handler: function (val, oldVal) {
  302. this.xiangqingmiaoshu = val.pblmDesc;
  303. this.getYanZhongChengDu()
  304. },
  305. deep: true
  306. },
  307. },
  308. }
  309. </script>
  310. <style>
  311. .media_item {
  312. float: left;
  313. width: 60px;
  314. font-size: 32px;
  315. }
  316. /*.el-select--mini {*/
  317. /*width: 100%;*/
  318. /*}*/
  319. </style>