Browse Source

自定义时间显示

dev-用户反馈
jiangyy 3 years ago
parent
commit
ba6f61ed53
  1. 261
      src/views/modules/communityService/dqfwzx/index.vue

261
src/views/modules/communityService/dqfwzx/index.vue

@ -2,24 +2,26 @@
<div> <div>
<el-card class="resi-card-table"> <el-card class="resi-card-table">
<div class="resi-row-btn"> <div class="resi-row-btn">
<el-button class="diy-button--add" size="small" @click="handleAdd" <el-button class="diy-button--add"
>新增</el-button size="small"
> @click="handleAdd">新增</el-button>
</div> </div>
<div class="m-center" v-if="tableData.length > 0"> <div class="m-center"
v-if="tableData.length > 0">
<div class="center-left"> <div class="center-left">
<div class="list" :class="{ 'z-iframe': $store.state.inIframe }"> <div class="list"
<div :class="{ 'z-iframe': $store.state.inIframe }">
@click="currentIndex = index" <div @click="currentIndex = index"
class="item" class="item"
:class="{ 'z-on': currentIndex == index }" :class="{ 'z-on': currentIndex == index }"
:key="'ct' + index" :key="'ct' + index"
v-for="(item, index) in tableData" v-for="(item, index) in tableData">
>
<div class="item-btns"> <div class="item-btns">
<a v-if="currentIndex == index" @click="handleEdit">修改</a> <a v-if="currentIndex == index"
<a v-if="currentIndex == index" @click="handleDel">删除</a> @click="handleEdit">修改</a>
<a v-if="currentIndex == index"
@click="handleDel">删除</a>
</div> </div>
<div class="item-name">{{ item.centerName }}</div> <div class="item-name">{{ item.centerName }}</div>
@ -49,108 +51,93 @@
> >
</div> --> </div> -->
<div id="centerIndexApp" class="div_map"></div> <div id="centerIndexApp"
class="div_map"></div>
<el-table
:data="tableData[currentIndex].matterList" <el-table :data="tableData[currentIndex].matterList"
border border
style="width: 100%" style="width: 100%"
class="resi-table" class="resi-table"
:max-height="maxTableHeight" :max-height="maxTableHeight">
> <el-table-column label="序号"
<el-table-column type="index"
label="序号" align="center"
type="index" width="50" />
align="center" <el-table-column prop="matterName"
width="50" label="事项名称">
/>
<el-table-column prop="matterName" label="事项名称">
</el-table-column> </el-table-column>
<el-table-column prop="allowTime" label="可预约时间 "> <el-table-column prop="allowTime"
label="可预约时间 ">
<template slot-scope="scope">
<span v-if="scope.row.appointmentType==='custom'">{{scope.row.showName}}</span>
<span v-else>{{scope.row.allowTime}}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column fixed="right"
fixed="right" label="操作"
label="操作" align="center"
align="center" width="120">
width="120"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button @click="handleOrder(scope.$index)"
@click="handleOrder(scope.$index)" type="text"
type="text" size="small"
size="small" style="color: #1c6afd">预约</el-button>
style="color: #1c6afd"
>预约</el-button <el-button @click="handleOrderList(scope.$index)"
> type="text"
size="small"
<el-button style="margin-right: 10px; color: #1c6afd">预约记录</el-button>
@click="handleOrderList(scope.$index)"
type="text"
size="small"
style="margin-right: 10px; color: #1c6afd"
>预约记录</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
<div class="m-hint" v-else> <div class="m-hint"
<el-empty description="暂无内容" :image-size="200"></el-empty> v-else>
<el-empty description="暂无内容"
:image-size="200"></el-empty>
</div> </div>
</el-card> </el-card>
<!-- 修改弹出框 --> <!-- 修改弹出框 -->
<el-dialog <el-dialog :visible.sync="formShow"
:visible.sync="formShow" :close-on-click-modal="false"
:close-on-click-modal="false" :close-on-press-escape="false"
:close-on-press-escape="false" :title="formTitle"
:title="formTitle" width="850px"
width="850px" top="5vh"
top="5vh" class="dialog-h"
class="dialog-h" @closed="handleClose">
@closed="handleClose" <edit-form ref="eleEditForm"
> @dialogCancle="handleClose"
<edit-form @dialogOk="handleEditSuccess"></edit-form>
ref="eleEditForm"
@dialogCancle="handleClose"
@dialogOk="handleEditSuccess"
></edit-form>
</el-dialog> </el-dialog>
<!-- 修改弹出框 --> <!-- 修改弹出框 -->
<el-dialog <el-dialog :visible.sync="form2Show"
:visible.sync="form2Show" :close-on-click-modal="false"
:close-on-click-modal="false" :close-on-press-escape="false"
:close-on-press-escape="false" title="预约"
title="预约" width="850px"
width="850px" top="5vh"
top="5vh" class="dialog-h"
class="dialog-h" @closed="handleCloseForm2">
@closed="handleCloseForm2" <order-form ref="eleOrderForm"
> @dialogCancle="handleCloseForm2"
<order-form @dialogOk="handleOrderSuccess"></order-form>
ref="eleOrderForm"
@dialogCancle="handleCloseForm2"
@dialogOk="handleOrderSuccess"
></order-form>
</el-dialog> </el-dialog>
<!-- 修改弹出框 --> <!-- 修改弹出框 -->
<el-dialog <el-dialog :visible.sync="orderListShow"
:visible.sync="orderListShow" :close-on-click-modal="false"
:close-on-click-modal="false" :close-on-press-escape="false"
:close-on-press-escape="false" title="预约记录"
title="预约记录" width="850px"
width="850px" top="5vh"
top="5vh" class="dialog-h"
class="dialog-h" @closed="handleCloseOrderList">
@closed="handleCloseOrderList" <order-list ref="eleOrderList"
> @dialogCancle="handleCloseOrderList"></order-list>
<order-list
ref="eleOrderList"
@dialogCancle="handleCloseOrderList"
></order-list>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -168,7 +155,7 @@ var map;
export default { export default {
components: { editForm, orderForm, orderList }, components: { editForm, orderForm, orderList },
data() { data () {
return { return {
openSearch: false, openSearch: false,
@ -185,7 +172,7 @@ export default {
}; };
}, },
computed: { computed: {
maxTableHeight() { maxTableHeight () {
return this.$store.state.inIframe return this.$store.state.inIframe
? this.clientHeight - 520 + 120 ? this.clientHeight - 520 + 120
: this.clientHeight - 520; : this.clientHeight - 520;
@ -193,17 +180,17 @@ export default {
...mapGetters(["clientHeight"]), ...mapGetters(["clientHeight"]),
}, },
watch: { watch: {
currentIndex() { currentIndex () {
this.setMap(); this.setMap();
}, },
}, },
async mounted() { async mounted () {
await this.loadAgency(); await this.loadAgency();
await this.getTableData(); await this.getTableData();
}, },
methods: { methods: {
// init // init
initMap() { initMap () {
let { latitude, longitude } = this.$store.state.user; let { latitude, longitude } = this.$store.state.user;
map = new daiMap( map = new daiMap(
@ -217,7 +204,7 @@ export default {
); );
}, },
setMap() { setMap () {
const { tableData, currentIndex } = this; const { tableData, currentIndex } = this;
let item = tableData[currentIndex]; let item = tableData[currentIndex];
if (item) { if (item) {
@ -226,24 +213,24 @@ export default {
} }
}, },
handleClose() { handleClose () {
this.formShow = false; this.formShow = false;
}, },
handleCloseForm2() { handleCloseForm2 () {
this.form2Show = false; this.form2Show = false;
}, },
handleCloseOrderList() { handleCloseOrderList () {
this.orderListShow = false; this.orderListShow = false;
}, },
async handleAdd() { async handleAdd () {
this.formShow = true; this.formShow = true;
await nextTick(); await nextTick();
console.log(this.$refs); console.log(this.$refs);
this.$refs.eleEditForm.initForm("add"); this.$refs.eleEditForm.initForm("add");
}, },
async handleWatch() { async handleWatch () {
this.formShow = true; this.formShow = true;
await nextTick(); await nextTick();
this.$refs.eleEditForm.initForm( this.$refs.eleEditForm.initForm(
@ -252,7 +239,7 @@ export default {
); );
}, },
async handleEdit() { async handleEdit () {
this.formShow = true; this.formShow = true;
await nextTick(); await nextTick();
this.$refs.eleEditForm.initForm( this.$refs.eleEditForm.initForm(
@ -261,12 +248,12 @@ export default {
); );
}, },
handleEditSuccess() { handleEditSuccess () {
this.handleClose(); this.handleClose();
this.getTableData(); this.getTableData();
}, },
async handleOrder(index) { async handleOrder (index) {
this.form2Show = true; this.form2Show = true;
await nextTick(); await nextTick();
this.$refs.eleOrderForm.initForm( this.$refs.eleOrderForm.initForm(
@ -276,18 +263,18 @@ export default {
); );
}, },
handleOrderSuccess() { handleOrderSuccess () {
this.handleCloseForm2(); this.handleCloseForm2();
}, },
async handleOrderList(index) { async handleOrderList (index) {
this.orderListShow = true; this.orderListShow = true;
await nextTick(0); await nextTick(0);
console.log(this.$refs); console.log(this.$refs);
this.$refs.eleOrderList.init(this.tableData[this.currentIndex], index); this.$refs.eleOrderList.init(this.tableData[this.currentIndex], index);
}, },
async handleDel() { async handleDel () {
if (!confirm("删除后不可恢复,确定删除?")) return; if (!confirm("删除后不可恢复,确定删除?")) return;
const item = this.tableData[this.currentIndex]; const item = this.tableData[this.currentIndex];
@ -303,7 +290,7 @@ export default {
} }
}, },
async getTableData() { async getTableData () {
const oldLen = this.tableData.length; const oldLen = this.tableData.length;
const url = "/gov/org/icpartyservicecenter/partyservicecenterlist"; const url = "/gov/org/icpartyservicecenter/partyservicecenterlist";
const { data, code, msg } = await requestPost(url, { const { data, code, msg } = await requestPost(url, {
@ -312,6 +299,46 @@ export default {
}); });
if (code === 0) { if (code === 0) {
console.log("列表请求成功!!!!!!!!!!!!!!"); console.log("列表请求成功!!!!!!!!!!!!!!");
data.forEach(tableItem => {
if (tableItem.matterList.length > 0) {
tableItem.matterList.forEach(element => {
if (element.appointmentType === 'custom') {
let showName = ''
let customList = element.customDay.split(',')
let customNameList = []
customList.forEach(customItem => {
if (customItem === '1') {
customNameList.push('周日')
}
if (customItem === '2') {
customNameList.push('周一')
}
if (customItem === '3') {
customNameList.push('周二')
}
if (customItem === '4') {
customNameList.push('周三')
}
if (customItem === '5') {
customNameList.push('周四')
}
if (customItem === '6') {
customNameList.push('周五')
}
if (customItem === '7') {
customNameList.push('周六')
}
});
showName = customNameList.join('、')
showName = showName + ' ' + element.startTime + '-' + element.endTime
element.showName = showName
}
});
}
});
this.tableData = data; this.tableData = data;
@ -324,7 +351,7 @@ export default {
}, },
// //
async loadAgency() { async loadAgency () {
const url = "/epmetuser/customerstaff/staffbasicinfo"; const url = "/epmetuser/customerstaff/staffbasicinfo";
let params = {}; let params = {};

Loading…
Cancel
Save