| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271 |
- <template>
- <div class="ele-body baseinfo-container">
- <el-card shadow="never">
- <div class="page-title">
- <el-page-header @back="$router.go(-1)">
- <div slot="content" class="pageContent">
- <div>{{ title }}</div>
- </div>
- </el-page-header>
- <div>
- <el-button type="primary" @click="submit" :loading="btnLoading"
- >确定</el-button
- >
- </div>
- </div>
- <el-form
- label-width="120px"
- :model="{ ...form, ...positionInfo }"
- ref="form"
- :rules="rules"
- >
- <div class="content">
- <div class="basic-details-title border-none">
- <span class="border-span">基本信息</span>
- </div>
- <el-descriptions title="" :column="4" size="medium" border>
- <template slot="title" v-if="pageType == 'add'">
- <el-form-item class="label-none" label-width="0">
- <span style="color: red; padding-right: 5px">*</span>
- <el-button type="primary" plain @click="handlwpbm"
- >选择物品编码</el-button
- >
- </el-form-item>
- </template>
- <el-descriptions-item>
- <template slot="label"> 设备编码 </template>
- <el-form-item
- prop="code"
- label-width="0"
- v-if="pageType == 'add'"
- >
- <el-input
- v-if="basicInfo"
- class="input"
- v-model="form.code"
- ></el-input>
- </el-form-item>
- <span v-if="pageType == 'edit'">{{ form.code }}</span>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 设备名称 </template>
- <el-form-item
- prop="name"
- label-width="0"
- v-if="pageType == 'add'"
- >
- <el-input
- v-if="basicInfo"
- class="input"
- v-model="form.name"
- ></el-input>
- </el-form-item>
- <span v-if="pageType == 'edit'">{{ form.name }}</span>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 牌号</template>
- {{ assetInfo.brandNum }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 型号</template>
- {{ assetInfo.modelType }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 规格 </template>
- {{ assetInfo.specification }}
- </el-descriptions-item>
- <el-descriptions-item :span="2">
- <template slot="label"> 分类 </template>
- {{ assetInfo.categoryLevelPath }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 生产日期 </template>
- <el-form-item
- prop="productTime"
- label-width="0"
- v-if="pageType == 'add'"
- >
- <el-date-picker
- v-if="basicInfo"
- v-model="form.productTime"
- type="datetime"
- placeholder="选择日期时间"
- value-format="yyyy-MM-dd HH:mm:ss"
- >
- </el-date-picker>
- </el-form-item>
- <span v-if="pageType == 'edit'">{{ form.productTime }}</span>
- </el-descriptions-item>
- <!-- <el-descriptions-item>
- <template slot="label"> 过保日期 </template>
- <span v-if="pageType == 'add'">{{ expirationTime }}</span>
- <span v-if="pageType == 'edit'">{{ cbexpirationTime }}</span>
- </el-descriptions-item> -->
- <el-descriptions-item>
- <template slot="label"> 计量单位 </template>
- {{ basicInfo.measuringUnit }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 标准产能 </template>
- {{ setbzcn(basicInfo.extendField) }}
- </el-descriptions-item>
- <!-- <el-descriptions-item v-if="pageType == 'edit'">
- <template slot="label"> 实际产能 </template>
- {{ basicInfo.measuringUnit }}
- </el-descriptions-item> -->
- <el-descriptions-item v-if="pageType == 'edit'">
- <template slot="label"> 生命周期</template>
- {{ sourceDICT }}
- </el-descriptions-item>
- <el-descriptions-item v-if="pageType == 'edit'">
- <template slot="label"> 网络状态</template>
- {{
- networkStatus === 1 ? '在线' : networkStatus === 0 ? '离线' : ''
- }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 重量单位 </template>
- {{ basicInfo.weightUnit }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 包装单位 </template>
- {{ basicInfo.packingUnit }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 体积 </template>
- {{ basicInfo.volume ? basicInfo.volume + '/' : null
- }}{{ basicInfo.volumeUnit }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 毛重 </template>
- {{ basicInfo.roughWeight }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 净重 </template>
- {{ basicInfo.netWeight }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 所属部门 </template>
- {{ basicInfo.groupName }}
- <!-- <personSelect
- ref="directorRef"
- v-model="basicInfo.deptId"
- :init="false"
- /> -->
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 负责人 </template>
- <!-- {{ basicInfo.packingUnit }} -->
- {{ basicInfo.name }}
- </el-descriptions-item>
- </el-descriptions>
- <div class="basic-details-title border-none">
- <span class="border-span">资产信息</span>
- </div>
- <el-descriptions
- title=""
- :column="4"
- size="medium"
- border
- style="edit"
- >
- <el-descriptions-item>
- <template slot="label"> 固资编码 </template>
- <el-form-item label-width="0">
- <el-input class="input" v-model="zcInfo.fixCode"></el-input>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 编号 </template>
- <el-form-item label-width="0">
- <el-input class="input" v-model="zcInfo.codeNumber"></el-input>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 颜色 </template>
- <el-form-item label-width="0">
- <el-input class="input" v-model="zcInfo.color"></el-input>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 重量 </template>
- <el-form-item label-width="0">
- <el-input class="input" v-model="zcInfo.weight"></el-input>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 维护部门 </template>
- <el-form-item label-width="0">
- <div class="input">
- <DeptSelect v-model="zcInfo.repairGroupId" @input="getwhbm" />
- </div>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 维护人 </template>
- <el-form-item label-width="0">
- <el-select
- style="width: 100%"
- v-model="zcInfo.repairUserId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in options.repairUserId"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 权属部门 </template>
- <el-form-item label-width="0">
- <div class="input">
- <DeptSelect
- v-model="zcInfo.ownershipGroupId"
- @input="getqsbm"
- />
- </div>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 权属人 </template>
- <el-form-item label-width="0">
- <el-select
- style="width: 100%"
- v-model="zcInfo.ownershipUserId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in options.ownershipUserId"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 设备用途 </template>
- <el-form-item label-width="0">
- <el-input v-model="zcInfo.purpose" class="input"></el-input>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 所属工序 </template>
- <el-form-item label-width="0">
- <WorkingProcedureSelect
- v-model="zcInfo.roteId"
- ></WorkingProcedureSelect>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 品牌 </template>
- <el-form-item label-width="0">
- <el-input v-model="zcInfo.brand" class="input"></el-input>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 供应商 </template>
- <el-form-item label-width="0">
- <el-select
- v-model="zcInfo.supplierId"
- style="width: 100%"
- placeholder="请选择"
- >
- <el-option
- v-for="item in options.supplierId"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item :span="4">
- <template slot="label"> 所属厂房 </template>
- <el-form-item label-width="0">
- <FactoryAreaSelect
- style="margin-right: 10px"
- v-model="zcInfo.factoryRoomId1"
- :augr="1"
- />
- <FactoryAreaSelect
- style="margin-right: 10px"
- v-model="zcInfo.factoryRoomId2"
- :augr="2"
- />
- <FactoryAreaSelect
- style="margin-right: 10px"
- v-model="zcInfo.factoryRoomId3"
- :augr="3"
- />
- <FactoryAreaSelect
- style="margin-right: 10px"
- v-model="zcInfo.factoryRoomId4"
- :augr="4"
- />
- <el-input
- placeholder="请输入"
- v-model="zcInfo.factoryRoomId5"
- style="width: 20%"
- ></el-input>
- </el-form-item>
- </el-descriptions-item>
- <el-descriptions-item :span="4">
- <template slot="label"> 设备位置 </template>
- <el-form-item label-width="0">
- <div style="display: flex">
- <div
- class="location-warp"
- style="width: 50%; margin-right: 10px"
- >
- <el-cascader
- clearable
- v-model="form.location"
- :options="options.cityDataLabel"
- ></el-cascader>
- </div>
- <factorySelect
- style="margin-right: 10px"
- v-model="positionInfo.factoryCode"
- placeholder="请选择工厂"
- @selfChange="hanldFactoryCode"
- />
- <WorkshopSelect
- style="margin-right: 10px"
- ref="WorkshopSelectRef"
- :factoryId="positionInfo.factoryCode"
- v-model="positionInfo.workshopCode"
- @selfChange="hanldWorkshopCode"
- placeholder="请选择车间"
- />
- <FactoryLineSelect
- style="margin-right: 10px"
- ref="FactoryLineSelectRef"
- :workshopId="positionInfo.workshopCode"
- v-model="positionInfo.lineCode"
- @selfChange="hanldlineCodeCode"
- placeholder="请选择产线"
- />
- <el-input
- style="margin-right: 10px"
- class="item item-input"
- placeholder="详细地址"
- v-model="positionInfo.detailPosition"
- ></el-input>
- <el-input
- class="detail"
- clearable
- :maxlength="20"
- v-model="form.locationDetail"
- placeholder="请输入详细地址"
- />
- </div>
- </el-form-item>
- </el-descriptions-item>
- </el-descriptions>
- <div class="basic-details-title border-none">
- <span class="border-span">仓储配置</span>
- </div>
- <el-descriptions title="" :column="4" size="medium" border>
- <el-descriptions-item>
- <template slot="label"> 启用库存预警</template>
- {{ dictType[categoryWms.isWarn] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">允许拆包</template>
- {{ dictType[categoryWms.isUnpack] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">安全库存</template>
- {{ categoryWms.secureInventory }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">最小库存</template>
- {{ categoryWms.minInventory }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label"> 最大库存</template>
- {{ categoryWms.maxInventory }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">盘点模式</template>
- {{ dictPd[categoryWms.inventoryMode] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">质保预警参考</template>
- <!-- <DictSelection
- dictName="质保预警参考"
- clearable
- v-model="categoryWms.warrantyWarnRefer"
- >
- </DictSelection> -->
- {{ categoryWms.warrantyWarnRefer }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">保质期</template>
- {{
- categoryWms.warrantyPeriod
- ? categoryWms.warrantyPeriod + '/'
- : null
- }}{{ categoryWms.warrantyPeriodUnit }}
- </el-descriptions-item>
- </el-descriptions>
- <div class="basic-details-title border-none">
- <span class="border-span">生产信息</span>
- </div>
- <el-descriptions title="" :column="4" size="medium" border>
- <el-descriptions-item>
- <template slot="label"> 是否齐套件</template>
- {{ dictType[categoryMes.isCompleteSet] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">消耗波动</template>
- {{ categoryMes.consumWave ? categoryMes.consumWave + '%' : null }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">变动损耗率</template>
- {{
- categoryMes.changeLossRate
- ? categoryMes.changeLossRate + '%'
- : null
- }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">固定损耗数</template>
- {{ categoryMes.fixLossNum }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">排程类型</template>
- {{ categoryMes.apsType }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">允许改型</template>
- {{ dictType[categoryMes.isModify] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">允许返工返修</template>
- {{ dictType[categoryMes.isRework] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">是否返回料</template>
- {{ dictType[categoryMes.isRematerial] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">是否副产品</template>
- {{ dictType[categoryMes.isByProduct] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">是否废品</template>
- {{ dictType[categoryMes.isWaste] }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">是否不良品</template>
- {{ dictType[categoryMes.isDefective] }}
- </el-descriptions-item>
- </el-descriptions>
- <div class="basic-details-title border-none">
- <span class="border-span">生产信息</span>
- </div>
- <el-descriptions title="" :column="4" size="medium" border>
- <el-descriptions-item>
- <template slot="label">附件信息</template>
- {{ categoryObj.fileName }}
- </el-descriptions-item>
- <el-descriptions-item>
- <template slot="label">备注信息</template>
- {{ categoryObj.remark }}
- </el-descriptions-item>
- </el-descriptions>
- <div class="basic-details-title border-none">
- <span class="border-span">关联信息</span>
- </div>
- <linkMsg
- v-if="isLink"
- ref="linkMsgRef"
- :id="categoryObj.id"
- :categoryLevelId="categoryObj.categoryLevelId"
- :categoryLevelGroupId="categoryObj.categoryLevelGroupId"
- />
- <div class="basic-details-title border-none">
- <span class="border-span">文档信息</span>
- </div>
- <div class="upload-container">
- <WithView v-model="imageUrl" :limit="1" />
- <div class="file-list">
- <div>
- <el-form-item prop="image" label="使用说明书">
- <fileUpload
- v-model="attUrl.operatingManual.value"
- module="main"
- :showLib="true"
- />
- </el-form-item>
- </div>
- <div>
- <el-form-item prop="image" label="生产许可证书">
- <fileUpload
- v-model="attUrl.productionLicence.value"
- module="main"
- :showLib="true"
- />
- </el-form-item>
- </div>
- <div>
- <el-form-item prop="image" label="防爆合格证书">
- <fileUpload
- v-model="attUrl.explosionProofCertificate.value"
- module="main"
- :showLib="true"
- />
- </el-form-item>
- </div>
- <div>
- <el-form-item prop="image" label="检验报告">
- <fileUpload
- v-model="attUrl.surveyReport.value"
- module="main"
- :showLib="true"
- />
- </el-form-item>
- </div>
- <div>
- <el-form-item prop="image" label="检验周期说明">
- <fileUpload
- v-model="attUrl.inspectionCycleManual.value"
- module="main"
- :showLib="true"
- />
- </el-form-item>
- </div>
- <div>
- <el-form-item prop="image" label="图纸资料">
- <fileUpload
- v-model="attUrl.informationDrawing.value"
- module="main"
- :showLib="true"
- />
- </el-form-item>
- </div>
- <div>
- <el-form-item prop="image" label="产品合格证">
- <fileUpload
- v-model="attUrl.productCertificate.value"
- module="main"
- :showLib="true"
- />
- </el-form-item>
- </div>
- </div>
- </div>
- <div class="basic-details-title border-none">
- <span class="border-span">物联参数</span>
- </div>
- <el-row>
- <el-col>
- <el-form-item label="是否启用物联">
- <el-switch
- v-model="isIotEnable"
- active-text="开"
- inactive-text="关"
- :active-value="1"
- :inactive-value="0"
- >
- </el-switch>
- </el-form-item>
- </el-col>
- <el-col>
- <el-form-item label="物联ID">{{ iotId }}</el-form-item>
- </el-col>
- </el-row>
- <div class="basic-details-title border-none">
- <span class="border-span">扩展信息</span>
- </div>
- <div class="kzzd">
- <el-row>
- <el-col
- :span="24"
- v-for="(item, index) in form.extInfoSelf"
- :key="index"
- style="margin-bottom: 20px"
- >
- <el-form-item
- label-width="0"
- :prop="'extInfoSelf.' + index + '.key'"
- :rules="{
- required: true,
- message: '自定义参数名称不能为空',
- trigger: 'blur'
- }"
- >
- <div class="add-col">
- <el-input
- class="col-input"
- v-model="item.key"
- placeholder="参数名称"
- ></el-input>
- <el-input
- class="col-input"
- v-model="item.value"
- placeholder="参数值"
- ></el-input>
- <el-button
- class="del"
- type="text"
- @click="delt(item, index)"
- >
- 删除
- </el-button>
- </div>
- </el-form-item>
- </el-col>
- <el-col :span="24" v-if="form.extInfoSelf.length < 10">
- <el-form-item label-width="0">
- <el-button
- class="primarybutton"
- type="primary"
- @click="addItem"
- >增加自定义参数</el-button
- >
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </div>
- </el-form>
- <DialogGoods
- ref="DialogGoods"
- @succeed="cbDialogGoods"
- width="1200px"
- ></DialogGoods>
- </el-card>
- </div>
- </template>
- <script>
- import DeptSelect from '@/components/CommomSelect/dept-select.vue';
- import FactoryLineSelect from '@/components/CommomSelect/factory-line-select.vue';
- import WorkshopSelect from '@/components/CommomSelect/workshop-select.vue';
- import FactoryAreaSelect from '@/components/CommomSelect/factory-area-select.vue';
- import WorkingProcedureSelect from '@/components/CommomSelect/working-procedure-select.vue';
- import factorySelect from '@/components/CommomSelect/factory-select.vue';
- import fileUpload from '@/components/upload/fileUpload';
- import WithView from '@/components/upload/WithView';
- import imgUpload from '@/components/upload/imgUpload';
- import { cityDataLabel } from 'ele-admin/packages/utils/regions';
- import personSelect from '@/components/CommomSelect/person-select.vue';
- import { getDetails } from '@/api/classifyManage/itemInformation';
- import { sysDict, isExit } from '@/utils/sys';
- import linkMsg from './components/link-msg.vue';
- // import selectUpload from "@/components/selectUpload";
- // import UploadImg from "@/components/uploadImg/WithView.vue";
- import DialogGoods from './components/DialogGoods';
- // import { parseTime } from "@/utils/ruoyi.js";
- // import org from "@/api/main/org";
- // import user from "@/api/main/user";
- // import selectTree from "@/components/selectTree";
- // import dict from "@/api/main/craft/dict";
- // import { imageView } from "@/utils";
- // import {
- // getPlants,
- // getfactoryInfo,
- // getFactorys,
- // getProductionLine,
- // saveOrEdit,
- // getAssetNum,
- // getDetail,
- // getSupplier
- // } from '@/api/ledgerAssets/equipment';
- import { getFactoryarea } from '@/api/factoryModel';
- import { saveOrEdit, getAssetInfo } from '@/api/ledgerAssets';
- import { getUserPage } from '@/api/system/organization';
- export default {
- components: {
- linkMsg,
- //selectUpload,
- //UploadImg,
- FactoryLineSelect,
- WithView,
- WorkshopSelect,
- FactoryAreaSelect,
- WorkingProcedureSelect,
- fileUpload,
- imgUpload,
- factorySelect,
- DialogGoods,
- DeptSelect,
- personSelect
- },
- data() {
- return {
- isLink: true,
- categoryObj: {},
- dictType: {
- 1: '是',
- 0: '否'
- },
- dictPd: {
- 1: '逐个盘点',
- 2: '批量盘点'
- },
- categoryMes: {
- isModify: '',
- isRework: '',
- isRematerial: '',
- isByProduct: '',
- isWaste: '',
- isDefective: ''
- },
- categoryWms: {}, //仓储
- title: '新建设备信息',
- pageType: 'add',
- btnLoading: false,
- // 设备主键id
- id: '',
- form: {
- extInfoSelf: [],
- // 基本信息
- code: '',
- name: '',
- productTime: ''
- },
- rules: {
- name: [
- { required: true, message: '请输入设备名称', trigger: 'blur' }
- ],
- location: [
- { required: true, message: '请输入设备位置', trigger: 'change' }
- ],
- code: [{ required: true, message: '请输入设备编码', trigger: 'blur' }]
- },
- // 基本信息
- basicInfo: {},
- assetInfo: {},
- // 资产信息
- zcInfo: {
- // 固定资产编码
- fixCode: '',
- // 颜色
- color: '',
- // 重量
- weight: '',
- // 维护部门code
- repairGroupId: '',
- repairDeptName: '',
- repairUserId: '',
- // 权属部门
- ownershipGroupId: '',
- ownershipUserId: '',
- // 设备用途
- purpose: '',
- // 工序
- roteId: '',
- //品牌
- brand: '',
- // 供应商code
- supplierId: '',
- // 厂房
- factoryRoomId: '',
- roteCode: '',
- codeNumber: ''
- },
- positionInfo: {
- // 详细地址
- detailPosition: '',
- // 请选择产线
- lineCode: '',
- lineName: '',
- // 请选择车间
- workshopCode: '',
- workshopName: '',
- // 请选择工厂
- factoryCode: '',
- factoryName: ''
- },
- // 图片
- imageUrl: null,
- // 文档信息
- attUrl: {
- operatingManual: {
- value: [],
- sort: 1
- },
- productionLicence: {
- value: [],
- sort: 2
- },
- explosionProofCertificate: {
- value: [],
- sort: 3
- },
- surveyReport: {
- value: [],
- sort: 4
- },
- inspectionCycleManual: {
- value: [],
- sort: 5
- },
- informationDrawing: {
- value: [],
- sort: 6
- },
- productCertificate: {
- value: [],
- sort: 7
- }
- },
- // 是否开始物联
- isIotEnable: true,
- // 物联ID
- iotId: '',
- // 回显过保时间
- cbexpirationTime: '',
- // 生命周期
- sourceDICT: '',
- // 网络状态
- networkStatus: '',
- options: {
- deptList: [],
- repairUserId: [],
- ownershipUserId: [],
- supplierId: [],
- brand: [],
- cityDataLabel
- },
- depList: []
- };
- },
- watch: {},
- computed: {
- // 过保时间
- expirationTime() {
- if (this.form.productTime && this.basicInfo.expirationDate) {
- return this.setGbTime(
- this.form.productTime,
- this.basicInfo.expirationDate,
- this.basicInfo.expirationDateUnit
- );
- } else {
- return '';
- }
- }
- },
- async created() {
- if (this.$route.query.id) {
- this.pageType = 'edit';
- this.id = this.$route.query.id;
- this.getInfo();
- this.title = '编辑设备信息';
- this.getgys();
- }
- },
- methods: {
- isExit,
- handlwpbm() {
- this.$refs.DialogGoods.open();
- },
- async cbDialogGoods(data) {
- console.log(data);
- this.basicInfo = data;
- this.assetInfo = data;
- this.form.rootCategoryLevelId =
- this.basicInfo.categoryLevelPathId.split(',')[0];
- this.form.categoryId = this.basicInfo.id;
- this.form.name = this.basicInfo.name;
- // let res = await getAssetNum({
- // assetCode: this.basicInfo.code,
- // num: 1
- // });
- this.form.code = data.code; //Date.now(); //res.data[0].onlyCode;
- for (const key in this.depList) {
- if (this.depList[key].id == data.deptId) {
- this.basicInfo.name = this.depList[key].name;
- this.basicInfo.groupName = this.depList[key].groupName;
- return;
- }
- }
- },
- async seachDetail(id) {
- this.isLink = false;
- const res = await getDetails(id);
- console.log('res==', res);
- this.categoryWms = {
- ...res.categoryWms,
- warrantyWarnRefer: await sysDict(
- '质保预警参考',
- res.categoryWms.warrantyWarnRefer
- ),
- warrantyPeriodUnit: await sysDict(
- '保质期单位',
- res.categoryWms.warrantyPeriodUnit
- )
- };
- this.categoryMes = {
- ...res.categoryMes,
- apsType: await sysDict('排程类型', res.categoryMes.apsType)
- };
- this.categoryObj = {
- ...res.category,
- fileName: res.category.remarkAttach
- ? res.category.remarkAttach.map((item) => item.name).join(', ')
- : ''
- };
- console.log(this.categoryObj);
- this.isLink = true;
- },
- // 计算过保时间
- setGbTime(basic, value, type) {
- basic = Date.parse(basic);
- let time;
- switch (type) {
- case 'minute':
- time = value * 1000 * 60;
- break;
- case 'hour':
- time = value * 1000 * 60 * 60;
- break;
- case 'day':
- time = value * 1000 * 60 * 60 * 24;
- break;
- case 'month':
- time = value * 1000 * 60 * 60 * 24 * 30;
- break;
- case 'year':
- time = value * 1000 * 60 * 60 * 24 * 365;
- break;
- default:
- break;
- }
- let num = basic + time;
- return parseTime(num);
- },
- async getwhbm() {
- if (!this.zcInfo.repairGroupId) return;
- let data = await getUserPage({
- pageNum: 1,
- size: 9999,
- groupId: this.zcInfo.repairGroupId
- });
- this.options.repairUserId = data.list;
- },
- async getqsbm() {
- if (!this.zcInfo.ownershipGroupId) return;
- let data = await getUserPage({
- pageNum: 1,
- size: 9999,
- groupId: this.zcInfo.ownershipGroupId
- });
- this.options.ownershipUserId = data.list;
- },
- // 树形结构数据
- getTreeList() {
- org.tree().then((res) => {
- this.options.deptList = res.data;
- });
- },
- // 获取供应商、工序列表
- async getgys() {
- let muster = await getSupplier({
- size: 999
- });
- this.options.supplierId = muster.data.items; //供应商
- },
- // 添加自定义参数
- addItem() {
- if (this.form.extInfoSelf.length < 10) {
- let item = { key: '', value: '' };
- this.form.extInfoSelf.push(item);
- } else {
- this.$message.warning('自定义参数最多添加10条');
- }
- },
- // 删除自定义参数
- delt(item, index) {
- this.form.extInfoSelf.splice(index, 1);
- },
- // 提交
- submit() {
- if (!this.basicInfo && this.pageType == 'add') {
- return this.$message.error('请选择物品编码');
- }
- this.$refs.form.validate((valid) => {
- if (valid) {
- let par = {
- //基本信息
- ...this.form,
- // id: this.basicInfo.id,
- // assetCode: this.form.code,
- // assetName: this.form.name,
- assetType: 1,
- // informationId: this.basicInfo.id,
- // productTime: this.form.productTime,
- // expirationTime: this.expirationTime,
- // 资产信息
- positionIds: '1,1,1,1',
- ...this.zcInfo,
- position: {
- detailPosition: this.positionInfo.detailPosition,
- pathIds: `${this.positionInfo.factoryCode},${this.positionInfo.workshopCode},${this.positionInfo.lineCode}`,
- pathName: `${this.positionInfo.factoryName},${this.positionInfo.workshopName},${this.positionInfo.lineName}`,
- type: '1',
- num: 1
- },
- // 文档信息
- attUrl: this.setWd() || [],
- // // 设备图片
- imageUrl: this.imageUrl || {},
- // 是否启用物联
- isIotEnable: this.isIotEnable
- // // 扩展字段
- // extInfoSelf: this.setKz()
- };
- //============================
- par.extInfo = { ...this.zcInfo };
- let obj = {};
- par.extInfoSelf.forEach((item) => {
- obj[item.key] = item.value;
- });
- par.extInfoSelf = obj;
- //============================
- if (this.pageType == 'edit') {
- par.id = this.id;
- }
- this.btnLoading = true;
- console.log('sasasasa', par);
- saveOrEdit(par)
- .then((res) => {
- this.$message.success('操作成功');
- this.$router.go(-1);
- })
- .finally(() => {
- this.btnLoading = false;
- });
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- // 处理扩展字段
- setKz() {
- return this.form.extInfoSelf || [];
- },
- // 处理文档信息
- setWd() {
- return Object.values(this.attUrl).map((item) => ({
- ...(item.value[0] || {}),
- sort: item.sort
- }));
- },
- // 选择所属部门
- async searchDeptNodeClick(id, ids) {
- // 根据部门获取人员
- const res = await getUserPage({
- pageNum: 1,
- size: -1,
- executeGroupId: id
- });
- // const depId = res.list.find((item) => {
- // item.id == ids;
- // });
- // console.log('depId', depId);
- this.depList = res.list;
- },
- // 获取设备详情
- async getInfo() {
- const data = await getAssetInfo(this.id);
- data.extInfoSelf = data.extInfoSelf || [];
- this.form = data;
- this.basicInfo = data.category;
- this.assetInfo = data.category.category;
- this.cbexpirationTime = data.expirationTime;
- this.sourceDICT = data.sourceDICT;
- this.networkStatus = data.networkStatus;
- if (data.positionList?.length) {
- this.positionInfo.detailPosition =
- data.positionList[0].detailPosition;
- const pathIds = data.positionList[0].pathIds.split(',');
- const pathName = data.positionList[0].pathName.split(',');
- this.positionInfo.factoryCode = pathIds[0];
- this.positionInfo.factoryName = pathName[0];
- this.positionInfo.workshopCode = pathIds[1];
- this.positionInfo.workshopName = pathName[1];
- this.positionInfo.lineCode = pathIds[2];
- this.positionInfo.lineName = pathName[2];
- this.$nextTick(() => {
- // this.$refs.WorkshopSelectRef.getList();
- // this.$refs.FactoryLineSelectRef.getList();
- });
- console.log('data', data);
- this.isLink = false;
- this.categoryWms = {
- ...data.category.categoryWms,
- warrantyWarnRefer: await sysDict(
- '质保预警参考',
- data.category.categoryWms.warrantyWarnRefer
- ),
- warrantyPeriodUnit: await sysDict(
- '保质期单位',
- data.category.categoryWms.warrantyPeriodUnit
- )
- };
- this.categoryMes = {
- ...data.category.categoryMes,
- apsType: await sysDict(
- '排程类型',
- data.category.categoryMes.apsType
- )
- };
- this.categoryObj = {
- ...data.category.category,
- fileName: data.category.category.remarkAttach
- ? data.category.category.remarkAttach
- .map((item) => item.name)
- .join(', ')
- : ''
- };
- this.isLink = true;
- }
- // 资产信息
- for (const key of Object.keys(this.zcInfo)) {
- this.zcInfo[key] = data[key];
- }
- this.getwhbm();
- this.getqsbm();
- if (data.attUrl && data.attUrl.length > 0) {
- // 文档信息
- Object.keys(this.attUrl).forEach((n, index) => {
- this.attUrl[n].value =
- (data.attUrl[index]?.storePath && [data.attUrl[index]]) || [];
- });
- }
- // 设备图片
- this.imageUrl = data.imageUrl;
- // 物联参数
- this.isIotEnable = data.isIotEnable;
- this.iotId = data.iotId;
- },
- // 设置标准产能
- setbzcn(val) {
- if (!val) {
- return '';
- }
- let item = JSON.parse(val);
- return item.standardCapacity || '';
- },
- hanldFactoryCode(val, item) {
- this.positionInfo.factoryName = item?.name;
- // 重置
- this.zcInfo.workshopCode = '';
- this.zcInfo.lineCode = '';
- this.options.workshopCode = [];
- this.options.lineCode = [];
- // 获取车间
- this.$nextTick(() => {
- // this.$refs.WorkshopSelectRef.getList();
- });
- },
- hanldWorkshopCode(val, item) {
- this.positionInfo.workshopName = item?.name;
- // 重置
- this.options.workshopCode = [];
- this.options.lineCode = [];
- // 获取产线
- this.$nextTick(() => {
- // this.$refs.FactoryLineSelectRef.getList();
- });
- },
- hanldlineCodeCode(val, item) {
- this.positionInfo.lineName = item?.name;
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-descriptions__table tbody:nth-child(4) {
- .el-descriptions-row {
- .el-descriptions-item__cell:last-child {
- }
- }
- }
- .baseinfo-container .basic-details-title {
- font-size: 16px;
- margin: 15px 0;
- }
- .upload-container {
- display: flex;
- justify-content: flex-start;
- .file-list {
- margin-left: 50px;
- flex: 1;
- }
- }
- .equipment-container {
- // .content {
- // padding: 0 20px;
- // }
- .label-none {
- .el-form-item__content {
- margin-left: 0 !important;
- }
- }
- }
- .sbwz {
- .item {
- width: 120px !important;
- }
- .item + .item {
- margin-left: 10px;
- }
- .item-input {
- width: 350px !important;
- }
- }
- .input {
- width: 100%;
- }
- .kzzd {
- width: 500px;
- .add-col {
- display: flex;
- .col-input {
- & + .col-input {
- margin-left: 10px;
- }
- }
- .del {
- margin-left: 10px;
- }
- }
- }
- ::v-deep .el-descriptions {
- .el-form-item {
- margin-bottom: 0px;
- }
- }
- </style>
|