39d3b3195af1000a21778bbf208ee42d870e4f8b.svn-base 14 KB

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