Bläddra i källkod

修改合作方式多选

zs 7 månader sedan
förälder
incheckning
5a20632ca5

+ 2 - 2
src/entity/platform/demand.entity.ts

@@ -15,8 +15,8 @@ export class Demand extends BaseModel {
   field: string;
   @Column({ type: 'character varying', nullable: true, comment: '需求紧急度' })
   urgent: string;
-  @Column({ type: 'character varying', nullable: true, comment: '合作方式' })
-  method: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '合作方式' })
+  method: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '开始时间' })
   start_time: string;
   @Column({ type: 'character varying', nullable: true, comment: '结束时间' })

+ 2 - 2
src/entity/platform/supply.entity.ts

@@ -15,8 +15,8 @@ export class Supply extends BaseModel {
   field: string;
   @Column({ type: 'character varying', nullable: true, comment: '需求紧急度' })
   urgent: string;
-  @Column({ type: 'character varying', nullable: true, comment: '合作方式' })
-  method: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '合作方式' })
+  method: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '开始时间' })
   start_time: string;
   @Column({ type: 'character varying', nullable: true, comment: '结束时间' })

+ 4 - 4
src/interface/platform/demand.interface.ts

@@ -21,7 +21,7 @@ export class FVO_demand {
   @ApiProperty({ description: '需求紧急度' })
   'urgent': string = undefined;
   @ApiProperty({ description: '合作方式' })
-  'method': string = undefined;
+  'method': Array<any> = undefined;
   @ApiProperty({ description: '开始时间' })
   'start_time': string = undefined;
   @ApiProperty({ description: '结束时间' })
@@ -70,7 +70,7 @@ export class QDTO_demand extends SearchBase {
   @ApiProperty({ description: '行业领域' })
   'field': string = undefined;
   @ApiProperty({ description: '合作方式' })
-  'method': string = undefined;
+  'method': Array<any> = undefined;
   @ApiProperty({ description: '需求紧急度' })
   'urgent': string = undefined;
   @ApiProperty({ description: '开始时间' })
@@ -134,8 +134,8 @@ export class CDTO_demand {
   @Rule(RuleType['string']().empty(''))
   'urgent': string = undefined;
   @ApiProperty({ description: '合作方式' })
-  @Rule(RuleType['string']().empty(''))
-  'method': string = undefined;
+  @Rule(RuleType['array']().empty(''))
+  'method': Array<any> = undefined;
   @ApiProperty({ description: '开始时间' })
   @Rule(RuleType['string']().empty(''))
   'start_time': string = undefined;

+ 4 - 4
src/interface/platform/supply.interface.ts

@@ -21,7 +21,7 @@ export class FVO_supply {
   @ApiProperty({ description: '需求紧急度' })
   'urgent': string = undefined;
   @ApiProperty({ description: '合作方式' })
-  'method': string = undefined;
+  'method': Array<any> = undefined;
   @ApiProperty({ description: '开始时间' })
   'start_time': string = undefined;
   @ApiProperty({ description: '结束时间' })
@@ -56,7 +56,7 @@ export class QDTO_supply extends SearchBase {
   @ApiProperty({ description: '行业领域' })
   'field': string = undefined;
   @ApiProperty({ description: '合作方式' })
-  'method': string = undefined;
+  'method': Array<any> = undefined;
   @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '开始时间' })
@@ -100,8 +100,8 @@ export class CDTO_supply {
   @Rule(RuleType['string']().empty(''))
   'urgent': string = undefined;
   @ApiProperty({ description: '合作方式' })
-  @Rule(RuleType['string']().empty(''))
-  'method': string = undefined;
+  @Rule(RuleType['array']().empty(''))
+  'method': Array<any> = undefined;
   @ApiProperty({ description: '开始时间' })
   @Rule(RuleType['string']().empty(''))
   'start_time': string = undefined;

+ 3 - 3
src/service/exportConfig.service.ts

@@ -26,8 +26,8 @@ export class ExportConfigService {
   }
   async fetch(query: object) {
     const builder = this.model.createQueryBuilder();
-    if (get(query, 'id')) builder.where(`"id"=:id`, { id: get(query, 'id') });
-    else if (get(query, 'table')) builder.where(`"table"=:table`, { table: get(query, 'table') });
+    if (get(query, 'id')) builder.where('"id"=:id', { id: get(query, 'id') });
+    else if (get(query, 'table')) builder.where('"table"=:table', { table: get(query, 'table') });
     const result = await builder.getOne();
     return result;
   }
@@ -66,7 +66,7 @@ export class ExportConfigService {
     ];
     return sourceList;
   }
-  
+
   getModelColumns(modelName, filters = []) {
     if (!modelName.includes('_model_')) {
       modelName = `_model_${modelName}`;

+ 16 - 7
src/service/util.service.ts

@@ -935,11 +935,16 @@ export class UtilService {
           } else if (mark === 'dict') {
             const req = await this.dictDataService.query({ code, is_use: '0' }, {});
             if (req.data) {
-              const selected = req.data.find(f => f.value === d[model]);
-              if (selected) {
-                d[model] = get(selected, 'label');
-                arr.push(d[model]);
-              } else arr.push(d[model]);
+              if (code === 'method') {
+                if (d[model]) d[model] = arr.push(d[model].join(','));
+                else arr.push(d[model]);
+              } else {
+                const selected = req.data.find(f => f.value === d[model]);
+                if (selected) {
+                  d[model] = get(selected, 'label');
+                  arr.push(d[model]);
+                } else arr.push(d[model]);
+              }
             } else arr.push(d[model]);
           } else if (mark === 'time') {
             if (d.start_time && d.end_time) {
@@ -1246,8 +1251,12 @@ export class UtilService {
     } else if (type === 'dict') {
       const req = await this.dictDataService.query({ code }, {});
       if (req.data) {
-        const selected = req.data.find(f => f.label === val);
-        if (selected) result = get(selected, 'value');
+        if (code === 'method') {
+          if (val) result = val.split(',');
+        } else {
+          const selected = req.data.find(f => f.label === val);
+          if (selected) result = get(selected, 'value');
+        }
       }
     } else if (type === 'area') {
       if (val) result = val.split('-');