|
|
@@ -33,7 +33,7 @@
|
|
|
<el-table-column label="本周" align="center" prop="weekNum" width="80"/>
|
|
|
<el-table-column label="本月" align="center" prop="monthNum" width="80"/>
|
|
|
<el-table-column label="备注" align="left" prop="remark" :show-overflow-tooltip="true"/>
|
|
|
- <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
|
<el-tooltip content="30天问答记录" placement="top">
|
|
|
<el-button link type="primary" icon="View" @click="handleMonthInfo(scope.row)"
|
|
|
@@ -43,6 +43,10 @@
|
|
|
<el-button link type="primary" icon="Position" @click="handleInfo(scope.row)"
|
|
|
v-hasPermi="['device:chatRecord:query']"></el-button>
|
|
|
</el-tooltip>
|
|
|
+ <el-tooltip content="修改备注" placement="top">
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['device:chatRecord:edit']"></el-button>
|
|
|
+ </el-tooltip>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -60,11 +64,30 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="remark.title" v-model="remark.visible" width="800px" append-to-body>
|
|
|
+ <el-form ref="chatRecordFormRef" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button :loading="buttonLoading" type="primary" @click="submitFormRemark">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="ChatRecord" lang="ts">
|
|
|
-import {getChatRecord, getChatRecordMonthInfo, listChatRecordCount,} from '@/api/smsb/device/device_chat_record';
|
|
|
+import {
|
|
|
+ getChatRecord,
|
|
|
+ getChatRecordMonthInfo,
|
|
|
+ listChatRecordCount,
|
|
|
+ updateChatRecord,
|
|
|
+} from '@/api/smsb/device/device_chat_record';
|
|
|
import {
|
|
|
ChatMonthRecordVO,
|
|
|
ChatRecordForm,
|
|
|
@@ -73,6 +96,8 @@ import {
|
|
|
} from '@/api/smsb/device/device_chat_record_type';
|
|
|
import * as echarts from 'echarts';
|
|
|
import {ref} from "vue";
|
|
|
+import {getDevice, updateDevice} from "@/api/smsb/device/device";
|
|
|
+import {DeviceForm} from "@/api/smsb/device/device_type";
|
|
|
|
|
|
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
@@ -102,6 +127,7 @@ const initFormData: ChatRecordForm = {
|
|
|
updatedAt: undefined,
|
|
|
deviceId: undefined,
|
|
|
deviceName: undefined,
|
|
|
+ remark: undefined,
|
|
|
}
|
|
|
const data = reactive<PageData<ChatRecordForm, ChatRecordQuery>>({
|
|
|
form: {...initFormData},
|
|
|
@@ -114,11 +140,67 @@ const data = reactive<PageData<ChatRecordForm, ChatRecordQuery>>({
|
|
|
deviceName: undefined,
|
|
|
params: {}
|
|
|
},
|
|
|
- rules: {}
|
|
|
+ rules: {
|
|
|
+ id: [
|
|
|
+ {required: true, message: "主键ID不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ difyId: [
|
|
|
+ {required: false, message: "difyId不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ name: [
|
|
|
+ {required: false, message: "name不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ createdAt: [
|
|
|
+ {required: false, message: "createdAt不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ updatedAt: [
|
|
|
+ {required: false, message: "updatedAt不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ deviceId: [
|
|
|
+ {required: false, message: "deviceId不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ deviceName: [
|
|
|
+ {required: false, message: "deviceName不能为空", trigger: "blur"}
|
|
|
+ ],
|
|
|
+ remark: [
|
|
|
+ {required: false, message: "备注不能为空", trigger: "blur"}
|
|
|
+ ]
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+const remark = reactive<DialogOption>({
|
|
|
+ visible: false,
|
|
|
+ title: ''
|
|
|
});
|
|
|
|
|
|
const {queryParams, form, rules} = toRefs(data);
|
|
|
|
|
|
+const handleUpdate = async (row?: ChatRecordVO) => {
|
|
|
+ reset();
|
|
|
+ const _id = row?.id || ids.value[0]
|
|
|
+ Object.assign(form.value, row);
|
|
|
+ remark.visible = true;
|
|
|
+ remark.title = "修改备注";
|
|
|
+}
|
|
|
+
|
|
|
+/** 提交备注 */
|
|
|
+const submitFormRemark = () => {
|
|
|
+ chatRecordFormRef.value?.validate(async (valid: boolean) => {
|
|
|
+ if (valid) {
|
|
|
+ buttonLoading.value = true;
|
|
|
+ let res = await getDevice(form.value.deviceId);
|
|
|
+ let deviceForm: DeviceForm = {}
|
|
|
+ Object.assign(deviceForm, res.data);
|
|
|
+ deviceForm.remark = form.value.remark;
|
|
|
+ await updateDevice(deviceForm).finally(() => buttonLoading.value = false);
|
|
|
+ proxy?.$modal.msgSuccess("操作成功");
|
|
|
+ remark.visible = false;
|
|
|
+ await getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
/** 查询问答记录列表 */
|
|
|
const getList = async () => {
|
|
|
loading.value = true;
|