workingProcedure.vue 63 KB

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