| <template> | 
|   <LoadingLayout :loading="state.loading"> | 
|     <AppContainer> | 
|       <ProTableQueryFilterBar @on-reset="reset"> | 
|         <template #query> | 
|           <QueryFilterItem> | 
|             <FieldSelect | 
|               v-model="extraParamState.pageType" | 
|               placeholder="广告页面" | 
|               :value-enum="[]" | 
|               clearable | 
|               @change="getAdvertiseOnShowList()" | 
|             /> | 
|           </QueryFilterItem> | 
|           <QueryFilterItem tip-content="状态"> | 
|             <FieldRadio | 
|               v-model="extraParamState.status" | 
|               :value-enum="[ | 
|                 { value: true, label: '展示中' }, | 
|                 { value: false, label: '已下架' }, | 
|               ]" | 
|               buttonStyle | 
|               showAllBtn | 
|               @change="getAdvertiseOnShowList()" | 
|             /> | 
|           </QueryFilterItem> | 
|           <QueryFilterItem tip-content="广告开始时间"> | 
|             <FieldDatePicker | 
|               v-model="extraParamState.beginDate" | 
|               type="daterange" | 
|               range-separator="~" | 
|               start-placeholder="开始日期" | 
|               end-placeholder="结束日期" | 
|               clearable | 
|               @change="getAdvertiseOnShowList()" | 
|             ></FieldDatePicker> | 
|           </QueryFilterItem> | 
|           <QueryFilterItem tip-content="广告结束时间"> | 
|             <FieldDatePicker | 
|               v-model="extraParamState.endDate" | 
|               type="daterange" | 
|               range-separator="~" | 
|               start-placeholder="开始日期" | 
|               end-placeholder="结束日期" | 
|               clearable | 
|               @change="getAdvertiseOnShowList()" | 
|             ></FieldDatePicker> | 
|           </QueryFilterItem> | 
|           <QueryFilterItem> | 
|             <SearchInput | 
|               v-model="extraParamState.keyword" | 
|               style="width: 260px" | 
|               placeholder="广告名称" | 
|               @on-click-search="getAdvertiseOnShowList" | 
|             > | 
|             </SearchInput> | 
|           </QueryFilterItem> | 
|         </template> | 
|         <template #btn> | 
|           <el-button | 
|             v-if="checkSubModuleItemShow('pageButton', 'addBtn')" | 
|             @click="openDialog()" | 
|             icon="Plus" | 
|             type="primary" | 
|             >新增</el-button | 
|           > | 
|         </template> | 
|       </ProTableQueryFilterBar> | 
|       <ProTableV2 v-bind="proTableProps" :columns="column" :operationBtns="operationBtns"> | 
|       </ProTableV2> | 
|     </AppContainer> | 
|   </LoadingLayout> | 
| </template> | 
|   | 
| <script setup lang="ts"> | 
| import { | 
|   ProTableQueryFilterBar, | 
|   OperationBtnType, | 
|   ProTableV2, | 
|   SearchInput, | 
|   LoadingLayout, | 
|   AppContainer, | 
|   QueryFilterItem, | 
|   useTable, | 
|   useFormDialog, | 
|   FieldDatePicker, | 
|   FieldSelect, | 
|   FieldRadio, | 
|   UploadUserFile, | 
| } from '@bole-core/components'; | 
| import { useAccess } from '@/hooks'; | 
| import { FlexWorkerEleSignEnumText } from '@/constants'; | 
| import { ModelValueType } from 'element-plus'; | 
| import { format, setOSSLink, convertApi2FormUrl, convertFormUrl2Api } from '@/utils'; | 
| import { Message } from '@bole-core/core'; | 
|   | 
| defineOptions({ | 
|   name: 'OperationManageList', | 
| }); | 
|   | 
| const operationBtnMap: Record<string, OperationBtnType> = { | 
|   editBtn: { emits: { onClick: (role) => openDialog(role) } }, | 
|   takeOnBtn: { | 
|     emits: { onClick: (role) => setAdvertiseOnShowStatus(role) }, | 
|     extraProps: { | 
|       hide: (row) => row.status, | 
|     }, | 
|   }, | 
|   takeDownBtn: { | 
|     emits: { onClick: (role) => setAdvertiseOnShowStatus(role) }, | 
|     props: { type: 'danger' }, | 
|     extraProps: { | 
|       hide: (row) => !row.status, | 
|     }, | 
|   }, | 
|   logBtn: { emits: { onClick: (role) => openDialog(role) } }, | 
| }; | 
|   | 
| const { checkSubModuleItemShow, column, operationBtns } = useAccess({ | 
|   operationBtnMap, | 
| }); | 
|   | 
| const BaseState = { | 
|   loading: true, | 
| }; | 
|   | 
| const state = reactive({ ...BaseState }); | 
|   | 
| onMounted(async () => { | 
|   await getAdvertiseOnShowList(); | 
|   state.loading = false; | 
| }); | 
|   | 
| const { | 
|   getDataSource: getAdvertiseOnShowList, | 
|   proTableProps, | 
|   paginationState, | 
|   extraParamState, | 
|   reset, | 
| } = useTable( | 
|   async ({ pageIndex, pageSize }, extraParamState) => { | 
|     try { | 
|       let params: API.GetUserClientForBackInput = { | 
|         pageModel: { | 
|           rows: pageSize, | 
|           page: pageIndex, | 
|           orderInput: extraParamState.orderInput, | 
|         }, | 
|         searchKeys: extraParamState.keyword, | 
|       }; | 
|       let res = await flexEnterpriseWokerServices.getUserClientList(params, { | 
|         showLoading: !state.loading, | 
|       }); | 
|       return res; | 
|     } catch (error) {} | 
|   }, | 
|   { | 
|     defaultExtraParams: { | 
|       keyword: '', | 
|       pageType: '' as any as number, | 
|       status: '' as any as boolean, | 
|       beginDate: [] as unknown as ModelValueType, | 
|       endDate: [] as unknown as ModelValueType, | 
|       orderInput: [{ property: 'sort', order: EnumPagedListOrder.Desc }], | 
|     }, | 
|     columnsRenderProps: {}, | 
|   } | 
| ); | 
|   | 
| function openDialog(row?) { | 
|   if (row) { | 
|     handleEdit({ | 
|       id: row.id, | 
|       pageType: row.pageType, | 
|       advertiseName: row.advertiseName, | 
|       advertiseLink: row.advertiseLink, | 
|       imgInfo: row.imgInfo.map((x) => convertApi2FormUrl(x.imgUrl)), | 
|       date: [format(row.advertiseBeginDate), format(row.advertiseEndDate)], | 
|       sort: row.sort, | 
|     }); | 
|   } else { | 
|     handleAdd(); | 
|   } | 
| } | 
|   | 
| const { dialogProps, handleAdd, handleEdit, editForm, dialogState } = useFormDialog({ | 
|   onConfirm: handleAddOrEdit, | 
|   defaultFormParams: { | 
|     title: '新增广告', | 
|     id: '', | 
|     pageType: '' as any as number, | 
|     advertiseName: '', | 
|     advertiseLink: '', | 
|     imgInfo: [] as UploadUserFile[], | 
|     date: [] as unknown as ModelValueType, | 
|     sort: 0, | 
|   }, | 
|   editTitle: '编辑广告', | 
| }); | 
|   | 
| async function handleAddOrEdit() { | 
|   try { | 
|   } catch (error) {} | 
| } | 
|   | 
| async function setAdvertiseOnShowStatus(row) { | 
|   try { | 
|   } catch (error) {} | 
| } | 
| </script> |