1.回顯頁面的時(shí)候,數(shù)據(jù)渲染不出來,頁面代碼如下
<style>
</style>
<template>
<transition name="right-div">
<div class="right-div" v-if="divShow" :style="{height:divH+'px',width:'60%'}">
<p class="title">{{id?'編輯':'新增'}}調(diào)查問卷
<Button type="text" class="pull-right" @click="$parent.closeDiv()" icon="close"></Button>
</p>
<p class="content">
<Form ref="form" :model="form" :rules="rules" :label-width="80">
<Row>
<Col :span="12">
<FormItem label="問卷名稱" prop="name">
<Input type="text" v-model="form.name"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="狀態(tài)">
<RadioGroup v-model="form.status">
<Radio label="1" true-value="1">激活</Radio>
<Radio label="0" true-value="0">禁用</Radio>
</RadioGroup>
</FormItem>
</Col>
</Row>
<Row>
<FormItem label="問卷描述" >
<Input type="textarea" :rows="2" v-model="form.remark"></Input>
</FormItem>
</Row>
<h2>配置問卷
<Button type="primary" size="small" icon="plus" class="pull-right"
@click="form.flupVoteTempTitleList.push({title:'',flupVoteTempQuestionList:[],show:true})">添加標(biāo)題
</Button>
</h2>
<Card v-for="(voteTitle,index) in form.flupVoteTempTitleList">
<Row>
<Col :span="3">
<span>問卷標(biāo)題{{index + 1}}:</span>
</Col>
<Col :span="10">
<Input type="text" v-model="voteTitle.title" size="small" :aria-required="true" error="請輸入"></Input>
<div v-model="voteTitle.sortNum" size="small" :value="{index}">
</div>
</Col>
<Col :span="3">
<Button type="text" @click="voteTitle.flupVoteTempQuestionList.push({subject:'',flupVoteTempItemList:[],show:true})" class="red">
<Icon type="plus"></Icon>
添加題目
</Button>
</Col>
<Col :span="2">
<Button type="text" @click="form.flupVoteTempTitleList.splice(index,1)" class="red">
<Icon type="ios-trash-outline"></Icon>
刪除
</Button>
</Col>
<Col :span="3">
<Button type="text" @click="voteTitle.show=(voteTitle.show==true)?false:true" class="red">
<span v-if="voteTitle.show==true">
<Icon type="chevron-up"></Icon>
收起
</span>
<span v-if="voteTitle.show==false">
<Icon type="chevron-down"></Icon>
顯示
</span>
</Button>
</Col>
</Row>
<Card v-for="(voteQuestion,index) in voteTitle.flupVoteTempQuestionList" v-show="voteTitle.show">
<Row>
<Col :span="3">
<span v-model="voteQuestion.sortNum">問卷題目{{index + 1}}:</span>
</Col>
<Col :span="12">
<Input type="text" v-model="voteQuestion.subject" size="small"></Input>
<!--<div v-model="voteQuestion.val" size="small" :value="{index}"></div>-->
</Col>
<!--<Col span="2" style="text-align: center">-</Col>-->
<!--<Col :span="3">-->
<!--<Input type="text" v-model="voteQuestion.subject" size="small"></Input>-->
<!--</Col>-->
<Col :span="3">
<Button type="text" @click="voteTitle.flupVoteTempQuestionList.splice(index,1)" class="red">
<Icon type="ios-trash-outline"></Icon>
刪除
</Button>
</Col>
</Row>
</Card>
</Card>
</Form>
</p>
<p class="bottom">
<Button type="primary" icon="archive" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button type="ghost" style="margin-left: 8px" @click="handleReset">重置</Button>
<Button type="ghost" icon="close" @click="$parent.closeDiv()">關(guān)閉</Button>
</p>
</div>
</transition>
</template>
<script>
import http from '../../../api/http'
import Input from "iview/src/components/input/input";
var model = {
name:'',
status:'1',
remark:'',
flupVoteTempTitleList:[]};
export default {
components: {Input},
data() {
return {
disabled: false,
rules: {
name: [
{required: true, message: '請?zhí)顚憜柧砟0迕Q'},
],
},
form: Object.assign({}, model),
divH:window.innerHeight-60
}
},
props: {
id: {type: String},
divShow: {type: Boolean, default: false}
},
methods: {
handleSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
var vm = this;
vm.disabled = true;
http.postData(vm, "/flup/votetemp/save", {json: JSON.stringify(vm.form)}, function (resp) {
var ret = resp.body;
if (ret.code === '111') {
vm.$parent.onSubmit();
vm.$parent.closeDiv();
vm.form = Object.assign({}, model);
vm.$Message.info(ret.msg?ret.msg:'保存成功!')
}else{
vm.$Message.error(ret.msg?ret.msg:'保存失敗!')
}
vm.disabled = false;
},function(e){
vm.disabled=false;
}
);
}
})
},
handleReset() {
this.$refs['form'].resetFields();
},
loadDetail() {
if (this.id != undefined && this.id != '') {
var vm = this;
http.postData(vm, "/flup/votetemp/detail/" + this.id, {}, function (resp) {
var ret = resp.body;
if (ret.code === '111') {
vm.form = ret.value;
var titleList = ret.value.flupVoteTempTitleList;
debugger;
for(var i=0;i < titleList.length;i++){
var questions = titleList[i].flupVoteTempQuestionList;
// ret.value.flupVoteTempTitleList[i].push({subject:'112',flupVoteTempItemList:[],show:true});
for (var j=0;j < questions.length;j++){
console.log(ret.value.flupVoteTempTitleList[i].flupVoteTempQuestionList[j]);
}
}
}
}
);
}
}
},
watch: {//檢測數(shù)據(jù)
id(val) {
if (val&&this.divShow) {
this.loadDetail();
} else {
this.form = Object.assign({}, model);
}
},
},
created() {
}
}
</script>
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。