|
@@ -1,44 +1,173 @@
|
|
|
<template>
|
|
|
<div class="unit-manage flex flex-col">
|
|
|
<SearchForm :fields="fields" :params="params"></SearchForm>
|
|
|
- <div class="flex-1 page-wrap"> </div>
|
|
|
+ <div class="flex-1 page-wrap">
|
|
|
+ <div class="btn-group">
|
|
|
+ <t-button theme="success" @click="handleAdd">新增</t-button>
|
|
|
+ </div>
|
|
|
+ <t-table
|
|
|
+ size="small"
|
|
|
+ row-key="id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="tableData"
|
|
|
+ bordered
|
|
|
+ :pagination="{
|
|
|
+ defaultCurrent: 1,
|
|
|
+ defaultPageSize: 10,
|
|
|
+ onChange,
|
|
|
+ total: pagination.total,
|
|
|
+ }"
|
|
|
+ :selected-row-keys="selectedRowKeys"
|
|
|
+ select-on-row-click
|
|
|
+ @select-change="selectChange"
|
|
|
+ >
|
|
|
+ </t-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <AddUnitDialog
|
|
|
+ v-model:visible="showAddUnitDialog"
|
|
|
+ :title="title"
|
|
|
+ :type="type"
|
|
|
+ :handleSave="handleSave"
|
|
|
+ :formData="formData"
|
|
|
+ ref="formDialogRef"
|
|
|
+ ></AddUnitDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="jsx" name="UnitManage">
|
|
|
import { ref, reactive } from 'vue';
|
|
|
+import { getTableData } from '@/api/test';
|
|
|
+import useFetchTable from '@/hooks/useFetchTable';
|
|
|
+import useTableCrud from '@/hooks/useTableCrud';
|
|
|
+import AddUnitDialog from './add-unit-dialog.vue';
|
|
|
+const formDialogRef = ref(null);
|
|
|
+const selectedRowKeys = ref([]);
|
|
|
+const selectChange = (value, { selectedRowData }) => {
|
|
|
+ selectedRowKeys.value = value;
|
|
|
+};
|
|
|
+
|
|
|
+const columns = [
|
|
|
+ { colKey: 'a', title: '服务单元名称', width: 140 },
|
|
|
+ { colKey: 'b', title: '服务开始时间', width: 140 },
|
|
|
+ { colKey: 'c', title: '服务截止时间', width: 140 },
|
|
|
+ { colKey: 'd', title: '业务类型', minWidth: 100 },
|
|
|
+ { colKey: 'e', title: '负责人', width: 80 },
|
|
|
+ { colKey: 'f', title: '区域配比', width: 80 },
|
|
|
+ { colKey: 'g', title: '当前状态', width: 80 },
|
|
|
+ { colKey: 'h', title: '创建人', width: 80 },
|
|
|
+ { colKey: 'i', title: '创建时间', width: 140 },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ colKey: 'operate',
|
|
|
+ fixed: 'right',
|
|
|
+ width: 260,
|
|
|
+ cell: (h, { row }) => {
|
|
|
+ return (
|
|
|
+ <div class="table-operations">
|
|
|
+ <t-link
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ onClick={(e) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ handleEdit(row);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </t-link>
|
|
|
+ <t-link theme="primary" hover="color">
|
|
|
+ 作废
|
|
|
+ </t-link>
|
|
|
+ <t-link theme="primary" hover="color">
|
|
|
+ 重启
|
|
|
+ </t-link>
|
|
|
+ <t-link theme="primary" hover="color">
|
|
|
+ 关闭
|
|
|
+ </t-link>
|
|
|
+ <t-link theme="primary" hover="color">
|
|
|
+ 设置考勤组
|
|
|
+ </t-link>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+];
|
|
|
+const {
|
|
|
+ loading: tableLoading,
|
|
|
+ pagination,
|
|
|
+ tableData,
|
|
|
+ fetchData,
|
|
|
+ onChange,
|
|
|
+} = useFetchTable(getTableData);
|
|
|
+
|
|
|
+const add = async () => {
|
|
|
+ await 1;
|
|
|
+ alert(1);
|
|
|
+};
|
|
|
+const update = async () => {};
|
|
|
+const refresh = async () => {};
|
|
|
+
|
|
|
+const {
|
|
|
+ visible: showAddUnitDialog,
|
|
|
+ type,
|
|
|
+ title,
|
|
|
+ loading: dialogLoading,
|
|
|
+ handleAdd,
|
|
|
+ handleEdit,
|
|
|
+ handleSave,
|
|
|
+ formData,
|
|
|
+ formRef,
|
|
|
+} = useTableCrud(
|
|
|
+ {
|
|
|
+ name: '服务管理单元',
|
|
|
+ doCreate: add,
|
|
|
+ doUpdate: update,
|
|
|
+ refresh: refresh,
|
|
|
+ initForm: {
|
|
|
+ a: '',
|
|
|
+ b: '',
|
|
|
+ c: '',
|
|
|
+ d: '',
|
|
|
+ e: '',
|
|
|
+ f: '',
|
|
|
+ g: '',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ formDialogRef
|
|
|
+);
|
|
|
+
|
|
|
const fields = ref([
|
|
|
{
|
|
|
prop: 'a',
|
|
|
label: '业务类型',
|
|
|
type: 'select',
|
|
|
- labelWidth: '80px',
|
|
|
- colSpan: 4,
|
|
|
+ labelWidth: '100px',
|
|
|
+ colSpan: 5,
|
|
|
},
|
|
|
{
|
|
|
prop: 'b',
|
|
|
label: '负责人',
|
|
|
type: 'select',
|
|
|
- labelWidth: '80px',
|
|
|
- colSpan: 4,
|
|
|
+ labelWidth: '100px',
|
|
|
+ colSpan: 5,
|
|
|
},
|
|
|
{
|
|
|
prop: 'c',
|
|
|
label: '当前状态',
|
|
|
type: 'select',
|
|
|
- labelWidth: '80px',
|
|
|
- colSpan: 4,
|
|
|
+ labelWidth: '100px',
|
|
|
+ colSpan: 5,
|
|
|
},
|
|
|
{
|
|
|
prop: 'd',
|
|
|
label: '创建时间',
|
|
|
- type: 'select',
|
|
|
- labelWidth: '80px',
|
|
|
- colSpan: 4,
|
|
|
+ type: 'daterange',
|
|
|
+ labelWidth: '100px',
|
|
|
+ colSpan: 7,
|
|
|
},
|
|
|
{
|
|
|
type: 'buttons',
|
|
|
- colSpan: 3,
|
|
|
+ colSpan: 2,
|
|
|
children: [
|
|
|
{
|
|
|
type: 'button',
|
|
@@ -48,17 +177,17 @@ const fields = ref([
|
|
|
},
|
|
|
{
|
|
|
prop: 'e',
|
|
|
- label: '创建时间',
|
|
|
+ label: '服务单元名称',
|
|
|
labelWidth: '100px',
|
|
|
- colSpan: 4,
|
|
|
+ colSpan: 5,
|
|
|
},
|
|
|
]);
|
|
|
const params = reactive({
|
|
|
a: '',
|
|
|
b: '',
|
|
|
c: '',
|
|
|
- d: '',
|
|
|
- e: [],
|
|
|
+ d: [],
|
|
|
+ e: '',
|
|
|
});
|
|
|
</script>
|
|
|
|