<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>
|