<template> 
 | 
  <!-- <TableLayout> --> 
 | 
  <keep-alive><TableLayout v-permissions="['ext:plansext:query']"> 
 | 
    <!-- 搜索表单 --> 
 | 
    <el-form slot="search-form" ref="searchForm" :model="searchForm" label-suffix=":" label-width="110px" inline> 
 | 
      <el-form-item label="搜索信息" prop="mixParam"> 
 | 
        <el-input v-model="searchForm.mixParam" placeholder="请输入物料名称/编码/工序名称" @keypress.enter.native="search"></el-input> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="成品计划" prop="workPlanCode"> 
 | 
        <el-input v-model="searchForm.workPlanCode" placeholder="请输入成品计划编码" @keypress.enter.native="search"></el-input> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="计划状态" prop="status"> 
 | 
        <el-select v-model="searchForm.status" placeholder="全部"> 
 | 
          <el-option 
 | 
            v-for="item in status" 
 | 
            :key="item.id" 
 | 
            :label="item.name" 
 | 
            :value="item.id"> 
 | 
          </el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="计划类型" prop="type"> 
 | 
        <el-select v-model="searchForm.type" placeholder="全部"> 
 | 
          <el-option 
 | 
            v-for="item in type" 
 | 
            :key="item.id" 
 | 
            :label="item.name" 
 | 
            :value="item.id"> 
 | 
          </el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="工厂" prop="factoryId"> 
 | 
        <el-select v-model="searchForm.factoryId" placeholder="请选择" clearable filterable @change="selectFactroy"> 
 | 
          <el-option 
 | 
            v-for="item in factories" 
 | 
            :key="item.id" 
 | 
            :label="item.name" 
 | 
            :value="item.id"> 
 | 
          </el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="工序" prop="procedureIdList"> 
 | 
        <el-select v-model="searchForm.procedureIdList" multiple :disabled="!searchForm.factoryId" clearable filterable placeholder="请选择"> 
 | 
          <el-option 
 | 
            v-for="item in productes" 
 | 
            :key="item.id" 
 | 
            :label="item.name" 
 | 
            :value="item.id"> 
 | 
          </el-option> 
 | 
        </el-select> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="批次号" prop="batch"> 
 | 
        <el-input v-model="searchForm.batch" placeholder="请输入" @keypress.enter.native="search"></el-input> 
 | 
      </el-form-item> 
 | 
      <el-form-item label="计划结束日期" prop="planDate"> 
 | 
        <el-date-picker 
 | 
          value-format="yyyy-MM-dd" 
 | 
          v-model="time" 
 | 
          type="daterange" 
 | 
          range-separator="至" 
 | 
          start-placeholder="开始日期" 
 | 
          end-placeholder="结束日期" 
 | 
          @change="selectDate" 
 | 
        ></el-date-picker> 
 | 
      </el-form-item> 
 | 
      <section> 
 | 
        <el-button type="primary" @click="search">搜索</el-button> 
 | 
        <el-button @click="reset">重置</el-button> 
 | 
      </section> 
 | 
    </el-form> 
 | 
    <!-- 表格和分页 --> 
 | 
    <template v-slot:table-wrap> 
 | 
      <ul class="toolbar"> 
 | 
        <!-- <li v-permissions="['ext:plansext:importExcel']"> 
 | 
          <ImportButton 
 | 
            text="导入" 
 | 
            template-name="plans_import_template.xlsx" 
 | 
            template-path="template/plans_import_template.xlsx" 
 | 
            action="/ext/plansExt/importBatch" 
 | 
            @success="search" 
 | 
          /> 
 | 
        </li> --> 
 | 
        <!-- <li v-permissions="['ext:plansext:create']"><el-button type="primary" @click="$refs.operaPlansExtWindow.open('新建生产计划')" >新建</el-button></li> --> 
 | 
        <!-- <li v-permissions="['ext:plansext:publish']"><el-button type="primary" @click="planRelease" >发布</el-button></li> --> 
 | 
        <li v-permissions="['ext:plansext:distribute']"><el-button type="primary" @click="plansDistribute">批量分配</el-button></li> 
 | 
        <li v-permissions="['ext:plansext:exportExcel']"><el-button type="primary" :loading="isWorking.export" @click="exportExcel">导出</el-button></li> 
 | 
        <!-- <li v-permissions="['ext:plansext:planpink']"><el-button type="primary" @click="$refs.operaWTransferExtWindow.open('计划领料')">计划领料</el-button></li> --> 
 | 
        <!-- <li v-permissions="['ext:plansext:stockpink']"><el-button type="primary" @click="$refs.operaPlanStaock.open('库存领料')">库存领料</el-button></li> --> 
 | 
        <!-- <li v-permissions="['ext:plansext:delete']"><el-button type="danger" plain @click="deleteByIdInBatch">批量删除</el-button></li> --> 
 | 
        <span></span> 
 | 
      </ul> 
 | 
      <el-table 
 | 
        v-loading="isWorking.search" 
 | 
        :data="tableData.list" 
 | 
        stripe 
 | 
        border 
 | 
        :summary-method="getSummaries" 
 | 
        show-summary 
 | 
        @selection-change="handleSelectionChange" 
 | 
        @row-style="rowStyle" 
 | 
      > 
 | 
        <el-table-column type="selection" fixed="left" width="55"></el-table-column> 
 | 
        <el-table-column prop="id" label="计划序号" fixed="left" min-width="100px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span>{{ row.id }}</span><el-tag type="danger" size="mini" v-if="row.hasExpire">延期</el-tag> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="mmodel.name" fixed="left" label="物料名称" show-overflow-tooltip min-width="140px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <el-button type="text" class="materail" @click="showPlan(row.id)"> 
 | 
              <div class="long-title-style">{{ row.mmodel.name }}</div> 
 | 
            </el-button> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="mmodel.code" label="物料编码" min-width="160px"> 
 | 
        </el-table-column> 
 | 
         
 | 
        <el-table-column prop="fmodel.name" label="工厂" min-width="100px"></el-table-column> 
 | 
        <el-table-column prop="pmodel.name" label="工序" show-overflow-tooltip min-width="100px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span class="long-title-style">{{ row.pmodel ? row.pmodel.name : '-' }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="batch" label="生产批次号" show-overflow-tooltip min-width="140px"></el-table-column> 
 | 
        <el-table-column prop="num" label="计划数量" min-width="100px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span>{{ row.num + (row.umodel ? row.umodel.name : '') }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="workPlanStartDate" label="计划开始日期" min-width="100px"> 
 | 
          <!-- <template slot-scope="{row}"> 
 | 
            {{ row.workPlanStartDate ? row.workPlanStartDate.substring(0, row.workPlanStartDate.length-9) : '-' }} 
 | 
          </template> --> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="workPlanEndDate" label="计划结束日期" min-width="100px"> 
 | 
          <!-- <template slot-scope="{row}"> 
 | 
            {{ row.workPlanEndDate ? row.workPlanEndDate.substring(0, row.workPlanEndDate.length-9) : '-' }} 
 | 
          </template> --> 
 | 
        </el-table-column> 
 | 
         
 | 
        <el-table-column label="计划状态" min-width="80px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            {{ statusToStr(row.status) }} 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="distributNoDoneNum" label="已分配未报工数量" min-width="140px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span>{{row.distributNoDoneNum ? (row.distributNoDoneNum + (row.umodel ? row.umodel.name : '')) : '-' }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="qulifiedNum" label="合格数量" min-width="100px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span>{{row.qulifiedNum ? (row.qulifiedNum + (row.umodel ? row.umodel.name : '')) : '-' }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="unqulifiedNum" label="不良数量" min-width="100px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span>{{row.unqulifiedNum ? (row.unqulifiedNum + (row.umodel ? row.umodel.name : '')) : '-' }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="urgent" label="优先级" min-width="60px"></el-table-column> 
 | 
        <el-table-column label="暂停" min-width="60px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            {{ row.paused == 0 ? '否' : '是' }} 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="workPlanCode" label="主计划编码" min-width="140px"></el-table-column> 
 | 
        <el-table-column label="类型" min-width="80px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span :style="typeColor(row.type)">{{ typeToStr(row.type) }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="publishDate" label="发布日期" min-width="100px"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <span>{{ row.publishDate || '-' }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column prop="userId" label="计划员" min-width="160px"> 
 | 
          <template slot-scope="{row}"> 
 | 
           <span class="long-title-style"> {{ row.usermodel.realname + " " + row.usermodel.mobile }}</span> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
        <el-table-column 
 | 
          label="操作" 
 | 
          min-width="100px" 
 | 
          fixed="right"> 
 | 
          <template slot-scope="{row}"> 
 | 
            <!-- 0已生成、1已发布、2已撤回、3已取消、4已分配、5已暂停、6已完工、7已入库、8已关闭 --> 
 | 
            <el-button v-if="row.status==0&&tempPremission('ext:plansext:publish')" type="text" @click="publishById(row.id)">发布</el-button> 
 | 
            <!-- <el-button v-if="(row.status==1||row.status==4)" type="text" @click="distrubution(row)">分配</el-button> --> 
 | 
            <!--  --> 
 | 
            <el-button v-if="(row.status==1||row.status==4)&&(row.num-row.distributNum>0)&&tempPremission('ext:plansext:distribute')" type="text" @click="distrubution(row)">分配</el-button> 
 | 
            <el-button v-if="row.status==4&&row.paused==0&&tempPremission('ext:plansext:control')" type="text" @click="planPauseById(row.id)">暂停</el-button> 
 | 
            <el-button v-if="row.status==4&&row.paused==1&&tempPremission('ext:plansext:control')" type="text" @click="planRegainById(row.id)">恢复</el-button> 
 | 
            <!-- <el-button v-if="row.status==4||row.status==5&&tempPremission('ext:plansext:control')" type="text" @click="planCloseById(row.id)">关闭</el-button> --> 
 | 
            <el-button v-if="row.status==0&&tempPremission('ext:plansext:update')" type="text" @click="$refs.operaPlansExtWindow.open('编辑生产计划', row)">编辑</el-button> 
 | 
            <span v-if="row.status==0||row.status==1&&tempPremission('ext:plansext:delete')" style="margin-left:8px"> 
 | 
              <!-- <el-button type="text" @click="deleteById(row)">删除</el-button> --> 
 | 
            </span> 
 | 
            <!-- <span v-if="row.status==4&&tempPremission('ext:plansext:control')" style="margin-left:8px"> 
 | 
              <el-button type="text" @click="cancelPlan(row)">取消</el-button> 
 | 
            </span> --> 
 | 
            <el-button v-if="row.status==3||row.status==6||row.status==8" type="text">-</el-button> 
 | 
          </template> 
 | 
        </el-table-column> 
 | 
      </el-table> 
 | 
      <pagination 
 | 
        @size-change="handleSizeChange" 
 | 
        @current-change="handlePageChange" 
 | 
        :pagination="tableData.pagination" 
 | 
      ></pagination> 
 | 
    </template> 
 | 
    <!-- 新建/修改 --> 
 | 
    <OperaPlansExtWindow ref="operaPlansExtWindow" @success="handlePageChange"/> 
 | 
    <OperaPlansDetailExtWindow ref="operaPlansDetailExtWindow" @success="handlePageChange"/> 
 | 
    <OperaPlansExtFromWindow ref="operaPlansExtFromWindow" @success="distrubuted"/> 
 | 
    <OperaWTransferExtWindow ref="operaWTransferExtWindow" @success="handlePageChange"/> 
 | 
    <OrderDistrubution ref="orderDistrubution" @success="distrubuted"/> 
 | 
    <OperaPlanStaock ref="operaPlanStaock" @success="handlePageChange"/> 
 | 
    <el-dialog 
 | 
      title="发布" 
 | 
      :visible.sync="dialogRelease" 
 | 
      width="30%" 
 | 
      left 
 | 
    > 
 | 
      确定发布选中计划吗? 
 | 
      <span slot="footer" class="dialog-footer"> 
 | 
        <el-button @click="dialogRelease = false">取 消</el-button> 
 | 
        <el-button type="primary" :disabled="isLoading" :icon="isLoading ? 'el-icon-loading' : ''" @click="submit">确 定</el-button> 
 | 
      </span> 
 | 
    </el-dialog> 
 | 
  </TableLayout></keep-alive> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
import BaseTable from '@/components/base/BaseTable' 
 | 
import TableLayout from '@/layouts/TableLayout' 
 | 
import Pagination from '@/components/common/Pagination' 
 | 
import ImportButton from '@/components/common/ImportButton' 
 | 
import OperaPlansExtWindow from '@/components/ext/OperaPlansExtWindow' 
 | 
import OperaPlansDetailExtWindow from '@/components/ext/OperaPlansDetailExtWindow' 
 | 
import OperaPlansExtFromWindow from '@/components/ext/OperaPlansExtFromWindow' 
 | 
import OperaWTransferExtWindow from '@/components/ext/OperaWTransferExtWindow' 
 | 
import OrderDistrubution from '@/components/ext/OrderDistrubution' 
 | 
import OperaPlanStaock from '@/components/ext/OperaPlanStaock' 
 | 
import { publish, cancelById, pauseById, regainById, closeById, planDetailById } from '@/api/ext/plansExt' 
 | 
import { getDepartmentListByConditon } from '@/api/ext/departmentExt' 
 | 
import { productesGroup } from '@/api/ext/proceduresExt' 
 | 
import { addPrecision } from '@/utils/util' 
 | 
export default { 
 | 
  name: 'PlansExt', 
 | 
  extends: BaseTable, 
 | 
  components: { 
 | 
    TableLayout, 
 | 
    OrderDistrubution, 
 | 
    Pagination, 
 | 
    ImportButton, 
 | 
    OperaPlansExtWindow, 
 | 
    OperaPlansDetailExtWindow, 
 | 
    OperaPlansExtFromWindow, 
 | 
    OperaWTransferExtWindow, 
 | 
    OperaPlanStaock 
 | 
  }, 
 | 
  data () { 
 | 
    return { 
 | 
      time: [], 
 | 
      status: [ 
 | 
        // 0已生成、1已发布、2已撤回、3已取消、4已分配、5已暂停、6已完工、8已关闭 
 | 
        { name: '已生成', id: 0 }, 
 | 
        { name: '已发布', id: 1 }, 
 | 
        { name: '已撤回', id: 2 }, 
 | 
        { name: '已取消', id: 3 }, 
 | 
        { name: '已分配', id: 4 }, 
 | 
        { name: '已暂停', id: 5 }, 
 | 
        { name: '已完工', id: 6 }, 
 | 
        { name: '已关闭', id: 8 } 
 | 
      ], 
 | 
      type: [ 
 | 
        { name: '正常', id: 0 }, 
 | 
        { name: '返工返修', id: 2 }, 
 | 
      ], 
 | 
      dialogRelease: false, 
 | 
      dialogwithdraw: false, 
 | 
      dialogimport: false, 
 | 
      ruleForms: { 
 | 
        time: '' 
 | 
      }, 
 | 
      isLoading: false, 
 | 
      factories: [], 
 | 
      productes: [], 
 | 
      // 搜索 
 | 
      searchForm: { 
 | 
        procedureIdList: [], 
 | 
        procedureId: null, 
 | 
        factoryId: null, 
 | 
        status: null, 
 | 
        mixParam: null, 
 | 
        planDateStartDate: null, 
 | 
        planDateEndDate: null, 
 | 
        batch: null, 
 | 
        type: null, 
 | 
        workPlanCode: null 
 | 
      } 
 | 
    } 
 | 
  }, 
 | 
  provide() { 
 | 
    return { 
 | 
      factories: () => this.factories 
 | 
    } 
 | 
  }, 
 | 
  created () { 
 | 
    this.config({ 
 | 
      module: '生产计划', 
 | 
      api: '/ext/plansExt', 
 | 
      'field.id': 'id', 
 | 
      'field.main': 'name', 
 | 
      sorts: [{ direction: 'DESC', property: 'CREATE_TIME' }] 
 | 
    }) 
 | 
    this.search() 
 | 
  }, 
 | 
  activated() { 
 | 
    getDepartmentListByConditon({ 
 | 
      type: 1 
 | 
    }).then(res => { 
 | 
      this.factories = res 
 | 
    }).catch(err => { 
 | 
      console.log(err) 
 | 
    }) 
 | 
  }, 
 | 
  methods: { 
 | 
    selectDate (v) { 
 | 
      this.searchForm.planDateStartDate = v[0] 
 | 
      this.searchForm.planDateEndDate = v[1] 
 | 
      this.search() 
 | 
    }, 
 | 
    selectFactroy (v) { 
 | 
      this.searchForm.procedureIdList = [] 
 | 
      productesGroup({ orgId: v }) 
 | 
        .then(res => { 
 | 
          this.productes = res 
 | 
        }) 
 | 
        .catch(err => { 
 | 
          console.log(err) 
 | 
        }) 
 | 
    }, 
 | 
    reset () { 
 | 
      this.$refs.searchForm.resetFields() 
 | 
      this.searchForm.planDateStartDate = null 
 | 
      this.searchForm.planDateEndDate = null 
 | 
      this.time = [] 
 | 
      this.search() 
 | 
    }, 
 | 
    planRelease () { 
 | 
      if (this.tableData.selectedRows.length === 0) { 
 | 
        this.$tip.warning('请至少选择一条数据') 
 | 
        return 
 | 
      } 
 | 
      for (const item of this.tableData.selectedRows) { 
 | 
        if (item.status !== 0) { 
 | 
          this.$tip.warning('只有已创建状态可以发布') 
 | 
          return 
 | 
        } 
 | 
      } 
 | 
      this.dialogRelease = true 
 | 
    }, 
 | 
    distrubution (row) { 
 | 
      this.$refs.orderDistrubution.open('分配工单', row) 
 | 
    }, 
 | 
    submit () { 
 | 
      this.dialogRelease = false 
 | 
      const query = '?ids=' + this.tableData.selectedRows.map(row => row.id).join(',') 
 | 
      this.publishAction(query) 
 | 
    }, 
 | 
    cancelPlan (row) { 
 | 
      this.$confirm('确认取消当前的计划?', '确认取消', { 
 | 
        distinguishCancelAndClose: true, 
 | 
        confirmButtonText: '确认', 
 | 
        cancelButtonText: '取消' 
 | 
      }) 
 | 
        .then(() => { 
 | 
          this.isWorking.delete = true 
 | 
          cancelById({ id: row.id }) 
 | 
            .then(() => { 
 | 
              this.handlePageChange() 
 | 
            }) 
 | 
            .catch(e => { 
 | 
              this.$tip.apiFailed(e) 
 | 
            }) 
 | 
            .finally(() => { 
 | 
              this.isWorking.delete = false 
 | 
            }) 
 | 
        }) 
 | 
        .catch(() => {}) 
 | 
    }, 
 | 
    publishById (id) { 
 | 
      this.$confirm('确认发布当前的计划?', '确认发布', { 
 | 
        distinguishCancelAndClose: true, 
 | 
        confirmButtonText: '确认', 
 | 
        cancelButtonText: '放弃' 
 | 
      }) 
 | 
        .then(() => { 
 | 
          this.publishAction('?ids=' + id) 
 | 
        }) 
 | 
        .catch(() => {}) 
 | 
    }, 
 | 
    publishAction (query) { 
 | 
      this.isWorking.delete = true 
 | 
      publish(query) 
 | 
        .then(() => { 
 | 
          this.handlePageChange() 
 | 
        }) 
 | 
        .catch(e => { 
 | 
          this.$tip.apiFailed(e) 
 | 
        }) 
 | 
        .finally(() => { 
 | 
          this.isWorking.delete = false 
 | 
        }) 
 | 
    }, 
 | 
    planPauseById (id) { 
 | 
      this.$confirm('确认暂停当前的计划?', '确认暂停', { 
 | 
        distinguishCancelAndClose: true, 
 | 
        confirmButtonText: '确认', 
 | 
        cancelButtonText: '放弃' 
 | 
      }) 
 | 
        .then(() => { 
 | 
          this.isWorking.delete = true 
 | 
          pauseById({ id }) 
 | 
            .then(() => { 
 | 
              this.$tip.success('暂停成功') 
 | 
              this.search() 
 | 
            }) 
 | 
            .catch(err => { 
 | 
              this.$tip.error(err) 
 | 
            }) 
 | 
        }) 
 | 
        .catch(() => {}) 
 | 
    }, 
 | 
    planRegainById (id) { 
 | 
      this.$confirm('确认恢复当前的计划?', '确认恢复', { 
 | 
        distinguishCancelAndClose: true, 
 | 
        confirmButtonText: '确认', 
 | 
        cancelButtonText: '放弃' 
 | 
      }) 
 | 
        .then(() => { 
 | 
          this.isWorking.delete = true 
 | 
          regainById({ id }) 
 | 
            .then(() => { 
 | 
              this.$tip.success('恢复成功') 
 | 
              this.search() 
 | 
            }) 
 | 
            .catch(err => { 
 | 
              this.$tip.error(err) 
 | 
            }) 
 | 
        }) 
 | 
        .catch(() => {}) 
 | 
    }, 
 | 
    rowStyle({row, rowIndex}) { 
 | 
      console.log('1'); 
 | 
      return { height: 20} 
 | 
    }, 
 | 
    planCloseById (id) { 
 | 
      this.$confirm('确认关闭当前的计划?', '确认关闭', { 
 | 
        distinguishCancelAndClose: true, 
 | 
        confirmButtonText: '确认', 
 | 
        cancelButtonText: '放弃' 
 | 
      }) 
 | 
        .then(() => { 
 | 
          this.isWorking.delete = true 
 | 
          closeById({ id }) 
 | 
            .then(() => { 
 | 
              this.$tip.success('关闭成功') 
 | 
              this.search() 
 | 
            }) 
 | 
            .catch(err => { 
 | 
              this.$tip.error(err) 
 | 
            }) 
 | 
        }) 
 | 
        .catch(() => {}) 
 | 
    }, 
 | 
    plansDistribute () { 
 | 
      if (this.tableData.selectedRows.length === 0) { 
 | 
        this.$tip.warning('请至少选择一条数据') 
 | 
        return 
 | 
      } 
 | 
      let procedureId = this.tableData.selectedRows[0].procedureId 
 | 
      for (const item of this.tableData.selectedRows) { 
 | 
        if (item.status !== 4 && item.status !== 1) { 
 | 
          this.$tip.warning('只有已发布或已分配状态可以分配') 
 | 
          return 
 | 
        } 
 | 
        // if (procedureId !== item.procedureId) { 
 | 
        //   this.$tip.warning('只能对同工序计划批量分配') 
 | 
        //   return 
 | 
        // } 
 | 
      } 
 | 
      this.$refs.operaPlansExtFromWindow.open('批量分配', this.tableData.selectedRows) 
 | 
    }, 
 | 
    statusToStr (satus) { 
 | 
      for (const item of this.status) { 
 | 
        if (item.id === satus) { 
 | 
          return item.name 
 | 
        } 
 | 
      } 
 | 
    }, 
 | 
    deleteById (row) { 
 | 
      this.$confirm('是否删除该条生产计划?', '提示', { 
 | 
        confirmButtonText: '确定', 
 | 
        cancelButtonText: '取消', 
 | 
        type: 'warning' 
 | 
      }).then(() => { 
 | 
        this.isWorking.delete = true 
 | 
        this.api.deleteById(row[this.configData['field.id']]) 
 | 
          .then(() => { 
 | 
            this.__afterDelete() 
 | 
          }) 
 | 
          .catch(e => { 
 | 
            this.$tip.apiFailed(e) 
 | 
          }) 
 | 
          .finally(() => { 
 | 
            this.isWorking.delete = false 
 | 
          }) 
 | 
      }).catch(() => {}) 
 | 
    }, 
 | 
    showPlan (id) { 
 | 
      planDetailById(id) 
 | 
        .then(res => { 
 | 
          // console.log(res) 
 | 
          this.$refs.operaPlansDetailExtWindow.open('详情', res) 
 | 
        }) 
 | 
        .catch(err => { 
 | 
          this.$tip.error(err) 
 | 
        }) 
 | 
    }, 
 | 
    typeToStr (type) { 
 | 
      for (const item of this.type) { 
 | 
        if (item.id === type) { 
 | 
          return item.name 
 | 
        } 
 | 
      } 
 | 
      return '-' 
 | 
    }, 
 | 
    typeColor (type) { 
 | 
      // { name: '正常', id: 0 }, 
 | 
        // { name: '返工返修', id: 2 }, 
 | 
        // $nav-stateColor1: #305ED5; 
 | 
        //     $nav-stateColor2: #03AF76; 
 | 
        //     $nav-stateColor4: #DE5243; 
 | 
        //     $nav-stateColor5: #F5A400; 
 | 
      switch (type) { 
 | 
        case 0 : return 'color: #03AF76' 
 | 
        case 2 : return 'color: #F5A400' 
 | 
        default: return 'color: #111111' 
 | 
      } 
 | 
    }, 
 | 
    // 权限判断 
 | 
    tempPremission (permissions) { 
 | 
      let allPremission = this.$store.state.userInfo.permissions 
 | 
       
 | 
      for (const item of allPremission) { 
 | 
        if (item === permissions) { 
 | 
          return true 
 | 
        } 
 | 
      } 
 | 
      return false 
 | 
    }, 
 | 
    distrubuted() { 
 | 
      setTimeout(()=>{ 
 | 
        this.handlePageChange() 
 | 
      },500) 
 | 
    }, 
 | 
    getSummaries (param) { 
 | 
      const { columns, data } = param; 
 | 
      const sums = []; 
 | 
      columns.forEach((column, index) => { 
 | 
        if (index === 0) { 
 | 
          sums[index] = '合计'; 
 | 
          return; 
 | 
        } else if (index === 1 || index === 6 || index === 8 || index === 9 || index === 14 || index === 16 || index === 17) { 
 | 
          sums[index] = '-'; 
 | 
          return; 
 | 
        } else if (index === 8 ) { 
 | 
          sums[index] = '-'; 
 | 
          return; 
 | 
        } 
 | 
        const values = data.map(item => Number(item[column.property])); 
 | 
        if (!values.every(value => isNaN(value))) { 
 | 
          sums[index] = 0 
 | 
          values.forEach(item => { 
 | 
            sums[index] = addPrecision(item, sums[index]) 
 | 
          }) 
 | 
        } else { 
 | 
          sums[index] = '-'; 
 | 
        } 
 | 
      }); 
 | 
      return sums 
 | 
    } 
 | 
  } 
 | 
} 
 | 
  
 | 
</script> 
 | 
<style lang="scss" scoped> 
 | 
.materail { 
 | 
  max-width: 120px; 
 | 
} 
 | 
.import{ 
 | 
  float: right; 
 | 
} 
 | 
span{ 
 | 
  clear: both; 
 | 
} 
 | 
.btn{ 
 | 
  a{ 
 | 
    margin-left: 20px; 
 | 
  } 
 | 
} 
 | 
</style> 
 |