ZhangXianQiang
2024-04-10 245514f4265faba31d0e778b41c6698d541baacc
src/views/system/calculate/record/index.vue
@@ -1,25 +1,25 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="核算规则" prop="ruleName">
        <el-input
          v-model="queryParams.ruleName"
          placeholder="请输入规则名称"
          clearable
          @clear="handleQuery"
          @keyup.enter.native="handleQuery"
        />
      <el-form-item label="单位名" prop="checkUnitId">
        <el-select v-model="queryParams.checkUnitId" clearable @clear="handleQuery" placeholder="请选择单位">
          <el-option
            label="成都x运维"
            value="1">
          </el-option>
          <el-option
            label="成都a运维"
            value="2">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker
          v-model="daterangeCreateTime"
          style="width: 240px"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        />
      <el-form-item label="核算日期" prop="date" >
        <el-date-picker clearable
          v-model="queryParams.date"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择核算日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -30,12 +30,23 @@
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:record:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:record:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
@@ -46,118 +57,101 @@
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:record:remove']"
        >删除</el-button>
      </el-col>
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['system:checkRule:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:record:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="checkRuleList" @selection-change="handleSelectionChange">
    <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="核算规则" align="center" prop="ruleName" />
      <el-table-column label="核算对象" align="center" prop="category">
      <el-table-column label="核算记录日期" align="center" prop="date" width="180">
        <template slot-scope="scope">
        <div v-if="scope.row.category === 1">视频监控</div>
        <div v-else-if="scope.row.category === 2">车辆识别</div>
        <div v-else-if="scope.row.category === 3">人脸识别</div>
          <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="合同名" align="center" prop="ruleDetail" />
      <el-table-column label="金额" align="center" prop="ruleDetail" />
      <el-table-column label="创建时间" align="center" prop="createTime" />
      <el-table-column label="核算规则" align="center" prop="ruleId">
        <template slot-scope="scope">
          <div v-if="scope.row.ruleId == 1">成都x运维考核结果应用规则</div>
        </template>
      </el-table-column>
      <el-table-column label="单位名" align="center" prop="unitId" >
        <template slot-scope="scope">
          <div v-if="scope.row.unitId == 2">成都x运维</div>
        </template>
      </el-table-column>
      <el-table-column label="总服务费" align="center" prop="totalAmount" />
      <el-table-column label="扣减服务费" align="center" prop="deductAmount" />
      <el-table-column label="考核分数" align="center" prop="score" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-s-check"
              @click="handleAudit(scope.row)"
              v-hasPermi="['check:rule:audit']"
            >审核</el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
            >修改</el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
            >删除</el-button>
          </template>
        </el-table-column>
       </el-table>
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:record:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:record:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
          <pagination
            v-show="total>0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
          />
  <div>
    <!-- 添加或修改考核规则对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="规则名称" prop="ruleName">
          <el-input v-model="form.ruleName" placeholder="请输入规则名称" />
        </el-form-item>
        <el-form-item label="规则类型" prop="category">
          <el-select v-model="form.category" placeholder="规则类型">
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改核算记录对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="核算对象" prop="checkUnitId">
          <el-select v-model="queryParams.checkUnitId" clearable @clear="handleQuery" placeholder="核算对象">
            <el-option
              v-for="item in categoryList"
              :key="item.id"
              :label="item.value"
              :value="item.id">
              label="成都x运维"
              value="1">
            </el-option>
            <el-option
              label="成都a运维"
              value="2">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规则描述" prop="ruleDetail">
          <el-input v-model="form.ruleDetail" type="textarea" show-word-limit maxlength="150" placeholder="请输入规则描述"/>
        <el-form-item label="核算记录日期" prop="date" >
          <el-date-picker clearable
            v-model="form.date"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择核算记录日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="参数配置" prop="ruleDetail">
          <div class="row-warp">
            <div class="row">
              <div class="row-left">参数名</div>
              <div class="row-right">条件</div>
            </div>
            <div class="row">
              <div class="row-left">天网视频点位数</div>
              <div class="row-right">
                <div>不少于</div>
                <div>
                  <el-input class="input-w" type="number" v-model="form.videoPointNum"/>{{" %"}}
                </div>
              </div>
            </div>
            <div class="row">
              <div class="row-left">车辆卡口点位数</div>
              <div class="row-right">
                <div>不少于</div>
                <div><el-input class="input-w" type="number" v-model="form.vehicleCheckpointNum"/></div>{{" %"}}
              </div>
            </div>
            <div class="row">
              <div class="row-left">人脸卡口点位数</div>
              <div class="row-right">
                <div>不少于</div>
                <div>
                  <el-input class="input-w" type="number" v-model="form.faceChceckpointNum" /></div>{{" %"}}
                </div>
            </div>
          </div>
        <el-form-item label="总服务费" prop="totalAmount">
          <el-input v-model="form.totalAmount" placeholder="请输入总服务费" />
        </el-form-item>
        <el-form-item label="扣减服务费" prop="deductAmount">
          <el-input v-model="form.deductAmount" placeholder="请输入扣减服务费" />
        </el-form-item>
        <el-form-item label="考核分数" prop="score">
          <el-input v-model="form.score" placeholder="请输入考核分数" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
@@ -166,83 +160,13 @@
      </div>
    </el-dialog>
  </div>
  <!-- 审核考核规则对话框 -->
  <el-dialog :title="title" :visible.sync="auditOpen" width="600px" append-to-body>
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-form-item label="规则名称" prop="ruleName">
        <el-input v-model="form.ruleName" placeholder="请输入规则名称" disabled/>
      </el-form-item>
      <el-form-item label="规则类型" prop="category">
        <el-select v-model="form.category" placeholder="规则类型" disabled>
          <el-option
            v-for="item in categoryList"
            :key="item.id"
            :label="item.value"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="规则描述" prop="ruleDetail">
        <el-input v-model="form.ruleDetail" type="textarea" show-word-limit maxlength="150" placeholder="请输入规则描述" disabled/>
      </el-form-item>
      <el-form-item label="参数配置" prop="ruleDetail" disabled>
        <div class="row-warp">
          <div class="row">
            <div class="row-left">参数名</div>
            <div class="row-right">条件</div>
          </div>
          <div class="row">
            <div class="row-left">天网视频点位数</div>
            <div class="row-right">
              <div>不少于</div>
              <div>
                <el-input class="input-w" type="number" v-model="form.videoPointNum" disabled/>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="row-left">车辆卡口点位数</div>
            <div class="row-right">
              <div>不少于</div>
              <div><el-input class="input-w" type="number" v-model="form.vehicleCheckpointNum" disabled/></div>
            </div>
          </div>
          <div class="row">
            <div class="row-left">人脸卡口点位数</div>
            <div class="row-right">
              <div>不少于</div>
              <div>
                <el-input class="input-w" type="number" v-model="form.faceChceckpointNum" disabled/></div>
            </div>
          </div>
        </div>
      </el-form-item>
      <el-form-item label="审核结果" prop="auditState" >
        <el-radio-group v-model="form.auditState">
        <el-radio :label="1">通过</el-radio>
        <el-radio :label="2">驳回</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="审核说明" prop="auditDescription" >
        <el-input v-model="form.auditDescription" type="textarea" show-word-limit maxlength="100" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
  </div>
</template>
<script>
import { listCheckRule, getCheckRule, delCheckRule, addCheckRule, updateCheckRule } from "@/api/platform/check-rule";
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/platform/calculate-record";
export default {
  name: "CheckRule",
  dicts: ['platform_audit_state'],
  name: "Record",
  data() {
    return {
      // 遮罩层
@@ -257,34 +181,29 @@
      showSearch: true,
      // 总条数
      total: 0,
      // 运维类型
      categoryList: [
        { id: 1, value: '视频监控' },
        { id: 2, value: '车辆识别' },
        { id: 3, value: '人脸识别' },
      ],
      // 考核规则表格数据
      checkRuleList: [],
      daterangeCreateTime: [],
      // 核算记录表格数据
      recordList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否显示弹出层
      auditOpen: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        ruleName: null,
        createTime: null,
        date: null,
        ruleId: null,
        unitId: null,
        totalAmount: null,
        deductAmount: null,
        score: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        ruleName: [
          { required: true, message: "规则名称不能为空", trigger: "blur" }
        id: [
          { required: true, message: "$comment不能为空", trigger: "blur" }
        ],
      }
    };
@@ -293,15 +212,11 @@
    this.getList();
  },
  methods: {
    /** 查询考核规则列表 */
    /** 查询核算记录列表 */
    getList() {
      this.loading = true;
      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
        this.queryParams["start"] = this.daterangeCreateTime[0];
        this.queryParams["end"] = this.daterangeCreateTime[1];
      }
      listCheckRule(this.queryParams).then(response => {
        this.checkRuleList = response.data;
      listRecord(this.queryParams).then(response => {
        this.recordList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
@@ -309,21 +224,18 @@
    // 取消按钮
    cancel() {
      this.open = false;
      this.auditOpen = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        ruleName: null,
        ruleDetail: null,
        videoPointNum: null,
        vehicleCheckpointNum: null,
        faceChceckpointNum: null,
        createTime: null,
        updateTime: null,
        deleted: null
        date: null,
        ruleId: null,
        unitId: null,
        totalAmount: null,
        deductAmount: null,
        score: null
      };
      this.resetForm("form");
    },
@@ -347,27 +259,16 @@
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加考核规则";
      this.title = "添加核算记录";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getCheckRule(id).then(response => {
      getRecord(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改考核规则";
      });
    },
    /** 审核按钮操作 */
    handleAudit(row) {
      this.reset();
      const id = row.id || this.ids
      getCheckRule(id).then(response => {
        this.form = response.data;
        this.auditOpen = true;
        this.title = "审核考核规则";
        this.title = "修改核算记录";
      });
    },
    /** 提交按钮 */
@@ -375,17 +276,15 @@
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateCheckRule(this.form).then(response => {
            updateRecord(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.auditOpen = false;
              this.getList();
            });
          } else {
            addCheckRule(this.form).then(response => {
            addRecord(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.auditOpen = false;
              this.getList();
            });
          }
@@ -395,56 +294,19 @@
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除考核规则编号为"' + ids + '"的数据项?').then(function() {
        return delCheckRule(ids);
      this.$modal.confirm('是否确认删除核算记录编号为"' + ids + '"的数据项?').then(function() {
        return delRecord(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/checkRule/export', {
      this.download('system/record/export', {
        ...this.queryParams
      }, `checkRule_${new Date().getTime()}.xlsx`)
      }, `record_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style scoped>
.input-w {
  margin-left: 5px;
  width: 70px;
}
.row-warp {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  border: solid 1px gray;
  /*padding: 3px;*/
}
.row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  border-bottom: solid 1px gray;
  padding: 3px;
}
.row:last-of-type {
  border-bottom: none;
}
.row-left {
  flex: 2;
  border-right: solid 1px gray;
}
.row-right {
  flex: 4;
  display: flex;
  flex-direction: row;
  justify-content: center;
}
</style>