f93a1bf91f742d73d9dd24cebd83b957da55ff86.svn-base 10 KB

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