Commit df212675 by 怪兽?别跑

全局检索接口增加字段

1 parent 253875cf
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
align="right" align="right"
:picker-options="pickerOptions"></el-date-picker> :picker-options="pickerOptions"
></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="消息状态"> <el-form-item label="消息状态">
<el-select v-model="query.action" class="noborder"> <el-select v-model="query.action" class="noborder">
...@@ -29,14 +30,15 @@ ...@@ -29,14 +30,15 @@
v-for="item in displayOptions" v-for="item in displayOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"></el-option> :value="item.value"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="getList(1)">查询</el-button> <el-button type="primary" @click="getList(1)">查询</el-button>
<el-button @click="resetFn">重置</el-button> <el-button @click="resetFn">重置</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right;">
<el-button type="primary" @click="exportList()">导出列表</el-button> <el-button type="primary" @click="exportList()">导出列表</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -83,189 +85,191 @@ ...@@ -83,189 +85,191 @@
:total="total" :total="total"
:page.sync="query.pageNum" :page.sync="query.pageNum"
:limit.sync="query.pageSize" :limit.sync="query.pageSize"
@pagination="getList()" /> @pagination="getList()"
/>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getChatList, exportList } from '@/api/conversation/content.js' import { getChatList, exportList } from '@/api/conversation/content.js'
import ChatContent from '@/components/ChatContent' import ChatContent from '@/components/ChatContent'
import { dateFormat } from '@/utils/index' import { dateFormat } from '@/utils/index'
export default { export default {
components: { ChatContent }, components: { ChatContent },
data() { data() {
return { return {
query: { query: {
action: '', action: '',
userName: '', userName: '',
customerName: '', customerName: '',
contact: '', contact: '',
beginTime: '', beginTime: '',
endTime: '', endTime: '',
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orderByColumn: 't.msg_time', orderByColumn: 't.msg_time',
isAsc: 'desc', // asc 升序 desc 降序 isAsc: 'desc' // asc 升序 desc 降序
},
dateRange: [],
total: 0,
fileData: [],
floorRange: '全部',
displayOptions: [
{
value: '',
label: '全部',
},
{
value: 'send',
label: '已发送',
},
{
value: 'recall',
label: '已撤回',
},
{
value: 'switch',
label: '切回企业日志',
}, },
], dateRange: [],
loading: false, total: 0,
} fileData: [],
}, floorRange: '全部',
created() { displayOptions: [
this.getList() {
}, value: '',
methods: { label: '全部'
resetFn() { },
this.dateRange = [] {
this.query = { value: 'send',
action: '', label: '已发送'
userName: '', },
customerName: '', {
contact: '', value: 'recall',
beginTime: '', label: '已撤回'
endTime: '', },
pageNum: 1, {
pageSize: 10, value: 'switch',
orderByColumn: 't.msg_time', label: '切回企业日志'
isAsc: 'desc', }
],
loading: false
} }
this.getList(1)
}, },
getList(page) { created() {
if (this.dateRange) { this.getList()
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
page && (this.query.pageNum = page)
this.loading = true
getChatList(this.query)
.then((res) => {
this.fileData = res.rows
this.total = ~~res.total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
parseMesContent(data, type) {
let contact = JSON.parse(data)
let typeDict = {
text: 'content',
image: 'attachment',
text: 'content',
}
return contact[type]
}, },
exportList() { methods: {
this.$confirm('是否确认导出所有数据项?', '警告', { resetFn() {
confirmButtonText: '确定', this.dateRange = []
cancelButtonText: '取消', this.query = {
type: 'warning', action: '',
}) userName: '',
.then(() => { customerName: '',
return exportList(this.query) contact: '',
beginTime: '',
endTime: '',
pageNum: 1,
pageSize: 10,
orderByColumn: 't.msg_time',
isAsc: 'desc',
fullSearch: 1
}
this.getList(1)
},
getList(page) {
if (this.dateRange) {
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
page && (this.query.pageNum = page)
this.loading = true
getChatList(this.query)
.then((res) => {
this.fileData = res.rows
this.total = ~~res.total
this.loading = false
})
.catch(() => {
this.loading = false
})
},
parseMesContent(data, type) {
let contact = JSON.parse(data)
let typeDict = {
text: 'content',
image: 'attachment',
text: 'content'
}
return contact[type]
},
exportList() {
this.$confirm('是否确认导出所有数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}) })
.then((res) => { .then(() => {
if (!res) return return exportList(this.query)
const blob = new Blob([res], { type: 'application/vnd.ms-excel' }) })
.then((res) => {
if (!res) return
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
//兼容IE10 //兼容IE10
navigator.msSaveBlob(blob, '内容存档') navigator.msSaveBlob(blob, '内容存档')
} else { } else {
const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象 const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象
const a = document.createElement('a') //创建a标签 const a = document.createElement('a') //创建a标签
a.style.display = 'none' a.style.display = 'none'
a.href = href // 指定下载链接 a.href = href // 指定下载链接
a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '_内容存档.xlsx' //指定下载文件名 a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '_内容存档.xlsx' //指定下载文件名
a.click() //触发下载 a.click() //触发下载
URL.revokeObjectURL(a.href) //释放URL对象 URL.revokeObjectURL(a.href) //释放URL对象
} }
}) })
.catch(function () {}) .catch(function () {})
}, }
}, }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.demo-form-inline { .demo-form-inline {
background: #f1f1f1; background: #f1f1f1;
padding: 18px 10px 0 10px; padding: 18px 10px 0 10px;
} }
.content {
margin-top: 15px;
padding: 10px;
}
.content { .pers {
margin-top: 15px; position: relative;
padding: 10px;
}
.pers { .green {
position: relative; background: greenyellow;
position: absolute;
width: 6px;
height: 6px;
border-radius: 50%;
top: 10px;
left: -8px;
}
.green { .red {
background: greenyellow; background: red;
position: absolute; position: absolute;
width: 6px; width: 6px;
height: 6px; height: 6px;
border-radius: 50%; border-radius: 50%;
top: 10px; top: 10px;
left: -8px; left: -8px;
} }
.red { .gay {
background: red; background: gray;
position: absolute; position: absolute;
width: 6px; width: 6px;
height: 6px; height: 6px;
border-radius: 50%; border-radius: 50%;
top: 10px; top: 10px;
left: -8px; left: -8px;
}
} }
.gay { .noborder {
background: gray; ::v-deep .el-input--mini .el-input__inner {
position: absolute; width: 2px;
width: 6px; border: none;
height: 6px; }
border-radius: 50%;
top: 10px;
left: -8px;
} }
}
.noborder { .emcode ::v-deep em {
::v-deep .el-input--mini .el-input__inner { color: #ff0000;
width: 2px;
border: none;
} }
}
.emcode ::v-deep em {
color: #ff0000;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!