edit copy.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  1. <template>
  2. <div class="ele-body">
  3. <el-card :body-style="{ padding: 0 }">
  4. <div class="page-container equipment-container">
  5. <div class="page-title basic-details-title">
  6. <el-page-header @back="$router.go(-1)">
  7. <div slot="content" class="pageContent">
  8. <div>{{ title }}</div>
  9. </div>
  10. </el-page-header>
  11. <div>
  12. <!-- <el-button size="small" @click="$router.go(-1)">取消</el-button> -->
  13. <el-button
  14. size="small"
  15. type="primary"
  16. @click="toSave"
  17. v-loading="btnLoading"
  18. >确定</el-button
  19. >
  20. </div>
  21. </div>
  22. <div v-if="pageType == 'add'">
  23. <el-button type="primary" plain @click="handlwpbm"
  24. >选择物品</el-button
  25. >
  26. </div>
  27. <div class="content">
  28. <el-form label-width="100px">
  29. <basicInfoVue ref="basicInfoVueRef" />
  30. <businessInformation ref="businessInformationRef" :form="info" />
  31. <assetInformation ref="assetInformationRef" :form="info" />
  32. <!-- <div class="basic-details-title border-none">
  33. <span class="border-span">资产信息</span>
  34. </div>
  35. <el-descriptions
  36. title=""
  37. :column="4"
  38. size="medium"
  39. border
  40. style="edit"
  41. >
  42. <el-descriptions-item>
  43. <template slot="label"> 模具编码 </template>
  44. <el-form-item label-width="0">
  45. <el-input size="small" v-model="info.mouldCode"></el-input>
  46. </el-form-item>
  47. </el-descriptions-item>
  48. <el-descriptions-item>
  49. <template slot="label"> 固资编码 </template>
  50. <el-form-item label-width="0">
  51. <el-input size="small" v-model="info.fixCode"></el-input>
  52. </el-form-item>
  53. </el-descriptions-item>
  54. <el-descriptions-item>
  55. <template slot="label"> 编号 </template>
  56. <el-form-item label-width="0">
  57. <el-input size="small" v-model="info.codeNumber"></el-input>
  58. </el-form-item>
  59. </el-descriptions-item>
  60. <el-descriptions-item>
  61. <template slot="label"> 已冲压次数 </template>
  62. <el-form-item label-width="0">
  63. <el-input size="small" v-model="info.startCyTimes"></el-input>
  64. </el-form-item>
  65. </el-descriptions-item>
  66. <el-descriptions-item>
  67. <template slot="label"> 权属部门 </template>
  68. <el-form-item label-width="0">
  69. <ele-tree-select
  70. clearable
  71. :data="treeData"
  72. v-model="info.ownershipGroupId"
  73. placeholder="请选择"
  74. default-expand-all
  75. labelKey="name"
  76. valueKey="id"
  77. />
  78. </el-form-item>
  79. </el-descriptions-item>
  80. </el-descriptions> -->
  81. <div class="basic-details-title border-none">
  82. <span class="border-span">模具信息</span>
  83. </div>
  84. <el-descriptions
  85. :label-style="labelStyle"
  86. :contentStyle="contentStyle"
  87. title=""
  88. :column="3"
  89. size="medium"
  90. border
  91. >
  92. <el-descriptions-item>
  93. <template slot="label"> 收缩系数</template>
  94. {{
  95. categoryMold.shrinkEffictive
  96. ? categoryMold.shrinkEffictive + '%'
  97. : null
  98. }}
  99. </el-descriptions-item>
  100. <el-descriptions-item>
  101. <template slot="label"> 芯杆数量 </template>
  102. {{ categoryMold.coreBarNum }}
  103. </el-descriptions-item>
  104. <el-descriptions-item>
  105. <template slot="label"> 模孔数量</template>
  106. {{ categoryMold.dieHoleNum }}
  107. </el-descriptions-item>
  108. <el-descriptions-item>
  109. <template slot="label"> 上冲头数量</template>
  110. {{ categoryMold.upperPunchNum }}
  111. </el-descriptions-item>
  112. <el-descriptions-item>
  113. <template slot="label"> 下冲头数量</template>
  114. {{ categoryMold.downPunchNum }}
  115. </el-descriptions-item>
  116. <el-descriptions-item>
  117. <template slot="label"> 最大冲压次数</template>
  118. {{ categoryMold.maxCyTimes }}
  119. </el-descriptions-item>
  120. <el-descriptions-item>
  121. <template slot="label"> 已冲压次数 </template>
  122. <el-form-item label-width="0">
  123. <el-input size="small" v-model="info.startCyTimes"></el-input>
  124. </el-form-item>
  125. </el-descriptions-item>
  126. <el-descriptions-item>
  127. <template slot="label"> 大模体型号 </template>
  128. {{ categoryMold.maxMoldType }}
  129. </el-descriptions-item>
  130. <el-descriptions-item>
  131. <template slot="label"> 芯棒直径 </template>
  132. {{ categoryMold.mandrelDiameter }}
  133. </el-descriptions-item>
  134. </el-descriptions>
  135. <div class="basic-details-title border-none">
  136. <span class="border-span">仓储配置</span>
  137. </div>
  138. <el-descriptions
  139. :label-style="labelStyle"
  140. :contentStyle="contentStyle"
  141. title=""
  142. :column="4"
  143. size="medium"
  144. border
  145. >
  146. <el-descriptions-item>
  147. <template slot="label"> 启用库存预警</template>
  148. {{ dictType[categoryWms.isWarn] }}
  149. </el-descriptions-item>
  150. <el-descriptions-item>
  151. <template slot="label">允许拆包</template>
  152. {{ dictType[categoryWms.isUnpack] }}
  153. </el-descriptions-item>
  154. <el-descriptions-item>
  155. <template slot="label">安全库存</template>
  156. {{ categoryWms.secureInventory }}
  157. </el-descriptions-item>
  158. <el-descriptions-item>
  159. <template slot="label">最小库存</template>
  160. {{ categoryWms.minInventory }}
  161. </el-descriptions-item>
  162. <el-descriptions-item>
  163. <template slot="label"> 最大库存</template>
  164. {{ categoryWms.maxInventory }}
  165. </el-descriptions-item>
  166. <el-descriptions-item>
  167. <template slot="label">盘点模式</template>
  168. {{ dictPd[categoryWms.inventoryMode] }}
  169. </el-descriptions-item>
  170. <el-descriptions-item>
  171. <template slot="label">质保预警参考</template>
  172. <!-- <DictSelection
  173. dictName="质保预警参考"
  174. clearable
  175. v-model="categoryWms.warrantyWarnRefer"
  176. >
  177. </DictSelection> -->
  178. {{ categoryWms.warrantyWarnRefer }}
  179. </el-descriptions-item>
  180. <el-descriptions-item>
  181. <template slot="label">保质期</template>
  182. {{
  183. categoryWms.warrantyPeriod
  184. ? categoryWms.warrantyPeriod + '/'
  185. : null
  186. }}{{ categoryWms.warrantyPeriodUnit }}
  187. </el-descriptions-item>
  188. </el-descriptions>
  189. <div class="basic-details-title border-none">
  190. <span class="border-span">生产信息</span>
  191. </div>
  192. <el-descriptions
  193. :label-style="labelStyle"
  194. :contentStyle="contentStyle"
  195. title=""
  196. :column="4"
  197. size="medium"
  198. border
  199. >
  200. <el-descriptions-item>
  201. <template slot="label"> 是否齐套件</template>
  202. {{ dictType[categoryMes.isCompleteSet] }}
  203. </el-descriptions-item>
  204. <el-descriptions-item>
  205. <template slot="label">消耗波动</template>
  206. {{
  207. categoryMes.consumWave ? categoryMes.consumWave + '%' : null
  208. }}
  209. </el-descriptions-item>
  210. <el-descriptions-item>
  211. <template slot="label">变动损耗率</template>
  212. {{
  213. categoryMes.changeLossRate
  214. ? categoryMes.changeLossRate + '%'
  215. : null
  216. }}
  217. </el-descriptions-item>
  218. <el-descriptions-item>
  219. <template slot="label">固定损耗数</template>
  220. {{ categoryMes.fixLossNum }}
  221. </el-descriptions-item>
  222. <el-descriptions-item>
  223. <template slot="label">排程类型</template>
  224. {{ categoryMes.apsType }}
  225. </el-descriptions-item>
  226. <el-descriptions-item>
  227. <template slot="label">允许改型</template>
  228. {{ dictType[categoryMes.isModify] }}
  229. </el-descriptions-item>
  230. <el-descriptions-item>
  231. <template slot="label">允许返工返修</template>
  232. {{ dictType[categoryMes.isRework] }}
  233. </el-descriptions-item>
  234. <el-descriptions-item>
  235. <template slot="label">是否返回料</template>
  236. {{ dictType[categoryMes.isRematerial] }}
  237. </el-descriptions-item>
  238. <el-descriptions-item>
  239. <template slot="label">是否副产品</template>
  240. {{ dictType[categoryMes.isByProduct] }}
  241. </el-descriptions-item>
  242. <el-descriptions-item>
  243. <template slot="label">是否废品</template>
  244. {{ dictType[categoryMes.isWaste] }}
  245. </el-descriptions-item>
  246. <el-descriptions-item>
  247. <template slot="label">是否不良品</template>
  248. {{ dictType[categoryMes.isDefective] }}
  249. </el-descriptions-item>
  250. </el-descriptions>
  251. <div class="basic-details-title border-none">
  252. <span class="border-span">计划</span>
  253. </div>
  254. <el-descriptions
  255. :label-style="labelStyle"
  256. :contentStyle="contentStyle"
  257. title=""
  258. :column="4"
  259. size="medium"
  260. border
  261. >
  262. <el-descriptions-item>
  263. <template slot="label">固定提前期</template>
  264. {{ categoryAps.fixLeadTime }}
  265. </el-descriptions-item>
  266. <el-descriptions-item>
  267. <template slot="label">变动提前期</template>
  268. {{ categoryAps.changeLeadTime }}
  269. </el-descriptions-item>
  270. <el-descriptions-item>
  271. <template slot="label">检验提前期</template>
  272. {{ categoryAps.checkLeadTime }}
  273. </el-descriptions-item>
  274. <el-descriptions-item>
  275. <template slot="label">累计提前期</template>
  276. {{ categoryAps.cumLeadTime }}
  277. </el-descriptions-item>
  278. <el-descriptions-item>
  279. <template slot="label">提前期单位</template>
  280. {{ categoryAps.unit }}
  281. </el-descriptions-item>
  282. <el-descriptions-item>
  283. <template slot="label">订货间隔期</template>
  284. {{
  285. categoryAps.orderIntervalTime
  286. ? categoryAps.orderIntervalTime + '/'
  287. : null
  288. }}{{ categoryAps.orderIntervalUnit }}
  289. </el-descriptions-item>
  290. </el-descriptions>
  291. <div class="basic-details-title border-none">
  292. <span class="border-span">质量配置</span>
  293. </div>
  294. <el-descriptions
  295. :label-style="labelStyle"
  296. :contentStyle="contentStyle"
  297. title=""
  298. :column="4"
  299. size="medium"
  300. border
  301. >
  302. <el-descriptions-item>
  303. <template slot="label">是否来料检验</template>
  304. {{ dictType[categoryQms.isComeCheck] }}
  305. </el-descriptions-item>
  306. <el-descriptions-item>
  307. <template slot="label">检验方案</template>
  308. {{ categoryQms.checkFormula }}
  309. </el-descriptions-item>
  310. <el-descriptions-item>
  311. <template slot="label">采购组织</template>
  312. {{ cgInfo.groupName }}
  313. </el-descriptions-item>
  314. <el-descriptions-item>
  315. <template slot="label">采购员</template>
  316. {{ cgInfo.name }}
  317. </el-descriptions-item>
  318. </el-descriptions>
  319. <div class="basic-details-title border-none">
  320. <span class="border-span">备注信息</span>
  321. </div>
  322. <el-descriptions
  323. :label-style="labelStyle"
  324. :contentStyle="contentStyle"
  325. title=""
  326. :column="2"
  327. size="medium"
  328. border
  329. >
  330. <el-descriptions-item>
  331. <template slot="label">附件信息</template>
  332. {{ categoryObj.fileName }}
  333. </el-descriptions-item>
  334. <el-descriptions-item>
  335. <template slot="label">备注</template>
  336. {{ categoryObj.remark }}
  337. </el-descriptions-item>
  338. </el-descriptions>
  339. <div class="basic-details-title border-none">
  340. <span class="border-span">关联信息</span>
  341. </div>
  342. <linkMsg
  343. ref="linkMsgRef"
  344. :id="categoryObj.id"
  345. :categoryLevelId="categoryObj.categoryLevelId"
  346. :categoryLevelGroupId="categoryObj.categoryLevelGroupId"
  347. />
  348. <div class="basic-details-title border-none">
  349. <span class="border-span">文档信息</span>
  350. </div>
  351. <!-- <div class="basic-details-title border-none">
  352. <span class="border-span">文档信息</span>
  353. </div> -->
  354. <div class="upload-container">
  355. <WithView v-model="imageUrl" :limit="1" :assetName="`模具`" />
  356. <div class="file-list">
  357. <div>
  358. <el-form-item prop="image" label="使用说明书">
  359. <fileUpload
  360. v-model="attUrl.operatingManual.value"
  361. module="main"
  362. :showLib="true"
  363. />
  364. </el-form-item>
  365. </div>
  366. <div>
  367. <el-form-item prop="image" label="生产许可证书">
  368. <fileUpload
  369. v-model="attUrl.productionLicence.value"
  370. module="main"
  371. :showLib="true"
  372. />
  373. </el-form-item>
  374. </div>
  375. <div>
  376. <el-form-item prop="image" label="防爆合格证书">
  377. <fileUpload
  378. v-model="attUrl.explosionProofCertificate.value"
  379. module="main"
  380. :showLib="true"
  381. />
  382. </el-form-item>
  383. </div>
  384. <div>
  385. <el-form-item prop="image" label="检验报告">
  386. <fileUpload
  387. v-model="attUrl.surveyReport.value"
  388. module="main"
  389. :showLib="true"
  390. />
  391. </el-form-item>
  392. </div>
  393. <div>
  394. <el-form-item prop="image" label="检验周期说明">
  395. <fileUpload
  396. v-model="attUrl.inspectionCycleManual.value"
  397. module="main"
  398. :showLib="true"
  399. />
  400. </el-form-item>
  401. </div>
  402. <div>
  403. <el-form-item prop="image" label="图纸资料">
  404. <fileUpload
  405. v-model="attUrl.informationDrawing.value"
  406. module="main"
  407. :showLib="true"
  408. />
  409. </el-form-item>
  410. </div>
  411. <div>
  412. <el-form-item prop="image" label="产品合格证">
  413. <fileUpload
  414. v-model="attUrl.productCertificate.value"
  415. module="main"
  416. :showLib="true"
  417. />
  418. </el-form-item>
  419. </div>
  420. </div>
  421. </div>
  422. </el-form>
  423. <div class="basic-details-title border-none">
  424. <span class="border-span">扩展信息</span>
  425. </div>
  426. <el-row>
  427. <el-form
  428. :model="itemForm"
  429. :rules="customRule"
  430. ref="formCustom"
  431. class="row-form"
  432. >
  433. <el-col
  434. :span="8"
  435. v-for="(item, index) in itemForm.addList"
  436. :key="index"
  437. >
  438. <el-form-item
  439. :prop="'addList.' + index + '.key'"
  440. :rules="{
  441. required: true,
  442. message: '自定义参数名称不能为空',
  443. trigger: 'blur'
  444. }"
  445. >
  446. <div class="add-col">
  447. <el-input
  448. class="col-input"
  449. v-model="item.key"
  450. placeholder="参数名称"
  451. ></el-input>
  452. <el-input
  453. class="col-input"
  454. v-model="item.value"
  455. placeholder="参数值"
  456. ></el-input>
  457. <el-button type="text" @click="delt(item, index)">
  458. 删除
  459. </el-button>
  460. </div>
  461. </el-form-item>
  462. </el-col>
  463. <el-col :span="8" v-if="itemForm.addList.length < 10">
  464. <el-form-item label-width="20px">
  465. <el-button type="primary" @click="addItem"
  466. >增加自定义参数</el-button
  467. >
  468. </el-form-item>
  469. </el-col>
  470. </el-form>
  471. </el-row>
  472. </div>
  473. </div>
  474. <DialogGoods
  475. ref="DialogGoods"
  476. @succeed="cbDialogGoods"
  477. width="1200px"
  478. ></DialogGoods>
  479. </el-card>
  480. </div>
  481. </template>
  482. <script>
  483. import { getDetails } from '@/api/classifyManage/itemInformation';
  484. import DialogGoods from '../components/DialogGoods';
  485. import {
  486. getAssetInfo,
  487. saveOrEdit,
  488. getCode,
  489. getAssetNum
  490. } from '@/api/ledgerAssets';
  491. import { listOrganizations } from '@/api/system/organization';
  492. import fileUpload from '@/components/upload/fileUpload';
  493. import WithView from '@/components/upload/WithView';
  494. import imgUpload from '@/components/upload/imgUpload';
  495. import businessInformation from '../components/businessInformation.vue';
  496. import { sysDict } from '@/utils/sys';
  497. import linkMsg from '../equipment/components/link-msg.vue';
  498. import basicInfoVue from '../components/basicInfo.vue';
  499. import assetInformation from '../components/assetInformation.vue';
  500. import { getDetailInfo } from '@/api/material/list';
  501. import { getUserPage } from '@/api/system/organization';
  502. export default {
  503. components: {
  504. WithView,
  505. fileUpload,
  506. imgUpload,
  507. linkMsg,
  508. basicInfoVue,
  509. assetInformation,
  510. businessInformation,
  511. DialogGoods
  512. },
  513. data() {
  514. return {
  515. labelStyle: {
  516. width: '200px'
  517. },
  518. contentStyle: {
  519. width: '400px'
  520. },
  521. categoryMold: {},
  522. cgInfo: {},
  523. categoryQms: {},
  524. categoryAps: {},
  525. categoryMes: {},
  526. categoryWms: {},
  527. dictType: {
  528. 1: '是',
  529. 0: '否'
  530. },
  531. dictPd: {
  532. 1: '逐个盘点',
  533. 2: '批量盘点'
  534. },
  535. categoryObj: {},
  536. formData: {},
  537. info: {
  538. baseInfo: {},
  539. extraInfo: {}
  540. },
  541. zcInfo: {},
  542. customRule: {},
  543. itemForm: {
  544. addList: []
  545. },
  546. // 基本信息
  547. basicInfo: {},
  548. // 图片
  549. imageUrl: null,
  550. // 文档信息
  551. attUrl: {
  552. operatingManual: {
  553. value: [],
  554. sort: 1
  555. },
  556. productionLicence: {
  557. value: [],
  558. sort: 2
  559. },
  560. explosionProofCertificate: {
  561. value: [],
  562. sort: 3
  563. },
  564. surveyReport: {
  565. value: [],
  566. sort: 4
  567. },
  568. inspectionCycleManual: {
  569. value: [],
  570. sort: 5
  571. },
  572. informationDrawing: {
  573. value: [],
  574. sort: 6
  575. },
  576. productCertificate: {
  577. value: [],
  578. sort: 7
  579. }
  580. },
  581. treeData: [],
  582. btnLoading: false,
  583. id: '',
  584. pageType: '',
  585. title: ''
  586. };
  587. },
  588. async created() {
  589. if (this.$route.query.id) {
  590. this.pageType = 'edit';
  591. this.id = this.$route.query.id;
  592. await this.getInfo();
  593. this.title = '编辑模具信息';
  594. // this.getgys();
  595. // await this._getWarehouseChildren();
  596. } else {
  597. this.pageType = 'add';
  598. this.title = '新增模具信息';
  599. }
  600. // let id = this.$route.query.id;
  601. // if (id) {
  602. // this.getDetilInfo(id);
  603. // this.query();
  604. // }
  605. },
  606. methods: {
  607. handlwpbm() {
  608. this.$refs.DialogGoods.open('5');
  609. },
  610. async cbDialogGoods(data) {
  611. // this.searchMoudol(data.category.category.id);
  612. let res = await getDetails(data.id);
  613. console.log(res);
  614. this.info.category = res;
  615. this.initOtherMsg(res);
  616. if (!data.extInfoSelf) {
  617. data.extInfoSelf = [];
  618. }
  619. if (!data.workstation) {
  620. data.workstation = {};
  621. }
  622. this.info = data;
  623. this.basicInfo = data;
  624. console.log('this.basicInfo-----------');
  625. console.log(this.basicInfo);
  626. if (typeof this.basicInfo.categoryLevelPathId === 'string') {
  627. let categoryLevelPathId = JSON.parse(
  628. this.basicInfo.categoryLevelPathId
  629. );
  630. if (Array.isArray(categoryLevelPathId)) {
  631. this.info.rootCategoryLevelId = JSON.parse(
  632. this.basicInfo.categoryLevelPathId
  633. )[0];
  634. } else {
  635. this.info.rootCategoryLevelId = categoryLevelPathId;
  636. }
  637. } else {
  638. if (Array.isArray(this.info.rootCategoryLevelId)) {
  639. this.info.rootCategoryLevelId =
  640. this.basicInfo.categoryLevelPathId[0];
  641. } else {
  642. this.info.rootCategoryLevelId = this.basicInfo.categoryLevelPathId;
  643. }
  644. }
  645. this.info.categoryId = this.basicInfo.id;
  646. this.info.name = this.basicInfo.name;
  647. this.info.code = data.code; //Date.now(); //res.data[0].onlyCode;
  648. this.$refs.basicInfoVueRef.getDetailInfoAugr(this.info);
  649. },
  650. // 树形结构数据
  651. query() {
  652. listOrganizations()
  653. .then((list) => {
  654. this.treeData = this.$util.toTreeData({
  655. data: list,
  656. idField: 'id',
  657. parentIdField: 'parentId'
  658. });
  659. })
  660. .catch((e) => {});
  661. },
  662. setImgs(type, sort, info) {
  663. if (info[0]) {
  664. this.attUrl[type] = info[0];
  665. this.attUrl[type].sort = sort;
  666. } else {
  667. this.attUrl[type] = null;
  668. }
  669. },
  670. // 处理文档信息
  671. setWd() {
  672. let attUrl = [];
  673. Object.entries(this.attUrl).forEach(([key, value], index) => {
  674. if (value) {
  675. attUrl.push(value);
  676. } else {
  677. attUrl.push({ sort: index + 1 });
  678. }
  679. });
  680. return attUrl;
  681. },
  682. // // 合并数据
  683. // mergeInfo(info) {
  684. // this.zcInfo = info;
  685. // // this.info = { ...this.info, ...info };
  686. // console.log('this.info--------------------', this.info);
  687. // console.log('this.zcInfo--------------------', this.zcInfo);
  688. // },
  689. async getInfo() {
  690. const data = await getAssetInfo(this.id);
  691. if (data) {
  692. if (!data.workstation) {
  693. data.workstation = {};
  694. }
  695. this.info = data;
  696. this.basicInfo = data;
  697. this.info.location = data.deviceLocationName.split(',');
  698. this.info.baseInfo = data.category.category;
  699. this.info.extraInfo = data.category.categoryMold;
  700. this.itemForm.addList = this.info.extInfoSelf
  701. ? this.info.extInfoSelf
  702. : [];
  703. // this.initOtherMsg(data);
  704. // 填充基本信息
  705. this.$nextTick(() => {
  706. this.$refs.basicInfoVueRef.getDetailInfoAugr(
  707. this.info.category.category
  708. );
  709. });
  710. if (data.attUrl && data.attUrl.length > 0) {
  711. // 文档信息
  712. Object.keys(this.attUrl).forEach((n, index) => {
  713. this.attUrl[n].value =
  714. (data.attUrl[index]?.storePath && [data.attUrl[index]]) || [];
  715. });
  716. }
  717. // 设备图片
  718. this.imageUrl = data.imageUrl || {};
  719. this.searchMoudol(data.category.category.id);
  720. }
  721. },
  722. async initOtherMsg(res) {
  723. this.categoryObj = {
  724. ...res.category,
  725. // deptId:
  726. fileName: res.category.remarkAttach
  727. ? res.category.remarkAttach.map((item) => item.name).join(', ')
  728. : ''
  729. };
  730. this.$nextTick(() => {
  731. this.$refs.basicInfoVueRef.getDetailInfoAugr(this.categoryObj);
  732. });
  733. await this.searchDeptNodeClick(res.category.deptLeaderId);
  734. for (const key in this.depList) {
  735. if (this.depList[key].id == res.category.deptId) {
  736. this.depInfo = this.depList[key];
  737. break;
  738. }
  739. }
  740. for (const key in this.depList) {
  741. if (this.depList[key].id == res.categoryQms.checkPerson) {
  742. console.log('++', this.depList[key]);
  743. this.cgInfo = this.depList[key];
  744. console.log(this.cgInfo);
  745. break;
  746. }
  747. }
  748. this.categoryWms = {
  749. ...res.categoryWms,
  750. warrantyPeriodUnit: await sysDict(
  751. '保质期单位',
  752. res.categoryWms.warrantyPeriodUnit
  753. ),
  754. warrantyWarnRefer: await sysDict(
  755. '质保预警参考',
  756. res.categoryWms.warrantyWarnRefer
  757. )
  758. };
  759. this.categoryMes = {
  760. ...res.categoryMes,
  761. apsType: await sysDict('排程类型', res.categoryMes.apsType)
  762. };
  763. this.categoryAps = {
  764. ...res.categoryAps,
  765. orderIntervalUnit: await sysDict(
  766. '提前期单位',
  767. res.categoryAps.orderIntervalUnit
  768. ),
  769. unit: await sysDict('提前期单位', res.categoryAps.unit)
  770. };
  771. this.categoryQms = {
  772. ...res.categoryQms,
  773. checkFormula: await sysDict('检验方案', res.categoryQms.checkFormula)
  774. };
  775. this.categoryMold = { ...res.categoryMold };
  776. },
  777. async searchMoudol(id) {
  778. const res = await getDetailInfo(id);
  779. this.categoryObj = {
  780. ...res.category,
  781. // deptId:
  782. fileName: res.category.remarkAttach
  783. ? res.category.remarkAttach.map((item) => item.name).join(', ')
  784. : ''
  785. };
  786. this.$nextTick(() => {
  787. this.$refs.basicInfoVueRef.getDetailInfoAugr(this.categoryObj);
  788. });
  789. await this.searchDeptNodeClick(res.category.deptLeaderId);
  790. for (const key in this.depList) {
  791. if (this.depList[key].id == res.category.deptId) {
  792. this.depInfo = this.depList[key];
  793. break;
  794. }
  795. }
  796. for (const key in this.depList) {
  797. if (this.depList[key].id == res.categoryQms.checkPerson) {
  798. console.log('++', this.depList[key]);
  799. this.cgInfo = this.depList[key];
  800. console.log(this.cgInfo);
  801. break;
  802. }
  803. }
  804. this.categoryWms = {
  805. ...res.categoryWms,
  806. warrantyPeriodUnit: await sysDict(
  807. '保质期单位',
  808. res.categoryWms.warrantyPeriodUnit
  809. ),
  810. warrantyWarnRefer: await sysDict(
  811. '质保预警参考',
  812. res.categoryWms.warrantyWarnRefer
  813. )
  814. };
  815. this.categoryMes = {
  816. ...res.categoryMes,
  817. apsType: await sysDict('排程类型', res.categoryMes.apsType)
  818. };
  819. this.categoryAps = {
  820. ...res.categoryAps,
  821. orderIntervalUnit: await sysDict(
  822. '提前期单位',
  823. res.categoryAps.orderIntervalUnit
  824. ),
  825. unit: await sysDict('提前期单位', res.categoryAps.unit)
  826. };
  827. this.categoryQms = {
  828. ...res.categoryQms,
  829. checkFormula: await sysDict('检验方案', res.categoryQms.checkFormula)
  830. };
  831. this.categoryMold = { ...res.categoryMold };
  832. },
  833. // 选择所属部门
  834. async searchDeptNodeClick(id, ids) {
  835. // 根据部门获取人员
  836. const res = await getUserPage({
  837. pageNum: 1,
  838. size: -1,
  839. executeGroupId: id
  840. });
  841. this.depList = res.list;
  842. },
  843. // 选择图片回调
  844. cbUploadImg(data) {
  845. if (data.length > 0) {
  846. this.imageUrl = data[0];
  847. } else {
  848. this.imageUrl = '';
  849. }
  850. },
  851. // 删除自定义参数
  852. delt(item, index) {
  853. this.itemForm.addList.splice(index, 1);
  854. },
  855. // 添加自定义参数
  856. addItem() {
  857. if (this.itemForm.addList.length < 10) {
  858. let item = { key: '', value: '' };
  859. this.itemForm.addList.push(item);
  860. } else {
  861. this.$message.warning('自定义参数最多添加10条');
  862. }
  863. },
  864. // 点击确定保存
  865. async toSave() {
  866. if (JSON.stringify(this.basicInfo) === '{}' && this.pageType == 'add') {
  867. return this.$message.error('请选择物品编码');
  868. }
  869. let extendField = this.itemForm.addList;
  870. console.log(this.info);
  871. let params = {
  872. ...this.info,
  873. id: this.info.id,
  874. code: this.info.code,
  875. fixCode: this.info.fixCode,
  876. extInfoSelf: extendField,
  877. ownershipGroupId: this.info.ownershipGroupId,
  878. rootCategoryLevelId: this.info.rootCategoryLevelId,
  879. categoryId: this.info.categoryId,
  880. // positionIds: JSON.parse(this.info.category.categoryLevelPathId).join(','),
  881. deviceLocationName: this.info.location
  882. ? this.info.location.join(',')
  883. : '',
  884. positionIds: '1,1,1,1',
  885. position: {
  886. type: '1',
  887. num: 1
  888. },
  889. // 文档信息
  890. attUrl: this.setWd() || [],
  891. // // 设备图片
  892. imageUrl: this.imageUrl || {}
  893. };
  894. //============================
  895. params.extInfo = {
  896. ownershipGroupId: this.info.ownershipGroupId,
  897. mouldCode: this.info.mouldCode,
  898. fixCode: this.info.fixCode,
  899. codeNumber: this.info.codeNumber,
  900. startCyTimes: this.info.startCyTimes
  901. };
  902. let obj = {};
  903. params.extInfoSelf.forEach((item) => {
  904. obj[item.key] = item.value;
  905. });
  906. params.extInfoSelf = obj;
  907. params = { ...params, ...params.extInfo };
  908. //============================
  909. if (this.pageType == 'add') {
  910. const batchNo = await getCode('lot_number_code');
  911. const res = await getAssetNum({
  912. assetCode: params.code,
  913. batchNum: batchNo,
  914. num: 1
  915. });
  916. params.code = res.data.shift().onlyCode;
  917. params.id = '';
  918. }
  919. this.btnLoading = true;
  920. this.$refs['formCustom'].validate((valid) => {
  921. if (valid) {
  922. saveOrEdit(params)
  923. .then((res) => {
  924. if (res) {
  925. this.$message.success('模具编辑成功');
  926. this.$router.go(-1);
  927. }
  928. })
  929. .finally(() => {
  930. this.btnLoading = false;
  931. });
  932. } else {
  933. return false;
  934. }
  935. });
  936. },
  937. // 处理文档信息
  938. setWd() {
  939. return Object.values(this.attUrl).map((item) => ({
  940. ...(item.value[0] || {}),
  941. sort: item.sort
  942. }));
  943. }
  944. }
  945. };
  946. </script>
  947. <style lang="scss" scoped>
  948. .equipment-container {
  949. background-color: #fff;
  950. padding: 20px;
  951. .content {
  952. padding: 0 20px;
  953. }
  954. .page-title {
  955. width: 100%;
  956. padding-bottom: 10px;
  957. border-bottom: 1px solid #ccc;
  958. }
  959. .basic-details-title {
  960. width: 100%;
  961. display: flex;
  962. align-items: center;
  963. justify-content: space-between;
  964. margin: 15px 0px;
  965. font-size: 16px;
  966. }
  967. .label-none {
  968. .el-form-item__content {
  969. margin-left: 0 !important;
  970. }
  971. }
  972. .upload-container {
  973. display: flex;
  974. .file-list {
  975. margin-left: 50px;
  976. flex: 1;
  977. }
  978. }
  979. .row-form {
  980. width: 100%;
  981. .add-col {
  982. display: flex;
  983. align-items: center;
  984. margin-left: 20px;
  985. .col-input {
  986. margin-right: 5px;
  987. }
  988. }
  989. }
  990. .qsbm .el-select {
  991. width: 100%;
  992. }
  993. }
  994. ::v-deep .el-descriptions {
  995. .el-form-item {
  996. margin-bottom: 0px;
  997. }
  998. }
  999. </style>