评估申请信息发送到钉钉联调
This commit is contained in:
@@ -50,3 +50,21 @@ export function exportLbAssessmentApply(params) {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 根据租户ID与记录ID生成评估会议通知文案 */
|
||||||
|
export function getLbAssessmentApplyNotificationText(params) {
|
||||||
|
return request({
|
||||||
|
url: '/lbAssessmentApply/notificationText',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 发送评估会议通知到钉钉群 */
|
||||||
|
export function sendLbAssessmentApplyNotificationToDingTalk(params) {
|
||||||
|
return request({
|
||||||
|
url: '/lbAssessmentApply/sendNotificationToDingTalk',
|
||||||
|
method: 'post',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,8 +47,18 @@
|
|||||||
{{ formatDateTime(scope.row.createdAt) }}
|
{{ formatDateTime(scope.row.createdAt) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" width="126">
|
<el-table-column label="操作" fixed="right" width="300">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
:loading="notificationLoadingId === scope.row.id"
|
||||||
|
@click="handleGenerateNotification(scope.row)"
|
||||||
|
>生成通知</el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
:loading="dingTalkLoadingId === scope.row.id"
|
||||||
|
@click="handleSendToDingTalk(scope.row)"
|
||||||
|
>发到钉钉</el-button>
|
||||||
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
|
||||||
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
|
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -86,6 +96,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="评估会议通知" :visible.sync="notificationDialogVisible" width="640px" @close="resetNotificationDialog">
|
||||||
|
<el-input
|
||||||
|
v-model="notificationText"
|
||||||
|
type="textarea"
|
||||||
|
:rows="14"
|
||||||
|
readonly
|
||||||
|
placeholder="通知文案将显示在此处"
|
||||||
|
/>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="notificationDialogVisible = false">关闭</el-button>
|
||||||
|
<el-button type="primary" icon="el-icon-copy-document" :disabled="!notificationText" @click="copyNotificationText">
|
||||||
|
复制
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog v-dialog-drag :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
|
<el-dialog v-dialog-drag :title="dialogTitle" :visible.sync="dialogVisible" width="760px" @close="resetForm">
|
||||||
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
|
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="120px">
|
||||||
<template v-if="!isEdit">
|
<template v-if="!isEdit">
|
||||||
@@ -239,7 +265,9 @@ import {
|
|||||||
deleteLbAssessmentApply,
|
deleteLbAssessmentApply,
|
||||||
exportLbAssessmentApply,
|
exportLbAssessmentApply,
|
||||||
getLbAssessmentApplyList,
|
getLbAssessmentApplyList,
|
||||||
|
getLbAssessmentApplyNotificationText,
|
||||||
parseAssessmentApplyFromText,
|
parseAssessmentApplyFromText,
|
||||||
|
sendLbAssessmentApplyNotificationToDingTalk,
|
||||||
updateLbAssessmentApply
|
updateLbAssessmentApply
|
||||||
} from '@/api/lb-assessment-apply'
|
} from '@/api/lb-assessment-apply'
|
||||||
import { getBusinessHeaders } from '@/utils/business-headers'
|
import { getBusinessHeaders } from '@/utils/business-headers'
|
||||||
@@ -253,6 +281,10 @@ export default {
|
|||||||
parseAiLoading: false,
|
parseAiLoading: false,
|
||||||
exportLoading: false,
|
exportLoading: false,
|
||||||
exportDialogVisible: false,
|
exportDialogVisible: false,
|
||||||
|
notificationDialogVisible: false,
|
||||||
|
notificationLoadingId: '',
|
||||||
|
dingTalkLoadingId: '',
|
||||||
|
notificationText: '',
|
||||||
assessmentApplyText: '',
|
assessmentApplyText: '',
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
@@ -511,6 +543,108 @@ export default {
|
|||||||
applicationDateRange: []
|
applicationDateRange: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleGenerateNotification(row) {
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (!tenantId) {
|
||||||
|
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!row || !row.id) {
|
||||||
|
this.$message.warning('记录ID无效,无法生成通知')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.notificationLoadingId = row.id
|
||||||
|
getLbAssessmentApplyNotificationText({ tenantId, id: row.id })
|
||||||
|
.then((res) => {
|
||||||
|
const payload = res && typeof res === 'object' ? res : {}
|
||||||
|
const text = this.extractNotificationText(payload)
|
||||||
|
if (!text) {
|
||||||
|
this.$message.warning(payload.message || '未获取到通知文案')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.notificationText = text
|
||||||
|
this.notificationDialogVisible = true
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.notificationLoadingId = ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSendToDingTalk(row) {
|
||||||
|
const tenantId = this.getTenantIdFromBusinessHeaders()
|
||||||
|
if (!tenantId) {
|
||||||
|
this.$message.error('未获取到租户ID,请先登录或配置业务请求头中的租户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!row || !row.id) {
|
||||||
|
this.$message.warning('记录ID无效,无法发送到钉钉')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$confirm('确定将该条评估会议通知发送到钉钉群吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.dingTalkLoadingId = row.id
|
||||||
|
return sendLbAssessmentApplyNotificationToDingTalk({ tenantId, id: row.id })
|
||||||
|
}).then((res) => {
|
||||||
|
this.$message.success((res && res.message) || '已发送到钉钉')
|
||||||
|
}).catch(() => {}).finally(() => {
|
||||||
|
this.dingTalkLoadingId = ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
extractNotificationText(payload) {
|
||||||
|
if (!payload || typeof payload !== 'object') return ''
|
||||||
|
if (typeof payload.data === 'string' && payload.data.trim()) {
|
||||||
|
return payload.data.trim()
|
||||||
|
}
|
||||||
|
const sources = [payload]
|
||||||
|
if (payload.data && typeof payload.data === 'object') {
|
||||||
|
sources.push(payload.data)
|
||||||
|
}
|
||||||
|
const keys = ['text', 'notificationText', 'content']
|
||||||
|
for (let i = 0; i < sources.length; i++) {
|
||||||
|
const source = sources[i]
|
||||||
|
for (let j = 0; j < keys.length; j++) {
|
||||||
|
const v = source[keys[j]]
|
||||||
|
if (typeof v === 'string' && v.trim()) return v.trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
},
|
||||||
|
resetNotificationDialog() {
|
||||||
|
this.notificationText = ''
|
||||||
|
},
|
||||||
|
copyNotificationText() {
|
||||||
|
const text = (this.notificationText || '').trim()
|
||||||
|
if (!text) {
|
||||||
|
this.$message.warning('没有可复制的通知文案')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (navigator.clipboard && window.isSecureContext) {
|
||||||
|
navigator.clipboard.writeText(text).then(() => {
|
||||||
|
this.$message.success('已复制到剪贴板')
|
||||||
|
}).catch(() => {
|
||||||
|
this.fallbackCopyTextToClipboard(text)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.fallbackCopyTextToClipboard(text)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fallbackCopyTextToClipboard(text) {
|
||||||
|
const textarea = document.createElement('textarea')
|
||||||
|
textarea.value = text
|
||||||
|
textarea.style.position = 'fixed'
|
||||||
|
textarea.style.left = '-9999px'
|
||||||
|
document.body.appendChild(textarea)
|
||||||
|
textarea.select()
|
||||||
|
try {
|
||||||
|
document.execCommand('copy')
|
||||||
|
this.$message.success('已复制到剪贴板')
|
||||||
|
} catch (e) {
|
||||||
|
this.$message.error('复制失败,请手动选择文本复制')
|
||||||
|
}
|
||||||
|
document.body.removeChild(textarea)
|
||||||
|
},
|
||||||
handleEdit(row) {
|
handleEdit(row) {
|
||||||
this.dialogTitle = '编辑评估申请'
|
this.dialogTitle = '编辑评估申请'
|
||||||
this.isEdit = true
|
this.isEdit = true
|
||||||
|
|||||||
Reference in New Issue
Block a user