From e9b3c9548c7701e3dc2cc88754f643ccbc447335 Mon Sep 17 00:00:00 2001
From: Cloud Zhang <941187371@qq.com>
Date: 星期五, 24 五月 2024 13:23:56 +0800
Subject: [PATCH] 班制(半成品)

---
 src/api/tigerapi/bas/shift.ts                     |  218 +++++++++++
 src/views/tigerprojects/bas/shift/shift.data.ts   |  290 +++++++++++++++
 src/views/tigerprojects/bas/shift/index.vue       |  144 +++++++
 src/views/tigerprojects/bas/shift/ShiftDrawer.vue |  124 ++++++
 src/views/tigerprojects/bas/shift/shiftDetail.vue |  325 +++++++++++++++++
 5 files changed, 1,101 insertions(+), 0 deletions(-)

diff --git a/src/api/tigerapi/bas/shift.ts b/src/api/tigerapi/bas/shift.ts
new file mode 100644
index 0000000..d7d86c2
--- /dev/null
+++ b/src/api/tigerapi/bas/shift.ts
@@ -0,0 +1,218 @@
+import { buildUUID } from '../../../utils/uuid';
+import { ApiAction, ApiActionPage } from '../../model/baseModel';
+import { genAction, Api } from '../system';
+import { useUserStore } from '/@/store/modules/user';
+import { defHttp } from '/@/utils/http/axios';
+import { isNullOrEmpty } from '/@/utils/is';
+import { formatToDateTime } from '/@/utils/dateUtil';
+
+/*
+ * 鑾峰彇鐝埗
+ */
+
+export const getListByPage = async (params: any) => {
+  let order = ''
+  if (params.order != undefined) {
+    order = params.order == 'descend' ? (params.field + ' desc') : params.field
+  }
+  let sqlcmd = '1=1';
+  if (params?.SFTS_CODE != undefined && params?.SFTS_CODE != '') {
+    sqlcmd += " And SFTS_CODE like '%" + params?.SFTS_CODE + "%'";
+  }
+
+  let option = {
+    UserId: useUserStore().getUserInfo.userId as string,
+    ByOrg: true,
+    OrgCode: useUserStore().getUserInfo.orgCode as string
+  }
+  if (!isNullOrEmpty(params.page)) {
+    const usParams = genAction('MES_SHIFT_SYS', {
+      QueryAble_T: '',
+      where: sqlcmd,
+      order: order,
+      page: {
+        pageAble_T: 'string',
+        draw: 1,
+        pageIndex: params.page,
+        pageSize: params.pageSize,
+      }
+    });
+    return getListByPageAsync(usParams);
+  } else {
+    const usParams = genAction('MES_SHIFT_SYS', {
+      QueryAble_T: '',
+      where: sqlcmd
+    });
+    return getListByPageAsync(usParams);
+  }
+  // const rParams = genActionPage('BIZ_ERP_PROD_IN', sqlcmd, params.page, params.pageSize,option);
+  // return getFinishedwarehouseListByPageAsync(rParams);
+};
+async function getListByPageAsync(params: any) {
+  const data = await defHttp.post(
+    { url: Api.QueryUrl, params },
+    {
+      isTransformResponse: false,
+    },
+  );
+  let model = {}
+  if (isNullOrEmpty(data.Data.page)) {
+    model = {
+      items: data.Data.Items,
+    };
+  } else {
+    model = {
+      items: data.Data.page.data,
+      total: data.Data.page.totals,
+    };
+  }
+  return model;
+}
+//鏂板淇濆瓨
+export const Save = async (params: Recordable, isUpdate: boolean, isbaofei: boolean) => {
+  const item: any = {
+    ID: params.ID,
+    CREATE_TIME: params?.CREATE_TIME,
+    CREATE_USER: params?.CREATE_USER,
+    UPDATE_TIME: params?.UPDATE_TIME,
+    UPDATE_USER: params?.UPDATE_USER,
+    GHOST_ROW: params?.GHOST_ROW,
+    AUTH_ORG: params?.AUTH_ORG,
+    AUTH_PROD: params?.AUTH_PROD,
+    AUTH_WH: params?.AUTH_WH,
+    TOOL_CODE: params?.TOOL_CODE,
+    PROJ_CODE: params?.PROJ_CODE,
+    RESULT: params?.RESULT,
+    REMARK: params?.REMARK,
+  };
+  let data;
+
+  if (isUpdate) {
+    if (isbaofei) {
+      item.STATUS = 5;
+    }
+    const time = new Date();
+    item.UPDATE_TIME = formatToDateTime(time);
+    item.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    // regionitem.ORG_CODE = useUserStore().getUserInfo.orgCode as string;
+    // regionitem.AUTH_ORG = useUserStore().getUserInfo.orgCode as string;
+    data = await defHttp.post(
+      { url: Api.UpdateEntity, params: genAction('SMT_MAINTAIN', item) },
+      {
+        errorMessageMode: 'none',
+        isTransformResponse: false,
+      },
+    );
+  } else {
+    // const usParams = genAction(
+    //   'SMT_SOLDER',
+    //   "REGION_CODE='" + params.REGION_CODE + "'AND AUTH_ORG='" + regionitem.ORG_CODE + "'",
+    // );
+    //var check = await isExist(usParams);
+    //console.log('check',check)
+    //if (!check.Data) {
+    item.ID = buildUUID(); //鐢熸垚GUID
+    item.UPDATE_TIME = formatToDateTime(new Date());
+    item.CREATE_USER = useUserStore().getUserInfo.userId as string;
+    item.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    // regionitem.ORG_CODE = useUserStore().getUserInfo.orgCode as string;
+    // regionitem.AUTH_ORG = useUserStore().getUserInfo.orgCode as string;
+    data = await defHttp.post(
+      { url: Api.AddEntity, params: genAction('SMT_MAINTAIN', item) },
+      {
+        errorMessageMode: 'none',
+        isTransformResponse: false,
+      },
+    );
+    //} else {
+    // return check.Message;
+    //return '閲嶅浜�';
+    //}
+  }
+  return data;
+};
+//鍒犻櫎
+export const Delete = async (Shift_Id: string) => {
+  const usParams = genAction('MES_SHIFT_SYS', `ID='${Shift_Id}'`)
+  return await defHttp.post(
+    { url: Api.DeleteWhere, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false
+    }
+  )
+}
+
+/*
+ * 鏍规嵁ID鑾峰彇鐝埗
+ */
+export const getShiftById = async (params: any) => {
+  let sqlcmd = '';
+  if (params?.SFTS_CODE != undefined && params?.SFTS_CODE != '') {
+    sqlcmd += "SFTS_CODE = '" + params?.SFTS_CODE + "'";
+  }
+  const rParams = genAction('MES_SHIFT_SYS', { QueryAble_T:"", where: sqlcmd, order:''});
+  return getRuleByIdAsync(rParams);
+};
+async function getRuleByIdAsync(params: ApiAction<{}>) {
+  const data = await defHttp.post<ApiAction<any>>(
+    {
+      url: Api.QueryUrl,
+      params,
+    },
+    {
+      errorMessageMode: 'modal',
+      isTransformResponse: false,
+    },
+  );
+  return data.Data;
+}
+/*
+ * 鑾峰彇瑙勫垯鏄庣粏鍒楄〃
+ */
+export const getShiftDtl = async (params: any) => {
+  let sqlcmd = '';
+  if (params?.SFTS_CODE != undefined && params?.SFTS_CODE != '') {
+    sqlcmd += "SFTS_CODE = '" + params?.SFTS_CODE + "'";
+  }
+  const rParams = genAction('MES_SHIFT', { QueryAble_T:"", where: sqlcmd});
+  return getRuleDtlAsync(rParams);
+};
+async function getRuleDtlAsync(params: ApiAction<{}>) {
+  const data = await defHttp.post<ApiAction<any>>(
+    {
+      url: Api.QueryUrl,
+      params,
+    },
+    {
+      errorMessageMode: 'modal',
+      isTransformResponse: false,
+    },
+  );
+  return data.Data;
+}
+//涓嬫媺鍒楄〃
+// STATUSs 鍗曟嵁鐘舵��
+export const optionsListApi = async (params: Recordable) => {
+  const usParams = genAction('SMT_MAINTAIN+RESULTs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      // apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
+//绫诲瀷
+export const optionsListApiType = async (params: Recordable) => {
+  const usParams = genAction('V_SMT_TOOL+TYPEs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      // apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
\ No newline at end of file
diff --git a/src/views/tigerprojects/bas/shift/ShiftDrawer.vue b/src/views/tigerprojects/bas/shift/ShiftDrawer.vue
new file mode 100644
index 0000000..7999dd8
--- /dev/null
+++ b/src/views/tigerprojects/bas/shift/ShiftDrawer.vue
@@ -0,0 +1,124 @@
+<template>
+  <BasicDrawer
+    v-bind="$attrs"
+    @register="CheckruleDrawer"
+    showFooter
+    :title="getTitle"
+    width="1200px"
+    @ok="handleSubmit"
+  >
+    <!-- <BasicForm @register="MaterialForm" /> -->
+    <a-card title="鐝鏄庣粏" :bordered="false">
+      <BasicForm @register="register" />
+    </a-card>
+    <a-card title="鏃舵鍒楄〃" :bordered="false" class="!mt-5">
+      <div>
+        <!-- <BasicTable
+          :columns="dtlColumns"
+          ref="tableRef"
+          :dataSource="data"
+          :canResize="canResize"
+          :loading="loading"
+          :striped="striped"
+          :bordered="border"
+          :actionColumn="actionColumn"
+          :pagination="pagination"
+          showTableSetting
+        >
+          <template #toolbar>
+            <a-button type="primary" @click="handleCreate"> 鏂板鐝 </a-button>
+          </template>
+          <template #action="{ record }">
+            <TableAction
+              :actions="[
+                {
+                  icon: 'clarity:note-edit-line',
+                  onClick: handleEdit.bind(null, record),
+                },
+                {
+                  icon: 'ant-design:delete-outlined',
+                  color: 'error',
+                  popConfirm: {
+                    title: '鏄惁纭鍒犻櫎?',
+                    placement: 'left',
+                    confirm: handleDelete.bind(null, record),
+                  },
+                },
+              ]"
+            />
+          </template>
+        </BasicTable> -->
+      </div>
+    </a-card>
+  </BasicDrawer>
+</template>
+<script lang="ts">
+  import { defineComponent, ref, computed, unref } from 'vue';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+  import { formSchema } from './shift.data';              
+  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
+
+  export default defineComponent({
+    name: 'CheckruleDrawer',
+    components: { BasicDrawer, BasicForm },
+    emits: ['success', 'register'],
+    setup(_, { emit }) {
+      const isUpdate = ref(true);
+
+      const [register, { resetFields, setFieldsValue, validate }] = useForm({
+        labelWidth: 120,
+        schemas: formSchema,
+        actionColOptions: {
+          span: 24,
+        },
+        showActionButtonGroup: false,
+      });
+
+      const [CheckruleDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
+        resetFields();
+        setDrawerProps({ confirmLoading: false });
+        isUpdate.value = !!data?.isUpdate;
+        // data.record.DATA_CASE=[data.record.DATA_CASE]
+        if (unref(isUpdate)) {
+          setFieldsValue({
+            ...data.record,
+          });
+        } else {
+          setFieldsValue({
+            RULE_ID: data.RULE_ID,
+          });
+        }
+      });
+
+      const getTitle = computed(() => (!unref(isUpdate) ? '鏂板瑙勫垯鏄庣粏' : '缂栬緫瑙勫垯鏄庣粏'));
+
+      async function handleSubmit() {
+        try {
+          const values = await validate();
+          setDrawerProps({ confirmLoading: true });
+          // TODO custom api
+          // //淇濆瓨鐗╂枡
+          // const apiAction = SaveRegion(values, unref(isUpdate));
+          // apiAction.then((action) => {
+          //   if (action.IsSuccessed) {
+          //     closeDrawer();
+          //     emit('success');
+          //   }
+          // });
+
+          closeDrawer();
+          emit('success', values, { isUpdate: isUpdate.value });
+        } finally {
+          setDrawerProps({ confirmLoading: false });
+        }
+      }
+
+      return {
+        CheckruleDrawer,
+        register,
+        getTitle,
+        handleSubmit,
+      };
+    },
+  });
+</script>
diff --git a/src/views/tigerprojects/bas/shift/index.vue b/src/views/tigerprojects/bas/shift/index.vue
new file mode 100644
index 0000000..c95f89a
--- /dev/null
+++ b/src/views/tigerprojects/bas/shift/index.vue
@@ -0,0 +1,144 @@
+<template>
+  <div>
+    <BasicTable @register="registerTable">
+      <template #toolbar>
+        <a-button color="primary" @click="handleAdd"> 娣诲姞 </a-button>
+        <a-button ghost color="primary" @click="aoaToExcel"> 瀵煎嚭 </a-button>
+      </template>
+      <template #action="{ record }">
+        <TableAction :actions="[
+      {
+        icon: 'clarity:note-edit-line',
+        tooltip: '淇敼',
+        onClick: handleEdit.bind(null, record),
+      },
+      {
+        icon: 'ant-design:delete-outlined',
+        color: 'error',
+        tooltip: '鍒犻櫎',
+        popConfirm: {
+          title: '鏄惁纭鍒犻櫎?',
+          placement: 'left',
+          confirm: handleDelete.bind(null, record),
+        },
+      },
+    ]" />
+      </template>
+    </BasicTable>
+    <Loading :loading="compState.loading" :tip="compState.tip" />
+    <!-- <WmsItemDrawer @register="registerDrawer" @success="handleSuccess" /> -->
+  </div>
+</template>
+<script lang="ts" setup>
+import { reactive, unref } from 'vue';
+import { aoaToSheetXlsx } from '/@/components/Excel';
+import { BasicTable, useTable, TableAction } from '/@/components/Table';
+import { useDrawer } from '/@/components/Drawer';
+import { columns, searchFormSchema } from './shift.data';
+import { getListByPage, Delete } from '/@/api/tigerapi/bas/shift';
+import { useGo } from '/@/hooks/web/usePage';
+import { Loading } from '/@/components/Loading';
+import { useMessage } from '/@/hooks/web/useMessage';
+import { useI18n } from '/@/hooks/web/useI18n';
+import { buildUUID } from '/@/utils/uuid';
+
+const { t } = useI18n();
+const { createMessage } = useMessage();
+const [registerDrawer, { openDrawer }] = useDrawer();
+const go = useGo();
+const compState = reactive({
+  absolute: false,
+  loading: false,
+  tip: '鍔犺浇涓�...',
+});
+const [registerTable, { getForm, getPaginationRef, reload }] = useTable({
+  title: '鐢熶骇鐝埗',
+  api: getListByPage,
+  columns,
+  formConfig: {
+    labelWidth: 120,
+    schemas: searchFormSchema,
+  },
+  actionColumn: {
+    width: 120,
+    title: '鎿嶄綔',
+    dataIndex: 'action',
+    slots: { customRender: 'action' },
+    fixed: 'right', //undefined,
+  },
+  ellipsis: true,
+  useSearchForm: true,
+  showTableSetting: false,
+  bordered: true,
+  showIndexColumn: false,
+});
+let arr: any[] = [];
+//瀵煎嚭
+function aoaToExcel() {
+  const totals = getPaginationRef().total
+  if (totals < 30000) {
+    arr = [];
+    compState.loading = true;
+    const col = getForm().getFieldsValue()
+    getListByPage(col).then((res) => {
+      res.items.forEach(element => {
+        arr.push({
+          '鐝埗缂栫爜': element.SFTS_CODE,
+          '鐝埗鍚嶇О': element.SFTS_NAME,
+          '鏄惁鍚敤': element.IS_ACTIVE,
+          '澶囨敞': element.REMARK,
+          '鍒涘缓浜�': element.CREATE_USER,
+          '鍒涘缓鏃堕棿': element.CREATE_TIME,
+        });
+      });
+      const arrHeader = columns.map((column) => column.title);
+      const arrData = arr.map((item) => {
+        return Object.keys(item).map((key) => item[key]);
+      });
+      // 淇濊瘉data椤哄簭涓巋eader涓�鑷�
+      if (arr.length < 30000) {
+        aoaToSheetXlsx({
+          data: arrData,
+          header: arrHeader,
+          filename: '鐝埗.xlsx',
+        });
+      } else {
+        createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+      }
+
+      compState.loading = false;
+
+    })
+
+  } else {
+    createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+  }
+
+
+}
+//娣诲姞
+function handleAdd() {
+  const rule = { SFTS_CODE: '0', ID: buildUUID() };
+  go(`/shiftDetail/${encodeURI(JSON.stringify(rule))}`);
+}
+//缂栬緫
+function handleEdit(record: any) {
+  const rule = { SFTS_CODE: record.SFTS_CODE, ID: record.ID };
+  go(`/shiftDetail/${encodeURI(JSON.stringify(rule))}`);
+}
+function handleSuccess() {
+  reload();
+}
+//鍒犻櫎
+function handleDelete(record: any) {
+  const apiAction = Delete(record.ID);
+  apiAction.then((action) => {
+    if (action.IsSuccessed) {
+      createMessage.success(t('宸插垹闄�'));
+      reload();
+    } else {
+      createMessage.success(t('鍒犻櫎鎿嶄綔澶辫触'));
+    }
+  });
+}
+</script>
diff --git a/src/views/tigerprojects/bas/shift/shift.data.ts b/src/views/tigerprojects/bas/shift/shift.data.ts
new file mode 100644
index 0000000..7c355a5
--- /dev/null
+++ b/src/views/tigerprojects/bas/shift/shift.data.ts
@@ -0,0 +1,290 @@
+import { BasicColumn } from '/@/components/Table';
+import { FormSchema } from '/@/components/Table';
+import { optionsListApi,optionsListApiType } from '/@/api/tigerapi/mes/smt/smtmaintain';
+import { h,unref } from 'vue';
+import { Tag ,Tooltip} from 'ant-design-vue';
+import{ useLocale } from '/@/locales/useLocale';
+
+const { getLocale }=useLocale();
+
+export const columns: BasicColumn[] = [
+  {
+    title: '鐝埗缂栫爜',
+    dataIndex: 'SFTS_CODE',
+    width:200,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鐝埗鍚嶇О',
+    dataIndex: 'SFTS_NAME',
+    width: 100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鏄惁鍚敤',
+    dataIndex: 'IS_ACTIVE',
+    width: 100,
+    sorter: true,
+    resizable: true,
+  },
+  {
+    title: '澶囨敞',
+    dataIndex: 'REMARK',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鍒涘缓浜�',
+    dataIndex: 'CREATE_USER',
+    width:100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鍒涘缓鏃堕棿',
+    dataIndex: 'CREATE_TIME',
+    width:100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: 'ID',
+    dataIndex: 'ID',
+    width:200,
+    sorter: true,
+    resizable:true,
+    ifShow:false
+  }
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    field: 'SFTS_CODE',
+    label: '鐝埗缂栫爜',
+    component: 'Input',
+    colProps: { span: 8 },
+  }
+];
+
+//鏂板鐝
+export const formSchema: FormSchema[] = [
+  {
+    label: '鐝缂栫爜',
+    field: 'SFT_CODE',
+    required: true,
+    colProps: { span: 12 },
+    component: 'Input',
+  },
+  {
+    field: 'ID',
+    label: 'ID',
+    component: 'Input',
+    show: false,
+  },
+  {
+    label: '鐝鍚嶇О',
+    field: 'SFTS_NAME',
+    required: true,
+    colProps: { span: 12 },
+    component: 'Input',
+  },
+  {
+    label: '鐝埗缂栫爜',
+    field: 'SFTS_CODE',
+    required: true,
+    colProps: { span: 12 },
+    component: 'Input',
+  },
+  {
+    label: '鐝寮�濮嬫椂闂�',
+    field: 'SFT_BEGIN',
+    required: true,
+    colProps: { span: 12 },
+    component: 'Input',
+  },
+  {
+    label: '鐝缁撴潫鏃堕棿',
+    field: 'SFT_END',
+    required: true,
+    colProps: { span: 12 },
+    component: 'Input',
+  },
+  {
+    label: '鏄惁璺ㄥぉ',
+    field: 'IS_ACROSS_DAY',
+    required: true,
+    component: 'Select',
+    colProps: { span: 12 },
+    componentProps: {
+      options: [
+        {
+          label: 'Y',
+          value: 'Y',
+          key: 'Y',
+        },
+        {
+          label: 'N',
+          value: 'N',
+          key: 'N',
+        },
+      ],
+    },
+  },
+  {
+    label: '澶囨敞',
+    field: 'REMARK',
+    colProps: { span: 12 },
+    component: 'Input',
+  }
+];
+
+export const searchFormSchema_D: FormSchema[] = [
+  {
+    field: 'TOOL_CODE',
+    label: '宸ュ叿缂栫爜',
+    component: 'Input',
+    colProps: { span: 8 },
+  }
+];
+//鐝
+export const dtlColumns: BasicColumn[] = [
+  {
+    title: '鐝缂栫爜',
+    dataIndex: 'SFT_CODE',
+    width:200,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鐝鍚嶇О',
+    dataIndex: 'SFT_NAME',
+    width: 100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鐝埗缂栫爜',
+    dataIndex: 'SFTS_CODE',
+    width: 100,
+    sorter: true,
+    resizable: true,
+  },
+  {
+    title: '鐝寮�濮嬫椂闂�',
+    dataIndex: 'SFT_BEGIN',
+    width: 100,
+    sorter: true,
+    resizable: true,
+  },
+  {
+    title: '鐝缁撴潫鏃堕棿',
+    dataIndex: 'SFT_END',
+    width: 100,
+    sorter: true,
+    resizable: true,
+  },
+  {
+    title: '鏄惁璺ㄥぉ',
+    dataIndex: 'IS_ACROSS_DAY',
+    width: 100,
+    sorter: true,
+    resizable: true,
+  },
+  {
+    title: '澶囨敞',
+    dataIndex: 'REMARK',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鍒涘缓浜�',
+    dataIndex: 'CREATE_USER',
+    width:100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鍒涘缓鏃堕棿',
+    dataIndex: 'CREATE_TIME',
+    width:100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: 'ID',
+    dataIndex: 'ID',
+    width:200,
+    sorter: true,
+    resizable:true,
+    ifShow:false
+  }
+];
+//褰撳墠鐝埗
+export const newFormSchema: FormSchema[] = [
+  {
+    label: '鐝埗缂栫爜',
+    field: 'SFTS_CODE',
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '鐝埗鍚嶇О',
+    field: 'SFTS_NAME',
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '鏄惁鍚敤',
+    field: 'IS_ACTIVE',
+    colProps: { span: 8 },
+    component: 'Input',
+    componentProps: {
+      options: [
+        {
+          label: 'Y',
+          value: 'Y',
+          key: 'Y',
+        },
+        {
+          label: 'N',
+          value: 'N',
+          key: 'N',
+        },
+      ],
+    },
+  },
+  {
+    label: '澶囨敞',
+    field: 'REMARK',
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+  ,
+  {
+    label: '鍒涘缓浜�',
+    field: 'CREATE_USER',
+    colProps: { span: 8 },
+    component: 'Input',
+    show:false
+  },
+  {
+    label: '鍒涘缓鏃堕棿',
+    field: 'CREATE_TIME',
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: 'ID',
+    field: 'ID',
+    colProps: { span: 8 },
+    component: 'Input',
+    show:false
+  }
+];
+
diff --git a/src/views/tigerprojects/bas/shift/shiftDetail.vue b/src/views/tigerprojects/bas/shift/shiftDetail.vue
new file mode 100644
index 0000000..90db586
--- /dev/null
+++ b/src/views/tigerprojects/bas/shift/shiftDetail.vue
@@ -0,0 +1,325 @@
+<template>
+  <PageWrapper class="high-form" title="鐝埗绠$悊" content="杩欐槸鐝埗绠$悊椤甸潰銆�" @back="goBack">
+    <a-card title="鐝埗淇℃伅" :bordered="false">
+      <BasicForm @register="register" />
+    </a-card>
+    <a-card title="鐝鏄庣粏" :bordered="false" class="!mt-5">
+      <div>
+        <BasicTable
+          :columns="dtlColumns"
+          ref="tableRef"
+          :dataSource="data"
+          :canResize="canResize"
+          :loading="loading"
+          :striped="striped"
+          :bordered="border"
+          :actionColumn="actionColumn"
+          :pagination="pagination"
+          showTableSetting
+        >
+          <template #toolbar>
+            <a-button type="primary" @click="handleCreate"> 鏂板鐝 </a-button>
+          </template>
+          <template #action="{ record }">
+            <TableAction
+              :actions="[
+                {
+                  icon: 'clarity:note-edit-line',
+                  onClick: handleEdit.bind(null, record),
+                },
+                {
+                  icon: 'ant-design:delete-outlined',
+                  color: 'error',
+                  popConfirm: {
+                    title: '鏄惁纭鍒犻櫎?',
+                    placement: 'left',
+                    confirm: handleDelete.bind(null, record),
+                  },
+                },
+              ]"
+            />
+          </template>
+        </BasicTable>
+      </div>
+    </a-card>
+    <!-- <a-card title="鏍¢獙娴嬭瘯" :bordered="false" class="!mt-5">
+      <BasicForm @register="registerTest" />
+    </a-card> -->
+
+    <template #rightFooter>
+      <a-button class="mr-4" type="info" @click="cancel"> 鍙栨秷 </a-button>
+      <a-button type="primary" @click="submitAll"> 鎻愪氦 </a-button>
+    </template>
+    <ShiftDrawer @register="registerDrawer" @success="handleSuccess" />
+  </PageWrapper>
+</template>
+<script lang="ts">
+  import { BasicForm, useForm } from '/@/components/Form';
+  import { defineComponent, onMounted, ref, unref } from 'vue';
+  import { useRoute, useRouter } from 'vue-router';
+  import { PageWrapper } from '/@/components/Page';
+  import { Card } from 'ant-design-vue';
+  import { useGo } from '/@/hooks/web/usePage';
+  import { useDrawer } from '/@/components/Drawer';
+  import { BasicTable, TableAction, TableActionType } from '/@/components/Table';
+  import { dtlColumns, newFormSchema } from './shift.data';
+  import ShiftDrawer from './ShiftDrawer.vue';
+  import { useTabs } from '/@/hooks/web/useTabs';
+  import {
+    // DeleteRuleDtl,
+    getShiftById,
+    getShiftDtl,
+    // SaveRule,
+    // SaveRuleDtl,
+  } from '/@/api/tigerapi/bas/shift';
+  import {
+    CheckRuleDtlParams,
+    CheckRuleListItem,
+    iBAS_CODE_DTL,
+  } from '/@/api/tigerapi/model/mesModel';
+  import { useUserStore } from '/@/store/modules/user';
+  import { buildUUID } from '/@/utils/uuid';
+  import { formatToDateTime } from '/@/utils/dateUtil';
+  import { useMultipleTabStore } from '/@/store/modules/multipleTab';
+  import { isEmpty, isNullOrEmpty } from '/@/utils/is';
+
+  export default defineComponent({
+    name: 'RuleDetail',
+    components: {
+      BasicForm,
+      BasicTable,
+      PageWrapper,
+      ShiftDrawer,
+      [Card.name]: Card,
+      TableAction,
+    },
+    setup(props) {
+      const route = useRoute();
+      const go = useGo();
+      const tableRef = ref<Nullable<TableActionType>>(null);
+      const RuleObj = ref(JSON.parse(decodeURI(route.params?.id as string)));
+      const { setTitle } = useTabs();
+      const isUpdate = ref(true);
+      const canResize = ref(false);
+      const loading = ref(false);
+      const striped = ref(true);
+      const border = ref(true);
+      const pagination = ref<any>(false);
+      const actionColumn = ref({
+        width: 80,
+        title: '鎿嶄綔',
+        dataIndex: 'action',
+        slots: { customRender: 'action' },
+      });
+      const tabStore = useMultipleTabStore();
+      const router = useRouter();
+
+      const { currentRoute } = router;
+      function getCurrentTab() {
+        const route = unref(currentRoute);
+        return tabStore.getTabList.find((item) => item.fullPath === route.fullPath)!;
+      }
+      const currentTab = getCurrentTab();
+      var _title =
+        RuleObj.value.SFTS_CODE == '0' ? '鏂板鐝' : '缂栬緫鐝锛�' + RuleObj.value.SFTS_CODE;
+      setTitle(_title);
+      const [registerDrawer, { openDrawer }] = useDrawer();
+      const [register, { resetFields, setFieldsValue, getFieldsValue, validate }] = useForm({
+        labelWidth: 120,
+        baseColProps: {
+          span: 24,
+        },
+        schemas: newFormSchema,
+        showActionButtonGroup: false,
+      });
+      
+      const params: CheckRuleDtlParams = {
+        SFTS_CODE: RuleObj.value.SFTS_CODE == '0' ? buildUUID() : (RuleObj.value.ID as string),
+      };
+      const data = ref([] as any[]);
+      onMounted(async () => {
+        resetFields();
+        pagination.value = { pageSize: 6 };
+        data.value = (await getShiftDtl(params)).Items;
+        const shiftData = (await getShiftById(params)).Items as any[];
+        if (!isNullOrEmpty(shiftData)) {
+          setFieldsValue(shiftData[0]);
+        }
+        // else{
+
+        //   // setFieldsValue({
+        //   //   ID: buildUUID(),
+        //   //   CHECK_TYPE:0,
+        //   //   CODE_LENGTH:0,
+        //   // });
+        //   // setFieldsValueTest({});
+        // }
+      });
+
+      function getTableAction() {
+        const tableAction = unref(tableRef);
+        if (!tableAction) {
+          throw new Error('tableAction is null');
+        }
+        return tableAction;
+      }
+
+      async function submitAll() {
+        // try {
+        //   const [values, testValues] = await Promise.all([validate(), validateTestForm()]);
+        //   values.ID =params.RULE_ID;
+        //   const action = await SaveRule({ ...values, ...testValues });
+        //   if (action.IsSuccessed) {
+        //     await DeleteRuleDtl(params.RULE_ID);
+        //     const dtlAction = await SaveRuleDtl(data.value);
+        //     if (dtlAction.IsSuccessed) {
+        //       cancel();
+        //     }
+        //   }
+        // } catch (error) {}
+      }
+      async function cancel() {
+        try {
+          tabStore.closeTab(currentTab, router);
+        } catch (error) {}
+      }
+      async function handleCreate() {
+        await validate();
+        openDrawer(true, {
+          RULE_ID: params.RULE_ID,
+          isUpdate: false,
+        });
+      }
+
+      function handleEdit(record: Recordable) {
+        openDrawer(true, {
+          record,
+          isUpdate: true,
+        });
+      }
+
+      function handleDelete(record: Recordable) {
+        var _data = data.value.map((item) => {
+          return item;
+        });
+        let index = _data.indexOf(record);
+        _data.splice(index, 1);
+        data.value = _data;
+        getTableAction().setProps({
+          dataSource: [],
+        });
+        getTableAction().setProps({
+          dataSource: data,
+        });
+        getTableAction().reload();
+        setData();
+      }
+
+      //鏂板鐝鏄庣粏
+      function handleSuccess(d, u) {
+        var Id = buildUUID();
+        isUpdate.value = u.isUpdate;
+        if (u.isUpdate) {
+          //鏇存柊
+          var _data = data.value.map((item) => {
+            if (item.ID == d.ID)
+              return {
+                ...item,
+                SFTS_CODE: d.SFTS_CODE,
+                SFTS_NAME: d.SFTS_NAME,
+                IS_ACTIVE: d.IS_ACTIVE,
+                REMARK: d.REMARK
+              };
+            return item;
+          });
+          data.value = _data;
+        } else {
+          //鏂板
+          d.ID = Id;
+          d.CREATE_USER = useUserStore().getUserInfo.userId as string;
+          d.UPDATE_TIME = formatToDateTime(new Date());
+          d.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+          var _data2: any[] = [];
+          if (!isEmpty(data.value)) {
+            _data2 = data.value.map((item) => {
+              return item;
+            });
+            d.RULE_SEQ =
+              data.value.reduce((maxLength, item) => {
+                return Math.max(maxLength, item.RULE_SEQ);
+              }, 0) + 1;
+          } else {
+            d.RULE_SEQ = 1;
+          }
+          // _data2.splice(0, 0, d);
+          _data2.push(d);
+          data.value = _data2;
+        }
+
+        //閲嶆柊淇敼鏁版嵁婧�
+
+        getTableAction().setProps({
+          dataSource: [],
+        });
+        getTableAction().setProps({
+          dataSource: data,
+        });
+        getTableAction().reload();
+        setData();
+      }
+      function setData() {
+        var CHECK_TYPE = 0;
+        var CHECK_REGEX = '^';
+        const total = data.value.reduce((length, item) => {
+          if (item.DATA_TYPE == 5) {
+            CHECK_TYPE = 1;
+          }
+          CHECK_REGEX += item.DATA_REGEX;
+          return (length += Number(item.CHECK_LENGTH) * Number(item.REPEAT_TIMES));
+        }, 0);
+
+        setFieldsValue({
+          ...getFieldsValue(),
+          ...{
+            CODE_LENGTH: total,
+            CHECK_TYPE: CHECK_TYPE,
+          },
+        });
+      }
+      function goBack() {
+        // 鏈緥鐨勬晥鏋滄椂鐐瑰嚮杩斿洖濮嬬粓璺宠浆鍒拌处鍙峰垪琛ㄩ〉锛屽疄闄呭簲鐢ㄦ椂鍙繑鍥炰笂涓�椤�
+        go('/shift');
+      }
+      return {
+        dtlColumns,
+        register,
+        resetFields,
+        setFieldsValue,
+        getFieldsValue,
+        validate,
+        data,
+        canResize,
+        loading,
+        striped,
+        border,
+        pagination,
+        actionColumn,
+        registerDrawer,
+        submitAll,
+        cancel,
+        tableRef,
+        goBack,
+        setData,
+        handleCreate,
+        handleEdit,
+        handleDelete,
+        handleSuccess,
+      };
+    },
+  });
+</script>
+<style lang="less" scoped>
+  .high-form {
+    padding-bottom: 48px;
+  }
+</style>

--
Gitblit v1.9.3