| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <template>
- <el-form ref="problemForm" :rules="rules" :model="problemForm" label-width="100px">
- <el-form-item label="详细描述" prop="inspPblmDesc">
- <el-input
- type="textarea"
- :rows="2"
- placeholder="请输入内容"
- v-model="problemForm.inspPblmDesc"
- required
- ></el-input>
- </el-form-item>
- <el-form-item label="列为典型问题" style="text-align:left">
- <el-radio v-model="problemForm.ifCasePblm" label="1">是</el-radio>
- <el-radio v-model="problemForm.ifCasePblm" label="0">否</el-radio>
- </el-form-item>
- <el-form-item label="上传照片">
- <upload
- ref="uploadFile"
- :url="`/pdcApi/file/insert?bizId=`"
- @uploadOver="removeNewSupervision"
- ></upload>
- </el-form-item>
- <el-form-item style="margin-top: 50px">
- <el-button type="primary" @click="onSubmit('problemForm')" style="width: 100px;float:right">保存</el-button>
- </el-form-item>
- </el-form>
- </template>
- <script>
- import request from '@util/gw_ajax_request.js'
- import {
- submitUpload
- } from "@api/duChaAPI.js"
- export default {
- props: ['objId', 'objName', 'villType', 'objType', 'problemMiddleType', 'problemSmallType', 'engId', 'currentObjectRgstrId', 'problData'],
- data () {
- return {
- problemForm: {
- objId: "",
- regid: '',
- objType: "",
- inspPblmDesc: "",
- ifCasePblm: '0',
- recPers: "",
- gwComFiles: [{
- id: "",
- filePath: "",
- bizId: ""
- }]
- },
- imgList: [],
- videoList: [],
- audioList: [],
- pblmStat: '',
- gwComFiles: [],
- rules: {
- inspPblmDesc: [{
- required: true,
- message: '请输入描述',
- trigger: 'blur'
- },
- ],
- }
- }
- },
- components: {
- upload: resolve => {
- require(["../../../widgets/uploadFile.vue"], resolve)
- },
- },
- computed: {
- recPers () {
- return localStorage.getItem('userid') ? localStorage.getItem('userid') : ''
- }
- },
- created () {
- },
- methods: {
- onSubmit (problemForm) {
- this.$refs[problemForm].validate((valid) => {
- if (valid) {
- this.problemForm.recPers = this.recPers
- this.problemForm.objId = this.objId
- this.problemForm.regid = this.currentObjectRgstrId
- this.problemForm.objType = this.objType
- this.problemForm.inspPblmType = 2
- this.problemForm.inspPblmName = this.objName
- console.log(this.problemForm)
- if (!this.problemForm.inspPblmDesc) {
- this.$message.info('请填写详细描述')
- return
- }
- request.post('/dc/insp/pblm', this.problemForm).then(res => {
- if (res.success) {
- this.pblmId = res.data.pblmId
- this.gwComFiles = []
- this.pblmStat = res.data.pblmStat
- if (this.$refs.uploadFile.submitUpload(res.data.pblmId)) {
- this.removeNewSupervision()
- }
- this.$message.success('保存成功')
- this.$emit('closeDialog')
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- // 文件上传
- submitUpload () {
- this.$refs.upload.submit()
- },
- updatefilelist (arg) {
- request.post('/dc/insp/pblm/update', {
- pblmId: this.pblmId,
- gwComFiles: arg,
- pblmStat: this.pblmStat
- }).then(res => {
- this.removeNewSupervision()
- this.$message.success('保存成功')
- this.$emit('closeDialog')
- this.gwComFiles = []
- this.$refs.uploadFile.init()
- })
- },
- removeNewSupervision (arg) {
- if (arg) {
- console.log(arg)
- var args = this.gwComFiles.concat(arg)
- this.updatefilelist(args)
- }
- },
- },
- watch: {
- },
- }
- </script>
- <style>
- .media_item {
- float: left;
- width: 60px;
- font-size: 32px;
- }
- </style>
|