<template>
  <div class="app-container">
    <div class="workplantable">
      <div>
        <el-form :model="search" inline>
          <el-form-item label="年">
            <el-input v-model="search.year" placeholder="输入年份"></el-input>
          </el-form-item>
          <el-form-item label="周">
            <el-input v-model="search.week" placeholder="输入周"></el-input>
          </el-form-item>
          <el-form-item label="零件号">
            <el-input v-model="search.partNumber" placeholder="输入零件号"></el-input>
          </el-form-item>
          <el-form-item label="颜色">
            <el-input v-model="search.color" placeholder="输入颜色名称"></el-input>
          </el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="getList">搜索</el-button>
        </el-form>
      </div>
      <div>
        <el-row :gutter="20">
          <el-col :span="16"> <el-button type="primary" @click="newplan">新建生产计划</el-button> </el-col>
        </el-row>

        <el-table
          border
          stripe
          :data="workplanList"
          v-loading="loading_1"
          style="width: 100%"
          height="500"
          highlight-current-row
          :header-cell-style="{ 'text-align': 'center' }"
        >
          <el-table-column prop="id" label="流水号" sortable></el-table-column>
          <el-table-column prop="year" label="年"> </el-table-column>
          <el-table-column prop="week" label="周"> </el-table-column>
          <el-table-column prop="source" label="来源"> </el-table-column>
          <af-table-column prop="partnumber" label="零件号">
            <template slot-scope="scope">
              <div class="workplan_scope">{{ scope.row.partnumber }}</div>
            </template>
          </af-table-column>
          <el-table-column prop="version" label="版本"> </el-table-column>
          <af-table-column prop="color" label="颜色">
            <template slot-scope="scope">
              <div class="workplan_scope">{{ scope.row.color }}</div>
            </template>
          </af-table-column>
          <el-table-column prop="colorcode" label="颜色代码"> </el-table-column>
          <el-table-column prop="neednumber" label="本周要货数量"> </el-table-column>
          <el-table-column prop="passpercent" label="产品合格率"> </el-table-column>
          <el-table-column prop="batchNumber" label="每挂数量"> </el-table-column>
          <el-table-column prop="productionRhythm" label="生产节拍"> </el-table-column>
          <el-table-column prop="hangerNumber" label="总挂具数"> </el-table-column>
          <el-table-column prop="needhangerNumber" label="订单需生产挂具数量"> </el-table-column>
          <el-table-column prop="actualplanNumber" label="实际计划数量" fixed="right"> </el-table-column>
          <el-table-column prop="carNumber" label="车数"> </el-table-column>
          <el-table-column prop="circleNumber" label="圈数"> </el-table-column>
          <el-table-column prop="producttime" label="订单生产时间(分钟)"> </el-table-column>
          <el-table-column prop="needcertainty" label="计划需求定性"> </el-table-column>
          <el-table-column prop="remark" label="备注"> </el-table-column>
          <el-table-column fixed="right" label="操作" width="280">
            <template slot-scope="scope">
              <el-button size="mini" @click="workplan_handleUpdate(scope.$index, scope.row)">修改</el-button>
              <el-button size="mini" type="danger" @click="workplan_handleDelete(scope.$index, scope.row)">删除</el-button>
              <el-button size="mini" type="success" @click="workplan_select(scope.$index, scope.row)">查看工单</el-button>
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="pagination.total > 0"
          :total="pagination.total"
          :page.sync="pagination.pageNum"
          :limit.sync="pagination.pageSize"
          @pagination="getList"
        />
      </div>
    </div>

    <!-- 添加或修改生产计划对话框 -->
    <el-dialog :title="dialog_1.title" :visible.sync="dialog_1.open" width="98%">
      <el-form ref="dialog_1form" :model="dialog_1.form" :rules="dialog_1.rules" label-width="150px">
        <el-row>
          <el-col :span="6">
            <el-form-item label="年份" prop="year"> <el-input v-model="dialog_1.form.year"></el-input> </el-form-item
          ></el-col>
          <el-col :span="6">
            <el-form-item label="周" prop="week"> <el-input v-model="dialog_1.form.week"></el-input> </el-form-item
          ></el-col>
          <el-col :span="6">
            <el-form-item label="来源" prop="source">
              <el-select v-model="dialog_1.form.source" placeholder="请选择来源">
                <el-option label="订单" value="订单"></el-option>
                <el-option label="紧急插单" value="紧急插单"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="零件号" prop="partnumber"> <el-input v-model="dialog_1.form.partnumber"></el-input> </el-form-item
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="版本" prop="version"> <el-input v-model="dialog_1.form.version"></el-input> </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="颜色" prop="color"> <el-input v-model="dialog_1.form.color"></el-input> </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="颜色代码"> <el-input v-model="dialog_1.form.colorcode"></el-input> </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="要货数量"> <el-input v-model="dialog_1.form.neednumber"></el-input> </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="产品合格率"> <el-input v-model="dialog_1.form.passpercent"></el-input> </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="每挂数量"> <el-input v-model="dialog_1.form.batchNumber"></el-input> </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="生产节拍"> <el-input v-model="dialog_1.form.productionRhythm"></el-input> </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="总挂具数"> <el-input v-model="dialog_1.form.hangerNumber"></el-input> </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <el-form-item label="订单需生产挂具数量"> <el-input v-model="dialog_1.form.needhangerNumber"></el-input> </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="实际计划数量"><el-input v-model="dialog_1.form.actualplanNumber"></el-input> </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="车数"> <el-input v-model="dialog_1.form.carNumber"></el-input> </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="订单生产时间(分钟)"> <el-input v-model="dialog_1.form.producttime"></el-input> </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="6"
            ><el-form-item label="计划需求定性"> <el-input v-model="dialog_1.form.needcertainty"></el-input> </el-form-item
          ></el-col>

          <el-col :span="6"
            ><el-form-item label="备注"> <el-input v-model="dialog_1.form.remark"></el-input> </el-form-item
          ></el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm_1">确 定</el-button>
        <el-button @click="cancel_1">取 消</el-button>
      </div>
    </el-dialog>

    <div class="workordertable">
      <el-row :gutter="20">
        <el-col :span="16"> <el-button type="primary" @click="addNewworkorder">新建生产工单</el-button> </el-col>
        <el-col :span="8"> 选中计划: {{ this.selectPlan.id }}</el-col>
      </el-row>
      <el-table border stripe :data="workOrderList" style="width: 100%" height="300">
        <el-table-column prop="id" label="流水号"> </el-table-column>
        <el-table-column prop="fkProPlanId" label="生产计划id"> </el-table-column>
        <el-table-column prop="year" label="年份"> </el-table-column>
        <el-table-column prop="week" label="周"> </el-table-column>
        <el-table-column prop="date" label="周几">
          <template slot-scope="scope">
            <div class="workorder_scope">{{ scope.row.date }}</div>
          </template>
        </el-table-column>
        <el-table-column prop="wrokerorder_status" label="工单状态">
          <template slot-scope="scope">
            <el-button v-if="scope.row.wrokerorder_status == 0" size="mini" type="success" round>未排程</el-button>
            <el-button v-else-if="scope.row.wrokerorder_status == 1" size="mini" type="info" round>已排程</el-button>
            <el-button v-else-if="scope.row.wrokerorder_status == 2" size="mini" type="info" round>领料中</el-button>
            <el-button v-else-if="scope.row.wrokerorder_status == 3" size="mini" type="info" round>领料结束</el-button>
            <el-button v-else-if="scope.row.wrokerorder_status == 4" size="mini" type="info" round>生产中</el-button>
            <el-button v-else-if="scope.row.wrokerorder_status == 5" size="mini" type="info" round>生产完成</el-button>
          </template>
        </el-table-column>
        <el-table-column prop="priority" label="优先级">
          <template slot-scope="scope">
            <div v-if="scope.row.priority == 100" style="color: red">高</div>
            <div v-else>低</div>
          </template>
        </el-table-column>
        <!-- <el-table-column prop="arrange_starttime" label="排产开始时间"> <i class="el-icon-time"></i> </el-table-column>
        <el-table-column prop="arrange_endtime" label="排产结束时间"> <i class="el-icon-time"></i></el-table-column> -->
        <el-table-column prop="productionTime" label="预计工时"> </el-table-column>
        <el-table-column prop="productionName" label="产品名称"> </el-table-column>
        <el-table-column prop="color" label="颜色"> </el-table-column>
        <el-table-column prop="paintCylinderNumber" label="油漆缸号"> </el-table-column>
        <el-table-column prop="specification" label="规格"> </el-table-column>
        <el-table-column prop="carnum" label="车数"> </el-table-column>
        <el-table-column prop="rack" label="挂具摆放"> </el-table-column>
        <el-table-column prop="requireNum" label="上件数"> </el-table-column>
        <el-table-column prop="workblankpartnumber" label="毛坯零件号"> </el-table-column>
        <el-table-column prop="finishedpartnumber" label="成品零件号"> </el-table-column>
        <el-table-column prop="actualnumber" label="实际上件数" fixed="right"> </el-table-column>
        <el-table-column fixed="right" label="操作" width="150">
          <template slot-scope="scope">
            <el-button size="mini" @click="workorder_updateEdit(scope.$index, scope.row)">修改</el-button>
            <el-button size="mini" type="danger" @click="workorder_delete(scope.$index, scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <!-- 添加或者修改生产工单对话框 -->
    <el-dialog :title="dialog_2.title" :visible.sync="dialog_2.open" width="98%">
      <div class="planbak">
        <div class="text-success">当前计划</div>
        <el-form :model="this.selectPlan" label-width="150px">
          <el-row>
            <el-col :span="12">
              <el-form-item label="零件号"> <el-input v-model="this.selectPlan.partnumber" disabled></el-input> </el-form-item
            ></el-col>
            <el-col :span="12">
              <el-form-item label="实际计划数量"> <el-input v-model="this.selectPlan.actualplanNumber" disabled></el-input> </el-form-item
            ></el-col>
          </el-row>
        </el-form>
      </div>

      <div class="planbak" style="margin-top: 20px">
        <div class="text-success">{{ dialog_2.title }}</div>
        <el-form ref="dialog_2form" :model="dialog_2.form" :rules="dialog_2.rules" label-width="150px">
          <el-row>
            <el-col :span="6">
              <el-form-item label="周几" prop="date"> <el-input v-model="dialog_2.form.date"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="预计工时" prop="productionTime"> <el-input v-model="dialog_2.form.productionTime"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="产品名称" prop="productionName"> <el-input v-model="dialog_2.form.productionName"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="颜色" prop="color"> <el-input v-model="dialog_2.form.color"></el-input> </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="油漆缸号" prop="paintCylinderNumber">
                <el-input v-model="dialog_2.form.paintCylinderNumber"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="规格" prop="specification"> <el-input v-model="dialog_2.form.specification"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="车数" prop="carnum"> <el-input v-model="dialog_2.form.carnum"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="挂具摆放" prop="rack"> <el-input v-model="dialog_2.form.rack"></el-input> </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6">
              <el-form-item label="上件数" prop="requireNum"> <el-input v-model="dialog_2.form.requireNum"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="毛坯零件号"> <el-input v-model="dialog_2.form.workblankpartnumber"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="实际上件数" prop="actualnumber"> <el-input v-model="dialog_2.form.actualnumber"></el-input> </el-form-item>
            </el-col>
            <el-col :span="6"
              ><el-form-item label="排程优先级">
                <el-select v-model="dialog_2.form.priority" placeholder="请选择来源">
                  <el-option label="紧急" :value="100"></el-option>
                  <el-option label="普通" :value="1"></el-option>
                </el-select> </el-form-item
            ></el-col>
          </el-row>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm_2">确 定</el-button>
        <el-button @click="cancel_2">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  getWorkplanList,
  addNewworkplan,
  deleteworkplan,
  updateworkplan,
  getworkorderList,
  insertNewworkorder,
  deleteworkorder,
  updateworkorder,
} from '@/api/productManagement/workplan.js'
export default {
  name: 'workplan',
  data() {
    return {
      flag: 'insert',
      selectPlan: {
        id: '',
      },
      search: {
        year: new Date().getFullYear(),
        week: null,
        partNumber: '',
        color: '',
      },
      workplanList: [], //生产计划列表
      workOrderList: [], // 生产工单列表
      pagination: {
        total: 0,
        pageNum: 1,
        pageSize: 10,
      },
      loading_1: true,
      dialog_1: {
        title: '新增生产计划',
        open: false,
        form: {
          id: '',
          year: new Date().getFullYear(),
          week: null,
          source: null,
          partnumber: null,
          version: null,
          color: null,
          colorcode: null,
          neednumber: null,
          passpercent: null,
          batchNumber: null,
          productionRhythm: null,
          actualplanNumber: null,
          carNumber: null,
          circleNumber: null,
          producttime: 0,
          needcertainty: null,
          remark: null,
        },
        rules: {
          year: [{ required: true, message: '年不能为空', trigger: 'blur' }],
          week: [{ required: true, message: '周不能为空', trigger: 'blur' }],
          source: [{ required: true, message: '来源不能为空', trigger: 'blur' }],
          partnumber: [{ required: true, message: '零件号不能为空', trigger: 'blur' }],
          color: [{ required: true, message: '颜色不能为空', trigger: 'blur' }],
        },
      },
      dialog_2: {
        title: '新增生产工单',
        open: false,
        rules: {
          date: [{ required: true, message: '周几不能为空', trigger: 'blur' }],
          productionTime: [{ required: true, message: '预计工时不能为空', trigger: 'blur' }],
          productionName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
          partnumber: [{ required: true, message: '零件号不能为空', trigger: 'blur' }],
          color: [{ required: true, message: '颜色不能为空', trigger: 'blur' }],
          paintCylinderNumber: [{ required: true, message: '颜色缸号不能为空', trigger: 'blur' }],
          carnum: [{ required: true, message: '车数不能为空', trigger: 'blur' }],
          rack: [{ required: true, message: '挂具摆放不能为空', trigger: 'blur' }],
          requireNum: [{ required: true, message: '需求数量不能为空', trigger: 'blur' }],
          actualnumber: [{ required: true, message: '实际上件数不能为空', trigger: 'blur' }],
        },
        form: {
          id: '',
          fkProPlanId: '',
          year: null,
          week: null,
          date: null,
          wrokerorder_status: '',
          arrangeStarttime: null,
          arrangeEndtime: null,
          productionTime: null,
          productionName: '',
          color: '',
          paintCylinderNumber: null,
          specification: '',
          carnum: null,
          rack: null,
          requireNum: null,
          workblankpartnumber: '',
          finishedpartnumber: '',
          actualnumber: null,
        },
      },
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    //todo 获取生产计划列表
    getList() {
      const query = { ...this.search, ...this.pagination }
      if (query.week == null || query.week == undefined || query.week == '') query.week = -1
      if (query.year == null || query.year == undefined || query.year == '') query.year = -1
      getWorkplanList(query).then((res) => {
        if (res.code == 200) {
          this.loading_1 = false
          this.workplanList = res.data.item1
          this.pagination.total = res.data.item2
        }
      })
    },
    //新增按钮
    newplan() {
      this.dialog_1.open = true
      this.dialog_1.title = '新增生产计划'
      this.flag = 'insert'
    },

    //todo 新建生产工单
    addNewworkorder() {
      if (this.selectPlan.id == '' || this.selectPlan.id == undefined) {
        this.$notify.error({
          title: '错误',
          message: '未选中生产计划不得新建生产工单',
        })
        return
      }
      this.dialog_2.open = true
      this.dialog_2.title = '新增生产工单'
      this.flag = 'insert'
    },

    // todo 新增修改提交计划处理
    submitForm_1() {
      if (this.flag == 'insert') {
        this.$refs['dialog_1form'].validate((valid) => {
          if (valid) {
            addNewworkplan(this.dialog_1.form).then((res) => {
              if (res.code == 200) {
                this.$notify.success('新增成功')
                this.getList()
                this.dialog_1.open = false
              }
            })
          }
        })
      } else if (this.flag == 'update') {
        this.$refs['dialog_1form'].validate((valid) => {
          if (valid) {
            updateworkplan(this.dialog_1.form).then((res) => {
              if (res.code == 200) {
                this.$notify.success('修改成功')
                this.getList()
                this.dialog_1.open = false
              }
            })
          }
        })
      }

      // 清空表单
      this.resetForm('dialog_1form')
    },

    // todo 新增修改 生产工单 处理
    submitForm_2() {
      if (this.flag == 'insert') {
        this.$refs['dialog_2form'].validate((valid) => {
          if (valid) {
            const query = { ...this.dialog_2.form }
            query.fkProPlanId = this.selectPlan.id
            query.year = this.selectPlan.year
            query.week = this.selectPlan.week
            query.wrokerorder_status = 0
            insertNewworkorder(query).then((res) => {
              if (res.code == 200) {
                if (res.data == 1) {
                  this.$notify.success('工单新增成功')
                  this.workplan_select(0, this.selectPlan)
                  this.dialog_2.open = false
                  // 清空表单
                  this.resetForm('dialog_2form')
                } else if (res.data == 0) {
                  this.$notify.error('工单新增异常,请联系管理员')
                  this.dialog_2.open = false
                } else if (res.data == 2) {
                  this.$notify.warning('工单生产数量超过计划,无法插入,请调整数量')
                  this.dialog_2.open = false
                }
              }
            })
          } else {
            this.$notify.error('工单校验失败')
          }
        })
      } else if (this.flag == 'update') {
        this.$refs['dialog_2form'].validate((valid) => {
          if (valid) {
            updateworkorder(this.dialog_2.form).then((res) => {
              if (res.code == 200) {
                if (res.data == 1) {
                  this.$notify.success('修改成功')
                  this.workplan_select(0, this.selectPlan)
                  this.dialog_2.open = false
                  // 清空表单
                  this.resetForm('dialog_2form')
                } else if (res.data == 0) {
                  this.$notify.error('修改失败，请联系管理员')
                } else if (res.data == 2) {
                  this.$notify.warning('修改的工单生产数量超过计划,无法插入,请调整数量')
                } else if (res.data == 3) {
                  this.dialog_2.open = false
                  this.$notify.error('该工单已经排程不能修改')
                  // 清空表单
                  this.resetForm('dialog_2form')
                }
              }
            })
          }
        })
      }
    },

    cancel_1() {
      this.dialog_1.open = false
      // this.dialog_1reset();
      this.resetForm('dialog_1form')
    },

    cancel_2() {
      this.dialog_2.open = false
      // this.dialog_1reset();
      this.resetForm('dialog_2form')
    },

    //todo 修改生产计划
    workplan_handleUpdate(index, row) {
      this.flag = 'update'
      this.dialog_1.open = true
      this.dialog_1.title = '修改生产计划'
      this.dialog_1.form.id = row.id
      this.dialog_1.form.year = row.year
      this.dialog_1.form.week = row.week
      this.dialog_1.form.source = row.source
      this.dialog_1.form.partnumber = row.partnumber
      this.dialog_1.form.version = row.version
      this.dialog_1.form.color = row.color
      this.dialog_1.form.colorcode = row.colorcode
      this.dialog_1.form.neednumber = row.neednumber
      this.dialog_1.form.passpercent = row.passpercent
      this.dialog_1.form.batchNumber = row.batchNumber
      this.dialog_1.form.productionRhythm = row.productionRhythm
      this.dialog_1.form.actualplanNumber = row.actualplanNumber
      this.dialog_1.form.carNumber = row.carNumber
      this.dialog_1.form.circleNumber = row.circleNumber
      this.dialog_1.form.producttime = row.producttime
      this.dialog_1.form.needcertainty = row.needcertainty
      this.dialog_1.form.remark = row.remark
    },

    //todo  删除生产计划
    workplan_handleDelete(index, row) {
      this.$modal
        .confirm('是否确认删除生产计划名称为' + row.partnumber + '"的数据项？')
        .then(function () {
          return deleteworkplan(row.id)
        })
        .then(() => {
          if (res.code == 200) {
            if ((res.data ==1)) {
              this.$notify.success('删除成功')
              this.getList()
            } else {
              this.$notify.error('删除失败')
            }
          }
        })
        .catch(() => {})
    },
    //todo 删除生产工单
    workorder_delete(index, row) {
      this.$modal
        .confirm('是否确认删除生产工单名称为' + row.id + '"的数据项？')
        .then(function () {
          return deleteworkorder(row.id)
        })
        .then((res) => {
          if (res.code == 200) {
            if (res.data == 1) {
              this.$notify.success('删除成功')
              this.workplan_select(0, this.selectPlan)
            } else if (res.data == 0) {
              this.$notify.error('删除失败')
            } else if (res.data == 3) {
              this.$notify.error('该工单已经排程不能删除')
            }
          }
        })
        .catch(() => {})
    },
    //todo 修改工单
    workorder_updateEdit(index, row) {
      this.dialog_2.open = true
      this.flag = 'update'
      this.dialog_2.title = '修改生产工单'
      this.dialog_2.form.id = row.id
      this.dialog_2.form.fkProPlanId = row.fkProPlanId
      this.dialog_2.form.year = row.year
      this.dialog_2.form.week = row.week
      this.dialog_2.form.date = row.date
      this.dialog_2.form.arrangeStarttime = row.arrangeStarttime
      this.dialog_2.form.wrokerorder_status = row.wrokerorder_status
      this.dialog_2.form.arrangeEndtime = row.arrangeEndtime
      this.dialog_2.form.productionTime = row.productionTime
      this.dialog_2.form.productionName = row.productionName
      this.dialog_2.form.color = row.color
      this.dialog_2.form.paintCylinderNumber = row.paintCylinderNumber
      this.dialog_2.form.specification = row.specification
      this.dialog_2.form.carnum = row.carnum
      this.dialog_2.form.rack = row.rack
      this.dialog_2.form.requireNum = row.requireNum
      this.dialog_2.form.workblankpartnumber = row.workblankpartnumber
      this.dialog_2.form.finishedpartnumber = row.finishedpartnumber
      this.dialog_2.form.actualnumber = row.actualnumber
    },

    //todo 查看工单
    workplan_select(index, row) {
      this.selectPlan = row
      getworkorderList(row.id).then((res) => {
        if (res.code == 200) {
          this.workOrderList = res.data
          this.$notify.success('工单查看成功')
        }
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.workplantable {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}
.workordertable {
  margin-top: 50px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}
.workplan_scope {
  color: #1890ff;
  font-size: 10px;
  font-weight: 700;
}
.workorder_scope {
  color: #ff1869;
  font-weight: 700;
}
.planbak {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  padding: 20;
}
</style>
