Procházet zdrojové kódy

JLHWEB: 补充导出数据时,数据内容渲染方法

JohnnyChan před 1 dnem
rodič
revize
7b3bf42b00

+ 6 - 0
JLHWEB/src/hooks/useDwLayout.tsx

@@ -369,6 +369,12 @@ export const useDwLayout = (
               return _item?.label ?? "";
             }
           };
+          item.exportMethod = ({ cellValue, row, column }) => {
+            let _val = cellValue;
+            let _item: any = {};
+            item.enum && (_item = item.enum.find((item: any) => item.value == Number(row[column.field])));
+            return _item?.label ?? _val;
+          };
         } else if (item?.datatype == "html") {
           item.render = (scope: any) => {
             let _keys = Object.keys(scope);

+ 1 - 1
JLHWEB/src/utils/index.ts

@@ -1101,7 +1101,7 @@ const parseTime = (time: any, cFormat?: string) => {
  * @param {string} option
  * @returns {Number} (秒)
  */
-export const formatTime = function (time: string | number, option: string, ifshort: boolean, nowtime?: string) {
+export const formatTime = function (time: string | number | Date, option: string, ifshort: boolean, nowtime?: string) {
   const _time = new Date(time);
   const d = new Date(time);
   const now = nowtime ? new Date(nowtime) : new Date();

+ 13 - 0
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -2937,6 +2937,19 @@ export const useHooks = (t?: any) => {
             </el-tag>
           </div>
         );
+      },
+      exportMethod: (scope: any) => {
+        return !scope.row?.child_count && !scope.row?.parentid
+          ? scope.row?.mattressname
+          : scope.row?.parentid
+          ? `
+            ${scope.row?.mattressname}
+              副
+            `
+          : `
+            ${scope.row?.mattressname}
+              主
+        `;
       }
     },
     {