<template lang="">
|
<div class="page-list-container">
|
<!-- 列表数据 -->
|
<yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :auth-nodes="authNodes" :data-list-selections.sync="dataListSelections" :button-click="buttonClick" :cell-style="cellStyle">
|
<template slot="common-column-slot" slot-scope="{row, col}">
|
<template v-if="col.prop==dataOptions.linkColumn">
|
<el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField], row);}">
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</el-link>
|
</template>
|
|
<!-- 自定义地址显示 -->
|
<template v-else-if="col.prop === 'annex'">
|
<el-link v-if="row.annex" type="primary" @click.native="downAttach(row)">下载附件</el-link>
|
</template>
|
|
<template v-else-if="col.dropdown_Id>0">
|
{{ dataList.translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</template>
|
|
<template v-else>
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</template>
|
</template>
|
</template>
|
</yrt-data-list>
|
<!-- 修改状态 -->
|
<el-dialog v-dialogDrag :visible.sync="isSatusDialog" title="更改快递公司" width="500px">
|
<el-form :label-width="formLabelWidth">
|
<el-form-item label="合同状态">
|
<el-select v-model="from.contractSatus" filterable clearable placeholder="请选择合同状态">
|
<el-option v-for="(item, index) in options" :key="index" :label="item.name" :value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="isSatusDialog=false">取 消</el-button>
|
<el-button type="primary" @click="updateSatus()">确 定</el-button>
|
</div>
|
</el-dialog>
|
<!-- 编辑器 -->
|
<yrt-editor
|
:ref="editorRef"
|
:data-list-ref="dataListRef"
|
v-bind="editorOptions"
|
:data-options="dataOptions"
|
:action.sync="editorOptions.action"
|
:visible.sync="editorOptions.config.visible"
|
:detail-button-click="detailButtonClick"
|
:auth-nodes="authNodes"
|
:cell-style="cellStyle"
|
:on-save-before="onSaveBefore" >
|
|
</yrt-editor>
|
|
</div>
|
</template>
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
var moment = require("moment");
|
export default {
|
name: "basicInfo-consignor-base-consignorContract",
|
components: {},
|
mixins: [baseLayout],
|
data() {
|
return {
|
from: {
|
contractSatus: "" // 选中的合同状态
|
},
|
options: [
|
{
|
value: "正常",
|
label: "正常"
|
},
|
{
|
value: "终止",
|
label: "终止"
|
},
|
{
|
value: "暂停",
|
label: "暂停"
|
}
|
],
|
// 状态显示
|
isSatusDialog: false,
|
// 页面宽度
|
formLabelWidth: "120px"
|
};
|
},
|
mounted() {},
|
created() {},
|
methods: {
|
// 设置行颜色
|
cellStyle({ row, column, rowIndex, columnIndex }) {
|
const effetiveDays = row.effetiveDays; // 剩余有效天数
|
const contractDays = row.contractDays; // 合同天数
|
|
if (effetiveDays > contractDays / 3 && effetiveDays < contractDays * 2 / 3) {
|
// 当剩余有效天数大于合同天数的1/3,小于合同天数的2/3时,背景颜色将提示为橙黄色
|
return { "background-color": "#ff9900 !important", color: "#eee" };
|
} else if (effetiveDays > 0 && effetiveDays < contractDays / 3) {
|
// 当剩余有效天数大于0,小于合同天数的1/3时,背景颜色将提示为红色
|
return { "background-color": "#ff0033", color: "#eee" };
|
} else if (effetiveDays < 0) {
|
// 当剩余有效天数小于0,也就是合同已过期,背景颜色将提示为深红色
|
return { "background-color": "#990000", color: "#eee" };
|
}
|
},
|
// 保存前事件
|
onSaveBefore(formData) {
|
// var arr = JSON.parse(formData.expandFields);
|
// var start = moment(formData.contractStartTime).format("YYYY-MM-DD HH:mm:ss");
|
// var end = moment(formData.contractEndTime).format("YYYY-MM-DD HH:mm:ss");
|
// formData.contractDays = end.subtract(start, "days");
|
var contractDays = "";
|
var effetiveDays = "";
|
|
var start = moment(formData.contractStartTime);
|
var end = moment(formData.contractEndTime);
|
var now = moment();
|
// 合同天数=合同结束日期-合同开始日期
|
contractDays = end.diff(start, "days");
|
// 合同天数=合同结束日期-合同开始日期
|
effetiveDays = end.diff(now, "days");
|
|
this.editor.changeValue("contractDays", contractDays);
|
this.editor.changeValue("effetiveDays", effetiveDays);
|
},
|
// 显示状态页面
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "contractAlter":
|
// 显示对话框
|
this.isSatusDialog = true;
|
return true;
|
}
|
},
|
// 下载附件
|
downAttach(row) {
|
// debugger;
|
// const url = row.annex;
|
// const urls = url.split(",");
|
// for (const _url of urls) {
|
// console.log(_url);
|
// }
|
},
|
// 修改状态
|
updateSatus() {
|
// 获得已选中的ID
|
const selectIDs = this.dataListSelections.map((item, index, Array) => {
|
return item.contract_Id;
|
});
|
if (!selectIDs.length) {
|
this.$message({
|
message: "至少选中一行!",
|
type: "warning"
|
});
|
return;
|
} else {
|
this.$confirm("检测到未保存的内容,是否在离开页面前保存修改?", "确认信息", {
|
distinguishCancelAndClose: true,
|
confirmButtonText: "保存",
|
cancelButtonText: "放弃修改"
|
}).then(() => {
|
const url = "/api/basicInfo/base/ConsignorContract/updateSatus";
|
const params = {
|
selectIDs: selectIDs,
|
contractSatus: this.from.contractSatus
|
};
|
const ref = this.dataList;
|
var callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.isSatusDialog = false;
|
ref.loadData();
|
}
|
};
|
this.common.ajax(url, params, callback, ref);
|
});
|
}
|
}
|
}
|
};
|
</script>
|