优化邮箱详情表格

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

View File

@ -66,7 +66,7 @@
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button> <el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
</div> </div>
</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 type="selection" align="center" width="45" :selectable="selectable"></el-table-column>
<el-table-column label="序号" align="center" type="index" :index="customIndexMethod"></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"> <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]}"> <span v-if="item.prop == 'is_confirm'" :class="{'success':scope.row[item.prop],'danger':!scope.row[item.prop]}">
{{scope.row[item.prop]?'已确认':'未确认'}} {{scope.row[item.prop]?'已确认':'未确认'}}
</span> </span>
<span v-else>scope.row[item.prop]</span> <span v-else>{{ scope.row[item.prop] }}</span>
</slot> </slot>
</template> </template>
</el-table-column> </el-table-column>
@ -327,7 +327,9 @@ export default {
emailChange(item,isChange) { emailChange(item,isChange) {
this.emailId = isChange?item.id:this.emailId>0?this.emailId:item.id; this.emailId = isChange?item.id:this.emailId>0?this.emailId:item.id;
this.searchData = {}; this.searchData = {};
if(this.$refs.scSearch){
this.$refs.scSearch.reload(); this.$refs.scSearch.reload();
}
this.getEmailData(); this.getEmailData();
}, },
async getEmailData() { async getEmailData() {
@ -345,6 +347,10 @@ export default {
this.userColumn = res.data.columnConfig; this.userColumn = res.data.columnConfig;
res.data.mail_info[0].text = this.stripHtmlTags(res.data.mail_info[0].summary) res.data.mail_info[0].text = this.stripHtmlTags(res.data.mail_info[0].summary)
this.emailParams = res.data.mail_info[0]; this.emailParams = res.data.mail_info[0];
if(res.data.tableConfig && res.data.tableConfig.size){
this.config = res.data.tableConfig;
}
} }
this.loading = false; this.loading = false;
}, },
@ -490,7 +496,8 @@ export default {
async columnSettingSave(userColumn){ async columnSettingSave(userColumn){
this.$refs.columnSetting.isSave = true this.$refs.columnSetting.isSave = true
try { 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('保存成功') this.$message.success('保存成功')
}catch(error){ }catch(error){
this.$message.error('保存失败') this.$message.error('保存失败')
@ -502,7 +509,8 @@ export default {
async columnSettingBack(userColumn){ async columnSettingBack(userColumn){
this.$refs.columnSetting.isSave = true this.$refs.columnSetting.isSave = true
try { 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){ if(column){
this.userColumn = column this.userColumn = column
this.$refs.columnSetting.usercolumn = JSON.parse(JSON.stringify(this.userColumn||[])) this.$refs.columnSetting.usercolumn = JSON.parse(JSON.stringify(this.userColumn||[]))
@ -515,7 +523,8 @@ export default {
}, },
async configSizeChange() { async configSizeChange() {
try { 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('保存成功') this.$message.success('保存成功')
} catch (error) { } catch (error) {
this.$message.error('保存失败') this.$message.error('保存失败')