Merge pull request 'master' (#58) from master into test

Reviewed-on: http://git.feashow.cn/feashow/SmartOpsWeb/pulls/58
This commit is contained in:
2024-09-15 14:59:28 +00:00
10 changed files with 374 additions and 124 deletions

View File

@@ -0,0 +1,30 @@
import request from '@/utils/request.js'
export const addContact = (data) => {
return request({
url: '/contact/add',
method: 'post',
data
})
}
export const getContactDetail = (contactId) => {
return request({
url: `/contact/${contactId}`,
method: 'get'
})
}
export const editContact = (data) => {
return request({
url: '/contact/update',
method: 'post',
data
})
}
export const deleteContact = (contactIds) => {
return request({
url: `/contact/${contactIds}`,
method: 'delete'
})
}

View File

@@ -25,6 +25,6 @@ defineExpose({
<style>
.box{
height: 65vh;
height: 68vh;
}
</style>

View File

@@ -127,8 +127,11 @@ const initWebSocket = () => {
}
//接收到消息的回调方法
socket.onmessage = function (event) {
let data = JSON.parse(event.data)
console.log("服务器返回的信息: ", JSON.parse(event.data));
let data = JSON.parse(event.data)
if(data.type!=='pong'){
console.log("服务器返回的信息: ", data);
}
}
//连接关闭的回调方法
socket.onclose = function () {
@@ -137,7 +140,7 @@ const initWebSocket = () => {
}
setInterval(() => {
socket.send(JSON.stringify(send))
}, 3000)
}, 30000)
} catch (e) {
console.log(e)
console.log("ws连接失败");
@@ -192,7 +195,7 @@ const initWebSocket = () => {
<style lang="scss" scoped>
.live-call {
width: 48%;
height: 47.5vh;
height: 47vh;
margin-bottom: 20px;
overflow: hidden;
border: 1px solid #d5d4d4;

View File

@@ -1,10 +1,10 @@
<template>
<el-dialog v-model="localDialogParams.localVisited" :title="localDialogParams.localTitle" :width="localDialogParams.localWidth+'px'">
<fvForm :schema="localDialogParams.localFormSchema" @getInstance="(e)=>baseForm = e" label-position="right" :rules="localDialogParams.localFormRules"></fvForm>
<el-dialog v-model="isVisited" :title="localDialogParams.localTitle" :width="localDialogParams.localWidth+'px'" @close="isVisited==false">
<fvForm :schema="localDialogParams.localFormSchema" @getInstance="(e)=>baseForm = e" label-position="right" :rules="localDialogParams.localFormRules"></fvForm>
<template #footer>
<span>
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button>
<el-button type="primary" @click="handleSubmit(baseForm)">确定</el-button>
</span>
</template>
</el-dialog>
@@ -12,15 +12,16 @@
<script setup>
const emits = defineEmits(['getInstance'])
const isVisited=ref(false)
const props = defineProps({
isVisited: {
type: Boolean,
default: true
},
title: {
type: Boolean,
default: true
},
dialogType: {
type: String,
default: ''
},
width: {
type: String,
default: '700'
@@ -36,8 +37,8 @@ const props = defineProps({
})
const baseForm = ref()
const localDialogParams = ref({})
watchEffect(()=>{
localDialogParams.value.localVisited = props.isVisited
localDialogParams.value.localTitle = props.title
localDialogParams.value.localWidth = props.width
localDialogParams.value.localFormSchema = props.formSchema
@@ -47,13 +48,21 @@ const getFormInstance=()=>{
return baseForm.value
}
const handleCancel=()=>{
emits('dialogCancel')
// emits('dialogCancel')
isVisited.value=false
nextTick(() => {
baseForm.value.resetFields()
})
}
const handleSubmit=()=>{
emits('dialogSubmit',baseForm.value)
const handleSubmit=(baseForm)=>{
emits('dialogSubmit',baseForm)
}
const openOrCloseDialog=(flag=true)=>{
isVisited.value=flag
}
defineExpose({
getFormInstance
getFormInstance,
openOrCloseDialog
})
</script>

View File

@@ -14,8 +14,8 @@
<script setup lang="jsx">
import LiveCall from '@/components/liveCall/index.vue'
import Voice from '@/components/voice/index.vue'
import InfoLiveCall from '@/components/infoLiveCall/index.vue'
import Voice from '@/components/Voice/index.vue'
import infoLiveCall from '@/components/infoLiveCall/index.vue'
const infoLiveCallRef=ref()
const voiceRef=ref()
const tableIns = ref()
@@ -97,7 +97,7 @@ const tableConfig = reactive({
label: '操作',
align: 'center',
fixed: 'right',
// width: 150,
width: 200,
showOverflowTooltip: false,
currentRender: ({ row, index }) => {
// console.log(row);

View File

@@ -1,29 +1,105 @@
<template>
<fvSearchForm :searchConfig="searchConfig" @search="search">
</fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig" :data="mockData" @headBtnClick="headBtnClick"></fvTable>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick"></fvTable>
<fvFormDialog ref="formDialogRef" :isVisited="showAddOrEditAddressBookDialog" :title="dialogTitle" :dialogType="dialogType"
:form-schema="formSchema" :form-rules="formRules" @dialogCancel="handleCancel"
@dialogSubmit="handleSubmit"></fvFormDialog>
</template>
<script setup lang="jsx">
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {addContact,editContact,getContactDetail,deleteContact} from "@/api/address-book";
import {ElMessage, ElMessageBox} from "element-plus";
const router = useRouter()
const tableIns = ref()
const mockData = ref([
{
workOrderNumber: 1211,
workOrderTime: '2022-02-09 00 : 12',
state: 0,
callState: 0
},
{
workOrderNumber: 232,
state: 1,
callState: 1
}
])
const formDialogRef = ref()
const dialogTitle = ref("");
const dialogType = ref("");
const formRules = reactive({
siteName: [
{required: true, message: "请输入电站", trigger: ["change", "blur"]}
],
role: [
{required: true, message: "请选择角色", trigger: ["change", "blur"]}
],
name: [
{required: true, message: "请输入姓名", trigger: ["change", "blur"]}
],
phone: [
{required: true, message: "请输入手机号", trigger: ["change", "blur"]}
]
});
const formSchema = computed(() => {
return [
{
label: '电站',
prop: 'siteName',
component: 'el-input',
colProps: {
span: 24
},
props: {
placeholder: '请输入电站',
clearable: true,
}
},
{
label: '角色',
prop: 'role',
component: shallowRef(fvSelect),
colProps: {
span: 24
},
props: {
placeholder: '请选择角色',
cacheKey: 'address_book_role',
clearable: true,
filterable: true,
}
},
{
label: '姓名',
prop: 'name',
component: 'el-input',
colProps: {
span: 24
},
props: {
placeholder: '请输入姓名',
clearable: true,
}
},
{
label: '手机号',
prop: 'phone',
component: 'el-input',
colProps: {
span: 24
},
props: {
placeholder: '请输入手机号',
clearable: true,
},
},
{
label: '规则',
prop: 'rule',
component: 'el-input',
colProps: {
span: 24
},
props: {
placeholder: '请输入规则',
clearable: true,
},
}
]
})
const searchConfig = reactive([
{
label: '电站',
prop: 'requirementName',
prop: 'siteName',
props: {
placeholder: '请输入电站查询',
clearable: true,
@@ -33,17 +109,18 @@ const searchConfig = reactive([
},
{
label: '角色',
prop: 'requirementName',
prop: 'role',
component: shallowRef(fvSelect),
props: {
placeholder: '请输入角色查询',
placeholder: '请选择角色查询',
cacheKey: 'address_book_role',
clearable: true,
checkStrictly: true
filterable: true,
},
component: 'el-input',
},
{
label: '姓名',
prop: 'requirementName',
prop: 'name',
props: {
placeholder: '请输入姓名查询',
clearable: true,
@@ -62,37 +139,85 @@ const tableConfig = reactive({
width: 80,
},
{
prop: 'workOrderNumber',
prop: 'siteName',
label: '电站',
align: 'center'
},
{
prop: 'workOrderNumber',
{//0运维1地面调度2现场调度
prop: 'role',
label: '角色',
align: 'center'
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.role !== null) {
return (<Tag dictType={'address_book_role'} value={row.role}/>)
} else {
return '--'
}
}
},
{
prop: 'workOrderNumber',
prop: 'name',
label: '姓名',
align: 'center'
},
{
prop: 'workOrderNumber',
prop: 'phone',
label: '手机号',
align: 'center'
},
{
prop: 'workOrderNumber',
prop: 'rule',
label: '规则',
align: 'center'
},
{
prop: 'oper',
label: '操作',
align: 'center',
fixed: 'right',
width: 150,
showOverflowTooltip: false,
currentRender: ({ row, index }) => {
let btn = []
btn.push({ label: '编辑', func: () => handleEdit(row), type: 'primary' })
btn.push({ label: '删除', func: () => handleDelete(row), type: 'danger' })
return (
<div style={{ width: '100%' }}>
{
btn.map(item => (
<el-button
type={item.type}
// v-perm={item.prem}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
</div>
)
}
}
],
api: '',
api: '/contact/list',
params: {},
btns: [
{name: '新增', key: 'add',type:'primary',icon:'Plus'},
{name: '新增', key: 'add', type: 'primary', icon: 'Plus'},
]
})
const search = (val) => {
let obj = {...val}
if (obj.dateValue) {
obj.startTime = obj.dateValue[0]
obj.endTime = obj.dateValue[1]
delete obj.dateValue
}
tableConfig.params = obj
tableIns.value.refresh()
}
const headBtnClick = (key) => {
switch (key) {
case 'add':
@@ -100,6 +225,80 @@ const headBtnClick = (key) => {
break;
}
}
const handleAdd = () => {
formDialogRef.value.openOrCloseDialog(true)
dialogTitle.value = "新增通讯录";
dialogType.value = "add";
nextTick(() => {
// 清空校验
formDialogRef.value.getFormInstance().clearValidate()
formDialogRef.value.getFormInstance().resetFields()
})
}
const handleEdit = (row) => {
formDialogRef.value.openOrCloseDialog(true)
getDetail(row)
dialogTitle.value = "编辑通讯录";
dialogType.value = "edit";
}
const getDetail=(row)=>{
getContactDetail(row.contactsId).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg)
nextTick(() => {
formDialogRef.value.getFormInstance().setValues(res.data)
// 清空校验
formDialogRef.value.getFormInstance().clearValidate()
})
} else {
}
})
}
const handleDelete = (row) => {
ElMessageBox.confirm(`确认删除姓名为${row.name}的通讯录吗?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteContact(row.contactsId).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg)
tableIns.value.refresh()
} else {
ElMessage.error(res.msg)
}
})
})
}
//提交
const handleSubmit = async (formInstance) => {
if (!formInstance) return;
let validate = await formInstance.validate()
if (!validate.isValidate) return;
if (dialogType.value === "add") {
addContact(formInstance.getValues()).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg);
tableIns.value.refresh()
formDialogRef.value.openOrCloseDialog(false)
} else {
ElMessage.error(res.msg);
}
});
} else {
editContact(formInstance.getValues()).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg);
tableIns.value.refresh()
formDialogRef.value.openOrCloseDialog(false)
} else {
ElMessage.error(res.msg);
}
});
}
}
</script>
<style scoped>

View File

@@ -1,7 +1,7 @@
<template>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick"></fvTable>
<fvFormDialog v-if="showAddOrEditUserDialog" ref="formDialogRef" :title="title" :form-schema="formSchema" :form-rules="formRules" @dialogCancel="handleCancel" @dialogSubmit="handleSubmit"></fvFormDialog>
<fvFormDialog v-if="showAddOrEditUserDialog" ref="formDialogRef" :title="dialogTitle" :form-schema="formSchema" :form-rules="formRules" @dialogCancel="handleCancel" @dialogSubmit="handleSubmit"></fvFormDialog>
</template>
<script setup>
@@ -12,6 +12,7 @@ import {useCacheStore} from "@/stores/cache.js";
const tableIns = ref()
const formDialogRef = ref()
const showAddOrEditUserDialog = ref(false)
const dialogTitle = ref("");
const searchConfig = reactive([
{
label: '用户名称',
@@ -181,7 +182,7 @@ const handleAdd = () => {
// showAddOrEditUserDialog.value = true
// formRules.value.password[0].required = true
// restForm();
// title.value = "新增用户";
// dialogTitle.value = "新增用户";
// nextTick(()=>{
// // 清空校验
// formDialogRef.value.getFormInstance().clearValidate()
@@ -190,7 +191,6 @@ const handleAdd = () => {
};
//取消
const handleCancel = () => {
// restForm();
showAddOrEditUserDialog.value = false;
};
@@ -199,35 +199,16 @@ const handleSubmit = async (formInstance) => {
if (!formInstance) return;
formInstance.validate(async (valid) => {
if (!valid) return;
if (title.value === "新增用户") {
addUser(userForm.value).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg);
isVisited.value = false;
} else {
ElMessage.error(res.msg);
}
});
}
// if (title.value === "新增用户") {
// addUser(userForm.value).then(res => {
// if (res.code === 1000) {
// ElMessage.success(res.msg);
// isVisited.value = false;
// } else {
// ElMessage.error(res.msg);
// }
// });
// }
})
}
const userForm = ref({});
const formInstance = ref();
const isVisited = ref(false);
const title = ref("");
// const restForm = () => {
// userForm.value = {
// userName: null,
// nickName: null,
// phoneNumber: null,
// email: null,
// password: null,
// sex: null,
// state: "1",
// };
// };
</script>

View File

@@ -13,14 +13,15 @@ const dialogVisible = ref(false);
const props = defineProps({
rowData: Object
})
let dataDetails = ref();
let opsCallList = ref([]);
// let mergedData = ref([]);
const open = (row) => {
dialogVisible.value = true;
};
const getData = async () => {
console.log(123);
// console.log(123);
const data = await orderGetDetails(props.rowData.orderNumber)
// console.log("111", data);
@@ -32,21 +33,48 @@ watch(() => props.rowData, (newRowData) => {
if (newRowData) {
// console.log(getData(newRowData));
getData(newRowData).then((data) => {
// console.log(data.data);
dataDetails = data.data.opsCallList
const dataDetails = data.data.opsCallList
// console.log(dataDetails);
// opsCallList = dataDetails.opsCallList
dataDetails.forEach(item => {
// console.log(item);
opsCallList.value.push(item)
const theData=[{createTime:'',data:[]}]
dataDetails.forEach(for1data => {
theData.forEach(for2data => {
if(for1data.createTime!==for2data.createTime){
console.log(for2data);
for2data.createTime=for1data.createTime
// for2data.data.push(for1data)
theData.push({createTime:for1data.createTime,data:[]})
}else{
for2data.data.push(for1data)
return;
}
})
});
// console.log(opsCallList);
theData.pop()
// console.log(theData);
theData.forEach(item => {
opsCallList.value.push(item)
})
console.log(opsCallList.value);
// dataDetails.forEach(item => {
// // console.log(item);
// opsCallList.value.push(item)
// });
// console.log(mergedData.value);
})
}
}, {
immediate: true // 立即执行一次以便在rowData初始值非空时也能触发
});
// getData()
function omitCreateTime(item) {
const { createTime, ...rest } = item;
return rest;
}
@@ -82,22 +110,22 @@ const test2 = [
size: "large",
}
];
const data = [
{
number: '17628661307',
state: '通话中',
time: '18 : 32',
},
{
number: '17628661307',
state: '已接通',
time: '18 : 32',
},
{
number: '17628661307',
state: '已接通',
time: '18 : 32',
}]
// const data = [
// {
// number: '17628661307',
// state: '通话中',
// time: '18 : 32',
// },
// {
// number: '17628661307',
// state: '已接通',
// time: '18 : 32',
// },
// {
// number: '17628661307',
// state: '已接通',
// time: '18 : 32',
// }]
defineExpose({
open,
});
@@ -107,7 +135,7 @@ defineExpose({
</script>
<template>
<el-dialog v-model="dialogVisible" :show-close=true title="工单详情" width="80%" overflow: auto>
<el-dialog v-model="dialogVisible" :show-close=true title="工单详情" width="80%">
<div class="common-layout">
<el-container>
<el-header class="header"><span>工单号</span>
@@ -140,7 +168,7 @@ defineExpose({
<div>
<div>工单内容</div>
<div class="textBox">
<el-scrollbar >
<el-scrollbar>
<div class="text">{{ rowData.orderContent }}</div>
</el-scrollbar>
</div>
@@ -148,7 +176,7 @@ defineExpose({
<div>
<div>处理内容</div>
<div class="textBox">
<el-scrollbar >
<el-scrollbar>
<div class="text">{{ rowData.processedContent }}</div>
</el-scrollbar>
</div>
@@ -157,7 +185,7 @@ defineExpose({
<div>
<div>录音信息</div>
<div class="textBox">
<el-scrollbar >
<el-scrollbar>
<div class="text">{{ rowData.recordUrl }}</div>
</el-scrollbar>
</div>
@@ -175,17 +203,17 @@ defineExpose({
:size="activity.size">
<div class="custom-card">
<div>{{ activity.createTime }}</div>
<!-- <div v-for="(info, index) in data" :key="index"> -->
<div>
<span :style="{ color: '#a8abb2' }">{{ activity.callIdNumber
}}</span>
<span :style="{
color: activity.callState === '通话中' ? '#6cc23a' : '#409eff'
}">{{ activity.callState }}</span>
<span class="span-3th" :style="{ color: '#a8abb2' }">{{
activity.answer_time }}</span>
<div v-for="(info, index) in activity.data" :key="index">
<div>
<span :style="{ color: '#a8abb2' }">{{ info.callIdNumber
}}</span>
<span :style="{
color: info.callState === '通话中' ? '#6cc23a' : '#409eff'
}">{{ info.callState }}</span>
<span class="span-3th" :style="{ color: '#a8abb2' }">{{
info.answer_time }}</span>
</div>
</div>
<!-- </div> -->
</div>
</el-timeline-item>
</el-timeline>

View File

@@ -233,7 +233,7 @@ const tableConfig = reactive({
}
],
api: '/order/list',
params: {},
params: {state:"1",name:"已处理"},
btns: [
// {name: '新增', key: 'add', color: '#DED0B2', auth: auths.report},
]

View File

@@ -233,7 +233,7 @@ const tableConfig = reactive({
}
],
api: '/order/list',
params: {},
params: {state:"0",name:"待处理"},
btns: [
// {name: '新增', key: 'add', color: '#DED0B2', auth: auths.report},
]