|
@@ -1,83 +1,94 @@
|
|
|
-<template>
|
|
|
- <PageWrapper
|
|
|
- title="可展开表格"
|
|
|
- content="TableAction组件可配置stopButtonPropagation来阻止操作按钮的点击事件冒泡,以便配合Table组件的expandRowByClick"
|
|
|
- >
|
|
|
- <BasicTable @register="registerTable">
|
|
|
+ <template>
|
|
|
+ <div>
|
|
|
+ <BasicTable @register="registerTable" @editEnd="editEnd">
|
|
|
<template #toolbar>
|
|
|
- <a-button type="primary" @click="exportExcel"> 导出</a-button>
|
|
|
+ <a-button type="primary" @click="openModal(true)"> 新增职位</a-button>
|
|
|
</template>
|
|
|
- <!-- <template #expandedRowRender="{ record }">
|
|
|
- <div>
|
|
|
- <a-descriptions title="信息组" :column="3">
|
|
|
- <a-descriptions-item label="负责人"> 林东东{{record.no}} </a-descriptions-item>
|
|
|
- <a-descriptions-item label="角色码"> 1234567 </a-descriptions-item>
|
|
|
- <a-descriptions-item label="所属部门"> XX公司 - YY部 </a-descriptions-item>
|
|
|
- <a-descriptions-item label="过期时间"> 2017-08-08 </a-descriptions-item>
|
|
|
- <a-descriptions-item label="描述" :span="2">
|
|
|
- 这段描述很长很长很长很长很长很长很长很长很长很长很长很长很长很长...
|
|
|
- </a-descriptions-item>
|
|
|
- <a-descriptions-item label="商品图片" :span="1">
|
|
|
- <TableImg style="margin: 0"
|
|
|
- :size="120"
|
|
|
- :simpleShow="true"
|
|
|
- :imgList="[record.appListPicUrl || 'http://zfb-4dkankan.oss-cn-shenzhen.aliyuncs.com/sceneLogo/1653644220202_3ee8b3c006e74012a82f2b286b2f4914.png']"
|
|
|
- />
|
|
|
- </a-descriptions-item>
|
|
|
- </a-descriptions>
|
|
|
- </div>
|
|
|
- </template> -->
|
|
|
- <template #bodyCell="{ column, record }">
|
|
|
- <template v-if="column.key === 'action'">
|
|
|
+ <template #action="{ record }">
|
|
|
<TableAction
|
|
|
stopButtonPropagation
|
|
|
:actions="[
|
|
|
{
|
|
|
+ label: '编辑',
|
|
|
+ icon: 'ep:edit',
|
|
|
+ ifShow:record.isPush == 0,
|
|
|
+ onClick: handleEdit.bind(null, record),
|
|
|
+ },{
|
|
|
label: '删除',
|
|
|
icon: 'ic:outline-delete-outline',
|
|
|
- onClick: handleDelete.bind(null, record),
|
|
|
- },
|
|
|
- ]"
|
|
|
- :dropDownActions="[
|
|
|
- {
|
|
|
- label: '启用',
|
|
|
popConfirm: {
|
|
|
- title: '是否启用?',
|
|
|
- confirm: handleOpen.bind(null, record),
|
|
|
+ title: '是否确认删除',
|
|
|
+ confirm: handleDelete.bind(null, record),
|
|
|
},
|
|
|
},
|
|
|
]"
|
|
|
/>
|
|
|
- </template>
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
- </PageWrapper>
|
|
|
+ <addRecruitModal @register="register" @update="reload" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { defineComponent, h } from 'vue';
|
|
|
import { BasicTable, useTable, TableAction, BasicColumn, TableImg, FormProps } from '/@/components/Table';
|
|
|
import { PageWrapper } from '/@/components/Page';
|
|
|
import { Time } from '/@/components/Time';
|
|
|
+ import { employNoteList, addOrUpdate, employNoteIsTop, NewPublicNews, employNoteIsPush } from '/@/api/operate'
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
import { Descriptions } from 'ant-design-vue';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { Switch } from 'ant-design-vue';
|
|
|
-
|
|
|
+ import addRecruitModal from './components/recruit/addModal.vue'
|
|
|
export default defineComponent({
|
|
|
components: {
|
|
|
BasicTable,
|
|
|
TableAction,
|
|
|
PageWrapper,
|
|
|
TableImg,
|
|
|
+ addRecruitModal,
|
|
|
[Descriptions.name]: Descriptions,
|
|
|
[Descriptions.Item.name]: Descriptions.Item,
|
|
|
},
|
|
|
setup() {
|
|
|
const { t } = useI18n();
|
|
|
const { createMessage } = useMessage();
|
|
|
+ const [register, { openModal }] = useModal();
|
|
|
const columns: BasicColumn[] = [
|
|
|
+
|
|
|
+ {
|
|
|
+ title: '职位名称',
|
|
|
+ dataIndex: 'workName',
|
|
|
+ ellipsis: false,
|
|
|
+ width: 250,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '工作地点',
|
|
|
+ dataIndex: 'workAddress',
|
|
|
+ ellipsis: false,
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '薪资待遇',
|
|
|
+ dataIndex: 'salary',
|
|
|
+ ellipsis: false,
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
{
|
|
|
- title: '时间',
|
|
|
+ title: '招聘人数',
|
|
|
+ dataIndex: 'employNum',
|
|
|
+ width: 150,
|
|
|
+ edit: true,
|
|
|
+ editRule: async (text) => {
|
|
|
+ if (text < 1) {
|
|
|
+ return '招聘人数应大于0';
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ },
|
|
|
+ editComponent: 'InputNumber',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建时间',
|
|
|
dataIndex: 'createTime',
|
|
|
width: 150,
|
|
|
customRender: ({ record }) => {
|
|
@@ -91,87 +102,51 @@
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- title: '订单号',
|
|
|
- dataIndex: 'orderSn',
|
|
|
- ellipsis: false,
|
|
|
- width: 180,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '用户名',
|
|
|
- dataIndex: 'nickName',
|
|
|
- width: 80,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '订单金额',
|
|
|
- dataIndex: 'brandName',
|
|
|
- width: 80,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '支付方式',
|
|
|
- dataIndex: 'orderType',
|
|
|
- slots: { customRender: 'orderType' },
|
|
|
- width: 80,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '订单状态',
|
|
|
- dataIndex: 'orderStatus',
|
|
|
- slots: { customRender: 'orderStatus' },
|
|
|
+ title: '状态',
|
|
|
+ dataIndex: 'isPush',
|
|
|
width: 80,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '上架状态',
|
|
|
- dataIndex: 'isOnSale',
|
|
|
- width: 180,
|
|
|
customRender: ({ record }) => {
|
|
|
if (!Reflect.has(record, 'pendingStatus')) {
|
|
|
record.pendingStatus = false;
|
|
|
}
|
|
|
return h(Switch, {
|
|
|
- checked: record.isOnSale === 1,
|
|
|
- checkedChildren: '上架',
|
|
|
- unCheckedChildren: '下架',
|
|
|
+ checked: record.isPush === 1,
|
|
|
+ checkedChildren: '已发布',
|
|
|
+ unCheckedChildren: '未发布',
|
|
|
loading: false,
|
|
|
onChange: async (checked: boolean) => {
|
|
|
record.pendingStatus = true;
|
|
|
const id: string = record.id || '';
|
|
|
const newStatus = checked ? 1 : 0;
|
|
|
- if (checked) {
|
|
|
- Reflect.set(record, 'isOnSale', newStatus);
|
|
|
- // await EnSaleApi([id]);
|
|
|
- } else {
|
|
|
- Reflect.set(record, 'isOnSale', newStatus);
|
|
|
- // await UnSaleApi([id]);
|
|
|
- }
|
|
|
+ Reflect.set(record, 'isPush', newStatus);
|
|
|
+ await employNoteIsPush({id:id,isPush:newStatus});
|
|
|
createMessage.success(t('common.optSuccess'));
|
|
|
+ // reload()
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
title: '置顶',
|
|
|
- dataIndex: 'isOnSale',
|
|
|
- width: 180,
|
|
|
+ dataIndex: 'isTop',
|
|
|
+ width: 80,
|
|
|
customRender: ({ record }) => {
|
|
|
if (!Reflect.has(record, 'pendingStatus')) {
|
|
|
record.pendingStatus = false;
|
|
|
}
|
|
|
return h(Switch, {
|
|
|
- checked: record.isOnSale === 1,
|
|
|
+ checked: record.isTop === 1,
|
|
|
checkedChildren: '是',
|
|
|
unCheckedChildren: '否',
|
|
|
loading: false,
|
|
|
onChange: async (checked: boolean) => {
|
|
|
record.pendingStatus = true;
|
|
|
- // const id: string = record.id || '';
|
|
|
+ const id: string = record.id || '';
|
|
|
const newStatus = checked ? 1 : 0;
|
|
|
- if (checked) {
|
|
|
- Reflect.set(record, 'isOnSale', newStatus);
|
|
|
- // await EnSaleApi([id]);
|
|
|
- } else {
|
|
|
- Reflect.set(record, 'isOnSale', newStatus);
|
|
|
- // await UnSaleApi([id]);
|
|
|
- }
|
|
|
+ // Reflect.set(record, 'isOnSale', newStatus);
|
|
|
+ await employNoteIsTop({id,isTop:newStatus});
|
|
|
createMessage.success(t('common.optSuccess'));
|
|
|
+ reload()
|
|
|
},
|
|
|
});
|
|
|
},
|
|
@@ -182,92 +157,91 @@
|
|
|
schemas: [
|
|
|
{
|
|
|
field: 'sceneName',
|
|
|
- label: t('routes.scenes.anchorRoom'),
|
|
|
- component: 'Input',
|
|
|
+ label: t('routes.operate.releaseTime'),
|
|
|
+ component: 'RangePicker',
|
|
|
componentProps: {
|
|
|
maxLength: 100,
|
|
|
+ format: 'YYYY-MM-DD HH:mm',
|
|
|
+ showTime: true,
|
|
|
},
|
|
|
colProps: {
|
|
|
- xl: 5,
|
|
|
- xxl: 5,
|
|
|
+ xl: 11,
|
|
|
+ xxl: 11,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
field: 'type',
|
|
|
- label: t('common.type'),
|
|
|
- component: 'ApiSelect',
|
|
|
- colProps: {
|
|
|
- xl: 5,
|
|
|
- xxl: 5,
|
|
|
- },
|
|
|
- componentProps: {
|
|
|
- // api: brandTypeListApi,
|
|
|
- resultField: 'list',
|
|
|
- labelField: 'name',
|
|
|
- valueField: 'brandType',
|
|
|
- params: {
|
|
|
- page: 1,
|
|
|
- limit: 1000,
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- field: 'livestreamStatus',
|
|
|
- label: t('routes.scenes.livestreamStatus'),
|
|
|
- component: 'Select',
|
|
|
+ label: t('routes.operate.newsTitle'),
|
|
|
+ component: 'Input',
|
|
|
colProps: {
|
|
|
- xl: 5,
|
|
|
- xxl: 5,
|
|
|
- },
|
|
|
- componentProps: {
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: t('common.all'),
|
|
|
- value: '',
|
|
|
- key: '0',
|
|
|
- },
|
|
|
- {
|
|
|
- label: t('common.yes'),
|
|
|
- value: 1,
|
|
|
- key: '1',
|
|
|
- },
|
|
|
- {
|
|
|
- label: t('common.no'),
|
|
|
- value: 0,
|
|
|
- key: '2',
|
|
|
- },
|
|
|
- ],
|
|
|
+ xl: 6,
|
|
|
+ xxl: 6,
|
|
|
},
|
|
|
},
|
|
|
],
|
|
|
};
|
|
|
- const [registerTable] = useTable({
|
|
|
- api: ()=>{
|
|
|
- return []
|
|
|
- },
|
|
|
- title: '可展开表格演示',
|
|
|
- titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
|
|
|
+ const [registerTable,{reload}] = useTable({
|
|
|
+ api: employNoteList,
|
|
|
+ title: '新闻列表',
|
|
|
columns: columns,
|
|
|
useSearchForm: true,
|
|
|
formConfig: searchForm,
|
|
|
showTableSetting: true,
|
|
|
+ showIndexColumn:false,
|
|
|
rowKey: 'id',
|
|
|
+ fetchSetting: {
|
|
|
+ pageField: 'pageNum',
|
|
|
+ sizeField: 'pageSize',
|
|
|
+ listField: 'list',
|
|
|
+ totalField: 'total',
|
|
|
+ },
|
|
|
+ actionColumn: {
|
|
|
+ width: 220,
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ },
|
|
|
canResize: false,
|
|
|
});
|
|
|
- function handleDelete(record: Recordable) {
|
|
|
- console.log('点击了删除', record);
|
|
|
+ async function handleDelete(record: Recordable) {
|
|
|
+ await newDelete({id:record.id})
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ async function handlePublish(record: Recordable) {
|
|
|
+ console.log('点击了发布', record);
|
|
|
+ await NewPublicNews({id:record.id,isPublic:1})
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ function handleEdit(record: Recordable) {
|
|
|
+ console.log('点击了编辑', record);
|
|
|
+ openModal(true,record)
|
|
|
}
|
|
|
- function handleOpen(record: Recordable) {
|
|
|
- console.log('点击了启用', record);
|
|
|
+ async function handleWithdraw(record: Recordable) {
|
|
|
+ await NewPublicNews({id:record.id,isPublic:0})
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
}
|
|
|
- function exportExcel(record: Recordable) {
|
|
|
- console.log('点击了导出', record);
|
|
|
+ function hendleAddNew(){
|
|
|
+ console.log('新增新闻');
|
|
|
}
|
|
|
+ async function editEnd({record, index, key, value}){
|
|
|
+ console.log('editEnd',record, index, key, value)
|
|
|
+ await addOrUpdate(record)
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ }
|
|
|
return {
|
|
|
registerTable,
|
|
|
handleDelete,
|
|
|
- handleOpen,
|
|
|
- exportExcel,
|
|
|
+ handleEdit,
|
|
|
+ handleWithdraw,
|
|
|
+ handlePublish,
|
|
|
+ hendleAddNew,
|
|
|
+ reload,
|
|
|
+ register,
|
|
|
+ openModal,
|
|
|
+ editEnd,
|
|
|
};
|
|
|
},
|
|
|
});
|