瀏覽代碼

意见反馈

Alex 9 月之前
父節點
當前提交
c9d3f68e9a

+ 85 - 39
src/views/optimization/fallback/components/deal-fallback.vue

@@ -1,53 +1,99 @@
 <!-- 搜索表单 -->
 <template>
-  <simple-form-modal
-    title="处理反馈"
-    :items="formItems"
-    ref="editRef"
-    :baseUrl="baseUrl"
-    @success="(data) => emit('done', data)"
-  ></simple-form-modal>
+  <el-dialog
+    v-model="visible"
+    :title="type === 'detail' ? '反馈详情' : '处理反馈'"
+    width="600px"
+    @open="handleDialogOpen"
+  >
+    <el-form ref="formRef" :model="form" label-width="100px">
+      <el-form-item label="联系方式">
+        <el-input v-model="form.mobile" disabled />
+      </el-form-item>
+      <el-form-item label="意见描述">
+        <el-input v-model="form.desc" type="textarea" :rows="4" disabled />
+      </el-form-item>
+      <el-form-item label="反馈图片">
+        <el-image
+          v-if="form.image"
+          :src="form.image"
+          style="width: 120px; height: 120px; border-radius: 4px"
+          fit="cover"
+        />
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="visible = false">取 消</el-button>
+        <template v-if="!type && form.status === 1">
+          <el-button type="primary" @click="handleProcessing">已反馈</el-button>
+          <el-button type="success" @click="handleFinish">已处理</el-button>
+        </template>
+      </span>
+    </template>
+  </el-dialog>
 </template>
 
 <script setup>
-  import { reactive, ref, defineEmits, getCurrentInstance } from 'vue';
-  import { useFormData } from '@/utils/use-form-data';
-  import SimpleFormModal from '@/components/CommonPage/SimpleFormModal.vue';
-  const { proxy } = getCurrentInstance();
+  import { ref, reactive } from 'vue';
+  import request from '@/utils/request';
+  import { ElMessage } from 'element-plus';
 
-  //获取省市
   const emit = defineEmits(['done']);
 
-  const formItems = reactive([
-    {
-      type: 'input',
-      label: '联系方式',
-      prop: 'mobile'
-    },
-    {
-      type: 'textarea',
-      label: '意见描述',
-      prop: 'desc'
-    },
-    {
-      type: 'imageUpload',
-      label: '反馈图片',
-      prop: 'image'
-    }
-  ]);
-
-  //默认值
-  const baseUrl = reactive({
-    add: '/baseinfo/schoolInfo/save',
-    update: '/baseinfo/schoolInfo/edit'
+  const visible = ref(false);
+  const type = ref('');
+  const form = reactive({
+    id: '',
+    mobile: '',
+    desc: '',
+    image: '',
+    status: 0
   });
-  const formData = ref({});
 
-  const editRef = ref(null);
-  function handleOpen(data = {}, type) {
-    formData.value = Object.assign(formData.value, data || {});
-    editRef.value?.handleOpen(formData.value, type);
+  // 打开弹窗
+  function handleOpen(data = {}, dialogType) {
+    type.value = dialogType;
+    Object.assign(form, data);
+    visible.value = true;
+  }
+
+  // 弹窗打开回调
+  function handleDialogOpen() {
+    // 可以在这里做一些初始化工作
+  }
+
+  // 处理中
+  async function handleProcessing() {
+    try {
+      await request.post(`/sys/suggestionLog/processing/${form.id}`);
+      ElMessage.success('操作成功');
+      visible.value = false;
+      emit('done');
+    } catch (error) {
+      console.error(error);
+    }
+  }
+
+  // 已处理
+  async function handleFinish() {
+    try {
+      await request.post(`/sys/suggestionLog/finish/${form.id}`);
+      ElMessage.success('操作成功');
+      visible.value = false;
+      emit('done');
+    } catch (error) {
+      console.error(error);
+    }
   }
 
   defineExpose({ handleOpen });
 </script>
+
+<style scoped>
+  .dialog-footer {
+    display: flex;
+    justify-content: flex-end;
+    gap: 8px;
+  }
+</style>

+ 8 - 5
src/views/optimization/fallback/components/page-search.vue

@@ -18,14 +18,17 @@
   const emit = defineEmits(['search']);
 
   const formItems = reactive([
-    { type: 'select', label: '意见类型', prop: 'fallbackType' },
-    { type: 'select', label: '状态', prop: 'status' },
-    { type: 'input', label: '用户UID', prop: 'userName' },
+    { type: 'input', label: '用户ID', prop: 'userId' },
+    { type: 'input', label: '昵称', prop: 'nickName' },
+    { type: 'input', label: '手机号', prop: 'mobile' },
+    { type: 'select', label: '状态', prop: 'status' }
   ]);
 
   const initKeys = reactive({
-    userName: '',
-    restrictType: ''
+    userId: '',
+    nickName: '',
+    mobile: '',
+    status: ''
   });
 
   const searchRef = ref(null);

+ 14 - 48
src/views/optimization/fallback/index.vue

@@ -8,15 +8,6 @@
       :tools="false"
     >
       <template #toolbar>
-        <el-button
-          type="danger"
-          plain
-          :icon="DeleteOutlined"
-          v-permission="'optimization:fallback:batchDelete'"
-          @click="handleBatchDelete()"
-        >
-          批量删除
-        </el-button>
         <el-button
           type="success"
           plain
@@ -27,6 +18,14 @@
           导出EXCEL
         </el-button>
       </template>
+      <template #status="{ row }">
+        <dict-data
+          code="feedback_status"
+          type="tag"
+          :model-value="row.status"
+        />
+      </template>
+
       <template #action="{ row }">
         <div>
           <el-button
@@ -57,39 +56,18 @@
   import CommonTable from '@/components/CommonPage/CommonTable.vue';
   import dealFallback from '@/views/optimization/fallback/components/deal-fallback.vue';
   import pageSearch from '@/views/optimization/fallback/components/page-search.vue';
-  import { useDictData } from '@/utils/use-dict-data';
 
   defineOptions({ name: 'fallbackList' });
-  const [useStatusDicts] = useDictData(['sys_normal_disable']);
 
   /** 表格列配置 */
   const columns = ref([
-    {
-      type: 'selection',
-      columnKey: 'selection',
-      width: 50,
-      align: 'center',
-      fixed: 'left'
-    },
     { type: 'index', label: '序号', width: 60, align: 'center' },
-    {
-      label: '状态',
-      prop: 'useStatus',
-      align: 'center',
-      formatter: (row) =>
-        useStatusDicts.value.find((d) => d.dictValue == row.useStatus)
-          ?.dictLabel
-    },
-    { label: '用户UID', prop: 'uid', align: 'center' },
+    { label: '状态', prop: 'status', align: 'center', slot: 'status' },
+    { label: '用户名', prop: 'nickName', align: 'center' },
     { label: '联系方式', prop: 'mobile', align: 'center' },
-    { label: '意见类型', prop: 'type', align: 'center' },
+    { label: '意见类型', prop: 'reason', align: 'center', minWidth: 150 },
     { label: '反馈时间', prop: 'createTime', align: 'center', width: 180 },
-    {
-      label: '意见描述',
-      prop: 'paymentCode',
-      align: 'center',
-      minWidth: 200
-    },
+    { label: '意见描述', prop: 'description', align: 'center', minWidth: 200 },
     {
       columnKey: 'action',
       label: '操作',
@@ -103,8 +81,8 @@
   const pageRef = ref(null);
 
   const pageConfig = reactive({
-    pageUrl: '/baseinfo/godown/pagelist',
-    exportUrl: '/baseinfo/godown/export',
+    pageUrl: '/sys/suggestionLog/pagelist',
+    exportUrl: '/sys/suggestionLog/export',
     fileName: '意见反馈',
     cacheKey: 'fallbackTable'
   });
@@ -114,18 +92,6 @@
     pageRef.value?.reload(where);
   }
 
-  //批量删除
-  function handleBatchDelete(row) {
-    let selections = row ? [row] : pageRef.value?.getSelections();
-    let ids = selections.map((item) => item.id).join(',');
-    let url = `/baseinfo/schoolInfo/removeById/${ids}`;
-    pageRef.value?.operatBatch({
-      title: '确认删除?',
-      method: 'post',
-      url,
-      row
-    });
-  }
   //导出excel
   function handleExportExcel() {
     pageRef.value?.exportData('意见反馈');