workingProcedure.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772
  1. <template>
  2. <el-dialog
  3. :title="title"
  4. :visible.sync="visible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="85%"
  10. >
  11. <el-card shadow="never">
  12. <header-title title="工序信息"></header-title>
  13. <el-form label-width="100px" ref="form" :model="rowData">
  14. <el-row>
  15. <el-col :span="6" label-width="100px">
  16. <el-form-item label="编码" prop="type">
  17. <el-input
  18. disabled
  19. placeholder="工序编码"
  20. v-model="rowData.code"
  21. ></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="6" label-width="100px">
  25. <el-form-item label="名称" prop="type">
  26. <el-input
  27. disabled
  28. placeholder="工序名称"
  29. v-model="rowData.controlName"
  30. ></el-input>
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. </el-form>
  35. <el-tabs
  36. v-model="activeName"
  37. class="tab-box"
  38. type="border-card"
  39. @tab-click="tabsChange"
  40. >
  41. <el-tab-pane label="工艺参数" name="工艺参数">
  42. <ele-pro-table
  43. ref="table"
  44. :datasource="datasource"
  45. :immediate="true"
  46. :need-page="false"
  47. :columns="columns"
  48. >
  49. <!-- 表头工具栏 -->
  50. <template v-if="!isView" v-slot:toolbar>
  51. <el-button
  52. size="small"
  53. icon="el-icon-plus"
  54. class="ele-btn-icon"
  55. type="primary"
  56. @click.native="openParam('工艺')"
  57. >添加参数</el-button
  58. >
  59. </template>
  60. <template v-slot:sort="{ row }">
  61. <div v-if="isView">{{ row.sort }}</div>
  62. <el-input v-else v-model="row.sort"></el-input>
  63. </template>
  64. <!-- 默认值 -->
  65. <template v-slot:defaultValue="{ row }">
  66. <div v-if="isView">
  67. {{ row.defaultValue }}
  68. </div>
  69. <div v-else>
  70. <el-input
  71. v-if="
  72. row.textType == 1 ||
  73. row.textType == 4 ||
  74. row.textType == 3 ||
  75. row.textType == 5
  76. "
  77. v-model="row.defaultValue"
  78. placeholder="请输入"
  79. ></el-input>
  80. <el-select
  81. v-if="row.textType == 2"
  82. v-model="row.defaultValue"
  83. placeholder="请选择"
  84. >
  85. <el-option label="TRUE" :value="'TRUE'" />
  86. <el-option label="FALSE" :value="'FALSE'" />
  87. </el-select>
  88. </div>
  89. </template>
  90. <!-- 上限 -->
  91. <template v-slot:maxValue="{ row }">
  92. <div v-if="isView">
  93. {{ row.maxValue }}
  94. </div>
  95. <div v-else>
  96. <el-input
  97. v-if="row.textType == 3"
  98. v-model="row.maxValue"
  99. placeholder="请输入"
  100. ></el-input>
  101. </div>
  102. </template>
  103. <!-- 下限 -->
  104. <template v-slot:minValue="{ row }">
  105. <div v-if="isView">
  106. {{ row.minValue }}
  107. </div>
  108. <div v-else>
  109. <el-input
  110. v-if="row.textType == 3"
  111. v-model="row.minValue"
  112. placeholder="请输入"
  113. ></el-input>
  114. </div>
  115. </template>
  116. <!-- 单位 -->
  117. <template v-slot:unitName="{ row }">
  118. <div v-if="isView">
  119. {{ row.unitName }}
  120. </div>
  121. <div v-else>
  122. <DictSelection
  123. v-if="row.textType != 2 && row.textType != 5"
  124. dictName="工艺参数单位"
  125. clearable
  126. filterable
  127. v-model="row.unitName"
  128. >
  129. </DictSelection>
  130. <span v-if="row.textType == 5"> h(小时)</span>
  131. </div>
  132. </template>
  133. <!-- 操作列 -->
  134. <template v-slot:action="{ row }">
  135. <el-popconfirm
  136. class="ele-action"
  137. title="确定要删除当前参数吗?"
  138. @confirm="remove(row, '工艺')"
  139. >
  140. <template v-slot:reference>
  141. <el-link
  142. type="danger"
  143. :underline="false"
  144. icon="el-icon-delete"
  145. >
  146. 删除
  147. </el-link>
  148. </template>
  149. </el-popconfirm>
  150. </template>
  151. </ele-pro-table>
  152. </el-tab-pane>
  153. <el-tab-pane label="质检项参数" name="质检项参数">
  154. <term :qualityParam="qualityParam" ref="qualityParamRef"></term>
  155. </el-tab-pane>
  156. <el-tab-pane label="生产节拍" name="生产节拍">
  157. <el-form label-width="100px" ref="form" :model="beatParam">
  158. <el-row>
  159. <el-col :span="16" label-width="100px">
  160. <el-form-item label="节拍生产数量" prop="beatNum">
  161. <el-input
  162. v-if="!isView"
  163. placeholder=""
  164. v-model="beatParam.beatNum"
  165. ></el-input>
  166. <div v-else>{{ beatParam.beatNum }}</div>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="8" label-width="100px">
  170. <el-form-item label="单位" prop="beatUnit">
  171. <el-select
  172. v-if="!isView"
  173. v-model="beatParam.beatUnit"
  174. filterable
  175. class="ele-block"
  176. >
  177. <el-option
  178. v-for="item in dictList"
  179. :key="item.value"
  180. :value="item.value"
  181. :label="item.label"
  182. ></el-option>
  183. </el-select>
  184. <div v-else>{{ beatParam.beatUnit }}</div>
  185. </el-form-item>
  186. </el-col>
  187. </el-row>
  188. <el-row>
  189. <el-col :span="16" label-width="100px">
  190. <el-form-item label="对应物料数量" prop="materielNum">
  191. <el-input
  192. v-if="!isView"
  193. placeholder=""
  194. v-model="beatParam.materielNum"
  195. ></el-input>
  196. <div v-else>{{ beatParam.materielNum }}</div>
  197. </el-form-item>
  198. </el-col>
  199. <el-col :span="8" label-width="100px">
  200. <el-form-item label="单位" prop="materielUnit">
  201. <el-select
  202. v-if="!isView"
  203. v-model="beatParam.materielUnit"
  204. filterable
  205. class="ele-block"
  206. >
  207. <el-option
  208. v-for="item in dictList"
  209. :key="item.value"
  210. :value="item.value"
  211. :label="item.label"
  212. ></el-option>
  213. </el-select>
  214. <div v-else>{{ beatParam.materielUnit }}</div>
  215. </el-form-item>
  216. </el-col>
  217. </el-row>
  218. <el-row>
  219. <el-col :span="16" label-width="100px">
  220. <el-form-item label="节拍时间" prop="beatTime">
  221. <el-input
  222. v-if="!isView"
  223. placeholder=""
  224. v-model="beatParam.beatTime"
  225. ></el-input>
  226. <div v-else>{{ beatParam.beatTime }}</div>
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="8" label-width="100px">
  230. <el-form-item label="单位" prop="beatTimeUnit">
  231. <el-select
  232. v-if="!isView"
  233. v-model="beatParam.beatTimeUnit"
  234. filterable
  235. class="ele-block"
  236. >
  237. <el-option
  238. v-for="item in dictList"
  239. :key="item.value"
  240. :value="item.value"
  241. :label="item.label"
  242. ></el-option>
  243. </el-select>
  244. <div v-else>{{ beatParam.beatTimeUnit }}</div>
  245. </el-form-item>
  246. </el-col>
  247. </el-row>
  248. <el-row>
  249. <el-col :span="16" label-width="100px">
  250. <el-form-item label="节拍准备时长" prop="name">
  251. <el-input
  252. v-if="!isView"
  253. placeholder=""
  254. v-model="beatParam.beatPrepareTime"
  255. ></el-input>
  256. <div v-else>{{ beatParam.beatPrepareTime }}</div>
  257. </el-form-item>
  258. </el-col>
  259. <el-col :span="8" label-width="100px">
  260. <el-form-item label="单位" prop="beatPrepareUnit">
  261. <el-select
  262. v-if="!isView"
  263. v-model="beatParam.beatPrepareUnit"
  264. filterable
  265. class="ele-block"
  266. >
  267. <el-option
  268. v-for="item in dictList"
  269. :key="item.value"
  270. :value="item.value"
  271. :label="item.label"
  272. ></el-option>
  273. </el-select>
  274. <div v-else>{{ beatParam.beatPrepareUnit }}</div>
  275. </el-form-item>
  276. </el-col>
  277. </el-row>
  278. <el-row>
  279. <el-col :span="16" label-width="100px">
  280. <el-form-item label="节拍休息时长" prop="name">
  281. <el-input
  282. v-if="!isView"
  283. placeholder=""
  284. v-model="beatParam.beatRestTime"
  285. ></el-input>
  286. <div v-else>{{ beatParam.beatRestTime }}</div>
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="8" label-width="100px">
  290. <el-form-item label="单位" prop="beatRestUnit">
  291. <el-select
  292. v-if="!isView"
  293. v-model="beatParam.beatRestUnit"
  294. filterable
  295. class="ele-block"
  296. >
  297. <el-option
  298. v-for="item in dictList"
  299. :key="item.value"
  300. :value="item.value"
  301. :label="item.label"
  302. ></el-option>
  303. </el-select>
  304. <div v-else>{{ beatParam.beatRestUnit }}</div>
  305. </el-form-item>
  306. </el-col>
  307. </el-row>
  308. <el-row>
  309. <el-col :span="24" label-width="100px">
  310. <el-form-item label="备注" prop="remark">
  311. <el-input
  312. v-if="!isView"
  313. placeholder=""
  314. v-model="beatParam.remark"
  315. type="textarea"
  316. :rows="4"
  317. ></el-input>
  318. <div v-else>{{ beatParam.remark }}</div>
  319. </el-form-item>
  320. </el-col>
  321. </el-row>
  322. <el-row>
  323. <el-col :span="8" label-width="100px">
  324. <el-form-item label="添加人" prop="name">
  325. <el-input
  326. v-if="!isView"
  327. placeholder=""
  328. disabled
  329. v-model="beatParam.createName"
  330. ></el-input>
  331. <div v-else>{{ beatParam.createName }}</div>
  332. </el-form-item>
  333. </el-col>
  334. <el-col :span="8" label-width="100px">
  335. <el-form-item label="添加时间" prop="name">
  336. <el-input
  337. v-if="!isView"
  338. placeholder=""
  339. disabled
  340. v-model="beatParam.createTime"
  341. ></el-input>
  342. <div v-else>{{ beatParam.createTime }}</div>
  343. </el-form-item>
  344. </el-col>
  345. </el-row>
  346. <el-row>
  347. <el-col :span="8" label-width="100px">
  348. <el-form-item label="修改人" prop="name">
  349. <el-input
  350. v-if="!isView"
  351. placeholder=""
  352. disabled
  353. v-model="beatParam.updateName"
  354. ></el-input>
  355. <div v-else>{{ beatParam.updateName }}</div>
  356. </el-form-item>
  357. </el-col>
  358. <el-col :span="8" label-width="100px">
  359. <el-form-item label="最后修改时间" prop="name">
  360. <el-input
  361. v-if="!isView"
  362. placeholder=""
  363. disabled
  364. v-model="beatParam.updateTime"
  365. ></el-input>
  366. <div v-else>{{ beatParam.updateTime }}</div>
  367. </el-form-item>
  368. </el-col>
  369. </el-row>
  370. </el-form>
  371. </el-tab-pane>
  372. <el-tab-pane label="标准工时" name="标准工时">
  373. <el-form label-width="100px" ref="form" :model="normalHours">
  374. <el-row>
  375. <el-col :span="16" label-width="100px">
  376. <el-form-item label="标准时长" prop="type">
  377. <el-input
  378. v-if="!isView"
  379. placeholder="标准时长"
  380. v-model="normalHours.time"
  381. ></el-input>
  382. <div v-else>{{ normalHours.time }}</div>
  383. </el-form-item>
  384. </el-col>
  385. <el-col :span="8" label-width="100px">
  386. <el-form-item label="单位" prop="type">
  387. <el-select
  388. v-if="!isView"
  389. v-model="normalHours.unit"
  390. filterable
  391. class="ele-block"
  392. >
  393. <el-option
  394. v-for="item in dictList"
  395. :key="item.value"
  396. :value="item.value"
  397. :label="item.label"
  398. ></el-option>
  399. </el-select>
  400. <div v-else>{{ normalHours.unit }}</div>
  401. </el-form-item>
  402. </el-col>
  403. </el-row>
  404. <el-row>
  405. <el-col :span="24" label-width="100px">
  406. <el-form-item label="备注" prop="remark">
  407. <el-input
  408. v-if="!isView"
  409. placeholder=""
  410. v-model="normalHours.remark"
  411. type="textarea"
  412. :rows="4"
  413. ></el-input>
  414. <div v-else>{{ normalHours.remark }}</div>
  415. </el-form-item>
  416. </el-col>
  417. </el-row>
  418. </el-form>
  419. </el-tab-pane>
  420. <el-tab-pane label="材料定额" name="材料定额">
  421. <ele-pro-table
  422. ref="materialTable"
  423. :columns="columns1"
  424. :datasource="datasource"
  425. :need-page="false"
  426. :immediate="true"
  427. >
  428. <!-- 表头工具栏 -->
  429. <template v-slot:toolbar>
  430. <el-button type="primary" v-if="!isView" @click="add">添加</el-button>
  431. <div class="toolbar_box">
  432. <div
  433. ><span>基本数量</span>
  434. <el-input placeholder="请输入" :disabled="isView" v-model.number="baseCount">
  435. </el-input>
  436. <DictSelection dictName="计量单位" :disabled="isView" v-model="baseCountUnit"
  437. /></div>
  438. </div>
  439. </template>
  440. <template v-slot:action="{ row, $index }">
  441. <el-link type="primary" @click="handleDel(row, $index)"
  442. >删除</el-link
  443. >
  444. </template>
  445. <template v-slot:subCode="{ row }">
  446. <div v-if="isView">{{ row.subCode }}</div>
  447. <el-input
  448. v-else
  449. v-model="row.subCode"
  450. placeholder="请输入"
  451. ></el-input>
  452. </template>
  453. <template v-slot:isReworkBom="{ row }">
  454. <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
  455. <div v-else>
  456. <el-select v-model="row.isReworkBom">
  457. <el-option
  458. v-for="item in isReworkBomList"
  459. :key="item.value"
  460. :label="item.label"
  461. :value="item.value"
  462. >
  463. </el-option>
  464. </el-select>
  465. </div>
  466. </template>
  467. <template v-slot:unit="{ row }">
  468. <div v-if="isView">{{ row.unit }}</div>
  469. <div v-else>
  470. <DictSelection
  471. dictName="计量单位"
  472. v-model="row.unit"
  473. ></DictSelection>
  474. </div>
  475. </template>
  476. <template v-slot:count="{ row }">
  477. <div v-if="isView">{{ row.count }}</div>
  478. <el-input
  479. v-else
  480. v-model="row.count"
  481. placeholder="请输入"
  482. @input="
  483. (value) =>
  484. (row.count = value.replace(
  485. /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
  486. '$1$2.$3'
  487. ))
  488. "
  489. ></el-input>
  490. </template>
  491. <template v-slot:categoryName="{ row, $index }">
  492. <div v-if="isView">{{ row.categoryName }}</div>
  493. <div v-else
  494. ><el-input
  495. :value="row.categoryName"
  496. placeholder="请选择"
  497. @click.native="categorySelect(row, $index)"
  498. ></el-input
  499. ></div>
  500. </template>
  501. <template v-slot:bomArtFiles="{ row }">
  502. <fileUpload
  503. v-model="row.bomArtFiles"
  504. type="add"
  505. size="mini"
  506. />
  507. </template>
  508. <template v-slot:remark="{ row }">
  509. <div v-if="isView">{{ row.remark }}</div>
  510. <el-input
  511. v-else
  512. v-model="row.remark"
  513. placeholder="请输入"
  514. ></el-input>
  515. </template>
  516. </ele-pro-table>
  517. </el-tab-pane>
  518. <el-tab-pane label="关键设备" name="关键设备">
  519. <ele-pro-table
  520. ref="deviceTabRef"
  521. :columns="standardCol"
  522. :datasource="datasource"
  523. :need-page="false"
  524. :immediate="true"
  525. >
  526. <!-- 表头工具栏 -->
  527. <template v-if="!isView" v-slot:toolbar>
  528. <el-button type="primary" @click="add">添加</el-button>
  529. </template>
  530. <template v-slot:action="{ row, $index }">
  531. <el-link type="danger" @click="handleDel(row, $index)"
  532. >删除</el-link
  533. >
  534. </template>
  535. </ele-pro-table>
  536. </el-tab-pane>
  537. <el-tab-pane label="制造资源" name="制造资源">
  538. <ele-pro-table
  539. ref="resourceTable"
  540. :columns="columns1"
  541. :datasource="datasource"
  542. :need-page="false"
  543. :immediate="true"
  544. >
  545. <!-- 表头工具栏 -->
  546. <template v-if="!isView" v-slot:toolbar>
  547. <el-button type="primary" @click="add">添加</el-button>
  548. </template>
  549. <template v-slot:action="{ row, $index }">
  550. <el-link type="primary" @click="handleDel(row, $index)"
  551. >删除</el-link
  552. >
  553. </template>
  554. <template v-slot:subCode="{ row }">
  555. <div v-if="isView">{{ row.subCode }}</div>
  556. <el-input
  557. v-else
  558. v-model="row.subCode"
  559. placeholder="请输入"
  560. ></el-input>
  561. </template>
  562. <template v-slot:isReworkBom="{ row }">
  563. <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
  564. <div v-else>
  565. <el-select v-model="row.isReworkBom">
  566. <el-option
  567. v-for="item in isReworkBomList"
  568. :key="item.value"
  569. :label="item.label"
  570. :value="item.value"
  571. >
  572. </el-option>
  573. </el-select>
  574. </div>
  575. </template>
  576. <template v-slot:unit="{ row }">
  577. <div v-if="isView">{{ row.unit }}</div>
  578. <div v-else>
  579. <DictSelection
  580. dictName="计量单位"
  581. v-model="row.unit"
  582. ></DictSelection>
  583. </div>
  584. </template>
  585. <template v-slot:count="{ row }">
  586. <div v-if="isView">{{ row.count }}</div>
  587. <el-input
  588. v-else
  589. v-model="row.count"
  590. placeholder="请输入"
  591. @input="
  592. (value) =>
  593. (row.count = value.replace(
  594. /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
  595. '$1$2.$3'
  596. ))
  597. "
  598. ></el-input>
  599. </template>
  600. <template v-slot:categoryName="{ row, $index }">
  601. <div v-if="isView">{{ row.categoryName }}</div>
  602. <div v-else
  603. ><el-input
  604. :value="row.categoryName"
  605. placeholder="请选择"
  606. @click.native="categorySelect(row, $index)"
  607. ></el-input
  608. ></div>
  609. </template>
  610. <template v-slot:bomArtFiles="{ row }">
  611. <fileUpload
  612. v-model="row.bomArtFiles"
  613. type="add"
  614. size="mini"
  615. />
  616. </template>
  617. <template v-slot:remark="{ row }">
  618. <div v-if="isView">{{ row.remark }}</div>
  619. <el-input
  620. v-else
  621. v-model="row.remark"
  622. placeholder="请输入"
  623. ></el-input>
  624. </template>
  625. </ele-pro-table>
  626. </el-tab-pane>
  627. <el-tab-pane label="替代料" name="替代料">
  628. <ele-pro-table
  629. ref="replaceMaterialTable"
  630. :columns="columns1"
  631. :datasource="datasource"
  632. :need-page="false"
  633. :immediate="true"
  634. >
  635. <!-- 表头工具栏 -->
  636. <template v-slot:toolbar>
  637. <el-button type="primary" v-if="!isView" @click="add">添加</el-button>
  638. <div class="toolbar_box">
  639. <div
  640. ><span>基本数量</span>
  641. <el-input placeholder="请输入" :disabled="isView" v-model.number="baseCount2">
  642. </el-input>
  643. <DictSelection dictName="计量单位" v-model="baseCountUnit2"
  644. /></div>
  645. </div>
  646. </template>
  647. <template v-slot:action="{ row, $index }">
  648. <el-link type="primary" @click="handleDel(row, $index)"
  649. >删除</el-link
  650. >
  651. </template>
  652. <template v-slot:subCode="{ row }">
  653. <div v-if="isView">{{ row.subCode }}</div>
  654. <el-input
  655. v-else
  656. v-model="row.subCode"
  657. placeholder="请输入"
  658. ></el-input>
  659. </template>
  660. <template v-slot:isReworkBom="{ row }">
  661. <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
  662. <div v-else>
  663. <el-select v-model="row.isReworkBom">
  664. <el-option
  665. v-for="item in isReworkBomList"
  666. :key="item.value"
  667. :label="item.label"
  668. :value="item.value"
  669. >
  670. </el-option>
  671. </el-select>
  672. </div>
  673. </template>
  674. <template v-slot:unit="{ row }">
  675. <div v-if="isView">{{ row.unit }}</div>
  676. <div v-else>
  677. <DictSelection
  678. dictName="计量单位"
  679. v-model="row.unit"
  680. ></DictSelection>
  681. </div>
  682. </template>
  683. <template v-slot:count="{ row }">
  684. <div v-if="isView">{{ row.count }}</div>
  685. <el-input
  686. v-else
  687. v-model="row.count"
  688. placeholder="请输入"
  689. @input="
  690. (value) =>
  691. (row.count = value.replace(
  692. /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
  693. '$1$2.$3'
  694. ))
  695. "
  696. ></el-input>
  697. </template>
  698. <template v-slot:categoryName="{ row, $index }">
  699. <div v-if="isView">{{ row.categoryName }}</div>
  700. <div v-else
  701. ><el-input
  702. :value="row.categoryName"
  703. placeholder="请选择"
  704. @click.native="categorySelect(row, $index)"
  705. ></el-input
  706. ></div>
  707. </template>
  708. <template v-slot:bomArtFiles="{ row }">
  709. <fileUpload
  710. v-model="row.bomArtFiles"
  711. type="add"
  712. size="mini"
  713. />
  714. </template>
  715. <template v-slot:remark="{ row }">
  716. <div v-if="isView">{{ row.remark }}</div>
  717. <el-input
  718. v-else
  719. v-model="row.remark"
  720. placeholder="请输入"
  721. ></el-input>
  722. </template>
  723. </ele-pro-table>
  724. </el-tab-pane>
  725. <el-tab-pane label="工种" name="工种">
  726. <ele-pro-table
  727. ref="jobTable"
  728. :columns="jobColumns"
  729. :datasource="datasource"
  730. row-key="id"
  731. >
  732. <!-- 表头工具栏 -->
  733. <template v-slot:toolbar>
  734. <el-button
  735. size="small"
  736. type="primary"
  737. icon="el-icon-plus"
  738. class="ele-btn-icon"
  739. @click="addJob"
  740. >新增</el-button
  741. >
  742. </template>
  743. <template v-slot:action="{ row, $index }">
  744. <el-link type="primary" @click="handleDel(row, $index)"
  745. >删除</el-link
  746. >
  747. </template>
  748. </ele-pro-table>
  749. </el-tab-pane>
  750. <el-tab-pane label="工艺文件" name="工艺文件">
  751. <ele-pro-table
  752. ref="fileTable"
  753. :columns="jobColumns1"
  754. :datasource="datasource"
  755. :need-page="false"
  756. :immediate="true"
  757. >
  758. <!-- 表头工具栏 -->
  759. <template v-if="!isView" v-slot:toolbar>
  760. <el-button type="primary" @click="addFile">添加</el-button>
  761. </template>
  762. <template v-slot:action="{ row, $index }">
  763. <el-link type="primary" @click="handleDel(row, $index)"
  764. >删除</el-link
  765. >
  766. <el-link type="primary" @click="fileDetails(row)"
  767. >详情</el-link
  768. >
  769. </template>
  770. </ele-pro-table>
  771. </el-tab-pane>
  772. <el-tab-pane label="标准产出" name="标准产出">
  773. <ele-pro-table
  774. ref="standard"
  775. :columns="standardCol"
  776. :datasource="datasource"
  777. :need-page="false"
  778. :immediate="true"
  779. >
  780. <!-- 表头工具栏 -->
  781. <template v-if="!isView" v-slot:toolbar>
  782. <el-button type="primary" @click="add">添加</el-button>
  783. </template>
  784. <template v-slot:action="{ row, $index }">
  785. <el-link type="danger" @click="handleDel(row, $index)"
  786. >删除</el-link
  787. >
  788. </template>
  789. </ele-pro-table>
  790. </el-tab-pane>
  791. </el-tabs>
  792. </el-card>
  793. <!-- 选择工艺参数 -->
  794. <jobDialog ref="jobRef" @chooseModal="chooseJob"></jobDialog>
  795. <ParamModal ref="paramRefs" @chooseModal="chooseModal"></ParamModal>
  796. <ProductModal ref="productRefs" @changeProduct="determineChoose" />
  797. <ProductModalMultiple
  798. ref="productMultipleRefs"
  799. @selection="addProductList"
  800. ></ProductModalMultiple>
  801. <standardOutput
  802. ref="standardOutputRefs"
  803. @selection="chooseStandardList"
  804. ></standardOutput>
  805. <fileIndex v-if="fileShow" @close="fileClose"></fileIndex>
  806. <fileBrowse ref="browseRef"></fileBrowse>
  807. <div class="btns">
  808. <el-button
  809. type="primary"
  810. size="small"
  811. v-if="!isView"
  812. @click="save('save')"
  813. >
  814. 保存</el-button
  815. >
  816. <el-button type="primary" size="small" @click="save('close')">{{
  817. isView ? '确定' : '保存并关闭'
  818. }}</el-button>
  819. <el-button size="small" @click="handleClose">关闭</el-button>
  820. </div>
  821. </el-dialog>
  822. </template>
  823. <script>
  824. import dictMixins from '@/mixins/dictMixins';
  825. import * as dayjs from 'dayjs';
  826. import { getFile } from '@/api/system/file';
  827. import fileUpload from '@/components/addDoc/index.vue';
  828. import { workingProcedureUpdate } from '@/api/material/BOM';
  829. import ParamModal from '@/views/technology/productParam/components/ParamModal.vue';
  830. import ProductModal from '@/components/select/bom/ProductModal.vue';
  831. import { getByCode } from '@/api/system/dictionary-data';
  832. import ProductModalMultiple from './ProductModalMultiple.vue';
  833. import userSearch from './user-search.vue';
  834. import jobDialog from './jobDialog.vue';
  835. import standardOutput from './standardOutput.vue';
  836. import term from '../qualityTesting/term';
  837. import fileIndex from '../file/index.vue';
  838. import fileBrowse from '../file/fileBrowse.vue'
  839. export default {
  840. components: {
  841. userSearch,
  842. ParamModal,
  843. fileUpload,
  844. ProductModal,
  845. jobDialog,
  846. ProductModalMultiple,
  847. standardOutput,
  848. term,
  849. fileIndex,
  850. fileBrowse
  851. },
  852. mixins: [dictMixins],
  853. data() {
  854. return {
  855. baseCount: '',
  856. baseCountUnit: '',
  857. baseCount2: '',
  858. baseCountUnit2: '',
  859. isView: false,
  860. filedList: [],
  861. jobFiledList: [],
  862. activeName: '工艺参数',
  863. attributeData: {},
  864. visible: false,
  865. title: '配置',
  866. form: {},
  867. statusOption: [
  868. {
  869. label: '启用',
  870. value: 1
  871. },
  872. {
  873. label: '停用',
  874. value: 0
  875. }
  876. ],
  877. isReworkBom: ['否', '是'],
  878. isReworkBomList: [
  879. { label: '否', value: 0 },
  880. { label: '是', value: 1 }
  881. ],
  882. dictList: [], //单位下拉
  883. // 表格列配置
  884. columns1: [],
  885. defaultColumns1: [
  886. {
  887. type: 'index',
  888. width: 55,
  889. align: 'center'
  890. },
  891. {
  892. label: '子项编号',
  893. prop: 'subCode',
  894. slot: 'subCode',
  895. action: 'subCode'
  896. },
  897. {
  898. label: '物料名称',
  899. prop: 'categoryName',
  900. slot: 'categoryName',
  901. action: 'categoryName'
  902. },
  903. {
  904. label: '是否回收料',
  905. prop: 'isReworkBom',
  906. slot: 'isReworkBom',
  907. action: 'isReworkBom'
  908. },
  909. {
  910. label: '编码',
  911. prop: 'categoryCode'
  912. },
  913. {
  914. label: '牌号',
  915. prop: 'brandNum'
  916. },
  917. {
  918. label: '型号',
  919. prop: 'modelType'
  920. },
  921. {
  922. prop: 'specification',
  923. label: '规格',
  924. align: 'center',
  925. showOverflowTooltip: true
  926. },
  927. {
  928. label: '数量',
  929. slot: 'count',
  930. action: 'count'
  931. },
  932. {
  933. label: '单位',
  934. slot: 'unit',
  935. action: 'unit'
  936. },
  937. {
  938. label: '附件',
  939. slot: 'bomArtFiles',
  940. action: 'bomArtFiles',
  941. minWidth: 150
  942. },
  943. {
  944. label: '备注',
  945. slot: 'remark',
  946. action: 'remark'
  947. }
  948. ],
  949. columns: [],
  950. // 表格列配置
  951. defaultColumns: [
  952. {
  953. prop: 'sort',
  954. slot: 'sort',
  955. label: '排序',
  956. minWidth: 60
  957. },
  958. {
  959. prop: 'code',
  960. label: '参数编码',
  961. showOverflowTooltip: true,
  962. align: 'center',
  963. minWidth: 110
  964. },
  965. {
  966. prop: 'name',
  967. label: '参数名称',
  968. showOverflowTooltip: true,
  969. align: 'center',
  970. minWidth: 110
  971. },
  972. {
  973. align: 'center',
  974. prop: 'description',
  975. label: '文本描述',
  976. showOverflowTooltip: true,
  977. minWidth: 110
  978. },
  979. {
  980. prop: 'maxValue',
  981. slot: 'maxValue',
  982. label: '参数上限',
  983. align: 'center'
  984. },
  985. {
  986. prop: 'minValue',
  987. slot: 'minValue',
  988. label: '参数下限',
  989. align: 'center'
  990. },
  991. {
  992. prop: 'defaultValue',
  993. slot: 'defaultValue',
  994. label: '默认值',
  995. align: 'center'
  996. }
  997. ],
  998. levelOptions: [
  999. {
  1000. label: '初级',
  1001. value: '1'
  1002. },
  1003. {
  1004. label: '中级',
  1005. value: '2'
  1006. },
  1007. {
  1008. label: '高级',
  1009. value: '3'
  1010. }
  1011. ],
  1012. // 表格列配置
  1013. jobColumns: [
  1014. {
  1015. label: '序号',
  1016. type: 'index',
  1017. width: 55,
  1018. align: 'center'
  1019. },
  1020. {
  1021. slot: 'type',
  1022. label: '类型',
  1023. showOverflowTooltip: true,
  1024. align: 'center',
  1025. minWidth: 110,
  1026. formatter: (_row) => {
  1027. return this.getDictValue('工种类型', _row.type);
  1028. }
  1029. },
  1030. {
  1031. align: 'center',
  1032. prop: 'code',
  1033. label: '编码',
  1034. showOverflowTooltip: true,
  1035. minWidth: 110
  1036. },
  1037. {
  1038. slot: 'name',
  1039. prop: 'name',
  1040. label: '名称',
  1041. showOverflowTooltip: true,
  1042. align: 'center',
  1043. minWidth: 110
  1044. },
  1045. {
  1046. slot: 'level',
  1047. prop: 'level',
  1048. label: '等级',
  1049. showOverflowTooltip: true,
  1050. align: 'center',
  1051. minWidth: 110,
  1052. formatter: (_row) => {
  1053. return this.levelOptions.filter(
  1054. (item) => _row.level == item.value
  1055. )[0].label;
  1056. }
  1057. },
  1058. {
  1059. slot: 'hourCost',
  1060. prop: 'hourCost',
  1061. label: '标准工时费',
  1062. showOverflowTooltip: true,
  1063. align: 'center',
  1064. minWidth: 110
  1065. },
  1066. {
  1067. columnKey: 'action',
  1068. label: '操作',
  1069. width: 260,
  1070. align: 'center',
  1071. resizable: false,
  1072. slot: 'action',
  1073. showOverflowTooltip: true
  1074. }
  1075. ],
  1076. // 表格选中数据
  1077. jobColumns1: [
  1078. {
  1079. label: '编码',
  1080. prop: 'code',
  1081. width: 180,
  1082. align: 'center',
  1083. showOverflowTooltip: true
  1084. },
  1085. {
  1086. prop: 'name',
  1087. label: '文档名称',
  1088. align: 'center',
  1089. slot: 'name',
  1090. showOverflowTooltip: true,
  1091. minWidth: 200
  1092. },
  1093. {
  1094. prop: 'storagePath',
  1095. label: '文件名称',
  1096. align: 'center',
  1097. showOverflowTooltip: true,
  1098. minWidth: 200,
  1099. formatter: (_row, _column, cellValue) => {
  1100. return cellValue[0]?.name;
  1101. }
  1102. },
  1103. {
  1104. prop: 'version',
  1105. label: '版本',
  1106. align: 'center',
  1107. showOverflowTooltip: true,
  1108. minWidth: 100
  1109. },
  1110. {
  1111. prop: 'createTime',
  1112. label: '创建时间',
  1113. showOverflowTooltip: true,
  1114. align: 'center',
  1115. minWidth: 110
  1116. },
  1117. {
  1118. columnKey: 'action',
  1119. label: '操作',
  1120. width: 260,
  1121. align: 'center',
  1122. resizable: false,
  1123. slot: 'action',
  1124. showOverflowTooltip: true
  1125. }
  1126. ],
  1127. standardCol: [
  1128. {
  1129. prop: 'code',
  1130. label: '编码'
  1131. },
  1132. {
  1133. prop: 'name',
  1134. label: '名称',
  1135. showOverflowTooltip: true
  1136. },
  1137. {
  1138. prop: 'brandNum',
  1139. label: '牌号'
  1140. },
  1141. {
  1142. prop: 'modelType',
  1143. label: '型号',
  1144. align: 'center',
  1145. showOverflowTooltip: true
  1146. },
  1147. {
  1148. prop: 'specification',
  1149. label: '规格',
  1150. align: 'center',
  1151. showOverflowTooltip: true
  1152. },
  1153. {
  1154. prop: 'measuringUnit',
  1155. label: '计量单位',
  1156. showOverflowTooltip: true,
  1157. minWidth: 90
  1158. },
  1159. {
  1160. columnKey: 'action',
  1161. label: '操作',
  1162. align: 'center',
  1163. resizable: false,
  1164. slot: 'action',
  1165. showOverflowTooltip: true
  1166. }
  1167. ],
  1168. rowData: {},
  1169. treeData: {},
  1170. currentIndex: 0,
  1171. tableData: {},
  1172. beatParam: {},
  1173. normalHours: {},
  1174. qualityParam: [],
  1175. qualityPointParam: [],
  1176. fileShow: false
  1177. };
  1178. },
  1179. created() {
  1180. this.requestDict('工种类型');
  1181. this.getDictList('time_unit');
  1182. },
  1183. methods: {
  1184. addFile() {
  1185. this.fileShow = true;
  1186. },
  1187. fileClose(val) {
  1188. if (val == false) {
  1189. this.fileShow = false;
  1190. } else {
  1191. this.fileShow = false;
  1192. this.$refs.fileTable.setData([
  1193. ...val,
  1194. ...this.$refs.fileTable.getData()
  1195. ]);
  1196. this.$set(
  1197. this.tableData.taskParam[this.currentIndex],
  1198. 'fileParam',
  1199. this.$refs.fileTable.getData()
  1200. );
  1201. }
  1202. },
  1203. fileDetails(row) {
  1204. this.$refs.browseRef.setFileUrl(row)
  1205. },
  1206. addJob() {
  1207. this.$refs.jobRef.open();
  1208. },
  1209. chooseJob(data) {
  1210. this.$refs.jobTable.setData([
  1211. ...data,
  1212. ...this.$refs.jobTable.getData()
  1213. ]);
  1214. this.$set(
  1215. this.tableData.taskParam[this.currentIndex],
  1216. 'aptitudeParam',
  1217. this.$refs.jobTable.getData()
  1218. );
  1219. },
  1220. determineChoose(title, row, idx) {
  1221. let type = '';
  1222. if (this.activeName === '材料定额') {
  1223. type = 'materialQuota';
  1224. } else if (this.activeName === '制造资源') {
  1225. type = 'resource';
  1226. } else if (this.activeName === '替代料') {
  1227. type = 'replaceMaterial';
  1228. }
  1229. if (title == '选择物料') {
  1230. this.$set(
  1231. this.tableData.taskParam[this.currentIndex][type][idx],
  1232. 'categoryName',
  1233. row.name
  1234. );
  1235. this.$set(
  1236. this.tableData.taskParam[this.currentIndex][type][idx],
  1237. 'categoryId',
  1238. row.id
  1239. );
  1240. this.$set(
  1241. this.tableData.taskParam[this.currentIndex][type][idx],
  1242. 'categoryCode',
  1243. row.code
  1244. );
  1245. this.$set(
  1246. this.tableData.taskParam[this.currentIndex][type][idx],
  1247. 'unit',
  1248. row.measuringUnit
  1249. );
  1250. this.$set(
  1251. this.tableData.taskParam[this.currentIndex][type][idx],
  1252. 'weightUnit',
  1253. row.weightUnit
  1254. );
  1255. this.$set(
  1256. this.tableData.taskParam[this.currentIndex][type][idx],
  1257. 'brandNum',
  1258. row.brandNum
  1259. );
  1260. this.$set(
  1261. this.tableData.taskParam[this.currentIndex][type][idx],
  1262. 'modelType',
  1263. row.modelType
  1264. );
  1265. }
  1266. },
  1267. uploadedSuccess(data, row) {
  1268. row.bomArtFiles = data[0].storePath;
  1269. this.filedList = [];
  1270. },
  1271. uploadedJobSuccess(data, row) {
  1272. row.path = data[0].storePath;
  1273. row.name = data[0].name;
  1274. this.jobFiledList = [];
  1275. },
  1276. downloadFile(url) {
  1277. getFile({ objectName: url }, '附件');
  1278. },
  1279. categorySelect(row, idx) {
  1280. this.$refs.productRefs.open(row, '选择物料', '1', idx);
  1281. },
  1282. handleDel(row, index) {
  1283. let type = '';
  1284. if (this.activeName === '材料定额') {
  1285. type = 'materialQuota';
  1286. } else if (this.activeName === '制造资源') {
  1287. type = 'resource';
  1288. } else if (this.activeName === '替代料') {
  1289. type = 'replaceMaterial';
  1290. } else if (this.activeName === '工种') {
  1291. type = 'aptitudeParam';
  1292. } else if (this.activeName === '工艺文件') {
  1293. type = 'fileParam';
  1294. } else if (this.activeName === '标准产出') {
  1295. type = 'standardOutput';
  1296. } else if (this.activeName === '关键设备') {
  1297. type = 'standardDevice';
  1298. }
  1299. this.tableData.taskParam[this.currentIndex][type].splice(index, 1);
  1300. },
  1301. addProductList(list) {
  1302. let subCode = 0;
  1303. let array = [];
  1304. list.map((item, index) => {
  1305. let max = '';
  1306. if (
  1307. this.tableData.taskParam[this.currentIndex]['materialQuota']
  1308. .length > 0
  1309. ) {
  1310. max =
  1311. Math.max(
  1312. ...this.tableData.taskParam[this.currentIndex][
  1313. 'materialQuota'
  1314. ].map((i) => i.subCode)
  1315. ) +
  1316. 10 * ++index +
  1317. '';
  1318. if (max.length < 4) {
  1319. max = new Array(4 - max.length).fill('0').join('') + max;
  1320. }
  1321. } else {
  1322. max = 10 * ++index + '';
  1323. if (max.length < 4) {
  1324. max = new Array(4 - max.length).fill('0').join('') + max;
  1325. }
  1326. }
  1327. console.log('item', this.isValueANumber(item.specification))
  1328. if(item.categoryLevelPathIdParent == 8 && this.isValueANumber(this.baseCount) && this.isValueANumber(item.specification) ) {
  1329. let num = this.baseCount / item.specification;
  1330. item.count = num == 'Infinity' ? '' : num.toFixed(3)
  1331. }
  1332. subCode = max.substring(0, max.length - 1) + '0';
  1333. array.push({
  1334. subCode,
  1335. id: item.id,
  1336. categoryName: item.name,
  1337. categoryCode: item.categoryCode,
  1338. isReworkBom: 0,
  1339. brandNum: item.brandNum,
  1340. count: item.count || '',
  1341. modelType: item.modelType,
  1342. unit: item.measuringUnit,
  1343. bomArtFiles: [],
  1344. remark: '',
  1345. specification: item.specification,
  1346. rootCategoryLevelId: item.categoryLevelPathIdParent,
  1347. extInfo:item.extInfo,
  1348. });
  1349. });
  1350. this.tableData.taskParam[this.currentIndex].materialQuota =
  1351. this.tableData.taskParam[this.currentIndex].materialQuota.concat(
  1352. array
  1353. );
  1354. this.$refs.materialTable.setData(
  1355. this.tableData.taskParam[this.currentIndex].materialQuota
  1356. );
  1357. },
  1358. isValueANumber(variable) {
  1359. if (variable === undefined || variable === null) {
  1360. return false; // 变量没有值
  1361. }
  1362. if (typeof variable === 'number') {
  1363. return true; // 基本类型的数字
  1364. }
  1365. if (typeof variable === 'string' && !isNaN(variable) && !variable.includes('.') || (variable.includes('.') && !variable.endsWith('.'))) {
  1366. // 字符串类型的数字(注意:这个正则表达式判断较为简单,可能需要根据实际情况调整)
  1367. // 或者使用 Number.isFinite(parseFloat(variable)) 来代替这部分逻辑,但要注意性能开销和边缘情况
  1368. const num = Number(variable);
  1369. return !isNaN(num) && isFinite(num);
  1370. }
  1371. return false; // 其他类型
  1372. },
  1373. add() {
  1374. let subCode = '0010';
  1375. let type = '';
  1376. if (this.activeName === '材料定额') {
  1377. this.$refs.productMultipleRefs.open(1);
  1378. return;
  1379. } else if (this.activeName === '标准产出') {
  1380. this.$refs.standardOutputRefs.open(9);
  1381. return;
  1382. } else if (this.activeName === '关键设备') {
  1383. this.$refs.standardOutputRefs.open(4);
  1384. return;
  1385. } else if (this.activeName === '制造资源') {
  1386. type = 'resource';
  1387. } else if (this.activeName === '替代料') {
  1388. type = 'replaceMaterial';
  1389. }
  1390. console.log(this.tableData.taskParam[this.currentIndex]);
  1391. if (this.tableData.taskParam[this.currentIndex][type].length) {
  1392. let max =
  1393. Math.max(
  1394. ...this.tableData.taskParam[this.currentIndex][type].map(
  1395. (i) => i.subCode
  1396. )
  1397. ) +
  1398. 10 +
  1399. '';
  1400. if (max.length < 4) {
  1401. max = new Array(4 - max.length).fill('0').join('') + max;
  1402. }
  1403. subCode = max.substring(0, max.length - 1) + '0';
  1404. }
  1405. this.tableData.taskParam[this.currentIndex][type].push({
  1406. subCode,
  1407. categoryId: '',
  1408. categoryName: '',
  1409. isReworkBom: 0,
  1410. brandNum: '',
  1411. count: '',
  1412. modelType: '',
  1413. unit: ''
  1414. });
  1415. },
  1416. /* 表格数据源 */
  1417. async datasource() {
  1418. return [];
  1419. },
  1420. tabsChange() {
  1421. console.log(this.activeName);
  1422. console.log(this.tableData.taskParam[this.currentIndex]);
  1423. if (this.activeName === '工艺参数') {
  1424. // 工艺参数
  1425. this.$refs.table.setData(
  1426. this.tableData.taskParam[this.currentIndex].produceList || []
  1427. );
  1428. } else if (this.activeName === '质检项参数') {
  1429. this.qualityParam =
  1430. this.tableData.taskParam[this.currentIndex].qualityParam || [];
  1431. } else if (this.activeName === '生产节拍') {
  1432. console.log(this.tableData.taskParam[this.currentIndex].beatParam);
  1433. this.beatParam =
  1434. this.tableData.taskParam[this.currentIndex].beatParam || {};
  1435. } else if (this.activeName === '标准工时') {
  1436. this.normalHours =
  1437. this.tableData.taskParam[this.currentIndex].normalHours || {};
  1438. } else if (this.activeName === '材料定额') {
  1439. this.$refs.materialTable.setData(
  1440. this.tableData.taskParam[this.currentIndex].materialQuota || []
  1441. );
  1442. } else if (this.activeName === '制造资源') {
  1443. this.$refs.resourceTable.setData(
  1444. this.tableData.taskParam[this.currentIndex].resource || []
  1445. );
  1446. } else if (this.activeName === '替代料') {
  1447. this.$refs.replaceMaterialTable.setData(
  1448. this.tableData.taskParam[this.currentIndex].replaceMaterial || []
  1449. );
  1450. } else if (this.activeName === '工种') {
  1451. if (
  1452. JSON.stringify(
  1453. this.tableData.taskParam[this.currentIndex].aptitudeParam
  1454. ) == '{}'
  1455. ) {
  1456. this.tableData.taskParam[this.currentIndex].aptitudeParam = [];
  1457. this.$refs.jobTable.setData([]);
  1458. } else {
  1459. this.$refs.jobTable.setData(
  1460. this.tableData.taskParam[this.currentIndex].aptitudeParam
  1461. );
  1462. }
  1463. } else if (this.activeName === '工艺文件') {
  1464. if (
  1465. JSON.stringify(
  1466. this.tableData.taskParam[this.currentIndex].fileParam
  1467. ) == '{}'
  1468. ) {
  1469. this.tableData.taskParam[this.currentIndex].fileParam = [];
  1470. this.$refs.fileTable.setData([]);
  1471. } else {
  1472. this.$refs.fileTable.setData(
  1473. this.tableData.taskParam[this.currentIndex].fileParam
  1474. );
  1475. }
  1476. } else if (this.activeName === '标准产出') {
  1477. this.$refs.standard.setData(
  1478. this.tableData.taskParam[this.currentIndex].standardOutput || []
  1479. );
  1480. } else if (this.activeName === '关键设备') {
  1481. this.$refs.deviceTabRef.setData(
  1482. this.tableData.taskParam[this.currentIndex].standardDevice || []
  1483. );
  1484. }
  1485. },
  1486. openParam(type) {
  1487. let tableData = [];
  1488. if (type === '工艺') {
  1489. tableData = this.$refs.table.getData();
  1490. } else {
  1491. tableData = this.$refs.qualityTable.getData();
  1492. }
  1493. this.$refs.paramRefs.open(tableData);
  1494. },
  1495. chooseModal(data) {
  1496. let dom = null;
  1497. if (this.activeName === '工艺参数') {
  1498. dom = this.$refs.table;
  1499. }
  1500. dom.setData([...data, ...dom.getData()]);
  1501. this.$set(
  1502. this.tableData.taskParam[this.currentIndex],
  1503. this.activeName === '工艺参数' ? 'produceList' : '',
  1504. dom.getData()
  1505. );
  1506. },
  1507. chooseStandardList(type, data) {
  1508. let dom = null;
  1509. if (type == 9) {
  1510. dom = this.$refs.standard;
  1511. dom.setData([data[0]]);
  1512. this.$set(
  1513. this.tableData.taskParam[this.currentIndex],
  1514. 'standardOutput',
  1515. dom.getData()
  1516. );
  1517. } else if (type == 4) {
  1518. dom = this.$refs.deviceTabRef;
  1519. dom.setData([data[0]]);
  1520. this.$set(
  1521. this.tableData.taskParam[this.currentIndex],
  1522. 'standardDevice',
  1523. dom.getData()
  1524. );
  1525. }
  1526. },
  1527. remove(row, type) {
  1528. let dom = null;
  1529. if (type === '工艺') {
  1530. dom = this.$refs.table;
  1531. } else {
  1532. dom = this.$refs.qualityTable;
  1533. }
  1534. const data = dom.getData();
  1535. if (row.id) {
  1536. dom.setData(data.filter((d) => d.id !== row.id));
  1537. } else {
  1538. dom.setData(data.filter((d) => d.paramId !== row.paramId));
  1539. }
  1540. this.$set(
  1541. this.tableData.taskParam[this.currentIndex],
  1542. type === '工艺' ? 'produceList' : 'qualityParam',
  1543. dom.getData()
  1544. );
  1545. },
  1546. open(rowData, treeData, tableData, isView) {
  1547. this.columns = [];
  1548. this.columns1 = [];
  1549. this.isView = isView;
  1550. if (!this.isView) {
  1551. this.columns = this.defaultColumns.concat({
  1552. columnKey: 'action',
  1553. label: '操作',
  1554. align: 'center',
  1555. resizable: false,
  1556. slot: 'action',
  1557. showOverflowTooltip: true
  1558. });
  1559. this.columns1 = this.defaultColumns1.concat({
  1560. action: 'action',
  1561. slot: 'action',
  1562. label: '操作'
  1563. });
  1564. } else {
  1565. this.columns = this.defaultColumns;
  1566. this.columns1 = this.defaultColumns1;
  1567. }
  1568. this.rowData = JSON.parse(JSON.stringify(rowData));
  1569. this.treeData = JSON.parse(JSON.stringify(treeData));
  1570. this.tableData = JSON.parse(JSON.stringify(tableData));
  1571. this.currentIndex = tableData.taskParam.findIndex(
  1572. (item) => item.id === rowData.id
  1573. );
  1574. this.activeName = '工艺参数';
  1575. this.baseCount = rowData.baseCount;
  1576. this.baseCountUnit = rowData.baseCountUnit;
  1577. this.baseCount2 = rowData.baseCount2;
  1578. this.baseCountUnit2 = rowData.baseCountUnit2;
  1579. this.visible = true;
  1580. setTimeout(() => {
  1581. console.log(this.$refs);
  1582. // 工艺参数
  1583. this.$refs.table.setData(
  1584. this.tableData.taskParam[this.currentIndex].produceList
  1585. );
  1586. }, 500);
  1587. },
  1588. handleClose() {
  1589. this.visible = false;
  1590. this.$refs.table.setSelectedRows([]);
  1591. this.selection = [];
  1592. },
  1593. save(type) {
  1594. if (this.isView) {
  1595. this.handleClose();
  1596. } else {
  1597. // 保存生产节拍
  1598. let userInfo = JSON.parse(localStorage.getItem('info'));
  1599. this.beatParam.createName = userInfo.name;
  1600. this.beatParam.createTime = dayjs(new Date()).format(
  1601. 'YYYY-MM-DD HH:mm:ss'
  1602. );
  1603. this.beatParam.updateName = userInfo.name;
  1604. this.beatParam.updateTime = dayjs(new Date()).format(
  1605. 'YYYY-MM-DD HH:mm:ss'
  1606. );
  1607. this.tableData.taskParam[this.currentIndex].beatParam =
  1608. this.beatParam;
  1609. // 保存标准工时
  1610. this.tableData.taskParam[this.currentIndex].normalHours =
  1611. this.normalHours;
  1612. // 保存材料定额
  1613. this.tableData.taskParam[this.currentIndex].baseCount =
  1614. this.baseCount;
  1615. this.tableData.taskParam[this.currentIndex].baseCountUnit =
  1616. this.baseCountUnit;
  1617. this.tableData.taskParam[this.currentIndex].baseCount2 =
  1618. this.baseCount2;
  1619. this.tableData.taskParam[this.currentIndex].baseCountUnit2 =
  1620. this.baseCountUnit2;
  1621. if (this.$refs.qualityParamRef) {
  1622. this.tableData.taskParam[this.currentIndex].qualityParam =
  1623. this.$refs.qualityParamRef.getDate() || [];
  1624. }
  1625. workingProcedureUpdate({
  1626. id: this.tableData.id,
  1627. categoryId: this.treeData.categoryId,
  1628. bomCategoryId: this.treeData.id,
  1629. categoryCode: this.treeData.categoryCode,
  1630. taskParam: this.tableData.taskParam
  1631. }).then(() => {
  1632. this.$message.success('保存成功');
  1633. this.$emit('chooseProcess');
  1634. if (type === 'close') {
  1635. this.handleClose();
  1636. }
  1637. });
  1638. }
  1639. },
  1640. async getDictList(code) {
  1641. let { data: res } = await getByCode(code);
  1642. this.dictList = res.reduce((acc, curr) => {
  1643. let key = Object.keys(curr)[0]; // 获取当前对象的键
  1644. let value = curr[key]; // 获取当前对象的值
  1645. acc.push({ value, label: value }); // 将 { value, label } 格式的对象添加到数组中
  1646. return acc;
  1647. }, []); // 初始值为空数组 []
  1648. }
  1649. }
  1650. };
  1651. </script>
  1652. <style lang="scss" scoped>
  1653. .btns {
  1654. text-align: center;
  1655. padding: 10px 0;
  1656. }
  1657. .downLoad {
  1658. display: flex;
  1659. }
  1660. .toolbar_box {
  1661. float: right;
  1662. margin-right: 10px;
  1663. > div {
  1664. display: flex;
  1665. align-items: center;
  1666. justify-content: center;
  1667. > span {
  1668. width: 150px;
  1669. }
  1670. > div {
  1671. margin-left: 10px;
  1672. }
  1673. }
  1674. }
  1675. </style>