This commit is contained in:
shijingjing
2022-04-20 14:39:10 +08:00
parent f151ebbac7
commit 025455eebd
2 changed files with 46 additions and 9 deletions

View File

@@ -34,7 +34,7 @@
<script> <script>
export default { export default {
name: "addLinkage", name: "addLinkage",
appName: "添加联动记录", appName: "添加联动记录", // :"修改联动记录"
data() { data() {
return { return {
params: { params: {
@@ -48,17 +48,37 @@ export default {
linksageDate: '', linksageDate: '',
description: '', description: '',
}, },
userList: [] userList: [],
id: '',
} }
}, },
onShow() { onShow() {
this.$dict.load('agriculturalType') this.$dict.load('agriculturalType')
this.getUserList() this.getUserList()
}, },
onLoad(o) {
if (o?.id) {
this.id = o.id
this.getDetail()
this.form = JSON.parse(JSON.stringify(this.data))
}
},
methods: { methods: {
onDateChange(e) { onDateChange(e) {
this.form.linksageDate = `${e.year}-${e.month}-${e.day}` this.form.linksageDate = `${e.year}-${e.month}-${e.day}`
}, },
getDetail() {
this.$instance.post('/app/apppartyfourlinkage/queryDetailById',null,{
params: {
id: this.id,
}
}).then(res => {
if(res.code == 0) {
// this.data = res.data
this.form = JSON.parse(JSON.stringify(res.data))
}
})
},
getUserList() { getUserList() {
this.$instance.post('/app/apppartyfourresident/listFourResidentByApplet').then((res) => { this.$instance.post('/app/apppartyfourresident/listFourResidentByApplet').then((res) => {
if(res?.data) { if(res?.data) {
@@ -71,6 +91,7 @@ export default {
} }
}) })
}, },
confirm() { confirm() {
if(!this.form.residentId) { if(!this.form.residentId) {
return this.$u.toast('请选择四邻对象') return this.$u.toast('请选择四邻对象')
@@ -83,14 +104,23 @@ export default {
} }
this.$instance.post('/app/apppartyfourlinkage/addByWxApplet',{ this.$instance.post('/app/apppartyfourlinkage/addByWxApplet',{
...this.form ...this.form,
id: this.id || '',
}).then(res => { }).then(res => {
if(res.code == 0) { if(res.code == 0) {
this.$u.toast('添加联动记录成功') this.$u.toast('提交成功')
uni.$emit('update') uni.$emit('update')
setTimeout(() => { if (!this.id) {
uni.navigateBack() setTimeout(() => {
},600) uni.navigateBack()
},600)
} else {
setTimeout(() => {
uni.navigateBack({
delta: 2
})
},600)
}
} }
}) })
} }

View File

@@ -23,7 +23,8 @@
</div> </div>
</div> </div>
<div class="btn"> <div class="btn">
<div class="delBtn" @click="delBtn">删除联动记录</div> <div class="delBtn" @click="delBtn" v-if="data.status==1">删除联动记录</div>
<div class="editBtn" @click="$linkTo(`./addLinkage?id=${id}`)" v-else>修改联动记录</div>
</div> </div>
</div> </div>
</template> </template>
@@ -116,7 +117,8 @@ export default {
padding: 16px 32px; padding: 16px 32px;
box-sizing: border-box; box-sizing: border-box;
background: #F3F6F9; background: #F3F6F9;
.delBtn { .delBtn,
.editBtn {
height: 88px; height: 88px;
line-height: 88px; line-height: 88px;
text-align: center; text-align: center;
@@ -124,6 +126,11 @@ export default {
border: 1px solid #FF4466; border: 1px solid #FF4466;
border-radius: 16px; border-radius: 16px;
} }
.editBtn {
background: #4181FF !important;
color: #FFF;
border: none;
}
} }
} }
</style> </style>