|
|
|
@ -1,268 +1,127 @@ |
|
|
|
<template> |
|
|
|
<div class="main-container"> |
|
|
|
<el-card class="box-card !border-none" shadow="never"> |
|
|
|
<div class="flex justify-between items-center"> |
|
|
|
<span class="text-lg">{{ pageName }}</span> |
|
|
|
<el-button type="primary" @click="addEvent"> |
|
|
|
{{ t('addCommunicationRecords') }} |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-card |
|
|
|
class="box-card !border-none my-[10px] table-search-wrap" |
|
|
|
shadow="never" |
|
|
|
> |
|
|
|
<el-form |
|
|
|
:inline="true" |
|
|
|
:model="communicationRecordsTable.searchParam" |
|
|
|
ref="searchFormRef" |
|
|
|
> |
|
|
|
<el-form-item :label="t('staffId')" prop="staff_id"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.staff_id" |
|
|
|
:placeholder="t('staffIdPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="t('resourceId')" prop="resource_id"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.resource_id" |
|
|
|
:placeholder="t('resourceIdPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="t('resourceType')" prop="resource_type"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.resource_type" |
|
|
|
:placeholder="t('resourceTypePlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item |
|
|
|
:label="t('communicationType')" |
|
|
|
prop="communication_type" |
|
|
|
> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.communication_type" |
|
|
|
:placeholder="t('communicationTypePlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item |
|
|
|
:label="t('communicationResult')" |
|
|
|
prop="communication_result" |
|
|
|
> |
|
|
|
<el-input |
|
|
|
v-model=" |
|
|
|
communicationRecordsTable.searchParam.communication_result |
|
|
|
" |
|
|
|
:placeholder="t('communicationResultPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item |
|
|
|
:label="t('communicationTime')" |
|
|
|
prop="communication_time" |
|
|
|
> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.communication_time" |
|
|
|
:placeholder="t('communicationTimePlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="t('remarks')" prop="remarks"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.remarks" |
|
|
|
:placeholder="t('remarksPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="t('tag')" prop="tag"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.tag" |
|
|
|
:placeholder="t('tagPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="t('businessId')" prop="business_id"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.business_id" |
|
|
|
:placeholder="t('businessIdPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="t('createdAt')" prop="created_at"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.created_at" |
|
|
|
:placeholder="t('createdAtPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="t('updatedAt')" prop="updated_at"> |
|
|
|
<el-input |
|
|
|
v-model="communicationRecordsTable.searchParam.updated_at" |
|
|
|
:placeholder="t('updatedAtPlaceholder')" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" @click="loadCommunicationRecordsList()">{{ |
|
|
|
t('search') |
|
|
|
}}</el-button> |
|
|
|
<el-button @click="resetForm(searchFormRef)">{{ |
|
|
|
t('reset') |
|
|
|
}}</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-card> |
|
|
|
|
|
|
|
<div class="mt-[10px]"> |
|
|
|
<el-table |
|
|
|
:data="communicationRecordsTable.data" |
|
|
|
size="large" |
|
|
|
v-loading="communicationRecordsTable.loading" |
|
|
|
> |
|
|
|
<template #empty> |
|
|
|
<span>{{ |
|
|
|
!communicationRecordsTable.loading ? t('emptyData') : '' |
|
|
|
}}</span> |
|
|
|
</template> |
|
|
|
<el-table-column |
|
|
|
prop="staff_id" |
|
|
|
:label="t('staffId')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="resource_id" |
|
|
|
:label="t('resourceId')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="resource_type" |
|
|
|
:label="t('resourceType')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="communication_type" |
|
|
|
:label="t('communicationType')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="communication_result" |
|
|
|
:label="t('communicationResult')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="communication_time" |
|
|
|
:label="t('communicationTime')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="remarks" |
|
|
|
:label="t('remarks')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="tag" |
|
|
|
:label="t('tag')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="business_id" |
|
|
|
:label="t('businessId')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="created_at" |
|
|
|
:label="t('createdAt')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
prop="updated_at" |
|
|
|
:label="t('updatedAt')" |
|
|
|
min-width="120" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<el-table-column |
|
|
|
:label="t('operation')" |
|
|
|
fixed="right" |
|
|
|
min-width="120" |
|
|
|
> |
|
|
|
<template #default="{ row }"> |
|
|
|
<el-button type="primary" link @click="editEvent(row)">{{ |
|
|
|
t('edit') |
|
|
|
}}</el-button> |
|
|
|
<el-button type="primary" link @click="deleteEvent(row.id)">{{ |
|
|
|
t('delete') |
|
|
|
}}</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<div class="mt-[16px] flex justify-end"> |
|
|
|
<el-pagination |
|
|
|
v-model:current-page="communicationRecordsTable.page" |
|
|
|
v-model:page-size="communicationRecordsTable.limit" |
|
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
|
:total="communicationRecordsTable.total" |
|
|
|
@size-change="loadCommunicationRecordsList()" |
|
|
|
@current-change="loadCommunicationRecordsList" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<edit |
|
|
|
ref="editCommunicationRecordsDialog" |
|
|
|
@complete="loadCommunicationRecordsList" |
|
|
|
/> |
|
|
|
</el-card> |
|
|
|
</div> |
|
|
|
<div class="main-container"> |
|
|
|
<el-card class="box-card !border-none" shadow="never"> |
|
|
|
|
|
|
|
<div class="flex justify-between items-center"> |
|
|
|
<span class="text-lg">{{pageName}}</span> |
|
|
|
<el-button type="primary" @click="addEvent"> |
|
|
|
{{ t('addCommunicationRecords') }} |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never"> |
|
|
|
<el-form :inline="true" :model="communicationRecordsTable.searchParam" ref="searchFormRef"> |
|
|
|
|
|
|
|
<el-form-item :label="t('resourceId')" prop="resource_id"> |
|
|
|
<el-select class="w-[280px]" v-model="communicationRecordsTable.searchParam.resource_id" clearable :placeholder="t('resourceIdPlaceholder')"> |
|
|
|
<el-option |
|
|
|
v-for="(item, index) in resourceIdList" |
|
|
|
:key="index" |
|
|
|
:label="item['name']" |
|
|
|
:value="item['id']" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<el-form-item :label="t('communicationType')" prop="communication_type"> |
|
|
|
<el-select class="w-[280px]" v-model="communicationRecordsTable.searchParam.communication_type" clearable :placeholder="t('communicationTypePlaceholder')"> |
|
|
|
<el-option label="全部" value=""></el-option> |
|
|
|
<el-option |
|
|
|
v-for="(item, index) in communication_typeList" |
|
|
|
:key="index" |
|
|
|
:label="item.name" |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" @click="loadCommunicationRecordsList()">{{ t('search') }}</el-button> |
|
|
|
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-card> |
|
|
|
|
|
|
|
<div class="mt-[10px]"> |
|
|
|
<el-table :data="communicationRecordsTable.data" size="large" v-loading="communicationRecordsTable.loading"> |
|
|
|
<template #empty> |
|
|
|
<span>{{ !communicationRecordsTable.loading ? t('emptyData') : '' }}</span> |
|
|
|
</template> |
|
|
|
<el-table-column prop="resource_id_name" :label="t('resourceId')" min-width="120" :show-overflow-tooltip="true"/> |
|
|
|
|
|
|
|
<el-table-column prop="resource_type" :label="t('resourceType')" min-width="120" :show-overflow-tooltip="true"/> |
|
|
|
|
|
|
|
<el-table-column :label="t('communicationType')" min-width="180" align="center" :show-overflow-tooltip="true"> |
|
|
|
<template #default="{ row }"> |
|
|
|
<div v-for="(item, index) in communication_typeList"> |
|
|
|
<div v-if="item.value == row.communication_type">{{ item.name }}</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column :label="t('communicationResult')" min-width="180" align="center" :show-overflow-tooltip="true"> |
|
|
|
<template #default="{ row }"> |
|
|
|
<div v-for="(item, index) in communication_resultList"> |
|
|
|
<div v-if="item.value == row.communication_result">{{ item.name }}</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="communication_time" :label="t('communicationTime')" min-width="120" :show-overflow-tooltip="true"/> |
|
|
|
|
|
|
|
<el-table-column prop="remarks" :label="t('remarks')" min-width="120" :show-overflow-tooltip="true"/> |
|
|
|
|
|
|
|
<el-table-column :label="t('tag')" min-width="180" align="center" :show-overflow-tooltip="true"> |
|
|
|
<template #default="{ row }"> |
|
|
|
<div v-for="(item, index) in tagList"> |
|
|
|
<div v-if="item.value == row.tag">{{ item.name }}</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column :label="t('operation')" fixed="right" min-width="120"> |
|
|
|
<template #default="{ row }"> |
|
|
|
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button> |
|
|
|
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
</el-table> |
|
|
|
<div class="mt-[16px] flex justify-end"> |
|
|
|
<el-pagination v-model:current-page="communicationRecordsTable.page" v-model:page-size="communicationRecordsTable.limit" |
|
|
|
layout="total, sizes, prev, pager, next, jumper" :total="communicationRecordsTable.total" |
|
|
|
@size-change="loadCommunicationRecordsList()" @current-change="loadCommunicationRecordsList" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<edit ref="editCommunicationRecordsDialog" @complete="loadCommunicationRecordsList" /> |
|
|
|
</el-card> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
import { reactive, ref, watch } from 'vue' |
|
|
|
import { t } from '@/lang' |
|
|
|
import { useDictionary } from '@/app/api/dict' |
|
|
|
import { |
|
|
|
getCommunicationRecordsList, |
|
|
|
deleteCommunicationRecords, |
|
|
|
} from '@/app/api/communication_records' |
|
|
|
import { getCommunicationRecordsList, deleteCommunicationRecords, getWithCustomerResourcesList } from '@/app/api/communication_records' |
|
|
|
import { img } from '@/utils/common' |
|
|
|
import { ElMessageBox, FormInstance } from 'element-plus' |
|
|
|
import { ElMessageBox,FormInstance } from 'element-plus' |
|
|
|
import Edit from '@/app/views/communication_records/components/communication-records-edit.vue' |
|
|
|
import { useRoute } from 'vue-router' |
|
|
|
const route = useRoute() |
|
|
|
const pageName = route.meta.title |
|
|
|
const pageName = route.meta.title; |
|
|
|
|
|
|
|
let communicationRecordsTable = reactive({ |
|
|
|
page: 1, |
|
|
|
limit: 10, |
|
|
|
total: 0, |
|
|
|
loading: true, |
|
|
|
data: [], |
|
|
|
searchParam: { |
|
|
|
staff_id: '', |
|
|
|
resource_id: '', |
|
|
|
resource_type: '', |
|
|
|
communication_type: '', |
|
|
|
communication_result: '', |
|
|
|
communication_time: '', |
|
|
|
remarks: '', |
|
|
|
tag: '', |
|
|
|
business_id: '', |
|
|
|
created_at: '', |
|
|
|
updated_at: '', |
|
|
|
}, |
|
|
|
page: 1, |
|
|
|
limit: 10, |
|
|
|
total: 0, |
|
|
|
loading: true, |
|
|
|
data: [], |
|
|
|
searchParam:{ |
|
|
|
"resource_id":"", |
|
|
|
"communication_type":"" |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
const searchFormRef = ref<FormInstance>() |
|
|
|
@ -271,26 +130,39 @@ const searchFormRef = ref<FormInstance>() |
|
|
|
const selectData = ref<any[]>([]) |
|
|
|
|
|
|
|
// 字典数据 |
|
|
|
const communication_typeList = ref([] as any[]) |
|
|
|
const communication_typeDictList = async () => { |
|
|
|
communication_typeList.value = await (await useDictionary('communication_type')).data.dictionary |
|
|
|
} |
|
|
|
communication_typeDictList(); |
|
|
|
const communication_resultList = ref([] as any[]) |
|
|
|
const communication_resultDictList = async () => { |
|
|
|
communication_resultList.value = await (await useDictionary('communication_result')).data.dictionary |
|
|
|
} |
|
|
|
communication_resultDictList(); |
|
|
|
const tagList = ref([] as any[]) |
|
|
|
const tagDictList = async () => { |
|
|
|
tagList.value = await (await useDictionary('tag')).data.dictionary |
|
|
|
} |
|
|
|
tagDictList(); |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取沟通记录列表 |
|
|
|
*/ |
|
|
|
const loadCommunicationRecordsList = (page: number = 1) => { |
|
|
|
communicationRecordsTable.loading = true |
|
|
|
communicationRecordsTable.page = page |
|
|
|
|
|
|
|
getCommunicationRecordsList({ |
|
|
|
page: communicationRecordsTable.page, |
|
|
|
limit: communicationRecordsTable.limit, |
|
|
|
...communicationRecordsTable.searchParam, |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
communicationRecordsTable.loading = false |
|
|
|
communicationRecordsTable.data = res.data.data |
|
|
|
communicationRecordsTable.total = res.data.total |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
communicationRecordsTable.loading = false |
|
|
|
communicationRecordsTable.loading = true |
|
|
|
communicationRecordsTable.page = page |
|
|
|
|
|
|
|
getCommunicationRecordsList({ |
|
|
|
page: communicationRecordsTable.page, |
|
|
|
limit: communicationRecordsTable.limit, |
|
|
|
...communicationRecordsTable.searchParam |
|
|
|
}).then(res => { |
|
|
|
communicationRecordsTable.loading = false |
|
|
|
communicationRecordsTable.data = res.data.data |
|
|
|
communicationRecordsTable.total = res.data.total |
|
|
|
}).catch(() => { |
|
|
|
communicationRecordsTable.loading = false |
|
|
|
}) |
|
|
|
} |
|
|
|
loadCommunicationRecordsList() |
|
|
|
@ -301,8 +173,8 @@ const editCommunicationRecordsDialog: Record<string, any> | null = ref(null) |
|
|
|
* 添加沟通记录 |
|
|
|
*/ |
|
|
|
const addEvent = () => { |
|
|
|
editCommunicationRecordsDialog.value.setFormData() |
|
|
|
editCommunicationRecordsDialog.value.showDialog = true |
|
|
|
editCommunicationRecordsDialog.value.setFormData() |
|
|
|
editCommunicationRecordsDialog.value.showDialog = true |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -310,42 +182,50 @@ const addEvent = () => { |
|
|
|
* @param data |
|
|
|
*/ |
|
|
|
const editEvent = (data: any) => { |
|
|
|
editCommunicationRecordsDialog.value.setFormData(data) |
|
|
|
editCommunicationRecordsDialog.value.showDialog = true |
|
|
|
editCommunicationRecordsDialog.value.setFormData(data) |
|
|
|
editCommunicationRecordsDialog.value.showDialog = true |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除沟通记录 |
|
|
|
*/ |
|
|
|
const deleteEvent = (id: number) => { |
|
|
|
ElMessageBox.confirm(t('communicationRecordsDeleteTips'), t('warning'), { |
|
|
|
confirmButtonText: t('confirm'), |
|
|
|
cancelButtonText: t('cancel'), |
|
|
|
type: 'warning', |
|
|
|
}).then(() => { |
|
|
|
deleteCommunicationRecords(id) |
|
|
|
.then(() => { |
|
|
|
loadCommunicationRecordsList() |
|
|
|
}) |
|
|
|
.catch(() => {}) |
|
|
|
}) |
|
|
|
ElMessageBox.confirm(t('communicationRecordsDeleteTips'), t('warning'), |
|
|
|
{ |
|
|
|
confirmButtonText: t('confirm'), |
|
|
|
cancelButtonText: t('cancel'), |
|
|
|
type: 'warning', |
|
|
|
} |
|
|
|
).then(() => { |
|
|
|
deleteCommunicationRecords(id).then(() => { |
|
|
|
loadCommunicationRecordsList() |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const resourceIdList = ref([]) |
|
|
|
const setResourceIdList = async () => { |
|
|
|
resourceIdList.value = await (await getWithCustomerResourcesList({})).data |
|
|
|
} |
|
|
|
setResourceIdList() |
|
|
|
|
|
|
|
const resetForm = (formEl: FormInstance | undefined) => { |
|
|
|
if (!formEl) return |
|
|
|
formEl.resetFields() |
|
|
|
loadCommunicationRecordsList() |
|
|
|
if (!formEl) return |
|
|
|
formEl.resetFields() |
|
|
|
loadCommunicationRecordsList() |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
/* 多行超出隐藏 */ |
|
|
|
.multi-hidden { |
|
|
|
word-break: break-all; |
|
|
|
text-overflow: ellipsis; |
|
|
|
overflow: hidden; |
|
|
|
display: -webkit-box; |
|
|
|
-webkit-line-clamp: 2; |
|
|
|
-webkit-box-orient: vertical; |
|
|
|
} |
|
|
|
word-break: break-all; |
|
|
|
text-overflow: ellipsis; |
|
|
|
overflow: hidden; |
|
|
|
display: -webkit-box; |
|
|
|
-webkit-line-clamp: 2; |
|
|
|
-webkit-box-orient: vertical; |
|
|
|
} |
|
|
|
</style> |
|
|
|
|