<template>
<!-- 停复役单审批 -->
    <div class="SSDApproval">
        <div class="box">
            <div class="box-top">
                <el-form
                    style="overflow: hidden;"
                    :style="filterForm.show ? null : { height: '0px' }"
                    size="mini"
                    label-width="85px"
                >
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="编制时间">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetimerange"
                                    v-model="filterForm.data.creattime"
                                    placeholder=""
                                    style="width: 100%;"
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="申请人">
                                <el-input clearable
                                    v-model="filterForm.data.applyer"
                                    placeholder=""
                                    style="width: 100%;"
                                    @keyup.enter.native="getTableData(1)"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!-- <el-row>
                        <el-col :span="12">
                            <el-form-item label="审批时间">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetimerange"
                                    v-model="filterForm.data.signtime"
                                    placeholder=""
                                    style="width: 100%;"
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="作业联络人">
                                <el-input clearable
                                    v-model="filterForm.data.worklinkman"
                                    placeholder=""
                                    style="width: 100%;"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row> -->
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="申请停役时间">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetimerange"
                                    v-model="filterForm.data.stoptime"
                                    placeholder=""
                                    style="width: 100%;"
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="设备名称">
                                <el-input clearable
                                    v-model="filterForm.data.equipmentname"
                                    placeholder=""
                                    style="width: 100%;"
                                    @keyup.enter.native="getTableData(1)"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="申请复役时间">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetimerange"
                                    v-model="filterForm.data.restarttime"
                                    placeholder=""
                                    style="width: 100%;"
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="作业内容">
                                <el-input clearable
                                    v-model="filterForm.data.reasoncontent"
                                    placeholder=""
                                    style="width: 100%;"
                                    @keyup.enter.native="getTableData(1)"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="6">
                            <el-form-item label="单据状态">
                                <el-select
                                    filterable clearable
                                    v-model="filterForm.data.billstatus"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                >
                                    <el-option
                                        v-for="item of nameObj.billstatus.arr"
                                        :key="item.id"
                                        :value="item.id"
                                        :label="item.name"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <!-- <el-col :span="6">
                            <el-form-item label="操作状态">
                                <el-select
                                filterable clearable
                                    v-model="filterForm.data.operatestatus"
                                    placeholder=""
                                    style="width: 100%;"
                                >
                                    <el-option
                                        v-for="item of nameObj.operatestatus.arr"
                                        :key="item.id"
                                        :value="item.id"
                                        :label="item.name"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col> -->
                    </el-row>
                </el-form>
                <div class="box-top-gjl">
                    <div style="float:right; text-align: right;">
                        <el-button
                            class="button"
                            type="primary"
                            size="mini"
                            icon="el-icon-search"
                            v-privilege="activeMenu + 'QUERY'"
                            @click="getTableData(1)"
                        >查询</el-button>
                        <el-button
                            class="button"
                            type="primary"
                            size="mini"
                            icon="el-icon-refresh"
                            v-privilege="activeMenu + 'QUERY'"
                            @click="tableDataCancel();"
                        >重置</el-button>
                        <el-button
                            size="mini"
                            :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
                            :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
                            @click="filterForm.show = !filterForm.show;
                                $nextTick(() => {
                                    singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
                                }
                            );"
                        >{{ filterForm.show ? '收起' : '展开' }}</el-button>
                    </div>
                </div>
            </div>
            <div class="box-bottom">
                <el-table stripe
                    id="singleTable"
                    ref="singleTable"
                    :data="tableData"
                    v-loading="tableLoading"
                    style="width: 100%;"
                    :height="singleTableHeight"
                    border
                    size="mini"
                    highlight-current-row
                >
                    <el-table-column
                    sortable
                        prop="billsno"
                        label="停复役单编号"
                        min-width="100px"
                        :show-overflow-tooltip="true"
                    ></el-table-column>
                    <el-table-column
                    sortable
                        prop="creattime"
                        label="编制时间"
                        min-width="100px"
                        :show-overflow-tooltip="true"
                    ></el-table-column>
                    <el-table-column
                    sortable
                        prop="equipmentname"
                        label="设备名称"
                        min-width="100px"
                        :show-overflow-tooltip="true"
                    ></el-table-column>
                    <el-table-column
                    sortable
                        prop="applyer"
                        label="申请人"
                        min-width="100px"
                        :show-overflow-tooltip="true"
                    ></el-table-column>
                    <el-table-column
                    sortable
                        prop="worklinkman"
                        label="作业联络人"
                        min-width="100px"
                        :show-overflow-tooltip="true"
                    ></el-table-column>
                    <!-- <el-table-column
                    sortable
                        prop="operatestatus"
                        label="操作状态"
                        min-width="100px"
                        :show-overflow-tooltip="true"
                    >
                        <template slot-scope="scope">
                            <span>{{ nameObj.operatestatus.obj[scope.row.operatestatus] ? nameObj.operatestatus.obj[scope.row.operatestatus] : scope.row.operatestatus }}</span>
                        </template>
                    </el-table-column> -->
                    <el-table-column
                        sortable
                        prop="billstatus"
                        label="单据状态"
                        min-width="100px"
                        :show-overflow-tooltip="true"
                    >
                        <template slot-scope="scope">
                            <span>{{ nameObj.billstatus.obj[scope.row.billstatus] ? nameObj.billstatus.obj[scope.row.billstatus] : scope.row.billstatus }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column
                        class-name="gn-TableDownloadExcel-none"
                        label="操作"
                        align="center"
                        width="70px"
                        fixed="right"
                    >
                        <template slot-scope="scope">
                            <div>
                                <el-button
                                    type="primary"
                                    size="mini"
                                    @click="but_edit(scope.row)"
                                >审批</el-button>
                            </div>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total"
                    :page-sizes="[10, 20, 50, 100, 500, 1000]"
                    :page-size="pageSize"
                    :current-page.sync="pageNum"
                    @size-change="tableSizeChange"
                    @current-change="getTableData()"
                    style="text-align: right;margin-top: 10px;"
                ></el-pagination>
            </div>
        </div>
        <el-dialog
            :title="'停复役申请单 - 审批'"
            :visible.sync="dialog.editorBox.show"
            width="940px"
            :close-on-click-modal="false"
            :show-close="!loading"
        >
            <div>
                <el-form
                    ref="dialog_form"
                    :model="dialog.editorBox.form.data"
                    :rules="dialog.editorBox.form.rules"
                    size="mini"
                    label-width="120px"
                >
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="介质系统" prop="tfymediumsystem">
                                <el-select
                                filterable clearable
                                    v-model="dialog.editorBox.form.data.tfymediumsystem"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                >
                                    <el-option
                                        v-for="item of nameObj.tfymediumsystem.arr"
                                        :key="item.id"
                                        :value="item.id"
                                        :label="item.name"
                                    ></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="停复役单编号" prop="billsno">
                                <el-input clearable
                                    v-model="dialog.editorBox.form.data.billsno"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="编制时间" prop="creattime">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetime"
                                    v-model="dialog.editorBox.form.data.creattime"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="申请人" prop="applyer">
                                <el-input clearable
                                    v-model="dialog.editorBox.form.data.applyer"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="设备名称" prop="equipmentname">
                                <el-input clearable
                                    v-model="dialog.editorBox.form.data.equipmentname"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="申请负责人" prop="chargeman">
                                <el-input clearable
                                    v-model="dialog.editorBox.form.data.chargeman"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="申请停役时间" prop="stoptime">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetime"
                                    v-model="dialog.editorBox.form.data.stoptime"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="申请复役时间" prop="restarttime">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetime"
                                    v-model="dialog.editorBox.form.data.restarttime"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="作业联络人" prop="worklinkman">
                                <el-input clearable
                                    v-model="dialog.editorBox.form.data.worklinkman"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="8">
                            <el-form-item label="检修开始时间" prop="examinestarttime">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetime"
                                    v-model="dialog.editorBox.form.data.examinestarttime"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="检修结束时间" prop="examineendtime">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetime"
                                    v-model="dialog.editorBox.form.data.examineendtime"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-container>
                        <el-main style="padding: 0;">
                            <el-form-item label="申请原因和作业内容" prop="reasoncontent">
                                <el-input clearable
                                    class="nr-textarea"
                                    type="textarea"
                                    v-model="dialog.editorBox.form.data.reasoncontent"
                                    placeholder=""
                                    style="width: 100%;"
                                    disabled
                                ></el-input>
                            </el-form-item>
                        </el-main>
                        <el-aside
                            width="200px"
                            style="padding-left: 15px;"
                        >
                            <zj-fileUploadBox class="fileUploadBox" :uploadBut="false" :files="dialog.editorBox.files"></zj-fileUploadBox>
                        </el-aside>
                    </el-container>
                    <el-form-item label="主管单位审批意见" prop="opinion">
                        <el-input clearable
                            type="textarea"
                            v-model="dialog.editorBox.form.data.opinion"
                            placeholder=""
                            style="width: 100%;"
                        ></el-input>
                    </el-form-item>
                    <el-form-item label="备注" prop="note">
                        <el-input clearable
                            type="textarea"
                            v-model="dialog.editorBox.form.data.note"
                            placeholder=""
                            style="width: 100%;"
                        ></el-input>
                    </el-form-item>
                    <el-row>
                        <el-col :span="16">
                            <el-form-item label="审批人" prop="approver">
                                <el-input clearable
                                    v-model="dialog.editorBox.form.data.approver"
                                    placeholder=""
                                    style="width: 100%;"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item label="审批时间" prop="signtime">
                                <el-date-picker
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="datetime"
                                    v-model="dialog.editorBox.form.data.signtime"
                                    placeholder=""
                                    style="width: 100%;"
                                ></el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
            </div>
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button @click="dialog.editorBox.show = false" :loading="loading">取 消</el-button>
                <el-button
                    type="primary"
                    @click="dataSave()"
                >暂 存</el-button>
                <el-button
                    type="primary"
                    @click="submitBut()"
                >提 交</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
import fileUploadBox from '~/components/zg/fileUploadBox.vue'
import { formatDate } from '@/utils/util.js'
import store from '@/store/index.js';
export default {
    name: 'SSDApproval',
    components: {
        'zj-fileUploadBox': fileUploadBox
    },
    data () {
        return {
            store,
            userInfo: {
                data: null
            },
            activeMenu: '',
            filterForm: {
                show: true,
                data: {
                    creattime: '',
                    applyer: '',
                    signtime: '',
                    worklinkman: '',
                    stoptime: '',
                    equipmentname: '',
                    restarttime: '',
                    reasoncontent: '',
                    billstatus: 'check'
                    // operatestatus: ''
                },
                rules: {

                }
            },
            pageNum: 1,
            pageSize: 20,
            total: 0,
            singleTableHeight: 100,
            tableData: [
                // {
                //     billsno: 'TFY_20190826_0001',
                //     creattime: '2019-08-26 15:03:56',
                //     equipmentname: 'aaa',
                //     applyer: 'admin',
                //     worklinkman: '111',
                //     operatestatus: '暂存',
                //     billstatus: '编制'
                // }
            ],
            nameObj: {
                tfymediumsystem: {
                    obj: {
                        'EleChannel': '电力',
                        'WaterChannel': '水道',
                        'PowerChannel': '动力'
                    },
                    arr: [
                        {
                            id: 'EleChannel',
                            name: '电力'
                        },
                        {
                            id: 'WaterChannel',
                            name: '水道'
                        },
                        {
                            id: 'PowerChannel',
                            name: '动力'
                        }
                    ]
                },
                // operatestatus: {
                //     obj: {
                //         'save': '暂存'
                //     },
                //     arr: [
                //         {
                //             id: 'save',
                //             name: '暂存'
                //         }
                //     ]
                // },
                billstatus: {
                    obj: {
                        '': '全部',
                        'create': '编制',
                        'check': '待审批',
                        'checked': '结束'
                    },
                    arr: [
                        {
                            id: '',
                            name: '全部'
                        },
                        {
                            id: 'create',
                            name: '编制'
                        },
                        {
                            id: 'check',
                            name: '待审批'
                        },
                        {
                            id: 'checked',
                            name: '结束'
                        }
                    ]
                }
            },
            loading: false,
            tableLoading: false,
            dialog: {
                editorBox: {
                    show: false,
                    type: '',
                    form: {
                        data: {
                            tfymediumsystem: '',
                            billsno: '',
                            creattime: '',
                            applyer: '',
                            equipmentname: '',
                            chargeman: '',
                            stoptime: '',
                            restarttime: '',
                            worklinkman: '',
                            examinestarttime: '',
                            examineendtime: '',
                            reasoncontent: '',
                            opinion: '',
                            note: '',
                            approver: '',
                            signtime: '',
                            billstatus: ''
                        },
                        rules: {
                            opinion: [
                                { required: true, message: '该项不能为空', trigger: 'change' }
                            ],
                            note: [],
                            approver: [
                                { required: true, message: '该项不能为空', trigger: 'change' }
                            ],
                            signtime: [
                                { required: true, message: '该项不能为空', trigger: 'change' }
                            ]
                        }
                    },
                    files: [
                        // {
                        //     name: '测试',
                        //     url: '',
                        //     file: null,
                        //     operation: '' // add or del
                        // }
                    ]
                }
            }
        };
    },
    created () {
        this.activeMenu = window.localStorage.getItem('activeMenu');
    },
    mounted () {
        let that = this;
        window.PEDataObj = {
            // 将数据绑定到window上，供main页面使用
            vm: that,
            // tableArr：用于导出成Excel的表格的信息
            tableArr: [
                {
                    name: '',
                    id: 'singleTable'
                }
            ]
        };
        that.$nextTick(() => {
            // 立即获取的height有一定偏差，通过setTimeout延迟来解决
            setTimeout(() => {
                that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
            }, 1);
        });
        that.store.dispatch('getUserInfo').then((res) => {
            that.userInfo.data = res.data;
        });
        that.getTableData();
    },
    methods: {
        //  计算树区域高度
        getRoleHeight (dom) {
            return window.innerHeight - dom.offsetTop;
        },
        // 获取表格中的数据
        getTableData (pageNum) {
            let that = this,
                params = {
                    creattime: that.filterForm.data.creattime[0],
                    creattimee: that.filterForm.data.creattime[1],
                    applyer: that.filterForm.data.applyer,
                    signtime: that.filterForm.data.signtime[0],
                    signtimee: that.filterForm.data.signtime[1],
                    worklinkman: that.filterForm.data.worklinkman,
                    stoptime: that.filterForm.data.stoptime[0],
                    stoptimee: that.filterForm.data.stoptime[1],
                    equipmentname: that.filterForm.data.equipmentname,
                    restarttime: that.filterForm.data.restarttime[0],
                    restarttimee: that.filterForm.data.restarttime[1],
                    reasoncontent: that.filterForm.data.reasoncontent,
                    billstatus: that.filterForm.data.billstatus
                    // operatestatus: that.filterForm.data.operatestatus
                };
            that.pageNum = pageNum || that.pageNum;
            that.tableLoading = true;
            let url = 'pass/ems/v1/tcm035s/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
            that.axios.get(url, {
                params: params
            })
                .then(function (res) {
                    if (res.code === '0') {
                        let arr = [];
                        for (let item of res.data.list) {
                            arr.push({
                                billsno: item.billsno,
                                tfymediumsystem: item.tfymediumsystem,
                                creattime: item.creattime,
                                applyer: item.applyer,
                                equipmentname: item.equipmentname,
                                chargeman: item.chargeman,
                                stoptime: item.stoptime,
                                restarttime: item.restarttime,
                                worklinkman: item.worklinkman,
                                examinestarttime: item.examinestarttime,
                                examineendtime: item.examineendtime,
                                reasoncontent: item.reasoncontent,
                                opinion: item.opinion,
                                note: item.note,
                                approver: item.approver,
                                signtime: item.signtime,
                                // operatestatus: item.operatestatus,
                                billstatus: item.billstatus,
                                filename: item.filename
                            })
                        }
                        that.tableData = arr;
                        that.total = res.data.total;
                    } else {
                        that.$message.error(res.message);
                    }
                    that.tableLoading = false;
                }).catch(function () {
                    that.tableLoading = false;
                });
        },
        // 改变表格显示条数
        tableSizeChange (val) {
            let that = this;
            that.pageSize = val;
            that.getTableData(1);
        },
        // 重置搜索
        tableDataCancel () {
            let that = this;
            for (let key in that.filterForm.data) {
                if (that.filterForm.data[key] instanceof Array) {
                    that.filterForm.data[key] = [];
                } else {
                    that.filterForm.data[key] = '';
                }
            }
            that.filterForm.data.billstatus = 'check';
            that.getTableData(1);
        },
        but_edit (row) {
            let that = this;
            that.dialog.editorBox.files = [];
            for (let key in that.dialog.editorBox.form.data) {
                if (typeof row[key] !== 'undefined') {
                    that.dialog.editorBox.form.data[key] = row[key];
                } else {
                    console.log(key);
                }
            }
            if (row.filename) {
                let fn = (row.filename + '').trim().split(';')
                if (fn && fn.length > 0) {
                    let billsno = row.billsno;
                    for (let i = 0; i < fn.length; i++) {
                        if (fn[i]) {
                            let fname = {name: fn[i], url: '/zhongsteel.pass.web/pass/ems/static/' + billsno + '/' + fn[i], file: null, operation: ''};
                            that.dialog.editorBox.files.push(fname);
                        }
                    }
                }
            }
            console.log('that.dialog.editorBox.form.data.approver', that.dialog.editorBox.form.data.approver)
            console.log('that.userInfo.data.userName', that.userInfo.data)
            console.log('that.userInfo.data.userName', that.userInfo.data.userName)
            console.log('signtime', that.dialog.editorBox.form.data.signtime)
            that.dialog.editorBox.form.data.approver = that.dialog.editorBox.form.data.approver ? that.dialog.editorBox.form.data.approver : that.userInfo.data.userName;
            that.dialog.editorBox.form.data.signtime = that.dialog.editorBox.form.data.signtime ? that.dialog.editorBox.form.data.signtime : formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss');
            that.dialog.editorBox.type = 'edit';
            that.dialog.editorBox.show = true;
        },
        submitBut () {
            let that = this;
            that.$confirm('是否提交?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                that.dataSave('submit');
            }).catch(() => {
            });
        },
        dataSave (billstatus) {
            let that = this;
            let SubmitData = {
                billsno: that.dialog.editorBox.form.data.billsno,
                tfymediumsystem: that.dialog.editorBox.form.data.tfymediumsystem,
                creattime: that.dialog.editorBox.form.data.creattime,
                applyer: that.dialog.editorBox.form.data.applyer,
                equipmentname: that.dialog.editorBox.form.data.equipmentname,
                chargeman: that.dialog.editorBox.form.data.chargeman,
                stoptime: that.dialog.editorBox.form.data.stoptime,
                restarttime: that.dialog.editorBox.form.data.restarttime,
                worklinkman: that.dialog.editorBox.form.data.worklinkman,
                examinestarttime: that.dialog.editorBox.form.data.examinestarttime,
                examineendtime: that.dialog.editorBox.form.data.examineendtime,
                reasoncontent: that.dialog.editorBox.form.data.reasoncontent,
                opinion: that.dialog.editorBox.form.data.opinion,
                note: that.dialog.editorBox.form.data.note,
                approver: that.dialog.editorBox.form.data.approver,
                signtime: that.dialog.editorBox.form.data.signtime,
                billstatus: that.dialog.editorBox.form.data.billstatus
            };
            // structurediagram: that.dialog.editorBox.files 上传文件
            let message = '保存成功';
            that.$refs['dialog_form'].validate((valid) => {
                if (valid) {
                    that.loading = true;
                    let url = 'pass/ems/v1/tcm035s/';
                    if (billstatus === 'submit') {
                        url = 'pass/ems/v1/tcm035s/submit/';
                        message = '提交成功';
                    }
                    that.axios.put(url, SubmitData, {headers: {'Content-Type': 'multipart/form-data'}})
                        .then(function (res) {
                            if (res.code === '0') {
                                that.$message({
                                    message: message,
                                    type: 'success'
                                });
                                that.getTableData();
                                that.dialog.editorBox.show = false;
                            } else {
                                that.$message.error(res.message);
                            }
                            that.loading = false;
                        }).catch(function () {
                            that.loading = false;
                        });
                }
            });
        }
    }
}
</script>

<style lang="less">
.SSDApproval {
    min-width: 700px;
    height: 100%;
    .box {
        height: 100%;
        padding: 15px 15px 0 15px;
        .box-top {
            .el-form-item {
                margin-bottom: 7px;
            }
            .box-top-gjl {
                overflow: hidden;
                padding: 7px 0;
                border-top: 1px solid #ccc;
            }
        }
    }
    .nr-textarea {
        .el-textarea__inner {
            min-height: 130px !important;
        }
    }
    .fileUploadBox {
        height: 130px;
        min-height: 130px !important;
        margin-bottom: 18px;
    }
}
</style>
