edit.vue 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895
  1. <template>
  2. <div id="equipment_edit" 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>
  157. <div class="basic-details-title border-none">
  158. <span class="border-span">资产信息</span>
  159. </div>
  160. <el-descriptions
  161. title=""
  162. :column="5"
  163. size="medium"
  164. border
  165. style="edit"
  166. :label-style="labelStyle"
  167. class="descriptions"
  168. >
  169. <el-descriptions-item>
  170. <template slot="label"> 固资编码 </template>
  171. <el-form-item label-width="0">
  172. <el-input class="input" v-model="zcInfo.fixCode"></el-input>
  173. </el-form-item>
  174. </el-descriptions-item>
  175. <el-descriptions-item>
  176. <template slot="label"> 编号 </template>
  177. <el-form-item label-width="0">
  178. <el-input class="input" v-model="zcInfo.codeNumber"></el-input>
  179. </el-form-item>
  180. </el-descriptions-item>
  181. <el-descriptions-item>
  182. <template slot="label"> 颜色 </template>
  183. <el-form-item label-width="0">
  184. <el-input class="input" v-model="zcInfo.color"></el-input>
  185. </el-form-item>
  186. </el-descriptions-item>
  187. <el-descriptions-item>
  188. <template slot="label"> 级别 </template>
  189. <el-form-item label-width="0">
  190. <el-select
  191. style="width: 100%"
  192. v-model="zcInfo.level"
  193. placeholder="请选择"
  194. >
  195. <el-option
  196. v-for="item in options.assetLevel"
  197. :key="item.id"
  198. :label="item.name"
  199. :value="item.id"
  200. >
  201. </el-option>
  202. </el-select>
  203. </el-form-item>
  204. </el-descriptions-item>
  205. <el-descriptions-item>
  206. <template slot="label"> 有效期开始 </template>
  207. <el-form-item label-width="0">
  208. <el-date-picker
  209. style="width: 100%"
  210. v-model="zcInfo.startTime"
  211. type="month"
  212. value-format="yyyy-MM"
  213. placeholder="选择有效期开始"
  214. >
  215. </el-date-picker>
  216. </el-form-item>
  217. </el-descriptions-item>
  218. <el-descriptions-item>
  219. <template slot="label"> 有效期结束 </template>
  220. <el-form-item label-width="0">
  221. <el-date-picker
  222. style="width: 100%"
  223. v-model="zcInfo.endTime"
  224. @change="endTimeRules"
  225. value-format="yyyy-MM"
  226. type="month"
  227. placeholder="选择有效期结束"
  228. >
  229. </el-date-picker>
  230. </el-form-item>
  231. </el-descriptions-item>
  232. <el-descriptions-item>
  233. <template slot="label"> 状态 </template>
  234. <el-form-item label-width="0">
  235. <el-input
  236. v-model="zcInfo.status"
  237. placeholder="请输入状态"
  238. ></el-input>
  239. </el-form-item>
  240. </el-descriptions-item>
  241. <el-descriptions-item>
  242. <template slot="label"> 入账日期 </template>
  243. <el-form-item label-width="0">
  244. <el-date-picker
  245. style="width: 100%"
  246. v-model="zcInfo.entryDate"
  247. type="date"
  248. placeholder="选择入账日期"
  249. value-format="yyyy-MM-dd"
  250. >
  251. </el-date-picker>
  252. </el-form-item>
  253. </el-descriptions-item>
  254. <el-descriptions-item>
  255. <template slot="label"> 周期 </template>
  256. <el-form-item label-width="0">
  257. <el-select
  258. style="width: 100%"
  259. v-model="zcInfo.cycle"
  260. placeholder="请选择"
  261. >
  262. <el-option
  263. v-for="item in options.deliveryCycle"
  264. :key="item.id"
  265. :label="item.name"
  266. :value="item.id"
  267. >
  268. </el-option>
  269. </el-select>
  270. </el-form-item>
  271. </el-descriptions-item>
  272. </el-descriptions>
  273. <el-descriptions
  274. title=""
  275. :column="5"
  276. size="medium"
  277. border
  278. style="edit"
  279. :label-style="labelStyle"
  280. class="descriptions"
  281. >
  282. <el-descriptions-item>
  283. <template slot="label"> 权属人 </template>
  284. <el-form-item label-width="0">
  285. <!-- <el-select
  286. style="width: 100%"
  287. v-model="zcInfo.ownershipUserId"
  288. placeholder="请选择"
  289. >
  290. <el-option
  291. v-for="item in options.ownershipUserId"
  292. :key="item.id"
  293. :label="item.name"
  294. :value="item.id"
  295. >
  296. </el-option>
  297. </el-select> -->
  298. <el-input
  299. v-model="form.workstation.leaderName"
  300. disabled
  301. placeholder="请输入内容"
  302. ></el-input>
  303. </el-form-item>
  304. </el-descriptions-item>
  305. <el-descriptions-item>
  306. <template slot="label"> 权属部门 </template>
  307. <el-form-item label-width="0">
  308. <div class="input">
  309. <!-- <DeptSelect
  310. v-model="zcInfo.ownershipGroupId"
  311. @input="getqsbm"
  312. /> -->
  313. <el-input
  314. v-model="form.workstation.groupName"
  315. disabled
  316. placeholder="请输入内容"
  317. ></el-input>
  318. </div>
  319. </el-form-item>
  320. </el-descriptions-item>
  321. <el-descriptions-item :span="3">
  322. <template slot="label"> 所属厂房 </template>
  323. <el-form-item label-width="0">
  324. <el-input
  325. style="margin-right: 10px; width: 20%"
  326. v-model="form.workstation.workshopPlanName"
  327. disabled
  328. placeholder="请输入内容"
  329. ></el-input>
  330. <el-input
  331. style="margin-right: 10px; width: 20%"
  332. v-model="form.workstation.workshopName"
  333. disabled
  334. placeholder="请输入内容"
  335. ></el-input>
  336. <el-input
  337. style="margin-right: 10px; width: 20%"
  338. v-model="form.workstation.productionLineName"
  339. disabled
  340. placeholder="请输入内容"
  341. ></el-input>
  342. <el-input
  343. style="margin-right: 10px; width: 20%"
  344. v-model="form.workstation.name"
  345. disabled
  346. placeholder="请输入内容"
  347. ></el-input>
  348. <!-- <FactoryAreaSelect
  349. placeholder="请选择工厂"
  350. style="margin-right: 10px; width: 20%"
  351. v-model="zcInfo.factoryRoomId1"
  352. :augr="1"
  353. />
  354. <FactoryAreaSelect
  355. placeholder="请选择厂房"
  356. style="margin-right: 10px; width: 20%"
  357. v-model="zcInfo.factoryRoomId2"
  358. :augr="2"
  359. @returnItem="returnItem1"
  360. /> -->
  361. <!-- <FactoryAreaSelect
  362. placeholder="请选择车间"
  363. style="margin-right: 10px; width: 20%"
  364. v-model="zcInfo.factoryRoomId3"
  365. :augr="3"
  366. /> -->
  367. <!-- <el-select
  368. style="width: 19%; margin-right: 10px"
  369. v-model="zcInfo.factoryRoomId3"
  370. placeholder="请选择"
  371. @change="getCxList"
  372. >
  373. <el-option
  374. v-for="item in zjList"
  375. :key="item.id"
  376. :label="item.name"
  377. :value="item.id"
  378. >
  379. </el-option>
  380. </el-select> -->
  381. <!-- <FactoryAreaSelect
  382. style="margin-right: 10px; width: 20%"
  383. placeholder="请选择产线"
  384. v-model="zcInfo.factoryRoomId4"
  385. :augr="4"
  386. /> -->
  387. <!-- <el-select
  388. style="width: 19%; margin-right: 10px"
  389. v-model="zcInfo.factoryRoomId4"
  390. placeholder="请选择"
  391. >
  392. <el-option
  393. v-for="item in cxList"
  394. :key="item.id"
  395. :label="item.name"
  396. :value="item.id"
  397. >
  398. </el-option>
  399. </el-select>
  400. <FactoryAreaSelect
  401. style="margin-right: 10px; width: 15%"
  402. placeholder="请输入工位"
  403. v-model="zcInfo.factoryRoomId5"
  404. @returnItem="returnItem"
  405. /> -->
  406. </el-form-item>
  407. </el-descriptions-item>
  408. <el-descriptions-item>
  409. <template slot="label"> 所属工序 </template>
  410. <el-form-item label-width="0">
  411. <!-- <WorkingProcedureSelect
  412. v-model="zcInfo.roteId"
  413. ></WorkingProcedureSelect> -->
  414. <el-input
  415. v-model="form.workstation.taskNames"
  416. disabled
  417. placeholder="请输入内容"
  418. ></el-input>
  419. </el-form-item>
  420. </el-descriptions-item>
  421. <el-descriptions-item>
  422. <template slot="label"> 设备位置 </template>
  423. <el-form-item label-width="0" prop="location">
  424. <div style="display: flex">
  425. <!-- <div
  426. class="location-warp"
  427. style="width: 50%; margin-right: 10px"
  428. >
  429. <el-cascader
  430. clearable
  431. v-model="form.location"
  432. :options="options.cityDataLabel"
  433. ></el-cascader>
  434. </div> -->
  435. <!-- <el-select
  436. filterable
  437. v-model="positionInfo.factoryCode"
  438. style="margin-right: 10px"
  439. clearable
  440. >
  441. <el-option
  442. v-for="(item, index) in warehouseList"
  443. :key="index"
  444. :label="item.name"
  445. :value="item.id"
  446. @click.native="changeWarehouse(item)"
  447. ></el-option>
  448. </el-select> -->
  449. <!-- <factorySelect
  450. style="margin-right: 10px"
  451. v-model="positionInfo.factoryCode"
  452. placeholder="请选择工厂"
  453. @selfChange="hanldFactoryCode"
  454. /> -->
  455. <!-- <el-select
  456. filterable
  457. clearable
  458. v-model="positionInfo.workshopCode"
  459. style="margin-right: 10px"
  460. >
  461. <el-option
  462. v-for="(item, index) in areaList"
  463. :key="index"
  464. :label="item.name"
  465. :value="item.id"
  466. @click.native="twoClick(item)"
  467. ></el-option>
  468. </el-select> -->
  469. <!-- <WorkshopSelect
  470. style="margin-right: 10px"
  471. ref="WorkshopSelectRef"
  472. :factoryId="positionInfo.factoryCode"
  473. v-model="positionInfo.workshopCode"
  474. @selfChange="hanldWorkshopCode"
  475. placeholder="请选择车间"
  476. /> -->
  477. <!-- <FactoryLineSelect
  478. style="margin-right: 10px"
  479. ref="FactoryLineSelectRef"
  480. :workshopId="positionInfo.workshopCode"
  481. v-model="positionInfo.lineCode"
  482. @selfChange="hanldlineCodeCode"
  483. placeholder="请选择产线"
  484. /> -->
  485. <!-- <el-select
  486. clearable
  487. filterable
  488. v-model="positionInfo.lineCode"
  489. >
  490. <el-option
  491. v-for="(item, index) in shelvesList"
  492. :key="index"
  493. :label="item.goodsshelvesCode"
  494. :value="item.id"
  495. @click.native="
  496. positionInfo.lineName = item.goodsshelvesCode
  497. "
  498. ></el-option>
  499. </el-select> -->
  500. <el-cascader
  501. clearable
  502. v-model="form.location"
  503. :options="options.cityDataLabel"
  504. ></el-cascader>
  505. <el-input
  506. style="width: 60%; margin-left: 10px"
  507. placeholder="详细地址"
  508. v-model="positionInfo.detailPosition"
  509. ></el-input>
  510. <!-- <el-input
  511. class="detail"
  512. clearable
  513. :maxlength="20"
  514. v-model="form.locationDetail"
  515. placeholder="请输入详细地址"
  516. /> -->
  517. </div>
  518. </el-form-item>
  519. </el-descriptions-item>
  520. </el-descriptions>
  521. <el-descriptions
  522. title=""
  523. :column="5"
  524. size="medium"
  525. border
  526. style="edit"
  527. :label-style="labelStyle"
  528. class="descriptions"
  529. >
  530. <el-descriptions-item>
  531. <template slot="label"> 维护人 </template>
  532. <el-form-item label-width="0">
  533. <el-select
  534. style="width: 100%"
  535. v-model="zcInfo.repairUserId"
  536. placeholder="请选择"
  537. >
  538. <el-option
  539. v-for="item in options.repairUserId"
  540. :key="item.id"
  541. :label="item.name"
  542. :value="item.id"
  543. >
  544. </el-option>
  545. </el-select>
  546. </el-form-item>
  547. </el-descriptions-item>
  548. <el-descriptions-item>
  549. <template slot="label"> 维护部门 </template>
  550. <el-form-item label-width="0">
  551. <div class="input">
  552. <DeptSelect v-model="zcInfo.repairGroupId" @input="getwhbm" />
  553. </div>
  554. </el-form-item>
  555. </el-descriptions-item>
  556. </el-descriptions>
  557. <el-descriptions
  558. title=""
  559. :column="5"
  560. size="medium"
  561. border
  562. style="edit"
  563. :label-style="labelStyle"
  564. class="descriptions"
  565. >
  566. <el-descriptions-item>
  567. <template slot="label"> 使用岗位 </template>
  568. <el-form-item label-width="0">
  569. <DeptSelect v-model="zcInfo.postId" @input="auditorDeptClick" />
  570. </el-form-item>
  571. </el-descriptions-item>
  572. <el-descriptions-item>
  573. <template slot="label"> 使用人 </template>
  574. <el-form-item label-width="0">
  575. <el-select
  576. style="width: 100%"
  577. v-model="zcInfo.usePersonId"
  578. filterable
  579. placeholder="请选择使用人"
  580. >
  581. <el-option
  582. v-for="item in userList"
  583. :key="item.id"
  584. :label="item.name"
  585. :value="item.id"
  586. >
  587. </el-option>
  588. </el-select>
  589. </el-form-item>
  590. </el-descriptions-item>
  591. <el-descriptions-item>
  592. <template slot="label"> 负责人 </template>
  593. <el-form-item label-width="0">
  594. <el-select
  595. style="width: 100%"
  596. v-model="zcInfo.chargePersonId"
  597. filterable
  598. placeholder="请选择负责人"
  599. >
  600. <el-option
  601. v-for="item in userList"
  602. :key="item.id"
  603. :label="item.name"
  604. :value="item.id"
  605. >
  606. </el-option>
  607. </el-select>
  608. </el-form-item>
  609. </el-descriptions-item>
  610. </el-descriptions>
  611. <el-descriptions
  612. title=""
  613. :column="3"
  614. size="medium"
  615. border
  616. style="edit"
  617. :label-style="labelStyle"
  618. >
  619. <el-descriptions-item>
  620. <template slot="label"> 供应商 </template>
  621. <el-form-item label-width="0">
  622. <el-select
  623. v-model="zcInfo.supplierId"
  624. style="width: 100%"
  625. placeholder="请选择"
  626. >
  627. <el-option
  628. v-for="item in suppList"
  629. :key="item.id"
  630. :label="item.name"
  631. :value="item.id"
  632. >
  633. </el-option>
  634. </el-select>
  635. </el-form-item>
  636. </el-descriptions-item>
  637. <el-descriptions-item>
  638. <template slot="label"> 品牌 </template>
  639. <el-form-item label-width="0">
  640. <el-input v-model="zcInfo.brand" class="input"></el-input>
  641. </el-form-item>
  642. </el-descriptions-item>
  643. <el-descriptions-item>
  644. <template slot="label"> 设备用途 </template>
  645. <el-form-item label-width="0">
  646. <el-input v-model="zcInfo.purpose" class="input"></el-input>
  647. </el-form-item>
  648. </el-descriptions-item>
  649. <el-descriptions-item>
  650. <template slot="label"> 备注 </template>
  651. <el-form-item label-width="0">
  652. <el-input
  653. type="textarea"
  654. :rows="2"
  655. placeholder="请输入内容"
  656. v-model="zcInfo.remark"
  657. ></el-input>
  658. </el-form-item>
  659. </el-descriptions-item>
  660. </el-descriptions>
  661. <div class="basic-details-title border-none">
  662. <span class="border-span">仓储配置</span>
  663. </div>
  664. <el-descriptions title="" :column="4" size="medium" border>
  665. <el-descriptions-item>
  666. <template slot="label"> 启用库存预警</template>
  667. {{ dictType[categoryWms.isWarn] }}
  668. </el-descriptions-item>
  669. <el-descriptions-item>
  670. <template slot="label">允许拆包</template>
  671. {{ dictType[categoryWms.isUnpack] }}
  672. </el-descriptions-item>
  673. <el-descriptions-item>
  674. <template slot="label">安全库存</template>
  675. {{ categoryWms.secureInventory }}
  676. </el-descriptions-item>
  677. <el-descriptions-item>
  678. <template slot="label">最小库存</template>
  679. {{ categoryWms.minInventory }}
  680. </el-descriptions-item>
  681. <el-descriptions-item>
  682. <template slot="label"> 最大库存</template>
  683. {{ categoryWms.maxInventory }}
  684. </el-descriptions-item>
  685. <el-descriptions-item>
  686. <template slot="label">盘点模式</template>
  687. {{ dictPd[categoryWms.inventoryMode] }}
  688. </el-descriptions-item>
  689. <el-descriptions-item>
  690. <template slot="label">质保预警参考</template>
  691. <!-- <DictSelection
  692. dictName="质保预警参考"
  693. clearable
  694. v-model="categoryWms.warrantyWarnRefer"
  695. >
  696. </DictSelection> -->
  697. {{ categoryWms.warrantyWarnRefer }}
  698. </el-descriptions-item>
  699. <el-descriptions-item>
  700. <template slot="label">保质期</template>
  701. {{
  702. categoryWms.warrantyPeriod
  703. ? categoryWms.warrantyPeriod + '/'
  704. : null
  705. }}{{ categoryWms.warrantyPeriodUnit }}
  706. </el-descriptions-item>
  707. </el-descriptions>
  708. <div class="basic-details-title border-none">
  709. <span class="border-span">生产信息</span>
  710. </div>
  711. <el-descriptions title="" :column="4" size="medium" border>
  712. <el-descriptions-item>
  713. <template slot="label"> 是否齐套件</template>
  714. {{ dictType[categoryMes.isCompleteSet] }}
  715. </el-descriptions-item>
  716. <el-descriptions-item>
  717. <template slot="label">消耗波动</template>
  718. {{ categoryMes.consumWave ? categoryMes.consumWave + '%' : null }}
  719. </el-descriptions-item>
  720. <el-descriptions-item>
  721. <template slot="label">变动损耗率</template>
  722. {{
  723. categoryMes.changeLossRate
  724. ? categoryMes.changeLossRate + '%'
  725. : null
  726. }}
  727. </el-descriptions-item>
  728. <el-descriptions-item>
  729. <template slot="label">固定损耗数</template>
  730. {{ categoryMes.fixLossNum }}
  731. </el-descriptions-item>
  732. <el-descriptions-item>
  733. <template slot="label">排程类型</template>
  734. {{ categoryMes.apsType }}
  735. </el-descriptions-item>
  736. <el-descriptions-item>
  737. <template slot="label">允许改型</template>
  738. {{ dictType[categoryMes.isModify] }}
  739. </el-descriptions-item>
  740. <el-descriptions-item>
  741. <template slot="label">允许返工返修</template>
  742. {{ dictType[categoryMes.isRework] }}
  743. </el-descriptions-item>
  744. <el-descriptions-item>
  745. <template slot="label">是否返回料</template>
  746. {{ dictType[categoryMes.isRematerial] }}
  747. </el-descriptions-item>
  748. <el-descriptions-item>
  749. <template slot="label">是否副产品</template>
  750. {{ dictType[categoryMes.isByProduct] }}
  751. </el-descriptions-item>
  752. <el-descriptions-item>
  753. <template slot="label">是否废品</template>
  754. {{ dictType[categoryMes.isWaste] }}
  755. </el-descriptions-item>
  756. <el-descriptions-item>
  757. <template slot="label">是否不良品</template>
  758. {{ dictType[categoryMes.isDefective] }}
  759. </el-descriptions-item>
  760. </el-descriptions>
  761. <div class="basic-details-title border-none">
  762. <span class="border-span">生产信息</span>
  763. </div>
  764. <el-descriptions title="" :column="4" size="medium" border>
  765. <el-descriptions-item>
  766. <template slot="label">附件信息</template>
  767. {{ categoryObj.fileName }}
  768. </el-descriptions-item>
  769. <el-descriptions-item>
  770. <template slot="label">备注信息</template>
  771. {{ categoryObj.remark }}
  772. </el-descriptions-item>
  773. </el-descriptions>
  774. <div class="basic-details-title border-none">
  775. <span class="border-span">关联信息</span>
  776. </div>
  777. <linkMsg
  778. v-if="isLink"
  779. ref="linkMsgRef"
  780. :id="categoryObj.id"
  781. :categoryLevelId="categoryObj.categoryLevelId"
  782. :categoryLevelGroupId="categoryObj.categoryLevelGroupId"
  783. />
  784. <div class="basic-details-title border-none">
  785. <span class="border-span">文档信息</span>
  786. </div>
  787. <div class="upload-container">
  788. <WithView v-model="imageUrl" :limit="1" />
  789. <div class="file-list">
  790. <div>
  791. <el-form-item prop="image" label="使用说明书">
  792. <fileUpload
  793. v-model="attUrl.operatingManual.value"
  794. module="main"
  795. :showLib="true"
  796. />
  797. </el-form-item>
  798. </div>
  799. <div>
  800. <el-form-item prop="image" label="生产许可证书">
  801. <fileUpload
  802. v-model="attUrl.productionLicence.value"
  803. module="main"
  804. :showLib="true"
  805. />
  806. </el-form-item>
  807. </div>
  808. <div>
  809. <el-form-item prop="image" label="防爆合格证书">
  810. <fileUpload
  811. v-model="attUrl.explosionProofCertificate.value"
  812. module="main"
  813. :showLib="true"
  814. />
  815. </el-form-item>
  816. </div>
  817. <div>
  818. <el-form-item prop="image" label="检验报告">
  819. <fileUpload
  820. v-model="attUrl.surveyReport.value"
  821. module="main"
  822. :showLib="true"
  823. />
  824. </el-form-item>
  825. </div>
  826. <div>
  827. <el-form-item prop="image" label="检验周期说明">
  828. <fileUpload
  829. v-model="attUrl.inspectionCycleManual.value"
  830. module="main"
  831. :showLib="true"
  832. />
  833. </el-form-item>
  834. </div>
  835. <div>
  836. <el-form-item prop="image" label="图纸资料">
  837. <fileUpload
  838. v-model="attUrl.informationDrawing.value"
  839. module="main"
  840. :showLib="true"
  841. />
  842. </el-form-item>
  843. </div>
  844. <div>
  845. <el-form-item prop="image" label="产品合格证">
  846. <fileUpload
  847. v-model="attUrl.productCertificate.value"
  848. module="main"
  849. :showLib="true"
  850. />
  851. </el-form-item>
  852. </div>
  853. </div>
  854. </div>
  855. <div class="basic-details-title border-none">
  856. <span class="border-span">物联参数</span>
  857. </div>
  858. <el-row>
  859. <el-col>
  860. <el-form-item label="是否启用物联">
  861. <el-switch
  862. v-model="isIotEnable"
  863. active-text="开"
  864. inactive-text="关"
  865. :active-value="1"
  866. :inactive-value="0"
  867. >
  868. </el-switch>
  869. </el-form-item>
  870. </el-col>
  871. <el-col>
  872. <el-form-item label="物联ID">{{ iotId }}</el-form-item>
  873. </el-col>
  874. </el-row>
  875. <div class="basic-details-title border-none">
  876. <span class="border-span">扩展信息</span>
  877. </div>
  878. <div class="kzzd">
  879. <el-row>
  880. <el-col
  881. :span="24"
  882. v-for="(item, index) in form.extInfoSelf"
  883. :key="index"
  884. style="margin-bottom: 20px"
  885. >
  886. <el-form-item
  887. label-width="0"
  888. :prop="'extInfoSelf.' + index + '.key'"
  889. :rules="{
  890. required: true,
  891. message: '自定义参数名称不能为空',
  892. trigger: 'blur'
  893. }"
  894. >
  895. <div class="add-col">
  896. <el-input
  897. class="col-input"
  898. v-model="item.key"
  899. placeholder="参数名称"
  900. ></el-input>
  901. <el-input
  902. class="col-input"
  903. v-model="item.value"
  904. placeholder="参数值"
  905. ></el-input>
  906. <el-button
  907. class="del"
  908. type="text"
  909. @click="delt(item, index)"
  910. >
  911. 删除
  912. </el-button>
  913. </div>
  914. </el-form-item>
  915. </el-col>
  916. <el-col :span="24" v-if="form.extInfoSelf.length < 10">
  917. <el-form-item label-width="0">
  918. <el-button
  919. class="primarybutton"
  920. type="primary"
  921. @click="addItem"
  922. >增加自定义参数</el-button
  923. >
  924. </el-form-item>
  925. </el-col>
  926. </el-row>
  927. </div>
  928. </div>
  929. </el-form>
  930. <DialogGoods
  931. ref="DialogGoods"
  932. @succeed="cbDialogGoods"
  933. width="1200px"
  934. ></DialogGoods>
  935. </el-card>
  936. </div>
  937. </template>
  938. <script>
  939. import selectTree from '@/components/selectTree';
  940. import DeptSelect from '@/components/CommomSelect/dept-select.vue';
  941. import FactoryLineSelect from '@/components/CommomSelect/factory-line-select.vue';
  942. import WorkshopSelect from '@/components/CommomSelect/workshop-select.vue';
  943. import FactoryAreaSelect from '@/components/CommomSelect/factory-area-select.vue';
  944. import WorkingProcedureSelect from '@/components/CommomSelect/working-procedure-select.vue';
  945. import factorySelect from '@/components/CommomSelect/factory-select.vue';
  946. import fileUpload from '@/components/upload/fileUpload';
  947. import WithView from '@/components/upload/WithView';
  948. import imgUpload from '@/components/upload/imgUpload';
  949. import { cityDataLabel } from 'ele-admin/packages/utils/regions';
  950. import personSelect from '@/components/CommomSelect/person-select.vue';
  951. import { getDetails } from '@/api/classifyManage/itemInformation';
  952. import { sysDict, isExit } from '@/utils/sys';
  953. import linkMsg from './components/link-msg.vue';
  954. // import selectUpload from "@/components/selectUpload";
  955. // import UploadImg from "@/components/uploadImg/WithView.vue";
  956. import DialogGoods from './components/DialogGoods';
  957. // import { parseTime } from "@/utils/ruoyi.js";
  958. // import org from "@/api/main/org";
  959. // import user from "@/api/main/user";
  960. // import selectTree from "@/components/selectTree";
  961. // import dict from "@/api/main/craft/dict";
  962. // import { imageView } from "@/utils";
  963. // import {
  964. // getPlants,
  965. // getfactoryInfo,
  966. // getFactorys,
  967. // getProductionLine,
  968. // // saveOrEdit,
  969. // getAssetNum,
  970. // getDetail,
  971. // getSupplier
  972. // } from '@/api/ledgerAssets/equipment';
  973. import { getFactoryarea } from '@/api/factoryModel';
  974. import {
  975. saveOrEdit,
  976. getAssetInfo,
  977. factoryworkstation
  978. } from '@/api/ledgerAssets';
  979. import { getUserPage } from '@/api/system/organization';
  980. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  981. import { listWorkshopByParentId, listFactoryLine } from '@/api/factoryModel';
  982. import { getByCode } from '@/api/system/dictionary-data';
  983. export default {
  984. components: {
  985. linkMsg,
  986. //selectUpload,
  987. //UploadImg,
  988. selectTree,
  989. FactoryLineSelect,
  990. WithView,
  991. WorkshopSelect,
  992. FactoryAreaSelect,
  993. WorkingProcedureSelect,
  994. fileUpload,
  995. imgUpload,
  996. factorySelect,
  997. DialogGoods,
  998. DeptSelect,
  999. personSelect
  1000. },
  1001. data() {
  1002. // 设备地址校验规则
  1003. // var addressValidation = (rule, array, callback) => {
  1004. // if (array?.length > 0) {
  1005. // var filterArray = array.filter((item) => item && item.trim());
  1006. // console.log(filterArray);
  1007. // if (filterArray.length > 0) {
  1008. // callback();
  1009. // } else {
  1010. // callback(new Error('地址不能为空'));
  1011. // }
  1012. // } else {
  1013. // callback(new Error('地址不能为空'));
  1014. // }
  1015. // };
  1016. return {
  1017. treeList: [], // 使用岗位树
  1018. userList: [], // 人员列表
  1019. labelStyle: {
  1020. 'min-width': '100px'
  1021. },
  1022. isLink: true,
  1023. categoryObj: {},
  1024. dictType: {
  1025. 1: '是',
  1026. 0: '否'
  1027. },
  1028. dictPd: {
  1029. 1: '逐个盘点',
  1030. 2: '批量盘点'
  1031. },
  1032. categoryMes: {
  1033. isModify: '',
  1034. isRework: '',
  1035. isRematerial: '',
  1036. isByProduct: '',
  1037. isWaste: '',
  1038. isDefective: ''
  1039. },
  1040. categoryWms: {}, //仓储
  1041. title: '新建设备信息',
  1042. pageType: 'add',
  1043. btnLoading: false,
  1044. // 设备主键id
  1045. id: '',
  1046. form: {
  1047. extInfoSelf: [],
  1048. // 基本信息
  1049. code: '',
  1050. name: '',
  1051. productTime: '',
  1052. workstation: {}
  1053. },
  1054. rules: {
  1055. name: [
  1056. { required: true, message: '请输入设备名称', trigger: 'blur' }
  1057. ],
  1058. // location: [{ validator: addressValidation, trigger: 'change' }],
  1059. code: [{ required: true, message: '请输入设备编码', trigger: 'blur' }]
  1060. },
  1061. // 基本信息
  1062. basicInfo: {},
  1063. assetInfo: {},
  1064. // 资产信息
  1065. zcInfo: {
  1066. factoryRoomId1: '',
  1067. factoryRoomId2: '',
  1068. factoryRoomId3: '',
  1069. factoryRoomId4: '',
  1070. factoryRoomId5: '',
  1071. factoryRoomName1: '',
  1072. factoryRoomName2: '',
  1073. factoryRoomName3: '',
  1074. factoryRoomName4: '',
  1075. factoryRoomName5: '',
  1076. // 固定资产编码
  1077. fixCode: '',
  1078. // 颜色
  1079. color: '',
  1080. // 重量
  1081. weight: '',
  1082. // 维护部门code
  1083. repairGroupId: '',
  1084. repairDeptName: '',
  1085. repairUserId: '',
  1086. // 权属部门
  1087. ownershipGroupId: '',
  1088. ownershipUserId: '',
  1089. // 设备用途
  1090. purpose: '',
  1091. // 工序
  1092. roteId: '',
  1093. roteName: '',
  1094. //品牌
  1095. brand: '',
  1096. // 供应商code
  1097. supplierId: '',
  1098. // 厂房
  1099. factoryRoomId: '',
  1100. roteCode: '',
  1101. codeNumber: '',
  1102. // 使用人
  1103. usePersonId: '',
  1104. // 有效期开始
  1105. startTime: '',
  1106. // 有效结束
  1107. endTime: '',
  1108. // 级别
  1109. level: '',
  1110. // 状态
  1111. status: '',
  1112. // 负责人
  1113. chargePersonId: '',
  1114. // 入账日期
  1115. entryDate: '',
  1116. // 周期
  1117. cycle: '',
  1118. // 备注
  1119. remark: '',
  1120. // 使用岗位
  1121. postId: ''
  1122. },
  1123. positionInfo: {
  1124. // 详细地址
  1125. detailPosition: '',
  1126. // 请选择产线
  1127. lineCode: '',
  1128. lineName: '',
  1129. // 请选择车间
  1130. workshopCode: '',
  1131. workshopName: '',
  1132. // 请选择工厂
  1133. factoryCode: '',
  1134. factoryName: ''
  1135. },
  1136. // 图片
  1137. imageUrl: null,
  1138. // 文档信息
  1139. attUrl: {
  1140. operatingManual: {
  1141. value: [],
  1142. sort: 1
  1143. },
  1144. productionLicence: {
  1145. value: [],
  1146. sort: 2
  1147. },
  1148. explosionProofCertificate: {
  1149. value: [],
  1150. sort: 3
  1151. },
  1152. surveyReport: {
  1153. value: [],
  1154. sort: 4
  1155. },
  1156. inspectionCycleManual: {
  1157. value: [],
  1158. sort: 5
  1159. },
  1160. informationDrawing: {
  1161. value: [],
  1162. sort: 6
  1163. },
  1164. productCertificate: {
  1165. value: [],
  1166. sort: 7
  1167. }
  1168. },
  1169. // 是否开始物联
  1170. isIotEnable: true,
  1171. // 物联ID
  1172. iotId: '',
  1173. // 回显过保时间
  1174. cbexpirationTime: '',
  1175. // 生命周期
  1176. sourceDICT: '',
  1177. // 网络状态
  1178. networkStatus: '',
  1179. options: {
  1180. deptList: [],
  1181. repairUserId: [],
  1182. ownershipUserId: [],
  1183. supplierId: [],
  1184. brand: [],
  1185. cityDataLabel,
  1186. assetLevel: [], // 资产级别
  1187. deliveryCycle: [] // 送检周期
  1188. },
  1189. depList: [],
  1190. warehouseList: [],
  1191. areaList: [],
  1192. shelvesList: [],
  1193. suppList: [],
  1194. zjList: [],
  1195. cxList: []
  1196. };
  1197. },
  1198. watch: {},
  1199. computed: {
  1200. // 过保时间
  1201. expirationTime() {
  1202. if (this.form.productTime && this.basicInfo.expirationDate) {
  1203. return this.setGbTime(
  1204. this.form.productTime,
  1205. this.basicInfo.expirationDate,
  1206. this.basicInfo.expirationDateUnit
  1207. );
  1208. } else {
  1209. return '';
  1210. }
  1211. }
  1212. },
  1213. async created() {
  1214. // 获取资产级别下拉框
  1215. await this.getAssetLevelOptions();
  1216. // 获取部门岗位树
  1217. await this.getUsePostsTree();
  1218. //
  1219. await this.getDeliveryCycleOptions();
  1220. if (this.$route.query.id) {
  1221. this.pageType = 'edit';
  1222. this.id = this.$route.query.id;
  1223. await this.getInfo();
  1224. this.title = '编辑设备信息';
  1225. // this.getgys();
  1226. // await this._getWarehouseChildren();
  1227. }
  1228. },
  1229. methods: {
  1230. // 限制结束时间
  1231. endTimeRules() {
  1232. if (this.zcInfo.startTime) {
  1233. console.log(this.zcInfo.startTime);
  1234. console.log(new Date(this.zcInfo.startTime).getTime());
  1235. let differenceTime =
  1236. new Date(this.zcInfo.endTime).getTime() -
  1237. new Date(this.zcInfo.startTime).getTime();
  1238. if (differenceTime <= 0) {
  1239. this.$message.error('请选择正确的有效结束时间');
  1240. this.zcInfo.endTime = '';
  1241. }
  1242. } else {
  1243. this.$message.error('请选择有效开始时间');
  1244. this.zcInfo.endTime = '';
  1245. }
  1246. },
  1247. // 获取资产级别下拉
  1248. async getAssetLevelOptions() {
  1249. let { data } = await getByCode('asset_level');
  1250. this.options.assetLevel =
  1251. data.length > 0
  1252. ? data.map((item) => {
  1253. return {
  1254. name: Object.keys(item)[0],
  1255. id: item[Object.keys(item)[0]]
  1256. };
  1257. })
  1258. : [];
  1259. },
  1260. // 获取送检周期下拉
  1261. async getDeliveryCycleOptions() {
  1262. let { data } = await getByCode('delivery_cycle');
  1263. console.log(data);
  1264. this.options.deliveryCycle =
  1265. data.length > 0
  1266. ? data.map((item) => {
  1267. return {
  1268. name: item[Object.keys(item)[0]],
  1269. id: +Object.keys(item)[0]
  1270. };
  1271. })
  1272. : [];
  1273. },
  1274. // 使用岗位点击事件
  1275. async auditorDeptClick(data) {
  1276. console.log(data);
  1277. if (data) {
  1278. this.getStaffList(data);
  1279. } else {
  1280. this.zcInfo.chargePersonId = '';
  1281. this.zcInfo.usePersonId = '';
  1282. this.userList = [];
  1283. }
  1284. },
  1285. // 获取使用岗位列表树
  1286. async getUsePostsTree() {
  1287. const res = await warehouseDefinition.tree();
  1288. this.treeList = this.$util.toTreeData({
  1289. data: res,
  1290. idField: 'id',
  1291. parentIdField: 'parentId'
  1292. });
  1293. },
  1294. // 通过部门岗位获取人员列表
  1295. async getStaffList(id) {
  1296. let res = await warehouseDefinition.getUserPage({
  1297. groupId: id,
  1298. size: 9999,
  1299. page: 1
  1300. });
  1301. this.userList = res.list;
  1302. },
  1303. async getCxList(e) {
  1304. this.zcInfo.factoryRoomId4 = '';
  1305. this.zcInfo.factoryRoomId5 = '';
  1306. const data = await listFactoryLine([e]);
  1307. console.log('生产线---------', data);
  1308. this.cxList = data;
  1309. },
  1310. async returnItem1(item) {
  1311. this.zcInfo.factoryRoomId3 = '';
  1312. this.zcInfo.factoryRoomId4 = '';
  1313. this.zcInfo.factoryRoomId5 = '';
  1314. const data = await listWorkshopByParentId(item.id);
  1315. console.log('厂房-------------', data);
  1316. this.zjList = data;
  1317. },
  1318. async returnItem(item) {
  1319. const data = await factoryworkstation(item.id);
  1320. console.log('工位------', data);
  1321. if (data.workshopId) {
  1322. await this.returnItem1({ id: data.workshopId });
  1323. }
  1324. if (data.productionLineId) {
  1325. await this.getCxList(data.productionLineId);
  1326. }
  1327. // this.zcInfo.factoryRoomId1 = data.factoryId;
  1328. // this.zcInfo.factoryRoomName1 = data.factoryName;
  1329. // this.zcInfo.factoryRoomId2 = data.workshopPlanId;
  1330. // this.zcInfo.factoryRoomName2 = data.workshopPlanName;
  1331. // this.zcInfo.factoryRoomId3 = data.workshopId;
  1332. // this.zcInfo.factoryRoomName3 = data.workshopName;
  1333. // this.zcInfo.factoryRoomId4 = data.productionLineId;
  1334. // this.zcInfo.factoryRoomName4 = data.productionLineName;
  1335. this.zcInfo.factoryRoomId5 = data.id;
  1336. this.zcInfo.factoryRoomName5 = data.name;
  1337. this.zcInfo.roteId = data.taskList[0].id;
  1338. this.zcInfo.roteName = data.taskList[0].name;
  1339. this.zcInfo.ownershipGroupId = data.extInfo.principalDep;
  1340. await this.getqsbm();
  1341. this.zcInfo.ownershipUserId = data.leaderId;
  1342. },
  1343. // returnName1(val) {
  1344. // this.zcInfo.factoryRoomName1 = val;
  1345. // },
  1346. // returnName2(val) {
  1347. // this.zcInfo.factoryRoomName2 = val;
  1348. // },
  1349. // returnName3(val) {
  1350. // this.zcInfo.factoryRoomName3 = val;
  1351. // },
  1352. // returnName4(val) {
  1353. // this.zcInfo.factoryRoomName4 = val;
  1354. // },
  1355. // returnName5(val) {
  1356. // this.zcInfo.factoryRoomName5 = val;
  1357. // },
  1358. async twoClick(val) {
  1359. this.positionInfo.workshopName = val.name;
  1360. const res = await warehouseDefinition.getListByAreaId(val.id);
  1361. this.shelvesList = res;
  1362. },
  1363. async changeWarehouse(val) {
  1364. this.positionInfo.factoryName = val.name;
  1365. const res = await warehouseDefinition.getListByWarehouseId(val.id);
  1366. this.areaList = res;
  1367. },
  1368. async _getWarehouseChildren() {
  1369. const res = await warehouseDefinition.list({});
  1370. this.warehouseList = res.map((item) => {
  1371. return { ...item, name: item.factoryName + '-' + item.name };
  1372. });
  1373. if (this.positionInfo.factoryCode) {
  1374. const params = {
  1375. id: this.positionInfo.factoryCode,
  1376. name: this.positionInfo.factoryName
  1377. };
  1378. this.changeWarehouse(params);
  1379. }
  1380. if (this.positionInfo.workshopCode) {
  1381. const params = {
  1382. id: this.positionInfo.workshopCode,
  1383. name: this.positionInfo.workshopName
  1384. };
  1385. this.twoClick(params);
  1386. }
  1387. // const res = await getWarehouseChildren();
  1388. // if (res?.success) {
  1389. //
  1390. // }
  1391. },
  1392. isExit,
  1393. handlwpbm() {
  1394. this.$refs.DialogGoods.open();
  1395. },
  1396. async cbDialogGoods(data) {
  1397. console.log(data);
  1398. this.basicInfo = data;
  1399. this.assetInfo = data;
  1400. this.form.rootCategoryLevelId =
  1401. this.basicInfo.categoryLevelPathId.split(',')[0];
  1402. this.form.categoryId = this.basicInfo.id;
  1403. this.form.name = this.basicInfo.name;
  1404. // let res = await getAssetNum({
  1405. // assetCode: this.basicInfo.code,
  1406. // num: 1
  1407. // });
  1408. this.form.code = data.code; //Date.now(); //res.data[0].onlyCode;
  1409. for (const key in this.depList) {
  1410. if (this.depList[key].id == data.deptId) {
  1411. this.basicInfo.name = this.depList[key].name;
  1412. this.basicInfo.groupName = this.depList[key].groupName;
  1413. return;
  1414. }
  1415. }
  1416. },
  1417. async seachDetail(id) {
  1418. this.isLink = false;
  1419. const res = await getDetails(id);
  1420. console.log('res==', res);
  1421. this.categoryWms = {
  1422. ...res.categoryWms,
  1423. warrantyWarnRefer: await sysDict(
  1424. '质保预警参考',
  1425. res.categoryWms.warrantyWarnRefer
  1426. ),
  1427. warrantyPeriodUnit: await sysDict(
  1428. '保质期单位',
  1429. res.categoryWms.warrantyPeriodUnit
  1430. )
  1431. };
  1432. this.categoryMes = {
  1433. ...res.categoryMes,
  1434. apsType: await sysDict('排程类型', res.categoryMes.apsType)
  1435. };
  1436. this.categoryObj = {
  1437. ...res.category,
  1438. fileName: res.category.remarkAttach
  1439. ? res.category.remarkAttach.map((item) => item.name).join(', ')
  1440. : ''
  1441. };
  1442. console.log(this.categoryObj);
  1443. this.isLink = true;
  1444. },
  1445. // 计算过保时间
  1446. setGbTime(basic, value, type) {
  1447. basic = Date.parse(basic);
  1448. let time;
  1449. switch (type) {
  1450. case 'minute':
  1451. time = value * 1000 * 60;
  1452. break;
  1453. case 'hour':
  1454. time = value * 1000 * 60 * 60;
  1455. break;
  1456. case 'day':
  1457. time = value * 1000 * 60 * 60 * 24;
  1458. break;
  1459. case 'month':
  1460. time = value * 1000 * 60 * 60 * 24 * 30;
  1461. break;
  1462. case 'year':
  1463. time = value * 1000 * 60 * 60 * 24 * 365;
  1464. break;
  1465. default:
  1466. break;
  1467. }
  1468. let num = basic + time;
  1469. return parseTime(num);
  1470. },
  1471. async getwhbm() {
  1472. if (!this.zcInfo.repairGroupId) return;
  1473. let data = await getUserPage({
  1474. pageNum: 1,
  1475. size: 9999,
  1476. groupId: this.zcInfo.repairGroupId
  1477. });
  1478. this.options.repairUserId = data.list;
  1479. },
  1480. async getqsbm() {
  1481. if (!this.zcInfo.ownershipGroupId) return;
  1482. let data = await getUserPage({
  1483. pageNum: 1,
  1484. size: 9999,
  1485. groupId: this.zcInfo.ownershipGroupId
  1486. });
  1487. this.options.ownershipUserId = data.list;
  1488. },
  1489. // 树形结构数据
  1490. getTreeList() {
  1491. org.tree().then((res) => {
  1492. this.options.deptList = res.data;
  1493. });
  1494. },
  1495. // 获取供应商、工序列表
  1496. async getgys() {
  1497. let muster = await getSupplier({
  1498. size: 999
  1499. });
  1500. this.options.supplierId = muster.data.items; //供应商
  1501. },
  1502. // 添加自定义参数
  1503. addItem() {
  1504. if (this.form.extInfoSelf.length < 10) {
  1505. let item = { key: '', value: '' };
  1506. this.form.extInfoSelf.push(item);
  1507. } else {
  1508. this.$message.warning('自定义参数最多添加10条');
  1509. }
  1510. },
  1511. // 删除自定义参数
  1512. delt(item, index) {
  1513. this.form.extInfoSelf.splice(index, 1);
  1514. },
  1515. // 提交
  1516. submit() {
  1517. if (!this.basicInfo && this.pageType == 'add') {
  1518. return this.$message.error('请选择物品编码');
  1519. }
  1520. // if (!this.zcInfo.factoryRoomId1) {
  1521. // return this.$message.error('请选择工厂');
  1522. // }
  1523. // if (!this.zcInfo.factoryRoomId2) {
  1524. // return this.$message.error('请选择厂房');
  1525. // }
  1526. // if (!this.zcInfo.factoryRoomId3) {
  1527. // return this.$message.error('请选择车间');
  1528. // }
  1529. // if (!this.zcInfo.factoryRoomId4) {
  1530. // return this.$message.error('请选择产线');
  1531. // }
  1532. // if (!this.zcInfo.factoryRoomId5) {
  1533. // return this.$message.error('请选择工位');
  1534. // }
  1535. this.$refs.form.validate((valid) => {
  1536. console.log('valid---------', valid);
  1537. console.log(this.form);
  1538. if (valid) {
  1539. console.log('ppp', this.positionInfo);
  1540. let par = {
  1541. //基本信息
  1542. ...this.form,
  1543. assetType: 1,
  1544. // 资产信息
  1545. positionIds: '1,1,1,1',
  1546. ...this.zcInfo,
  1547. position: {
  1548. detailPosition: this.positionInfo.detailPosition,
  1549. pathIds: `${
  1550. this.positionInfo.factoryCode
  1551. ? this.positionInfo.factoryCode + ','
  1552. : ''
  1553. }${
  1554. this.positionInfo.workshopCode
  1555. ? this.positionInfo.workshopCode + ','
  1556. : ''
  1557. }${this.positionInfo.lineCode}`,
  1558. pathName: `${
  1559. this.positionInfo.factoryName
  1560. ? this.positionInfo.factoryName + ','
  1561. : ''
  1562. }${
  1563. this.positionInfo.workshopName
  1564. ? this.positionInfo.workshopName + ','
  1565. : ''
  1566. }${this.positionInfo.lineName}`,
  1567. type: '1',
  1568. num: 1
  1569. },
  1570. factoryRoomId: '',
  1571. factoryRoomName: '',
  1572. // 文档信息
  1573. attUrl: this.setWd() || [],
  1574. // // 设备图片
  1575. imageUrl: this.imageUrl || {},
  1576. // 是否启用物联
  1577. isIotEnable: this.isIotEnable
  1578. // // 扩展字段
  1579. // extInfoSelf: this.setKz()
  1580. };
  1581. const factoryRoomIds = [
  1582. this.zcInfo.factoryRoomId1,
  1583. this.zcInfo.factoryRoomId2,
  1584. this.zcInfo.factoryRoomId3,
  1585. this.zcInfo.factoryRoomId4,
  1586. this.zcInfo.factoryRoomId5
  1587. ];
  1588. const nonEmptyFactoryRoomIds = factoryRoomIds.filter((id) => id);
  1589. par.factoryRoomId = nonEmptyFactoryRoomIds.join(',');
  1590. //---
  1591. const factoryRoomNames = [
  1592. this.zcInfo.factoryRoomName1,
  1593. this.zcInfo.factoryRoomName2,
  1594. this.zcInfo.factoryRoomName3,
  1595. this.zcInfo.factoryRoomName4,
  1596. this.zcInfo.factoryRoomName5
  1597. ];
  1598. const nonEmptyFactoryRoomNames = factoryRoomNames.filter(
  1599. (id) => id
  1600. );
  1601. par.factoryRoomName = nonEmptyFactoryRoomNames.join(',');
  1602. //==
  1603. console.log(par);
  1604. par.deviceLocationName = par.location
  1605. ? par.location.toString()
  1606. : '';
  1607. // par.sss = par.position.detailPosition;
  1608. //==
  1609. //============================
  1610. par.extInfo = { ...this.zcInfo };
  1611. let obj = {};
  1612. par.extInfoSelf.forEach((item) => {
  1613. obj[item.key] = item.value;
  1614. });
  1615. par.extInfoSelf = obj;
  1616. //============================
  1617. if (this.pageType == 'edit') {
  1618. par.id = this.id;
  1619. }
  1620. this.btnLoading = true;
  1621. console.log('sasasasa', par);
  1622. saveOrEdit(par)
  1623. .then((res) => {
  1624. this.$message.success('操作成功');
  1625. this.$router.go(-1);
  1626. })
  1627. .finally(() => {
  1628. this.btnLoading = false;
  1629. });
  1630. } else {
  1631. console.log('error submit!!');
  1632. return false;
  1633. }
  1634. });
  1635. },
  1636. // 处理扩展字段
  1637. setKz() {
  1638. return this.form.extInfoSelf || [];
  1639. },
  1640. // 处理文档信息
  1641. setWd() {
  1642. return Object.values(this.attUrl).map((item) => ({
  1643. ...(item.value[0] || {}),
  1644. sort: item.sort
  1645. }));
  1646. },
  1647. // 选择所属部门
  1648. async searchDeptNodeClick(id, ids) {
  1649. // 根据部门获取人员
  1650. const res = await getUserPage({
  1651. pageNum: 1,
  1652. size: -1,
  1653. executeGroupId: id
  1654. });
  1655. // const depId = res.list.find((item) => {
  1656. // item.id == ids;
  1657. // });
  1658. // console.log('depId', depId);
  1659. this.depList = res.list;
  1660. },
  1661. // 获取设备详情
  1662. async getInfo() {
  1663. const data = await getAssetInfo(this.id);
  1664. console.log('获取设备详情-----', data);
  1665. this.auditorDeptClick(data.postId);
  1666. for (const key of Object.keys(this.zcInfo)) {
  1667. this.zcInfo[key] = data[key];
  1668. }
  1669. console.log(this.zcInfo);
  1670. data.extInfoSelf = data.extInfoSelf || [];
  1671. if (!data.workstation) {
  1672. data.workstation = {};
  1673. }
  1674. this.form = data;
  1675. this.form.location = data.deviceLocationName.split(',');
  1676. this.basicInfo = data.category;
  1677. this.assetInfo = data.category.category;
  1678. this.cbexpirationTime = data.expirationTime;
  1679. this.sourceDICT = data.sourceDICT;
  1680. this.networkStatus = data.networkStatus;
  1681. if (data.factoryRoomId) {
  1682. const pathIds = data.factoryRoomId.split(',');
  1683. this.zcInfo.factoryRoomId1 = pathIds[0];
  1684. this.zcInfo.factoryRoomId2 = pathIds[1];
  1685. this.zcInfo.factoryRoomId3 = pathIds[2];
  1686. this.zcInfo.factoryRoomId4 = pathIds[3];
  1687. this.zcInfo.factoryRoomId5 = pathIds[4];
  1688. if (this.zcInfo.factoryRoomId2) {
  1689. this.returnItem1({ id: pathIds[1] });
  1690. }
  1691. if (this.zcInfo.factoryRoomId3) {
  1692. this.getCxList(pathIds[2]);
  1693. }
  1694. }
  1695. if (data.detailPosition) {
  1696. this.positionInfo.detailPosition = data.detailPosition;
  1697. const pathIds = data.positionList[0].pathIds.split(',');
  1698. const pathName = data.positionList[0].pathName.split(',');
  1699. // this.zcInfo.factoryRoomId1 = pathIds[0];
  1700. // this.zcInfo.factoryRoomId2 = pathIds[1];
  1701. // this.zcInfo.factoryRoomId3 = pathIds[2];
  1702. // this.zcInfo.factoryRoomId4 = pathIds[3];
  1703. // this.zcInfo.factoryRoomId5 = pathIds[4];
  1704. this.$nextTick(() => {
  1705. // this.$refs.WorkshopSelectRef.getList();
  1706. // this.$refs.FactoryLineSelectRef.getList();
  1707. });
  1708. console.log('data', data);
  1709. this.isLink = false;
  1710. this.categoryWms = {
  1711. ...data.category.categoryWms,
  1712. warrantyWarnRefer: await sysDict(
  1713. '质保预警参考',
  1714. data.category.categoryWms.warrantyWarnRefer
  1715. ),
  1716. warrantyPeriodUnit: await sysDict(
  1717. '保质期单位',
  1718. data.category.categoryWms.warrantyPeriodUnit
  1719. )
  1720. };
  1721. this.categoryMes = {
  1722. ...data.category.categoryMes,
  1723. apsType: await sysDict(
  1724. '排程类型',
  1725. data.category.categoryMes.apsType
  1726. )
  1727. };
  1728. this.categoryObj = {
  1729. ...data.category.category,
  1730. fileName: data.category.category.remarkAttach
  1731. ? data.category.category.remarkAttach
  1732. .map((item) => item.name)
  1733. .join(', ')
  1734. : ''
  1735. };
  1736. this.isLink = true;
  1737. }
  1738. // // 资产信息
  1739. // this.zcInfo.codeNumber = data.codeNumber;
  1740. // this.zcInfo.fixCode = data.fixCode;
  1741. this.getwhbm();
  1742. this.getqsbm();
  1743. if (data.attUrl && data.attUrl.length > 0) {
  1744. // 文档信息
  1745. Object.keys(this.attUrl).forEach((n, index) => {
  1746. this.attUrl[n].value =
  1747. (data.attUrl[index]?.storePath && [data.attUrl[index]]) || [];
  1748. });
  1749. }
  1750. // 设备图片
  1751. this.imageUrl = data.imageUrl;
  1752. // 物联参数
  1753. this.isIotEnable = data.isIotEnable;
  1754. this.iotId = data.iotId;
  1755. //供应商
  1756. const rep = await warehouseDefinition.eomContact({
  1757. type: 2,
  1758. status: 1,
  1759. size: -1,
  1760. pageNum: 1
  1761. });
  1762. this.suppList = rep.list;
  1763. },
  1764. // 设置标准产能
  1765. setbzcn(val) {
  1766. if (!val) {
  1767. return '';
  1768. }
  1769. let item = JSON.parse(val);
  1770. return item.standardCapacity || '';
  1771. },
  1772. hanldFactoryCode(val, item) {
  1773. this.positionInfo.factoryName = item?.name;
  1774. // 重置
  1775. this.zcInfo.workshopCode = '';
  1776. this.zcInfo.lineCode = '';
  1777. this.options.workshopCode = [];
  1778. this.options.lineCode = [];
  1779. // 获取车间
  1780. this.$nextTick(() => {
  1781. // this.$refs.WorkshopSelectRef.getList();
  1782. });
  1783. },
  1784. hanldWorkshopCode(val, item) {
  1785. this.positionInfo.workshopName = item?.name;
  1786. // 重置
  1787. this.options.workshopCode = [];
  1788. this.options.lineCode = [];
  1789. // 获取产线
  1790. this.$nextTick(() => {
  1791. // this.$refs.FactoryLineSelectRef.getList();
  1792. });
  1793. },
  1794. hanldlineCodeCode(val, item) {
  1795. this.positionInfo.lineName = item?.name;
  1796. }
  1797. }
  1798. };
  1799. </script>
  1800. <style lang="scss" scoped>
  1801. ::v-deep .descriptions {
  1802. margin-bottom: 10px;
  1803. }
  1804. ::v-deep .el-descriptions__table tbody:nth-child(4) {
  1805. .el-descriptions-row {
  1806. .el-descriptions-item__cell:last-child {
  1807. }
  1808. }
  1809. }
  1810. .baseinfo-container .basic-details-title {
  1811. font-size: 16px;
  1812. margin: 15px 0;
  1813. }
  1814. .upload-container {
  1815. display: flex;
  1816. justify-content: flex-start;
  1817. .file-list {
  1818. margin-left: 50px;
  1819. flex: 1;
  1820. }
  1821. }
  1822. .equipment-container {
  1823. // .content {
  1824. // padding: 0 20px;
  1825. // }
  1826. .label-none {
  1827. .el-form-item__content {
  1828. margin-left: 0 !important;
  1829. }
  1830. }
  1831. }
  1832. .sbwz {
  1833. .item {
  1834. width: 120px !important;
  1835. }
  1836. .item + .item {
  1837. margin-left: 10px;
  1838. }
  1839. .item-input {
  1840. width: 350px !important;
  1841. }
  1842. }
  1843. .input {
  1844. width: 100%;
  1845. }
  1846. .kzzd {
  1847. width: 500px;
  1848. .add-col {
  1849. display: flex;
  1850. .col-input {
  1851. & + .col-input {
  1852. margin-left: 10px;
  1853. }
  1854. }
  1855. .del {
  1856. margin-left: 10px;
  1857. }
  1858. }
  1859. }
  1860. ::v-deep .el-descriptions {
  1861. .el-form-item {
  1862. margin-bottom: 0px;
  1863. }
  1864. }
  1865. </style>