|
|
@@ -47,11 +47,11 @@
|
|
|
|
|
|
<!-- 操作按钮区域 -->
|
|
|
<div class="table-operator">
|
|
|
- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
|
|
+ <a-button @click="handleAdd" :disabled="!isAddOk" type="primary" icon="plus">新增</a-button>
|
|
|
</div>
|
|
|
|
|
|
<!-- table区域-begin -->
|
|
|
- <div>
|
|
|
+ <div class="table-remake">
|
|
|
<a-table
|
|
|
ref="table"
|
|
|
size="middle"
|
|
|
@@ -69,7 +69,7 @@
|
|
|
class="j-table-force-nowrap"
|
|
|
@change="handleTableChange"
|
|
|
>
|
|
|
- <template slot="htmlSlot" slot-scope="text">
|
|
|
+ <!-- <template slot="htmlSlot" slot-scope="text">
|
|
|
<div v-html="text"></div>
|
|
|
</template>
|
|
|
<template slot="imgSlot" slot-scope="text, record">
|
|
|
@@ -99,19 +99,92 @@
|
|
|
>
|
|
|
下载
|
|
|
</a-button>
|
|
|
+ </template> -->
|
|
|
+
|
|
|
+
|
|
|
+ <template v-for="col in columns.map(item=> item.dataIndex )" :slot="col" slot-scope="text, record, index">
|
|
|
+ <div :key="col">
|
|
|
+ <a-input
|
|
|
+ v-if="record.editable && (col == 'userName' || col == 'contentBody') "
|
|
|
+ style="margin: -5px 0;width:100px;"
|
|
|
+ :value="text"
|
|
|
+ @change="e => handleChange(e.target.value, record.id, col)"
|
|
|
+ />
|
|
|
+ <template v-if="!record.editable && col != 'relay' ">
|
|
|
+ {{ text }}
|
|
|
+ </template>
|
|
|
+ <template v-if="record.editable && col == 'createDate' ">
|
|
|
+ {{ text }}
|
|
|
+ </template>
|
|
|
+ <template v-if="!record.editable && col == 'relay' ">
|
|
|
+ {{ text==1? '是':'否' }}
|
|
|
+ </template>
|
|
|
+ <a-select v-if=" record.editable && col == 'roomNo' " v-model="record.livingOrderId" placeholder="请选择房号">
|
|
|
+ <a-select-option
|
|
|
+ :value="item.livingOrderId"
|
|
|
+ v-for="(item, index) in roomsList"
|
|
|
+ :key="item.id"
|
|
|
+ >
|
|
|
+ {{ item.roomName }}/{{ item.customerName }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ <j-date
|
|
|
+ v-if=" record.editable && col == 'remindDate' "
|
|
|
+ placeholder="请选择自动提醒时间"
|
|
|
+ v-model="record.remindDate"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ <j-date
|
|
|
+ v-if=" record.editable && col == 'validDate' "
|
|
|
+ placeholder="请选择有效时间"
|
|
|
+ v-model="record.validDate"
|
|
|
+ style="width: 100%"
|
|
|
+ />
|
|
|
+ <a-select v-if=" record.editable && col == 'relay' " placeholder="请选择" v-model="record.relay">
|
|
|
+ <a-select-option :value="1"> 是 </a-select-option>
|
|
|
+ <a-select-option :value="2"> 否 </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
- <span slot="action" slot-scope="text, record">
|
|
|
- <a @click="handleEdit(record)">编辑</a>
|
|
|
|
|
|
- <a-divider type="vertical" />
|
|
|
- <a-popconfirm
|
|
|
- title="确定删除吗?"
|
|
|
- @confirm="() => handleDelete(record.id)"
|
|
|
- >
|
|
|
- <a>删除</a>
|
|
|
- </a-popconfirm>
|
|
|
- </span>
|
|
|
+
|
|
|
+ <template slot="action" slot-scope="text, record, index">
|
|
|
+ <!-- <div>
|
|
|
+ <a @click="handleEdit(record)">编辑</a>
|
|
|
+ <a-divider type="vertical" />
|
|
|
+ <a-popconfirm
|
|
|
+ title="确定删除吗?"
|
|
|
+ @confirm="() => handleDelete(record.id)"
|
|
|
+ >
|
|
|
+ <a>删除</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </div> -->
|
|
|
+ <span v-if="record.editable">
|
|
|
+ <a @click="() => save(record.id, record)">保存</a>
|
|
|
+ <a-divider :disabled="editingKey !== ''" type="vertical" />
|
|
|
+ <!-- <a-popconfirm title="Sure to cancel?" @confirm="() => cancel(record.id)"> -->
|
|
|
+ <a @click="() => cancel(record.id)">取消</a>
|
|
|
+ <!-- </a-popconfirm> -->
|
|
|
+ </span>
|
|
|
+ <span v-else>
|
|
|
+ <!-- <a :disabled="editingKey !== ''" @click="() => edit(record.id)">Edit</a> -->
|
|
|
+ <a :disabled="editingKey !== ''" @click="edit(record.id)">编辑</a>
|
|
|
+ <a-divider :disabled="editingKey !== ''" type="vertical" />
|
|
|
+ <a-popconfirm :disabled="editingKey !== ''"
|
|
|
+ title="确定删除吗?"
|
|
|
+ @confirm="() => handleDelete(record.id)"
|
|
|
+ >
|
|
|
+ <a :disabled="editingKey !== ''">删除</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- <span slot="action" slot-scope="text, record">
|
|
|
+
|
|
|
+ </span> -->
|
|
|
+
|
|
|
</a-table>
|
|
|
</div>
|
|
|
|
|
|
@@ -127,6 +200,7 @@ import "@/assets/less/TableExpand.less";
|
|
|
import { mixinDevice } from "@/utils/mixin";
|
|
|
import { JeecgListMixin } from "@/mixins/JeecgListMixin";
|
|
|
import BusMemberMessageModal from "./modules/membermessage/BusMemberMessageModal";
|
|
|
+import { deleteAction, getAction,downFile,getFileAccessHttpUrl, httpAction } from '@/api/manage'
|
|
|
|
|
|
export default {
|
|
|
name: "BusMemberMessageList",
|
|
|
@@ -142,6 +216,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ editingKey: "",
|
|
|
description: "bus_member_message管理页面",
|
|
|
// 表头
|
|
|
columns: [
|
|
|
@@ -149,48 +224,55 @@ export default {
|
|
|
title: "房号",
|
|
|
align: "center",
|
|
|
dataIndex: "roomNo",
|
|
|
+ scopedSlots: { customRender: "roomNo" },
|
|
|
},
|
|
|
{
|
|
|
title: "留言人",
|
|
|
align: "center",
|
|
|
dataIndex: "userName",
|
|
|
+ scopedSlots: { customRender: "userName" },
|
|
|
},
|
|
|
{
|
|
|
title: "自动提醒时间",
|
|
|
align: "center",
|
|
|
dataIndex: "remindDate",
|
|
|
- customRender: function (text) {
|
|
|
- return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
|
|
|
- },
|
|
|
+ // customRender: function (text) {
|
|
|
+ // return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
|
|
|
+ // },
|
|
|
+ scopedSlots: { customRender: "remindDate" },
|
|
|
},
|
|
|
{
|
|
|
title: "有效时间",
|
|
|
align: "center",
|
|
|
dataIndex: "validDate",
|
|
|
- customRender: function (text) {
|
|
|
- return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
|
|
|
- },
|
|
|
+ scopedSlots: { customRender: "validDate" },
|
|
|
+ // customRender: function (text) {
|
|
|
+ // return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
|
|
|
+ // },
|
|
|
},
|
|
|
{
|
|
|
title: "是否传达",
|
|
|
align: "center",
|
|
|
dataIndex: "relay",
|
|
|
- customRender: function (text) {
|
|
|
- return !text ? "否" : "是";
|
|
|
- },
|
|
|
+ scopedSlots: { customRender: "relay" },
|
|
|
+ // customRender: function (text) {
|
|
|
+ // return !text ? "否" : "是";
|
|
|
+ // },
|
|
|
},
|
|
|
{
|
|
|
title: "留言内容",
|
|
|
align: "center",
|
|
|
+ scopedSlots: { customRender: "contentBody" },
|
|
|
dataIndex: "contentBody",
|
|
|
},
|
|
|
{
|
|
|
title: "创建时间",
|
|
|
align: "center",
|
|
|
dataIndex: "createDate",
|
|
|
- customRender: function (text) {
|
|
|
- return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
|
|
|
- },
|
|
|
+ scopedSlots: { customRender: "createDate" },
|
|
|
+ // customRender: function (text) {
|
|
|
+ // return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
|
|
|
+ // },
|
|
|
},
|
|
|
{
|
|
|
title: "操作",
|
|
|
@@ -212,10 +294,21 @@ export default {
|
|
|
dictOptions: {},
|
|
|
superFieldList: [],
|
|
|
datetime: [],
|
|
|
+ dataSourceCopy:[],
|
|
|
+ roomsList: [],
|
|
|
+ isAddOk: true,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getSuperFieldList();
|
|
|
+ getAction("/business/busRoomBookingOrders/living-orders?status=-1", {
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 99999,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.roomsList = res.result.records;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
computed: {
|
|
|
importExcelUrl: function () {
|
|
|
@@ -223,10 +316,113 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ handleChange(value, key, column) {
|
|
|
+ const newData = [...this.dataSource];
|
|
|
+ const target = newData.find(item => key === item.id);
|
|
|
+ if (target) {
|
|
|
+ target[column] = value;
|
|
|
+ this.dataSource = newData;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ edit(key) {
|
|
|
+ const newData = [...this.dataSource];
|
|
|
+ const target = newData.find(item => key === item.id);
|
|
|
+ this.editingKey = key;
|
|
|
+ if (target) {
|
|
|
+ target.editable = true;
|
|
|
+ this.dataSource = newData;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ save(key) {
|
|
|
+ const that = this;
|
|
|
+ const newData = [...this.dataSource];
|
|
|
+ const newCacheData = [...this.dataSourceCopy];
|
|
|
+ const target = newData.find(item => key === item.id);
|
|
|
+ const targetCache = newCacheData.find(item => key === item.id);
|
|
|
+ if (!target.remindDate) {
|
|
|
+ that.$message.warning("自动提醒时间不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!target.validDate) {
|
|
|
+ that.$message.warning("有效时间不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (target && targetCache) {
|
|
|
+ delete target.editable;
|
|
|
+ this.dataSource = newData;
|
|
|
+ Object.assign(targetCache, target);
|
|
|
+ this.dataSourceCopy = newCacheData;
|
|
|
+ }
|
|
|
+ that.loading = true;
|
|
|
+ let httpurl = "";
|
|
|
+ let method = "";
|
|
|
+ if (!target.id || target.id == 9999) {
|
|
|
+ httpurl += '/business/busMemberMessage/add';
|
|
|
+ method = "post";
|
|
|
+ } else {
|
|
|
+ httpurl += '/business/busMemberMessage/edit';
|
|
|
+ method = "put";
|
|
|
+ }
|
|
|
+ if (target.id==9999) {
|
|
|
+ delete target.id
|
|
|
+ }
|
|
|
+ httpAction(httpurl, target, method)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ that.$message.success(res.message);
|
|
|
+ // that.$emit("ok");
|
|
|
+ // 新增/修改 成功时,重载列表
|
|
|
+ this.loadData();
|
|
|
+ //清空列表选中
|
|
|
+ this.onClearSelected()
|
|
|
+ } else {
|
|
|
+ that.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ that.loading = false;
|
|
|
+ this.isAddOk = true
|
|
|
+ });
|
|
|
+ console.log("target", target);
|
|
|
+ this.editingKey = '';
|
|
|
+ },
|
|
|
+ cancel(key) {
|
|
|
+ const newData = [...this.dataSource];
|
|
|
+ const target = newData.find(item => key === item.id);
|
|
|
+ this.editingKey = '';
|
|
|
+ if (target) {
|
|
|
+ Object.assign(target, this.dataSourceCopy.find(item => key === item.id));
|
|
|
+ delete target.editable;
|
|
|
+ this.dataSource = newData;
|
|
|
+ }
|
|
|
+ if (target.id == 9999) {
|
|
|
+ this.dataSource.pop()
|
|
|
+ this.isAddOk = true;
|
|
|
+ }
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
handleAdd() {
|
|
|
- this.$refs.modalForm.add(this.livingOrderId);
|
|
|
- this.$refs.modalForm.title = "新增";
|
|
|
- this.$refs.modalForm.disableSubmit = false;
|
|
|
+ // this.$refs.modalForm.add(this.livingOrderId);
|
|
|
+ // this.$refs.modalForm.title = "新增";
|
|
|
+ // this.$refs.modalForm.disableSubmit = false;
|
|
|
+ let find = this.roomsList.find(
|
|
|
+ (t) => t.livingOrderId === this.livingOrderId
|
|
|
+ );
|
|
|
+ let roomId = find.roomId
|
|
|
+ this.dataSource.push({
|
|
|
+ id:9999,
|
|
|
+ livingOrderId: this.livingOrderId,
|
|
|
+ relay: 1,
|
|
|
+ editable: true,
|
|
|
+ hotelId:JSON.parse(localStorage.getItem("storeInfo")).id,
|
|
|
+ roomId:roomId,
|
|
|
+ })
|
|
|
+ this.isAddOk = false;
|
|
|
+ this.editingKey = 9999;
|
|
|
},
|
|
|
onChange(e, dateString) {
|
|
|
this.queryParam.startTime = dateString[0];
|
|
|
@@ -259,9 +455,51 @@ export default {
|
|
|
fieldList.push({ type: "date", value: "createDate", text: "创建时间" });
|
|
|
this.superFieldList = fieldList;
|
|
|
},
|
|
|
+ loadData(arg) {
|
|
|
+ if (this.url.list==2) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!this.url.list){
|
|
|
+ this.$message.error("请设置url.list属性!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //加载数据 若传入参数1则加载第一页的内容
|
|
|
+ if (arg === 1) {
|
|
|
+ this.ipagination.current = 1;
|
|
|
+ }
|
|
|
+ var params = this.getQueryParams();//查询条件
|
|
|
+ this.loading = true;
|
|
|
+ getAction(this.url.list, params).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
+ this.dataSource = res.result.records||res.result;
|
|
|
+ this.dataSourceCopy = res.result.records||res.result
|
|
|
+ if(res.result.total)
|
|
|
+ {
|
|
|
+ this.ipagination.total = res.result.total;
|
|
|
+ }else{
|
|
|
+ this.ipagination.total = 0;
|
|
|
+ }
|
|
|
+ //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
+ }else{
|
|
|
+ this.$message.warning(res.message)
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
@import "~@assets/less/common.less";
|
|
|
+.table-remake /deep/.ant-table-body {
|
|
|
+ min-height: 352px !important;
|
|
|
+ }
|
|
|
+.table-remake /deep/ .ant-empty-normal {
|
|
|
+ margin: 140px 0 !important;
|
|
|
+}
|
|
|
+.table-remake /deep/.ant-table-placeholder{
|
|
|
+ margin-top: -320px;
|
|
|
+}
|
|
|
</style>
|