<script>
import {queryQuoteDetailBomTree} from "@/api/quote/quoteDetailBomTree";
import {
  queryQuoteDetailRouting,
  queryQuoteDetailRoutingAlternative, changeQuoteDetailRoutingChange,
  queryQuoteDetailRoutingVersion
} from "@/api/quote/quoteDetailRouting";
import {updateQuoteDetailRouting} from "../../../../../api/quote/quoteDetailRouting";

export default {
  name: "quoteDetailRouting",
  props:{
    quoteDetail:{
      type:Object,
      required:true
    },
  },
  model:{
    prop: "quoteDetail",
    event: "update"
  },
  data(){
    return{
      isAllRouting:false,
      dataList:[],
      queryLoading:false,
      treeData:[],
      columns: [
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5OperationNo',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'operationNo',
          headerAlign: "center",
          align: "center",
          columnLabel: '工序号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 60,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5OperationName',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'operationName',
          headerAlign: "center",
          align: "left",
          columnLabel: '工序名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5PartNo',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'partNo',
          headerAlign: "center",
          align: "left",
          columnLabel: '物料编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5PartDesc',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'partDesc',
          headerAlign: "center",
          align: "left",
          columnLabel: '物料名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 200,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5Version',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'routingRevision',
          headerAlign: "center",
          align: "center",
          columnLabel: '版本',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 80,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5AlternativeNo',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'alternativeNo',
          headerAlign: "center",
          align: "left",
          columnLabel: '替代编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5WorkCenterNo',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'workCenterNo',
          headerAlign: "center",
          align: "left",
          columnLabel: '加工中心编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5WorkCenterDesc',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'workCenterDesc',
          headerAlign: "center",
          align: "left",
          columnLabel: '加工中心名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 200,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5MachSetupTime',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'machSetupTime',
          headerAlign: "center",
          align: "right",
          columnLabel: '机器调机时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5SetupCrewSize',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'setupCrewSize',
          headerAlign: "center",
          align: "right",
          columnLabel: '调机过程人数',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5SetupLaborClassNo',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'setupLaborClassNo',
          headerAlign: "center",
          align: "left",
          columnLabel: '调机时人员等级',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 140,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5MachRunFactor',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'machRunFactor',
          headerAlign: "center",
          align: "right",
          columnLabel: '机器单位产出',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5CrewSize',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'crewSize',
          headerAlign: "center",
          align: "right",
          columnLabel: '生产过程人数',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5LaborClassNo',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'laborClassNo',
          headerAlign: "center",
          align: "left",
          columnLabel: '人员等级',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5LaborSetupTime',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'laborSetupTime',
          headerAlign: "center",
          align: "right",
          columnLabel: '人工调机时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5LaborRunFactor',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'laborRunFactor',
          headerAlign: "center",
          align: "right",
          columnLabel: '人工单位产出',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5RunTimeDesc',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'runTimeDesc',
          headerAlign: "center",
          align: "center",
          columnLabel: '产出单位',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5EfficiencyFactor',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'efficiencyFactor',
          headerAlign: "center",
          align: "right",
          columnLabel: '效率%',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5ShrinkageFactor',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'shrinkageFactor',
          headerAlign: "center",
          align: "right",
          columnLabel: '损耗率%',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5LaborClassCost',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'laborClassCost',
          headerAlign: "center",
          align: "right",
          columnLabel: '单位人工成本-生产',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5SetupLaborClassCost',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'setupLaborClassCost',
          headerAlign: "center",
          align: "right",
          columnLabel: '单位人工成本-调机',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5WorkCenterCost',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'workCenterCost',
          headerAlign: "center",
          align: "right",
          columnLabel: '单位机器成本',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5TotalMachCost',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'totalMachCost',
          headerAlign: "center",
          align: "right",
          columnLabel: '机器成本',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 140,
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5TotalLaborCost',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'totalLaborCost',
          headerAlign: "center",
          align: "right",
          columnLabel: '人工成本',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 140,
        },{
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table5TotalCost',
          tableId: "5011Table5",
          tableName: "报价工艺信息",
          columnProp: 'totalCost',
          headerAlign: "center",
          align: "right",
          columnLabel: '成本小计',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: 'right',
          columnWidth: 120,
        },
      ],
      props:{
        children: 'list',
        label: (data,node)=>{
          return `${data.partNo}-${data.engChgLevel}-${data.alternativeNo}-${data.bomType}`;
        },
      },
      queryTreeLoading:false,
      versionVisible:false,
      versionList:[],
      alternativeList:[],
      routing:{

      },

      quoteDetailRouting:{

      },
      quoteDetailRoutingVisible:false,

      rules:{
        workCenterCost:[
          { required: true, message: '请输入加工中心成本', trigger: ['blur','change'] },
        ],
        setupLaborClassCost:[
          { required: true, message: '请输入人工成本-调机', trigger: ['blur','change'] },
        ],
        laborClassCost:[
          { required: true, message: '请输入人工成本-生产', trigger: ['blur','change'] },
        ],
        shrinkageFactor:[
          { required: true, message: '请输入损耗率', trigger: ['blur','change'] },
        ],
      },
      changeLoading:false,
      // 导出相关
      exportName: '报价工艺信息' + this.dayjs().format('YYYYMMDDHHmmss'),
    }
  },
  methods:{
    handleQueryQuoteDetailBomTree(){
      let params = {
        id: this.quoteDetail.id,
      }
      this.queryTreeLoading = true;
      queryQuoteDetailBomTree(params).then(({data})=>{
        if (data && data.code === 0){
          this.treeData = data.rows;
          if (this.treeData.length > 0){
            this.$nextTick(()=>{
              this.$refs.tree.setCurrentKey(this.treeData[0].id);
              this.handleQueryDetailRouting();
            })
          }
          this.queryTreeLoading = false;
        }else {
          this.$message.warning(data.msg);
          this.queryTreeLoading = false;
        }
      }).catch((error)=>{
        this.$message.error(error);
      })
    },
    nodeClick(data){
      this.handleQueryDetailRouting();
    },
    handleQueryDetailRouting(){
      let node = this.$refs.tree.getCurrentNode();
      let params = {
        treeId:node.id,
        quoteDetailId: this.quoteDetail.id,
        isAllRouting: this.isAllRouting,
      }
      this.queryLoading = true;
      queryQuoteDetailRouting(params).then(({data})=>{
        if (data && data.code === 0){
          this.dataList = data.rows;
        }else {
          this.$message.warning(data.msg);
        }
        this.queryLoading = false;
      }).catch((error)=>{
        this.$message.error(error);
        this.queryLoading = false;
      })
    },
    handleChangeVersion(){
      let node = this.$refs.tree.getCurrentNode();
      if (this.treeData.length === 0){
        this.$message.warning("未维护BOM结构")
        return;
      }
      if (node){
        this.routing = {
          partNo: node.partNo,
          buNo: node.buNo,
          site: node.site,
          routingType: node.bomType,
          routingRevision: node.engChgLevel,
          alternativeNo: node.alternativeNo,
        }
      }
      this.handleQueryVersionList();
      this.versionVisible = true;
    },
    versionRowStyle({row}){
      if (row.routingRevision === this.routing.routingRevision && row.routingType === this.routing.routingType){
        return { 'background-color': '#E8F7F6' };
      }
    },
    handleQueryVersionList(){
      let node = this.$refs.tree.getCurrentNode();
      let params = {
        treeId: node.id,
      }
      queryQuoteDetailRoutingVersion(params).then(({data})=>{
        if (data && data.code === 0){
          this.versionList = data.rows;
          this.handleQueryAlternativeList();
        }else {
          this.$message.warning(data.msg);
        }
      }).catch((error)=>{
        this.$message.error(error);
      })
    },
    handleQueryAlternativeList(){
      let params = {
        ...this.routing,
      }
      queryQuoteDetailRoutingAlternative(params).then(({data})=>{
        if (data && data.code === 0){
          this.alternativeList = data.rows;
        }else {
          this.$message.warning(data.msg);
        }
      }).catch((error)=>{
        this.$message.error(error);
      })
    },
    versionRowClick(row){
      this.routing.routingType = row.routingType;
      this.routing.routingRevision = row.routingRevision;
      this.handleQueryAlternativeList();
    },
    alternativeRowStyle({row}){
      if (this.dataList.length > 0){
        if (this.routing.alternativeNo === row.alternativeNo && this.routing.routingRevision === row.routingRevision && this.routing.routingType === row.routingType){
          return { 'background-color': '#E8F7F6' };
        }
      }
    },
    changeRouting(row){
      if (this.$refs.tree.getCurrentNode().parentId === 0 || this.$refs.tree.getCurrentNode().parentId === null || this.$refs.tree.getCurrentNode().parentId === undefined){
        this.$confirm('确认切换Routing版本吗,切换后将重新覆盖工具信息,请确认!','提示',{
          type: 'warning',
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(()=>{
          this.handleChangeRouting(row);
        })
      }else {
        this.handleChangeRouting(row);
      }
    },
    handleChangeRouting(row){
      let params = {
        quoteId: this.quoteDetail.quoteId,
        quoteDetailId: this.quoteDetail.id,
        quoteDetailItemNo:this.quoteDetail.itemNo,
        versionNo: this.quoteDetail.versionNo,
        site: row.site,
        partNo: row.partNo,
        buNo: "*",
        quoteNo: this.quoteDetail.quoteNo,
        routingType: row.routingType,
        routingRevision: row.routingRevision,
        alternativeNo: row.alternativeNo,
        treeId: this.$refs.tree.getCurrentNode().id,
        createBy: this.$store.state.user.name,
      }
      this.changeLoading = true;
      changeQuoteDetailRoutingChange(params).then(({data})=>{
        this.changeLoading = false;
        if (data && data.code === 0){
          this.$message.success(data.msg);
          this.versionVisible = false;
          this.handleQueryDetailRouting();
        }else {
          this.$message.warning(data.msg);
        }
      }).catch((error)=>{
        this.changeLoading = false;
        this.$message.error(error)
      })
    },
    handleJumpToRouting(row){
      if (this.$router.resolve('part-routingManagement').resolved.name === '404') {
        this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',});
      } else {
        this.$emit('close')
        let params = {
          name: "part-routingManagement",
          params: {
            type:'quote',
            partNo:row.partNo,
            routingType:row.routingType,
            routingRevision:row.routingRevision,
            alternativeNo:row.alternativeNo,
          }
        }
        this.$router.push(params)
      }
    },
    handleUpdateQuoteDetailRouting(row){
      this.quoteDetailRouting = {...row}
      this.quoteDetailRoutingVisible = true;
    },
    saveQuoteDetailRouting(){
      this.$refs.quoteDetailRoutingForm.validate((valid,obj) => {
        if (valid){
          let params = {
            ...this.quoteDetailRouting,
          }
          updateQuoteDetailRouting(params).then(({data})=>{
            if (data && data.code === 0){
              this.$message.success(data.msg);
              this.handleQueryDetailRouting();
              this.quoteDetailRoutingVisible = false;
            }else {
              this.$message.warning(data.msg);
            }
          }).catch((error)=>{
            this.$message.error(error);
          })
        }else {
          let i = 1;
          for (let item in obj){
            this.$message.error(obj[item][0].message);
            if (i === 1){
              return
            }
            i++;
          }
        }
      })
    },
    // 导出相关方法
    exportFields() {
      let json = "{"
      this.columns.forEach((item, index) => {
        if (index === this.columns.length - 1) {
          json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
        } else {
          json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
        }
      })
      json += "}"
      return eval("(" + json + ")")
    },
    createExportData() {
      return this.dataList;
    }
  },
  created() {
    if (this.quoteDetail && this.quoteDetail.id){
      this.handleQueryQuoteDetailBomTree();
    }
  },
  watch:{
    'quoteDetail.id'(newVal,oldVal){
      this.handleQueryQuoteDetailBomTree();
    },
    isAllRouting(newVal,oldVal){
      this.handleQueryDetailRouting();
    },
  }
}
</script>

<template>
  <div>
    <div style="margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center;">
      <div>
        <template v-if="isAuth('5011:detail:tab2:check')">
          <el-link style="margin-right: 20px;cursor:pointer;" @click="handleChangeVersion" v-if="quoteDetail.status === '草稿'">切换版本</el-link>
        </template>
<!--      <el-checkbox v-model="isAllRouting">全级Routing结构</el-checkbox>-->
      </div>
      <download-excel
        :fields="exportFields()"
        :data="dataList"
        type="xls"
        :name="exportName"
        :fetch="createExportData"
        worksheet="工艺信息"
        class="el-button el-button--primary el-button--mini">
        导出
      </download-excel>
    </div>
    <el-container>
      <el-aside width="300px" style="max-height:420px" v-loading="queryTreeLoading">
        <el-tree
          :data="treeData"
          :props="props"
          :default-expand-all="true"
          :expand-on-click-node="false"
          node-key="id"
          highlight-current
          @node-click="nodeClick" ref="tree">

        </el-tree>
      </el-aside>
      <el-main style="padding: 0">
        <el-table :data="dataList" v-loading="queryLoading" border style="width: 100%" :height="420">
          <el-table-column label="操作" fixed="left" align="center" width="80px" v-if="quoteDetail.status === '草稿'">
            <template slot-scope="scope">
              <template v-if="isAuth('5011:detail:tab2:update')">
                <a @click="handleUpdateQuoteDetailRouting(scope.row)">编辑</a>
              </template>
            </template>
          </el-table-column>
          <el-table-column
            v-for="(item,index) in columns" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed===''?false:item.fixed"
            :min-width="item.columnWidth"
            :label="item.columnLabel">
            <template slot-scope="scope">
              <template v-if="item.columnProp === 'partNo'">
                <el-link @click="handleJumpToRouting(scope.row)">{{ scope.row[item.columnProp] }}</el-link>
              </template>
              <template v-else>
                <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
                <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
              </template>
            </template>
          </el-table-column>
        </el-table>
      </el-main>
    </el-container>

    <el-dialog title="切换版本" :visible.sync="versionVisible" width="1000px" v-drag :close-on-click-modal="false" append-to-body>
      <el-table v-loading="changeLoading" :data="versionList" :row-style="versionRowStyle" ref="routingVersionTable" style="margin-top: 8px" border :height="240" @row-click="versionRowClick">
        <el-table-column label="物料编码" prop="partNo" header-align="center" align="center" show-overflow-tooltip min-width="140"/>
        <el-table-column label="物料名称" prop="partDesc" header-align="center" align="left" show-overflow-tooltip min-width="200"/>
        <el-table-column label="版本" prop="routingRevision" header-align="center" align="center" show-overflow-tooltip min-width="60"/>
        <el-table-column label="类型" prop="routingType" header-align="center" align="center" show-overflow-tooltip min-width="100"/>
      </el-table>

      <el-table v-loading="changeLoading" :data="alternativeList" :row-style="alternativeRowStyle" ref="routingAlternativeTable" border :height="240" style="margin-top: 8px">
        <el-table-column label="物料编码" prop="partNo" header-align="center" align="center" show-overflow-tooltip min-width="140"/>
        <el-table-column label="物料名称" prop="partDesc" header-align="center" align="left" show-overflow-tooltip min-width="200"/>
        <el-table-column label="版本" prop="routingRevision" header-align="center" align="center" show-overflow-tooltip min-width="60"/>
        <el-table-column label="替代编码" prop="alternativeNo" header-align="center" align="left" show-overflow-tooltip min-width="60"/>
        <el-table-column label="类型" prop="routingType" header-align="center" align="center" show-overflow-tooltip min-width="100"/>
        <el-table-column label="操作" min-width="80" header-align="center" align="center">
          <template slot-scope="{row,$index}">
            <a @click="changeRouting(row)">选择</a>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>


    <el-dialog title="工序信息" top="23vh" v-drag :visible.sync="quoteDetailRoutingVisible" width="500px" append-to-body :close-on-click-modal="false">
      <el-form label-position="top" ref="quoteDetailRoutingForm" :model="quoteDetailRouting" :rules="rules" label-width="100px">
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="物料编码">
              <el-input v-model="quoteDetailRouting.partNo" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="物料名称">
              <el-input v-model="quoteDetailRouting.partDesc" disabled></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="工序编码">
              <el-input v-model="quoteDetailRouting.operationNo" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-row :gutter="5">
              <el-col :span="19">
                <el-form-item label="工序名称">
                  <el-input v-model="quoteDetailRouting.operationName" disabled></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item label="损耗率%" prop="shrinkageFactor" :show-message="false">
                  <el-input-number :min="0" :controls="false" :step="0" v-model="quoteDetailRouting.shrinkageFactor"></el-input-number>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="单位机器成本" prop="workCenterCost" :show-message="false">
              <el-row :gutter="5">
                <el-col :span="14">
                  <el-input v-model="quoteDetailRouting.workCenterNo" disabled></el-input>
                </el-col>
                <el-col :span="10">
                  <el-input-number :min="0" :controls="false" :step="0" v-model="quoteDetailRouting.workCenterCost"></el-input-number>
                </el-col>
              </el-row>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="单位人工成本-调机" prop="setupLaborClassCost" :show-message="false">
              <el-row :gutter="5">
                <el-col :span="14">
                  <el-input v-model="quoteDetailRouting.setupLaborClassNo" disabled></el-input>
                </el-col>
                <el-col :span="10">
                  <el-input-number :min="0" :controls="false" :step="0" v-model="quoteDetailRouting.setupLaborClassCost"></el-input-number>
                </el-col>
              </el-row>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="单位人工成本-生产" prop="laborClassCost" :show-message="false">
              <el-row :gutter="5">
                <el-col :span="14">
                  <el-input v-model="quoteDetailRouting.laborClassNo" disabled></el-input>
                </el-col>
                <el-col :span="10">
                  <el-input-number :min="0" :controls="false" :step="0" v-model="quoteDetailRouting.laborClassCost"></el-input-number>
                </el-col>
              </el-row>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-footer style="text-align: center;line-height: 30px;height: 30px">
        <el-button type="primary" @click="saveQuoteDetailRouting">确 定</el-button>
        <el-button type="primary" @click="quoteDetailRoutingVisible = false">取 消</el-button>
      </el-footer>
    </el-dialog>
  </div>
</template>

<style scoped>

</style>
