<template>
    <div class="container">
        <fullscreen :fullscreen.sync="fullscreen" class="container-box">
            <div class="titbox">
                <h2>长流程工单查询</h2>
                <div>
                    <i class="el-icon-refresh" @click="iconCli(1)"></i>
                    <i class="el-icon-full-screen" @click="iconCli(2)"></i>
                    <!--                    <i class="el-icon-folder-opened"></i>-->
                    <!--                    <i class="el-icon-view"></i>-->
                    <!--                    <i class="el-icon-more"></i>-->
                </div>
            </div>
            <div class="search">
                <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
            </div>
            <div class="tabbox">
                <el-table height="calc(100% - 40px)" v-loading="loading" class="com-table" ref="multipleTable"
                    :data="tableData" tooltip-effect="dark" size="small" border style="width: 100%">
                    <el-table-column width="120" align="center" prop="srvNumber" show-overflow-tooltip label="客户号码">
                    </el-table-column>
                    <el-table-column width="140" align="center" prop="processWOID" label="工单流水号">
                    </el-table-column>
                    <el-table-column prop="crmProcessWOID" label="CRM工单号" show-overflow-tooltip width="120">
                    </el-table-column>
                    <el-table-column width="120" align="center" prop="acptTime" label="受理时间">
                    </el-table-column>
                    <el-table-column width="120" align="center" prop="customID" label="客户编号">
                    </el-table-column>
                    <el-table-column width="120" align="center" prop="customType" label="客户类型">
                    </el-table-column>
                    align="center"
                    <el-table-column width="120" align="center" prop="productID" label="关联产品">
                    </el-table-column>
                    <el-table-column width="120" align="center" prop="node" label="处理环节">
                    </el-table-column>
                    <el-table-column width="120" align="center" prop="status" label="工单状态">
                    </el-table-column>
                    <el-table-column prop="alarmStatus" align="center" label="工单预警状态" width="120" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column fixed="right" width="120" align="center" prop="rltSysNM" label="投诉处理工单列表">
                        <template slot-scope="scope">
                            <el-button size="mini" type="primary" plain @click="getDetailes(scope.row)">详情</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column width="400" fixed="right" label="操作" align="center">
                        <template slot-scope="scope">
                            <el-button size="mini" type="danger" plain @click="goAlarm(scope.row)">工单预警</el-button>
                            <el-button size="mini" type="success" plain @click="goLongTime(scope.row)">超时工单</el-button>
                            <el-button size="mini" type="primary" plain @click="goReturn(scope.row)">工单反馈</el-button>
                            <el-button size="mini" type="primary" plain @click="goLog(scope.row)">历史信息</el-button>
                            <el-button size="mini" type="primary" plain @click="goMoney(scope.row)">计费信息</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination class="pageBox" @current-change="currchange" layout="prev, pager, next" background
                    :total="total">
                </el-pagination>
            </div>
        </fullscreen>
        <el-dialog title="工单查询服务详情" :visible.sync="tableStatus" width="80%" :close-on-press-escape="false"
            :show-close="false" :destroy-on-close="true" :modal-append-to-body="false" :close-on-click-modal="false">
            <el-table v-loading="loading" class="com-table" ref="multipleTable" :data="tableList" tooltip-effect="dark"
                size="small" border style="width: 100%">
                <el-table-column show-overflow-tooltip align="center" prop="processWOID" label="工单编号">
                </el-table-column>
                <el-table-column align="center" prop="processWONode" label="工单处理环节">
                </el-table-column>
                <el-table-column align="center" prop="staffName" label="工单处理人">
                    <template slot-scope="scope">
                          <span>{{$desensitization(scope.row.staffName,1)}}</span>
                    </template>
                </el-table-column>
                <el-table-column show-overflow-tooltip align="center" prop="staffNO" label="工单处理工号">
                </el-table-column>
                <el-table-column align="center" prop="bizCode" label="返回码">
                </el-table-column>
                <el-table-column width="120" align="center" show-overflow-tooltip prop="bizDesc" label="返回信息描述">
                </el-table-column>
                <el-table-column width="150" align="center" prop="feedbackTime" label="处理时间">
                </el-table-column>
            </el-table>
            <div slot="footer" class="dialog-footer">
                <el-button @click="
            () => {
              tableStatus = false;
            }
          ">取 消</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
    import pForm from "../../../components/p-form";
    import mySearch from "../../../components/search";

    export default {
        components: {
            mySearch,
            pForm,
        },
        data() {
            return {
                propPageSize: 1,
                tableList: [],
                tableStatus: false,
                fullscreen: false,
                total: 0,
                pageSize: 1,
                tableData: [],
                dialogStatus: false,
                searchList: [{
                        type: "input",
                        tit: "客户号码",
                        value: "",
                        width: "50%",
                        options: [],
                    },
                    {
                        type: "sel",
                        tit: "工单状态",
                        value: "",
                        width: "50%",
                        options: [{
                                dataName: "待处理",
                                dataCode: "1"
                            },
                            {
                                dataName: "关闭",
                                dataCode: "2"
                            },
                        ],
                    },
                ],
                params: {
                    srvNumber: "1",
                    status: "1",
                },
                loading: false,
            };
        },
        methods: {
            defaultMenu(path, name) {
                let defaults = this.$store.state.tabList.filter((item) => {
                    if (item.rountPath == path) {
                        return item;
                    }
                });
                if (defaults.length == 1) {
                    return;
                }
                let params = {
                    children: "",
                    name: name,
                    rountPath: path,
                    target: "_self",
                };
                let set = new Set([...this.$store.state.tabList, params]);
                this.$store.commit("setDefaultActive", path);
                this.$store.commit("setTabList", Array.from(set));
            },
            // 工单告警
            goAlarm(val) {
                this.$router.push({
                    name: "orderOverTimeService",
                    params: {
                        complaintWOID: val.crmProcessWOID,
                    },
                });
                this.defaultMenu("/orderOverTimeService", "工单超时预警服务查询");
            },
            // 超时工单
            goLongTime(val) {
                this.$router.push({
                    name: "processWoAlarmInfoQuery",
                    params: {
                        crmProcessWOID: val.crmProcessWOID,
                    },
                });
                this.defaultMenu("/processWoAlarmInfoQuery", "超时工单预警查询");
            },
            // 计费
            goMoney(val) {
                this.$router.push({
                    name: "accountInformationQuery",
                    params: {
                        srvNumber: val.srvNumber,
                    },
                });
                this.defaultMenu("/accountInformationQuery", "计费信息服务查询");
            },
            // 详情列表
            getDetailes(val) {
                this.tableStatus = true;
                this.loading = true;
                this.$http({
                    url: "/compvis/ipv/processWoQueryDetails",
                    method: "post",
                    headers: {
                        "Content-Type": "application/json",
                        page: '{"pageNo":"' + this.propPageSize + '","pageSize":"10"}',
                    },
                    data: {
                        processWOID: val.processWOID
                    },
                }).then((res) => {
                    this.loading = false;
                    this.tableList = res.data.data;
                });
            },
            // 反馈
            goReturn(val) {
                this.$router.push({
                    name: "relatedOrderFeedback",
                    params: {
                        processWOID: val.processWOID,
                    },
                });
                this.defaultMenu("/relatedOrderFeedback", "关联工单反馈");
            },
            goLog(val) {
                this.$router.push({
                    name: "processWoQueryHis",
                    params: {
                        processWOID: val.processWOID,
                    },
                });
                this.defaultMenu("/processWoQueryHis", "工单处理历史信息查询");
            },
            // 取消提交
            resetUser() {
                this.$refs.pForm.resetForm(this.form.formName);
            },
            closeDialog() {
                this.dialogStatus = false;
                this.getList(this.params, this.pageSize);
            },
            //搜索数据
            searchInfo(v) {
                this.params = {};
                v[0] ? (this.params.srvNumber = v[0]) : "";
                v[1] ? (this.params.status = v[1]) : "";
                this.getList(this.params, this.pageSize);
            },
            //获取列表
            getList(v, n) {
                this.loading = true;
                this.pageSize = n;
                this.$http({
                    url: "/compvis/ipv/processWoQuery",
                    method: "post",
                    headers: {
                        "Content-Type": "application/json",
                        page: '{"pageNo":"' + n + '","pageSize":"10"}',
                    },
                    data: v,
                }).then((res) => {
                    this.loading = false;
                    this.tableData = res.data.data;
                    this.total = res.data.totalRecord;
                });
            },
            //功能栏
            iconCli(v) {
                if (v === 1) {
                    this.getList(this.params, this.pageSize);
                }
                if (v === 2) {
                    this.fullscreen = !this.fullscreen;
                }
            },
            // 分页
            currchange(v) {
                this.pageSize = v;
                this.getList(this.params, this.pageSize);
            },
        },
        mounted() {
            this.getList(this.params, this.pageSize);
        },
        created() {},
    };
</script>
<style>
    .el-input__suffix {
        cursor: pointer;
    }
</style>
<style scoped lang="scss">
    .titbox {
        div {
            float: right;

            i {
                font-size: 22px;
                margin-left: 20px;
                cursor: pointer;
            }
        }
    }

    .tabbox {
        margin-top: 15px;
    }

    .pageBox {
        text-align: right;
        margin-top: 10px;
    }
</style>
