workingProcedure.vue 58 KB

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