xiaodai2017 2 years ago
parent
commit
903f07d8fc

+ 3 - 1
src/components/BasicForm/src/form-items.vue

@@ -112,7 +112,9 @@ onMounted(() => {
                 style="width: 150px"
               >
                 <el-option
-                  v-for="option in item.otherOptions?.inputGroupOptions"
+                  v-for="(option, index) in item.otherOptions
+                    ?.inputGroupOptions"
+                  :key="option.value + index"
                   :value="option.value"
                   :label="option.label"
                 />

+ 49 - 0
src/components/ListModal/ListModal.vue

@@ -0,0 +1,49 @@
+<script setup lang="ts">
+import { computed, ref, unref } from "vue";
+import { PageSearch, usePageSearch } from "/@/components/PageSearch";
+import { modalProps } from "./types";
+import { ElMessage } from "element-plus";
+import { PageContent } from "/@/components/PageContent";
+const props = defineProps(modalProps);
+const modelTitle = computed(() => props.modalConfig.title);
+const searchConfig = computed(() => props.modalConfig.searchConfig);
+const contentConfig = computed(() => props.modalConfig.contentConfig);
+const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
+  undefined,
+  undefined,
+  searchConfig
+);
+const dialogVisible = ref(false);
+function handleConfirmClick() {}
+async function show(id) {
+  console.log(id);
+  // modelFormItems.value.forEach(item => {
+  //   if (item.field === "id") {
+  //     formData.value[item.field] = id;
+  //   } else {
+  //     formData.value[item.field] = "";
+  //   }
+  // });
+  dialogVisible.value = true;
+}
+defineExpose({
+  show
+});
+</script>
+
+<template>
+  <el-dialog
+    :title="modelTitle"
+    v-model="dialogVisible"
+    center
+    destroy-on-close
+    width="1040px"
+  >
+    <PageSearch
+      :form-config="searchConfig"
+      @search-btn-click="handleSearchClick"
+      @reset-btn-click="handleResetClick"
+    />
+    <PageContent ref="pageContentRef" :content-config="contentConfig" />
+  </el-dialog>
+</template>

+ 3 - 0
src/components/ListModal/index.ts

@@ -0,0 +1,3 @@
+import ListModal from "./ListModal.vue";
+export default ListModal;
+export * from "./types";

+ 20 - 0
src/components/ListModal/types.ts

@@ -0,0 +1,20 @@
+import ListModal from "./ListModal.vue";
+import { ContentConfig } from "/@/components/PageContent";
+import { FormConfig } from "/@/components/PageSearch";
+
+export type PageModalInstance = typeof ListModal & {
+  show: (id?: string) => void;
+};
+
+export interface ModalConfig {
+  title: String;
+  searchConfig: FormConfig;
+  contentConfig: ContentConfig;
+}
+
+export const modalProps = {
+  modalConfig: {
+    type: Object as PropType<ModalConfig>,
+    required: true
+  }
+};

+ 0 - 20
src/components/PageContent/src/actions/action-create.tsx

@@ -1,20 +0,0 @@
-import { defineComponent } from "vue";
-import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
-
-const ActionCreate = defineComponent({
-  name: "ActionCreate",
-  emits: ["create"],
-  setup(_, { emit }) {
-    return () => (
-      <el-button
-        onClick={() => emit("create")}
-        icon={useRenderIcon("add")}
-        type="primary"
-      >
-        新增
-      </el-button>
-    );
-  }
-});
-
-export default ActionCreate;

+ 0 - 34
src/components/PageContent/src/actions/action-export.tsx

@@ -1,34 +0,0 @@
-import { defineComponent } from "vue";
-import { ElButton } from "element-plus";
-import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
-import { exportPageContent } from "/@/utils/export";
-
-//execl导出
-const Export = defineComponent({
-  props: {
-    selects: {
-      type: Array as PropType<any[]>
-    },
-    columns: {
-      type: Array as PropType<any[]>
-    }
-  },
-  setup(props) {
-    return () => (
-      <ElButton
-        icon={useRenderIcon("excel")}
-        onClick={() =>
-          exportPageContent({
-            type: "front",
-            data: props.selects,
-            columns: props.columns
-          })
-        }
-      >
-        导出
-      </ElButton>
-    );
-  }
-});
-
-export default Export;

+ 0 - 201
src/components/PageContent/src/actions/action-tag.tsx

@@ -1,201 +0,0 @@
-import { defineComponent, ref, watchEffect, nextTick, computed } from "vue";
-
-import { httpBillAddTag, httpList } from "/@/api/parameter/tagManage";
-
-import {
-  ElButton,
-  ElDialog,
-  ElForm,
-  ElFormItem,
-  ElInputNumber,
-  ElOption,
-  ElSelect,
-  ElTooltip
-} from "element-plus";
-import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
-
-const defaultFormData = {
-  tag_id: "",
-  code: "",
-  total_fee: 0
-};
-
-const props = {
-  tagProps: {
-    type: Object as PropType<Record<string, string>>
-  },
-  row: {
-    type: Object as PropType<Record<string, string>>
-  },
-  isPay: {
-    type: Boolean
-  }
-};
-
-const MAP = [
-  {
-    value: "1",
-    label: "付款"
-  },
-  {
-    value: "2",
-    label: "回票"
-  },
-  {
-    value: "3",
-    label: "回款"
-  },
-  {
-    value: "4",
-    label: "开票"
-  }
-];
-
-const coinIconTypes = ["1", "3"];
-
-const ActionTag = defineComponent({
-  name: "ActionTag",
-  props,
-  emits: ["reload"],
-  setup(props, { emit }) {
-    const visible = ref(false);
-    const formRef = ref<InstanceType<typeof ElForm>>(null);
-    const formData = ref({ ...defaultFormData });
-
-    const {
-      data: taglist,
-      run: taglistRun,
-      loading: taglistLoading
-    } = useAsync({
-      initalData: [],
-      isList: true
-    });
-
-    const requesetTaglist = async () => {
-      const { type } = props.tagProps;
-
-      taglistRun(
-        httpList({
-          type,
-          size: 1000
-        })
-      );
-    };
-
-    const { run: addtagRun, loading: addtagLoading } = useAsync({
-      success: () => {
-        visible.value = false;
-        emit("reload");
-      }
-    });
-
-    const onAddTagWithCode = () => {
-      formRef.value.validate(isValid => {
-        if (!isValid) return;
-        const { tag_id, total_fee } = formData.value;
-        const { row, tagProps } = props;
-        const { prop } = tagProps;
-
-        addtagRun(
-          httpBillAddTag({
-            tag_id,
-            total_fee: String(total_fee),
-            code: row[prop]
-          })
-        );
-      });
-    };
-
-    const title = computed(() => {
-      const { tagProps } = props;
-      const { type } = tagProps;
-      if (!type) return;
-      return MAP.find(s => s.value === type)?.label;
-    });
-
-    function renderModal() {
-      return (
-        <ElDialog
-          title={`添加${title.value}标签`}
-          appendToBody
-          center
-          v-model={visible.value}
-          onOpen={() => requesetTaglist()}
-        >
-          <ElForm model={formData.value} ref={formRef}>
-            <ElFormItem
-              prop="tag_id"
-              label="标签名:"
-              rules={[
-                {
-                  message: "请选择标签名",
-                  required: true,
-                  trigger: "change"
-                }
-              ]}
-            >
-              <ElSelect
-                class="w-full"
-                v-model={formData.value.tag_id}
-                loading={taglistLoading.value}
-                placeholder="请选择标签名"
-                filterable
-              >
-                {taglist.value.map(tag => (
-                  <ElOption key={tag.id} label={tag.tag_name} value={tag.id} />
-                ))}
-              </ElSelect>
-            </ElFormItem>
-
-            <ElFormItem
-              prop="total_fee"
-              label="标签金额:"
-              rules={[
-                {
-                  message: "请输入标签金额",
-                  required: true,
-                  trigger: "change"
-                }
-              ]}
-            >
-              <ElInputNumber v-model={formData.value.total_fee} />
-            </ElFormItem>
-
-            <div class="w-full flex justify-end flex-end">
-              <ElButton
-                type="primary"
-                onClick={() => onAddTagWithCode()}
-                loading={addtagLoading.value}
-              >
-                添加
-              </ElButton>
-            </div>
-          </ElForm>
-        </ElDialog>
-      );
-    }
-
-    watchEffect(() => {
-      if (visible.value) formData.value = { ...defaultFormData };
-      nextTick(() => formRef.value && formRef.value.clearValidate());
-    });
-
-    return () => (
-      <ElTooltip placement="top" content={`添加${title.value}标签`}>
-        <ElButton
-          link
-          class="reset-margin"
-          type="primary"
-          onClick={() => (visible.value = true)}
-          icon={useRenderIcon(
-            coinIconTypes.includes(props.tagProps.type) ? "coin" : "stamp"
-          )}
-        >
-          {renderModal()}
-        </ElButton>
-      </ElTooltip>
-    );
-  }
-});
-
-export default ActionTag;

+ 4 - 8
src/components/PageContent/src/actions/index.ts

@@ -1,22 +1,18 @@
-import Create from "./action-create";
 import Delete from "./action-delete";
 import Update from "./action-update";
 import Preview from "./action-preview";
 import Status from "./action-status";
 import ResetPwd from "./action-resetPwd";
 import ChangePwd from "./action-changePwd";
-import Export from "./action-export";
 import Log from "./action-log";
 const Operation = {
-  Create,
-  Update,
+  ChangePwd,
   Delete,
+  Log,
   Preview,
-  Status,
   ResetPwd,
-  ChangePwd,
-  Log,
-  Export
+  Status,
+  Update
 };
 
 export { Operation };

+ 67 - 78
src/components/PageContent/src/page-content.tsx

@@ -7,23 +7,22 @@ import { useRequeset } from "./hooks/use-request";
 import { Operation } from "./actions";
 import { useSelection } from "./hooks/use-selection";
 import { POWERS } from "/@/config/status";
-import {
-  ElButton,
-  ElButtonGroup,
-  ElCheckbox,
-  ElCheckboxGroup,
-  ElScrollbar,
-  ElTooltip
-} from "element-plus";
+// import {
+//   ElButton,
+//   ElButtonGroup,
+//   ElCheckbox,
+//   ElCheckboxGroup,
+//   ElScrollbar,
+//   ElTooltip
+// } from "element-plus";
 import { useColumns } from "./hooks/use-columns";
-import { useRenderIcon } from "../../ReIcon/src/hooks";
+// import { useRenderIcon } from "../../ReIcon/src/hooks";
 import "./styles/index.scss";
 const powers = POWERS;
 const PageConent = defineComponent({
   name: "PageContent",
   props: pageContentProps,
   emits: [
-    "createBtnClick",
     "updateBtnClick",
     "previewBtnClick",
     "statusBtnClick",
@@ -50,9 +49,12 @@ const PageConent = defineComponent({
 
     const { selects } = useSelection();
 
-    const { columns, fixed, displayColumns, _raw, reset } = useColumns(
-      props.contentConfig.columns
-    );
+    const {
+      columns
+      // fixed, displayColumns,
+      // _raw
+      // reset
+    } = useColumns(props.contentConfig.columns);
 
     function handleSelection(value) {
       selects.value = value;
@@ -71,6 +73,7 @@ const PageConent = defineComponent({
         inv,
         apis,
         notPreview,
+        notLog,
         delTooltip,
         showPreview,
         showDelete,
@@ -78,7 +81,6 @@ const PageConent = defineComponent({
       } = contentConfig;
 
       const view = showPreview ? showPreview(row) : true;
-
       const del = showDelete ? showDelete(row) : true;
 
       return (
@@ -138,14 +140,8 @@ const PageConent = defineComponent({
               {...createActionProps("resetPwd", apis)}
             />
           )}
-          {action.log && powers.some(i => i == "022") && (
-            <Operation.Log
-              row={row}
-              prop={contentConfig.logProp}
-              delTooltip={delTooltip}
-              onLog={() => emit("logBtnClick", row)}
-              {...createActionProps("log", apis)}
-            />
+          {!notLog && powers.some(i => i == "022") && (
+            <Operation.Log onLog={() => emit("logBtnClick", row)} />
           )}
         </>
       );
@@ -162,13 +158,6 @@ const PageConent = defineComponent({
         <div style={{ display: "flex", gap: "5px" }}>
           {/* excel导出 */}
           {slots.header && slots.header()}
-          {(slots.create && slots.create()) ||
-            (action.create && powers.some(i => i == "003") && (
-              <Operation.Create
-                {...createActionProps("create", contentConfig.apis)}
-                onCreate={() => emit("createBtnClick")}
-              />
-            ))}
         </div>
       );
     }
@@ -186,56 +175,56 @@ const PageConent = defineComponent({
       return slots.expand && slots.expand(row);
     }
 
-    function renderFilterColumnns() {
-      return (
-        <div class="filter-columns__content">
-          <div class="filter-columns_reset">
-            列筛选
-            <ElButton onClick={() => reset()}>重置</ElButton>
-          </div>
+    // function renderFilterColumnns() {
+    //   return (
+    //     <div class="filter-columns__content">
+    //       <div class="filter-columns_reset">
+    //         列筛选
+    //         <ElButton onClick={() => reset()}>重置</ElButton>
+    //       </div>
 
-          <ElScrollbar maxHeight={300}>
-            <ElCheckboxGroup v-model={displayColumns.value}>
-              {_raw.map(({ label, prop, fixed: fixedValue }, index) => {
-                if (!label || label === "序号" || label === "操作") return;
+    //       <ElScrollbar maxHeight={300}>
+    //         <ElCheckboxGroup v-model={displayColumns.value}>
+    //           {_raw.map(({ label, prop, fixed: fixedValue }, index) => {
+    //             if (!label || label === "序号" || label === "操作") return;
 
-                return (
-                  <div class="fixed-group">
-                    <ElButtonGroup>
-                      <ElTooltip
-                        content="固定在左边"
-                        placement="top"
-                        disabled={fixedValue === "left"}
-                      >
-                        <ElButton
-                          link
-                          icon={useRenderIcon("arrow-left-s-line")}
-                          onClick={() => fixed("left", index)}
-                        />
-                      </ElTooltip>
-                      <ElTooltip
-                        content="固定在右边"
-                        placement="top"
-                        disabled={fixedValue === "right"}
-                      >
-                        <ElButton
-                          link
-                          icon={useRenderIcon("arrow-right-s-line")}
-                          onClick={() => fixed("right", index)}
-                        />
-                      </ElTooltip>
-                    </ElButtonGroup>
-                    <ElCheckbox label={prop} key={prop}>
-                      {label}
-                    </ElCheckbox>
-                  </div>
-                );
-              })}
-            </ElCheckboxGroup>
-          </ElScrollbar>
-        </div>
-      );
-    }
+    //             return (
+    //               <div class="fixed-group">
+    //                 <ElButtonGroup>
+    //                   <ElTooltip
+    //                     content="固定在左边"
+    //                     placement="top"
+    //                     disabled={fixedValue === "left"}
+    //                   >
+    //                     <ElButton
+    //                       link
+    //                       icon={useRenderIcon("arrow-left-s-line")}
+    //                       onClick={() => fixed("left", index)}
+    //                     />
+    //                   </ElTooltip>
+    //                   <ElTooltip
+    //                     content="固定在右边"
+    //                     placement="top"
+    //                     disabled={fixedValue === "right"}
+    //                   >
+    //                     <ElButton
+    //                       link
+    //                       icon={useRenderIcon("arrow-right-s-line")}
+    //                       onClick={() => fixed("right", index)}
+    //                     />
+    //                   </ElTooltip>
+    //                 </ElButtonGroup>
+    //                 <ElCheckbox label={prop} key={prop}>
+    //                   {label}
+    //                 </ElCheckbox>
+    //               </div>
+    //             );
+    //           })}
+    //         </ElCheckboxGroup>
+    //       </ElScrollbar>
+    //     </div>
+    //   );
+    // }
 
     function renderPureTable(size, checkList) {
       const { contentConfig } = props;
@@ -287,7 +276,7 @@ const PageConent = defineComponent({
           loading={loading.value}
           v-slots={{
             buttons: () => renderButtons(),
-            toolbar: () => renderFilterColumnns(),
+            // toolbar: () => renderFilterColumnns(),
             default: ({ size, checkList }) => renderPureTable(size, checkList)
           }}
         />

+ 1 - 3
src/components/PageContent/src/types.ts

@@ -19,11 +19,11 @@ export interface ContentConfig {
   notReuqiredInit?: boolean;
   notPagination?: boolean;
   notPreview?: boolean;
+  notLog?: boolean;
   statusProp?: string;
   deleteProp?: string;
   changePwdProp?: string;
   resetPwdProp?: string;
-  logProp?: string;
   mockData?: Array<any>;
   isTree?: boolean;
   treeProps?: any;
@@ -56,7 +56,6 @@ export type ActionType =
   | "status"
   | "resetPwd"
   | "changePwd"
-  | "log"
   | "export";
 
 export interface ContentApis {
@@ -67,7 +66,6 @@ export interface ContentApis {
   httpStatus?: API;
   httpResetPwd?: API;
   httpChangePwd?: API;
-  httpLog?: API;
 }
 
 export type PageContentInstance = typeof PageContent & {

+ 1 - 5
src/components/PageContent/src/utils/create-operation.tsx

@@ -1,13 +1,9 @@
 import type { ContentApis, ActionType } from "./../types";
 
 export const mapActionToApi = {
-  update: "httpUpdate",
-  create: "httpAdd",
   delete: "httpDelete",
   status: "httpStatus",
-  changePwd: "httpChangePwd",
-  resetPwd: "httpResetPwd",
-  log: "httpLog"
+  resetPwd: "httpResetPwd"
 };
 
 /**

+ 3 - 3
src/components/ReTable/src/bar.tsx

@@ -118,12 +118,12 @@ export default defineComponent({
         <div
           {...attrs}
           class="pl-3 pr-3  pb-1 bg-white dark:bg-dark"
-          style="padding-top:15px;width:100%"
+          style="width:100%"
           v-loading={props.loading}
           element-loading-svg={loadingSvg}
           element-loading-svg-view-box="-10, -10, 50, 50"
         >
-          <div class="flex justify-between w-full h-60px p-3">
+          {/* <div class="flex justify-between w-full h-60px p-3">
             <p class="font-bold truncate" style="line-height: 40px;">
               {props.title}
             </p>
@@ -197,7 +197,7 @@ export default defineComponent({
               trigger="hover"
               content="列设置"
             />
-          </div>
+          </div> */}
           {props.dataList.length > 0 ? (
             slots.default({ size: size.value, checkList: checkList.value })
           ) : (

+ 0 - 1
src/components/resetPwd/types.ts

@@ -15,7 +15,6 @@ export type PageModalInstance = typeof ResetPwd & {
 
 export interface ModalConfig {
   title: String;
-  ConPwdList: Record<string, string>[];
   httpChangePwd: API;
   formItems: Array<FormItem>;
   // formGroup: Array<FormGorup>;

+ 7 - 1
src/style/index.scss

@@ -51,4 +51,10 @@
 }
 .el-dialog--center .el-dialog__body{
   padding-top:0px!important;
-}
+}
+
+.el-form>.el-form-item.asterisk-left {
+  margin:0 0 0 0!important;
+
+}
+  

+ 13 - 2
src/views/mobile/exchangeStock/config/content.config1.ts → src/views/mobile/exchangeStock/config/ListModal.config.ts

@@ -1,6 +1,11 @@
-// import { ModalConfig } from "/@/components/PageListModal2";
+import { ModalConfig } from "/@/components/ListModal";
 import { httpLog } from "/@/api/mobile/exchangeStock";
 import { renderImage } from "/@/utils/column-helper";
+import { FormConfig } from "/@/components/PageSearch";
+const searchFormConfig: FormConfig = {
+  isHide: true,
+  formItems: []
+};
 const columns = [
   {
     type: "selection",
@@ -92,4 +97,10 @@ const contentConfig = {
   }
 };
 
-export default contentConfig;
+const ListModalConfig: ModalConfig = {
+  title: "库存修改记录",
+  searchConfig: searchFormConfig,
+  contentConfig: contentConfig
+};
+
+export default ListModalConfig;

+ 8 - 8
src/views/mobile/exchangeStock/index.vue

@@ -9,6 +9,8 @@ import modalConfig from "./config/modal.config";
 import { PageContent } from "/@/components/PageContent";
 import { projectFormConfig } from "./config/_details";
 import { projectFormRules } from "./config/_rules";
+import ListModalConfig from "./config/ListModal.config";
+
 import {
   BasicForm,
   transform,
@@ -22,9 +24,7 @@ import LadderTable from "./cpns/ladder-table.vue";
 import { ComCard } from "/@/components/RemoteSelect";
 import OrderDialog from "/@/components/PageListModal";
 import { ElForm, ElMessage } from "element-plus";
-import PageListModall from "/@/components/PageListModall";
-import contentConfig1 from "./config/content.config1";
-
+import ListModal from "/@/components/ListModal";
 const responseHandle = useResponseHandle();
 const ladderModalRef = ref<InstanceType<typeof LadderModal>>(null);
 const modelRef = ref<InstanceType<typeof OrderDialog>>(null);
@@ -38,9 +38,8 @@ const { pageModalRef, handleCreateData, handleConfrim, defaultInfo } =
   usePageModal({
     pageContentRef
   });
-
+const ListModalRef = ref<InstanceType<typeof ListModal>>(null);
 const { formItems } = projectFormConfig;
-const PageListModalReff = ref<InstanceType<typeof PageListModall>>(null);
 const basicFormRef = ref<InstanceType<typeof ElForm>>(null);
 const formData = ref<Record<string, any>>(createDefaultData(formItems));
 function handleCreate() {
@@ -101,8 +100,8 @@ function handleAddOrder(list) {
   });
 }
 function aa(id) {
-  PageListModalReff.value.show(id);
-  // console.log(id);
+  console.log(id);
+  ListModalRef.value.show(id);
 }
 </script>
 
@@ -121,7 +120,7 @@ function aa(id) {
     @update-btn-click="({ id }) => handleDetailData(id, 'update')"
     @log-btn-click="({ id }) => aa(id)"
   />
-  <PageListModal2 ref="PageListModalReff" :modal-config="contentConfig1" />
+
   <PageModal
     ref="pageModalRef"
     :modal-config="modalConfig"
@@ -159,5 +158,6 @@ function aa(id) {
 
   <OrderDialog ref="modelRef" @save-btn-click="handleAddOrder" />
   <addModel ref="actionModalRef" @submitOk="Create" />
+  <ListModal ref="ListModalRef" :modalConfig="ListModalConfig" />
   <!-- </PageAuth> -->
 </template>