| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044 |
- <template>
- <ele-modal
- custom-class="ele-dialog-form long-dialog-form"
- :centered="true"
- :visible.sync="visible"
- :title="title"
- append-to-body
- :close-on-click-modal="false"
- width="85%"
- :maxable="true"
- >
- <el-card shadow="never">
- <header-title title="物品信息"></header-title>
- <el-form
- label-width="100px"
- ref="form"
- :model="rowData"
- class="item-height"
- >
- <el-row>
- <el-col :span="6" label-width="100px">
- <el-form-item label="名称" prop="name">
- <el-input
- disabled
- placeholder="物品名称"
- v-model="treeData.name"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6" label-width="100px">
- <el-form-item label="编码" prop="categoryCode">
- <el-input
- disabled
- placeholder="物品编码"
- v-model="treeData.categoryCode"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6" label-width="100px">
- <el-form-item label="型号" prop="modelType">
- <el-input
- disabled
- placeholder="物品型号"
- v-model="treeData.modelType"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6" label-width="100px">
- <el-form-item label="规格" prop="specification">
- <el-input
- disabled
- placeholder="物品规格"
- v-model="treeData.specification"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6" label-width="100px">
- <el-form-item label="bom编码" prop="code">
- <el-input
- disabled
- placeholder="物品规格"
- v-model="treeData.code"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <header-title title="工序信息"></header-title>
- <el-form label-width="100px" ref="form" :model="rowData">
- <el-row>
- <el-col :span="6" label-width="100px">
- <el-form-item label="编码" prop="type">
- <el-input
- disabled
- placeholder="工序编码"
- v-model="rowData.code"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6" label-width="100px">
- <el-form-item label="工序名称" prop="type">
- <el-input
- disabled
- placeholder="工序名称"
- v-model="rowData.name"
- ></el-input>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="6" label-width="100px">
- <el-form-item label="名称" prop="type">
- <el-input
- disabled
- placeholder="物品名称"
- v-model="rowData.name"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6" label-width="100px">
- <el-form-item label="物品编码" prop="type">
- <el-input
- disabled
- placeholder="工序名称"
- v-model="rowData.name"
- ></el-input>
- </el-form-item>
- </el-col> -->
- </el-row>
- </el-form>
- <el-tabs
- v-model="activeName"
- class="tab-box"
- type="border-card"
- @tab-click="tabsChange"
- >
- <el-tab-pane label="工艺参数" name="工艺参数">
- <ele-pro-table
- ref="table"
- :datasource="datasource"
- :immediate="true"
- :need-page="false"
- :columns="columns"
- >
- <!-- 表头工具栏 -->
- <template v-if="!isView" v-slot:toolbar>
- <el-button
- size="small"
- icon="el-icon-plus"
- class="ele-btn-icon"
- type="primary"
- @click.native="openParam('工艺')"
- >添加参数</el-button
- >
- </template>
- <template v-slot:sort="{ row }">
- <div v-if="isView">{{ row.sort }}</div>
- <el-input v-else v-model="row.sort"></el-input>
- </template>
- <!-- 默认值 -->
- <template v-slot:defaultValue="{ row }">
- <div v-if="isView">
- {{ row.defaultValue }}
- </div>
- <div v-else>
- <el-input
- v-if="
- row.textType == 1 ||
- row.textType == 4 ||
- row.textType == 3 ||
- row.textType == 5
- "
- v-model="row.defaultValue"
- placeholder="请输入"
- ></el-input>
- <el-select
- v-if="row.textType == 2"
- v-model="row.defaultValue"
- placeholder="请选择"
- >
- <el-option label="TRUE" :value="'TRUE'" />
- <el-option label="FALSE" :value="'FALSE'" />
- </el-select>
- </div>
- </template>
- <!-- 上限 -->
- <template v-slot:maxValue="{ row }">
- <div v-if="isView">
- {{ row.maxValue }}
- </div>
- <div v-else>
- <el-input
- v-if="row.textType == 3"
- v-model="row.maxValue"
- placeholder="请输入"
- ></el-input>
- </div>
- </template>
- <!-- 下限 -->
- <template v-slot:minValue="{ row }">
- <div v-if="isView">
- {{ row.minValue }}
- </div>
- <div v-else>
- <el-input
- v-if="row.textType == 3"
- v-model="row.minValue"
- placeholder="请输入"
- ></el-input>
- </div>
- </template>
- <!-- 单位 -->
- <template v-slot:unitName="{ row }">
- <div v-if="isView">
- {{ row.unitName }}
- </div>
- <div v-else>
- <DictSelection
- v-if="row.textType != 2 && row.textType != 5"
- dictName="工艺参数单位"
- clearable
- filterable
- v-model="row.unitName"
- >
- </DictSelection>
- <span v-if="row.textType == 5"> h(小时)</span>
- </div>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-popconfirm
- class="ele-action"
- title="确定要删除当前参数吗?"
- @confirm="remove(row, '工艺')"
- >
- <template v-slot:reference>
- <el-link
- type="danger"
- :underline="false"
- icon="el-icon-delete"
- >
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="质检项参数" name="质检项参数">
- <term
- :qualityParam="qualityParam"
- :isView="isView"
- ref="qualityParamRef"
- ></term>
- </el-tab-pane>
- <el-tab-pane label="生产节拍" name="生产节拍">
- <el-form
- label-width="140px"
- ref="form"
- :model="beatParam"
- style="width: 800px; margin: auto"
- >
- <el-row>
- <el-col :span="16" label-width="100px">
- <el-form-item label="节拍生产数量" prop="beatNum">
- <el-input
- v-if="!isView"
- placeholder=""
- v-model="beatParam.beatNum"
- maxlength="9"
- ></el-input>
- <div v-else>{{ beatParam.beatNum }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="单位:" prop="unit">
- <el-select
- v-if="!isView"
- v-model="beatParam.unit"
- filterable
- class="ele-block"
- @change="changeUnit"
- >
- <el-option
- v-for="item in dictList"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- ></el-option>
- </el-select>
- <div v-else>{{ beatParam.unit }}</div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="16" label-width="100px">
- <el-form-item label="生产时长" prop="newBeatTime">
- <el-input
- v-if="!isView"
- placeholder=""
- v-model="beatParam.newBeatTime"
- @blur="convertVal(beatParam.newBeatTime, 'beatTime')"
- maxlength="9"
- oninput="value = value.replace(/[^\d.]/g, '')"
- ></el-input>
- <div v-else>{{ beatParam.newBeatTime }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="单位:" prop="">
- <div>{{ beatParam.unit }}</div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="16" label-width="100px">
- <el-form-item label="准备时长" prop="newBeatPrepareTime">
- <el-input
- v-if="!isView"
- placeholder=""
- v-model="beatParam.newBeatPrepareTime"
- @blur="
- convertVal(
- beatParam.newBeatPrepareTime,
- 'beatPrepareTime'
- )
- "
- maxlength="9"
- oninput="value = value.replace(/[^\d.]/g, '')"
- ></el-input>
- <div v-else>{{ beatParam.newBeatPrepareTime }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="单位:" prop="">
- <div>{{ beatParam.unit }}</div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="16" label-width="140px">
- <el-form-item label="下道工序间隔时长" prop="newBeatRestTime">
- <el-input
- v-if="!isView"
- placeholder=""
- v-model="beatParam.newBeatRestTime"
- @blur="
- convertVal(beatParam.newBeatRestTime, 'beatRestTime')
- "
- maxlength="9"
- oninput="value = value.replace(/[^\d.]/g, '')"
- ></el-input>
- <div v-else>{{ beatParam.newBeatRestTime }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="单位:" prop="beatRestUnit">
- <div>{{ beatParam.unit }}</div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="16" label-width="100px">
- <el-form-item label="标准时长" prop="newTime">
- <el-input
- v-if="!isView"
- placeholder="标准时长"
- v-model="beatParam.newTime"
- @blur="convertVal(beatParam.newTime, 'time')"
- maxlength="9"
- oninput="value = value.replace(/[^\d.]/g, '')"
- ></el-input>
- <div v-else>{{ beatParam.newTime }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="单位:" prop="">
- <div>{{ beatParam.unit }}</div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="16" label-width="100px">
- <el-form-item label="工时单价" prop="taskPrice">
- <el-input
- v-if="!isView"
- placeholder=""
- v-model="beatParam.taskPrice"
- oninput="value = value.replace(/[^\d.]/g, '')"
- maxlength="7"
- ></el-input>
- <div v-else>{{ beatParam.taskPrice }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="8" label-width="100px">
- <el-form-item label="单位:" prop="">
- <div>元</div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24" label-width="100px">
- <el-form-item label="备注" prop="remark">
- <el-input
- v-if="!isView"
- placeholder=""
- v-model="beatParam.remark"
- type="textarea"
- :rows="4"
- ></el-input>
- <div v-else>{{ beatParam.remark }}</div>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="材料定额" name="材料定额">
- <ele-pro-table
- ref="materialTable"
- :columns="columns1"
- :datasource="datasource"
- :need-page="false"
- :immediate="true"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- type="primary"
- v-if="
- !isView &&
- attributeData.approvalStatus != 1 &&
- attributeData.approvalStatus != 2
- "
- @click="add"
- >添加</el-button
- >
- <el-button
- type="primary"
- v-if="
- !isView &&
- attributeData.approvalStatus != 1 &&
- attributeData.approvalStatus != 2
- "
- @click="detailsList"
- >从明细表导入</el-button
- >
- <div class="toolbar_box">
- <div>
- <el-form
- ref="form"
- :rules="rules"
- :model="form"
- label-width="80px"
- inline
- >
- <el-form-item prop="baseCount" label="基本数量">
- <el-input
- placeholder="请输入"
- disabled
- v-model.number="form.baseCount"
- >
- </el-input>
- </el-form-item>
- <el-form-item prop="baseCountUnit" label="单位">
- <!-- <DictSelection
- dictName="计量单位"
- clearable
- :disabled="true"
- v-model="form.baseCountUnit"
- ></DictSelection> -->
- <!-- <el-form-item label="单位:" prop="unit"> -->
- <el-select
- disabled
- v-model="form.baseCountUnit"
- filterable
- class="ele-block"
- @change="changeUnit"
- >
- <el-option
- v-for="item in unitList"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- ></el-option>
- </el-select>
- <!-- </el-form-item> -->
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <template
- v-if="
- attributeData.approvalStatus != 1 &&
- attributeData.approvalStatus != 2
- "
- v-slot:action="{ row, $index }"
- >
- <el-link type="danger" @click="handleDel(row, $index)"
- >删除</el-link
- >
- <el-link type="primary" @click="handSubstitution(row)"
- >替代料</el-link
- >
- </template>
- <template v-slot:subCode="{ row }">
- <div v-if="isView">{{ row.subCode }}</div>
- <el-input
- v-else
- v-model="row.subCode"
- placeholder="请输入"
- :disabled="
- attributeData.approvalStatus == 1 ||
- attributeData.approvalStatus == 2
- "
- ></el-input>
- </template>
- <template v-slot:isReworkBom="{ row }">
- <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
- <div v-else>
- <el-select
- v-model="row.isReworkBom"
- :disabled="
- attributeData.approvalStatus == 1 ||
- attributeData.approvalStatus == 2
- "
- >
- <el-option
- v-for="item in isReworkBomList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- </template>
- <template v-slot:unit="{ row }">
- <div v-if="isView">{{ row.unit }}</div>
- <div v-else>
- <DictSelection
- dictName="计量单位"
- :isProhibit="true"
- v-model="row.unit"
- ></DictSelection>
- </div>
- </template>
- <template v-slot:count="{ row }">
- <div v-if="isView">{{ row.count }}</div>
- <el-input
- v-else
- v-model="row.count"
- placeholder="请输入"
- style="width: 90px"
- @input="handleInput(row)"
- :disabled="
- attributeData.approvalStatus == 1 ||
- attributeData.approvalStatus == 2
- "
- ></el-input>
- </template>
- <template v-slot:categoryName="{ row, $index }">
- <el-link
- type="primary"
- :underline="false"
- @click="handSubstitution(row)"
- v-if="
- isView ||
- attributeData.approvalStatus == 1 ||
- attributeData.approvalStatus == 2
- "
- >{{ row.categoryName }}</el-link
- >
- <div v-else
- ><el-input
- :value="row.categoryName"
- placeholder="请选择"
- @click.native="categorySelect(row, $index)"
- ></el-input
- ></div>
- </template>
- <template v-slot:bomArtFiles="{ row }">
- <fileMain
- v-model="row.bomArtFiles"
- :type="
- isView ||
- attributeData.approvalStatus == 1 ||
- attributeData.approvalStatus == 2
- ? 'view'
- : 'add'
- "
- size="mini"
- />
- </template>
- <template v-slot:remark="{ row }">
- <div v-if="isView">{{ row.remark }}</div>
- <el-input
- v-else
- v-model="row.remark"
- placeholder="请输入"
- :disabled="
- attributeData.approvalStatus == 1 ||
- attributeData.approvalStatus == 2
- "
- ></el-input>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="关键设备" name="关键设备">
- <ele-pro-table
- ref="deviceTabRef"
- :columns="standardCol"
- :datasource="datasource"
- :need-page="false"
- :immediate="true"
- >
- <!-- 表头工具栏 -->
- <template v-if="!isView" v-slot:toolbar>
- <el-button type="primary" @click="add">添加</el-button>
- </template>
- <template v-slot:action="{ row, $index }">
- <el-link type="danger" @click="handleDel(row, $index)"
- >删除</el-link
- >
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="制造资源" name="制造资源">
- <ele-pro-table
- ref="resourceTable"
- :columns="columns1"
- :datasource="datasource"
- :need-page="false"
- :immediate="true"
- >
- <!-- 表头工具栏 -->
- <template v-if="!isView" v-slot:toolbar>
- <el-button type="primary" @click="add">添加</el-button>
- </template>
- <template v-slot:action="{ row, $index }">
- <el-link type="primary" @click="handleDel(row, $index)"
- >删除</el-link
- >
- </template>
- <template v-slot:subCode="{ row }">
- <div v-if="isView">{{ row.subCode }}</div>
- <el-input
- v-else
- v-model="row.subCode"
- placeholder="请输入"
- ></el-input>
- </template>
- <template v-slot:isReworkBom="{ row }">
- <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
- <div v-else>
- <el-select v-model="row.isReworkBom">
- <el-option
- v-for="item in isReworkBomList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- </template>
- <template v-slot:unit="{ row }">
- <div v-if="isView">{{ row.unit }}</div>
- <div v-else>
- <DictSelection
- dictName="计量单位"
- v-model="row.unit"
- ></DictSelection>
- </div>
- </template>
- <template v-slot:count="{ row }">
- <div v-if="isView">{{ row.count }}</div>
- <el-input
- v-else
- v-model="row.count"
- placeholder="请输入"
- @input="
- (value) =>
- (row.count = value.replace(
- /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
- '$1$2.$3'
- ))
- "
- ></el-input>
- </template>
- <template v-slot:categoryName="{ row, $index }">
- <div v-if="isView">{{ row.categoryName }}</div>
- <div v-else
- ><el-input
- :value="row.categoryName"
- placeholder="请选择"
- @click.native="categorySelect(row, $index)"
- ></el-input
- ></div>
- </template>
- <template v-slot:bomArtFiles="{ row }">
- <fileUpload v-model="row.bomArtFiles" type="add" size="mini" />
- </template>
- <template v-slot:remark="{ row }">
- <div v-if="isView">{{ row.remark }}</div>
- <el-input
- v-else
- v-model="row.remark"
- placeholder="请输入"
- ></el-input>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="工种" name="工种">
- <ele-pro-table
- ref="jobTable"
- :columns="jobColumns"
- :datasource="datasource"
- row-key="id"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="addJob"
- >新增</el-button
- >
- </template>
- <template v-slot:action="{ row, $index }">
- <el-link type="primary" @click="handleDel(row, $index)"
- >删除</el-link
- >
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="工艺文件" name="工艺文件">
- <ele-pro-table
- ref="fileTable"
- :columns="jobColumns1"
- :datasource="datasource"
- :need-page="false"
- :immediate="true"
- >
- <!-- 表头工具栏 -->
- <template v-if="!isView" v-slot:toolbar>
- <el-button type="primary" @click="addFile">添加</el-button>
- </template>
- <template v-slot:action="{ row, $index }">
- <el-link type="primary" @click="handleDel(row, $index)"
- >删除</el-link
- >
- <el-link type="primary" @click="fileDetails(row)">详情</el-link>
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="标准产出" name="标准产出">
- <ele-pro-table
- ref="standard"
- :columns="standardCol"
- :datasource="datasource"
- :need-page="false"
- :immediate="true"
- >
- <!-- 表头工具栏 -->
- <template v-if="!isView" v-slot:toolbar>
- <el-button type="primary" @click="add">添加</el-button>
- </template>
- <template v-slot:action="{ row, $index }">
- <el-link type="danger" @click="handleDel(row, $index)"
- >删除</el-link
- >
- </template>
- </ele-pro-table>
- </el-tab-pane>
- <el-tab-pane label="过程控制" name="过程控制">
- <userSettingMatterProcess
- :produce-task-id="rowData.sourceTaskId"
- :produce-task-name="rowData.name"
- :produce-task-code="rowData.code"
- :bom-category-id="resourceBomId"
- ref="userSettingMatterProcessRef"
- ></userSettingMatterProcess>
- </el-tab-pane>
- </el-tabs>
- </el-card>
- <!-- 选择工艺参数 -->
- <jobDialog ref="jobRef" @chooseModal="chooseJob"></jobDialog>
- <ParamModal ref="paramRefs" @chooseModal="chooseModal"></ParamModal>
- <ProductModal ref="productRefs" @changeProduct="determineChoose" />
- <ProductModalMultiple
- ref="productMultipleRefs"
- @selection="addProductList"
- ></ProductModalMultiple>
- <standardOutput
- ref="standardOutputRefs"
- @selection="chooseStandardList"
- ></standardOutput>
- <fileIndex v-if="fileShow" @close="fileClose"></fileIndex>
- <fileBrowse ref="browseRef"></fileBrowse>
- <replaceMaterialPop
- ref="replaceMaterialRef"
- @selected="replaceSelected"
- :isView="isView"
- ></replaceMaterialPop>
- <mbomDatailList ref="bomDetailList"></mbomDatailList>
- <div class="btns">
- <el-button
- type="primary"
- size="small"
- v-if="!isView"
- @click="save('save')"
- >
- 保存</el-button
- >
- <el-button type="primary" size="small" @click="save('close')">{{
- isView ? '确定' : '保存并关闭'
- }}</el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </div>
- </ele-modal>
- </template>
- <script>
- import dictMixins from '@/mixins/dictMixins';
- import * as dayjs from 'dayjs';
- import { getFile } from '@/api/system/file';
- // import fileUpload from '@/components/addDoc/index.vue';
- import { workingProcedureUpdate } from '@/api/material/BOM';
- import ParamModal from '@/views/technology/productParam/components/ParamModal.vue';
- import ProductModal from '@/components/select/bom/ProductModal.vue';
- import { getByCode } from '@/api/system/dictionary-data';
- import ProductModalMultiple from './ProductModalMultiple.vue';
- import userSearch from './user-search.vue';
- import jobDialog from './jobDialog.vue';
- import standardOutput from './standardOutput.vue';
- import term from '../qualityTesting/term';
- import fileIndex from '../file/index.vue';
- import fileBrowse from '../file/fileBrowse.vue';
- import replaceMaterialPop from './replaceMaterialPop.vue';
- import { newFilePageAPI } from '@/api/material/file';
- import { getBomGetById, getDetailList } from '@/api/material/BOM.js';
- import mbomDatailList from './mbomDatailList.vue';
- import { setFileUrl } from '@/components/addDoc/util.js';
- import userSettingMatterProcess from '@/views/technology/production/components/user-setting-matter-process.vue';
- export default {
- components: {
- userSearch,
- ParamModal,
- // fileUpload,
- ProductModal,
- jobDialog,
- ProductModalMultiple,
- standardOutput,
- term,
- fileIndex,
- fileBrowse,
- replaceMaterialPop,
- mbomDatailList,
- userSettingMatterProcess
- },
- mixins: [dictMixins],
- data() {
- return {
- rules: {
- baseCount: [
- { required: true, message: '请输入基本数量', trigger: 'blur' }
- ],
- baseCountUnit: [
- { required: true, message: '请选择单位', trigger: 'change' }
- ]
- },
- form: {
- baseCount: 0,
- baseCountUnit: ''
- },
- baseCountUnit: '',
- baseCount2: '',
- baseCountUnit2: '',
- isView: false,
- filedList: [],
- jobFiledList: [],
- activeName: '工艺参数',
- attributeData: {},
- visible: false,
- title: '配置',
- statusOption: [
- {
- label: '启用',
- value: 1
- },
- {
- label: '停用',
- value: 0
- }
- ],
- isReworkBom: ['否', '是'],
- isReworkBomList: [
- { label: '否', value: 0 },
- { label: '是', value: 1 }
- ],
- dictList: [], //单位下拉
- // 表格列配置
- columns1: [],
- defaultColumns1: [
- {
- type: 'index',
- width: 55,
- align: 'center'
- },
- {
- label: '子项编号',
- prop: 'subCode',
- slot: 'subCode',
- action: 'subCode'
- },
- {
- label: '物料名称',
- prop: 'categoryName',
- slot: 'categoryName',
- action: 'categoryName'
- },
- {
- label: '是否回收料',
- prop: 'isReworkBom',
- slot: 'isReworkBom',
- action: 'isReworkBom'
- },
- {
- label: '编码',
- prop: 'categoryCode'
- },
- {
- label: '牌号',
- prop: 'brandNum'
- },
- {
- label: '型号',
- prop: 'modelType'
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- label: '数量',
- slot: 'count',
- action: 'count'
- },
- {
- label: '单位',
- slot: 'unit',
- action: 'unit'
- },
- {
- label: '附件',
- slot: 'bomArtFiles',
- action: 'bomArtFiles',
- minWidth: 150
- },
- {
- label: '备注',
- slot: 'remark',
- action: 'remark'
- }
- ],
- columns: [],
- // 表格列配置
- defaultColumns: [
- {
- prop: 'sort',
- slot: 'sort',
- label: '排序',
- minWidth: 60
- },
- {
- prop: 'code',
- label: '参数编码',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'name',
- label: '参数名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- align: 'center',
- prop: 'description',
- label: '文本描述',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'maxValue',
- slot: 'maxValue',
- label: '参数上限',
- align: 'center'
- },
- {
- prop: 'minValue',
- slot: 'minValue',
- label: '参数下限',
- align: 'center'
- },
- {
- prop: 'defaultValue',
- slot: 'defaultValue',
- label: '默认值',
- align: 'center'
- }
- ],
- levelOptions: [
- {
- label: '初级',
- value: '1'
- },
- {
- label: '中级',
- value: '2'
- },
- {
- label: '高级',
- value: '3'
- }
- ],
- // 表格列配置
- jobColumns: [
- {
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center'
- },
- {
- slot: 'type',
- label: '类型',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110,
- formatter: (_row) => {
- return this.getDictValue('工种类型', _row.type);
- }
- },
- {
- align: 'center',
- prop: 'code',
- label: '编码',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- slot: 'name',
- prop: 'name',
- label: '名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- slot: 'level',
- prop: 'level',
- label: '等级',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110,
- formatter: (_row) => {
- return this.levelOptions.filter(
- (item) => _row.level == item.value
- )[0].label;
- }
- },
- {
- slot: 'hourCost',
- prop: 'hourCost',
- label: '标准工时费',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 260,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- // 表格选中数据
- jobColumns1: [
- {
- label: '编码',
- prop: 'code',
- width: 180,
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'name',
- label: '文档名称',
- align: 'center',
- slot: 'name',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'storagePath',
- label: '文件名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200,
- formatter: (_row, _column, cellValue) => {
- return cellValue[0]?.name;
- }
- },
- {
- prop: 'version',
- label: '版本',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'createTime',
- label: '创建时间',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 260,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- standardCol: [
- {
- prop: 'code',
- label: '编码'
- },
- {
- prop: 'name',
- label: '名称',
- showOverflowTooltip: true
- },
- {
- prop: 'brandNum',
- label: '牌号'
- },
- {
- prop: 'modelType',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'measuringUnit',
- label: '计量单位',
- showOverflowTooltip: true,
- minWidth: 90
- },
- {
- columnKey: 'action',
- label: '操作',
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- rowData: {},
- treeData: {},
- currentIndex: 0,
- tableData: {},
- beatParam: {
- newTime: '',
- time: '',
- newBeatPrepareTime: '',
- beatPrepareTime: '',
- newBeatTime: '',
- beatTime: '',
- newBeatRestTime: '',
- beatRestTime: '',
- taskPrice: ''
- },
- qualityParam: [],
- qualityPointParam: [],
- fileShow: false,
- resourceBomId: '',
- level: '',
- attributeData: {},
- unitList: []
- };
- },
- created() {
- this.requestDict('工种类型');
- this.getDictList('time_unit');
- this.getDicTUnitList('measuring_uint');
- },
- methods: {
- addFile() {
- this.fileShow = true;
- },
- fileClose(val) {
- if (val == false) {
- this.fileShow = false;
- } else {
- this.fileShow = false;
- this.$refs.fileTable.setData([
- ...val,
- ...this.$refs.fileTable.getData()
- ]);
- this.$set(
- this.tableData.taskParam[this.currentIndex],
- 'fileParam',
- this.$refs.fileTable.getData()
- );
- }
- },
- async getDicTUnitList(code) {
- let { data: res } = await getByCode(code);
- this.unitList = res.reduce((acc, curr) => {
- let key = Object.keys(curr)[0]; // 获取当前对象的键
- let value = curr[key]; // 获取当前对象的值
- acc.push({ value, label: value }); // 将 { value, label } 格式的对象添加到数组中
- return acc;
- }, []); // 初始值为空数组 []
- console.log(this.unitList, 'this.unitList');
- },
- handleInput(item) {
- let newVal = item.count.replace(/[^\d.]/g, '');
- // 2. 不能以点开头
- if (newVal.startsWith('.')) {
- newVal = '';
- }
- // 3. 只允许出现一个小数点
- const firstDotIndex = newVal.indexOf('.');
- if (firstDotIndex !== -1) {
- newVal =
- newVal.slice(0, firstDotIndex + 1) +
- newVal.slice(firstDotIndex + 1).replace(/\./g, '');
- }
- // 4. 更新数据
- item.count = newVal;
- },
- async detailsList() {
- console.log(this.rowData, 'this.rowData');
- await getDetailList({
- bomType: this.attributeData.bomType,
- bomCategoryId: this.resourceBomId,
- taskId: this.rowData.id
- }).then((res) => {
- console.log(res);
- this.$refs.materialTable.setData(res.data);
- this.tableData.taskParam[this.currentIndex].materialQuota = res.data;
- console.log(this.tableData, 'this.tableData');
- });
- // this.$refs.bomDetailList.open(this.resourceBomId, this.level)
- },
- fileDetails(row) {
- window.open(setFileUrl(row));
- },
- addJob() {
- this.$refs.jobRef.open();
- },
- chooseJob(data) {
- this.$refs.jobTable.setData([
- ...data,
- ...this.$refs.jobTable.getData()
- ]);
- this.$set(
- this.tableData.taskParam[this.currentIndex],
- 'aptitudeParam',
- this.$refs.jobTable.getData()
- );
- },
- determineChoose(title, row, idx) {
- let type = '';
- if (this.activeName === '材料定额') {
- type = 'materialQuota';
- } else if (this.activeName === '制造资源') {
- type = 'resource';
- }
- if (title == '选择物料') {
- console.log(row, 'row');
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'categoryName',
- row.name
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'categoryId',
- row.id
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'categoryCode',
- row.code
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'unit',
- row.measuringUnit
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'weightUnit',
- row.weightUnit
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'brandNum',
- row.brandNum
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'modelType',
- row.modelType
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'rootCategoryLevelId',
- row.categoryLevelPathIdParent
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'specification',
- row.specification
- );
- this.$set(
- this.tableData.taskParam[this.currentIndex][type][idx],
- 'id',
- row.id
- );
- }
- },
- uploadedSuccess(data, row) {
- row.bomArtFiles = data[0].storePath;
- this.filedList = [];
- },
- uploadedJobSuccess(data, row) {
- row.path = data[0].storePath;
- row.name = data[0].name;
- this.jobFiledList = [];
- },
- downloadFile(url) {
- getFile({ objectName: url }, '附件');
- },
- categorySelect(row, idx) {
- this.$refs.productRefs.open(row, '选择物料', '1', idx);
- },
- handleDel(row, index) {
- let type = '';
- if (this.activeName === '材料定额') {
- type = 'materialQuota';
- } else if (this.activeName === '制造资源') {
- type = 'resource';
- } else if (this.activeName === '工种') {
- type = 'aptitudeParam';
- } else if (this.activeName === '工艺文件') {
- type = 'fileParam';
- } else if (this.activeName === '标准产出') {
- type = 'standardOutput';
- } else if (this.activeName === '关键设备') {
- type = 'standardDevice';
- }
- this.tableData.taskParam[this.currentIndex][type].splice(index, 1);
- },
- addProductList(list) {
- let subCode = 0;
- let array = [];
- list.map((item, index) => {
- let max = '';
- if (
- this.tableData.taskParam[this.currentIndex]['materialQuota']
- .length > 0
- ) {
- max =
- Math.max(
- ...this.tableData.taskParam[this.currentIndex][
- 'materialQuota'
- ].map((i) => i.subCode)
- ) +
- 10 * ++index +
- '';
- if (max.length < 4) {
- max = new Array(4 - max.length).fill('0').join('') + max;
- }
- } else {
- max = 10 * ++index + '';
- if (max.length < 4) {
- max = new Array(4 - max.length).fill('0').join('') + max;
- }
- }
- console.log('item', this.isValueANumber(item.specification));
- if (
- item.categoryLevelPathIdParent == 8 &&
- this.isValueANumber(this.baseCount) &&
- this.isValueANumber(item.specification)
- ) {
- let num = this.baseCount / item.specification;
- item.count = num == 'Infinity' ? '' : num.toFixed(3);
- }
- subCode = max.substring(0, max.length - 1) + '0';
- array.push({
- subCode,
- id: item.id,
- categoryName: item.name,
- categoryCode: item.code,
- isReworkBom: 0,
- brandNum: item.brandNum,
- count: item.count || '',
- modelType: item.modelType,
- unit: item.measuringUnit,
- bomArtFiles: [],
- remark: '',
- specification: item.specification,
- rootCategoryLevelId: item.categoryLevelPathIdParent,
- extInfo: item.extInfo
- });
- });
- let _arr =
- this.tableData.taskParam[this.currentIndex].materialQuota.concat(
- array
- );
- let uniqueArray = [];
- uniqueArray = _arr.reduce((acc, current) => {
- const existing = acc.find((item) => item.id === current.id);
- if (!existing) {
- acc.push(current);
- }
- return acc;
- }, []);
- this.tableData.taskParam[this.currentIndex].materialQuota = uniqueArray;
- this.$refs.materialTable.setData(
- this.tableData.taskParam[this.currentIndex].materialQuota
- );
- },
- isValueANumber(variable) {
- if (variable === undefined || variable === null) {
- return false; // 变量没有值
- }
- if (typeof variable === 'number') {
- return true; // 基本类型的数字
- }
- if (
- (typeof variable === 'string' &&
- !isNaN(variable) &&
- !variable.includes('.')) ||
- (variable.includes('.') && !variable.endsWith('.'))
- ) {
- // 字符串类型的数字(注意:这个正则表达式判断较为简单,可能需要根据实际情况调整)
- // 或者使用 Number.isFinite(parseFloat(variable)) 来代替这部分逻辑,但要注意性能开销和边缘情况
- const num = Number(variable);
- return !isNaN(num) && isFinite(num);
- }
- return false; // 其他类型
- },
- add() {
- let subCode = '0010';
- let type = '';
- if (this.activeName === '材料定额') {
- this.$refs.productMultipleRefs.open(1);
- return;
- } else if (this.activeName === '标准产出') {
- this.$refs.standardOutputRefs.open(9);
- return;
- } else if (this.activeName === '关键设备') {
- this.$refs.standardOutputRefs.open(4);
- return;
- } else if (this.activeName === '制造资源') {
- type = 'resource';
- }
- console.log(this.tableData.taskParam[this.currentIndex]);
- if (this.tableData.taskParam[this.currentIndex][type].length) {
- let max =
- Math.max(
- ...this.tableData.taskParam[this.currentIndex][type].map(
- (i) => i.subCode
- )
- ) +
- 10 +
- '';
- if (max.length < 4) {
- max = new Array(4 - max.length).fill('0').join('') + max;
- }
- subCode = max.substring(0, max.length - 1) + '0';
- }
- this.tableData.taskParam[this.currentIndex][type].push({
- subCode,
- bomArtFiles: [],
- categoryId: '',
- categoryName: '',
- isReworkBom: 0,
- brandNum: '',
- count: '',
- modelType: '',
- unit: '',
- rootCategoryLevelId: '',
- categoryCode: '',
- specification: '',
- id: ''
- });
- },
- /* 表格数据源 */
- async datasource() {
- return [];
- },
- tabsChange() {
- console.log(this.activeName);
- console.log(this.tableData.taskParam[this.currentIndex]);
- if (this.activeName === '工艺参数') {
- // 工艺参数
- this.$refs.table.setData(
- this.tableData.taskParam[this.currentIndex].produceList || []
- );
- } else if (this.activeName === '质检项参数') {
- this.qualityParam =
- this.tableData.taskParam[this.currentIndex].qualityParam || [];
- } else if (this.activeName === '生产节拍') {
- this.beatParam =
- this.tableData.taskParam[this.currentIndex].beatParam ||
- this.beatParam;
- } else if (this.activeName === '材料定额') {
- this.$refs.materialTable.setData(
- this.tableData.taskParam[this.currentIndex].materialQuota || []
- );
- } else if (this.activeName === '制造资源') {
- this.$refs.resourceTable.setData(
- this.tableData.taskParam[this.currentIndex].resource || []
- );
- } else if (this.activeName === '工种') {
- if (
- JSON.stringify(
- this.tableData.taskParam[this.currentIndex].aptitudeParam
- ) == '{}'
- ) {
- this.tableData.taskParam[this.currentIndex].aptitudeParam = [];
- this.$refs.jobTable.setData([]);
- } else {
- this.$refs.jobTable.setData(
- this.tableData.taskParam[this.currentIndex].aptitudeParam
- );
- }
- } else if (this.activeName === '工艺文件') {
- if (
- JSON.stringify(
- this.tableData.taskParam[this.currentIndex].fileParam
- ) == '{}'
- ) {
- this.tableData.taskParam[this.currentIndex].fileParam = [];
- this.$refs.fileTable.setData([]);
- } else {
- let fileId = this.tableData.taskParam[this.currentIndex].fileParam;
- console.log('111111');
- if (fileId.length > 0) {
- this.fileParamDatasource(fileId);
- }
- // this.$refs.fileTable.setData(
- // this.tableData.taskParam[this.currentIndex].fileParam
- // );
- }
- } else if (this.activeName === '标准产出') {
- this.$refs.standard.setData(
- this.tableData.taskParam[this.currentIndex].standardOutput || []
- );
- } else if (this.activeName === '关键设备') {
- this.$refs.deviceTabRef.setData(
- this.tableData.taskParam[this.currentIndex].standardDevice || []
- );
- } else if (this.activeName === '过程控制') {
- // 过程控制数据查询
- }
- },
- openParam(type) {
- let tableData = [];
- if (type === '工艺') {
- tableData = this.$refs.table.getData();
- } else {
- tableData = this.$refs.qualityTable.getData();
- }
- this.$refs.paramRefs.open(tableData);
- },
- chooseModal(data) {
- let dom = null;
- if (this.activeName === '工艺参数') {
- dom = this.$refs.table;
- }
- dom.setData([...data, ...dom.getData()]);
- this.$set(
- this.tableData.taskParam[this.currentIndex],
- this.activeName === '工艺参数' ? 'produceList' : '',
- dom.getData()
- );
- },
- chooseStandardList(type, data) {
- let dom = null;
- if (type == 9) {
- dom = this.$refs.standard;
- dom.setData([data[0]]);
- this.$set(
- this.tableData.taskParam[this.currentIndex],
- 'standardOutput',
- dom.getData()
- );
- } else if (type == 4) {
- dom = this.$refs.deviceTabRef;
- dom.setData([data[0]]);
- this.$set(
- this.tableData.taskParam[this.currentIndex],
- 'standardDevice',
- dom.getData()
- );
- }
- },
- remove(row, type) {
- let dom = null;
- if (type === '工艺') {
- dom = this.$refs.table;
- } else {
- dom = this.$refs.qualityTable;
- }
- const data = dom.getData();
- if (row.id) {
- dom.setData(data.filter((d) => d.id !== row.id));
- } else {
- dom.setData(data.filter((d) => d.paramId !== row.paramId));
- }
- this.$set(
- this.tableData.taskParam[this.currentIndex],
- type === '工艺' ? 'produceList' : 'qualityParam',
- dom.getData()
- );
- },
- open(rowData, treeData, tableData, isView, attributeData, resourceBomId) {
- // 工序信息
- console.log('rowData', rowData);
- // bom 信息
- console.log('treeData', treeData);
- // 工序信息列表 信息 包括工艺参数 材料定额等
- console.log('tableData', tableData);
- // 是否为详情 详情只能查看
- console.log('isView', isView);
- // bom 信息 和 treeData 一致
- console.log('attributeData', attributeData);
- // bom category id
- console.log('resourceBomId', resourceBomId);
- this.columns = [];
- this.columns1 = [];
- this.isView = isView; //true详情 false编辑
- this.resourceBomId = resourceBomId;
- this.attributeData = attributeData;
- this.form.baseCount = attributeData.baseCount;
- // if (rowData.baseCount) {
- // this.form.baseCount = rowData.baseCount;
- // } else {
- // this.form.baseCount = attributeData.baseCount
- // ? attributeData.baseCount
- // : 1;
- // }
- // if (this.attributeData) {
- // this.form.baseCount = this.attributeData.baseCount;
- // } else {
- // this.form.baseCount = 1;
- // }
- if (!this.isView) {
- this.columns = this.defaultColumns.concat({
- columnKey: 'action',
- label: '操作',
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- });
- this.columns1 = this.defaultColumns1.concat({
- action: 'action',
- slot: 'action',
- label: '操作'
- });
- } else {
- this.columns = this.defaultColumns;
- this.columns1 = this.defaultColumns1;
- }
- this.rowData = JSON.parse(JSON.stringify(rowData));
- this.treeData = JSON.parse(JSON.stringify(treeData));
- this.tableData = JSON.parse(JSON.stringify(tableData));
- this.currentIndex = tableData.taskParam.findIndex(
- (item) => item.id === rowData.id
- );
- console.log('currentIndex', this.currentIndex);
- this.activeName = '工艺参数';
- // this.baseCount = rowData.baseCount;
- // this.baseCountUnit = rowData.baseCountUnit;
- console.log(rowData, 'rowData');
- // this.form.baseCount = rowData.baseCount || 1;
- this.form.baseCountUnit = rowData.baseCountUnit;
- this.baseCount2 = rowData.baseCount2;
- this.baseCountUnit2 = rowData.baseCountUnit2;
- this.visible = true;
- setTimeout(() => {
- console.log(this.$refs);
- // 工艺参数
- this.$refs.table.setData(
- this.tableData.taskParam[this.currentIndex]?.produceList || []
- );
- this.$refs.userSettingMatterProcessRef.getMatterList();
- }, 500);
- this.getBomLevel();
- },
- async getBomLevel() {
- await getBomGetById(this.resourceBomId).then((res) => {
- if (res.data.level) {
- this.level = res.data.level;
- }
- });
- },
- handleClose() {
- this.visible = false;
- this.$refs.table.setSelectedRows([]);
- this.selection = [];
- },
- save(type) {
- if (this.activeName == '材料定额') {
- }
- this.$refs.form.validate((valid) => {
- let isYs = true;
- if (this.activeName == '材料定额') {
- isYs = valid;
- }
- if (isYs) {
- if (this.isView) {
- this.handleClose();
- } else {
- // 保存生产节拍
- let userInfo = JSON.parse(localStorage.getItem('info'));
- this.beatParam.createName = userInfo.name;
- this.beatParam.createTime = dayjs(new Date()).format(
- 'YYYY-MM-DD HH:mm:ss'
- );
- this.beatParam.updateName = userInfo.name;
- this.beatParam.updateTime = dayjs(new Date()).format(
- 'YYYY-MM-DD HH:mm:ss'
- );
- this.tableData.taskParam[this.currentIndex].beatParam =
- this.beatParam;
- // 保存材料定额
- this.tableData.taskParam[this.currentIndex].baseCount =
- this.form.baseCount;
- this.tableData.taskParam[this.currentIndex].baseCountUnit =
- this.form.baseCountUnit;
- const isCount = this.tableData.taskParam[
- this.currentIndex
- ].materialQuota.every((item) => {
- if (!item.count) {
- return false;
- }
- return true;
- });
- if (!isCount) {
- this.$message.warning('材料定额数量不能为空');
- return;
- }
- this.tableData.taskParam[this.currentIndex].baseCount2 =
- this.baseCount2;
- this.tableData.taskParam[this.currentIndex].baseCountUnit2 =
- this.baseCountUnit2;
- if (this.$refs.qualityParamRef) {
- this.tableData.taskParam[this.currentIndex].qualityParam =
- this.$refs.qualityParamRef.getDate() || [];
- }
- //工艺文件只传id
- let fileParamArr = JSON.parse(
- JSON.stringify(this.tableData.taskParam)
- );
- fileParamArr.map((item, index) => {
- if (item.fileParam.length > 0) {
- let val = [];
- item.fileParam.map((fileItem) => {
- let obj = {
- id: fileItem.id
- };
- val.push(obj);
- });
- this.$set(this.tableData.taskParam[index], 'fileParam', val);
- }
- });
- console.log('111112223344', this.tableData.taskParam);
- // 保存过程控制事项
- this.$refs.userSettingMatterProcessRef?.saveMatterList();
- workingProcedureUpdate({
- id: this.tableData.id,
- categoryId: this.treeData.categoryId,
- bomCategoryId: this.treeData.id,
- categoryCode: this.treeData.categoryCode,
- taskParam: this.tableData.taskParam
- }).then(() => {
- this.$message.success('保存成功');
- this.$emit('chooseProcess');
- if (type === 'close') {
- this.handleClose();
- }
- });
- }
- }
- });
- },
- //工艺文件表格回显
- fileParamDatasource(fileParam) {
- let fileId = fileParam.map((item) => item.id).join(',');
- newFilePageAPI({
- // pageNum: 1,
- // size: 999,
- // directoryId: null,
- // lcyStatus: 1,
- // fileType: 0,
- // ids: fileId
- ids: "'" + fileId + "'"
- }).then((res) => {
- this.$refs.fileTable.setData(res);
- });
- },
- async getDictList(code) {
- let { data: res } = await getByCode(code);
- this.dictList = res.reduce((acc, curr) => {
- let key = Object.keys(curr)[0]; // 获取当前对象的键
- let value = curr[key]; // 获取当前对象的值
- acc.push({ value, label: value }); // 将 { value, label } 格式的对象添加到数组中
- return acc;
- }, []); // 初始值为空数组 []
- },
- convertToSeconds(time) {
- switch (this.beatParam.unit) {
- case '秒':
- return time;
- case '分钟':
- return time * 60;
- case '小时':
- return time * 3600;
- case '天':
- return time * 86400; // 24小时 * 60分钟 * 60秒
- case '月':
- // 近似值,一个月按30天计算
- return time * 86400 * 30;
- case '年':
- // 近似值,一年按365天计算
- return time * 86400 * 365;
- case '毫秒':
- return time / 1000;
- case '微秒':
- return time / 1000000;
- default:
- this.$message.error('不支持的时间单位: ' + unit);
- }
- },
- convertVal(val, name) {
- if (!this.beatParam.unit) {
- return this.$message.error('请选择时间单位');
- }
- const isNumeric = /^\d*(\.\d+)?$/.test(val);
- if (isNumeric) {
- this.beatParam[name] = this.convertToSeconds(val);
- } else {
- this.$message.error('请输入数字');
- this.beatParam[name] = '';
- }
- },
- changeUnit() {
- this.beatParam.newTime = '';
- this.beatParam.time = '';
- this.beatParam.newBeatPrepareTime = '';
- this.beatParam.beatPrepareTime = '';
- this.beatParam.newBeatTime = '';
- this.beatParam.beatTime = '';
- this.beatParam.newBeatRestTime = '';
- this.beatParam.beatRestTime = '';
- this.beatParam.taskPrice = '';
- },
- handSubstitution(row) {
- this.$refs.replaceMaterialRef.open(row);
- },
- replaceSelected(id, list) {
- let _arr = [];
- _arr = this.tableData.taskParam[this.currentIndex].materialQuota;
- _arr.forEach((item) => {
- if (item.id === id) {
- item.replaceMaterial = list;
- }
- });
- this.tableData.taskParam[this.currentIndex].materialQuota = _arr;
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .btns {
- text-align: center;
- padding: 10px 0;
- }
- .downLoad {
- display: flex;
- }
- .toolbar_box {
- float: right;
- margin-right: 10px;
- > div {
- display: flex;
- align-items: center;
- justify-content: center;
- > span {
- width: 150px;
- }
- > div {
- margin-left: 10px;
- }
- }
- }
- .item-height {
- margin-bottom: 20px;
- }
- </style>
|