Przeglądaj źródła

客服管理 修改

wks 1 rok temu
rodzic
commit
8c1f4b25be

+ 1 - 1
src/http/moudules/customer/customerManage.js

@@ -37,7 +37,7 @@ export const getDutyConfig = (customerId) => {
 // 清除值班配置
 export const clearDutyConfig = (customerId) => {
   return axios({
-    url: '/wechat/customer/manage/clearDutyConfig' + customerId,
+    url: '/wechat/customer/manage/clearDutyConfig/' + customerId,
     method: 'delete',
   })
 }

+ 30 - 23
src/views/PeopleManage/Customer/CustomerServiceAccount.vue

@@ -1,5 +1,6 @@
 <script setup>
 import KtCommonTable from "@/views/Core/KtCommonTable.vue";
+import dayjs from "dayjs";
 
 export default {
   components: {
@@ -63,7 +64,7 @@ export default {
         {prop: "userId", label: "工号"},
         {prop: "receptionist", label: "企微用户"},
         {prop: "dutyCustomer", label: "值班客服"},
-        // {prop: "dutyCustomer", label: "值班时间"},
+        {prop: "dutyDatetime", label: "值班时间"},
       ],
 
       rules: {
@@ -84,6 +85,9 @@ export default {
     this.queryPage();
   },
   methods: {
+    changeDateTime(value) {
+      return dayjs(value).format("yyyy-MM-dd HH:mm:ss");
+    },
     queryPage() {
       this.$api.customerManage.pageQuery(this.queryCondition).then((res) => {
         if (res.code === 200) {
@@ -105,10 +109,6 @@ export default {
           this.$message.error(res.msg)
         }
       });
-    },
-    // 编辑客服
-    editCustomer(customerID) {
-
     },
     // 删除客服
     deleteCustomer({row}) {
@@ -117,14 +117,10 @@ export default {
           this.$message("删除成功")
         }
       })
-    },
-    // 值班配置
-    saveDutyConfig() {
-
     },
     // 清除值班配置
-    clearDutyConfig(customerID) {
-      this.$api.customerManage.clearDutyConfig(customerID).then((res) => {
+    clearDutyConfig({row}) {
+      this.$api.customerManage.clearDutyConfig(row.id).then((res) => {
         if (res.code === 200) {
           this.$message("清除值班配置成功")
         }
@@ -287,11 +283,12 @@ export default {
     // 获取详情数据
     getDutyConfig(customerId) {
       this.$api.customerManage.getDutyConfig(customerId).then(res => {
-
         this.formData.dutyCustomerId = res.data.dutyCustomerId
-        if (res.data.dutyDateTimeList != null && res.data.dutyDateTimeList.length > 0) {
-          this.formData.dutyDateTimeList = res.data.dutyDateTimeList
-        }
+        res.data.dutyDateTimeList.map(item => {
+          this.startTime = dayjs(item.startTime).valueOf()
+          this.endTime = dayjs(item.endTime).valueOf()
+        })
+        this.formData.dutyDateTimeList = res.data.dutyDateTimeList
       })
     },
     openDialog({row}) {
@@ -302,31 +299,40 @@ export default {
       this.dialogVisibleDuty = true;
     },
     addTime() {
-      this.formData.dutyTimes.push({
+      this.formData.dutyDateTimeList.push({
         startTime: new Date().setHours(8, 30, 0),
         endTime: new Date().setHours(18, 30, 0)
       });
     },
     removeTime(index) {
-      if (this.formData.dutyTimes.length === 1) {
+      if (this.formData.dutyDateTimeList.length === 1) {
         this.$message.warning('请至少保留一条数据');
         return;
       }
-      this.formData.dutyTimes.splice(index, 1);
+      this.formData.dutyDateTimeList.splice(index, 1);
     },
     handleCancel() {
       this.resetFormData();
       this.dialogVisibleDuty = false;
       this.$message({type: 'info', message: '已取消操作'});
     },
-
+    dutyConfigData() {
+      return {
+        customerId: this.formData.customerId,
+        dutyCustomerId: this.formData.dutyCustomerId,
+        dutyDateTimeList: this.formData.dutyDateTimeList.map(t => ({
+          startTime: dayjs(t.start).format('YYYY-MM-DD HH:mm:ss'),
+          endTime: dayjs(t.end).format('YYYY-MM-DD HH:mm:ss')
+        }))
+      }
+    },
     // 确认操作
     handleConfirm() {
       // 数据校验
       if (!this.validateTime()) return;
 
       // 提交逻辑(示例)
-      this.$api.customerManage.dutyConfig(this.formData)
+      this.$api.customerManage.dutyConfig(this.dutyConfigData())
         .then((res) => {
           if (res.code === 200) {
             this.$message.success('保存成功');
@@ -343,7 +349,7 @@ export default {
 
     // 时间有效性校验
     validateTime() {
-      for (const time of this.formData.dutyTimes) {
+      for (const time of this.formData.dutyDateTimeList) {
         if (new Date(time.start) >= new Date(time.end)) {
           this.$message.error('结束时间必须晚于开始时间');
           return false;
@@ -354,7 +360,7 @@ export default {
   },
   computed: {
     showAddButton() {
-      return this.formData.dutyTimes.length < 10;
+      return this.formData.dutyDateTimeList.length < 10;
     }
   },
 }
@@ -381,6 +387,7 @@ export default {
                        button2Name="编辑" @handleButton2="handleEdit"
                        button3Name="删除" @handleButton3="deleteCustomer"
                        button4Name="值班配置" @handleButton4="openDialog"
+                       button5Name="清除值班配置" @handleButton5="clearDutyConfig"
       >
       </kt-common-table>
 
@@ -488,7 +495,7 @@ export default {
       <el-form :model="formData" label-width="100px" label-position="right">
         <!-- 当前客服(只读) -->
         <el-form-item label="当前客服">
-          <el-input v-model="currentService" clearable readonly></el-input>
+          <el-input v-model="formData.nickname" width="700px" clearable readonly></el-input>
         </el-form-item>
 
         <!-- 值班客服(可编辑) -->