1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348 |
- <template>
- <div class="app-container" style="width: 100%;">
- <el-tabs type="border-card" @tab-click="tabClick" v-model="selectedWorkshop">
- <!--南车间-->
- <el-tab-pane label="南车间计划" name="南车间">
- <!--表格-->
- <el-table
- :data="tableData"
- ref="tableRef"
- :span-method="spanMethod2">
- <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
- <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center" width="111.2px"></el-table-column>
- <el-table-column label="在机产品" header-align="center" >
- <el-table-column prop="productTypeName" fixed label="产品类型" header-align="center" align="center" width="111.2px"></el-table-column>
- <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentLotNumber" label="批号" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
- </el-table-column>
- <!-- <el-table-column label="待上机产品" header-align="center" align="center">-->
- <!-- <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
- <!-- <el-table-column prop="djCurrentSpecification" label="规格" header-align="center" align="center"></el-table-column>-->
- <!-- <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
- <!-- <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
- <!-- </el-table-column>-->
- <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center" >
- <template slot-scope="scope">
- <div v-if="scope.row.listOfPendingProduction">
- <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
- {{ item }},
- <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
- </span>
- </div>
- </template>
- </el-table-column>
- <el-table-column fixed="right" label="操作" header-align="center" align="center" width="150px" >
- <template slot-scope="scope">
- <el-dropdown>
- <el-button type="primary">
- 操作
- <i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>
- <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>
- <el-dropdown-item @click.native.prevent="handleStopProductionLine(scope.row)">机台状态</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
- </el-table>
- <!--新增计划弹窗-->
- <el-dialog title="南车间新增计划" :visible.sync="nanInsertDialogTableVisible" width="1200px">
- <el-table :data="tableData2" @row-click.self="handleRowClick">
- <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
- <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.currentColorCode" filterable placeholder="请选择母粒编码" @change="selectedML(scope.row)">
- <el-option
- v-for="(item,index) in options"
- :key="index"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- <!-- <!– 如果当前行正在编辑,则显示输入框 –>-->
- <!-- <el-input v-if="scope.row.isEditing" v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>-->
- <!-- <!– 否则显示普通文本 –>-->
- <!-- <span v-else>{{ scope.row.currentColorCode }}</span>-->
- </template>
- </el-table-column>
- <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
- <template v-slot:default="scope">
- <!-- 如果当前行正在编辑,则显示输入框 -->
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <!-- 否则显示普通文本 -->
- <span v-else>{{ scope.row.currentSpecification }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="productType" label="产品类别" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.productType" placeholder="请选择产品类别" >
- <el-option v-for="product in productTypeList" :key="product.value" :label="product.lable" :value="product.value" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :disabled="isDisabled" v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentLotNumber }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.currentSpindleCount" placeholder="请输入锭数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentSpindleCount }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="djNumber" label="数量" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.number" placeholder="请输入数量" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.number }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.startTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.plannedEndTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.planStatus" placeholder="计划状态">
- <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="handleDelete(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button type="primary" style="width: 100%;margin-top: 30px" @click="addEditableRow">新增计划产品</el-button>
- <span slot="footer" class="dialog-footer">
- <el-button @click="nanInsertDialogTableVisible = false">取 消</el-button>
- <el-button type="primary" @click="addPlanInfo">确 定</el-button>
- </span>
- </el-dialog>
- <!--修改计划弹窗-->
- <el-dialog title="修改计划" :visible.sync="nanUpdateDialogTableVisible" width="1400px">
- <!--查询条件-->
- <el-form ref="form" :model="formData" label-width="80px" :inline="true">
- <el-form-item label="产品类别:">
- <el-select v-model="formData.productType" placeholder="请选择产品类别">
- <el-option v-for="product in productTypeList" :key="product.value" :label="product.lable" :value="product.value" ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="计划状态:">
- <el-select v-model="formData.planStatus" placeholder="请选择计划状态">
- <el-option v-for="stateListItem in stateList2" :key="product.id" :label="stateListItem.name" :value="stateListItem.id" ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="onSubmit">查询</el-button>
- <el-button @click="reset">重置</el-button>
- </el-form-item>
- </el-form>
- <!--表格-->
- <el-table :data="tableData2" @row-click.self="handleRowClick">
- <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
- <template slot-scope="scope">
- {{ getProductChineseName(scope.row.productId) }}
- </template>
- </el-table-column>
- <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
- <template v-slot:default="scope">
- <!-- 如果当前行正在编辑,则显示输入框 -->
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
- <!-- 否则显示普通文本 -->
- <span v-else>{{ scope.row.currentColorCode }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
- <template v-slot:default="scope">
- <!-- 如果当前行正在编辑,则显示输入框 -->
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <!-- 否则显示普通文本 -->
- <span v-else>{{ scope.row.currentSpecification }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="productType" label="产品类别" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.productType" placeholder="请选择产品类别" >
- <el-option v-for="product in productTypeList" :key="product.value" :label="product.lable" :value="product.value" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentLotNumber }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.currentSpindleCount" placeholder="请输入锭数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentSpindleCount }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="number" label="数量" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.number" placeholder="请输入数量" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.number }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.startTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.plannedEndTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <!--上机变停机待机-->
- <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态">
- <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- <!--待机可以上机-->
- <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" >
- <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- <!--停机变上机-->
- <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" >
- <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="200px">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="updateStatus(scope.$index, scope.row)">更新状态</el-button>
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="deletePlan(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--操作按钮-->
- <span slot="footer" class="dialog-footer">
- <el-button @click="nanUpdateDialogTableVisible = false">取 消</el-button>
- <el-button type="primary" @click="nanUpdateDialogTableVisible = false">确 定</el-button>
- </span>
- </el-dialog>
- </el-tab-pane>
- <!--北车间-->
- <el-tab-pane label="北车间计划" name="北车间">
- <!--表格-->
- <el-table
- :data="tableData"
- ref="tableRef"
- :span-method="spanMethod2">
- <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
- <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center" width="111.2px"></el-table-column>
- <el-table-column label="在机产品" header-align="center" >
- <el-table-column prop="productTypeName" fixed label="产品类型" header-align="center" align="center" width="111.2px"></el-table-column>
- <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentLotNumber" label="批号" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
- <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
- </el-table-column>
- <!-- <el-table-column label="待上机产品" header-align="center" align="center">-->
- <!-- <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
- <!-- <el-table-column prop="djCurrentSpecification" label="规格" header-align="center" align="center"></el-table-column>-->
- <!-- <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
- <!-- <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
- <!-- </el-table-column>-->
- <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center" >
- <template slot-scope="scope">
- <div v-if="scope.row.listOfPendingProduction">
- <div v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
- {{ item }}
- <span v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1">,</span>
- <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column fixed="right" label="操作" header-align="center" align="center" width="150px" >
- <template slot-scope="scope">
- <el-dropdown>
- <el-button type="primary">
- 操作
- <i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>
- <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>
- <el-dropdown-item @click.native.prevent="handleStopProductionLine(scope.row)">机台状态</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- </el-table-column>
- </el-table>
- <!--新增计划弹窗-->
- <el-dialog title="北车间新增计划" :visible.sync="beiInsertDialogTableVisible" width="1200px">
- <el-table :data="tableData2" @row-click.self="handleRowClick">
- <!-- <el-table-column prop="salesmanId" label="业务员" header-align="center" align="center" width="100px">-->
- <!-- <template v-slot:default="scope">-->
- <!-- <el-select v-model="scope.row.salesmanId" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.salesmanId)">-->
- <!-- <el-option v-for="salesmanItem in salesmanInfo" :key="salesmanItem.saleNo" :label="salesmanItem.salesman" :value="salesmanItem.saleNo" ></el-option>-->
- <!-- </el-select>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.productId" placeholder="请选择待排产产品" @change="selectedChangeDate(scope.row,scope.row.productId)">
- <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.currentColorCode" filterable placeholder="请选择母粒编码">
- <el-option
- v-for="(item,index) in options"
- :key="index"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- <!-- <!– 如果当前行正在编辑,则显示输入框 –>-->
- <!-- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>-->
- <!-- <!– 否则显示普通文本 –>-->
- <!-- <span v-else>{{ scope.row.currentColorCode }}</span>-->
- </template>
- </el-table-column>
- <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
- <template v-slot:default="scope">
- <!-- 如果当前行正在编辑,则显示输入框 -->
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <!-- 否则显示普通文本 -->
- <span v-else>{{ scope.row.currentSpecification }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="productType" label="产品类别" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.productType" placeholder="请选择产品类别" >
- <el-option v-for="product in productTypeList" :key="product.value" :label="product.lable" :value="product.value" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :disabled="isDisabled" v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentLotNumber }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.currentSpindleCount" placeholder="请输入锭数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentSpindleCount }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="number" label="数量" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.number" placeholder="请输入数量" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.number }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.startTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.plannedEndTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.planStatus" placeholder="计划状态" >
- <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="操作" >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="handleDelete(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button type="primary" style="width: 100%;margin-top: 30px" @click="addEditableRow">新增计划产品</el-button>
- <span slot="footer" class="dialog-footer">
- <el-button @click="beiInsertDialogTableVisible = false">取 消</el-button>
- <el-button type="primary" @click="addPlanInfo">确 定</el-button>
- </span>
- </el-dialog>
- <!--修改计划弹窗-->
- <el-dialog title="北车间修改计划" :visible.sync="beiUpdateDialogTableVisible" width="1200px">
- <!--查询条件-->
- <el-form ref="form" :model="formData" label-width="80px" :inline="true">
- <el-form-item label="产品类别:">
- <el-select v-model="formData.productType" placeholder="请选择产品类别">
- <el-option v-for="(product,index) in productTypeList" :key="index" :label="product.lable" :value="product.value" ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="计划状态:">
- <el-select v-model="formData.planStatus" placeholder="请选择计划状态">
- <el-option v-for="stateListItem in stateList2" :key="product.id" :label="stateListItem.name" :value="stateListItem.id" ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="onSubmit">查询</el-button>
- <el-button @click="reset">重置</el-button>
- </el-form-item>
- </el-form>
- <!--表格-->
- <el-table :data="tableData2" @row-click.self="handleRowClick">
- <el-table-column prop="productId" label="产品" header-align="center" align="center" width="150px">
- <template slot-scope="scope">
- {{ getProductChineseName(scope.row.productId) }}
- </template>
- </el-table-column>
- <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center">
- <template v-slot:default="scope">
- <!-- 如果当前行正在编辑,则显示输入框 -->
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentColorCode" placeholder="请输入色号" @blur.stop.prevent="handleInputBlur(scope.row)" ></el-input>
- <!-- 否则显示普通文本 -->
- <span v-else>{{ scope.row.currentColorCode }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center">
- <template v-slot:default="scope">
- <!-- 如果当前行正在编辑,则显示输入框 -->
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" placeholder="请输入规格" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <!-- 否则显示普通文本 -->
- <span v-else>{{ scope.row.currentSpecification }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="productType" label="产品类别" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <el-select v-model="scope.row.productType" placeholder="请选择产品类别">
- <el-option v-for="product in productTypeList" :key="product.value" :label="product.lable" :value="product.value" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentLotNumber" placeholder="请输入批号" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentLotNumber }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.currentSpindleCount" placeholder="请输入锭数" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.currentSpindleCount }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="number" label="数量" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.number" placeholder="请输入数量" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.number }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="startTime" label="上机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" placeholder="请输入上机时间" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.startTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="plannedEndTime" label="计划下机时间" header-align="center" align="center">
- <template v-slot:default="scope">
- <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" placeholder="请输入计划下机时间" @blur="handleInputBlur(scope.row)">></el-input>
- <span v-else>{{ scope.row.plannedEndTime }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
- <template v-slot:default="scope">
- <!--上机变停机待机-->
- <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态" >
- <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- <!--待机可以上机-->
- <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" >
- <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- <!--停机变上机-->
- <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" >
- <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="200px">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="updateStatus(scope.$index, scope.row)">更新状态</el-button>
- <el-button
- size="mini"
- type="danger"
- @click.stop.prevent="deletePlan(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <span slot="footer" class="dialog-footer">
- <el-button @click="beiUpdateDialogTableVisible = false">取 消</el-button>
- <el-button type="primary" @click="beiUpdateDialogTableVisible = false">确 定</el-button>
- </span>
- </el-dialog>
- </el-tab-pane>
- <!--停机弹窗-->
- <el-dialog title="修改机台状态" :visible.sync="modifyMachineStatus" width="500px">
- <el-form :model="modifyMachineStatusFrom" ref="modifyMachineStatusFrom" label-width="100px" class="demo-ruleForm">
- <el-form-item label="机台状态" prop="type">
- <el-checkbox-group v-model="modifyMachineStatusFrom.type">
- <el-checkbox label="1" name="type">A面停机</el-checkbox>
- <el-checkbox label="2" name="type">B面停机</el-checkbox>
- </el-checkbox-group>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="confirmStopProductionLine">确定</el-button>
- <el-button @click="tjqx">取消</el-button>
- </el-form-item>
- </el-form>
- </el-dialog>
- </el-tabs>
- </div>
- </template>
- <script>
- import {
- ammunitionPlanInfo,
- getProductsInfo,
- removeBombLoadingPlan,
- getMaterielInfo,
- addMaterielInfo,
- getProductsAll,
- getAllPlanListByMachineId,
- getAllPlanListByProductTypeAndStatus,
- updatePlanOne,
- whetherTheFeederIsShutDown,
- updateLineStates,
- getIsTheOrderProductProduced,
- getJtIsTheOrderProductProduced,
- getCurrentProductionLineSuperior,
- updateSpinningInfoPlanOne
- } from "@/api/plan/paln.js";
- export default {
- data() {
- return {
- options: [],
- modifyMachineStatusFrom:{
- type: [],
- },
- modifyMachineStatus:false,
- //选中的是那个车间
- selectedWorkshop:"南车间",
- tableData:[],
- isDisabled:true,
- form: {
- product:"",
- },
- previousMachineId: undefined,
- currentRowspan: 1,
- prevRow: {},
- tableData2: [],
- nanInsertDialogTableVisible:false,
- nanUpdateDialogTableVisible:false,
- beiInsertDialogTableVisible:false,
- beiUpdateDialogTableVisible:false,
- editingRowIndex: -1,
- lastEditLine:0,
- queryParams:{ productionLineDepartment:"加弹部",
- productionLineWorkshop:"南车间"},
- isEditLine:false,
- productsInfo:[],
- salesmanInfo:[],
- product:{},
- materiel:{},
- // 机台号
- machineId:"",
- macId:"",//机台id
- // 待机/上机/停产
- stateList0:[
- {"id":0,"name":"待机"},
- {"id":1,"name":"上机"},
- ],
- stateList1:[
- {"id":0,"name":"待机"},
- {"id":2,"name":"停机"},
- {"id":1,"name":"上机"},
- ],
- stateList2:[
- {"id":0,"name":"待机"},
- {"id":2,"name":"停机"},
- {"id":1,"name":"上机"},
- ],
- formData:{
- updateSelectedProductCategory:"",
- updateSelectedProductState:""
- },
- // 产品类别
- productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
- }
- },
- mounted() {
- // 得到排产计划信息
- this.getAmmunitionPlanInfo();
- },
- methods: {
- tjqx(){
- this.modifyMachineStatus=false;
- },
- getProductChineseName(productId) {
- return this.productsInfo.find(product => product.id == productId).productName;
- },
- selectedML(row){
- console.log(row.currentColorCode)
- if(row.currentColorCode){
- let tarName=this.options.find(item=>item.value==row.currentColorCode).colourNumber
- console.log("aaaaa=============",tarName)
- row.colourNumber=tarName;
- console.log("aaaaa=============",row)
- }
- },
- //删除计划
- deletePlan($index,row){
- console.log(row)
- //判断当前计划是否已经投产
- getJtIsTheOrderProductProduced({"id":row.id}).then(resp=>{
- if(resp.data.length>0){
- this.$message({message: '当前计划订单产品在生产中已经不能删除', type: 'warning'});
- return;//证明有在上级的产品--zhi能有一个上级产品
- }
- removeBombLoadingPlan(row.id).then(res=>{
- if(res.code==200){
- this.$message({
- message: '删除成功',
- type: 'success'
- });
- }else{
- this.$message({message:"删除失败",type: 'error'})
- }
- this.onSubmit();
- this.getAmmunitionPlanInfo();
- })
- });
- },
- //打开修改机台信息
- handleStopProductionLine(row){
- this.modifyMachineStatus=true;
- this.machineId=row.machineId;
- this.macId=row.macId;//机台id
- //查询当前机台A、面B面的状态
- whetherTheFeederIsShutDown(this.macId).then(res=>{
- this.modifyMachineStatusFrom.type=res.data;
- })
- },
- //确认修改产线信息
- confirmStopProductionLine(){
- // console.log(this.modifyMachineStatusFrom.type);
- if(this.modifyMachineStatusFrom.type.length==0){
- this.modifyMachineStatusFrom.type.push("3")
- }
- //更改状态
- updateLineStates(this.macId,this.modifyMachineStatusFrom.type.join(",")).then(res=>{
- if(res.code==200){
- this.$message({
- message: '修改状态成功',
- type: 'success'
- });
- }else{
- this.$message({message:"修改状态成功",type: 'error'})
- }
- this.modifyMachineStatus=false;
- this.getAmmunitionPlanInfo();
- })
- // //如果为空代表都不停机
- // if(this.modifyMachineStatusFrom.type.length<=0){
- // this.modifyMachineStatus=false;
- // //发送请求删除,A面-timestampRandomCode="停机" B-timestampRandomCode="停机"的数据、并把所有上机产品的状态改为上机
- // return;
- // }
- // // 包含1A停机---插入一条 timestampRandomCode=停机,状态为停机的数据
- // if (this.modifyMachineStatusFrom.type.includes("1")) {
- // //查询当前机台A、面B面的状态
- // whetherTheFeederIsShutDown(this.machineId).then(res=>{
- // //后台没有虚拟的假数据,就插入
- // if(!res.data.includes("1")){
- // console.log('数组中不包含数字 1');
- // //新增一条数据,
- // let aStopInfo= {
- // currentColorCode: '1',
- // //产品规格
- // currentSpecification: '1',
- // currentLotNumber: '1',
- // currentSpindleCount: '1',
- // number: '1',
- // productType:'A面',
- // startTime: '1',
- // plannedEndTime:'1',
- // planStatus:2,
- // productId:'1',
- // machineId:this.machineId,
- // salesmanId:'1',
- // timestampRandomCode:"停机",
- // }
- // let aStoptableList=[];
- // aStoptableList.push(aStopInfo)
- // //时间戳
- // let data={
- // //机台号
- // machineId: this.machineId,
- // //计划信息
- // detailsOfTheRefuelingPlans: aStoptableList
- // }
- // //添加计划信息
- // addMaterielInfo(data).then(response => {
- // if (response.code == 200) {
- // this.$message({
- // message: '停机成功',
- // type: 'success'
- // });
- // this.getAmmunitionPlanInfo();
- // //最后把弹窗关掉
- // this.nanInsertDialogTableVisible=false
- // //更改订单投产信息的批号,
- // } else {
- // this.$message({
- // message: '停机失败,请联系管理员',
- // type: 'error'
- // });
- // //最后把弹窗关掉
- // this.nanInsertDialogTableVisible=false
- // }
- // });
- // }
- // })
- // }
- // if(this.modifyMachineStatusFrom.type.includes("2")) {
- // whetherTheFeederIsShutDown(this.machineId).then(res=>{
- // if(!res.data.includes("2")) {
- // console.log('数组中不包含数字2');
- // //新增一条数据,
- // let aStopInfo= {
- // currentColorCode: '1',
- // //产品规格
- // currentSpecification: '1',
- // currentLotNumber: '1',
- // currentSpindleCount: '1',
- // number: '1',
- // productType:'B面',
- // startTime: '1',
- // plannedEndTime:'1',
- // planStatus:2,
- // productId:'1',
- // machineId:this.machineId,
- // salesmanId:'1',
- // timestampRandomCode:"停机",
- // }
- // let aStoptableList=[];
- // aStoptableList.push(aStopInfo)
- // //时间戳
- // let data={
- // //机台号
- // machineId: this.machineId,
- // //计划信息
- // detailsOfTheRefuelingPlans: aStoptableList
- // }
- // //添加计划信息
- // addMaterielInfo(data).then(response => {
- // if (response.code == 200) {
- // this.$message({
- // message: '停机成功',
- // type: 'success'
- // });
- // this.getAmmunitionPlanInfo();
- // //最后把弹窗关掉
- // this.nanInsertDialogTableVisible=false
- // //更改订单投产信息的批号,
- // } else {
- // this.$message({
- // message: '停机失败,请联系管理员',
- // type: 'error'
- // });
- // //最后把弹窗关掉
- // this.nanInsertDialogTableVisible=false
- // }
- // });
- // }
- // })
- // }
- },
- // 查询排产信息
- getAmmunitionPlanInfo() {
- ammunitionPlanInfo(this.queryParams).then((response) => {
- this.tableData = response.data
- });
- },
- // 合并单元格
- spanMethod2({ row, column, rowIndex, columnIndex }) {
- //第二列合并
- if (columnIndex === 1) {
- if(row.productType == null) {
- return;
- }
- const prevRow2 = this.tableData[rowIndex - 1]; // 上一行数据
- let nextRow2 = this.tableData[rowIndex + 1]; // 下一行数据
- // 当上一行的数据(machineId和productType)等于当前行数据时,当前行单元格隐藏
- if (
- prevRow2 &&
- prevRow2.machineId === row.machineId &&
- prevRow2.productType === row.productType
- ) {
- return { rowspan: 0, colspan: 0 };
- } else {
- // 反之,则循环判断若下一行数据(machineId和productType)等于当前行数据,则当前行开始进行合并单元格
- let countRowspan2 = 1; // 用于合并计数多少单元格
- while (
- nextRow2 &&
- nextRow2.machineId === row.machineId &&
- nextRow2.productType === row.productType
- ) {
- nextRow2 = this.tableData[++countRowspan2 + rowIndex];
- }
- if (countRowspan2 > 1) {
- return { rowspan: countRowspan2, colspan: 1 };
- }
- }
- }
- //待生产列表
- if (columnIndex === 9) {
- const prevRow2 = this.tableData[rowIndex - 1] //上一行数据
- let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
- // 当上一行的数据等于当前行数据时,当前行单元格隐藏
- if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
- return;
- }
- if (prevRow2 &&
- prevRow2.machineId === row.machineId &&
- prevRow2.productType === row.productType
- ) {
- return { rowspan: 0, colspan: 0 }
- } else {
- // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
- let countRowspan2 = 1 //用于合并计数多少单元格
- while (nextRow2 &&
- nextRow2.listOfPendingProduction === row.listOfPendingProduction&&
- nextRow2.machineId === row.machineId &&
- nextRow2.productType === row.productType
- ) {
- nextRow2 = this.tableData[++countRowspan2 + rowIndex]
- }
- if (countRowspan2 > 1) {
- return { rowspan: countRowspan2, colspan: 1 }
- }
- }
- }
- //合并最后一列操作列
- const lastColumnIndex = this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
- if (columnIndex === lastColumnIndex && column.label === '操作') { // 判断是否为最后一列且标签为'操作'
- const machineIdColumnIndex = 0; // 机台号列的索引假定为0
- const currentMachineId = row.machineId;
- let countRowspan = 1;
- const prevRow = this.tableData[rowIndex - 1];
- if (prevRow && prevRow.machineId === currentMachineId) {
- return { rowspan: 0, colspan: 0 };
- } else {
- let nextRow = this.tableData[rowIndex + 1];
- while (
- nextRow &&
- nextRow.machineId === currentMachineId
- ) {
- nextRow = this.tableData[++countRowspan + rowIndex];
- }
- if (countRowspan > 1) {
- return { rowspan: countRowspan, colspan: 1 };
- }
- }
- }
- //第一列机台号合并
- if (columnIndex === 0) {
- //定义需要合并的列字段,有哪些列需要合并,就自定义添加字段即可
- const fields = ['machineId']
- // 当前行的数据
- const cellValue = row[column.property]
- let countRowspan = 1 //用于合并计数多少单元格
- // 判断只合并定义字段的列数据
- if (cellValue && fields.includes(column.property)) {
- const prevRow = this.tableData[rowIndex - 1] //上一行数据
- let nextRow = this.tableData[rowIndex + 1] //下一行数据
- // 当上一行的数据等于当前行数据时,当前行单元格隐藏
- if (prevRow && prevRow[column.property] === cellValue) {
- return { rowspan: 0, colspan: 0 }
- } else {
- // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
- let countRowspan = 1 //用于合并计数多少单元格
- while (nextRow && nextRow[column.property] === cellValue) {
- nextRow = this.tableData[++countRowspan + rowIndex]
- }
- if (countRowspan > 1) {
- return { rowspan: countRowspan, colspan: 1 }
- }
- }
- }
- }
- },
- getProductsInfo() {
- getProductsInfo("JT-").then((response) => {
- this.productsInfo = response.data;
- console.log("hmcxzz",this.productsInfo)
- this.productsInfo.forEach(item => {
- // item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
- item.productName = item.productName+"—"+item.colours;
- });
- })
- },
- // 下拉框数据改变查询色号批号信息
- selectedChangeDate(row,selectedProduct) {
- this.options=[];
- //选择的那个销售产品
- this.product = this.productsInfo.find(product => product.id === selectedProduct);
- this.form.product=selectedProduct;
- //通过母粒编码查询到对应的母粒信息
- let queryParams = {
- // "materielCode": this.product.colourNumber,
- "materielSpecies":"1"
- }
- //得到对应的母粒信息
- getMaterielInfo(queryParams).then((response) => {
- if (response.data!=null) {
- let mls = response.data
- mls.forEach(dataKey => {
- this.options.push({
- "label":dataKey.materieEncoding+"("+dataKey.materieColorNumber+")",
- "value":dataKey.materieEncoding+"("+dataKey.materieColorNumber+")",
- "colourNumber":dataKey.materielCode
- })
- });
- //色号 母粒编码+色号
- // row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
- }
- });
- //isDisabled(有批号就用,没批号就自己输入)
- if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
- row.currentLotNumber=this.product.lotNumber;
- this.isDisabled=true;
- }else {
- this.isDisabled=false;
- row.currentLotNumber="";
- }
- //产品规格
- row.currentSpecification= this.product.productSpecifications;
- //销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
- row.salesmanId=this.product.saleOrderNo;
- //数量
- row.number=this.product.productNumber;
- // console.log(this.product,'ddddddddddddddd')
- },
- // 新增计划产品信息
- handleAddPlan(row) {
- //查询当前机台A、面B面的状态(这个不用改,因为这个是唯一的)
- whetherTheFeederIsShutDown(row.macId).then(res=>{
- this.modifyMachineStatusFrom.type=res.data;
- if(this.modifyMachineStatusFrom.type.includes("2")&&this.modifyMachineStatusFrom.type.includes("1")){
- this.$message({
- message: 'AB都已停机请更改机台状态',
- type: 'warning'
- });
- return;
- }else {
- if(this.modifyMachineStatusFrom.type.includes("1")){
- this.productTypeList=[]
- this.productTypeList.push({value:"B面",lable:"B面"})
- }
- if(this.modifyMachineStatusFrom.type.includes("2")){
- this.productTypeList=[]
- this.productTypeList.push({value:"A面",lable:"A面"})
- }
- if(this.modifyMachineStatusFrom.type.length<=0){
- this.productTypeList=[]
- this.productTypeList.push({value:"A面",lable:"A面"})
- this.productTypeList.push({value:"B面",lable:"B面"})
- }
- //否则就打开弹窗添加计划
- if(this.selectedWorkshop=="南车间"){
- this.nanInsertDialogTableVisible = true
- }else{
- this.beiInsertDialogTableVisible = true
- }
- //查询可以添加的产品信息
- this.getProductsInfo();
- //清空添加的数组对象
- this.tableData2=[]
- //先清空
- this.machineId=""
- //当前操作机台号
- this.machineId=row.machineId;
- this.macId=row.macId;
- }
- })
- },
- // tab栏点击切换
- tabClick(tab, event) {
- // console.log('当前点击的标签名称:', tab.name);
- this.selectedWorkshop = tab.name;
- // productionLineName getProductionLineNo productionLineDepartment productionLineWorkshop
- this.queryParams.productionLineWorkshop = tab.name;
- this.getAmmunitionPlanInfo();
- },
- // 删除行
- handleDelete(index, row) {
- // console.log(index,row)
- // this.tableData2[a];
- this.tableData2.splice(index, 1);
- // 把上一编辑行置回-1
- this.editingRowIndex = -1;
- },
- // 点击编辑行
- handleRowClick(row) {
- // this.isEditLine = true;
- // // alert(this.lastEditLine+"编辑行")
- // //找到当前行的编辑索引
- // var rowIndex = this.tableData2.indexOf(row);
- //
- // if (this.lastEditLine != 0 &&
- // this.editingRowIndex !== rowIndex &&
- // this.editingRowIndex !== -1 &&
- // !this.isRowFilled(this.tableData2[this.lastEditLine])) {
- // this.$message({
- // message: '请先完成上一条数据的填写',
- // type: 'warning'
- // });
- // return;
- // }
- // //编辑索引不等于当前编辑行索引
- // if (this.editingRowIndex !== rowIndex) {
- // // alert(this.editingRowIndex);
- // if (this.editingRowIndex !== -1) {
- // //把当前行变成不可编辑的
- // this.tableData2[this.editingRowIndex].isEditing = false;
- // }
- // //把当前行变成可编辑的
- // row.isEditing = true;
- // this.editingRowIndex = rowIndex;
- // }
- },
- // 光标失去焦点变成不可编辑
- handleInputBlur(row) {
- // let rowIndex = this.tableData2.indexOf(row);
- // //编辑索引不等于当前编辑行索引
- // if (this.editingRowIndex !== rowIndex) {
- // if (this.isRowFilled(row)) {
- // row.isEditing = false;
- // //对于整个表格来说
- // this.isEditLine = false;
- // //当前编辑行置为-1
- // this.editingRowIndex = -1;
- // }
- // }
- },
- // 检查行是否填写完毕的示例方法
- isRowFilled(row) {
- return row.currentSpecification &&
- row.currentSpindleCount &&
- row.currentColorCode &&
- row.productType &&
- row.currentLotNumber &&
- row.number &&
- row.startTime &&
- row.plannedEndTime;
- },
- // 新增一行标记为可编辑
- addEditableRow() {
- // 检查当前编辑行是否已填写完毕
- if(this.tableData2.length!=0){
- if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
- this.$message({
- message: '请先完成上一条数据的填写',
- type: 'warning'
- });
- return;
- }
- //新增行之前先让以前的行不能编辑
- this.tableData2.forEach(item => {
- item.isEditing = false;
- })
- }
- this.tableData2.push({
- currentColorCode: '',
- currentSpecification: '',
- currentLotNumber: '',
- currentSpindleCount: '',
- number: '',
- startTime: '',
- plannedEndTime:'',
- planStatus:0,
- productId:'',
- salesmanId:'',
- isEditing: true, // 标记为正在编辑状态
- colourNumber:""
- });
- this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
- this.lastEditLine = this.tableData2.length - 1
- },
- // 添加计划
- addPlanInfo(){
- if(this.tableData2.length>0){
- var flag=true;
- this.tableData2.forEach(item=>{
- if(!this.isRowFilled(item)){
- this.$message({
- message: '请先完善表格数据',
- type: 'warning'
- });
- flag=false
- }
- })
- if(flag){
- const datatime=Date.now()+this.machineId;
- //处理表格数据
- this.tableData2.forEach(item=>{
- item.timestampRandomCode=datatime;
- item.machineId=this.machineId;
- })
- //时间戳
- let data={
- //机台号
- machineId: this.machineId,
- macId:this.macId,
- timestampRandomCode:datatime,
- //计划信息
- detailsOfTheRefuelingPlans: this.tableData2
- }
- //添加计划信息
- addMaterielInfo(data).then(response => {
- if (response.code == 200) {
- this.$message({
- message: '添加成功',
- type: 'success'
- });
- this.getAmmunitionPlanInfo();
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible = false
- this.beiInsertDialogTableVisible = false
- //更改订单投产信息的批号,
- } else {
- this.$message({
- message: '添加失败',
- type: 'error'
- });
- this.nanInsertDialogTableVisible = false
- this.beiInsertDialogTableVisible = false
- //最后把弹窗关掉
- }
- });
- }
- }else {
- this.$message({
- message: '请先添加表格数据',
- type: 'warning'
- });
- return;
- }
- },
- // 修改产品计划
- handleEditPlan(row) {
- //已经在待机列表了,isNull过滤掉了
- getProductsAll(row.macId).then((response) => {
- this.productsInfo = response.data;
- this.productsInfo.forEach(item => {
- item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
- });
- this.tableData2=[];
- //弹窗
- if(this.selectedWorkshop=="南车间"){
- this.nanUpdateDialogTableVisible = true
- }else{
- this.beiUpdateDialogTableVisible = true
- }
- //先清空--当前操作机台号
- this.machineId=""
- this.machineId=row.machineId;
- this.macId=row.macId;
- //查询当前机台下的计划信息
- getAllPlanListByMachineId(this.macId).then((response) => {
- //得到生产中,停产的,待产的
- response.data.forEach(item => {
- item.isEditing=false;
- item.planStatus=parseInt(item.planStatus);
- item.productId=parseInt(item.productId)
- })
- this.tableData2=response.data;
- // console.log( this.tableData2)
- })
- })
- },
- //重置按钮
- reset(){
- this.tableData2=[];
- //弹窗
- if(this.selectedWorkshop=="南车间"){
- this.nanUpdateDialogTableVisible = true
- }else{
- this.beiUpdateDialogTableVisible = true
- }
- console.log(this.machineId,"dddd")
- getAllPlanListByMachineId(this.machineId).then((response) => {
- //得到生产中,停产的,待产的
- response.data.forEach(item => {
- item.isEditing=false;
- item.planStatus=parseInt(item.planStatus);
- item.productId=parseInt(item.productId)
- })
- this.tableData2=response.data;
- // console.log( this.tableData2)
- // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
- this.$nextTick(() => {
- // 获取第一个业务员选择框(假设表格只有一行)
- for (let i = 0; i < this.tableData2.length; i++) {
- const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
- // 触发 change 事件
- if (firstSalesmanSelect) {
- firstSalesmanSelect.$emit('change', {
- target: {value: "ddd"},
- });
- }
- }
- });
- })
- },
- //弹窗里边的点击查询
- onSubmit(){
- this.formData.macId=this.macId;
- getAllPlanListByProductTypeAndStatus(this.formData).then(response => {
- //得到生产中,停产的,待产的
- response.data.forEach(item => {
- item.isEditing=false;
- item.planStatus=parseInt(item.planStatus);
- })
- this.tableData2=response.data;
- });
- },
- //更新状态
- updateStatus(ind, row){
- if(!this.isRowFilled(row)){
- this.$message({message: '请完善当前行数据', type: 'warning'});
- return;
- }
- //判断当前计划是否已经投产
- getJtIsTheOrderProductProduced({"id":row.id}).then(resp=>{
- if(resp.data.length>0) {
- this.$message({message: '当前计划订单产品在生产中已经不能修改', type: 'warning'});
- return;//证明有在上级的产品--zhi能有一个上级产品
- }
- //不是投产中就可以更新了.
- updatePlanOne(row).then(response=>{
- if (response.code == 200) {
- this.$message({
- message: '修改成功',
- type: 'success'
- });
- this.getAmmunitionPlanInfo();
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- this.beiUpdateDialogTableVisible=false
- } else {
- this.$message({
- message: '修改失败',
- type: 'error'
- });
- //最后把弹窗关掉
- this.nanInsertDialogTableVisible=false
- this.beiUpdateDialogTableVisible=false
- }
- })
- })
- }
- }
- }
- </script>
- <style scoped>
- .el-tabs--border-card >>> .el-tabs__content {
- padding: 0 !important;
- }
- .el-table__body-wrapper {
- cursor: grab;
- }
- .el-table__body-wrapper.grabbing {
- cursor: grabbing;
- }
- .container >>> .el-table .cell {
- white-space: pre-line;
- }
- </style>
|