edit.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271
  1. <template>
  2. <div class="ele-body baseinfo-container">
  3. <el-card shadow="never">
  4. <div class="page-title">
  5. <el-page-header @back="$router.go(-1)">
  6. <div slot="content" class="pageContent">
  7. <div>{{ title }}</div>
  8. </div>
  9. </el-page-header>
  10. <div>
  11. <el-button type="primary" @click="submit" :loading="btnLoading"
  12. >确定</el-button
  13. >
  14. </div>
  15. </div>
  16. <el-form
  17. label-width="120px"
  18. :model="{ ...form, ...positionInfo }"
  19. ref="form"
  20. :rules="rules"
  21. >
  22. <div class="content">
  23. <div class="basic-details-title border-none">
  24. <span class="border-span">基本信息</span>
  25. </div>
  26. <el-descriptions title="" :column="4" size="medium" border>
  27. <template slot="title" v-if="pageType == 'add'">
  28. <el-form-item class="label-none" label-width="0">
  29. <span style="color: red; padding-right: 5px">*</span>
  30. <el-button type="primary" plain @click="handlwpbm"
  31. >选择物品编码</el-button
  32. >
  33. </el-form-item>
  34. </template>
  35. <el-descriptions-item>
  36. <template slot="label"> 设备编码 </template>
  37. <el-form-item
  38. prop="code"
  39. label-width="0"
  40. v-if="pageType == 'add'"
  41. >
  42. <el-input
  43. v-if="basicInfo"
  44. class="input"
  45. v-model="form.code"
  46. ></el-input>
  47. </el-form-item>
  48. <span v-if="pageType == 'edit'">{{ form.code }}</span>
  49. </el-descriptions-item>
  50. <el-descriptions-item>
  51. <template slot="label"> 设备名称 </template>
  52. <el-form-item
  53. prop="name"
  54. label-width="0"
  55. v-if="pageType == 'add'"
  56. >
  57. <el-input
  58. v-if="basicInfo"
  59. class="input"
  60. v-model="form.name"
  61. ></el-input>
  62. </el-form-item>
  63. <span v-if="pageType == 'edit'">{{ form.name }}</span>
  64. </el-descriptions-item>
  65. <el-descriptions-item>
  66. <template slot="label"> 牌号</template>
  67. {{ assetInfo.brandNum }}
  68. </el-descriptions-item>
  69. <el-descriptions-item>
  70. <template slot="label"> 型号</template>
  71. {{ assetInfo.modelType }}
  72. </el-descriptions-item>
  73. <el-descriptions-item>
  74. <template slot="label"> 规格 </template>
  75. {{ assetInfo.specification }}
  76. </el-descriptions-item>
  77. <el-descriptions-item :span="2">
  78. <template slot="label"> 分类 </template>
  79. {{ assetInfo.categoryLevelPath }}
  80. </el-descriptions-item>
  81. <el-descriptions-item>
  82. <template slot="label"> 生产日期 </template>
  83. <el-form-item
  84. prop="productTime"
  85. label-width="0"
  86. v-if="pageType == 'add'"
  87. >
  88. <el-date-picker
  89. v-if="basicInfo"
  90. v-model="form.productTime"
  91. type="datetime"
  92. placeholder="选择日期时间"
  93. value-format="yyyy-MM-dd HH:mm:ss"
  94. >
  95. </el-date-picker>
  96. </el-form-item>
  97. <span v-if="pageType == 'edit'">{{ form.productTime }}</span>
  98. </el-descriptions-item>
  99. <!-- <el-descriptions-item>
  100. <template slot="label"> 过保日期 </template>
  101. <span v-if="pageType == 'add'">{{ expirationTime }}</span>
  102. <span v-if="pageType == 'edit'">{{ cbexpirationTime }}</span>
  103. </el-descriptions-item> -->
  104. <el-descriptions-item>
  105. <template slot="label"> 计量单位 </template>
  106. {{ basicInfo.measuringUnit }}
  107. </el-descriptions-item>
  108. <el-descriptions-item>
  109. <template slot="label"> 标准产能 </template>
  110. {{ setbzcn(basicInfo.extendField) }}
  111. </el-descriptions-item>
  112. <!-- <el-descriptions-item v-if="pageType == 'edit'">
  113. <template slot="label"> 实际产能 </template>
  114. {{ basicInfo.measuringUnit }}
  115. </el-descriptions-item> -->
  116. <el-descriptions-item v-if="pageType == 'edit'">
  117. <template slot="label"> 生命周期</template>
  118. {{ sourceDICT }}
  119. </el-descriptions-item>
  120. <el-descriptions-item v-if="pageType == 'edit'">
  121. <template slot="label"> 网络状态</template>
  122. {{
  123. networkStatus === 1 ? '在线' : networkStatus === 0 ? '离线' : ''
  124. }}
  125. </el-descriptions-item>
  126. <el-descriptions-item>
  127. <template slot="label"> 重量单位 </template>
  128. {{ basicInfo.weightUnit }}
  129. </el-descriptions-item>
  130. <el-descriptions-item>
  131. <template slot="label"> 包装单位 </template>
  132. {{ basicInfo.packingUnit }}
  133. </el-descriptions-item>
  134. <el-descriptions-item>
  135. <template slot="label"> 体积 </template>
  136. {{ basicInfo.volume ? basicInfo.volume + '/' : null
  137. }}{{ basicInfo.volumeUnit }}
  138. </el-descriptions-item>
  139. <el-descriptions-item>
  140. <template slot="label"> 毛重 </template>
  141. {{ basicInfo.roughWeight }}
  142. </el-descriptions-item>
  143. <el-descriptions-item>
  144. <template slot="label"> 净重 </template>
  145. {{ basicInfo.netWeight }}
  146. </el-descriptions-item>
  147. <el-descriptions-item>
  148. <template slot="label"> 所属部门 </template>
  149. {{ basicInfo.groupName }}
  150. <!-- <personSelect
  151. ref="directorRef"
  152. v-model="basicInfo.deptId"
  153. :init="false"
  154. /> -->
  155. </el-descriptions-item>
  156. <el-descriptions-item>
  157. <template slot="label"> 负责人 </template>
  158. <!-- {{ basicInfo.packingUnit }} -->
  159. {{ basicInfo.name }}
  160. </el-descriptions-item>
  161. </el-descriptions>
  162. <div class="basic-details-title border-none">
  163. <span class="border-span">资产信息</span>
  164. </div>
  165. <el-descriptions
  166. title=""
  167. :column="4"
  168. size="medium"
  169. border
  170. style="edit"
  171. >
  172. <el-descriptions-item>
  173. <template slot="label"> 固资编码 </template>
  174. <el-form-item label-width="0">
  175. <el-input class="input" v-model="zcInfo.fixCode"></el-input>
  176. </el-form-item>
  177. </el-descriptions-item>
  178. <el-descriptions-item>
  179. <template slot="label"> 编号 </template>
  180. <el-form-item label-width="0">
  181. <el-input class="input" v-model="zcInfo.codeNumber"></el-input>
  182. </el-form-item>
  183. </el-descriptions-item>
  184. <el-descriptions-item>
  185. <template slot="label"> 颜色 </template>
  186. <el-form-item label-width="0">
  187. <el-input class="input" v-model="zcInfo.color"></el-input>
  188. </el-form-item>
  189. </el-descriptions-item>
  190. <el-descriptions-item>
  191. <template slot="label"> 重量 </template>
  192. <el-form-item label-width="0">
  193. <el-input class="input" v-model="zcInfo.weight"></el-input>
  194. </el-form-item>
  195. </el-descriptions-item>
  196. <el-descriptions-item>
  197. <template slot="label"> 维护部门 </template>
  198. <el-form-item label-width="0">
  199. <div class="input">
  200. <DeptSelect v-model="zcInfo.repairGroupId" @input="getwhbm" />
  201. </div>
  202. </el-form-item>
  203. </el-descriptions-item>
  204. <el-descriptions-item>
  205. <template slot="label"> 维护人 </template>
  206. <el-form-item label-width="0">
  207. <el-select
  208. style="width: 100%"
  209. v-model="zcInfo.repairUserId"
  210. placeholder="请选择"
  211. >
  212. <el-option
  213. v-for="item in options.repairUserId"
  214. :key="item.id"
  215. :label="item.name"
  216. :value="item.id"
  217. >
  218. </el-option>
  219. </el-select>
  220. </el-form-item>
  221. </el-descriptions-item>
  222. <el-descriptions-item>
  223. <template slot="label"> 权属部门 </template>
  224. <el-form-item label-width="0">
  225. <div class="input">
  226. <DeptSelect
  227. v-model="zcInfo.ownershipGroupId"
  228. @input="getqsbm"
  229. />
  230. </div>
  231. </el-form-item>
  232. </el-descriptions-item>
  233. <el-descriptions-item>
  234. <template slot="label"> 权属人 </template>
  235. <el-form-item label-width="0">
  236. <el-select
  237. style="width: 100%"
  238. v-model="zcInfo.ownershipUserId"
  239. placeholder="请选择"
  240. >
  241. <el-option
  242. v-for="item in options.ownershipUserId"
  243. :key="item.id"
  244. :label="item.name"
  245. :value="item.id"
  246. >
  247. </el-option>
  248. </el-select>
  249. </el-form-item>
  250. </el-descriptions-item>
  251. <el-descriptions-item>
  252. <template slot="label"> 设备用途 </template>
  253. <el-form-item label-width="0">
  254. <el-input v-model="zcInfo.purpose" class="input"></el-input>
  255. </el-form-item>
  256. </el-descriptions-item>
  257. <el-descriptions-item>
  258. <template slot="label"> 所属工序 </template>
  259. <el-form-item label-width="0">
  260. <WorkingProcedureSelect
  261. v-model="zcInfo.roteId"
  262. ></WorkingProcedureSelect>
  263. </el-form-item>
  264. </el-descriptions-item>
  265. <el-descriptions-item>
  266. <template slot="label"> 品牌 </template>
  267. <el-form-item label-width="0">
  268. <el-input v-model="zcInfo.brand" class="input"></el-input>
  269. </el-form-item>
  270. </el-descriptions-item>
  271. <el-descriptions-item>
  272. <template slot="label"> 供应商 </template>
  273. <el-form-item label-width="0">
  274. <el-select
  275. v-model="zcInfo.supplierId"
  276. style="width: 100%"
  277. placeholder="请选择"
  278. >
  279. <el-option
  280. v-for="item in options.supplierId"
  281. :key="item.id"
  282. :label="item.name"
  283. :value="item.id"
  284. >
  285. </el-option>
  286. </el-select>
  287. </el-form-item>
  288. </el-descriptions-item>
  289. <el-descriptions-item :span="4">
  290. <template slot="label"> 所属厂房 </template>
  291. <el-form-item label-width="0">
  292. <FactoryAreaSelect
  293. style="margin-right: 10px"
  294. v-model="zcInfo.factoryRoomId1"
  295. :augr="1"
  296. />
  297. <FactoryAreaSelect
  298. style="margin-right: 10px"
  299. v-model="zcInfo.factoryRoomId2"
  300. :augr="2"
  301. />
  302. <FactoryAreaSelect
  303. style="margin-right: 10px"
  304. v-model="zcInfo.factoryRoomId3"
  305. :augr="3"
  306. />
  307. <FactoryAreaSelect
  308. style="margin-right: 10px"
  309. v-model="zcInfo.factoryRoomId4"
  310. :augr="4"
  311. />
  312. <el-input
  313. placeholder="请输入"
  314. v-model="zcInfo.factoryRoomId5"
  315. style="width: 20%"
  316. ></el-input>
  317. </el-form-item>
  318. </el-descriptions-item>
  319. <el-descriptions-item :span="4">
  320. <template slot="label"> 设备位置 </template>
  321. <el-form-item label-width="0">
  322. <div style="display: flex">
  323. <div
  324. class="location-warp"
  325. style="width: 50%; margin-right: 10px"
  326. >
  327. <el-cascader
  328. clearable
  329. v-model="form.location"
  330. :options="options.cityDataLabel"
  331. ></el-cascader>
  332. </div>
  333. <factorySelect
  334. style="margin-right: 10px"
  335. v-model="positionInfo.factoryCode"
  336. placeholder="请选择工厂"
  337. @selfChange="hanldFactoryCode"
  338. />
  339. <WorkshopSelect
  340. style="margin-right: 10px"
  341. ref="WorkshopSelectRef"
  342. :factoryId="positionInfo.factoryCode"
  343. v-model="positionInfo.workshopCode"
  344. @selfChange="hanldWorkshopCode"
  345. placeholder="请选择车间"
  346. />
  347. <FactoryLineSelect
  348. style="margin-right: 10px"
  349. ref="FactoryLineSelectRef"
  350. :workshopId="positionInfo.workshopCode"
  351. v-model="positionInfo.lineCode"
  352. @selfChange="hanldlineCodeCode"
  353. placeholder="请选择产线"
  354. />
  355. <el-input
  356. style="margin-right: 10px"
  357. class="item item-input"
  358. placeholder="详细地址"
  359. v-model="positionInfo.detailPosition"
  360. ></el-input>
  361. <el-input
  362. class="detail"
  363. clearable
  364. :maxlength="20"
  365. v-model="form.locationDetail"
  366. placeholder="请输入详细地址"
  367. />
  368. </div>
  369. </el-form-item>
  370. </el-descriptions-item>
  371. </el-descriptions>
  372. <div class="basic-details-title border-none">
  373. <span class="border-span">仓储配置</span>
  374. </div>
  375. <el-descriptions title="" :column="4" size="medium" border>
  376. <el-descriptions-item>
  377. <template slot="label"> 启用库存预警</template>
  378. {{ dictType[categoryWms.isWarn] }}
  379. </el-descriptions-item>
  380. <el-descriptions-item>
  381. <template slot="label">允许拆包</template>
  382. {{ dictType[categoryWms.isUnpack] }}
  383. </el-descriptions-item>
  384. <el-descriptions-item>
  385. <template slot="label">安全库存</template>
  386. {{ categoryWms.secureInventory }}
  387. </el-descriptions-item>
  388. <el-descriptions-item>
  389. <template slot="label">最小库存</template>
  390. {{ categoryWms.minInventory }}
  391. </el-descriptions-item>
  392. <el-descriptions-item>
  393. <template slot="label"> 最大库存</template>
  394. {{ categoryWms.maxInventory }}
  395. </el-descriptions-item>
  396. <el-descriptions-item>
  397. <template slot="label">盘点模式</template>
  398. {{ dictPd[categoryWms.inventoryMode] }}
  399. </el-descriptions-item>
  400. <el-descriptions-item>
  401. <template slot="label">质保预警参考</template>
  402. <!-- <DictSelection
  403. dictName="质保预警参考"
  404. clearable
  405. v-model="categoryWms.warrantyWarnRefer"
  406. >
  407. </DictSelection> -->
  408. {{ categoryWms.warrantyWarnRefer }}
  409. </el-descriptions-item>
  410. <el-descriptions-item>
  411. <template slot="label">保质期</template>
  412. {{
  413. categoryWms.warrantyPeriod
  414. ? categoryWms.warrantyPeriod + '/'
  415. : null
  416. }}{{ categoryWms.warrantyPeriodUnit }}
  417. </el-descriptions-item>
  418. </el-descriptions>
  419. <div class="basic-details-title border-none">
  420. <span class="border-span">生产信息</span>
  421. </div>
  422. <el-descriptions title="" :column="4" size="medium" border>
  423. <el-descriptions-item>
  424. <template slot="label"> 是否齐套件</template>
  425. {{ dictType[categoryMes.isCompleteSet] }}
  426. </el-descriptions-item>
  427. <el-descriptions-item>
  428. <template slot="label">消耗波动</template>
  429. {{ categoryMes.consumWave ? categoryMes.consumWave + '%' : null }}
  430. </el-descriptions-item>
  431. <el-descriptions-item>
  432. <template slot="label">变动损耗率</template>
  433. {{
  434. categoryMes.changeLossRate
  435. ? categoryMes.changeLossRate + '%'
  436. : null
  437. }}
  438. </el-descriptions-item>
  439. <el-descriptions-item>
  440. <template slot="label">固定损耗数</template>
  441. {{ categoryMes.fixLossNum }}
  442. </el-descriptions-item>
  443. <el-descriptions-item>
  444. <template slot="label">排程类型</template>
  445. {{ categoryMes.apsType }}
  446. </el-descriptions-item>
  447. <el-descriptions-item>
  448. <template slot="label">允许改型</template>
  449. {{ dictType[categoryMes.isModify] }}
  450. </el-descriptions-item>
  451. <el-descriptions-item>
  452. <template slot="label">允许返工返修</template>
  453. {{ dictType[categoryMes.isRework] }}
  454. </el-descriptions-item>
  455. <el-descriptions-item>
  456. <template slot="label">是否返回料</template>
  457. {{ dictType[categoryMes.isRematerial] }}
  458. </el-descriptions-item>
  459. <el-descriptions-item>
  460. <template slot="label">是否副产品</template>
  461. {{ dictType[categoryMes.isByProduct] }}
  462. </el-descriptions-item>
  463. <el-descriptions-item>
  464. <template slot="label">是否废品</template>
  465. {{ dictType[categoryMes.isWaste] }}
  466. </el-descriptions-item>
  467. <el-descriptions-item>
  468. <template slot="label">是否不良品</template>
  469. {{ dictType[categoryMes.isDefective] }}
  470. </el-descriptions-item>
  471. </el-descriptions>
  472. <div class="basic-details-title border-none">
  473. <span class="border-span">生产信息</span>
  474. </div>
  475. <el-descriptions title="" :column="4" size="medium" border>
  476. <el-descriptions-item>
  477. <template slot="label">附件信息</template>
  478. {{ categoryObj.fileName }}
  479. </el-descriptions-item>
  480. <el-descriptions-item>
  481. <template slot="label">备注信息</template>
  482. {{ categoryObj.remark }}
  483. </el-descriptions-item>
  484. </el-descriptions>
  485. <div class="basic-details-title border-none">
  486. <span class="border-span">关联信息</span>
  487. </div>
  488. <linkMsg
  489. v-if="isLink"
  490. ref="linkMsgRef"
  491. :id="categoryObj.id"
  492. :categoryLevelId="categoryObj.categoryLevelId"
  493. :categoryLevelGroupId="categoryObj.categoryLevelGroupId"
  494. />
  495. <div class="basic-details-title border-none">
  496. <span class="border-span">文档信息</span>
  497. </div>
  498. <div class="upload-container">
  499. <WithView v-model="imageUrl" :limit="1" />
  500. <div class="file-list">
  501. <div>
  502. <el-form-item prop="image" label="使用说明书">
  503. <fileUpload
  504. v-model="attUrl.operatingManual.value"
  505. module="main"
  506. :showLib="true"
  507. />
  508. </el-form-item>
  509. </div>
  510. <div>
  511. <el-form-item prop="image" label="生产许可证书">
  512. <fileUpload
  513. v-model="attUrl.productionLicence.value"
  514. module="main"
  515. :showLib="true"
  516. />
  517. </el-form-item>
  518. </div>
  519. <div>
  520. <el-form-item prop="image" label="防爆合格证书">
  521. <fileUpload
  522. v-model="attUrl.explosionProofCertificate.value"
  523. module="main"
  524. :showLib="true"
  525. />
  526. </el-form-item>
  527. </div>
  528. <div>
  529. <el-form-item prop="image" label="检验报告">
  530. <fileUpload
  531. v-model="attUrl.surveyReport.value"
  532. module="main"
  533. :showLib="true"
  534. />
  535. </el-form-item>
  536. </div>
  537. <div>
  538. <el-form-item prop="image" label="检验周期说明">
  539. <fileUpload
  540. v-model="attUrl.inspectionCycleManual.value"
  541. module="main"
  542. :showLib="true"
  543. />
  544. </el-form-item>
  545. </div>
  546. <div>
  547. <el-form-item prop="image" label="图纸资料">
  548. <fileUpload
  549. v-model="attUrl.informationDrawing.value"
  550. module="main"
  551. :showLib="true"
  552. />
  553. </el-form-item>
  554. </div>
  555. <div>
  556. <el-form-item prop="image" label="产品合格证">
  557. <fileUpload
  558. v-model="attUrl.productCertificate.value"
  559. module="main"
  560. :showLib="true"
  561. />
  562. </el-form-item>
  563. </div>
  564. </div>
  565. </div>
  566. <div class="basic-details-title border-none">
  567. <span class="border-span">物联参数</span>
  568. </div>
  569. <el-row>
  570. <el-col>
  571. <el-form-item label="是否启用物联">
  572. <el-switch
  573. v-model="isIotEnable"
  574. active-text="开"
  575. inactive-text="关"
  576. :active-value="1"
  577. :inactive-value="0"
  578. >
  579. </el-switch>
  580. </el-form-item>
  581. </el-col>
  582. <el-col>
  583. <el-form-item label="物联ID">{{ iotId }}</el-form-item>
  584. </el-col>
  585. </el-row>
  586. <div class="basic-details-title border-none">
  587. <span class="border-span">扩展信息</span>
  588. </div>
  589. <div class="kzzd">
  590. <el-row>
  591. <el-col
  592. :span="24"
  593. v-for="(item, index) in form.extInfoSelf"
  594. :key="index"
  595. style="margin-bottom: 20px"
  596. >
  597. <el-form-item
  598. label-width="0"
  599. :prop="'extInfoSelf.' + index + '.key'"
  600. :rules="{
  601. required: true,
  602. message: '自定义参数名称不能为空',
  603. trigger: 'blur'
  604. }"
  605. >
  606. <div class="add-col">
  607. <el-input
  608. class="col-input"
  609. v-model="item.key"
  610. placeholder="参数名称"
  611. ></el-input>
  612. <el-input
  613. class="col-input"
  614. v-model="item.value"
  615. placeholder="参数值"
  616. ></el-input>
  617. <el-button
  618. class="del"
  619. type="text"
  620. @click="delt(item, index)"
  621. >
  622. 删除
  623. </el-button>
  624. </div>
  625. </el-form-item>
  626. </el-col>
  627. <el-col :span="24" v-if="form.extInfoSelf.length < 10">
  628. <el-form-item label-width="0">
  629. <el-button
  630. class="primarybutton"
  631. type="primary"
  632. @click="addItem"
  633. >增加自定义参数</el-button
  634. >
  635. </el-form-item>
  636. </el-col>
  637. </el-row>
  638. </div>
  639. </div>
  640. </el-form>
  641. <DialogGoods
  642. ref="DialogGoods"
  643. @succeed="cbDialogGoods"
  644. width="1200px"
  645. ></DialogGoods>
  646. </el-card>
  647. </div>
  648. </template>
  649. <script>
  650. import DeptSelect from '@/components/CommomSelect/dept-select.vue';
  651. import FactoryLineSelect from '@/components/CommomSelect/factory-line-select.vue';
  652. import WorkshopSelect from '@/components/CommomSelect/workshop-select.vue';
  653. import FactoryAreaSelect from '@/components/CommomSelect/factory-area-select.vue';
  654. import WorkingProcedureSelect from '@/components/CommomSelect/working-procedure-select.vue';
  655. import factorySelect from '@/components/CommomSelect/factory-select.vue';
  656. import fileUpload from '@/components/upload/fileUpload';
  657. import WithView from '@/components/upload/WithView';
  658. import imgUpload from '@/components/upload/imgUpload';
  659. import { cityDataLabel } from 'ele-admin/packages/utils/regions';
  660. import personSelect from '@/components/CommomSelect/person-select.vue';
  661. import { getDetails } from '@/api/classifyManage/itemInformation';
  662. import { sysDict, isExit } from '@/utils/sys';
  663. import linkMsg from './components/link-msg.vue';
  664. // import selectUpload from "@/components/selectUpload";
  665. // import UploadImg from "@/components/uploadImg/WithView.vue";
  666. import DialogGoods from './components/DialogGoods';
  667. // import { parseTime } from "@/utils/ruoyi.js";
  668. // import org from "@/api/main/org";
  669. // import user from "@/api/main/user";
  670. // import selectTree from "@/components/selectTree";
  671. // import dict from "@/api/main/craft/dict";
  672. // import { imageView } from "@/utils";
  673. // import {
  674. // getPlants,
  675. // getfactoryInfo,
  676. // getFactorys,
  677. // getProductionLine,
  678. // saveOrEdit,
  679. // getAssetNum,
  680. // getDetail,
  681. // getSupplier
  682. // } from '@/api/ledgerAssets/equipment';
  683. import { getFactoryarea } from '@/api/factoryModel';
  684. import { saveOrEdit, getAssetInfo } from '@/api/ledgerAssets';
  685. import { getUserPage } from '@/api/system/organization';
  686. export default {
  687. components: {
  688. linkMsg,
  689. //selectUpload,
  690. //UploadImg,
  691. FactoryLineSelect,
  692. WithView,
  693. WorkshopSelect,
  694. FactoryAreaSelect,
  695. WorkingProcedureSelect,
  696. fileUpload,
  697. imgUpload,
  698. factorySelect,
  699. DialogGoods,
  700. DeptSelect,
  701. personSelect
  702. },
  703. data() {
  704. return {
  705. isLink: true,
  706. categoryObj: {},
  707. dictType: {
  708. 1: '是',
  709. 0: '否'
  710. },
  711. dictPd: {
  712. 1: '逐个盘点',
  713. 2: '批量盘点'
  714. },
  715. categoryMes: {
  716. isModify: '',
  717. isRework: '',
  718. isRematerial: '',
  719. isByProduct: '',
  720. isWaste: '',
  721. isDefective: ''
  722. },
  723. categoryWms: {}, //仓储
  724. title: '新建设备信息',
  725. pageType: 'add',
  726. btnLoading: false,
  727. // 设备主键id
  728. id: '',
  729. form: {
  730. extInfoSelf: [],
  731. // 基本信息
  732. code: '',
  733. name: '',
  734. productTime: ''
  735. },
  736. rules: {
  737. name: [
  738. { required: true, message: '请输入设备名称', trigger: 'blur' }
  739. ],
  740. location: [
  741. { required: true, message: '请输入设备位置', trigger: 'change' }
  742. ],
  743. code: [{ required: true, message: '请输入设备编码', trigger: 'blur' }]
  744. },
  745. // 基本信息
  746. basicInfo: {},
  747. assetInfo: {},
  748. // 资产信息
  749. zcInfo: {
  750. // 固定资产编码
  751. fixCode: '',
  752. // 颜色
  753. color: '',
  754. // 重量
  755. weight: '',
  756. // 维护部门code
  757. repairGroupId: '',
  758. repairDeptName: '',
  759. repairUserId: '',
  760. // 权属部门
  761. ownershipGroupId: '',
  762. ownershipUserId: '',
  763. // 设备用途
  764. purpose: '',
  765. // 工序
  766. roteId: '',
  767. //品牌
  768. brand: '',
  769. // 供应商code
  770. supplierId: '',
  771. // 厂房
  772. factoryRoomId: '',
  773. roteCode: '',
  774. codeNumber: ''
  775. },
  776. positionInfo: {
  777. // 详细地址
  778. detailPosition: '',
  779. // 请选择产线
  780. lineCode: '',
  781. lineName: '',
  782. // 请选择车间
  783. workshopCode: '',
  784. workshopName: '',
  785. // 请选择工厂
  786. factoryCode: '',
  787. factoryName: ''
  788. },
  789. // 图片
  790. imageUrl: null,
  791. // 文档信息
  792. attUrl: {
  793. operatingManual: {
  794. value: [],
  795. sort: 1
  796. },
  797. productionLicence: {
  798. value: [],
  799. sort: 2
  800. },
  801. explosionProofCertificate: {
  802. value: [],
  803. sort: 3
  804. },
  805. surveyReport: {
  806. value: [],
  807. sort: 4
  808. },
  809. inspectionCycleManual: {
  810. value: [],
  811. sort: 5
  812. },
  813. informationDrawing: {
  814. value: [],
  815. sort: 6
  816. },
  817. productCertificate: {
  818. value: [],
  819. sort: 7
  820. }
  821. },
  822. // 是否开始物联
  823. isIotEnable: true,
  824. // 物联ID
  825. iotId: '',
  826. // 回显过保时间
  827. cbexpirationTime: '',
  828. // 生命周期
  829. sourceDICT: '',
  830. // 网络状态
  831. networkStatus: '',
  832. options: {
  833. deptList: [],
  834. repairUserId: [],
  835. ownershipUserId: [],
  836. supplierId: [],
  837. brand: [],
  838. cityDataLabel
  839. },
  840. depList: []
  841. };
  842. },
  843. watch: {},
  844. computed: {
  845. // 过保时间
  846. expirationTime() {
  847. if (this.form.productTime && this.basicInfo.expirationDate) {
  848. return this.setGbTime(
  849. this.form.productTime,
  850. this.basicInfo.expirationDate,
  851. this.basicInfo.expirationDateUnit
  852. );
  853. } else {
  854. return '';
  855. }
  856. }
  857. },
  858. async created() {
  859. if (this.$route.query.id) {
  860. this.pageType = 'edit';
  861. this.id = this.$route.query.id;
  862. this.getInfo();
  863. this.title = '编辑设备信息';
  864. this.getgys();
  865. }
  866. },
  867. methods: {
  868. isExit,
  869. handlwpbm() {
  870. this.$refs.DialogGoods.open();
  871. },
  872. async cbDialogGoods(data) {
  873. console.log(data);
  874. this.basicInfo = data;
  875. this.assetInfo = data;
  876. this.form.rootCategoryLevelId =
  877. this.basicInfo.categoryLevelPathId.split(',')[0];
  878. this.form.categoryId = this.basicInfo.id;
  879. this.form.name = this.basicInfo.name;
  880. // let res = await getAssetNum({
  881. // assetCode: this.basicInfo.code,
  882. // num: 1
  883. // });
  884. this.form.code = data.code; //Date.now(); //res.data[0].onlyCode;
  885. for (const key in this.depList) {
  886. if (this.depList[key].id == data.deptId) {
  887. this.basicInfo.name = this.depList[key].name;
  888. this.basicInfo.groupName = this.depList[key].groupName;
  889. return;
  890. }
  891. }
  892. },
  893. async seachDetail(id) {
  894. this.isLink = false;
  895. const res = await getDetails(id);
  896. console.log('res==', res);
  897. this.categoryWms = {
  898. ...res.categoryWms,
  899. warrantyWarnRefer: await sysDict(
  900. '质保预警参考',
  901. res.categoryWms.warrantyWarnRefer
  902. ),
  903. warrantyPeriodUnit: await sysDict(
  904. '保质期单位',
  905. res.categoryWms.warrantyPeriodUnit
  906. )
  907. };
  908. this.categoryMes = {
  909. ...res.categoryMes,
  910. apsType: await sysDict('排程类型', res.categoryMes.apsType)
  911. };
  912. this.categoryObj = {
  913. ...res.category,
  914. fileName: res.category.remarkAttach
  915. ? res.category.remarkAttach.map((item) => item.name).join(', ')
  916. : ''
  917. };
  918. console.log(this.categoryObj);
  919. this.isLink = true;
  920. },
  921. // 计算过保时间
  922. setGbTime(basic, value, type) {
  923. basic = Date.parse(basic);
  924. let time;
  925. switch (type) {
  926. case 'minute':
  927. time = value * 1000 * 60;
  928. break;
  929. case 'hour':
  930. time = value * 1000 * 60 * 60;
  931. break;
  932. case 'day':
  933. time = value * 1000 * 60 * 60 * 24;
  934. break;
  935. case 'month':
  936. time = value * 1000 * 60 * 60 * 24 * 30;
  937. break;
  938. case 'year':
  939. time = value * 1000 * 60 * 60 * 24 * 365;
  940. break;
  941. default:
  942. break;
  943. }
  944. let num = basic + time;
  945. return parseTime(num);
  946. },
  947. async getwhbm() {
  948. if (!this.zcInfo.repairGroupId) return;
  949. let data = await getUserPage({
  950. pageNum: 1,
  951. size: 9999,
  952. groupId: this.zcInfo.repairGroupId
  953. });
  954. this.options.repairUserId = data.list;
  955. },
  956. async getqsbm() {
  957. if (!this.zcInfo.ownershipGroupId) return;
  958. let data = await getUserPage({
  959. pageNum: 1,
  960. size: 9999,
  961. groupId: this.zcInfo.ownershipGroupId
  962. });
  963. this.options.ownershipUserId = data.list;
  964. },
  965. // 树形结构数据
  966. getTreeList() {
  967. org.tree().then((res) => {
  968. this.options.deptList = res.data;
  969. });
  970. },
  971. // 获取供应商、工序列表
  972. async getgys() {
  973. let muster = await getSupplier({
  974. size: 999
  975. });
  976. this.options.supplierId = muster.data.items; //供应商
  977. },
  978. // 添加自定义参数
  979. addItem() {
  980. if (this.form.extInfoSelf.length < 10) {
  981. let item = { key: '', value: '' };
  982. this.form.extInfoSelf.push(item);
  983. } else {
  984. this.$message.warning('自定义参数最多添加10条');
  985. }
  986. },
  987. // 删除自定义参数
  988. delt(item, index) {
  989. this.form.extInfoSelf.splice(index, 1);
  990. },
  991. // 提交
  992. submit() {
  993. if (!this.basicInfo && this.pageType == 'add') {
  994. return this.$message.error('请选择物品编码');
  995. }
  996. this.$refs.form.validate((valid) => {
  997. if (valid) {
  998. let par = {
  999. //基本信息
  1000. ...this.form,
  1001. // id: this.basicInfo.id,
  1002. // assetCode: this.form.code,
  1003. // assetName: this.form.name,
  1004. assetType: 1,
  1005. // informationId: this.basicInfo.id,
  1006. // productTime: this.form.productTime,
  1007. // expirationTime: this.expirationTime,
  1008. // 资产信息
  1009. positionIds: '1,1,1,1',
  1010. ...this.zcInfo,
  1011. position: {
  1012. detailPosition: this.positionInfo.detailPosition,
  1013. pathIds: `${this.positionInfo.factoryCode},${this.positionInfo.workshopCode},${this.positionInfo.lineCode}`,
  1014. pathName: `${this.positionInfo.factoryName},${this.positionInfo.workshopName},${this.positionInfo.lineName}`,
  1015. type: '1',
  1016. num: 1
  1017. },
  1018. // 文档信息
  1019. attUrl: this.setWd() || [],
  1020. // // 设备图片
  1021. imageUrl: this.imageUrl || {},
  1022. // 是否启用物联
  1023. isIotEnable: this.isIotEnable
  1024. // // 扩展字段
  1025. // extInfoSelf: this.setKz()
  1026. };
  1027. //============================
  1028. par.extInfo = { ...this.zcInfo };
  1029. let obj = {};
  1030. par.extInfoSelf.forEach((item) => {
  1031. obj[item.key] = item.value;
  1032. });
  1033. par.extInfoSelf = obj;
  1034. //============================
  1035. if (this.pageType == 'edit') {
  1036. par.id = this.id;
  1037. }
  1038. this.btnLoading = true;
  1039. console.log('sasasasa', par);
  1040. saveOrEdit(par)
  1041. .then((res) => {
  1042. this.$message.success('操作成功');
  1043. this.$router.go(-1);
  1044. })
  1045. .finally(() => {
  1046. this.btnLoading = false;
  1047. });
  1048. } else {
  1049. console.log('error submit!!');
  1050. return false;
  1051. }
  1052. });
  1053. },
  1054. // 处理扩展字段
  1055. setKz() {
  1056. return this.form.extInfoSelf || [];
  1057. },
  1058. // 处理文档信息
  1059. setWd() {
  1060. return Object.values(this.attUrl).map((item) => ({
  1061. ...(item.value[0] || {}),
  1062. sort: item.sort
  1063. }));
  1064. },
  1065. // 选择所属部门
  1066. async searchDeptNodeClick(id, ids) {
  1067. // 根据部门获取人员
  1068. const res = await getUserPage({
  1069. pageNum: 1,
  1070. size: -1,
  1071. executeGroupId: id
  1072. });
  1073. // const depId = res.list.find((item) => {
  1074. // item.id == ids;
  1075. // });
  1076. // console.log('depId', depId);
  1077. this.depList = res.list;
  1078. },
  1079. // 获取设备详情
  1080. async getInfo() {
  1081. const data = await getAssetInfo(this.id);
  1082. data.extInfoSelf = data.extInfoSelf || [];
  1083. this.form = data;
  1084. this.basicInfo = data.category;
  1085. this.assetInfo = data.category.category;
  1086. this.cbexpirationTime = data.expirationTime;
  1087. this.sourceDICT = data.sourceDICT;
  1088. this.networkStatus = data.networkStatus;
  1089. if (data.positionList?.length) {
  1090. this.positionInfo.detailPosition =
  1091. data.positionList[0].detailPosition;
  1092. const pathIds = data.positionList[0].pathIds.split(',');
  1093. const pathName = data.positionList[0].pathName.split(',');
  1094. this.positionInfo.factoryCode = pathIds[0];
  1095. this.positionInfo.factoryName = pathName[0];
  1096. this.positionInfo.workshopCode = pathIds[1];
  1097. this.positionInfo.workshopName = pathName[1];
  1098. this.positionInfo.lineCode = pathIds[2];
  1099. this.positionInfo.lineName = pathName[2];
  1100. this.$nextTick(() => {
  1101. // this.$refs.WorkshopSelectRef.getList();
  1102. // this.$refs.FactoryLineSelectRef.getList();
  1103. });
  1104. console.log('data', data);
  1105. this.isLink = false;
  1106. this.categoryWms = {
  1107. ...data.category.categoryWms,
  1108. warrantyWarnRefer: await sysDict(
  1109. '质保预警参考',
  1110. data.category.categoryWms.warrantyWarnRefer
  1111. ),
  1112. warrantyPeriodUnit: await sysDict(
  1113. '保质期单位',
  1114. data.category.categoryWms.warrantyPeriodUnit
  1115. )
  1116. };
  1117. this.categoryMes = {
  1118. ...data.category.categoryMes,
  1119. apsType: await sysDict(
  1120. '排程类型',
  1121. data.category.categoryMes.apsType
  1122. )
  1123. };
  1124. this.categoryObj = {
  1125. ...data.category.category,
  1126. fileName: data.category.category.remarkAttach
  1127. ? data.category.category.remarkAttach
  1128. .map((item) => item.name)
  1129. .join(', ')
  1130. : ''
  1131. };
  1132. this.isLink = true;
  1133. }
  1134. // 资产信息
  1135. for (const key of Object.keys(this.zcInfo)) {
  1136. this.zcInfo[key] = data[key];
  1137. }
  1138. this.getwhbm();
  1139. this.getqsbm();
  1140. if (data.attUrl && data.attUrl.length > 0) {
  1141. // 文档信息
  1142. Object.keys(this.attUrl).forEach((n, index) => {
  1143. this.attUrl[n].value =
  1144. (data.attUrl[index]?.storePath && [data.attUrl[index]]) || [];
  1145. });
  1146. }
  1147. // 设备图片
  1148. this.imageUrl = data.imageUrl;
  1149. // 物联参数
  1150. this.isIotEnable = data.isIotEnable;
  1151. this.iotId = data.iotId;
  1152. },
  1153. // 设置标准产能
  1154. setbzcn(val) {
  1155. if (!val) {
  1156. return '';
  1157. }
  1158. let item = JSON.parse(val);
  1159. return item.standardCapacity || '';
  1160. },
  1161. hanldFactoryCode(val, item) {
  1162. this.positionInfo.factoryName = item?.name;
  1163. // 重置
  1164. this.zcInfo.workshopCode = '';
  1165. this.zcInfo.lineCode = '';
  1166. this.options.workshopCode = [];
  1167. this.options.lineCode = [];
  1168. // 获取车间
  1169. this.$nextTick(() => {
  1170. // this.$refs.WorkshopSelectRef.getList();
  1171. });
  1172. },
  1173. hanldWorkshopCode(val, item) {
  1174. this.positionInfo.workshopName = item?.name;
  1175. // 重置
  1176. this.options.workshopCode = [];
  1177. this.options.lineCode = [];
  1178. // 获取产线
  1179. this.$nextTick(() => {
  1180. // this.$refs.FactoryLineSelectRef.getList();
  1181. });
  1182. },
  1183. hanldlineCodeCode(val, item) {
  1184. this.positionInfo.lineName = item?.name;
  1185. }
  1186. }
  1187. };
  1188. </script>
  1189. <style lang="scss" scoped>
  1190. ::v-deep .el-descriptions__table tbody:nth-child(4) {
  1191. .el-descriptions-row {
  1192. .el-descriptions-item__cell:last-child {
  1193. }
  1194. }
  1195. }
  1196. .baseinfo-container .basic-details-title {
  1197. font-size: 16px;
  1198. margin: 15px 0;
  1199. }
  1200. .upload-container {
  1201. display: flex;
  1202. justify-content: flex-start;
  1203. .file-list {
  1204. margin-left: 50px;
  1205. flex: 1;
  1206. }
  1207. }
  1208. .equipment-container {
  1209. // .content {
  1210. // padding: 0 20px;
  1211. // }
  1212. .label-none {
  1213. .el-form-item__content {
  1214. margin-left: 0 !important;
  1215. }
  1216. }
  1217. }
  1218. .sbwz {
  1219. .item {
  1220. width: 120px !important;
  1221. }
  1222. .item + .item {
  1223. margin-left: 10px;
  1224. }
  1225. .item-input {
  1226. width: 350px !important;
  1227. }
  1228. }
  1229. .input {
  1230. width: 100%;
  1231. }
  1232. .kzzd {
  1233. width: 500px;
  1234. .add-col {
  1235. display: flex;
  1236. .col-input {
  1237. & + .col-input {
  1238. margin-left: 10px;
  1239. }
  1240. }
  1241. .del {
  1242. margin-left: 10px;
  1243. }
  1244. }
  1245. }
  1246. ::v-deep .el-descriptions {
  1247. .el-form-item {
  1248. margin-bottom: 0px;
  1249. }
  1250. }
  1251. </style>