zhangafei 1 mēnesi atpakaļ
vecāks
revīzija
2ab4cc1e16

+ 4 - 10
src/settings/designSetting.ts

@@ -15,7 +15,7 @@ export const APP_PRESET_COLOR_LIST: string[] = [
   '#52c41a',
   '#ee4f12',
   '#0096c7',
-  '#9c27b0',
+  '#722ed1',
   '#ff9800',
 ];
 
@@ -30,42 +30,36 @@ export const HEADER_PRESET_BG_COLOR_LIST: string[] = [
   '#e74c3c',
   '#52c41a',
   '#394664',
-  '#faad14',
+  '#9254de',
   '#383f45',
 ];
 
 // sider preset color
 export const SIDE_BAR_BG_COLOR_LIST: string[] = [
   '#001529',
-  // '#212121',
   '#009688',
   '#273352',
   '#ffffff',
   '#191b24',
-  // '#191a23',
   '#037bd5',
   '#304156',
   '#faad14',
   '#28333E',
-  // '#344058',
-  '#e74c3c',
+  '#9254de',
   '#a0d911',
 ];
 
 // sider logo line preset color [logo����ɫ]
 export const SIDER_LOGO_BG_COLOR_LIST: string[] = [
   'linear-gradient(180deg, #000000, #021d37)',
-  // 'linear-gradient(180deg, #000000, #282828)',
   'linear-gradient(180deg, #078d80, #029184)',
   'linear-gradient(180deg, #1c253e, #2b385c)',
   'linear-gradient(180deg, #ffffff, #ffffff)',
   'linear-gradient(180deg, #000000, #242735)',
-  // 'linear-gradient(180deg, #000000, #1d1f2a)',
   'linear-gradient(180deg, #1d77bb, #188efa)',
   'linear-gradient(180deg, #304156, #32455d)',
   'linear-gradient(180deg, #faad14, #faad14)',
   'linear-gradient(180deg, #000000, #2b3743)',
-  // 'linear-gradient(180deg, #344058, #374560)',
-  'linear-gradient(180deg, #e83723, #e52611)',
+  'linear-gradient(180deg, #9254de, #9254de)',
   'linear-gradient(180deg, #383f45, #3b434b)',
 ];

+ 53 - 0
src/views/equipmentLifecycle/components/ElApiSelect.vue

@@ -0,0 +1,53 @@
+<template>
+  <ApiSelect
+    v-bind="$attrs"
+    :api="api"
+    :params="params"
+    resultField="records"
+    :labelField="labelField"
+    :valueField="valueField"
+    :showSearch="true"
+    :immediate="false"
+    :pageConfig="{
+      isPage: true,
+      // 如果和默认的分页字段一致,请忽略以下配置
+      pageField: 'pageNo',
+      pageSizeField: 'pageSize',
+      totalField: 'total',
+      listField: 'records',
+    }"
+    :placeholder="placeholder"
+  />
+</template>
+<script setup lang="ts">
+  import ApiSelect from '/@/components/Form/src/components/ApiSelect.vue';
+
+  type OptionsItem = {
+    label: any;
+    value: any;
+    [key: string]: any;
+  };
+
+  defineProps({
+    api: {
+      type: Function as PropType<(arg?: Recordable<any> | undefined) => Promise<OptionsItem[]>>,
+      default: () => new Promise((resolve) => resolve([])),
+    },
+    labelField: {
+      type: String,
+      default: 'title',
+    },
+    valueField: {
+      type: String,
+      default: 'id',
+    },
+    placeholder: {
+      type: String,
+      default: '请选择',
+    },
+    params: {
+      type: Object,
+      default: () => {},
+    },
+  });
+</script>

+ 0 - 3
src/views/equipmentLifecycle/device/list/DeviceBaseInfo.data.ts

@@ -311,9 +311,6 @@ export const formSchema: FormSchema[] = [
     label: '负责人',
     field: 'personInCharge',
     component: 'JSelectUser',
-    componentProps: {
-      maxSelectCount: 1,
-    },
     colProps: { span: 12 },
   },
   {

+ 20 - 33
src/views/equipmentLifecycle/device/list/index.vue

@@ -1,44 +1,31 @@
 <template>
   <a-tabs v-model:activeKey="activeKey" type="card">
     <a-tab-pane key="1" tab="在用设备"><DeviceBaseInfoList /></a-tab-pane>
-    <a-tab-pane key="2" tab="已报废设备">Content of Tab Pane 2</a-tab-pane>
-    <a-tab-pane key="3" tab="已变卖设备">Content of Tab Pane 3</a-tab-pane>
+    <a-tab-pane key="2" tab="已报废设备">已报废设备</a-tab-pane>
+    <a-tab-pane key="3" tab="已变卖设备">已变卖设备</a-tab-pane>
   </a-tabs>
-  <!-- <div>
-    <a-upload v-model:file-list="fileList" name="file" action="/jeecgboot/sys/common/uploadDevice" :headers="headers" @change="handleChange">
-      <a-button>
-        <UploadOutlined />
-        Click to Upload
-      </a-button>
-    </a-upload>
-  </div> -->
 </template>
 <script lang="ts" setup>
-  import DeviceBaseInfoList from './DeviceBaseInfoList.vue';
-
-  // import { getToken } from '/@/utils/auth';
-  // import { ConfigEnum } from '/@/enums/httpEnum';
   import { ref } from 'vue';
-  // import { message } from 'ant-design-vue';
-  // import { UploadOutlined } from '@ant-design/icons-vue';
-  // import type { UploadChangeParam } from 'ant-design-vue';
+  import DeviceBaseInfoList from './DeviceBaseInfoList.vue';
 
   const activeKey = ref('1');
+</script>
+<style lang="less" scoped>
+  .ant-tabs {
+    height: 100%;
+    padding: 10px;
 
-  // const handleChange = (info: UploadChangeParam) => {
-  //   if (info.file.status !== 'uploading') {
-  //     console.log(info.file, info.fileList);
-  //   }
-  //   if (info.file.status === 'done') {
-  //     message.success(`${info.file.name} file uploaded successfully`);
-  //   } else if (info.file.status === 'error') {
-  //     message.error(`${info.file.name} file upload failed.`);
-  //   }
-  // };
+    :deep(.ant-tabs-nav) {
+      margin-bottom: 0;
+    }
 
-  // const fileList = ref([]);
-  // const headers = {
-  //   authorization: 'authorization-text',
-  //   [ConfigEnum.TOKEN]: getToken(),
-  // };
-</script>
+    :deep(.ant-tabs-content) {
+      height: 100%;
+    }
+
+    :deep(.jeecg-basic-table) {
+      padding: 10px 0 0;
+    }
+  }
+</style>

+ 111 - 0
src/views/equipmentLifecycle/device/tree/components/department.vue

@@ -0,0 +1,111 @@
+<template>
+  <div class="department-wrap">
+    <a-input-search v-model:value="searchValue" style="margin-bottom: 8px" placeholder="Search" />
+    <a-tree :expanded-keys="expandedKeys" block-node show-icon :auto-expand-parent="autoExpandParent" :tree-data="gData" @expand="onExpand" show-line>
+      <template #title="{ title }">
+        <span v-if="title.indexOf(searchValue) > -1">
+          {{ title.substring(0, title.indexOf(searchValue)) }}
+          <span style="color: #f50">{{ searchValue }}</span>
+          {{ title.substring(title.indexOf(searchValue) + searchValue.length) }}
+        </span>
+        <span v-else>{{ title }}</span>
+      </template>
+    </a-tree>
+  </div>
+</template>
+<script lang="ts" setup>
+  import { ref, watch } from 'vue';
+  import type { TreeProps } from 'ant-design-vue';
+
+  const x = 10;
+  const y = 2;
+  const z = 1;
+  const genData: TreeProps['treeData'] = [];
+
+  const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
+    const preKey = _preKey || '0';
+    const tns = _tns || genData;
+
+    const children: any[] = [];
+    for (let i = 0; i < x; i++) {
+      const key = `${preKey}-${i}`;
+      tns.push({ title: key, key });
+      if (i < y) {
+        children.push(key);
+      }
+    }
+    if (_level < 0) {
+      return tns;
+    }
+    const level = _level - 1;
+    children.forEach((key, index) => {
+      tns[index].children = [];
+      return generateData(level, key, tns[index].children);
+    });
+  };
+  generateData(z);
+
+  const dataList: TreeProps['treeData'] = [];
+  const generateList = (data: TreeProps['treeData']) => {
+    if (!data) {
+      return null;
+    }
+    for (let i = 0; i < data.length; i++) {
+      const node = data[i];
+      const key = node.key;
+      dataList.push({ key, title: key });
+      if (node.children) {
+        generateList(node.children);
+      }
+    }
+  };
+  generateList(genData);
+
+  const getParentKey = (key: string | number, tree: TreeProps['treeData']): string | number | undefined => {
+    let parentKey;
+    if (!tree) {
+      return parentKey;
+    }
+    for (let i = 0; i < tree.length; i++) {
+      const node = tree[i];
+      if (node.children) {
+        if (node.children.some((item) => item.key === key)) {
+          parentKey = node.key;
+        } else if (getParentKey(key, node.children)) {
+          parentKey = getParentKey(key, node.children);
+        }
+      }
+    }
+    return parentKey;
+  };
+  const expandedKeys = ref<(string | number)[]>([]);
+  const searchValue = ref<string>('');
+  const autoExpandParent = ref<boolean>(true);
+  const gData = ref<TreeProps['treeData']>(genData);
+
+  const onExpand = (keys: string[]) => {
+    expandedKeys.value = keys;
+    autoExpandParent.value = false;
+  };
+
+  watch(searchValue, (value) => {
+    const expanded = dataList
+      .map((item: TreeProps['treeData'][number]) => {
+        if (item.title.indexOf(value) > -1) {
+          return getParentKey(item.key, gData.value);
+        }
+        return null;
+      })
+      .filter((item, i, self) => item && self.indexOf(item) === i);
+    expandedKeys.value = expanded;
+    searchValue.value = value;
+    autoExpandParent.value = true;
+  });
+</script>
+<style lang="less" scoped>
+  .department-wrap {
+    height: 100%;
+    padding: 20px;
+    overflow: auto;
+  }
+</style>

+ 23 - 2
src/views/equipmentLifecycle/device/tree/index.vue

@@ -1,4 +1,25 @@
 <template>
-  <div class="app-container"> tree </div>
+  <div class="tree-container flex">
+    <div class="tree">
+      <tree />
+    </div>
+    <div class="content"></div>
+  </div>
 </template>
-<script setup lang="ts"></script>
+<script setup lang="ts">
+  import tree from './tree.vue';
+</script>
+<style lang="less" scoped>
+  .tree-container {
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+    padding: 10px;
+
+    .tree {
+      width: 500px;
+      border-radius: 6px;
+      overflow: hidden;
+    }
+  }
+</style>

+ 42 - 0
src/views/equipmentLifecycle/device/tree/tree.vue

@@ -0,0 +1,42 @@
+<template>
+  <a-tabs v-model:activeKey="activeKey" type="card">
+    <a-tab-pane key="1" tab="按部门">
+      <department />
+    </a-tab-pane>
+    <a-tab-pane key="2" tab="按位置">按位置</a-tab-pane>
+    <a-tab-pane key="3" tab="按类别">已变卖设备</a-tab-pane>
+  </a-tabs>
+</template>
+<script setup lang="ts">
+  import { ref } from 'vue';
+  import department from './components/department.vue';
+
+  const activeKey = ref('1');
+</script>
+<style lang="less" scoped>
+  .ant-tabs {
+    height: 100%;
+
+    :deep(.ant-tabs-nav) {
+      margin-bottom: 0;
+    }
+
+    :deep(.ant-tabs-content-holder) {
+      height: 0;
+      overflow: hidden;
+
+      .ant-tabs-content {
+        height: 100%;
+        background-color: #fff;
+        border: 1px solid rgba(5, 5, 5, 0.06);
+        border-top: 0;
+        border-radius: 0 0 6px 6px;
+        overflow: hidden;
+      }
+    }
+
+    :deep(.jeecg-basic-table) {
+      padding: 10px 0 0;
+    }
+  }
+</style>

+ 14 - 15
src/views/equipmentLifecycle/supplier/accept/EquipmentAccept.api.ts

@@ -1,12 +1,12 @@
-import {defHttp} from '/@/utils/http/axios';
-import { useMessage } from "/@/hooks/web/useMessage";
+import { defHttp } from '/@/utils/http/axios';
+import { useMessage } from '/@/hooks/web/useMessage';
 
 const { createConfirm } = useMessage();
 
 enum Api {
   list = '/purchaseManage/equipmentAccept/list',
-  save='/purchaseManage/equipmentAccept/add',
-  edit='/purchaseManage/equipmentAccept/edit',
+  save = '/purchaseManage/equipmentAccept/add',
+  edit = '/purchaseManage/equipmentAccept/edit',
   deleteOne = '/purchaseManage/equipmentAccept/delete',
   deleteBatch = '/purchaseManage/equipmentAccept/deleteBatch',
   importExcel = '/purchaseManage/equipmentAccept/importExcel',
@@ -38,17 +38,16 @@ export const equipmentInfoList = Api.equipmentInfoList;
  * 列表接口
  * @param params
  */
-export const list = (params) =>
-  defHttp.get({url: Api.list, params});
+export const list = (params) => defHttp.get({ url: Api.list, params });
 
 /**
  * 删除单个
  */
-export const deleteOne = (params,handleSuccess) => {
-  return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
+export const deleteOne = (params, handleSuccess) => {
+  return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
     handleSuccess();
   });
-}
+};
 /**
  * 批量删除
  * @param params
@@ -61,17 +60,17 @@ export const batchDelete = (params, handleSuccess) => {
     okText: '确认',
     cancelText: '取消',
     onOk: () => {
-      return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
+      return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
         handleSuccess();
       });
-    }
+    },
   });
-}
+};
 /**
  * 保存或者更新
  * @param params
  */
 export const saveOrUpdate = (params, isUpdate) => {
-  let url = isUpdate ? Api.edit : Api.save;
-  return defHttp.post({url: url, params});
-}
+  const url = isUpdate ? Api.edit : Api.save;
+  return defHttp.post({ url: url, params });
+};

+ 47 - 40
src/views/equipmentLifecycle/supplier/accept/EquipmentAccept.data.ts

@@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Table';
 // import { rules } from '/@/utils/helper/validator';
 import { render } from '/@/utils/common/renderUtils';
 import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types';
+import dayjs from 'dayjs';
 // import { getWeekMonthQuarterYear } from '/@/utils';
 //列表数据
 export const columns: BasicColumn[] = [
@@ -17,9 +18,12 @@ export const columns: BasicColumn[] = [
     dataIndex: 'title',
   },
   {
-    title: '验收类型(1 到货验收 2 开箱验收  3 安装验收 4 质保验收 5 试运行验收)',
+    title: '验收类型',
     align: 'center',
     dataIndex: 'acceptType',
+    customRender(opt) {
+      return render.renderDict(opt.record.acceptType, 'accept_type');
+    },
   },
   {
     title: '验收人',
@@ -41,55 +45,50 @@ export const columns: BasicColumn[] = [
     align: 'center',
     dataIndex: 'remark',
   },
-  {
-    title: '前置验收单',
-    align: 'center',
-    dataIndex: 'preAcceptForm',
-  },
-  {
-    title: '随机附件是否完备(0 是 1否)',
-    align: 'center',
-    dataIndex: 'completeOrNot',
-  },
-  {
-    title: '到货时间',
-    align: 'center',
-    dataIndex: 'arrivalTime',
-  },
-  {
-    title: '到货验收单',
-    align: 'center',
-    dataIndex: 'arrivalAcceptForm',
-  },
-  {
-    title: '采购申请id',
-    align: 'center',
-    dataIndex: 'purchaseApplicationId',
-  },
 ];
 //查询数据
 export const searchFormSchema: FormSchema[] = [];
 //表单数据
 export const formSchema: FormSchema[] = [
+  {
+    label: '采购申请单',
+    field: 'purchaseApplicationId',
+    component: 'Input',
+    colProps: { span: 12 },
+    rules: [{ required: true, message: '采购申请单不能为空' }],
+    slot: 'purchaseApplicationId',
+  },
   {
     label: '编号',
     field: 'number',
     component: 'Input',
+    colProps: { span: 12 },
+    rules: [{ required: true, message: '编号不能为空' }],
   },
   {
-    label: '标题',
+    label: '验收标题',
     field: 'title',
     component: 'Input',
+    colProps: { span: 12 },
+    rules: [{ required: true, message: '标题不能为空' }],
   },
   {
-    label: '验收类型(1 到货验收 2 开箱验收  3 安装验收 4 质保验收 5 试运行验收)',
+    label: '验收类型',
     field: 'acceptType',
-    component: 'InputNumber',
+    component: 'JDictSelectTag',
+    componentProps: {
+      dictCode: 'accept_type',
+      placeholder: '请选择验收类型',
+    },
+    colProps: { span: 12 },
+    rules: [{ required: true, message: '验收类型不能为空' }],
   },
   {
     label: '验收人',
     field: 'accepter',
-    component: 'Input',
+    component: 'JSelectUser',
+    colProps: { span: 12 },
+    rules: [{ required: true, message: '验收人不能为空' }],
   },
   {
     label: '验收时间',
@@ -99,26 +98,31 @@ export const formSchema: FormSchema[] = [
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss',
     },
+    defaultValue: dayjs().format('YYYY-MM-DD HH:mm:ss'),
+    colProps: { span: 12 },
+    rules: [{ required: true, message: '验收时间不能为空' }],
   },
   {
     label: '验收设备',
     field: 'acceptEquipment',
     component: 'Input',
-  },
-  {
-    label: '备注',
-    field: 'remark',
-    component: 'Input',
+    colProps: { span: 12 },
   },
   {
     label: '前置验收单',
     field: 'preAcceptForm',
     component: 'Input',
+    colProps: { span: 12 },
+    slot: 'preAcceptForm',
   },
   {
-    label: '随机附件是否完备(0 是 1否)',
+    label: '随机附件是否完备',
     field: 'completeOrNot',
-    component: 'InputNumber',
+    component: 'JSwitch',
+    componentProps: {
+      options: ['0', '1'],
+    },
+    colProps: { span: 12 },
   },
   {
     label: '到货时间',
@@ -128,16 +132,19 @@ export const formSchema: FormSchema[] = [
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss',
     },
+    colProps: { span: 12 },
   },
   {
     label: '到货验收单',
     field: 'arrivalAcceptForm',
     component: 'Input',
+    colProps: { span: 12 },
+    slot: 'arrivalAcceptForm',
   },
   {
-    label: '采购申请id',
-    field: 'purchaseApplicationId',
-    component: 'Input',
+    label: '备注',
+    field: 'remark',
+    component: 'InputTextArea',
   },
   // TODO 主键隐藏字段,目前写死为ID
   {

+ 152 - 88
src/views/equipmentLifecycle/supplier/accept/components/EquipmentAcceptModal.vue

@@ -1,6 +1,28 @@
 <template>
-  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
-    <BasicForm @register="registerForm" ref="formRef" name="EquipmentAcceptForm"/>
+  <BasicModal
+    v-bind="$attrs"
+    @register="registerModal"
+    destroyOnClose
+    :title="title"
+    :width="1200"
+    :bodyStyle="{
+      padding: '20px 20px 0',
+    }"
+    @ok="handleSubmit"
+  >
+    <BasicForm @register="registerForm" ref="formRef" name="EquipmentAcceptForm">
+      <!-- 选择采购申请 --->
+      <template #purchaseApplicationId="{ model, field }">
+        <el-api-select v-model:value="model[field]" :api="applyList" :params="applyParams" labelField="purchaseTitle" placeholder="请选择采购申请" />
+      </template>
+      <!-- 选择前置验收单 --->
+      <template #preAcceptForm="{ model, field }">
+        <el-api-select v-model:value="model[field]" :api="acceptList" :params="params" placeholder="请选择前置验收单" />
+      </template>
+      <template #arrivalAcceptForm="{ model, field }">
+        <el-api-select v-model:value="model[field]" :api="acceptList" :params="arrivalParams" placeholder="请选择到货验收单" />
+      </template>
+    </BasicForm>
     <!-- 子表单区域 -->
     <a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
       <a-tab-pane tab="设备相关文件" key="equipmentRelatedFile" :forceRender="true">
@@ -16,7 +38,7 @@
           :rowSelection="true"
           :disabled="formDisabled"
           :toolbar="true"
-          />
+        />
       </a-tab-pane>
       <a-tab-pane tab="设备信息" key="equipmentInfo" :forceRender="true">
         <JVxeTable
@@ -31,103 +53,145 @@
           :rowSelection="true"
           :disabled="formDisabled"
           :toolbar="true"
-          />
+        />
       </a-tab-pane>
     </a-tabs>
   </BasicModal>
 </template>
 
 <script lang="ts" setup>
-    import {ref, computed, unref,reactive} from 'vue';
-    import {BasicModal, useModalInner} from '/@/components/Modal';
-    import {BasicForm, useForm} from '/@/components/Form/index';
-    import { JVxeTable } from '/@/components/jeecg/JVxeTable'
-    import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts'
-    import {formSchema,equipmentRelatedFileColumns,equipmentInfoColumns} from '../EquipmentAccept.data';
-    import {saveOrUpdate,equipmentRelatedFileList,equipmentInfoList} from '../EquipmentAccept.api';
-    import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
-    // Emits声明
-    const emit = defineEmits(['register','success']);
-    const isUpdate = ref(true);
-    const formDisabled = ref(false);
-    const refKeys = ref(['equipmentRelatedFile', 'equipmentInfo', ]);
-    const activeKey = ref('equipmentRelatedFile');
-    const equipmentRelatedFile = ref();
-    const equipmentInfo = ref();
-    const tableRefs = {equipmentRelatedFile, equipmentInfo, };
-    const equipmentRelatedFileTable = reactive({
-          loading: false,
-          dataSource: [],
-          columns:equipmentRelatedFileColumns
-    })
-    const equipmentInfoTable = reactive({
-          loading: false,
-          dataSource: [],
-          columns:equipmentInfoColumns
-    })
-    //表单配置
-    const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
-        labelWidth: 150,
-        schemas: formSchema,
-        showActionButtonGroup: false,
-        baseColProps: {span: 24}
-    });
-     //表单赋值
-    const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
-        //重置表单
-        await reset();
-        setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter});
-        isUpdate.value = !!data?.isUpdate;
-        formDisabled.value = !data?.showFooter;
-        if (unref(isUpdate)) {
-            //表单赋值
-            await setFieldsValue({
-                ...data.record,
-            });
-             requestSubTableData(equipmentRelatedFileList, {id:data?.record?.id}, equipmentRelatedFileTable)
-             requestSubTableData(equipmentInfoList, {id:data?.record?.id}, equipmentInfoTable)
-        }
-        // 隐藏底部时禁用整个表单
-       setProps({ disabled: !data?.showFooter })
-    });
-    //方法配置
-    const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys);
+  import { ref, computed, unref, reactive } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+  import { JVxeTable } from '/@/components/jeecg/JVxeTable';
+  import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods';
+  import { formSchema, equipmentRelatedFileColumns, equipmentInfoColumns } from '../EquipmentAccept.data';
+  import { saveOrUpdate, equipmentRelatedFileList, equipmentInfoList } from '../EquipmentAccept.api';
+  import { useUserStore } from '/@/store/modules/user';
+  import { list as applyList } from '../../apply/PurchaseApplication.api';
+  import { list as acceptList } from '../EquipmentAccept.api';
+  import ElApiSelect from '/@/views/equipmentLifecycle/components/ElApiSelect.vue';
 
-    //设置标题
-    const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(formDisabled) ? '编辑' : '详情'));
+  const userStore = useUserStore();
+  // Emits声明
+  const emit = defineEmits(['register', 'success']);
+  const isUpdate = ref(true);
+  const formDisabled = ref(false);
+  const refKeys = ref(['equipmentRelatedFile', 'equipmentInfo']);
+  const activeKey = ref('equipmentRelatedFile');
+  const equipmentRelatedFile = ref();
+  const equipmentInfo = ref();
+  const tableRefs = { equipmentRelatedFile, equipmentInfo };
+  const equipmentRelatedFileTable = reactive({
+    loading: false,
+    dataSource: [],
+    columns: equipmentRelatedFileColumns,
+  });
+  const equipmentInfoTable = reactive({
+    loading: false,
+    dataSource: [],
+    columns: equipmentInfoColumns,
+  });
+  //表单配置
+  const [registerForm, { setProps, resetFields, setFieldsValue }] = useForm({
+    labelWidth: 130,
+    schemas: formSchema,
+    showActionButtonGroup: false,
+    baseColProps: { span: 24 },
+  });
 
-    async function reset(){
-      await resetFields();
-      activeKey.value = 'equipmentRelatedFile';
-      equipmentRelatedFileTable.dataSource = [];
-      equipmentInfoTable.dataSource = [];
+  const info = ref<any>({});
+  const params = ref<any>(null);
+  const arrivalParams = ref<any>(null);
+  const applyParams = ref<any>({ approvalStatus: 1 });
+  //表单赋值
+  const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
+    //重置表单
+    await reset();
+    setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
+    isUpdate.value = !!data?.isUpdate;
+    formDisabled.value = !data?.showFooter;
+    info.value = data.record || {};
+    if (unref(isUpdate)) {
+      //表单赋值
+      await setFieldsValue({
+        ...data.record,
+      });
+
+      if (typeof requestSubTableData === 'function') {
+        requestSubTableData(equipmentRelatedFileList, { id: data?.record?.id }, equipmentRelatedFileTable);
+        requestSubTableData(equipmentInfoList, { id: data?.record?.id }, equipmentInfoTable);
+      }
+
+      params.value = {
+        superQueryMatchType: 'and',
+        superQueryParams: encodeURIComponent(JSON.stringify([{ field: 'id', rule: 'ne', val: data.record?.id, type: 'text', dbType: 'string' }])),
+      };
+
+      arrivalParams.value = {
+        superQueryMatchType: 'and',
+        superQueryParams: encodeURIComponent(
+          JSON.stringify([
+            { field: 'id', rule: 'ne', val: data.record?.id, type: 'text', dbType: 'string' },
+            { field: 'acceptType', rule: 'eq', val: '1', type: 'text', dbType: 'string' },
+          ])
+        ),
+      };
+    } else {
+      await setFieldsValue({
+        accepter: userStore.getUserInfo.username,
+      });
     }
-    function classifyIntoFormData(allValues) {
-         let main = Object.assign({}, allValues.formValue)
-         return {
-           ...main, // 展开
-           equipmentRelatedFileList: allValues.tablesValue[0].tableData,
-           equipmentInfoList: allValues.tablesValue[1].tableData,
-         }
-       }
-    //表单提交事件
-    async function requestAddOrEdit(values) {
-        try {
-            setModalProps({confirmLoading: true});
-            //提交表单
-            await saveOrUpdate(values, isUpdate.value);
-            //关闭弹窗
-            closeModal();
-            //刷新列表
-            emit('success');
-        } finally {
-            setModalProps({confirmLoading: false});
-        }
+    // 隐藏底部时禁用整个表单
+    setProps({ disabled: !data?.showFooter });
+  });
+  //方法配置
+  const [handleChangeTabs, handleSubmit, requestSubTableData, formRef] = useJvxeMethod(
+    requestAddOrEdit,
+    classifyIntoFormData,
+    tableRefs,
+    activeKey,
+    refKeys
+  );
+
+  //设置标题
+  const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(formDisabled) ? '编辑' : '详情'));
+
+  async function reset() {
+    await resetFields();
+    activeKey.value = 'equipmentRelatedFile';
+    equipmentRelatedFileTable.dataSource = [];
+    equipmentInfoTable.dataSource = [];
+  }
+  function classifyIntoFormData(allValues) {
+    let main = Object.assign({}, allValues.formValue);
+    return {
+      ...main, // 展开
+      equipmentRelatedFileList: allValues.tablesValue[0].tableData,
+      equipmentInfoList: allValues.tablesValue[1].tableData,
+    };
+  }
+  //表单提交事件
+  async function requestAddOrEdit(values) {
+    console.log(values);
+
+    return;
+    try {
+      setModalProps({ confirmLoading: true });
+      //提交表单
+      await saveOrUpdate(values, isUpdate.value);
+      //关闭弹窗
+      closeModal();
+      //刷新列表
+      emit('success');
+    } finally {
+      setModalProps({ confirmLoading: false });
     }
+  }
 </script>
 
 <style lang="less" scoped>
-	/** 时间和数字输入框样式 */
+  /** 时间和数字输入框样式 */
   :deep(.ant-input-number) {
     width: 100%;
   }
@@ -135,4 +199,4 @@
   :deep(.ant-calendar-picker) {
     width: 100%;
   }
-</style>
+</style>

+ 0 - 3
src/views/equipmentLifecycle/supplier/apply/PurchaseApplication.data.ts

@@ -128,9 +128,6 @@ export const getFormSchema = (props?: any) => {
       label: '申请人',
       field: 'applicant',
       component: 'JSelectUser',
-      componentProps: {
-        maxSelectCount: 1,
-      },
       colProps: { span: 12 },
       rules: [{ required: true, message: '请选择申请人' }],
     },

+ 3 - 35
src/views/equipmentLifecycle/supplier/apply/components/PurchaseApplicationModal.vue

@@ -29,42 +29,10 @@
           :toolbar="true"
         >
           <template #recommendSupplierOne="props">
-            <ApiSelect
-              v-model:value="props.row.recommendSupplierOne"
-              :api="supplierList"
-              resultField="records"
-              labelField="supplierName"
-              valueField="id"
-              :showSearch="true"
-              :pageConfig="{
-                isPage: true,
-                // 如果和默认的分页字段一致,请忽略以下配置
-                pageField: 'pageNo',
-                pageSizeField: 'pageSize',
-                totalField: 'total',
-                listField: 'records',
-              }"
-              placeholder="请选择供应商"
-            />
+            <el-api-select v-model:value="props.row.recommendSupplierOne" labelField="supplierName" :api="supplierList" placeholder="请选择供应商" />
           </template>
           <template #recommendSupplierTwo="props">
-            <ApiSelect
-              v-model:value="props.row.recommendSupplierTwo"
-              :api="supplierList"
-              resultField="records"
-              labelField="supplierName"
-              valueField="id"
-              :showSearch="true"
-              :pageConfig="{
-                isPage: true,
-                // 如果和默认的分页字段一致,请忽略以下配置
-                pageField: 'pageNo',
-                pageSizeField: 'pageSize',
-                totalField: 'total',
-                listField: 'records',
-              }"
-              placeholder="请选择供应商"
-            />
+            <el-api-select v-model:value="props.row.recommendSupplierTwo" labelField="supplierName" :api="supplierList" placeholder="请选择供应商" />
           </template>
         </JVxeTable>
       </a-tab-pane>
@@ -80,7 +48,7 @@
   import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods';
   import { getFormSchema, materialListColumns, currentTable } from '../PurchaseApplication.data';
   import { saveOrUpdate, materialListList } from '../PurchaseApplication.api';
-  import ApiSelect from '/@/components/Form/src/components/ApiSelect.vue';
+  import ElApiSelect from '/@/views/equipmentLifecycle/components/ElApiSelect.vue';
   import AttachmentsEditTable from '/@/views/equipmentLifecycle/manager/attachments/AttachmentsEditTable.vue';
   import { list as supplierList } from '/@/views/equipmentLifecycle/supplier/list/SupplierManage.api';
 

+ 0 - 3
src/views/equipmentLifecycle/supplier/plan/PurchasePlan.data.ts

@@ -141,9 +141,6 @@ export const formSchema: FormSchema[] = [
     label: '申请人',
     field: 'applicant',
     component: 'JSelectUser',
-    componentProps: {
-      maxSelectCount: 1,
-    },
     colProps: { span: 12 },
     rules: [{ required: true, message: '请选择申请人' }],
   },

+ 2 - 18
src/views/equipmentLifecycle/supplier/plan/components/PurchasePlanModal.vue

@@ -29,23 +29,7 @@
           :toolbar="true"
         >
           <template #supplier="props">
-            <ApiSelect
-              v-model:value="props.row.supplier"
-              :api="supplierList"
-              resultField="records"
-              labelField="supplierName"
-              valueField="id"
-              :showSearch="true"
-              :pageConfig="{
-                isPage: true,
-                // 如果和默认的分页字段一致,请忽略以下配置
-                pageField: 'pageNo',
-                pageSizeField: 'pageSize',
-                totalField: 'total',
-                listField: 'records',
-              }"
-              placeholder="请选择供应商"
-            />
+            <el-api-select v-model:value="props.row.supplier" labelField="supplierName" :api="supplierList" placeholder="请选择供应商" />
           </template>
         </JVxeTable>
       </a-tab-pane>
@@ -61,7 +45,7 @@
   import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods';
   import { formSchema, purchasePlanInfoColumns, currentTable } from '../PurchasePlan.data';
   import { saveOrUpdate, purchasePlanInfoList } from '../PurchasePlan.api';
-  import ApiSelect from '/@/components/Form/src/components/ApiSelect.vue';
+  import ElApiSelect from '/@/views/equipmentLifecycle/components/ElApiSelect.vue';
   import { list as supplierList } from '/@/views/equipmentLifecycle/supplier/list/SupplierManage.api';
   import AttachmentsEditTable from '/@/views/equipmentLifecycle/manager/attachments/AttachmentsEditTable.vue';