zs 1 anno fa
parent
commit
8527fff82b
1 ha cambiato i file con 22 aggiunte e 5 eliminazioni
  1. 22 5
      src/views/core/opinion/index.vue

+ 22 - 5
src/views/core/opinion/index.vue

@@ -5,13 +5,20 @@
         <el-option v-for="i in typeList" :key="i._id" :label="i.label" :value="i.value"></el-option>
       </template>
       <template #status>
-        <el-option v-for="i in statusList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+        <el-select clearable filterable allow-create default-first-option v-model="searchForm.status" placeholder="请选择状态" style="width: 100%; min-width: 200px">
+          <el-option v-for="i in statusList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+        </el-select>
       </template>
       <template #userType>
         <el-option v-for="i in userTypeList" :key="i._id" :label="i.label" :value="i.value"></el-option>
       </template>
     </custom-search-bar>
-    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @view="toView"></custom-table>
+    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @view="toView">
+      <template #status="{ row }">
+        <el-tag v-if="row.status == '1'" type="success">已解决</el-tag>
+        <el-tag v-else type="info">未解决</el-tag>
+      </template>
+    </custom-table>
     <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
       <el-row>
         <el-col :span="24" v-if="dialog.type == '1'">
@@ -36,7 +43,7 @@
 </template>
 
 <script setup>
-import { get } from 'lodash-es'
+import { cloneDeep, get } from 'lodash-es'
 const { t } = useI18n()
 const $checkRes = inject('$checkRes')
 // 接口
@@ -47,11 +54,11 @@ const store = OpinionStore()
 const data = ref([])
 const searchForm = ref({})
 const fields = [
-  { label: t('pages.opinion.user_name'), model: 'user_name', isSearch: true },
+  { label: t('pages.opinion.user_name'), model: 'user_name' },
   { label: t('pages.opinion.userType'), model: 'userType', format: (i) => getDict(i, 'userType'), type: 'select', isSearch: true },
   { label: t('pages.opinion.type'), model: 'type', format: (i) => getDict(i, 'type'), type: 'select', isSearch: true },
   { label: t('pages.opinion.time'), model: 'time', type: 'date' },
-  { label: t('pages.opinion.status'), model: 'status', format: (i) => getDict(i, 'status'), type: 'select' }
+  { label: t('pages.opinion.status'), model: 'status', custom: true, isSearch: true }
 ]
 let skip = 0
 let limit = inject('limit')
@@ -131,6 +138,16 @@ const toClose = () => {
   form.value = {}
   dialog.value = { show: false }
 }
+// 保存
+const toSave = async () => {
+  const data = cloneDeep(form.value)
+  delete data.user_name
+  let res = await store.update(data)
+  if ($checkRes(res, true)) {
+    search({ skip: 0, limit })
+    toClose()
+  }
+}
 </script>
 <style scoped lang="scss">
 .images {