schangxiang@126.com
2025-09-10 3d43ffa3152110b7823f9fa6320c08a6ae02358a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
  <div ref="container" class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
    </yrt-data-list>
    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes" :btn-read-only="btnReadOnly" @on-add-load-after="onEditLoadAfter" @on-edit-load-after="onEditLoadAfter">
      <!--自定义审核按钮-->
      <template slot="footer-button-region" slot-scope="{ formData }">
        <el-button :disabled="btnReadOnly.auditing" type="success" icon="el-icon-yrt-qiyong" @click.native="updateAuditing(formData, 2)">审核</el-button>
        <el-button :disabled="!btnReadOnly.auditing" type="danger" icon="el-icon-yrt-guanbi" @click.native="updateAuditing(formData, 0)">审核驳回</el-button>
        <el-button :disabled="btnReadOnly.signingStatus" type="success" icon="el-icon-yrt-icon-test" @click.native="updateSign(formData, '已签署')">签署</el-button>
        <el-button :disabled="!btnReadOnly.signingStatus" type="danger" icon="el-icon-yrt-guanbi" @click.native="updateSign(formData, '未签署')">签署驳回</el-button>
      </template>
    </yrt-editor>
  </div>
</template>
<script>
import baseLayout from "@/components/common/base-layout.vue";
export default {
  name: "basicInfo-tms-base-driverContract",
  components: {},
  mixins: [baseLayout],
  data() {
    return {};
  },
  mounted() {},
  methods: {
    /**
     * 审核
     * **/
    updateAuditing(dataList, auditing) {
      this.$confirm("审核后将无法对页面进行操作, 是否继续?", "提示", {
        cancelButtonText: "取消",
        confirmButtonText: "确定",
        type: "warning"
      })
        .then(() => {
          const contract_Id = this.editor.formData["contract_Id"]; // 获取id 值
          const url = "/api/basicInfo/tms/basedriverContract/updateAuditing"; // 服务地址
          const params = {
            contract_Id: contract_Id,
            auditing: auditing
          };
          var callback = res => {
            this.common.showMsg(res);
 
            if (res.result) {
              // 判断请求 返回成功 true  失败 false
              this.dataList.reload(); // 刷新列表数据
              this.editor.reload(); // 刷新编辑器数据
            }
          };
          this.common.ajax(url, params, callback, true);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },
    /**
     * 签署
     * **/
    updateSign(dataList, status) {
      this.$confirm("签署后将无法对页面进行操作, 是否继续?", "提示", {
        cancelButtonText: "取消",
        confirmButtonText: "确定",
        type: "warning"
      })
        .then(() => {
          const contract_Id = this.editor.formData["contract_Id"]; // 获取id 值
          const url = "/api/basicInfo/tms/baseDriverContract/updateSign"; // 服务地址
          const params = {
            contract_Id: contract_Id,
            signingStatus: status
          };
          var callback = res => {
            this.common.showMsg(res);
 
            if (res.result) {
              // 判断请求 返回成功 true  失败 false
              this.dataList.reload(); // 刷新列表数据
              this.editor.reload(); // 刷新编辑器数据
            }
          };
          this.common.ajax(url, params, callback, true);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },
    /**
     *  //false 为可编辑 true 禁用编辑
     * 当数据加载后触发
     * 0 待审核
     * 2 通过审核
     *
     * 1 未签署
     * 2 已签署
     * **/
    onEditLoadAfter(formData) {
      const auditingID = formData.auditing; // 审核
      const signingStatus = formData.signingStatus; // 签署
      if (auditingID === 0) {
        this.$set(this.btnReadOnly, "auditing", false);
        this.editorOptions.config.disabled = false;
      } else if (auditingID === 2) {
        this.$set(this.btnReadOnly, "auditing", true);
        this.editorOptions.config.disabled = true;
      }
      if (signingStatus === "未签署") {
        this.$set(this.btnReadOnly, "signingStatus", false);
        this.editorOptions.config.disabled = false;
      } else if (signingStatus === "已签署") {
        this.$set(this.btnReadOnly, "signingStatus", true);
        this.editorOptions.config.disabled = true;
      }
    }
  }
};
</script>