Просмотр исходного кода

Merge branch 'master' of http://192.168.100.32:3000/fanfan/xt-front

fan 2 лет назад
Родитель
Сommit
0d879c44fc

+ 1 - 1
.env

@@ -1,5 +1,5 @@
 # port
-VITE_PORT = 3100
+VITE_PORT = 3200
 
 # spa-title
 VITE_GLOB_APP_TITLE = 后台管理系统

+ 4 - 4
src/api/biz/management/wardInfo.ts

@@ -2,8 +2,8 @@ import { defHttp } from '/@/utils/http/axios';
 import { setParams } from '/@/utils/index';
 enum Api {
   getWardInfo = '/biz/sys/wardInfo/query/page',
-  add = '/biz/sys/wardInfo/add',
-  edit = '/biz/sys/wardInfo/edit',
+  wardInfoAdd = '/biz/sys/wardInfo/add',
+  wardInfoEdit = '/biz/sys/wardInfo/edit',
   changeStatus = '/biz/sys/wardInfo/modify/status/',
   WardInfoById = '/biz/sys/wardInfo/detail',
 }
@@ -13,11 +13,11 @@ export const getWardInfo = (params?: object) => {
 };
 
 export const wardInfoAdd = (params?: object) => {
-  return defHttp.post({ url: Api.add, params: params });
+  return defHttp.post({ url: Api.wardInfoAdd, params: params });
 };
 
 export const wardInfoEdit = (params?: object) => {
-  return defHttp.post({ url: Api.edit, params: params });
+  return defHttp.post({ url: Api.wardInfoEdit, params: params });
 };
 
 export const changeStatus = (id: string) => {

+ 6 - 6
src/api/biz/management/wardType.ts

@@ -1,18 +1,18 @@
 import { defHttp } from '/@/utils/http/axios';
 enum Api {
-  add = '/biz/sys/wardProperties/add',
-  get = '/biz/sys/wardProperties/query/list',
-  delete = '/biz/sys/wardProperties/removeByIds',
+  wardTypeAdd = '/biz/sys/wardProperties/add',
+  wardTypeGet = '/biz/sys/wardProperties/query/list',
+  wardTypeDel = '/biz/sys/wardProperties/removeByIds',
 }
 
 export const wardTypeAdd = (params?: object) => {
-  return defHttp.post({ url: Api.add, params: params });
+  return defHttp.post({ url: Api.wardTypeAdd, params: params });
 };
 
 export const getAttrList = (params?: object) => {
-  return defHttp.post({ url: Api.get, params: params });
+  return defHttp.post({ url: Api.wardTypeGet, params: params });
 };
 
 export const deleteWardType = (params?: object) => {
-  return defHttp.post({ url: Api.delete, params: params });
+  return defHttp.post({ url: Api.wardTypeDel, params: params });
 };

+ 25 - 0
src/api/biz/management/working.ts

@@ -0,0 +1,25 @@
+import { defHttp } from '/@/utils/http/axios';
+enum Api {
+  workingDayGet = '/biz/sys/workday/query/detail',
+  workingDayEdit = '/biz/sys/workday/edit',
+  SailingsGet = '/biz/sys/sailings/query/list',
+  SailingsEdit = '/biz/sys/sailings/edit',
+}
+
+export const getWorkingDay = (params?: object) => {
+  return defHttp.post({ url: Api.workingDayGet, params: params });
+};
+
+export const WorkingDayEdit = (params?: object) => {
+  return defHttp.post({ url: Api.workingDayEdit, params: params });
+};
+
+export const getSailings = async (params?: object) => {
+  return await defHttp.post({ url: Api.SailingsGet, params: params }).then(res => {
+    return res.infos;
+  });
+};
+
+export const sailingsEdit = (params?: object) => {
+  return defHttp.post({ url: Api.SailingsEdit, params: params });
+};

+ 58 - 10
src/views/biz/management/parameter/index.vue

@@ -2,13 +2,55 @@
   <div>
     <BasicTable @register="registerTable">
       <template #bodyCell="{ column, record }">
-        <template v-if="column.key === 'contents'">
+        <template
+          v-if="
+            column.key === 'contents' &&
+            record.key != 1 &&
+            record.key != 2 &&
+            record.key != 3 &&
+            record.key != 4
+          "
+        >
           <div>
             <a-input
               v-if="editableData[record.key]"
               v-model:value="editableData[record.key][column.dataIndex]"
               placeholder="请输入参数内容"
             />
+            <template v-else> {{ record.contents }} </template>
+          </div>
+        </template>
+
+        <template
+          v-if="
+            column.key === 'contents' && (record.key == 2 || record.key == 3 || record.key == 4)
+          "
+        >
+          <div>
+            <a-radio-group
+              v-model:value="editableData[record.key][column.dataIndex]"
+              v-if="editableData[record.key]"
+            >
+              <a-radio :value="1">是</a-radio>
+              <a-radio :value="0">否</a-radio>
+            </a-radio-group>
+
+            <template v-else>
+              {{ record.contents == 0 ? '否' : '是' }}
+            </template>
+          </div>
+        </template>
+
+        <template v-if="column.key === 'contents' && record.key == 1">
+          <div>
+            <DatePicker
+              v-if="editableData[record.key]"
+              :show-time="true"
+              :format="'YYYY-MM-DD HH:mm:ss'"
+              :value-format="'YYYY-MM-DD HH:mm:ss'"
+              v-model:value="editableData[record.key][column.dataIndex]"
+              placeholder="请选择时间"
+            />
             <template v-else>
               {{ record.contents }}
             </template>
@@ -18,7 +60,7 @@
           <TableAction
             :actions="[
               {
-                auth: ['biz:sys:params:add', 'biz:sys:params:edit', 'biz:sys:params:remove'],
+                auth: ['bizSys:params:add', 'bizSys:params:edit', 'bizSys:params:remove'],
                 ifShow: editableData[record.key] ? false : true,
                 icon: 'icon-edit|iconfont',
                 tooltip: '编辑',
@@ -26,7 +68,7 @@
                 onClick: handleEdit.bind(null, record),
               },
               {
-                auth: ['biz:sys:params:add', 'biz:sys:params:edit', 'biz:sys:params:remove'],
+                auth: ['bizSys:params:add', 'bizSys:params:edit', 'bizSys:params:remove'],
                 ifShow: editableData[record.key] ? true : false,
                 icon: 'icon-check|iconfont',
                 tooltip: '保存',
@@ -42,7 +84,7 @@
 </template>
 <script lang="ts" setup>
   import { ref, UnwrapRef, reactive } from 'vue'; // onBeforeMount,
-
+  import { DatePicker } from 'ant-design-vue';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { cloneDeep } from 'lodash-es';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
@@ -331,20 +373,26 @@
   }
 
   function handleBeforeFetch() {}
-
+  // 编辑业务
   function handleEdit(record) {
     const key = record.key;
     editableData[key] = cloneDeep(dataList.value.filter(item => key === item.key)[0]);
   }
-
+  // 保存业务
   async function handleSave(record) {
     const key = record.key;
     const editObj = resObj.value;
     const editName = editableData[key].typeName;
-    console.log('record.contents:::::::', editableData[key].contents);
-    editObj[editableData[key].typeIndex] = Number(
-      parseFloat(editableData[key].contents).toFixed(2),
-    );
+    if (
+      editableData[key].typeIndex != 'firstScheduleBedTime' &&
+      editableData[key].typeIndex != 'autoFlowAfterDialysis' &&
+      editableData[key].typeIndex != 'autoFlowDisinfect' &&
+      editableData[key].typeIndex != 'autoFlowPreDialysis'
+    ) {
+      editObj[editableData[key].typeIndex] = Number(
+        parseFloat(editableData[key].contents).toFixed(2),
+      );
+    }
     await edit(resObj.value);
     delete editableData[key];
     createMessage.success('参数[' + editName + ']修改成功!');

+ 82 - 0
src/views/biz/management/ward/data.ts

@@ -1,5 +1,6 @@
 import { BasicColumn, FormSchema } from '/@/components/Table';
 import { getAttrList } from '/@/api/biz/management/wardType';
+
 export const wardInfoColumns: BasicColumn[] = [
   {
     title: '病区名',
@@ -95,3 +96,84 @@ export const wardInfoDataFormSchema: FormSchema[] = [
     },
   },
 ];
+
+export const workDayDataFormSchema: FormSchema[] = [
+  {
+    label: '工作日',
+    field: 'works',
+    required: true,
+    component: 'CheckboxGroup',
+    componentProps: {
+      options: [
+        { label: '周一', value: 'monday' },
+        { label: '周二', value: 'tuesday' },
+        { label: '周三', value: 'wednesday' },
+        { label: '周四', value: 'thursday' },
+        { label: '周五', value: 'friday' },
+        { label: '周六', value: 'saturday' },
+        { label: '周七', value: 'sunday' },
+      ],
+    },
+  },
+];
+// 班次列表信息
+export const sailingsColumns: BasicColumn[] = [
+  {
+    title: '班次名称',
+    width: 150,
+    dataIndex: 'name',
+  },
+  {
+    title: '开始时间',
+    width: 100,
+    dataIndex: 'startTime',
+  },
+  {
+    title: '结束时间',
+    width: 150,
+    dataIndex: 'endTime',
+  },
+];
+
+// 班次编辑列表信息
+export const sailingsEditColumns: BasicColumn[] = [
+  {
+    title: '班次名称',
+    width: 150,
+    dataIndex: 'name',
+    edit: true,
+    editable: true,
+    editComponent: 'Input',
+    editComponentProps: {
+      placeholder: '请输入班次名称',
+    },
+  },
+  {
+    title: '开始时间',
+    width: 100,
+    dataIndex: 'startTime',
+    edit: true,
+    editable: true,
+    editComponent: 'TimePicker',
+    editComponentProps: {
+      placeholder: '请选择时间',
+      format: 'HH:mm',
+      valueFormat: 'HH:mm',
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    title: '结束时间',
+    width: 150,
+    dataIndex: 'endTime',
+    edit: true,
+    editable: true,
+    editComponent: 'TimePicker',
+    editComponentProps: {
+      placeholder: '请选择时间',
+      format: 'HH:mm',
+      valueFormat: 'HH:mm',
+      getPopupContainer: () => document.body,
+    },
+  },
+];

+ 222 - 15
src/views/biz/management/ward/index.vue

@@ -16,10 +16,12 @@
           <Col :span="6">
             <Card title="病区属性" style="height: 680px">
               <template #extra
-                ><Button size="small" v-auth="['sys:wardProperties:add']" @click="handleAddAttr"
-                  >+</Button
-                ></template
-              >
+                ><Button
+                  shape="circle"
+                  v-auth="['bizSys:wardProperties:add']"
+                  @click="handleAddAttr"
+                  ><Icon icon="icon-plus|iconfont" :size="14" /></Button
+              ></template>
               <Row>
                 <div class="type-title">阴性</div>
               </Row>
@@ -52,10 +54,9 @@
           <Col :span="17">
             <Card title="病区信息" style="height: 680px">
               <template #extra
-                ><Button size="small" v-auth="['sys:wardInfo:add']" @click="handleAddInfo"
-                  >+</Button
-                ></template
-              >
+                ><Button shape="circle" v-auth="['bizSys:wardInfo:add']" @click="handleAddInfo"
+                  ><Icon icon="icon-plus|iconfont" :size="14" /></Button
+              ></template>
               <BasicTable @register="registerTable">
                 <template #bodyCell="{ column, record }">
                   <template v-if="column.key === 'disable'">
@@ -67,7 +68,7 @@
                     <TableAction
                       :actions="[
                         {
-                          auth: 'sys:wardInfo:status',
+                          auth: 'bizSys:wardInfo:status',
                           icon: 'icon-minus-square|iconfont',
                           tooltip: '停用',
                           label: '',
@@ -80,7 +81,7 @@
                           },
                         },
                         {
-                          auth: 'sys:wardInfo:status',
+                          auth: 'bizSys:wardInfo:status',
                           icon: 'icon-plus|iconfont',
                           tooltip: '启用',
                           label: '',
@@ -93,7 +94,79 @@
                           },
                         },
                         {
-                          auth: 'sys:wardInfo:edit',
+                          auth: 'bizSys:wardInfo:edit',
+                          icon: 'icon-edit|iconfont',
+                          tooltip: '编辑',
+                          label: '',
+                          onClick: handleEdit.bind(null, record),
+                        },
+                      ]"
+                    />
+                  </template>
+                </template>
+              </BasicTable>
+            </Card>
+          </Col>
+        </Row>
+      </p>
+      <p :key="1" v-else>
+        <Row>
+          <Col :span="6">
+            <Card title="工作日配置" style="height: 680px">
+              <template #extra
+                ><Button shape="circle" v-auth="['bizSys:workday:edit']" @click="handleEditWorkDay">
+                  <Icon icon="icon-edit|iconfont" :size="14" /></Button
+              ></template>
+              <Row v-for="(item, index) in workDays" :key="index">
+                <div class="wrak-day">{{ item.label }}</div>
+              </Row>
+            </Card>
+          </Col>
+          <Col :span="1" />
+          <Col :span="17">
+            <Card title="班次配置" style="height: 680px">
+              <template #extra
+                ><Button v-auth="['bizSys:wardInfo:add']" @click="handleAddSailing" shape="circle"
+                  ><Icon icon="icon-edit|iconfont" :size="14" /></Button
+              ></template>
+              <BasicTable @register="registerSailingsTable">
+                <template #bodyCell="{ column, record }">
+                  <template v-if="column.key === 'disable'">
+                    <Tag :color="formatDictColor(disableOptions, record.disable)">
+                      {{ formatDictValue(disableOptions, record.disable) }}
+                    </Tag>
+                  </template>
+                  <template v-if="column.key === 'action'">
+                    <TableAction
+                      :actions="[
+                        {
+                          auth: 'bizSys:wardInfo:status',
+                          icon: 'icon-minus-square|iconfont',
+                          tooltip: '停用',
+                          label: '',
+                          color: 'error',
+                          ifShow: record.disable == 0,
+                          popConfirm: {
+                            title: '是否确认停用',
+                            placement: 'left',
+                            confirm: handleChangeState.bind(null, record),
+                          },
+                        },
+                        {
+                          auth: 'bizSys:wardInfo:status',
+                          icon: 'icon-plus|iconfont',
+                          tooltip: '启用',
+                          label: '',
+                          ifShow: record.disable == 1,
+                          color: 'error',
+                          popConfirm: {
+                            title: '是否确认启用',
+                            placement: 'left',
+                            confirm: handleChangeState.bind(null, record),
+                          },
+                        },
+                        {
+                          auth: 'bizSys:wardInfo:edit',
                           icon: 'icon-edit|iconfont',
                           tooltip: '编辑',
                           label: '',
@@ -108,23 +181,28 @@
           </Col>
         </Row>
       </p>
-      <p :key="1" v-else> 班次设置 </p>
     </Card>
   </PageWrapper>
   <WardTypeFormModal @register="registerWardTypeModal" @success="handleWardTypeSuccess" />
   <WardInfoFormModal @register="registerWardInfoModal" @success="handleWardInfoSuccess" />
+  <WorkDayFormModal @register="registerWorkDayModal" @success="handleWorkDaySuccess" />
+  <SailingEdit @register="registerSailingEditModal" @success="handleSailingSuccess" />
 </template>
 
 <script lang="ts" setup>
   import { onBeforeMount, ref } from 'vue';
   import { PageWrapper } from '/@/components/Page';
   import { Button, Card, Row, Col, Tag } from 'ant-design-vue';
+  import Icon from '/@/components/Icon/src/Icon.vue';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
-  import { wardInfoColumns } from './data';
+  import { wardInfoColumns, sailingsColumns } from './data';
   import WardTypeFormModal from './wardTypeFormModal.vue';
   import WardInfoFormModal from './wardInfoFormModal.vue';
+  import WorkDayFormModal from './workDayFormModal.vue';
+  import SailingEdit from './sailingsEditFormModal.vue';
   import { getWardInfo, changeStatus } from '/@/api/biz/management/wardInfo';
   import { getAttrList, deleteWardType } from '/@/api/biz/management/wardType';
+  import { getWorkingDay, getSailings } from '/@/api/biz/management/working';
   import { useModal } from '/@/components/Modal';
   import { listDictModel } from '/@/api/common';
   import { useMessage } from '/@/hooks/web/useMessage';
@@ -137,10 +215,12 @@
   const activeKey = ref(0);
   const attributePositiveList = ref([]); // 阳性列表
   const attributeFeminineList = ref([]); // 阴性列表
+  const workDays = ref([]);
   const disableOptions = ref();
   onBeforeMount(async () => {
     disableOptions.value = await listDictModel({ dictCode: 'sys_disable_type' });
     await getWardType();
+    await getWordDay();
   });
   const [registerTable, { reload }] = useTable({
     api: getWardInfo,
@@ -169,8 +249,23 @@
     sortFn: handleSortFn,
   });
 
+  const [registerSailingsTable, { reload: SailingsReload }] = useTable({
+    api: getSailings,
+    columns: sailingsColumns,
+    showIndexColumn: false,
+    formConfig: {
+      labelWidth: 120,
+      autoSubmitOnEnter: true,
+      baseColProps: { xs: 24, sm: 12, md: 12, lg: 8 },
+    },
+    useSearchForm: false,
+    bordered: true,
+  });
+
   const [registerWardTypeModal, { openModal: openWardTypeModal }] = useModal();
   const [registerWardInfoModal, { openModal: openWardInfoModal }] = useModal();
+  const [registerWorkDayModal, { openModal: openWorkDayModal }] = useModal();
+  const [registerSailingEditModal, { openModal: openSailingModal }] = useModal();
   const tableSort = ref([
     {
       field: 'sort',
@@ -216,6 +311,14 @@
     });
   }
 
+  //打开编辑工作日方法
+  function handleEditWorkDay() {
+    openWorkDayModal(true, {
+      record: workDays.value,
+      isUpdate: true,
+    });
+  }
+
   // 打开编辑病区信息方法
   function handleEdit(record: Recordable) {
     openWardInfoModal(true, {
@@ -244,6 +347,7 @@
 
   function handleWardInfoSuccess() {
     reload();
+    SailingsReload();
   }
 
   async function getWardType() {
@@ -263,6 +367,100 @@
     selectType.value = e.key;
     reload();
   }
+
+  // 获取工作日
+  async function getWordDay() {
+    const res = await getWorkingDay();
+    const workDay = [];
+    Object.keys(res).forEach((value, index) => {
+      if (res[value]) {
+        switch (value) {
+          case 'monday': {
+            workDay.push({
+              name: value,
+              key: index,
+              value: res[value],
+              label: '周一',
+            });
+            break;
+          }
+
+          case 'tuesday': {
+            workDay.push({
+              name: value,
+              key: index,
+              value: res[value],
+              label: '周二',
+            });
+            break;
+          }
+
+          case 'wednesday': {
+            workDay.push({
+              name: value,
+              key: index,
+              value: res[value],
+              label: '周三',
+            });
+            break;
+          }
+
+          case 'thursday': {
+            workDay.push({
+              name: value,
+              key: index,
+              value: res[value],
+              label: '周四',
+            });
+            break;
+          }
+
+          case 'friday': {
+            workDay.push({
+              name: value,
+              key: index,
+              value: res[value],
+              label: '周五',
+            });
+            break;
+          }
+
+          case 'saturday': {
+            workDay.push({
+              name: value,
+              key: index,
+              value: res[value],
+              label: '周六',
+            });
+            break;
+          }
+
+          case 'sunday': {
+            workDay.push({
+              name: value,
+              key: index,
+              value: res[value],
+              label: '周日',
+            });
+            break;
+          }
+        }
+      }
+    });
+    workDays.value = workDay;
+  }
+  // 新增班次
+  function handleAddSailing() {
+    openSailingModal(true, {});
+  }
+
+  async function handleWorkDaySuccess() {
+    await getWordDay();
+  }
+
+  async function handleSailingSuccess() {
+    await SailingsReload();
+  }
 </script>
 
 <style lang="less" scoped>
@@ -286,6 +484,15 @@
     border-radius: 4px !important;
     border: 1px solid #c2ccd4 !important;
   }
-</style>
 
-function $forceUpdate() { throw new Error('Function not implemented.'); }
+  .wrak-day {
+    width: 28px;
+    height: 20px;
+    margin-bottom: 20px;
+    text-align: center;
+    font-size: 14px;
+    font-weight: 500;
+    color: #000a18;
+    line-height: 20px;
+  }
+</style>

+ 119 - 0
src/views/biz/management/ward/sailingsEditFormModal.vue

@@ -0,0 +1,119 @@
+<template>
+  <div>
+    <BasicModal
+      v-bind="$attrs"
+      destroyOnClose
+      @register="registerModal"
+      title="班次配置"
+      width="60%"
+      @ok="handleSubmit"
+      :showFooter="true"
+    >
+      <div class="mb-4">
+        <a-button type="primary" shape="round" @click="handleAdd">
+          <template #icon>
+            <PlusOutlined />
+          </template>
+          添加
+        </a-button>
+      </div>
+      <BasicTable @register="registerTable" @edit-change="callEditChange">
+        <template #bodyCell="{ column, record }">
+          <template v-if="column.key === 'action'">
+            <TableAction
+              :actions="[
+                {
+                  auth: '',
+                  icon: 'icon-xt-details_delete_default|iconfont',
+                  tooltip: '删除',
+                  popConfirm: {
+                    title: '是否取消删除',
+                    placement: 'left',
+                    confirm: handleDel.bind(null, record, column),
+                  },
+                },
+              ]"
+            />
+          </template>
+        </template>
+      </BasicTable>
+    </BasicModal>
+  </div>
+</template>
+<script lang="ts" setup>
+  import { nextTick, ref } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicTable, useTable, TableAction } from '/@/components/Table';
+  import { nanoid } from 'nanoid';
+  import { getSailings, sailingsEdit } from '/@/api/biz/management/working';
+  import { sailingsEditColumns } from './data';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  const tableDatas = ref([]);
+  const emit = defineEmits(['success', 'register']);
+  const { createMessage } = useMessage();
+  const [registerModal, { setModalProps, closeModal }] = useModalInner(async () => {
+    setModalProps({ confirmLoading: false, canFullscreen: false });
+    tableDatas.value = await getSailings();
+    await nextTick();
+    await setTableData(tableDatas.value);
+  });
+  const [registerTable, { setTableData, getDataSource }] = useTable({
+    rowKey: 'sort',
+    showIndexColumn: false,
+    bordered: true,
+    striped: false,
+    pagination: false,
+    maxHeight: 200,
+    actionColumn: {
+      width: 40,
+      title: '操作',
+      dataIndex: 'action',
+    },
+    dataSource: tableDatas.value,
+    columns: sailingsEditColumns,
+  });
+
+  async function handleAdd() {
+    tableDatas.value.push({
+      endTime: '',
+      name: '',
+      startTime: '',
+      sort: nanoid(5),
+    });
+    await nextTick();
+    await setTableData(tableDatas.value);
+  }
+
+  // 保存班次配置,请求接口
+  async function handleSubmit() {
+    try {
+      const values = getDataSource();
+      const infoList = [];
+      values.forEach(item => {
+        infoList.push({
+          name: item.name,
+          startTime: item.startTime,
+          endTime: item.endTime,
+        });
+      });
+      const infos = {
+        infos: infoList,
+      };
+      await sailingsEdit(infos);
+      createMessage.success('班次编辑成功!');
+      closeModal();
+      emit('success');
+    } finally {
+      setModalProps({ confirmLoading: false });
+    }
+  }
+  // 删除当前行
+  async function handleDel(record) {
+    const data = getDataSource();
+    const index = data.findIndex(item => item.key === record.key);
+    tableDatas.value.splice(index, 1);
+    await setTableData(tableDatas.value);
+  }
+
+  function callEditChange() {}
+</script>

+ 1 - 1
src/views/biz/management/ward/wardInfoFormModal.vue

@@ -61,7 +61,7 @@
       closeModal();
       emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
     } finally {
-      setModalProps({ confirmLoading: false });
+      setModalProps({ confirmLoading: false, canFullscreen: false });
     }
   }
 </script>

+ 1 - 1
src/views/biz/management/ward/wardTypeFormModal.vue

@@ -51,7 +51,7 @@
       closeModal();
       emit('success', { isUpdate: unref(isUpdate), values: { ...values, configId: rowId.value } });
     } finally {
-      setModalProps({ confirmLoading: false });
+      setModalProps({ confirmLoading: false, canFullscreen: false });
     }
   }
 </script>

+ 87 - 0
src/views/biz/management/ward/workDayFormModal.vue

@@ -0,0 +1,87 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    destroyOnClose
+    @register="registerModal"
+    :title="getTitle"
+    width="22%"
+    @ok="handleSubmit"
+  >
+    <BasicForm @register="registerForm" />
+  </BasicModal>
+</template>
+<script lang="ts" setup>
+  import { ref, computed, unref } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { workDayDataFormSchema } from './data';
+
+  import { WorkingDayEdit } from '/@/api/biz/management/working';
+
+  const emit = defineEmits(['success', 'register']);
+
+  const getTitle = computed(() => '工作日配置');
+  const isUpdate = ref(false);
+  const rowId = ref();
+
+  const { createMessage } = useMessage();
+  const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
+    layout: 'vertical',
+    showResetButton: false,
+    labelWidth: 100,
+    schemas: workDayDataFormSchema,
+    showActionButtonGroup: false,
+    actionColOptions: {
+      span: 23,
+    },
+  });
+  const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
+    await resetFields();
+    setModalProps({ confirmLoading: false, canFullscreen: false });
+    isUpdate.value = !!data?.isUpdate;
+
+    if (unref(isUpdate)) {
+      rowId.value = data.record.roleId;
+      console.log(data);
+      const works = [];
+      data.record.forEach(item => {
+        works.push(item.name);
+      });
+      await setFieldsValue({ works });
+    }
+  });
+
+  // 提交按钮事件
+  async function handleSubmit() {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+      const workings = {
+        monday: 0,
+        tuesday: 0,
+        wednesday: 0,
+        thursday: 0,
+        friday: 0,
+        saturday: 0,
+        sunday: 0,
+      };
+      Object.keys(workings).forEach(item => {
+        if (values.works.indexOf(item) == -1) {
+          workings[item] = 0;
+        } else {
+          workings[item] = 1;
+        }
+      });
+      console.log('workings::::::::', workings);
+      await WorkingDayEdit(workings);
+      createMessage.success('工作日编辑成功!');
+      closeModal();
+      emit('success', {
+        isUpdate: unref(isUpdate),
+      });
+    } finally {
+      setModalProps({ confirmLoading: false });
+    }
+  }
+</script>