f9df335de29257802dfe80f4c02a94a54c9ab159.svn-base 11 KB

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