<template>
  <div style="margin: 0 auto">
    <el-container>
      <el-aside width="200px">
        <div class="JKWTree-tree" style="height: 746px;">
<!--          排产进程及参数设置-->
          <el-tree :data="sctreeData" :props="defaultProps" @node-click="schandleNodeClick"></el-tree>
<!--          车间-->
          <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
        </div>
      </el-aside>
      <el-container>
        <el-main>

          <!-- 搜索框 -->
          <div class="gva-search-box">
            <!--            状态设置-->
            <el-dialog v-model="onstatuslist" title="工单状态设置" width="30%" style="top: 15%">
              <div style="width: 100%;height: 100%;">
                <div style="width: 100%; display: flex; align-items: center;">
                  <el-form-item label="工单编号 :" prop="currentProcess">
                    <el-input v-model="statusformData['gdbh']" placeholder="" />
                  </el-form-item>
                </div>
                <div style="width: 100%; display: flex; align-items: center; margin-top: 30px;">
                  <span>状态设置：</span>
                  <el-radio-group v-model="status" style="margin-left: 10px;">
                    <el-radio label="计划中">计划中</el-radio>
                    <el-radio label="生产中">生产中</el-radio>
                    <el-radio label="已完工">已完工</el-radio>
                  </el-radio-group>
                </div>
                <div class="dialog-footer" style="text-align: right; margin-top: 40px;">
                  <el-button @click="handleCancel">取消</el-button>
                  <el-button type="primary"  @click="handleConfirm">确认</el-button>
                </div>
              </div>
            </el-dialog>
            <!--            工序状态更正-->
            <el-dialog v-model="gxztgzzlist" title="工序状态更正" style="width: 100%;height: 100%;margin: 0px;padding: 0px">

              <el-button type="primary" @click="gxztgzzCancel">退出</el-button>

              <div style="width: 100%; height: 60px; padding: 0px; margin: 10px 0px 0px 0px; display: flex; align-items: center;">
                <el-form-item label="关键字 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
                  <el-input v-model="gxztgzzformData['gdbh']"
                            @keyup.enter="gxztgzzgetProductValue" placeholder="" style="width: 500px;"/>
                </el-form-item>
              </div>
              <el-table ref="multipleTable"
                        :show-overflow-tooltip="true"
                        :row-style="{ height: '0px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '0px' }"
                        :header-cell-style="{ padding: '0px' }"
                        style="width: 100%;height: 710px" border tooltip-effect="dark"
                        :data="gxztgzztableData" row-key="ID" @selection-change="handleSelectionChange">
                <el-table-column v-slot="scope" align="left" label=印件及工序 width="600" >
                  <el-input disabled  v-model="scope.row.印件及工序" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label=计划产量/已完成 width="590" >
                  <el-input disabled  v-model="scope.row['计划产量/已完成']" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label=完成率 width="240" >
                  <el-input disabled  v-model="scope.row.完成率" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label=完工时间 width="210" >
                  <el-input disabled  v-model="scope.row.完工时间" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label=设备代号 width="240" >
                  <el-input disabled  v-model="scope.row.设备代号" :clearable="false"/>
                </el-table-column>
              </el-table>
            </el-dialog>


            <el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
              <el-form-item>
                <el-input v-model="searchInfo" placeholder="搜索" clearable style="width: 200px;"></el-input>
                <el-button type="primary" icon="search" @click="onSubmit" style="margin: 5px">查询</el-button>
                <el-button type="primary" icon="edit" @click="onStatusClick" style="margin: 5px">状态设置</el-button>
                <el-button type="primary" icon="edit" @click="onStatusgzClick" style="margin: 5px">工序状态更正</el-button>
              </el-form-item>
            </el-form>
          </div>

          <div class="gva-table-box">
            <el-table ref="multipleTable"
                      style="width: 100%;height: 40vh"
                      :row-style="{ height: '20px' }"
                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      border
                      tooltip-effect="dark"
                      :data="tableData"
                      row-key="ID"
                      :highlight-current-row="true"
                      size="small"
                      @row-click="gdtableRowClick"
                      @selection-change="handleSelectionChange"
                      :show-overflow-tooltip="true">
              <template v-for="item in tableFields[currentNode]">
                  <el-table-column :align="item.align" :label="item.title" :prop="item.prop" :width="item.width" />
              </template>
            </el-table>
          </div>

            <el-tabs v-model="activeName" type="card" @tab-click="handleClick" v-if="currentNode == 1 || currentNode == 4">
              <el-tab-pane label="工艺资料"  @click="showTable('工艺资料')"  name="first">
                <el-table ref="multipleTable"
                          :show-overflow-tooltip="true"
                          :row-style="{ height: '20px' }"
                          :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                          :header-cell-style="{ padding: '0px' }"
                          highlight-current-row="true"
                          style="width: 100%;height: 400px" border tooltip-effect="dark" :data="gytableData" row-key="ID" @selection-change="handleSelectionChange">
                  <el-table-column align="left" label="工单编号" prop="工单编号"  width="100"/>
                  <el-table-column align="left" label="重点工序" prop="重点工序"  width="100"/>
                  <el-table-column align="left" label="工序备注" prop="工序备注"  width="240"/>
                  <el-table-column align="left" label="机组" prop="机组"  width="100"/>
                  <el-table-column align="left" label="小时产能" prop="小时产能"  width="100"/>
                  <el-table-column align="left" label="生产工时" prop="生产工时"  width="100"/>
                  <el-table-column align="left" label="辅助工时" prop="辅助工时"  width="100"/>
                  <el-table-column align="left" label="印刷方式" prop="印刷方式"  width="100"/>
                  <el-table-column align="left" label="版距" prop="版距"  width="100"/>
                  <el-table-column align="left" label="创建用户" prop="创建用户"  width="120"/>
                  <el-table-column align="left" label="创建时间" prop="创建时间"  width="160"/>
                  <el-table-column align="left" label="修改时间" prop="修改时间"  width="160"/>
                  <el-table-column align="left" label="UNIQID" prop="UNIQID"  width="100"/>
                  <el-table-column align="left" label="印件工序及名称" prop="印件工序及名称"  width="340"/>
                </el-table>
              </el-tab-pane>

              <el-tab-pane label="印件资料"  @click="showTable('印件资料')"  name="second">
                <el-table ref="multipleTable"
                          :row-style="{ height: '20px' }"
                          :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                          :header-cell-style="{ padding: '0px' }"
                          :show-overflow-tooltip="true"
                          :highlight-current-row="true"
                          style="width: 100%;height: 400px" border tooltip-effect="dark" :data="yjtableData" row-key="ID" @selection-change="handleSelectionChange">
                  <el-table-column align="left" label="工单编号" prop="工单编号"  width="100"/>
                  <el-table-column align="left" label="印件号" prop="印件号"  width="100"/>
                  <el-table-column align="left" label="印件代号" prop="印件代号"  width="100"/>
                  <el-table-column align="left" label="印件名称" prop="印件名称"  width="100"/>
                  <el-table-column align="left" label="纸张名称" prop="纸张名称"  width="100"/>
                  <el-table-column align="left" label="投料规格" prop="投料规格"  width="100"/>
                  <el-table-column align="left" label="成品数量" prop="成品数量"  width="100"/>
                  <el-table-column align="left" label="实际投料" prop="实际投料"  width="100"/>
                  <el-table-column align="left" label="投料单位" prop="投料单位"  width="100"/>
                  <el-table-column align="left" label="平张投料" prop="平张投料"  width="100"/>
                  <el-table-column align="left" label="联数" prop="联数"  width="100"/>
                  <el-table-column align="left" label="开数" prop="开数"  width="100"/>
                  <el-table-column align="left" label="创建用户" prop="创建用户"  width="120"/>
                  <el-table-column align="left" label="创建时间" prop="创建时间"  width="160"/>
                  <el-table-column align="left" label="修改时间" prop="修改时间"  width="160"/>
                  <el-table-column align="left" label="UNIQID" prop="UNIQID"  width="100"/>
                </el-table>
              </el-tab-pane>
            </el-tabs>

            <el-table ref="multipleTable2"
                      v-if="[2, 3].includes(currentNode)"
                      :show-overflow-tooltip="true"
                      :row-style="{ height: '20px' }"
                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      :highlight-current-row="true"
                      style="width: 100%;height: 400px" border tooltip-effect="dark" :data="bottomData" row-key="ID" @selection-change="handleSelectionChange">
              <template v-for="item in bottomTableF[currentNode]">
                <el-table-column :align="item.align" :label="item.title" :prop="item.prop" :width="item.width" />
              </template>
            </el-table>


        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>
//点击按钮显示下方表格
export default {
  data() {
    return {
      currentTable: '',
      activeName: 'first',
      // 其他表格数据...
    };
  },
  methods: {
    showTable(tableName) {
      console.log("点击了".tableName)
      // 根据点击的按钮设置当前展示的表格
      this.currentTable = tableName;
    },
    showTableChange() {
      // 处理表格选中事件
    },
    // 其他方法...
  }
};
</script>

<script setup>
// 全量引入格式化工具 请按需保留
import {createCompany, deleteCompany, deleteCompanyByIds, updateCompany, findCompany, getCompanyList} from '@/api/company'
import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, reactive } from 'vue'
import {
  DataList,
  getProduct,
  getProductData,
  Project,StatusEdit,
  projectCraft,ProcessStatusCorrection,
  projectPrint, setProductStatus,
  workbench
} from "@/api/yunyin/yunying";
defineOptions({name: 'Company'})

// =========== 左侧树侧形结构 ===========
const sctreeData = ref([
  {
    label: '排产进程及参数设置',
    children:[
      {label: '1.计划中工单', number: 1},
      {label: '2.排程中工单', number: 2,},
      {label: '3.制程中工单', number: 3,},
      {label: '4.已完工工单', number: 4,}
    ],
  }
]);

const tableFields = ref(
{
      '1': [
          { title:'生产分类', prop: '生产分类', width: 90, align:'left', },
          { title: '工单编号', prop: '工单编号', width: 120, align:'left', },
          { title: '产品代号', prop: '产品代号', width: 120, align:'left', },
          { title: '产品名称', prop: '产品名称', width: 340, align:'left', },
          { title: '接单日期', prop: '接单日期', width: 160, align:'left', },
          { title: '交货日期', prop: '交货日期', width: 160, align:'left', },
          { title: '订单数量', prop: '订单数量', width: 120, align:'left', },
          { title: '计量单位', prop: '计量单位', width: 120, align:'left', },
          { title: '客户名称', prop: '客户名称', width: 200, align:'left', },
          { title: '客户编号', prop: '客户编号', width: 120, align:'left', },
        { title: '备注', prop: '备注', width: 400, align:'left', },
          { title: '客户料号', prop: '客户料号', width: 120, align:'left', },
          { title: '创建用户', prop: '创建用户', width: 160, align:'left', },
          { title: '创建时间', prop: '创建时间', width: 160, align:'left', },
          { title: '修改时间', prop: '修改时间', width: 160, align:'left', },
          { title: 'UNIQID', prop: 'UNIQID', width: 120, align:'left', },
          { title: '投料率', prop: '投料率', width: 120, align:'left', },
          { title: '销售订单号', prop: '销售订单号', width: 120, align:'left', },
    ],
    '2':[
      { title: '最早开工时间', prop: '最早开工时间', width: 120, align:'left', },
      { title: '工单编号', prop: '工单编号', width: 120, align:'left', },
      { title: '产品代号', prop: '产品代号', width: 120, align:'left', },
      { title: '产品名称', prop: '产品名称', width: 340, align:'left', },
      { title: '接单日期', prop: '接单日期', width: 160, align:'left', },
      { title: '交货日期', prop: '交货日期', width: 160, align:'left', },
      { title: '订单数量', prop: '订单数量', width: 120, align:'left', },
      { title: '计量单位', prop: '计量单位', width: 120, align:'left', },
      { title: '销售订单号', prop: '销售订单号', width: 200, align:'left', },
      { title: '排程类型', prop: '排程类型', width: 120, align:'left', },
      { title: '客户编号', prop: '客户编号', width: 120, align:'left', },
      { title: '客户名称', prop: '客户名称', width: 120, align:'left', },
      { title: '创建用户', prop: '创建用户', width: 160, align:'left', },
      { title: 'GDUID', prop: 'GDUID', width: 120, align:'left', },
      { title: 'GYUID', prop: 'GYUID', width: 120, align:'left', },
      ],
      '3': [
        { title: '最早开工时间', prop: '最早开工时间', width: 120, align:'left', },
        { title: '工单编号', prop: '工单编号', width: 120, align:'left', },
        { title: '产品代号', prop: '产品代号', width: 120, align:'left', },
        { title: '产品名称', prop: '产品名称', width: 340, align:'left', },
        { title: '接单日期', prop: '接单日期', width: 160, align:'left', },
        { title: '交货日期', prop: '交货日期', width: 160, align:'left', },
        { title: '订单数量', prop: '订单数量', width: 120, align:'left', },
        { title: '计量单位', prop: '计量单位', width: 120, align:'left', },
        { title: '销售订单号', prop: '销售订单号', width: 200, align:'left', },
        { title: '排程类型', prop: '排程类型', width: 120, align:'left', },
        { title: '客户编号', prop: '客户编号', width: 120, align:'left', },
        { title: '客户名称', prop: '客户名称', width: 120, align:'left', },
        { title: '客户料号', prop: '客户料号', width: 160, align:'left', },
        { title: 'GDUID', prop: 'GDUID', width: 120, align:'left', },
        { title: 'GYUID', prop: 'GYUID', width: 120, align:'left', },
      ],
      '4': [
        { title: '工单编号', prop: '工单编号', width: 120, align:'left', },
        { title: '产品代号', prop: '产品代号', width: 120, align:'left', },
        { title: '产品名称', prop: '产品名称', width: 340, align:'left', },
        { title: '接单日期', prop: '接单日期', width: 160, align:'left', },
        { title: '交货日期', prop: '交货日期', width: 160, align:'left', },
        { title: '订单数量', prop: '订单数量', width: 120, align:'left', },
        { title: '计量单位', prop: '计量单位', width: 120, align:'left', },
        { title: '销售订单号', prop: '销售订单号', width: 200, align:'left', },
        { title: '客户编号', prop: '客户编号', width: 120, align:'left', },
        { title: '客户名称', prop: '客户名称', width: 120, align:'left', },
        { title: '客户料号', prop: '客户料号', width: 160, align:'left', },
        { title: '排程类型', prop: '排程类型', width: 120, align:'left', },
        { title: 'GDUID', prop: 'GDUID', width: 120, align:'left', },
      ]
    }
)

const bottomTableF = ref({
  '2': [
    { title:'工单编号', prop: '工单编号', width: 120, align:'left', },
    { title:'印件工序及名称', prop: '印件工序及名称', width: 160, align:'left', },
    { title:'机组', prop: '机组', width: 120, align:'left', },
    { title:'设备编号', prop: '设备编号', width: 120, align:'left', },
    { title:'工序产量', prop: '工序产量', width: 120, align:'left', },
    { title:'已完成产量', prop: '已完成产量', width: 120, align:'left', },
    { title:'剩余产量', prop: '剩余产量', width: 120, align:'left', },
    { title:'小时产能', prop: '小时产能', width: 120, align:'left', },
    { title:'产能系数', prop: '产能系数', width: 120, align:'left', },
    { title:'生产工时', prop: '生产工时', width: 120, align:'left', },
    { title:'辅助工时', prop: '辅助工时', width: 120, align:'left', },
    { title:'最早开工时间', prop: '最早开工时间', width: 120, align:'left', },
    { title:'计划开工时间', prop: '计划开工时间', width: 120, align:'left', },
    { title:'计划完工时间', prop: '计划完工时间', width: 120, align:'left', },
    { title:'班次安排', prop: '班次安排', width: 120, align:'left', },
    { title:'设备名称', prop: '设备名称', width: 120, align:'left', },
    { title:'排单备注', prop: '排单备注', width: 120, align:'left', },
    { title:'工序完工', prop: '工序完工', width: 120, align:'left', },
    { title:'UNIQID', prop: 'UNIQID', width: 120, align:'left', },
  ],
  '3': [
    { title:'工单编号', prop: '工单编号', width: 120, align:'left', },
    { title:'印件工序及名称', prop: '印件工序及名称', width: 160, align:'left', },
    { title:'机组', prop: '机组', width: 120, align:'left', },
    { title:'设备编号', prop: '设备编号', width: 120, align:'left', },
    { title:'工序产量', prop: '工序产量', width: 120, align:'left', },
    { title:'已完成产量', prop: '已完成产量', width: 120, align:'left', },
    { title:'剩余产量', prop: '剩余产量', width: 120, align:'left', },
    { title:'小时产能', prop: '小时产能', width: 120, align:'left', },
    { title:'产能系数', prop: '产能系数', width: 120, align:'left', },
    { title:'生产工时', prop: '生产工时', width: 120, align:'left', },
    { title:'辅助工时', prop: '辅助工时', width: 120, align:'left', },
    { title:'最早开工时间', prop: '最早开工时间', width: 120, align:'left', },
    { title:'计划开工时间', prop: '计划开工时间', width: 120, align:'left', },
    { title:'计划完工时间', prop: '计划完工时间', width: 120, align:'left', },
    { title:'班次安排', prop: '班次安排', width: 120, align:'left', },
    { title:'设备名称', prop: '设备名称', width: 120, align:'left', },
    { title:'排单备注', prop: '排单备注', width: 120, align:'left', },
    { title:'工序完工', prop: '工序完工', width: 120, align:'left', },
    { title:'UNIQID', prop: 'UNIQID', width: 120, align:'left', },
      ],
})

const treeData = ref([]);
const currentNode = ref('1')
//印件资料
const yjtableData = ref([])
//工艺资料
const gytableData = ref([])

const bottomData = ref([])
//点击 设备定额及分配参数设置
const schandleNodeClick = async (node) => {
  currentNode.value = node.number
  bottomData.value = []
  yjtableData.value = []
  gytableData.value = []
  switch (node.number) {
    case 1:
      // 计划中工单
      const Projectdata = await Project();
      tableData.value = Projectdata.data
      break;
    case 2:
      //排程中工单
      tableData.value = [
        {
          '最早开工时间': '',
          '工单编号': '2011719',
          '产品代号': '100102003',
          '产品名称': '利群（休闲云端）手工条盒',
          '接单日期': '2020.11.04',
          '交货日期': '2020.11.14',
          '订单数量': '12.5',
          '计量单位': '万张',
          '销售订单号': '利群（休闲云端）手工条盒 201102',
          '排程类型': '2.排程中工单',
          '客户编号': '1001',
          '客户名称': '浙江中烟',
          '客户料号': '',
          'GDUID': '5222',
          'GYUID': '95913',
        },
        {
          '最早开工时间': '',
          '工单编号': '2380342',
          '产品代号': '',
          '产品名称': '检验改二维码专用印章',
          '接单日期': '2023.03.07',
          '交货日期': '',
          '订单数量': '',
          '计量单位': '张',
          '销售订单号': '',
          '排程类型': '2.排程中工单',
          '客户编号': '1001',
          '客户名称': '浙江中烟',
          '客户料号': '',
          'GDUID': '14405',
          'GYUID': '211808',
        },
      ]
      break;
    case 3:
      //制程中工单
      break;
    case 4:
      //已完工工单
      break;
  }
};
//进入页面自动加载数据
const workbenchdata = async () => {
  try {
    const data = await workbench();
    const rawData = data.data;
    const dataArray =Object.keys(rawData).map(key => ({
      label: key,
      children: Object.keys(rawData[key]).map(subKey => ({
        label: subKey,
        children: rawData[key][subKey].map(item => ({
          label: item
        }))
      }))
    }));
    treeData.value = dataArray;
    // console.log(dataArray);
  } catch (error) {
    console.error(error);
  }
};
workbenchdata();

//点击左侧树形获取列表
const tableData = ref([])
const handleNodeClick = async (node) => {
  const custom_code = node.label;
  console.log("↓↓↓↓点击了车间参数↓↓↓↓");
  console.log(custom_code);
};

//下方表格数据
const gdtableRowClick = async (row) => {

  // 计划中
  if (currentNode.value == 1) {
    const Gd_gdbh = row.工单编号;
    // console.log(Gd_gdbh);
    //计划中工单->工艺资料接口
    const gyres = await projectCraft({Gd_gdbh: Gd_gdbh});
    //计划中工单->印件资料接口
    const yjres = await projectPrint({Gd_gdbh: Gd_gdbh});
    //工艺资料表格
    gytableData.value.splice(0, gytableData.value.length, ...gyres.data);
    //印件资料表格
    yjtableData.value.splice(0, yjtableData.value.length, ...(yjres?.data ?? []));
  }

  // 排程中 下方表格
  if (currentNode.value == 2) {
    bottomData.value = [
      {
        '工单编号' : '2305909',
        '印件工序及名称' : '01-01 裁切【光边】',
        '机组' : 'QZ01# QZ03#',
        '设备编号' : 'QZ01#',
        '工序产量' : '3000',
        '已完成产量' : '',
        '剩余产量' : '9000',
        '产能系数' : '1',
        '生产工时' : '',
        '辅助工时' : '1',
        '最早开工时间' : '',
        '计划完工时间' : '',
        '班次安排' : '007',
        '设备名称' : '海德堡波拉裁切刀（QZ-01）',
      }
    ]
  }
};

//搜索查询
const searchInfo = ref('')
//点击【查询】按钮
const onSubmit = () => {
  // console.log("点击了搜索按钮")
};

// =========== 【工序状态更正】 ===========
const gxztgzzlist = ref(false);
const gxztgzzformData = reactive({gdbh: '',});
const gxztgzztableData = ref([]);
//工序状态更正【按钮】
const onStatusgzClick = () => {
  // if(工单编号.value == null){
  //   gxztgzzlist.value = false;
  //   ElMessage({
  //     type: 'warning',
  //     message: '请选择树形后，再操作此功能'
  //   })
  // }else{
  gxztgzzformData['gdbh'] = '2312192';
  _ProcessStatusCorrection();
  gxztgzzlist.value = true;
  // }
};
//工序状态更正【回车】
const gxztgzzgetProductValue = () => {
  _ProcessStatusCorrection();
};
//工序状态更正
const _ProcessStatusCorrection = async (row) => {
  const workOrder = gxztgzzformData['gdbh'];
  console.log(workOrder)
  const ProcessStatusCorrectiondata = await ProcessStatusCorrection({workOrder:workOrder});
  gxztgzztableData.value = ProcessStatusCorrectiondata.data;
};
//工序状态更正【退出】
const gxztgzzCancel = () => {
  gxztgzzlist.value = false;
};


// =========== 状态设置 ===========
const onstatuslist = ref(false);
const statusformData = reactive({gdbh: '',});
const status = ref('计划中'); // 默认选择在产
// const _stacode = ref(null);
//点击【状态设置】按钮
const onStatusClick = () => {
  // if(_product_code.value == null){
  //   onstatuslist.value = false;
  //   ElMessage({
  //     type: 'warning',
  //     message: '请选择树形后，再操作此功能'
  //   })
  // }else{
    statusformData['gdbh'] = '2401156';
    onstatuslist.value = true;
  // }
};
//工单状态设置放弃按钮
const handleCancel = () => {
  onstatuslist.value = false;
};
//工单状态设置执行按钮
const handleConfirm = async () => {
  //工单编号
  let workOrder = statusformData['gdbh'];
  //状态
  let statusCode;
  if (status.value === '计划中') {
    statusCode = "1-计划中";
  } else if (status.value === '生产中') {
    statusCode = "2-生产中";
  }else if (status.value === '已完工') {
    statusCode = "3-已完工";
  }
  const StatusEditdata = await StatusEdit({workOrder:workOrder,status:statusCode});
  if (StatusEditdata.code === 0) {
    ElMessage({
      type: 'success',
      message: '更新成功'
    })
  } else {
    ElMessage({
      type: 'error',
      message: '更新成功'
    })
  }
  onstatuslist.value = false;
};
// handleCancel(_stacode);


const page = ref(1)
const total = ref(0)
const pageSize = ref(10)
// 分页
const handleSizeChange = (val) => {
  pageSize.value = val
  getTableData()
}

// 修改页面容量
const handleCurrentChange = (val) => {
  page.value = val
  getTableData()
}

// 查询
const getTableData = async() => {

}
getTableData()

// ============== 表格控制部分结束 ===============

// 获取需要的字典 可能为空 按需保留
const setOptions = async () =>{
}

// 获取需要的字典 可能为空 按需保留
setOptions()


// 多选数据
const multipleSelection = ref([])
// 多选
const handleSelectionChange = (val) => {
  multipleSelection.value = val
}

// 行为控制标记（弹窗内部需要增还是改）
const type = ref('')

//修改
const updateCompanyFunc = async (row) => {
  console.log(row);
  dialogFormVisible.value = true;
};

// 打开弹窗
const openDialog = () => {
  dialogFormVisible.value = true
}
// 弹窗确定
const enterDialog = async () => {
  console.log("弹窗确定")
}
// 关闭弹窗
const closeDialog = () => {dialogFormVisible.value = false}
</script>
<style scoped>
:deep(.el-table td .cell) {
  line-height: 30px !important;
}
.JKWTree-container {
  display: flex;
}
.JKWTree-tree {
  width: 300px;
  background-color: #fff;
  padding: 10px;
  margin-right: 20px;
}

.JKWTree-tree h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 10px 0;
}
.JKWTree-content {
  flex: 1;
}
/* 选中某行时的背景色 */
:deep(.el-table__body tr.current-row) > td {
  background: #ff80ff !important;
}
</style>