/* * @Author: lixiong * @Date: 2019-08-21 14:35:07 * @Last Modified by: zheng * @Last Modified time: 2021-06-09 09:52:31 */ /** * 短信日志 */ import * as dayjs from 'dayjs' import ApiModel from '@dreamSend/serve/core/ApiModel' // 表单信息 const formList = [ { type: 'input', label: '接收手机号', value: '', name: 'phoneNo' }, { type: 'datetimerange', label: '收到请求时间', value: [], name: 'createdAt', names: ['startCreatedAt', 'endCreatedAt'] }, { type: 'datetimerange', label: '运营商相应时间', value: [], name: 'dealTime', names: ['startDealTime', 'endDealTime'] }, { type: 'input', label: '申请编号', value: '', name: 'applyNo' }, { type: 'input', label: '业务单号', value: '', name: 'busiNo' }, { type: 'select', label: '请求系统', value: '', options: [], name: 'channelCode', attrs: ['collapse-tags', 'filterable', 'clearable'] }, { type: 'input', label: '模板编号', value: '', name: 'tempNo' }, { type: 'input', label: '短信内容(模糊匹配)', value: '', name: 'tempContent' }, { type: 'select', label: '发送状态', value: '', options: [ { label: '落地', value: '1' }, { label: '处理中', value: '2' }, { label: '成功', value: '3' }, { label: '失败', value: '4' }, ], name: 'status', attrs: ['collapse-tags', 'filterable', 'clearable'] }, { type: 'input', label: '发送返回码(模糊匹配)', value: '', name: 'responseCode' }, { type: 'input', label: '发送返回消息(模糊匹配)', value: '', name: 'response' }, ] // 表格信息 const tableList = [ { prop: "applyNo", label: "申请编号", width: "200px", // fixed: true, // type: "link" // link, button, buttons }, { prop: 'busiNo', label: '业务单号', width: '220px' }, { prop: 'channelName', label: '请求系统', width: '80px', }, { prop: 'tempNo', label: '模板编号', width: '200px', }, { prop: 'phoneNo', label: '接收手机号', width: '120px', }, { prop: 'tempContent', label: '短信内容', width: '200px', showTooltip: true }, { prop: 'statusName', label: '发送状态', width: '80px', }, { prop: 'orgName', label: '短信运营商', width: '100px', }, { prop: 'msgId', label: '运营商流水号', width: '200px', }, { prop: 'createdAt', label: '收到请求时间', width: '160px', }, { prop: 'dealTime', label: '运营商相应时间', width: '160px', }, { prop: 'requestDate', label: '发送短信时间', width: '160px', }, { prop: 'responseCode', label: '发送返回码', width: '100px', }, { prop: 'responseMsg', label: '发送返回消息', width: '110px', }, // { // prop: 'registrationAgent', // label: '登记经办人', // width: '100px', // }, // { // prop: 'registrationOrg', // label: '登记经办机构', // width: '110px', // }, { prop: "lastAction", label: "操作管理", width: "170px", type: "buttons", fixed: "right" } ] export default options => { // 接口地址,required const api = 'admin/sms/OrgRecord' return new ApiModel({ api, formList, tableList, request(params) { return this.get(params) }, computedItem(item) { // 表格部分字段特殊处理 let { createdAt, dealTime, requestDate, status } = item createdAt = createdAt && dayjs(createdAt).format('YYYY-MM-DD HH:mm:ss') dealTime = dealTime && dayjs(dealTime).format('YYYY-MM-DD HH:mm:ss') requestDate = requestDate && dayjs(requestDate).format('YYYY-MM-DD HH:mm:ss') const statusArr = { "1": "落地", "2": "处理中", "3": "成功", "4": "失败" }; const statusName = statusArr[status] return { ...item, createdAt, dealTime, requestDate, statusName } }, // computedValue(val, name, list) { // // 表单部分字段特殊处理(这里为:多选项按接口要求转换为拼接字符串) // const { formList } = this // if (typeof list === 'undefined') { // list = [...formList] // } // if ( // formList.some( // ({ attrs = [], name: findName }) => // attrs.includes('multiple') && findName === name // ) // ) { // return Array.isArray(val) ? val.join(',') : val // } // return val // } // computedValues(values = {}) { // const { formList } = this // return Object.keys(values).reduce((pre, curr) => { // // let { name, value } = curr // let value = values[curr] // const findItem = formList.find( // item => // item.name === curr && // (Array.isArray(item.attrs) && item.attrs.includes('multiple')) // ) // if (findItem && Array.isArray(value)) { // value = value.join(',') // } // pre[curr] = value // return pre // }, {}) // } }) }