倚楼听风雨 3 gadi atpakaļ
vecāks
revīzija
8a308d7c81

+ 50 - 28
cool-admin-midway-master/src/app/comm/utils.ts

@@ -70,7 +70,7 @@ export class Utils {
   /**
    * 获取指定格式日期YYYY-MM-DD
    * @param {*} date
-   * @return {*} 
+   * @return {*}
    * @memberof Utils
    */
   formatDate(date) {
@@ -81,10 +81,14 @@ export class Utils {
     const Year: number = Dates.getFullYear();
 
     //月份下标是0-11
-    const Months: any = (Dates.getMonth() + 1) < 10 ? '0' + (Dates.getMonth() + 1) : (Dates.getMonth() + 1);
+    const Months: any =
+      Dates.getMonth() + 1 < 10
+        ? '0' + (Dates.getMonth() + 1)
+        : Dates.getMonth() + 1;
 
     //具体的天数
-    const Day: any = Dates.getDate() < 10 ? '0' + Dates.getDate() : Dates.getDate();
+    const Day: any =
+      Dates.getDate() < 10 ? '0' + Dates.getDate() : Dates.getDate();
 
     //小时
     //  const Hours = Dates.getHours() < 10 ? '0' + Dates.getHours() : Dates.getHours();
@@ -96,13 +100,13 @@ export class Utils {
     //  const Seconds = Dates.getSeconds() < 10 ? '0' + Dates.getSeconds() : Dates.getSeconds();
 
     //返回数据格式
-    //  return Year + '-' + Months + '-' + Day + '-' + Hours + ':' + Minutes + ':' + Seconds; 
+    //  return Year + '-' + Months + '-' + Day + '-' + Hours + ':' + Minutes + ':' + Seconds;
     return Year + '-' + Months + '-' + Day;
   }
   /**
-   * 获取指定格式日期YYYY-MM-DD
+   * 获取指定格式时间
    * @param {*} date
-   * @return {*} 
+   * @return {*}
    * @memberof Utils
    */
   formatDateTime(date) {
@@ -113,30 +117,49 @@ export class Utils {
     const Year: number = Dates.getFullYear();
 
     //月份下标是0-11
-    const Months: any = (Dates.getMonth() + 1) < 10 ? '0' + (Dates.getMonth() + 1) : (Dates.getMonth() + 1);
+    const Months: any =
+      Dates.getMonth() + 1 < 10
+        ? '0' + (Dates.getMonth() + 1)
+        : Dates.getMonth() + 1;
 
     //具体的天数
-    const Day: any = Dates.getDate() < 10 ? '0' + Dates.getDate() : Dates.getDate();
+    const Day: any =
+      Dates.getDate() < 10 ? '0' + Dates.getDate() : Dates.getDate();
 
     //小时
-    const Hours = Dates.getHours() < 10 ? '0' + Dates.getHours() : Dates.getHours();
+    const Hours =
+      Dates.getHours() < 10 ? '0' + Dates.getHours() : Dates.getHours();
 
     //  //分钟
-    const Minutes = Dates.getMinutes() < 10 ? '0' + Dates.getMinutes() : Dates.getMinutes();
+    const Minutes =
+      Dates.getMinutes() < 10 ? '0' + Dates.getMinutes() : Dates.getMinutes();
 
     //  //秒
-    const Seconds = Dates.getSeconds() < 10 ? '0' + Dates.getSeconds() : Dates.getSeconds();
+    const Seconds =
+      Dates.getSeconds() < 10 ? '0' + Dates.getSeconds() : Dates.getSeconds();
 
     //返回数据格式
-    //  return Year + '-' + Months + '-' + Day + '-' + Hours + ':' + Minutes + ':' + Seconds; 
-    return Year + '-' + Months + '-' + Day + ' ' + Hours + ':' + Minutes + ':' + Seconds;
+    //  return Year + '-' + Months + '-' + Day + '-' + Hours + ':' + Minutes + ':' + Seconds;
+    return (
+      Year +
+      '-' +
+      Months +
+      '-' +
+      Day +
+      ' ' +
+      Hours +
+      ':' +
+      Minutes +
+      ':' +
+      Seconds
+    );
   }
   /**
-   * 两个时间相差天数 
-   * sDate1和sDate2是2006-12-18格式 
+   * 两个时间相差天数
+   * sDate1和sDate2是2006-12-18格式
    * @param {*} sDate1
    * @param {*} sDate2
-   * @return {*} 
+   * @return {*}
    * @memberof Utils
    */
   dateDiff(sDate1, sDate2) {
@@ -146,21 +169,21 @@ export class Utils {
     dateSpan = sDate2 - sDate1;
     dateSpan = Math.abs(dateSpan);
     iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
-    return parseInt(iDays)
+    return parseInt(iDays);
   }
 
   /**
    * 计算时间差(秒)
    * @param {Date} time1
    * @param {Date} time2
-   * @return {*} 
+   * @return {*}
    * @memberof Utils
    */
   timeDiff(time1: Date, time2: Date) {
-    var seconds = 0
-    time1 = new Date(time1)
-    seconds = (time1.getTime() - time2.getTime()) / 1000
-    return seconds
+    var seconds = 0;
+    time1 = new Date(time1);
+    seconds = (time1.getTime() - time2.getTime()) / 1000;
+    return seconds;
   }
   /**
    *
@@ -173,10 +196,9 @@ export class Utils {
     var dd = new Date(date);
     dd.setDate(dd.getDate() + day);
     var y = dd.getFullYear();
-    var m = dd.getMonth() + 1 < 10 ? "0" + (dd.getMonth() + 1) : dd.getMonth() + 1;
-    var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
-    return y + "-" + m + "-" + d;
-  };
-
-
+    var m =
+      dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1;
+    var d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate();
+    return y + '-' + m + '-' + d;
+  }
 }

+ 24 - 8
cool-admin-midway-master/src/app/modules/shuyou/controller/admin/rent_computer.ts

@@ -1,14 +1,15 @@
 /*
  * @Author: YKH
  * @Date: 2021-12-08 10:26:27
- * @LastEditTime: 2022-09-02 16:13:28
- * @Description: 
+ * @LastEditTime: 2022-09-20 17:50:34
+ * @Description:
  * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\shuyou\controller\admin\rent_computer.ts
  */
-import { Provide } from '@midwayjs/decorator';
+import { ALL, Body, Inject, Post, Provide } from '@midwayjs/decorator';
 import { CoolController, BaseController } from 'midwayjs-cool-core';
 import { ShuyouRentComputerEntity } from '../../entity/rent_computer';
 import { ShuyouRentComputerService } from '../../service/rent_computer';
+import { ILogger } from '@midwayjs/logger';
 
 /**
  * 租机
@@ -32,24 +33,39 @@ import { ShuyouRentComputerService } from '../../service/rent_computer';
   before: ctx => {
     //前段数据转JSON格式
     const data = ctx.request.body;
-    if (data.pc_name == "") {
-      data.pc_name = null
+    if (data.pc_num == '') {
+      data.pc_num = null;
     }
     ctx.request.body.data = JSON.stringify(data);
   },
   // 分页查询配置
   pageQueryOp: {
     // 让字段支持模糊查询
-    keyWordLikeFields: ['pc_name'],
+    keyWordLikeFields: ['pc_num'],
     // 让字段支持筛选
-    fieldEq: ['pc_name'],
+    fieldEq: ['pc_num'],
     // 添加排序
     addOrderBy: {
       // 排序字段及排序方式
-      pc_name: 'asc',
+      pc_num: 'asc',
     },
   },
 })
 export class ShuyouRentComputerController extends BaseController {
+  @Inject()
+  logger: ILogger;
 
+  @Inject()
+  ShuyouRentComputerService: ShuyouRentComputerService;
+
+  @Post('/replaceNum')
+  async replaceNum(@Body(ALL) queryObject) {
+    // this.logger.info(queryObject);
+    let reqmsg = await this.ShuyouRentComputerService.replaceNum(queryObject);
+    if (reqmsg.code == 1000) {
+      return await this.ok({ code: 1, message: reqmsg.data });
+    } else {
+      return await this.fail(reqmsg.data, -1);
+    }
+  }
 }

+ 55 - 0
cool-admin-midway-master/src/app/modules/shuyou/controller/admin/rent_ledger_computer.ts

@@ -0,0 +1,55 @@
+/*
+ * @Author: YKH
+ * @Date: 2021-12-08 10:26:27
+ * @LastEditTime: 2022-09-20 14:07:34
+ * @Description: 
+ * @FilePath: \cool-admin\cool-admin-midway-master\src\app\modules\shuyou\controller\admin\rent_computer.ts
+ */
+import { Provide } from '@midwayjs/decorator';
+import { CoolController, BaseController } from 'midwayjs-cool-core';
+import { ShuyouRentLedgerComputerEntity } from '../../entity/rent_ledger_computer';
+import { ShuyouRentLedgerComputerService } from '../../service/rent_ledger_computer';
+
+/**
+ * 租机
+ */
+@Provide()
+@CoolController({
+  // 添加通用CRUD接口
+  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
+  // 设置表实体
+  entity: ShuyouRentLedgerComputerEntity,
+  service: ShuyouRentLedgerComputerService,
+  // // 向表插入当前登录用户ID
+  // insertParam: async (ctx: Context) => {
+  //   return {
+  //     userId: ctx.admin.userId,
+  //   };
+  // },
+  // // info接口忽略价格字段
+  // infoIgnoreProperty: ['price'],
+
+  before: ctx => {
+    //前段数据转JSON格式
+    const data = ctx.request.body;
+    if (data.pc_num == "") {
+      data.pc_num = null
+    }
+    ctx.request.body.data = JSON.stringify(data);
+  },
+  // 分页查询配置
+  pageQueryOp: {
+    // 让字段支持模糊查询
+    keyWordLikeFields: ['pc_num'],
+    // 让字段支持筛选
+    fieldEq: ['pc_num'],
+    // 添加排序
+    addOrderBy: {
+      // 排序字段及排序方式
+      pc_num: 'asc',
+    },
+  },
+})
+export class ShuyouRentLedgerComputerController extends BaseController {
+
+}

+ 38 - 12
cool-admin-midway-master/src/app/modules/shuyou/entity/rent_computer.ts

@@ -1,12 +1,12 @@
 /*
  * @Author: YKH
  * @Date: 2022-09-01 20:41:58
- * @LastEditTime: 2022-09-19 18:00:10
+ * @LastEditTime: 2022-09-20 17:58:34
  * @Description: file content
  * @FilePath: \cool-admin-3.x\cool-admin-midway-master\src\app\modules\shuyou\entity\rent_computer.ts
  */
 import { EntityModel } from '@midwayjs/orm';
-import { Column,Index } from 'typeorm';
+import { Column, Index } from 'typeorm';
 import { BaseEntity } from 'midwayjs-cool-core';
 
 /**
@@ -14,8 +14,6 @@ import { BaseEntity } from 'midwayjs-cool-core';
  */
 @EntityModel('shuyou_rent_computer')
 export class ShuyouRentComputerEntity extends BaseEntity {
-
-
   @Index()
   @Column({ comment: '电脑编号', length: 100 })
   pc_num: string;
@@ -27,34 +25,62 @@ export class ShuyouRentComputerEntity extends BaseEntity {
   @Column({ comment: '租机店铺ID' })
   shop_id: number;
 
-  @Column({ type:'datetime', comment: '起租时间' })
+  @Column({ type: 'datetime', comment: '起租时间' })
   rent_start: Date;
 
   @Column({ comment: '租机时常(天)' })
   rent_duration: number;
 
-  @Column({  type:'datetime', comment: '到期时间'})
+  @Column({ type: 'datetime', comment: '到期时间' })
   rent_end: Date;
 
-  @Column({ comment: '租机价格', type: 'decimal', precision: 10, scale: 2, default: 0})
+  @Column({
+    comment: '租机价格',
+    type: 'decimal',
+    precision: 10,
+    scale: 2,
+    default: 0,
+  })
   rent_price: number;
 
-  @Column({ comment: '折算天租金', type: 'decimal', precision: 10, scale: 5, default: 0})
+  @Column({
+    comment: '折算天租金',
+    type: 'decimal',
+    precision: 10,
+    scale: 5,
+    default: 0,
+  })
   rent_price_day: number;
 
-  @Column({ comment: '结算方式 0:先付后用 1:先用后付 2:其他方式', default: 0, type: 'tinyint' })
+  @Column({
+    comment: '结算方式 0:先付后用 1:先用后付 2:其他方式',
+    default: 0,
+    type: 'tinyint',
+  })
   pay_method: number;
 
-  @Column({ type: "decimal",comment: '当前租赁期内已产生多少租金', precision: 10, scale: 5, default: 0})
+  @Column({
+    comment: '是否到期 0:否 1:是 2:明日到期',
+    default: 0,
+    type: 'tinyint',
+  })
+  is_expire: number;
+
+  @Column({
+    type: 'decimal',
+    comment: '当前租赁期内已产生多少租金',
+    precision: 10,
+    scale: 5,
+    default: 0,
+  })
   rent_price_used: number;
 
   @Column({ comment: '租赁人', nullable: true })
   rent_person_id: number;
-  
+
   // 任务ID列表,映射使用人列表
   taskIdList: string[];
 
   @Column({ comment: '备注', nullable: true })
   remark: string;
-
 }

+ 85 - 7
cool-admin-midway-master/src/app/modules/shuyou/service/rent_computer.ts

@@ -1,17 +1,18 @@
 /*
  * @Author: YKH
  * @Date: 2021-12-08 10:26:27
- * @LastEditTime: 2022-09-19 17:55:06
+ * @LastEditTime: 2022-09-20 18:06:03
  * @Description:
  * @FilePath: \cool-admin-3.x\cool-admin-midway-master\src\app\modules\shuyou\service\rent_computer.ts
  */
-import { Provide } from '@midwayjs/decorator';
+import { Provide, Inject } from '@midwayjs/decorator';
 import { BaseService, CoolCommException } from 'midwayjs-cool-core';
 import { InjectEntityModel } from '@midwayjs/orm';
 import { Repository } from 'typeorm';
 import * as _ from 'lodash';
 import { ShuyouRentComputerEntity } from '../entity/rent_computer';
 import { ShuyouRentComputerUsageEntity } from '../entity/rent_computer_game_record';
+import { Utils } from '../../../comm/utils';
 
 /**
  * 租机
@@ -22,7 +23,8 @@ export class ShuyouRentComputerService extends BaseService {
   ShuyouRentComputerEntity: Repository<ShuyouRentComputerEntity>;
   @InjectEntityModel(ShuyouRentComputerUsageEntity)
   ShuyouRentComputerUsageEntity: Repository<ShuyouRentComputerUsageEntity>;
-
+  @Inject()
+  utils: Utils;
   /**
    * 重写新增接口
    */
@@ -35,7 +37,8 @@ export class ShuyouRentComputerService extends BaseService {
     }
     param.createTime = new Date();
     param.updateTime = new Date();
-    param.rent_price_day = parseFloat(param.rent_price) / parseFloat(param.rent_duration); // 折算天租金
+    param.rent_price_day =
+      parseFloat(param.rent_price) / parseFloat(param.rent_duration); // 折算天租金
 
     console.log('rent_price_day');
     console.log(param.rent_price_day);
@@ -101,10 +104,11 @@ export class ShuyouRentComputerService extends BaseService {
     if (!taskInfo) {
       throw new CoolCommException('租机不存在');
     }
-    param.rent_price_day = parseFloat(param.rent_price) / parseFloat(param.rent_duration); // 折算天租金
+    param.rent_price_day =
+      parseFloat(param.rent_price) / parseFloat(param.rent_duration); // 折算天租金
 
-    console.log('rent_price_day');
-    console.log(param.rent_price_day);
+    // console.log('rent_price_day');
+    // console.log(param.rent_price_day);
 
     await this.ShuyouRentComputerEntity.save(param);
     await this.updateTaskGame(param);
@@ -134,4 +138,78 @@ export class ShuyouRentComputerService extends BaseService {
         `;
     return this.sqlRenderPage(sql, query);
   }
+
+  /**
+   * 更换租机编号
+   * @param queryObject
+   * @returns
+   */
+  async replaceNum(queryObject) {
+    const info = await this.ShuyouRentComputerEntity.findOne({
+      pc_num: queryObject.pc_num_old,
+    });
+    if (!info) {
+      return { code: -1, data: '待更换的租机编号不存在' };
+    }
+    if (info.is_expire == 1) {
+      return { code: -1, data: '待更换的租机已到期' };
+    }
+    const info2 = await this.ShuyouRentComputerEntity.findOne({
+      pc_num: queryObject.pc_num_new,
+    });
+    if (info2) {
+      return { code: -1, data: '要更换的租机编号已存在' };
+    }
+
+    var remark =
+      this.utils.formatDate(new Date()) +
+      ',租机编号' +
+      queryObject.pc_num_old +
+      '更换为租机编号' +
+      queryObject.pc_num_new;
+    let object_old = {
+      updateTime: new Date(),
+      pc_num: queryObject.pc_num_old,
+      rent_end: this.utils.formatDate(new Date()) + ' 23:59:59',
+      remark: info.remark + ';' + remark,
+    };
+    let object_new = {
+      pc_num: queryObject.pc_num_new,
+      pc_name: queryObject.pc_num_new,
+      shop_id: queryObject.shop_id,
+      rent_duration: queryObject.rent_duration,
+      rent_end: queryObject.rent_end,
+      rent_price: queryObject.rent_price,
+      rent_price_day: queryObject.rent_price_day,
+      pay_method: queryObject.pay_method,
+      rent_person_id: queryObject.rent_person_id,
+      rent_start:
+        this.utils.formatDate(this.utils.getNextDate(new Date(), 1)) +
+        ' 00:00:00',
+      rent_price_used: 0,
+      remark: remark,
+    };
+
+    let updateResult = await this.ShuyouRentComputerEntity.createQueryBuilder()
+      .update()
+      .set(object_old)
+      .where('pc_num = :pc_num and shop_id = :shop_id', {
+        pc_num: queryObject.pc_num_old,
+        shop_id: queryObject.shop_id,
+      })
+      .execute();
+    if (updateResult.affected >= 1) {
+      let insertResult = await this.ShuyouRentComputerEntity.insert(object_new);
+      if (insertResult.raw.affectedRows >= 1) {
+        this.ShuyouRentComputerUsageEntity.createQueryBuilder()
+          .update()
+          .set({ pc_num: queryObject.pc_num_new })
+          .where('pc_num = :pc_num', {
+            pc_num: queryObject.pc_num_old,
+          })
+          .execute();
+      }
+    }
+    return { code: 1000, data: remark };
+  }
 }

+ 137 - 0
cool-admin-midway-master/src/app/modules/shuyou/service/rent_ledger_computer.ts

@@ -0,0 +1,137 @@
+/*
+ * @Author: YKH
+ * @Date: 2021-12-08 10:26:27
+ * @LastEditTime: 2022-09-20 14:05:31
+ * @Description:
+ * @FilePath: \cool-admin-3.x\cool-admin-midway-master\src\app\modules\shuyou\service\rent_computer.ts
+ */
+import { Provide } from '@midwayjs/decorator';
+import { BaseService, CoolCommException } from 'midwayjs-cool-core';
+import { InjectEntityModel } from '@midwayjs/orm';
+import { Repository } from 'typeorm';
+import * as _ from 'lodash';
+import { ShuyouRentLedgerComputerEntity } from '../entity/rent_ledger_computer';
+import { ShuyouRentComputerUsageEntity } from '../entity/rent_computer_game_record';
+
+/**
+ * 租机
+ */
+@Provide()
+export class ShuyouRentLedgerComputerService extends BaseService {
+  @InjectEntityModel(ShuyouRentLedgerComputerEntity)
+  ShuyouRentLedgerComputerEntity: Repository<ShuyouRentLedgerComputerEntity>;
+  @InjectEntityModel(ShuyouRentComputerUsageEntity)
+  ShuyouRentComputerUsageEntity: Repository<ShuyouRentComputerUsageEntity>;
+
+  // /**
+  //  * 重写新增接口
+  //  */
+  // async add(param) {
+  //   const existsTask = await this.ShuyouRentComputerEntity.findOne({
+  //     pc_num: param.pc_num,
+  //   });
+  //   if (!_.isEmpty(existsTask)) {
+  //     throw new CoolCommException('已存在相同编号的租机');
+  //   }
+  //   param.createTime = new Date();
+  //   param.updateTime = new Date();
+  //   param.rent_price_day = parseFloat(param.rent_price) / parseFloat(param.rent_duration); // 折算天租金
+
+  //   console.log('rent_price_day');
+  //   console.log(param.rent_price_day);
+
+  //   await this.updateTaskGame(param);
+  //   return super.add(param);
+  // }
+
+  // /**
+  //  * 更新租机-任务关系
+  //  * @param pc_task
+  //  */
+  // async updateTaskGame(pc_task) {
+  //   await this.ShuyouRentComputerUsageEntity.delete({ pc_num: pc_task.pc_num });
+  //   if (pc_task.taskIdList) {
+  //     for (const task_id of pc_task.taskIdList) {
+  //       // console.log(task_id)
+  //       await this.ShuyouRentComputerUsageEntity.save({
+  //         pc_num: pc_task.pc_num,
+  //         task_id,
+  //       });
+  //     }
+  //   }
+  // }
+
+  // //表编码格式不一致导致报错解决办法
+  // //SHOW CREATE TABLE shuyou_rent_computer_usage;
+  // //ALTER TABLE shuyou_rent_computer_usage DEFAULT CHARACTER SET utf8mb4 COLLATE=utf8mb4_german2_ci;
+  // // ALTER TABLE shuyou_rent_computer_usage CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci;
+  // /**
+  //  * 根据ID获得信息
+  //  * @param id
+  //  */
+  // public async info(id) {
+  //   const info = await this.ShuyouRentComputerEntity.findOne({ id });
+  //   if (info) {
+  //     const taskIds = await this.nativeQuery(
+  //       `select 
+  //         task_id
+  //       from 
+  //         shuyou_rent_computer_usage
+  //       where pc_num = ?`,
+  //       [info.pc_num]
+  //     );
+  //     if (taskIds) {
+  //       info.taskIdList = taskIds.map(e => {
+  //         return e.task_id;
+  //       });
+  //     }
+  //   }
+  //   return info;
+  // }
+
+  // /**
+  //  * 修改
+  //  * @param param 数据
+  //  */
+  // async update(param) {
+  //   // console.log(param)
+  //   const taskInfo = await this.ShuyouRentComputerEntity.findOne({
+  //     id: param.id,
+  //   });
+  //   if (!taskInfo) {
+  //     throw new CoolCommException('租机不存在');
+  //   }
+  //   param.rent_price_day = parseFloat(param.rent_price) / parseFloat(param.rent_duration); // 折算天租金
+
+  //   console.log('rent_price_day');
+  //   console.log(param.rent_price_day);
+
+  //   await this.ShuyouRentComputerEntity.save(param);
+  //   await this.updateTaskGame(param);
+  // }
+  // /**
+  //  * 重写分页查询
+  //  * @param query
+  //  */
+  // async page(query) {
+  //   const { pc_num } = query;
+  //   const sql = `
+  //         SELECT
+  //           a.*,
+  //           b.name as shop_name,c.name as rent_person_name,
+  //           GROUP_CONCAT(d.task_id) AS taskIdList,
+  //           GROUP_CONCAT(DISTINCT f.name) AS directorNameList
+  //         FROM
+  //           shuyou_rent_computer a
+  //           LEFT JOIN shuyou_rent_computer_shop b ON a.shop_id = b.id
+  //           LEFT JOIN shuyou_game_director c ON a.rent_person_id = c.id
+  //           LEFT JOIN shuyou_rent_computer_usage d ON a.pc_num = d.pc_num
+  //           LEFT JOIN shuyou_game_task e ON e.id = d.task_id
+  //           LEFT JOIN shuyou_game_director f ON f.id = e.directorId
+  //         WHERE 1 = 1
+  //           ${this.setSql(pc_num, 'and a.pc_num = ?', [pc_num])}
+  //         GROUP BY a.id
+  //       `;
+  //   return this.sqlRenderPage(sql, query);
+  // }
+}

+ 81 - 0
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/components/adv-search-ledgerComputer.vue

@@ -0,0 +1,81 @@
+<template>
+	<div class="demo-adv-ledgerComputer-search">
+		<cl-adv-btn>筛选</cl-adv-btn>
+		<cl-adv-search :items="items" :op-list="opList" />
+	</div>
+</template>
+
+<script lang="ts">
+import { AdvSearchItem } from "cl-admin-crud-vue3/types";
+import { defineComponent, ref } from "vue";
+
+export default defineComponent({
+	setup() {
+		const items = ref<AdvSearchItem[]>([
+			{
+				prop: "new_date",
+				label: "目标日期",
+				span: 18,
+				component: {
+					name: "el-date-picker",
+					props: {
+						type: "daterange",
+						rangeSeparator: "至",
+						startPlaceholder: "开始日期",
+						endPlaceholder: "结束日期",
+						format: "YYYY-MM-DD",
+						valueFormat: "YYYY-MM-DD"
+					}
+				},
+				rules: {
+					required: true,
+					message: "日期不能为空"
+				}
+			},
+			{
+				prop: "shop_id",
+				label: "供应商",
+				span: 12,
+				component: {
+					name: "shuyouRentComputerShopSelect",
+					props: {
+						placeholder: "请选择供应商"
+					}
+				}
+			}
+			// {
+			// 	label: "运行状态",
+			// 	prop: "is_run",
+			// 	value: -1,
+			// 	component: {
+			// 		name: "el-radio-group",
+			// 		options: [
+			// 			{
+			// 				label: "运行",
+			// 				value: 1
+			// 			},
+			// 			{
+			// 				label: "停止",
+			// 				value: 0
+			// 			},
+			// 			{
+			// 				label: "所有",
+			// 				value: -1
+			// 			}
+			// 		]
+			// 	}
+			// }
+		]);
+
+		const opList = ref<string[]>(["search", "reset", "clear", "close"]);
+
+		return {
+			items,
+			opList
+		};
+	}
+});
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 0 - 3
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/components/adv-search.vue

@@ -49,7 +49,6 @@ export default defineComponent({
 				prop: "game_agentId",
 				label: "游戏端口",
 				span: 12,
-				group: "base",
 				component: {
 					name: "shuyouGameAgentselect",
 					props: {
@@ -61,7 +60,6 @@ export default defineComponent({
 				prop: "account_typeId",
 				label: "账号类型",
 				span: 12,
-				group: "base",
 				component: {
 					name: "shuyouAccountTypeselect",
 					props: {
@@ -73,7 +71,6 @@ export default defineComponent({
 				prop: "login_modeId",
 				label: "登录方式",
 				span: 12,
-				group: "base",
 				component: {
 					name: "shuyouLoModeselect",
 					props: {

+ 4 - 2
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/components/index.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: YKH
  * @Date: 2021-12-08 10:29:23
- * @LastEditTime: 2022-09-05 20:59:01
+ * @LastEditTime: 2022-09-20 14:21:16
  * @Description: 
  * @FilePath: \cool-admin\cool-admin-vue-vue3-ts-vite\src\cool\modules\shuyou\components\index.ts
  */
@@ -17,6 +17,7 @@ import shuyouGameDirectorNameselect from "./shuyouGameDirectorName-select.vue";
 import shuyouGameListSelect from "./shuyouGameList-select.vue";
 import specialAccountTypeselect from "./specialAccountType-select.vue";
 import shuyouRentComputerShopSelect from "./shuyouRentComputerShop-select.vue";
+import shuyouledgerComputerSelect from "./adv-search-ledgerComputer.vue";
 
 export default {
     shuyouGameAgentselect,
@@ -30,5 +31,6 @@ export default {
     shuyouGameListSelect,
     specialAccountTypeselect,
     shuyouRentComputerShopSelect,
-    shuyouGameTaskNameselect
+    shuyouGameTaskNameselect,
+    shuyouledgerComputerSelect
 };

+ 4 - 2
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/service/index.ts

@@ -1,7 +1,7 @@
 /*
  * @Author: YKH
  * @Date: 2021-12-08 10:29:23
- * @LastEditTime: 2022-09-02 19:25:58
+ * @LastEditTime: 2022-09-20 14:10:26
  * @Description: 
  * @FilePath: \cool-admin\cool-admin-vue-vue3-ts-vite\src\cool\modules\shuyou\service\index.ts
  */
@@ -35,6 +35,7 @@ import SyRobotEnterpriseWeChat from "./robot_enterprise_wechat";
 import ShuyouData23 from "./data_23";
 import ShuyouRentComputerShop from "./rent_computer_shop";
 import ShuyouRentComputer from "./rent_computer";
+import ShuyouRentLedgerComputer from "./rent_ledger_computer";
 
 export default {
 	shuyouLoMode: new ShuyouLoMode,
@@ -66,5 +67,6 @@ export default {
 	syRobotEnterpriseWeChat: new SyRobotEnterpriseWeChat,
 	shuyouData23: new ShuyouData23,
 	shuyouRentComputerShop: new ShuyouRentComputerShop,
-  	shuyouRentComputer: new ShuyouRentComputer
+  	shuyouRentComputer: new ShuyouRentComputer,
+	shuyouRentLedgerComputer:new ShuyouRentLedgerComputer
 };

+ 12 - 3
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/service/rent_computer.ts

@@ -1,13 +1,22 @@
 /*
  * @Author: YKH
  * @Date: 2022-09-02 19:24:43
- * @LastEditTime: 2022-09-02 19:25:10
+ * @LastEditTime: 2022-09-20 16:29:59
  * @Description: file content
  * @FilePath: \cool-admin\cool-admin-vue-vue3-ts-vite\src\cool\modules\shuyou\service\rent_computer.ts
  */
-import { BaseService, Service } from "/@/core";
+import { BaseService, Permission, Service } from "/@/core";
 
 @Service("shuyou/rent_computer")
-class ShuyouRentComputer extends BaseService {}
+class ShuyouRentComputer extends BaseService {
+	@Permission("replaceNum")
+	replaceNum(data: any) {
+		return this.request({
+			url: "/replaceNum",
+			method: "POST",
+			data
+		});
+	}
+}
 
 export default ShuyouRentComputer;

+ 13 - 0
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/service/rent_ledger_computer.ts

@@ -0,0 +1,13 @@
+/*
+ * @Author: YKH
+ * @Date: 2022-09-02 19:24:43
+ * @LastEditTime: 2022-09-20 14:09:50
+ * @Description: file content
+ * @FilePath: \cool-admin\cool-admin-vue-vue3-ts-vite\src\cool\modules\shuyou\service\rent_computer.ts
+ */
+import { BaseService, Service } from "/@/core";
+
+@Service("shuyou/rent_ledger_computer")
+class ShuyouRentLedgerComputer extends BaseService {}
+
+export default ShuyouRentLedgerComputer;

+ 269 - 152
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/views/game_target.vue

@@ -32,8 +32,13 @@
 					</el-button>
 				</template> -->
 				<template #slot-resetPay="{ scope }">
-					<el-button v-if="showResetPay(scope.row)" type="text" size="mini"
-						@click="switchResetPay(scope.row)">重置付费</el-button>
+					<el-button
+						v-if="showResetPay(scope.row)"
+						type="text"
+						size="mini"
+						@click="switchResetPay(scope.row)"
+						>重置付费</el-button
+					>
 				</template>
 				<!-- <template #slot-payFailed="{ scope }">
 					<el-button v-if="showResetPay(scope.row)" type="text" size="mini"
@@ -44,7 +49,12 @@
 						@click="switchResetPay(scope.row)">未付费</el-button>
 				</template> -->
 				<template #slot-incomplete="{ scope }">
-					<el-button v-if="showPage(scope.row)" type="warning" size="mini" @click="switchPage(scope.row)">原因填写
+					<el-button
+						v-if="showPage(scope.row)"
+						type="warning"
+						size="mini"
+						@click="switchPage(scope.row)"
+						>原因填写
 					</el-button>
 				</template>
 			</cl-table>
@@ -55,7 +65,12 @@
 			<cl-pagination />
 		</el-row>
 
-		<cl-upsert v-model="form" v-bind="upsert" :on-info="onInfoSubmit" :on-submit="onUpsertSubmit">
+		<cl-upsert
+			v-model="form"
+			v-bind="upsert"
+			:on-info="onInfoSubmit"
+			:on-submit="onUpsertSubmit"
+		>
 			<!-- 动态增减表单验证 -->
 			<template #slot-validate="{}">
 				<el-button @click="addCardMsg()">添加卡号</el-button>
@@ -73,7 +88,12 @@
 								</el-form-item>
 							</el-col>
 							<el-col :span="2" v-if="cardList.length !== 1">
-								<el-button @click="deleteCardMsg(index)" class="el-icon-delete" size="mini" circle>
+								<el-button
+									@click="deleteCardMsg(index)"
+									class="el-icon-delete"
+									size="mini"
+									circle
+								>
 								</el-button>
 							</el-col>
 						</el-row>
@@ -86,54 +106,86 @@
 				<el-row>
 					<el-form-item label="警告:" prop="task_id">
 						<el-col :span="24">
-							<p style="color:red;font-size: larger;">当日目标未完成,请于次日9点以后填写原因说明,否则无效</p>
+							<p style="color: red; font-size: larger">
+								当日目标未完成,请于次日9点以后填写原因说明,否则无效
+							</p>
 						</el-col>
 					</el-form-item>
 				</el-row>
 				<el-row>
 					<el-form-item label="任务ID" prop="task_id">
 						<el-col :span="24">
-							<el-input v-model="reasonForm.task_id" placeholder="任务ID" disabled="true"></el-input>
+							<el-input
+								v-model="reasonForm.task_id"
+								placeholder="任务ID"
+								disabled="true"
+							></el-input>
 						</el-col>
 					</el-form-item>
 					<el-form-item label="任务名称" prop="task_name">
 						<el-col :span="24">
-							<el-input v-model="reasonForm.task_name" placeholder="任务名称" disabled="true"></el-input>
+							<el-input
+								v-model="reasonForm.task_name"
+								placeholder="任务名称"
+								disabled="true"
+							></el-input>
 						</el-col>
 					</el-form-item>
 				</el-row>
 				<el-row>
 					<el-form-item label="负责人" prop="directorName">
 						<el-col :span="24">
-							<el-input v-model="reasonForm.directorName" placeholder="任务名称" disabled="true"></el-input>
+							<el-input
+								v-model="reasonForm.directorName"
+								placeholder="任务名称"
+								disabled="true"
+							></el-input>
 						</el-col>
 					</el-form-item>
 					<el-form-item label="任务日期" prop="new_date">
 						<el-col :span="24">
-							<el-input v-model="reasonForm.new_date" placeholder="任务名称" disabled="true"></el-input>
+							<el-input
+								v-model="reasonForm.new_date"
+								placeholder="任务日期"
+								disabled="true"
+							></el-input>
 						</el-col>
 					</el-form-item>
 				</el-row>
 				<el-form-item label="问题类型" prop="type_id">
 					<el-col :span="6">
-						<demo-problem-type-select v-model="reasonForm.type_id"></demo-problem-type-select>
+						<demo-problem-type-select
+							v-model="reasonForm.type_id"
+						></demo-problem-type-select>
 					</el-col>
 				</el-form-item>
 				<el-form-item label="未完原因" prop="reason">
 					<el-col :span="20">
-						<el-input v-model="reasonForm.reason" type="textarea" placeholder="未完原因"
-							:autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
+						<el-input
+							v-model="reasonForm.reason"
+							type="textarea"
+							placeholder="未完原因"
+							:autosize="{ minRows: 4, maxRows: 4 }"
+							:style="{ width: '100%' }"
+						></el-input>
 					</el-col>
 				</el-form-item>
 				<el-form-item label="解决方案" prop="solution">
 					<el-col :span="20">
-						<el-input v-model="reasonForm.solution" type="textarea" placeholder="解决方案"
-							:autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
+						<el-input
+							v-model="reasonForm.solution"
+							type="textarea"
+							placeholder="解决方案"
+							:autosize="{ minRows: 4, maxRows: 4 }"
+							:style="{ width: '100%' }"
+						></el-input>
 					</el-col>
 				</el-form-item>
 				<el-form-item>
 					<el-button size="small" @click="visible = false">取消</el-button>
-					<el-button type="primary" size="small" @click="updateReason(reasonForm)">提交</el-button>
+					<el-button type="primary" size="small" @click="updateReason(reasonForm)"
+						>提交</el-button
+					>
 				</el-form-item>
 			</el-form>
 		</cl-dialog>
@@ -141,13 +193,18 @@
 			<el-form ref="elForm" :model="payAccount" size="medium" label-width="100px">
 				<el-form-item label="类型" prop="type">
 					<el-col :span="20">
-						<p style="color:red;font-size: larger;">{{ payAccount.type }}</p>
+						<p style="color: red; font-size: larger">{{ payAccount.type }}</p>
 					</el-col>
 				</el-form-item>
 				<el-form-item label="账号" prop="account">
 					<el-col :span="20">
-						<el-input v-model="payAccount.account" type="textarea" placeholder=""
-							:autosize="{ minRows: 20, maxRows: 20 }" :style="{ width: '100%' }"></el-input>
+						<el-input
+							v-model="payAccount.account"
+							type="textarea"
+							placeholder=""
+							:autosize="{ minRows: 20, maxRows: 20 }"
+							:style="{ width: '100%' }"
+						></el-input>
 					</el-col>
 				</el-form-item>
 				<el-form-item>
@@ -155,17 +212,38 @@
 				</el-form-item>
 			</el-form>
 		</cl-dialog>
-		<el-dialog title="今日可付费账号获取" v-model="visible_can_pay" :center="true" :close-on-click-modal="false"
-			:close-on-press-escape="false" width="50%">
-			<p style="color:red;font-size: larger;margin-bottom: 10px;">{{ payAccount.type }}</p>
+		<el-dialog
+			title="今日可付费账号获取"
+			v-model="visible_can_pay"
+			:center="true"
+			:close-on-click-modal="false"
+			:close-on-press-escape="false"
+			width="50%"
+		>
+			<p style="color: red; font-size: larger; margin-bottom: 10px">{{ payAccount.type }}</p>
 			<!--付费金额填写-->
 			<div v-if="rowTask.login_modeId == 2">
 				<span>加币金额</span>
-				<el-input-number v-model="pay_price" :precision="0" :step="1" :max="10" :min="1" size="small"
-					style="margin-left: 20px;margin-bottom: 10px;" controls-position="right" step-strictly />
+				<el-input-number
+					v-model="pay_price"
+					:precision="0"
+					:step="1"
+					:max="10"
+					:min="1"
+					size="small"
+					style="margin-left: 20px; margin-bottom: 10px"
+					controls-position="right"
+					step-strictly
+				/>
 			</div>
-			<el-table :data="accountList" border style="width: 100%;" max-height="500">
-				<el-table-column prop="account" label="账号" align="left" min-width="50" header-align="left" />
+			<el-table :data="accountList" border style="width: 100%" max-height="500">
+				<el-table-column
+					prop="account"
+					label="账号"
+					align="left"
+					min-width="50"
+					header-align="left"
+				/>
 				<!-- <el-table-column prop="account" label="账号" align="left" min-width="200" header-align="left">
 					<template #default="scope">
 						<el-button size="small">
@@ -173,17 +251,39 @@
 						</el-button>
 					</template>
 				</el-table-column> -->
-				<el-table-column prop="password" label="密码" align="left" min-width="50" header-align="left" />
-				<el-table-column fixed="right" label="操作" width="110" align="center" header-align="center">
+				<el-table-column
+					prop="password"
+					label="密码"
+					align="left"
+					min-width="50"
+					header-align="left"
+				/>
+				<el-table-column
+					fixed="right"
+					label="操作"
+					width="110"
+					align="center"
+					header-align="center"
+				>
 					<template #default="scope">
-						<el-button v-permission="service.shuyouGameTarget.permission.handAddPayMz"
-							v-if="rowTask.login_modeId == 2" size="small" type="warning" plain
-							@click="handAddPayMz(scope.row)">
+						<el-button
+							v-permission="service.shuyouGameTarget.permission.handAddPayMz"
+							v-if="rowTask.login_modeId == 2"
+							size="small"
+							type="warning"
+							plain
+							@click="handAddPayMz(scope.row)"
+						>
 							魅族加币
 						</el-button>
 					</template>
 				</el-table-column>
-				<el-table-column fixed="right" label="信息展示" align="center" header-align="center">
+				<el-table-column
+					fixed="right"
+					label="信息展示"
+					align="center"
+					header-align="center"
+				>
 					<template #default="scope">
 						<span>{{ scope.row.msg }}</span>
 					</template>
@@ -191,30 +291,39 @@
 			</el-table>
 			<div v-if="rowTask.login_modeId == 2">
 				<el-divider>
-					<span style="color:#FF0080">↓任意账号强制加币,谨慎使用↓</span>
+					<span style="color: #ff0080">↓任意账号强制加币,谨慎使用↓</span>
 				</el-divider>
-				<el-row :gutter="24" style="margin-top:20px">
+				<el-row :gutter="24" style="margin-top: 20px">
 					<el-col :span="10">
-						<span style="color:red">如果加不上币,提示额度不足等需要强制加币请联系王梳霖</span>
+						<span style="color: red"
+							>如果加不上币,提示额度不足等需要强制加币请联系王梳霖</span
+						>
 					</el-col>
 				</el-row>
-				<el-row :gutter="24" style="margin-top:20px"
-					v-permission="service.shuyouGameTarget.permission.forceAddPayMz">
+				<el-row
+					:gutter="24"
+					style="margin-top: 20px"
+					v-permission="service.shuyouGameTarget.permission.forceAddPayMz"
+				>
 					<el-col :span="6">
 						<el-input v-model="force_add.force_account" size="small" />
 					</el-col>
 					<el-col :span="5">
-						<el-button class="el-icon-plus" type="danger" plain size="small" @click="forceAddPayMz()">
+						<el-button
+							class="el-icon-plus"
+							type="danger"
+							plain
+							size="small"
+							@click="forceAddPayMz()"
+						>
 							强制加币
 						</el-button>
 					</el-col>
 					<el-col :span="10">
-						<span style="color:red">{{ force_add.msg }}</span>
+						<span style="color: red">{{ force_add.msg }}</span>
 					</el-col>
 				</el-row>
 			</div>
-
-
 		</el-dialog>
 	</cl-crud>
 </template>
@@ -252,11 +361,11 @@ export default defineComponent({
 		let accountList = ref<any[]>([]);
 		const pay_price = ref<number>(6);
 		const force_add = reactive<any>({
-			force_account: '',
-			force_msg: ''
+			force_account: "",
+			force_msg: ""
 		});
 		const rowTask = reactive<any>({
-			xjf_id: '',
+			xjf_id: "",
 			login_modeId: 0
 		});
 		let cardList = ref<any[]>([]);
@@ -489,11 +598,11 @@ export default defineComponent({
 				{
 					label: "其他支付方式",
 					prop: "other_pay_hand",
-					value: '',
+					value: "",
 					span: 6,
 					group: "complete",
 					hidden: ({ scope }: any) => {
-						return (scope.pay_mode_hand != 4 || scope.is_pay_hand != 0);
+						return scope.pay_mode_hand != 4 || scope.is_pay_hand != 0;
 					},
 					component: {
 						name: "el-input"
@@ -529,7 +638,7 @@ export default defineComponent({
 					span: 6,
 					group: "complete",
 					hidden: ({ scope }: any) => {
-						return (scope.is_pay_hand != 0 || scope.is_pay_hand != 0);
+						return scope.is_pay_hand != 0 || scope.is_pay_hand != 0;
 					},
 					component: {
 						name: "el-input"
@@ -542,7 +651,7 @@ export default defineComponent({
 					span: 6,
 					group: "complete",
 					hidden: ({ scope }: any) => {
-						return (scope.is_same_hand != 0 || scope.is_pay_hand != 0);
+						return scope.is_same_hand != 0 || scope.is_pay_hand != 0;
 					},
 					component: {
 						name: "el-input"
@@ -578,7 +687,7 @@ export default defineComponent({
 					prop: "account_hand",
 					label: "账号记录",
 					group: "complete",
-					value: '',
+					value: "",
 					span: 20,
 					component: {
 						name: "cl-editor-quill",
@@ -640,7 +749,7 @@ export default defineComponent({
 							rows: 10
 						}
 					}
-				},
+				}
 			]
 		});
 
@@ -660,7 +769,7 @@ export default defineComponent({
 					return {
 						label: scope.task_name,
 						disabled: true
-					}
+					};
 				},
 				"refresh",
 				"update",
@@ -856,30 +965,30 @@ export default defineComponent({
 		}
 		//编辑打开时的钩子
 		function onInfoSubmit(data: any, { next, done, close }: any) {
-			service.info
-			done(data)
-			cardList.value = data.card_list
+			service.info;
+			done(data);
+			cardList.value = data.card_list;
 			// console.log(data)
 		}
 
 		//查询当前付费失败的账号
 		async function payFailed(scope: any) {
-			const task_id = scope.task_id
+			const task_id = scope.task_id;
 			service.shuyouUtils
 				.payFailed({ task_id: task_id })
 				.then((data) => {
 					// console.log(data.code)
 					visible_pay.value = true;
-					payAccount.type = '付费失败的账号'
+					payAccount.type = "付费失败的账号";
 					if (data.code == 1) {
-						if (data.message == 'null') {
-							payAccount.account = '暂无账号'
+						if (data.message == "null") {
+							payAccount.account = "暂无账号";
 						} else {
-							let arr = ''
-							data.message.forEach(e => {
-								arr += e.account + '----' + e.password + '\n'
+							let arr = "";
+							data.message.forEach((e) => {
+								arr += e.account + "----" + e.password + "\n";
 							});
-							payAccount.account = arr
+							payAccount.account = arr;
 						}
 					}
 				})
@@ -889,25 +998,24 @@ export default defineComponent({
 		}
 
 		function addCardMsg() {
-			let hasFlag = false
+			let hasFlag = false;
 			for (let i = 0; i < cardList.value.length; i++) {
-				if (cardList.value[i].card_account == '' || cardList.value[i].card_balance == '') {
-					hasFlag = true
+				if (cardList.value[i].card_account == "" || cardList.value[i].card_balance == "") {
+					hasFlag = true;
 					break;
 				}
 			}
 			if (hasFlag == true) {
-				ElMessage.error('有未填写项');
+				ElMessage.error("有未填写项");
 			} else {
 				cardList.value.push({
-					card_account: '',
-					card_balance: ''
+					card_account: "",
+					card_balance: ""
 				});
 			}
-
 		}
 		function deleteCardMsg(index: number) {
-			cardList.value.splice(index, 1)
+			cardList.value.splice(index, 1);
 		}
 
 		// 权限service.shuyouGameTarget.permission.forceAddPayMz
@@ -916,26 +1024,30 @@ export default defineComponent({
 
 		//查询今日可付费账号
 		async function unpaid(scope: any) {
-			const task_id = scope.task_id
-			rowTask.xjf_id = scope.xjf_id
-			rowTask.login_modeId = scope.login_modeId
-			accountList.value = []
+			const task_id = scope.task_id;
+			rowTask.xjf_id = scope.xjf_id;
+			rowTask.login_modeId = scope.login_modeId;
+			accountList.value = [];
 			service.shuyouUtils
 				.unpaid({ task_id: task_id })
 				.then((data) => {
 					visible_can_pay.value = true;
-					payAccount.type = '( ' + scope.task_name + ' ) - ' + '当日可付费账号,仅展示100个,如需更多,请联系国亮哥获取'
+					payAccount.type =
+						"( " +
+						scope.task_name +
+						" ) - " +
+						"当日可付费账号,仅展示100个,如需更多,请联系国亮哥获取";
 					if (data.code == 1) {
-						if (data.message == 'null') {
-							payAccount.type = '暂无账号'
+						if (data.message == "null") {
+							payAccount.type = "暂无账号";
 						} else {
-							data.message.forEach(e => {
+							data.message.forEach((e) => {
 								let obj = {
 									account: e.account,
 									password: e.password,
-									msg: ''
-								}
-								accountList.value.push(obj)
+									msg: ""
+								};
+								accountList.value.push(obj);
 							});
 						}
 					}
@@ -945,60 +1057,65 @@ export default defineComponent({
 				});
 		}
 		async function handAddPayMz(row: any) {
-			ElMessageBox.confirm(
-				"确定要手动加币吗,请谨慎操作!!!",
-				'账号: ' + row.account,
-				{
-					dangerouslyUseHTMLString: true,
-					type: "warning"
-				}
-			).then(() => {
-				service.shuyouGameTarget
-					.handAddPayMz({ xjf_id: rowTask.xjf_id, account: row.account, pay_price: pay_price.value })
-					.then((data) => {
-						// console.log(data)
-						if (data.code == 1) {
-							ElMessage.success(data.message);
-						} else {
-							ElMessage.error(data.message);
-						}
-						row.msg = data.message
-					})
-					.catch((err: string) => {
-						ElMessage.error(err);
-					});
-			}).catch(() => null);
-
+			ElMessageBox.confirm("确定要手动加币吗,请谨慎操作!!!", "账号: " + row.account, {
+				dangerouslyUseHTMLString: true,
+				type: "warning"
+			})
+				.then(() => {
+					service.shuyouGameTarget
+						.handAddPayMz({
+							xjf_id: rowTask.xjf_id,
+							account: row.account,
+							pay_price: pay_price.value
+						})
+						.then((data) => {
+							// console.log(data)
+							if (data.code == 1) {
+								ElMessage.success(data.message);
+							} else {
+								ElMessage.error(data.message);
+							}
+							row.msg = data.message;
+						})
+						.catch((err: string) => {
+							ElMessage.error(err);
+						});
+				})
+				.catch(() => null);
 		}
 		async function forceAddPayMz() {
-			force_add.msg = ''
+			force_add.msg = "";
 			ElMessageBox.confirm(
 				"确定要强制给账号加币吗,请谨慎操作!!!",
-				'账号: ' + force_add.force_account,
+				"账号: " + force_add.force_account,
 				{
 					dangerouslyUseHTMLString: true,
 					type: "error"
 				}
-			).then(() => {
-				service.shuyouGameTarget
-					.handAddPayMz({ xjf_id: rowTask.xjf_id, account: force_add.force_account, pay_price: pay_price.value })
-					.then((data) => {
-						// console.log(data)
-						if (data.code == 1) {
-							ElMessage.success(data.message);
-						} else {
-							ElMessage.error(data.message);
-						}
-						force_add.msg = data.message
-					})
-					.catch((err: string) => {
-						ElMessage.error(err);
-					});
-			}).catch(() => null);
-
+			)
+				.then(() => {
+					service.shuyouGameTarget
+						.handAddPayMz({
+							xjf_id: rowTask.xjf_id,
+							account: force_add.force_account,
+							pay_price: pay_price.value
+						})
+						.then((data) => {
+							// console.log(data)
+							if (data.code == 1) {
+								ElMessage.success(data.message);
+							} else {
+								ElMessage.error(data.message);
+							}
+							force_add.msg = data.message;
+						})
+						.catch((err: string) => {
+							ElMessage.error(err);
+						});
+				})
+				.catch(() => null);
 		}
 
-
 		// crud 加载
 		async function onLoad({ ctx, app }: CrudLoad) {
 			// console.log(service);
@@ -1012,28 +1129,27 @@ export default defineComponent({
 				ElMessageBox.confirm(aa.message, "数据查询失败", {
 					type: "error"
 				})
-					.then(() => { })
+					.then(() => {})
 					.catch(() => null);
 
 				// ctx.service(service.shuyouGameTarget).done();
 				// app.refresh();
-
 			}
 		}
 
 		function showPage(row: any) {
-			var ret = false
-			if (row.is_complete == 0 && dayjs(new Date()).format('YYYY-MM-DD') != row.new_date) {
-				ret = true
+			var ret = false;
+			if (row.is_complete == 0 && dayjs(new Date()).format("YYYY-MM-DD") != row.new_date) {
+				ret = true;
 			}
-			return ret
+			return ret;
 		}
 		function showResetPay(row: any) {
-			var ret = false
-			if (dayjs(new Date()).format('YYYY-MM-DD') == row.new_date) {
-				ret = true
+			var ret = false;
+			if (dayjs(new Date()).format("YYYY-MM-DD") == row.new_date) {
+				ret = true;
 			}
-			return ret
+			return ret;
 		}
 
 		// 表单值
@@ -1084,7 +1200,7 @@ export default defineComponent({
 				.catch((err: string) => {
 					ElMessage.error(err);
 				});
-		};
+		}
 		async function switchResetPay(xxx) {
 			ElMessageBox.confirm(
 				"确定要重新下发今日付费未成功的账号以及重置留存账号吗?!!",
@@ -1093,22 +1209,23 @@ export default defineComponent({
 					dangerouslyUseHTMLString: true,
 					type: "info"
 				}
-			).then(() => {
-				service.shuyouGameTarget
-					.resetPay({ id: xxx.task_id })
-					.then((data) => {
-						// console.log(data)
-						if (data.code == 1) {
-							ElMessage.success(data.message);
-						} else {
-							ElMessage.error(data.message);
-						}
-						refs.value.crud.refresh();
-					})
-					.catch((err: string) => {
-						ElMessage.error(err);
-					});
-			})
+			)
+				.then(() => {
+					service.shuyouGameTarget
+						.resetPay({ id: xxx.task_id })
+						.then((data) => {
+							// console.log(data)
+							if (data.code == 1) {
+								ElMessage.success(data.message);
+							} else {
+								ElMessage.error(data.message);
+							}
+							refs.value.crud.refresh();
+						})
+						.catch((err: string) => {
+							ElMessage.error(err);
+						});
+				})
 				.catch(() => null);
 		}
 

+ 227 - 37
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/views/rent_computer.vue

@@ -1,5 +1,5 @@
 <template>
-	<cl-crud @load="onLoad">
+	<cl-crud :ref="setRefs('crud')" @load="onLoad">
 		<el-row type="flex">
 			<cl-refresh-btn />
 			<cl-add-btn />
@@ -18,15 +18,25 @@
 		</el-row>
 
 		<el-row>
-			<cl-table v-bind="table" >
-				<!-- <template #column-pc_position="{ scope }">
-					<span v-if="scope.row.is_rent == 0">{{
-						scope.row.pc_position
-					}}</span>
-					<span v-if="scope.row.is_rent == 1">
-						{{scope.row.pc_position}}({{scope.row.shop_name}})
-					</span>
-				</template> -->
+			<cl-table v-bind="table">
+				<template #slot-renew="{ scope }">
+					<el-button type="text" size="mini" @click="renew(scope.row)">续费</el-button>
+				</template>
+				<template #slot-renting-out="{ scope }">
+					<el-button type="text" size="mini" @click="rentingOut(scope.row)"
+						>退租</el-button
+					>
+				</template>
+				<template #slot-replace-num="{ scope }">
+					<el-button type="text" size="mini" @click="switchReplaceNum(scope.row)"
+						>换编号</el-button
+					>
+				</template>
+				<template #slot-delete="{ scope }">
+					<el-button type="text" size="mini" @click="deleteNum(scope.row)"
+						>下架</el-button
+					>
+				</template>
 			</cl-table>
 		</el-row>
 
@@ -41,23 +51,71 @@
 					v-model="scope.rent_start"
 					type="date"
 					:@change="calculateRentDuration(scope)"
-					placeholder="选择租机日期">
+					placeholder="选择租机日期"
+				>
 				</el-date-picker>
 			</template>
 			<template #slot-rent_duration="{ scope }">
-				<el-input v-model="scope.rent_duration" placeholder="租机时长(天)" @change="calculateRentDuration(scope)"></el-input>
+				<el-input
+					v-model="scope.rent_duration"
+					placeholder="租机时长(天)"
+					@change="calculateRentDuration(scope)"
+				>
+				</el-input>
 			</template>
 		</cl-upsert>
+
+		<cl-dialog title="租机编号更换" v-model="visible">
+			<el-form ref="elForm" :model="replaceNumForm" size="medium" label-width="100px">
+				<el-row>
+					<el-form-item label="警告:" prop="">
+						<el-col :span="24">
+							<p style="color: red; font-size: larger">
+								请勿随意更换,会影响租机续费
+							</p>
+						</el-col>
+					</el-form-item>
+				</el-row>
+				<el-row>
+					<el-form-item label="原租机编号" prop="pc_num_old">
+						<el-col :span="24">
+							<el-input
+								v-model="replaceNumForm.pc_num_old"
+								placeholder="原租机编号"
+								disabled="true"
+							></el-input>
+						</el-col>
+					</el-form-item>
+					<el-form-item label="更换编号" prop="pc_num_new">
+						<el-col :span="24">
+							<el-input
+								v-model="replaceNumForm.pc_num_new"
+								placeholder="更换编号"
+							></el-input>
+						</el-col>
+					</el-form-item>
+				</el-row>
+				<el-form-item>
+					<el-button size="small" @click="visible = false">取消</el-button>
+					<el-button type="primary" size="small" @click="replaceNum(replaceNumForm)"
+						>提交</el-button
+					>
+				</el-form-item>
+			</el-form>
+		</cl-dialog>
 	</cl-crud>
 </template>
 
 <script lang="ts">
 import { CrudLoad, Table, Upsert } from "cl-admin-crud-vue3/types";
-import { defineComponent, inject, reactive,watch } from "vue";
+import { defineComponent, inject, reactive, ref } from "vue";
 import QueryIsAbnormal from "../components/query-is_abnormal.vue";
+import dayjs from "dayjs";
+import { ElMessage } from "element-plus";
+import { useRefs } from "/@/core";
 
 export default defineComponent({
-	name: "game-computer",
+	name: "rent-computer",
 
 	components: {
 		"demo-query-isabnormal": QueryIsAbnormal
@@ -65,11 +123,24 @@ export default defineComponent({
 
 	setup() {
 		const service = inject<any>("service");
-
+		const { refs, setRefs }: any = useRefs();
 		// 表单值
 		const form = reactive<any>({
 			relevance: 1
 		});
+		// 表单值
+		const replaceNumForm = reactive<any>({
+			pc_num_old: "",
+			pc_num_new: "",
+			shop_id: 0,
+			rent_duration: 0,
+			rent_end: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
+			rent_price: 0,
+			rent_price_day: 0,
+			pay_method: 0,
+			rent_person_id: ""
+		});
+		const visible = ref<boolean>(false);
 
 		// 新增、编辑配置
 		const upsert = reactive<Upsert>({
@@ -212,7 +283,7 @@ export default defineComponent({
 				{
 					label: "租机价格",
 					prop: "rent_price",
-					value: 0.00,
+					value: 0.0,
 					span: 12,
 					component: {
 						name: "el-input-number",
@@ -263,6 +334,29 @@ export default defineComponent({
 						]
 					}
 				},
+				{
+					prop: "is_expire",
+					label: "是否到期",
+					value: 0,
+					group: "base_msg",
+					component: {
+						name: "el-radio-group",
+						options: [
+							{
+								label: "在租期中",
+								value: 0
+							},
+							{
+								label: "到期未续",
+								value: 1
+							},
+							{
+								label: "即将到期",
+								value: 2
+							}
+						]
+					}
+				}
 			]
 		});
 
@@ -287,7 +381,7 @@ export default defineComponent({
 					sortable: "true",
 					headerAlign: "left",
 					align: "left",
-					minWidth: 180,
+					minWidth: 180
 				},
 				{
 					prop: "pc_num",
@@ -295,7 +389,7 @@ export default defineComponent({
 					sortable: "true",
 					headerAlign: "left",
 					align: "left",
-					minWidth: 100,
+					minWidth: 100
 				},
 				{
 					prop: "pc_name",
@@ -322,6 +416,28 @@ export default defineComponent({
 					minWidth: 150
 				},
 				{
+					prop: "is_expire",
+					label: "是否到期",
+					minWidth: 80,
+					dict: [
+						{
+							label: "在租期中",
+							value: 0,
+							type: "success"
+						},
+						{
+							label: "到期未续",
+							value: 1,
+							type: "info"
+						},
+						{
+							label: "即将到期",
+							value: 2,
+							type: "danger"
+						}
+					]
+				},
+				{
 					prop: "rent_duration",
 					label: "租机时常",
 					sortable: "true",
@@ -396,7 +512,7 @@ export default defineComponent({
 					label: "备注",
 					headerAlign: "left",
 					align: "left",
-					minWidth: 100
+					minWidth: 200
 				},
 				{
 					prop: "updateTime",
@@ -407,8 +523,15 @@ export default defineComponent({
 					minWidth: 150
 				},
 				{
-					label: "操作",
-					type: "op"
+					type: "op",
+					buttons: [
+						"edit", //编辑信息
+						"slot-renew", //续费
+						"slot-renting-out", //退租
+						"slot-replace-num", //换编号
+						"slot-delete" //删除/下架-管理员专用
+					],
+					width: 130
 				}
 			]
 		});
@@ -420,29 +543,96 @@ export default defineComponent({
 			app.refresh();
 		}
 		// 计算租机到期时间
-		function calculateRentDuration(scope: { rent_end: Date; rent_start: string; rent_duration: string; }) {
-			scope.rent_end = new Date(Date.parse(scope.rent_start) + 1 * 24 * 60 * 60 * 1000 * (parseInt(scope.rent_duration) - 1 ))
+		function calculateRentDuration(scope: {
+			rent_end: Date;
+			rent_start: string;
+			rent_duration: string;
+		}) {
+			scope.rent_end = new Date(
+				Date.parse(scope.rent_start) +
+					1 * 24 * 60 * 60 * 1000 * (parseInt(scope.rent_duration) - 1)
+			);
 		}
-		// 监听
-		watch(
-			() => form,
-			(newVal, oldValue) => {
-				// console.log(newVal, oldValue);
-				if(form.is_rent == 1){
-					form.pc_position = "租机"
-				}
-			},
-			{
-				deep: true,
-				immediate: true
+		// 续费
+		async function renew(rowData) {}
+		// 退租
+		async function rentingOut(rowData: any) {}
+		// 拉起换编号弹窗
+		async function switchReplaceNum(rowData: any) {
+			replaceNumForm.pc_num_old = rowData.pc_num;
+			replaceNumForm.shop_id = rowData.shop_id;
+			replaceNumForm.rent_duration = rowData.rent_duration;
+			replaceNumForm.rent_end = rowData.rent_end;
+			replaceNumForm.rent_price = rowData.rent_price;
+			replaceNumForm.rent_price_day = rowData.rent_price_day;
+			replaceNumForm.pay_method = rowData.pay_method;
+			replaceNumForm.rent_person_id = rowData.rent_person_id;
+			if (visible.value == false) {
+				visible.value = true;
 			}
-		);
+		}
+		// 换编
+		async function replaceNum(rowData: any) {
+			let doForm = {
+				pc_num_old: rowData.pc_num_old,
+				pc_num_new: rowData.pc_num_new,
+				shop_id: rowData.shop_id,
+				rent_duration: rowData.rent_duration,
+				rent_end: rowData.rent_end,
+				rent_price: rowData.rent_price,
+				rent_price_day: rowData.rent_price_day,
+				pay_method: rowData.pay_method,
+				rent_person_id: rowData.rent_person_id
+				// remark: rowData.remark  //备注说明一下谁换的谁
+			};
+			service.shuyouRentComputer
+				.replaceNum(doForm)
+				.then((data: any) => {
+					// console.log(data);
+					if (data.code == 1) {
+						visible.value = false;
+						ElMessage.success(data.message);
+					} else {
+						ElMessage.error(data.message);
+					}
+					// console.log('刷新页面')
+					refs.value.crud.refresh();
+				})
+				.catch((err: string) => {
+					ElMessage.error(err);
+				});
+		}
+		// 删除/下架
+		async function deleteNum(rowData) {}
+		// 监听
+		// watch(
+		// 	() => form,
+		// 	(newVal, oldValue) => {
+		// 		// console.log(newVal, oldValue);
+		// 		if(form.is_rent == 1){
+		// 			form.pc_position = "租机"
+		// 		}
+		// 	},
+		// 	{
+		// 		deep: true,
+		// 		immediate: true
+		// 	}
+		// );
 		return {
 			form,
+			refs,
+			setRefs,
 			upsert,
 			table,
 			onLoad,
-			calculateRentDuration
+			calculateRentDuration,
+			renew,
+			rentingOut,
+			replaceNum,
+			deleteNum,
+			switchReplaceNum,
+			visible,
+			replaceNumForm
 		};
 	}
 });

+ 1 - 1
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/views/rent_computer_shop.vue

@@ -42,7 +42,7 @@ import { CrudLoad, Table, Upsert } from "cl-admin-crud-vue3/types";
 import { defineComponent, inject, reactive } from "vue";
 
 export default defineComponent({
-	name: "sys-role",
+	name: "rent-computer-shop",
 
 	setup() {
 		const service = inject<any>("service");

+ 451 - 0
cool-admin-vue-vue3-ts-vite/src/cool/modules/shuyou/views/rent_ledger_computer.vue

@@ -0,0 +1,451 @@
+<template>
+	<cl-crud @load="onLoad">
+		<el-row type="flex">
+			<cl-refresh-btn />
+			<cl-add-btn />
+			<cl-multi-delete-btn />
+			<cl-flex1 />
+			<cl-search-key
+				field="pc_num"
+				:field-list="[
+					{
+						label: '电脑编号',
+						value: 'pc_num'
+					}
+				]"
+			></cl-search-key>
+			<demo-adv-ledgerComputer-search />
+		</el-row>
+
+		<el-row>
+			<cl-table v-bind="table" >
+				<!-- <template #column-pc_position="{ scope }">
+					<span v-if="scope.row.is_rent == 0">{{
+						scope.row.pc_position
+					}}</span>
+					<span v-if="scope.row.is_rent == 1">
+						{{scope.row.pc_position}}({{scope.row.shop_name}})
+					</span>
+				</template> -->
+			</cl-table>
+		</el-row>
+
+		<el-row type="flex">
+			<cl-flex1 />
+			<cl-pagination />
+		</el-row>
+
+		<cl-upsert v-model="form" v-bind="upsert">
+			<template #slot-rent_start="{ scope }">
+				<el-date-picker
+					v-model="scope.rent_start"
+					type="date"
+					:@change="calculateRentDuration(scope)"
+					placeholder="选择租机日期">
+				</el-date-picker>
+			</template>
+			<template #slot-rent_duration="{ scope }">
+				<el-input v-model="scope.rent_duration" placeholder="租机时长(天)" @change="calculateRentDuration(scope)"></el-input>
+			</template>
+		</cl-upsert>
+	</cl-crud>
+</template>
+
+<script lang="ts">
+import { CrudLoad, Table, Upsert } from "cl-admin-crud-vue3/types";
+import { defineComponent, inject, reactive,watch } from "vue";
+import QueryIsAbnormal from "../components/query-is_abnormal.vue";
+import AdvSearch from "../components/adv-search-ledgerComputer.vue";
+
+export default defineComponent({
+	name: "rent-ledger-computer",
+
+	components: {
+		"demo-query-isabnormal": QueryIsAbnormal,
+		"demo-adv-ledgerComputer-search":AdvSearch
+	},
+
+	setup() {
+		const service = inject<any>("service");
+
+		// 表单值
+		const form = reactive<any>({
+			relevance: 1
+		});
+
+		// 新增、编辑配置
+		const upsert = reactive<Upsert>({
+			width: "800px",
+
+			items: [
+				{
+					prop: "pc_num",
+					label: "电脑编号",
+					span: 8,
+					component: {
+						name: "el-input",
+						props: {
+							placeholder: "租机方提供的电脑编号"
+						}
+					},
+					rules: {
+						required: true,
+						message: "电脑编号不能为空"
+					}
+				},
+				{
+					prop: "pc_name",
+					label: "电脑名称",
+					span: 8,
+					component: {
+						name: "el-input",
+						props: {
+							placeholder: "脚本上传的电脑名"
+						}
+					},
+					rules: {
+						required: true,
+						message: "电脑名称不能为空"
+					}
+				},
+				{
+					prop: "rent_person_id",
+					label: "租赁人",
+					span: 8,
+					component: {
+						name: "shuyouGameDirectorselect",
+						props: {
+							placeholder: "租赁人"
+						}
+					}
+				},
+				{
+					prop: "shop_id",
+					label: "供应商",
+					span: 8,
+					component: {
+						name: "shuyouRentComputerShopSelect",
+						props: {
+							placeholder: "供应商"
+						}
+					},
+					rules: {
+						required: true,
+						message: "供应商不能为空"
+					}
+				},
+				// {
+				// 	prop: "taskIdList",
+				// 	label: "游戏任务",
+				// 	span: 24,
+				// 	component: {
+				// 		name: "el-input",
+				// 		props: {
+				// 			placeholder: "游戏任务"
+				// 		}
+				// 	},
+				// 	rules: {
+				// 		required: true,
+				// 		message: "游戏任务不能为空"
+				// 	}
+				// },
+				{
+					prop: "taskIdList",
+					label: "游戏任务",
+					span: 24,
+					value: [],
+					component: {
+						name: "shuyouGameTaskNameselect",
+						props: {
+							props: {
+								// "multiple-limit": 3
+							}
+						}
+					},
+					rules: {
+						required: true,
+						message: "游戏任务不能为空"
+					}
+				},
+				{
+					prop: "rent_start",
+					label: "起租时间",
+					span: 12,
+					value: Date(),
+					component: {
+						name: "slot-rent_start"
+						// name: "el-date-picker",
+						// props: {
+						// 	type: "date",
+						// 	placeholder: "选择租机日期"
+						// }
+					},
+					rules: {
+						required: true,
+						message: "起租时间不能为空"
+					}
+				},
+				{
+					prop: "rent_duration",
+					label: "租机时长",
+					value: 1,
+					span: 12,
+					component: {
+						name: "slot-rent_duration"
+					},
+					rules: {
+						required: true,
+						message: "租机时长不能为空"
+					}
+				},
+				{
+					prop: "rent_end",
+					label: "到期时间",
+					span: 12,
+					component: {
+						name: "el-date-picker",
+						props: {
+							type: "date",
+							readonly: true,
+							placeholder: "选择到期时间"
+						}
+					}
+				},
+				{
+					label: "租机价格",
+					prop: "rent_price",
+					value: 0.00,
+					span: 12,
+					component: {
+						name: "el-input-number",
+						props: {
+							precision: "2",
+							step: "1"
+						}
+					},
+					rules: {
+						required: true,
+						message: "租机价格不能为空"
+					}
+				},
+				{
+					prop: "remark",
+					label: "备注",
+					span: 24,
+					group: "base_msg",
+					component: {
+						name: "el-input",
+						props: {
+							placeholder: "请填写备注",
+							type: "textarea",
+							rows: 3
+						}
+					}
+				},
+				{
+					prop: "pay_method",
+					label: "结算方式",
+					value: 0,
+					group: "base_msg",
+					component: {
+						name: "el-radio-group",
+						options: [
+							{
+								label: "先付后用",
+								value: 0
+							},
+							{
+								label: "先用后付",
+								value: 1
+							},
+							{
+								label: "其他方式",
+								value: 2
+							}
+						]
+					}
+				},
+			]
+		});
+
+		// 表格配置
+		const table = reactive<Table>({
+			props: {
+				"default-sort": {
+					prop: "pc_num",
+					order: "descending"
+				}
+			},
+			columns: [
+				{
+					type: "selection",
+					headerAlign: "left",
+					align: "left",
+					width: 40
+				},
+				{
+					prop: "shop_name",
+					label: "供应商",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 180,
+				},
+				{
+					prop: "pc_num",
+					label: "电脑编号",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 100,
+				},
+				{
+					prop: "pc_name",
+					label: "电脑名称",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 120
+				},
+				{
+					prop: "rent_start",
+					label: "起租时间",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 150
+				},
+				{
+					prop: "rent_end",
+					label: "到期时间",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 150
+				},
+				{
+					prop: "rent_duration",
+					label: "租机时常",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 120
+				},
+				{
+					prop: "rent_price",
+					label: "租机价格",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 120
+				},
+				{
+					prop: "rent_price_day",
+					label: "折算天租金",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 120
+				},
+				{
+					prop: "rent_price_used",
+					label: "已产生租金",
+					sortable: "true",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 120
+				},
+				{
+					prop: "directorNameList",
+					label: "使用人",
+					headerAlign: "left",
+					align: "left",
+					sortable: "custom",
+					minWidth: 100
+				},
+				{
+					prop: "pay_method",
+					label: "结算方式",
+					minWidth: 80,
+					dict: [
+						{
+							label: "先付后用",
+							value: 0,
+							type: "primary"
+						},
+						{
+							label: "先用后付",
+							value: 1,
+							type: "success"
+						},
+						{
+							label: "其他方式",
+							value: 2,
+							type: "danger"
+						}
+					]
+				},
+				{
+					prop: "rent_person_name",
+					label: "租赁人",
+					headerAlign: "left",
+					align: "left",
+					sortable: "custom",
+					minWidth: 100
+				},
+				{
+					prop: "remark",
+					label: "备注",
+					headerAlign: "left",
+					align: "left",
+					minWidth: 100
+				},
+				{
+					prop: "updateTime",
+					label: "更新时间",
+					headerAlign: "left",
+					align: "left",
+					sortable: "custom",
+					minWidth: 150
+				},
+				{
+					label: "操作",
+					type: "op"
+				}
+			]
+		});
+
+		// crud 加载
+		function onLoad({ ctx, app }: CrudLoad) {
+			// console.log(service)
+			ctx.service(service.shuyouRentLedgerComputer).done();
+			app.refresh();
+		}
+		// 计算租机到期时间
+		function calculateRentDuration(scope: { rent_end: Date; rent_start: string; rent_duration: string; }) {
+			scope.rent_end = new Date(Date.parse(scope.rent_start) + 1 * 24 * 60 * 60 * 1000 * (parseInt(scope.rent_duration) - 1 ))
+		}
+		// 监听
+		watch(
+			() => form,
+			(newVal, oldValue) => {
+				// console.log(newVal, oldValue);
+				if(form.is_rent == 1){
+					form.pc_position = "租机"
+				}
+			},
+			{
+				deep: true,
+				immediate: true
+			}
+		);
+		return {
+			form,
+			upsert,
+			table,
+			onLoad,
+			calculateRentDuration
+		};
+	}
+});
+</script>