优化邮箱详情表格

This commit is contained in:
龙运模 2024-08-14 22:45:00 +08:00
parent 412cba8aae
commit 923a5f718d
2 changed files with 23 additions and 13 deletions

View File

@ -28,8 +28,9 @@ export default {
* 自定义列保存处理
* @tableName scTable组件的props->tableName
* @column 用户配置好的列
* otherParams 冗余的参数
*/
columnSettingSave: function (tableName, column ,params) {
columnSettingSave: function (tableName, column ,params, otherParams) {
column.forEach((item,index)=>{
item.sort = index+1;
})
@ -38,12 +39,12 @@ export default {
resolve(false)
return
}
let data = {
let data = Object.assign({},{
column_config:column,
save_column:true,
page:1,
pageSize:this.pageSize
}
},otherParams);
http.post(params.url, data).then(res=>{
if(res.code == 200 && res.data.column){
resolve(true)
@ -58,17 +59,17 @@ export default {
* @tableName scTable组件的props->tableName
* @column 组件接受到的props->column
*/
columnSettingConfigSave: function (tableName, config, params) {
columnSettingConfigSave: function (tableName, config, params, otherParams) {
return new Promise((resolve) => {
if(!params.url || params.url==''){
resolve(false)
return
}
let data = {
let data = Object.assign({},{
table_config:config,
page:1,
pageSize:this.pageSize
}
},otherParams);
http.post(params.url, data).then(res=>{
if(res.code == 200 && res.data.column){
resolve(true)

View File

@ -66,7 +66,7 @@
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
</div>
</div>
<el-table class="scTable" :header-cell-class-name="setClassName" :data="emailData.rows" ref="table" :row-key="rowKey" :key="toggleIndex" :header-cell-style="{'background': '#F5F7FA','color':'#606266'}" @selection-change="selectionChange" stripe :size="size">
<el-table class="scTable" :header-cell-class-name="setClassName" :data="emailData.rows" ref="table" :row-key="rowKey" :key="toggleIndex" :header-cell-style="{'background': '#F5F7FA','color':'#606266'}" @selection-change="selectionChange" :size="config.size" :border="config.config.border" :stripe="config.config.stripe">
<el-table-column type="selection" align="center" width="45" :selectable="selectable"></el-table-column>
<el-table-column label="序号" align="center" type="index" :index="customIndexMethod"></el-table-column>
<template v-for="(item, index) in userColumn" :key="index">
@ -96,7 +96,7 @@
<span v-if="item.prop == 'is_confirm'" :class="{'success':scope.row[item.prop],'danger':!scope.row[item.prop]}">
{{scope.row[item.prop]?'已确认':'未确认'}}
</span>
<span v-else>scope.row[item.prop]</span>
<span v-else>{{ scope.row[item.prop] }}</span>
</slot>
</template>
</el-table-column>
@ -312,7 +312,7 @@ export default {
const emailHeight = this.$refs.emailMain;
const remainingDistance = scrollbar.$el.scrollHeight + event.scrollTop + 100;
if (remainingDistance > emailHeight.clientHeight) {
this.loadMore();
this.loadMore();
}
})
},
@ -327,7 +327,9 @@ export default {
emailChange(item,isChange) {
this.emailId = isChange?item.id:this.emailId>0?this.emailId:item.id;
this.searchData = {};
this.$refs.scSearch.reload();
if(this.$refs.scSearch){
this.$refs.scSearch.reload();
}
this.getEmailData();
},
async getEmailData() {
@ -345,6 +347,10 @@ export default {
this.userColumn = res.data.columnConfig;
res.data.mail_info[0].text = this.stripHtmlTags(res.data.mail_info[0].summary)
this.emailParams = res.data.mail_info[0];
if(res.data.tableConfig && res.data.tableConfig.size){
this.config = res.data.tableConfig;
}
}
this.loading = false;
},
@ -490,7 +496,8 @@ export default {
async columnSettingSave(userColumn){
this.$refs.columnSetting.isSave = true
try {
await config.columnSettingSave(this.tableName, userColumn,this.apiObj);
let apiObj = this.$API.orders.order.mail.detail;
await config.columnSettingSave('', userColumn, apiObj, {mail_data_id:this.emailId});
this.$message.success('保存成功')
}catch(error){
this.$message.error('保存失败')
@ -502,7 +509,8 @@ export default {
async columnSettingBack(userColumn){
this.$refs.columnSetting.isSave = true
try {
const column = await config.columnSettingReset(this.tableName, userColumn,this.apiObj)
let apiObj = this.$API.orders.order.mail.detail;
const column = await config.columnSettingReset('', userColumn, apiObj, {mail_data_id:this.emailId})
if(column){
this.userColumn = column
this.$refs.columnSetting.usercolumn = JSON.parse(JSON.stringify(this.userColumn||[]))
@ -515,7 +523,8 @@ export default {
},
async configSizeChange() {
try {
await config.columnSettingConfigSave(this.tableName, this.config, this.apiObj);
let apiObj = this.$API.orders.order.mail.detail;
await config.columnSettingConfigSave('', this.config, apiObj, {mail_data_id:this.emailId});
this.$message.success('保存成功')
} catch (error) {
this.$message.error('保存失败')