Browse Source

【pc端 添加网格实体化指标详情】-【页面修改】-(魏凯)-2020/12/09

master
weikai 5 years ago
parent
commit
477013312f
  1. 223
      src/views/modules/kpi/kpisubpositiondetail.vue

223
src/views/modules/kpi/kpisubpositiondetail.vue

@ -6,60 +6,60 @@
{{index+1}} {{item.label}}: {{index+1}} {{item.label}}:
</div> </div>
<div v-for="(item1, index1) in item.childDiction"> <div v-for="(item1, index1) in item.childDiction">
<div style="margin: 20px"> <div style="margin: 20px">
{{index1+1}}) {{item1.label}} {{index1+1}}) {{item1.label}}
</div> </div>
<el-form label-width="370px" :model="item1" :rules="dataRule" ref="dataForm" > <el-form label-width="370px" :model="item1" :disabled="pageDisabled" :rules="dataRule" ref="dataForm" >
<el-form-item label="描述:" label-width="90px" style="font-weight:bold;"> <el-form-item label="描述:" label-width="90px" style="font-weight:bold;">
<el-input <el-input
type="textarea" type="textarea"
:rows="6" :rows="6"
placeholder="描述,最多输入500字以内" placeholder="描述,最多输入500字以内"
v-model="item1.describe" v-model="item1.describe"
maxlength="500" maxlength="500"
style="max-width:562px"> style="max-width:562px">
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="添加图片" v-loading="loading" prop="images" label-width="90px"> <el-form-item label="添加图片" v-loading="loading" prop="images" label-width="90px">
<el-upload <el-upload
:action="uploadUrl" :action="uploadUrl"
:class="{hide:hideUpload}" :class="{hide:hideUpload}"
list-type="picture-card" list-type="picture-card"
:file-list="item1.images" :file-list="item1.images"
:limit=6 :limit=6
:on-preview="handlePictureCardPreview" :on-preview="handlePictureCardPreview"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-success="handleAvatarSuccess" :on-success="handleAvatarSuccess"
:on-error="handelError" :on-error="handelError"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
style="width:480px"> style="width:480px">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
<el-dialog :visible.sync="dialogVisible"> <el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt=""> <img width="100%" :src="dialogImageUrl" alt="">
</el-dialog> </el-dialog>
<div><font color="gray">1~6张图</font></div> <div><font color="gray">1~6张图</font></div>
</el-form-item> </el-form-item>
<el-form-item label="添加文件" v-loading="fileloading" prop="files" label-width="90px"> <el-form-item label="添加文件" v-loading="fileloading" prop="files" label-width="90px">
<el-upload <el-upload
ref="upload" ref="upload"
class="upload-demo" class="upload-demo"
:action="uploadFileUrl" :action="uploadFileUrl"
:before-remove="beforeFileRemove" :before-remove="beforeFileRemove"
:file-list="item1.files" :file-list="item1.files"
:before-upload="beforeAvatarFileUpload" :before-upload="beforeAvatarFileUpload"
:on-remove="handleFileRemove" :on-remove="handleFileRemove"
:on-success="handleAvatarFileSuccess" :on-success="handleAvatarFileSuccess"
:on-error="handelError" :on-error="handelError"
:on-preview="handleFileCardPreview" :on-preview="handleFileCardPreview"
style="width:480px"> style="width:480px">
<el-button size="small" >点击上传</el-button> <el-button size="small" >点击上传</el-button>
<div slot="tip" class="el-upload__tip">支持扩展名.rar.zip.doc.docxPDFExcel...文件</div> <div slot="tip" class="el-upload__tip">支持扩展名.rar.zip.doc.docxPDFExcel...文件</div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-form v-if="index == 1" label-width="370px" :model="item" :rules="dataRule" ref="dataForm" > <el-form v-if="item.childDiction.length == 0" label-width="370px" :disabled="pageDisabled" :model="item" :rules="dataRule" ref="dataForm" >
<el-form-item label="描述:" prop="content" label-width="90px" style="font-weight:bold;"> <el-form-item label="描述:" prop="content" label-width="90px" style="font-weight:bold;">
<el-input <el-input
type="textarea" type="textarea"
@ -108,13 +108,15 @@
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-form> <el-form>
<el-form-item label="关联网格:" prop="content" label-width="90px" style="font-weight:bold;"> <el-form-item label="关联网格:" prop="content" label-width="90px" style="font-weight:bold">
<el-select <el-select
v-model="dataForm.grids" v-model="dataForm.grids"
multiple multiple
style="width: 300px"
collapse-tags collapse-tags
placeholder="请选择"> placeholder="请选择">
<el-option <el-option
@ -129,11 +131,15 @@
<el-form> <el-form>
<el-form-item style="margin-left:35px;"> <el-form-item style="margin-left:35px;">
<el-button type="primary" @click="backToUserRelationList">{{"返回"}}</el-button> <el-button type="primary" @click="backToUserRelationList">{{"返回"}}</el-button>
<el-button type="primary" :disabled="isAble" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> <el-button v-if="this.state === '0'" type="primary" :disabled="isAble" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
<el-button v-if="state === '2'" type="primary" @click="">初审</el-button>
<el-button v-if="state === '3'" type="primary" @click="">验收</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<!-- 初审弹框 -->
<trial v-if="trialVisible" ref="subpositioncheckinfoTrial" @refreshDataList="backToUserRelationList"></trial>
</el-card> </el-card>
</template> </template>
@ -141,6 +147,7 @@
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import debounce from "lodash/debounce"; import debounce from "lodash/debounce";
import MapSelect from "@/views/modules/workRecord/map-select"; import MapSelect from "@/views/modules/workRecord/map-select";
import trial from "./subpositioncheckinfo-trial"
export default { export default {
name: "kpisubpositiondetail", name: "kpisubpositiondetail",
@ -155,6 +162,7 @@ export default {
}, },
options :[], options :[],
isAble:false, isAble:false,
pageDisabled:false,
gridIds:[], gridIds:[],
// //
pageloading:true, pageloading:true,
@ -171,6 +179,9 @@ export default {
hideUpload: false, hideUpload: false,
fileloading: false, fileloading: false,
checkDiction:[], checkDiction:[],
state:'0',
//
trialVisible:false,
} }
}, },
@ -187,18 +198,42 @@ export default {
this.uploadUrl = `http://219.146.91.110:10000/epdc-api/oss/file/uploadImg?token=${Cookies.get('token')}` this.uploadUrl = `http://219.146.91.110:10000/epdc-api/oss/file/uploadImg?token=${Cookies.get('token')}`
this.uploadFileUrl = `http://219.146.91.110:10000/epdc-api/oss/file/uploadAllFile?token=${Cookies.get('token')}` this.uploadFileUrl = `http://219.146.91.110:10000/epdc-api/oss/file/uploadAllFile?token=${Cookies.get('token')}`
this.getOptions(); this.getOptions();
this.getCheckInfo(); this.init();
}, },
mounted () { mounted () {
if (this.$route.query.disabled === '0') { if (this.$route.query.status === '1') {
//
this.pageDisabled = true;
} else { } else {
} }
}, },
methods: { methods: {
init () { init () {
this.dataForm.id = this.$route.query.id
this.state = this.$route.query.state === undefined? '0':this.$route.query.state;
if (this.state === '1'){
this.isAble = true;
this.pageDisabled = true;
}
// this.$route.query.id
// '980b98f007278c1452867b7c208f3f75'
this.$nextTick(() => {
if (this.dataForm.id) {
this.$http.get(`/kpi/subdetail/getInfogrid/${this.dataForm.id}`).then(({ data: res }) => {
this.pageloading = false
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm.grids = res.data
}).catch(() => {})
this.getInfoById()
}else {
this.getCheckInfo();
}
})
}, },
beforeAvatarUpload (file) { beforeAvatarUpload (file) {
if (this.dataForm.length === 6) { if (this.dataForm.length === 6) {
@ -302,9 +337,9 @@ export default {
}, },
// //
backToUserRelationList () { backToUserRelationList () {
this.$emit('refreshDataList') this.$emit('subpositioncheckinfo')
this.$parent.selectComponent = 'Weekrecordinfo' this.$parent.selectComponent = 'Subpositioncheckinfo'
this.$router.push({ path: '/workRecord-weekrecordinforoute' }) this.$router.push({ path: '/kpi-subpositioncheckinforoute' })
}, },
getOptions () { getOptions () {
this.$http this.$http
@ -327,51 +362,44 @@ export default {
this.checkDiction = res.data this.checkDiction = res.data
}).catch(() => {}) }).catch(() => {})
// this.checkDiction=[ },
// {
// id:'01f23eecdda4f20ef58fd2cb344ab3bf',
// label:'', getInfoById(){
// childDiction:[ this.$http.get(`/kpi/subdetail/getSubDetailInfoByInfoId/${this.dataForm.id}`).then(({ data: res }) => {
// { this.pageloading = false
// id:'009ff607df016a3fc1e15a08651c8977', if (res.code !== 0) {
// label:'3' return this.$message.error(res.msg)
// }, }
// { this.checkDiction = res.data
// id:'2ff0833824d341e6bd26717c49e0ff33',
// label:'' }).catch(() => {})
// } },
// ] //
// }, trial(){
// { this.trialVisible = true
// id:'ae35fb5792b9ecaa316b1c238fbffd2b',
// label:'',
// childDiction:[
//
// ]
// }
// ]
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(function () {
// //
let subChild =[]; let subChild =[];
for (let i of this.checkDiction){ for (let i of this.checkDiction){
let laber = i.label;
let bigId = i.id; let bigId = i.id;
let childSub = i.childDiction; let childSub = i.childDiction;
if (childSub.length>0) { if (childSub.length>0) {
for (let j of childSub) { for (let j of childSub) {
// //
console.log(j) console.log(j)
let childDesribe = j.describe; let childDesribe = j.describe;
// //
let childUrl = j.images === undefined ? [] :j.images.url; let childUrl = j.images.url === undefined? [] :j.images.url;
// //
let thumbnail = j.images === undefined ? [] :j.images.thumbnail; let thumbnail = j.images.thumbnail === undefined ? [] :j.images.thumbnail;
// //
let childFile =j.files === undefined ? [] : j.files; let childFile =j.files.name === undefined ? [] : j.files;
let littleId = j.id; let littleId = j.id;
let m = { let m = {
id:j.infoId, id:j.infoId,
@ -386,8 +414,8 @@ export default {
} }
}else { }else {
let childDesribe = i.describe; let childDesribe = i.describe;
let childUrl = i.images === undefined ?[]:i.images.url; let childUrl = i.images.url === undefined ?[]:i.images.url;
let thumbnail = i.images === undefined ? [] :j.images.thumbnail; let thumbnail = i.images.thumbnail === undefined ? [] :j.images.thumbnail;
let childFile = i.files === undefined ?[]:i.files; let childFile = i.files === undefined ?[]:i.files;
let ai = { let ai = {
id:i.infoId, id:i.infoId,
@ -403,18 +431,25 @@ export default {
} }
this.dataForm.subDetail =subChild this.dataForm.subDetail =subChild
debugger
let pateDate={ let pateDate={
infoId : this.dataForm.id, infoId : this.dataForm.id,
gridIds:this.dataForm.grids, gridIds:this.dataForm.grids,
infoDetail:subChild infoDetail:subChild
} }
console.log(pateDate) console.log(pateDate);
this.$http[!this.dataForm.id ? 'post' : 'put'](`kpi/subdetail/addDetail`,pateDate).then(({ data: res }) => {
this.pageloading = false
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.backToUserRelationList();
}).catch(() => {})
}, 1000, { 'leading': true, 'trailing': false }) }, 1000, { 'leading': true, 'trailing': false })
}, },
components: { components: {
MapSelect MapSelect,
trial
} }
} }
</script> </script>

Loading…
Cancel
Save