xiaodai2017 před 2 roky
rodič
revize
96dadc2c6f

+ 0 - 1
src/components/PageContent/src/actions/action-delete.tsx

@@ -24,7 +24,6 @@ const ActionDelete = defineComponent({
 
     async function handleDelete() {
       const { config, row, prop } = props;
-
       const { code, message } = await config.api({
         ...(prop ? { [prop]: row[prop] } : { id: row.id })
       });

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

@@ -20,7 +20,7 @@ export interface ContentConfig {
   notPagination?: boolean;
   notPreview?: boolean;
   statusProp?: string;
-  deleteProp?: string;
+  deleteProp?: any;
   mockData?: Array<any>;
   isTree?: boolean;
   treeProps?: any;

+ 0 - 1
src/views/reportForm/reportApply/config/content.config.ts

@@ -4,7 +4,6 @@ import { httpList, httpAdd, httpStatus } from "/@/api/reportForm/reportApply";
 import { h } from "vue";
 import dayjs from "dayjs";
 import { ElTag } from "element-plus";
-import { type_options } from "./_options";
 const columns = [
   {
     type: "selection",

+ 0 - 1
src/views/reportForm/reportApply/config/modal.config.ts

@@ -1,5 +1,4 @@
 import { ModalConfig } from "/@/components/PageModal/src/types";
-import { type_options } from "./_options";
 import { httpListAll } from "/@/api/reportForm/reportApply";
 import { httpList } from "/@/api/parameter/finance";
 import { ref, unref } from "vue";

+ 3 - 0
src/views/reportForm/reportRecord/config/content.config.ts

@@ -105,6 +105,9 @@ const contentConfig: ContentConfig = {
   title: "报表申请记录",
   superUserNoAction: false,
   columns,
+  showDelete: row => {
+    return String(row.status) == "1";
+  },
   apis: {
     httpList,
     httpAdd,

+ 2 - 21
src/views/reportForm/reportRecord/config/modal.config.ts

@@ -1,24 +1,5 @@
-import { ModalConfig } from "../../../../components/PageModal/src/types";
-import { httpListAll } from "/@/api/reportForm/reportRecord";
+import { ModalConfig } from "/@/components/PageModal/src/types";
 import { type_options } from "./_options";
-import { ref, unref } from "vue";
-const list = ref([]);
-list.value = await get_list();
-async function get_list() {
-  const arr = [];
-  const { code, data } = await httpListAll({});
-  if (code === 0) {
-    data.forEach(si => {
-      const model = {
-        value: si.id,
-        label: si.name,
-        disabled: String(si.status) == "0"
-      };
-      arr.push(model);
-    });
-  }
-  return arr;
-}
 const modalConfig: ModalConfig = {
   title: "报表申请",
   colLayout: { span: 24 },
@@ -31,7 +12,7 @@ const modalConfig: ModalConfig = {
       labelWidth: "120px",
       placeholder: "请选择报表",
       rules: [{ required: true, trigger: "change", message: "请选择报表" }],
-      options: unref(list),
+      options: [],
       otherOptions: {
         disabled: true
       }

+ 52 - 14
src/views/reportForm/reportRecord/index.vue

@@ -7,9 +7,35 @@ import { useCompany } from "/@/hooks/core/useCompany";
 import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
 import { ElMessage } from "element-plus";
 import dayjs from "dayjs";
+import { httpListAll } from "/@/api/reportForm/reportRecord";
+import { ref, watchEffect } from "vue";
 const PageName = "reportRecord";
-
+const refModalConfig = ref(modalConfig);
 const { currentCompany } = useCompany();
+const list = ref([]);
+async function get_list() {
+  const arr = [];
+  if (!currentCompany.value.companyNo) {
+    list.value = [];
+    refModalConfig.value.formItems[0].options = list.value;
+    return;
+  }
+  const { code, data } = await httpListAll({
+    comapnyNo: currentCompany.value.companyNo
+  });
+  if (code === 0) {
+    data.forEach(si => {
+      const model = {
+        value: si.id,
+        label: si.name,
+        disabled: String(si.status) == "0"
+      };
+      arr.push(model);
+    });
+  }
+  refModalConfig.value.formItems[0].options = list.value;
+  list.value = arr;
+}
 
 const hooks: PageHooks = {
   pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig),
@@ -23,6 +49,7 @@ const hooks: PageHooks = {
         const start_updatetime = new Date(start).valueOf();
         const end_updatetime = new Date(end).valueOf() + delay;
         const day = (end_updatetime - start_updatetime) / delay;
+        const companyNo = currentCompany.value.companyNo;
         if (String(type) === "1" && day > 7) {
           ElMessage.warning("立即执行时,时间区间不能超过7天!");
           return false;
@@ -31,17 +58,24 @@ const hooks: PageHooks = {
           ElMessage.warning("延时执行时,时间区间不能超过30天!");
           return false;
         }
+        if (!companyNo) {
+          ElMessage.warning("请选择业务公司!");
+          return false;
+        }
         return {
           start,
           end,
-          companyNo: currentCompany.value.companyNo
+          companyNo
         };
       }
     })
 };
-const download = url => {
-  console.log(url);
-};
+watchEffect(() => {
+  if (currentCompany.value.companyNo) {
+    console.log("1234");
+    get_list();
+  }
+});
 </script>
 
 <template>
@@ -50,18 +84,22 @@ const download = url => {
       :hooks="hooks"
       :contentConfig="contentConfig"
       :search-config="searchConfig"
-      :modal-config="modalConfig"
+      :modal-config="refModalConfig"
     >
       <template #content_action="{ status, down_url }">
-        <ElButton
-          link
-          size="small"
-          class="fl"
-          type="primary"
+        <el-link
+          :href="down_url"
           v-if="String(status) === '2'"
-          @click="download(down_url)"
-          :icon="useRenderIcon('download-line')"
-        />
+          target="_blank"
+          :underline="false"
+        >
+          <ElButton
+            link
+            size="small"
+            type="primary"
+            :icon="useRenderIcon('download-line')"
+          />
+        </el-link>
       </template>
     </PageContainer>
   </PageAuth>