<template>
  <section>
    <el-form ref="form" :model="form" class="demo-ruleForm" :rules="rules">
      <table border="1" class="twoTable">
        <thead>
          <tr>
            <td colspan="6">废品损失核算</td>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td class="center" colspan="2">项目</td>
            <td class="center" style="width: 80px">单位</td>
            <td class="center">数量</td>
            <td class="center">单价</td>
            <td class="center">损失价值</td>
          </tr>
          <tr>
            <td rowspan="6" class="width40">本车间损失</td>
            <td class="center">材料</td>
            <td class="center">材料费</td>
            <td class="input">
              <el-form-item prop="materialCount">
                <el-input
                  v-model="form.materialCount"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="materialCost">
                <el-input
                  v-model="form.materialCost"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.materialLossCost }}
              <!-- <el-input v-model="form.materialLossCost" min="0" type="Number" @input="thisLoss" /> -->
            </td>
          </tr>
          <tr>
            <!-- <td
                class="center"
                rowspan="2"
                :class="{ costEstimator: !costEstimator }"
              > -->
            <td class="center" rowspan="2">
              本工序工时
            </td>
            <td class="center">人工费</td>
            <td class="input">
              <el-form-item prop="curOpCostPCount">
                <el-input
                  v-model="form.curOpCostPCount"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="curOpCostP">
                <el-input
                  v-model="form.curOpCostP"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.curOpPLossCost }}
              <!-- <el-input v-model="form.curOpPLossCost" min="0" type="Number" @input="thisLoss" /> -->
            </td>
          </tr>
          <tr>
            <td class="center">制造费</td>
            <td class="input">
              <el-form-item prop="curOpCostMCount">
                <el-input
                  v-model="form.curOpCostMCount"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="curOpCostM">
                <el-input
                  v-model="form.curOpCostM"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.curOpMLossCost }}
              <!-- <el-input v-model="form.curOpMLossCost" min="0" type="Number" @input="thisLoss" /> -->
            </td>
          </tr>
          <tr>
            <td class="center" rowspan="2">
              <!-- <td
                class="center"
                rowspan="2"
                :class="{ costEstimator: !costEstimator && item.primaryBusinessObject==='Activity_144n8lq' }"
              > -->
              前工序工时
            </td>
            <td class="center">人工费</td>
            <td class="input">
              <el-form-item prop="perOpCostPCount">
                <el-input
                  v-model="form.perOpCostPCount"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="perOpCostP">
                <el-input
                  v-model="form.perOpCostP"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.perOpPLossCost }}
              <!-- <el-input v-model="form.perOpPLossCost" min="0" type="Number" @input="thisLoss" /> -->
            </td>
          </tr>
          <tr>
            <td class="center">制造费</td>
            <td class="input">
              <el-form-item prop="perOpCostMCount">
                <el-input
                  v-model="form.perOpCostMCount"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="perOpCostM">
                <el-input
                  v-model="form.perOpCostM"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  @input="thisPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.perOpMLossCost }}
              <!-- <el-input v-model="form.perOpMLossCost" min="0" type="Number" @input="thisLoss" /> -->
            </td>
          </tr>
          <tr>
            <td class="center">合计</td>
            <td />
            <td class="text-indent">{{ form.curTotalCount }}</td>
            <td class="text-indent">{{ form.curTotalCost }}</td>
            <td class="text-indent">{{ form.curTotalLossCost }}</td>
          </tr>
          <tr>
            <td rowspan="4" class="width40">外车间损失</td>
            <td class="center">材料(零件价格)</td>
            <td />
            <td class="input">
              <el-form-item prop="outMaterialCount">
                <el-input
                  v-model="form.outMaterialCount"
                  clearable
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  :disabled="basicData.isOnlyRead"
                  @input="outCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="outMaterialCost">
                <el-input
                  v-model="form.outMaterialCost"
                  clearable
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  :disabled="basicData.isOnlyRead"
                  @input="outPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.outMaterialLossCost }}
              <!-- <el-input v-model="form.outMaterialLossCost" min="0" type="Number" placeholder="请输入" @input="outLoss" /> -->
            </td>
          </tr>
          <tr>
            <td class="center" rowspan="2">工时</td>
            <td class="center">人工费</td>
            <td class="input">
              <el-form-item prop="workHourPCount">
                <el-input
                  v-model="form.workHourPCount"
                  clearable
                  min="0"
                  type="Number"
                  placeholder="请输入"
                  :disabled="basicData.isOnlyRead"
                  @input="outCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="workHourPCost">
                <el-input
                  v-model="form.workHourPCost"
                  clearable
                  min="0"
                  type="Number"
                  :disabled="basicData.isOnlyRead"
                  placeholder="请输入"
                  @input="outPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.workHourPLossCost }}
              <!-- <el-input v-model="form.workHourPLossCost" min="0" type="Number" placeholder="请输入" @input="outLoss" /> -->
            </td>
          </tr>
          <tr>
            <td class="center">制造费</td>
            <td class="input">
              <el-form-item prop="workHourMCount">
                <el-input
                  v-model="form.workHourMCount"
                  clearable
                  min="0"
                  type="Number"
                  :disabled="basicData.isOnlyRead"
                  placeholder="请输入"
                  @input="outCount"
                />
              </el-form-item>
            </td>
            <td class="input">
              <el-form-item prop="workHourMCost">
                <el-input
                  v-model="form.workHourMCost"
                  clearable
                  min="0"
                  type="Number"
                  :disabled="basicData.isOnlyRead"
                  placeholder="请输入"
                  @input="outPrice"
                />
              </el-form-item>
            </td>
            <td class="text-indent">
              {{ form.workHourMLossCost }}
              <!-- <el-input v-model="form.workHourMLossCost" min="0" type="Number" placeholder="请输入" @input="outLoss" /> -->
            </td>
          </tr>
          <tr>
            <td class="center">合计</td>
            <td />
            <td class="text-indent">{{ form.outTotalCount }}</td>
            <td class="text-indent">{{ form.outTotalCost }}</td>
            <td class="text-indent">{{ form.outTotalLossCost }}</td>
          </tr>
          <tr>
            <td class="center" colspan="2">总计损失</td>
            <td colspan="4" class="text-indent">{{ form.totalLossCost }}</td>
          </tr>
          <tr>
            <td class="center" colspan="2">
              <!-- <td
                class="center"
                colspan="2"
                :class="{ costEstimator: !costEstimator }"
              > -->
              净废品残值
            </td>
            <td colspan="4" class="input">
              <el-form-item prop="scrapValue">
                <el-input
                  v-model="form.scrapValue"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                />

                <!-- {{ form.scrapValue }} -->
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td class="center netLoss" colspan="2">
              <!-- <td
                class="center"
                colspan="2"
                :class="{ costEstimator: !costEstimator }"
              > -->
              净损失(元)
            </td>
            <td colspan="4" class="input">
              <el-form-item prop="netLoss">
                <el-input
                  v-model="form.netLoss"
                  clearable
                  :disabled="costEstimator || (disabled && !costEstimator)||basicData.isOnlyRead"
                  min="0"
                  type="Number"
                  placeholder="请输入"
                />
                <!-- {{ form.netLoss }} -->
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td class="center" colspan="2">材料费用</td>
            <td class="center" colspan="2">工时费用</td>
            <td class="center">制造费用</td>
            <td class="center">会计核算</td>
          </tr>
          <tr class="signature">
            <td colspan="2">
              <p>合计:{{ form.materialF }}</p>
              <p class="input">
                签字:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入名字" />
              </p>
              <p class="input">
                日期:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入日期" />
              </p>
            </td>
            <td colspan="2">
              <p>合计:{{ form.workHourF }}</p>
              <p class="input">
                签字:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入名字" />
              </p>
              <p class="input">
                日期:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入日期" />
              </p>
            </td>
            <td>
              <p>合计:{{ form.manufactureF }}</p>
              <p class="input">
                签字:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入名字" />
              </p>
              <p class="input">
                日期:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入日期" />
              </p>
            </td>
            <td>
              <el-form-item prop="accounts">
                <p class="input">
                  <label>合计:</label><el-input
                    v-model="form.accounts"
                    clearable
                    :disabled="true"
                    placeholder="请输入"
                  />
                  <!-- <label :class="{ costKeeper: !costKeeper }">合计:</label><el-input
                      v-model="form.accounts"
                      clearable
                      :disabled="costKeeper || (disabled && !costKeeper)"
                      placeholder="请输入"
                    /> -->
                </p>
              </el-form-item>
              <p class="input">
                签字:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入名字" />
              </p>
              <p class="input">
                日期:<el-input :disabled="basicData.isOnlyRead" clearable placeholder="请输入日期" />
              </p>
            </td>
          </tr>
        </tbody>
      </table>
      <div v-if="!basicData.isOnlyRead" class="table-btn">
        <el-button type="primary" size="small" :disabled="disab" @click="save">确定</el-button>
        <el-button size="small" :disabled="disab" @click="handleClose">取消</el-button>
      </div>
    </el-form>
  </section>
</template>
<script>
export default {
  props: {
    basicData: {
      type: Object,
      default: () => null
    }
  },
  data() {
    return {
      item: {},
      disabled: true,
      disab: false,
      form: {
        materialCount: null, // | 材料数量                 |
        materialCost: null, // | 材料单价                 |
        materialLossCost: 0, // | 材料损失价值             |
        curOpCostPCount: null, // | 本工序工时人工费数量     |
        curOpCostP: null, // | 本工序工时人工费单价     |
        curOpPLossCost: 0, // | 本工序工时人工损失价值   |
        curOpCostMCount: null, // | 本工序工时制造数量       |
        curOpCostM: null, // | 本工序工时制造单价       |
        curOpMLossCost: 0, // | 本工序工时制造损失价值   |
        perOpCostPCount: null, // | 前工序工时人工费数量     |
        perOpCostP: null, // | 前工序工时人工费单价     |
        perOpPLossCost: 0, // | 前工序工时人工损失价值   |
        perOpCostMCount: null, // | 前工序工时制造费数量     |
        perOpCostM: null, // | 前工序工时制造费单价     |
        perOpMLossCost: 0, // | 前工序工时制造费损失价值 |
        curTotalCount: 0, // | 本车间数量合计           |
        curTotalCost: 0, // | 本车间单价合计           |
        curTotalLossCost: 0, // | 本车间损失合计           |
        outMaterialCount: null, // | 外车间材料数量           |
        outMaterialCost: null, // | 外车间材料单价           |
        outMaterialLossCost: 0, // | 外车间材料损失           |
        workHourPCount: null, // | 工时人工数量             |
        workHourPCost: null, // | 工时人工单价             |
        workHourPLossCost: 0, // | 工时人工损失             |
        workHourMCount: null, // | 工时制造数量             |
        workHourMCost: null, // | 工时制造单价             |
        workHourMLossCost: 0, // | 工时制造损失             |
        outTotalCount: 0, // | 外车间数量合计           |
        outTotalCost: 0, // | 外车间数单价合计         |
        outTotalLossCost: 0, // | 外车间数损失合计         |
        totalLossCost: 0, // | 总计损失
        scrapValue: null, // | 净废品残值
        netLoss: null, // | 净损失(元)
        materialF: 0, // 材料费用
        workHourF: 0, // 工时费用
        manufactureF: 0, // 制造费用
        accounts: '' // 会计核算
      },
      rules: {
        'netLoss': [{ required: true, message: '该项必填', trigger: 'blur' }]
      },
      // 成本核算员
      costEstimator: true,
      // 成本管理员
      costKeeper: true,
      // 废品通知单编制禁用
      Activity_1dnbmb6: false
    }
  },
  watch: {
    form: {
      handler(val) {
        var that = this.form

        if (that.materialCount && that.materialCost) {
          that.materialLossCost =
            parseFloat(that.materialCount) * parseFloat(that.materialCost)
        } else if (!that.materialCount || !that.materialCost) {
          that.materialLossCost = 0
        }
        if (that.curOpCostPCount && that.curOpCostP) {
          that.curOpPLossCost =
            parseFloat(that.curOpCostPCount) * parseFloat(that.curOpCostP)
        } else if (!that.curOpCostPCount || !that.curOpCostP) {
          that.curOpPLossCost = 0
        }
        if (that.curOpCostM && that.curOpCostMCount) {
          that.curOpMLossCost =
            parseFloat(that.curOpCostM) * parseFloat(that.curOpCostMCount)
        } else if (!that.curOpCostM || !that.curOpCostMCount) {
          that.curOpMLossCost = 0
        }

        if (that.perOpCostPCount && that.perOpCostP) {
          that.perOpPLossCost =
            parseFloat(that.perOpCostPCount) * parseFloat(that.perOpCostP)
        } else if (!that.perOpCostPCount || !that.perOpCostP) {
          that.perOpPLossCost = 0
        }

        if (that.perOpCostMCount && that.perOpCostM) {
          that.perOpMLossCost =
            parseFloat(that.perOpCostMCount) * parseFloat(that.perOpCostM)
        } else if (!that.perOpCostMCount || !that.perOpCostM) {
          that.perOpMLossCost = 0
        }

        if (that.outMaterialCount && that.outMaterialCost) {
          that.outMaterialLossCost =
            parseFloat(that.outMaterialCount) *
            parseFloat(that.outMaterialCost)
        } else if (!that.outMaterialCount || !that.outMaterialCost) {
          that.outMaterialLossCost = 0
        }
        if (that.workHourPCount && that.workHourPCost) {
          that.workHourPLossCost =
            parseFloat(that.workHourPCount) * parseFloat(that.workHourPCost)
        } else if (!that.workHourPCount || !that.workHourPCost) {
          that.workHourPLossCost = 0
        }

        if (that.workHourMCount && that.workHourMCost) {
          that.workHourMLossCost =
            parseFloat(that.workHourMCount) * parseFloat(that.workHourMCost)
        } else if (!that.workHourMCount || !that.workHourMCost) {
          that.workHourMLossCost = 0
        }
        if (that.totalLossCost) {
          that.accounts = parseFloat(that.totalLossCost)
        } else if (!that.totalLossCost) {
          that.accounts = 0
        }
        this.outLoss()
        this.thisLoss()
        this.thisCount()
        this.thisPrice()
        this.outPrice()
        this.outCount()
        that.netLoss = that.totalLossCost = that.curTotalLossCost + that.outTotalLossCost
        that.materialF = that.materialLossCost
        that.workHourF =
          that.curOpPLossCost + that.perOpPLossCost + that.workHourPLossCost
        that.manufactureF =
          that.curOpMLossCost + that.perOpMLossCost + that.workHourMLossCost
      },
      deep: true
    },
    item: {
      handler(val) {
        this.$refs.form && this.$refs['form'].resetFields()
        if (val) {
          this.item = val
          Object.keys(this.form).forEach((key) => {
            Object.keys(val).forEach((key2) => {
              if (key === key2) {
                if (val[key2]) {
                  this.$set(this.form, key, val[key2])
                }
              }
            })
          })
        }
      },
      deep: true
    }
  },
  created() {
    this.open(this.basicData)
  },

  methods: {
    // 打开弹出框
    open(val) {
      this.$nextTick(() => {
        if (val && val.taskkey) {
        // 废品通知单编制
          if (val.taskkey === 'Activity_1dnbmb6') {
            this.Activity_1dnbmb6 = true
          }
          // 成本核算员节点Activity_1lgytbi和财务部会计Activity_07owud7
          // if (['Activity_1lgytbi', 'Activity_07owud7'].includes(val.taskkey)) {
          //   this.disabled = false
          //   if (val.taskkey === 'Activity_1lgytbi') {
          //     this.costEstimator = false
          //   } else if (val.taskkey === 'Activity_07owud7') {
          //     this.costKeeper = false
          //   }
          // } else {
          //   this.disabled = true
          // }
          this.disabled = false
          this.costEstimator = false
          this.costKeeper = false
          this.searchItem()
        }
      })
    },
    searchItem() {
      const params = {
        searchItems: {
          items: [{ 'fieldName': 'id', operator: 'EQ', value: this.basicData.id }],
          operator: 'AND'
        }
      }
      this.$api.searchApi('ScrapNoticeDoc', params).then(res => {
        if (res.items.content) {
          this.$nextTick(() => {
            res.items.content[0].taskkey = this.basicData.taskkey
            this.item = res.items.content[0]
          })
        }
      })
    },
    save() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.disab = true
          const params = {
            id: this.item.id,
            operator: 'MODIFY', // 增加操作
            ...this.form,
            loss: this.form.accounts
          }
          this.$api.recursion('ScrapNoticeDoc', params).then((res) => {
            this.item = res.items
            this.reset('保存')
          })
            .catch((err) => console.log(err))
            .finally(() => {
              this.disab = false
            })
        } else {
          this.$utils.showMessageWarning('请完整填写表单')
          return false
        }
      })
    },
    // 本车间数量
    thisCount() {
      var that = this.form
      var totalCount = 0
      if (that.materialCount) {
        totalCount += parseFloat(that.materialCount)
      }
      if (that.curOpCostPCount) {
        totalCount += parseFloat(that.curOpCostPCount)
      }
      if (that.curOpCostMCount) {
        totalCount += parseFloat(that.curOpCostMCount)
      }
      if (that.perOpCostPCount) {
        totalCount += parseFloat(that.perOpCostPCount)
      }
      if (that.perOpCostMCount) {
        totalCount += parseFloat(that.perOpCostMCount)
      }
      this.form.curTotalCount = Math.floor(totalCount * 1000) / 1000
    },
    // 本车间单价
    thisPrice() {
      var that = this.form
      // eslint-disable-next-line no-unused-vars
      let totalCount = 0
      if (that.materialCost) {
        totalCount += parseFloat(that.materialCost)
      }
      if (that.curOpCostP) {
        totalCount += parseFloat(that.curOpCostP)
      }
      if (that.curOpCostM) {
        totalCount += parseFloat(that.curOpCostM)
      }
      if (that.perOpCostP) {
        totalCount += parseFloat(that.perOpCostP)
      }
      if (that.perOpCostM) {
        totalCount += parseFloat(that.perOpCostM)
      }
      // this.form.curTotalCost = Math.floor(totalCount * 1000) / 1000
      this.form.curTotalCount ? this.form.curTotalCost = Math.floor(this.form.curTotalLossCost / this.form.curTotalCount * 1000) / 1000 : this.form.curTotalCost = 0
    },
    // 本车间损失
    thisLoss() {
      var that = this.form
      var totalCount = 0
      if (that.materialLossCost) {
        totalCount += parseFloat(that.materialLossCost)
      }
      if (that.curOpPLossCost) {
        totalCount += parseFloat(that.curOpPLossCost)
      }
      if (that.curOpMLossCost) {
        totalCount += parseFloat(that.curOpMLossCost)
      }
      if (that.perOpPLossCost) {
        totalCount += parseFloat(that.perOpPLossCost)
      }
      if (that.perOpMLossCost) {
        totalCount += parseFloat(that.perOpMLossCost)
      }
      this.form.curTotalLossCost = Math.floor(totalCount * 1000) / 1000
    },
    // 外车间数量
    outCount() {
      var that = this.form
      var totalCount = 0
      if (that.outMaterialCount) {
        totalCount += parseFloat(that.outMaterialCount)
      }
      if (that.workHourPCount) {
        totalCount += parseFloat(that.workHourPCount)
      }
      if (that.workHourMCount) {
        totalCount += parseFloat(that.workHourMCount)
      }
      this.form.outTotalCount = Math.floor(totalCount * 1000) / 1000
    },
    // 外车间单价
    outPrice() {
      var that = this.form
      var totalCount = 0
      if (that.outMaterialCost) {
        totalCount += parseFloat(that.outMaterialCost)
      }
      if (that.workHourPCost) {
        totalCount += parseFloat(that.workHourPCost)
      }
      if (that.workHourMCost) {
        totalCount += parseFloat(that.workHourMCost)
      }
      this.form.outTotalCost = Math.floor(totalCount * 1000) / 1000
    },
    // 外车间损失
    outLoss() {
      var that = this.form
      var totalCount = 0
      if (that.outMaterialLossCost) {
        totalCount += parseFloat(that.outMaterialLossCost)
      }
      if (that.workHourPLossCost) {
        totalCount += parseFloat(that.workHourPLossCost)
      }
      if (that.workHourMLossCost) {
        totalCount += parseFloat(that.workHourMLossCost)
      }
      this.form.outTotalLossCost = Math.floor(totalCount * 1000) / 1000
    },
    handleClose() {
      this.$emit('cancel')
    },
    // 重置弹出框
    reset(message) {
      this.$parent.$parent.$parent.$parent.$parent.$refs.asCom.getData()
      this.handleClose()
      this.$message({
        message: `${message}成功`,
        type: 'success'
      })
      // Object.keys(this.form).forEach(key => {
      //   this.form[key] = ''
      // })
      // setTimeout(() => {
      //   this.$emit('reload')
      // }, 500)
    }
  }
}
</script>
<style lang="scss">
.twoTable {
  width: 860px;
  margin: 0 20px;

  .el-drawer__header {
    margin-bottom: 0 !important;
  }

  thead {
    line-height: 50px;
    text-align: center;
    font-weight: 700;
  }

  tbody {
    line-height: 32px;

    .input {
      input {
        border: none;
      }
    }

    .width40 {
      width: 56px;
      padding: 0 20px;
      box-sizing: border-box;
    }

    .center {
      text-align: center;
    }

    .text-indent {
      text-indent: 20px;
    }

    .signature {
      td {
        padding: 5px;
        box-sizing: border-box;
      }

      .el-input {
        width: 120px;
      }

      .el-input__inner {
        width: 120px;
      }
    }
  }
}

.netLoss,
.costEstimator {
  &::before {
    content: "*";
    color: #f56c6c;
    margin-right: 4px;
  }
}

.table-btn {
  margin-top: 10px;
  text-align: center;
}
</style>