|
|
@@ -1,6 +1,6 @@
|
|
|
<script setup lang="tsx">
|
|
|
import { reactive, ref, unref } from 'vue'
|
|
|
-import { getPlanList } from '@/api/plan'
|
|
|
+import { getPlanList, recommendPlan } from '@/api/plan'
|
|
|
import { useTable } from '@/hooks/web/useTable'
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
import { Table, TableColumn } from '@/components/Table'
|
|
|
@@ -9,7 +9,7 @@ import { FormSchema } from '@/components/Form'
|
|
|
import { ContentWrap } from '@/components/ContentWrap'
|
|
|
import { Dialog } from '@/components/Dialog'
|
|
|
import { BaseButton } from '@/components/Button'
|
|
|
-import { ElTag } from 'element-plus'
|
|
|
+import { ElMessage, ElTag } from 'element-plus'
|
|
|
import { TableImage } from '@/components/tableImage'
|
|
|
// import Write from './components/Write.vue'
|
|
|
|
|
|
@@ -124,8 +124,8 @@ const tableColumns = reactive<TableColumn[]>([
|
|
|
width: 120
|
|
|
},
|
|
|
{
|
|
|
- field: 'status',
|
|
|
- label: '是否展示',
|
|
|
+ field: 'is_recommend',
|
|
|
+ label: '是否推荐',
|
|
|
width: 150,
|
|
|
slots: {
|
|
|
default: ({ row }: any) => {
|
|
|
@@ -133,9 +133,11 @@ const tableColumns = reactive<TableColumn[]>([
|
|
|
<>
|
|
|
<ElTag
|
|
|
class="mr-5px"
|
|
|
- type={row.status == 0 ? 'primary' : row.status == 1 ? 'success' : 'danger'}
|
|
|
+ type={
|
|
|
+ row.is_recommend == 0 ? 'warning' : row.is_recommend == 1 ? 'success' : 'danger'
|
|
|
+ }
|
|
|
>
|
|
|
- {row.status_chs}
|
|
|
+ {row.is_recommend == 0 ? '否' : '是'}
|
|
|
</ElTag>
|
|
|
</>
|
|
|
)
|
|
|
@@ -143,34 +145,35 @@ const tableColumns = reactive<TableColumn[]>([
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- field: 'reason',
|
|
|
- label: '审核意见',
|
|
|
- width: 120
|
|
|
+ field: 'action',
|
|
|
+ label: t('userDemo.action'),
|
|
|
+ width: 200,
|
|
|
+ fixed: 'right',
|
|
|
+ align: 'center',
|
|
|
+ headerAlign: 'center',
|
|
|
+ slots: {
|
|
|
+ default: (data: any) => {
|
|
|
+ const row = data.row
|
|
|
+ if (row.is_recommend == 1) {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <BaseButton link size="small" type="warning" onClick={() => changeStatus(0, row)}>
|
|
|
+ 取消推荐
|
|
|
+ </BaseButton>
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <BaseButton link size="small" type="primary" onClick={() => changeStatus(1, row)}>
|
|
|
+ 推荐
|
|
|
+ </BaseButton>
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- // {
|
|
|
- // field: 'action',
|
|
|
- // label: t('userDemo.action'),
|
|
|
- // width: 200,
|
|
|
- // fixed: 'right',
|
|
|
- // align: 'center',
|
|
|
- // headerAlign: 'center',
|
|
|
- // slots: {
|
|
|
- // default: (data: any) => {
|
|
|
- // const row = data.row
|
|
|
- // return (
|
|
|
- // <>
|
|
|
- // <BaseButton link size="small" type="primary" onClick={() => action('edit', row)}>
|
|
|
- // 编辑
|
|
|
- // </BaseButton>
|
|
|
- // <ElDivider direction="vertical" />
|
|
|
- // <BaseButton link size="small" type="danger" onClick={() => delAction(row)}>
|
|
|
- // 删除
|
|
|
- // </BaseButton>
|
|
|
- // </>
|
|
|
- // )
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
])
|
|
|
|
|
|
const searchSchema = reactive<FormSchema[]>([
|
|
|
@@ -271,6 +274,24 @@ const saveLoading = ref(false)
|
|
|
// })
|
|
|
// .catch(() => {})
|
|
|
// }
|
|
|
+const changeStatus = async (is_recommend, row) => {
|
|
|
+ const data: any = {
|
|
|
+ id: row.id,
|
|
|
+ recommend: is_recommend
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ await recommendPlan(data)
|
|
|
+ getList()
|
|
|
+ ElMessage({
|
|
|
+ showClose: true,
|
|
|
+ message: '设置成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ } finally {
|
|
|
+ }
|
|
|
+}
|
|
|
const save = async () => {
|
|
|
// // const write = unref(writeRef)
|
|
|
// // const formData = await write?.submit()
|