workingProcedure.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  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-tabs>
  929. </el-card>
  930. <!-- 选择工艺参数 -->
  931. <jobDialog ref="jobRef" @chooseModal="chooseJob"></jobDialog>
  932. <ParamModal ref="paramRefs" @chooseModal="chooseModal"></ParamModal>
  933. <ProductModal ref="productRefs" @changeProduct="determineChoose" />
  934. <div class="btns">
  935. <el-button type="primary" size="small" @click="save">{{
  936. isView ? '确定' : '保存'
  937. }}</el-button>
  938. <el-button size="small" @click="handleClose">关闭</el-button>
  939. </div>
  940. </el-dialog>
  941. </template>
  942. <script>
  943. import dictMixins from '@/mixins/dictMixins';
  944. import * as dayjs from 'dayjs';
  945. import { getFile } from '@/api/system/file';
  946. import fileUpload from '@/components/upload/fileUpload';
  947. import { workingProcedureUpdate } from '@/api/material/BOM';
  948. import ParamModal from '@/views/technology/productParam/components/ParamModal.vue';
  949. import ProductModal from '@/components/select/bom/ProductModal.vue';
  950. import userSearch from './user-search.vue';
  951. import jobDialog from './jobDialog.vue';
  952. export default {
  953. components: {
  954. userSearch,
  955. ParamModal,
  956. fileUpload,
  957. ProductModal,
  958. jobDialog
  959. },
  960. mixins: [dictMixins],
  961. data() {
  962. return {
  963. baseCount: '',
  964. baseCountUnit: '',
  965. isView: false,
  966. filedList: [],
  967. jobFiledList: [],
  968. activeName: '工艺参数',
  969. attributeData: {},
  970. visible: false,
  971. title: '配置',
  972. form: {},
  973. statusOption: [
  974. {
  975. label: '启用',
  976. value: 1
  977. },
  978. {
  979. label: '停用',
  980. value: 0
  981. }
  982. ],
  983. isReworkBom: ['否', '是'],
  984. isReworkBomList: [
  985. { label: '否', value: 0 },
  986. { label: '是', value: 1 }
  987. ],
  988. // 表格列配置
  989. columns1: [],
  990. defaultColumns1: [
  991. {
  992. type: 'index',
  993. width: 55,
  994. align: 'center'
  995. },
  996. {
  997. label: '子项编号',
  998. prop: 'subCode',
  999. slot: 'subCode',
  1000. action: 'subCode'
  1001. },
  1002. {
  1003. label: '物料名称',
  1004. prop: 'categoryName',
  1005. slot: 'categoryName',
  1006. action: 'categoryName'
  1007. },
  1008. {
  1009. label: '是否回收料',
  1010. prop: 'isReworkBom',
  1011. slot: 'isReworkBom',
  1012. action: 'isReworkBom'
  1013. },
  1014. {
  1015. label: '编码',
  1016. prop: 'categoryCode'
  1017. },
  1018. {
  1019. label: '牌号',
  1020. prop: 'brandNum'
  1021. },
  1022. {
  1023. label: '型号',
  1024. prop: 'modelType'
  1025. },
  1026. {
  1027. label: '数量',
  1028. slot: 'count',
  1029. action: 'count'
  1030. },
  1031. {
  1032. label: '单位',
  1033. slot: 'unit',
  1034. action: 'unit'
  1035. },
  1036. {
  1037. label: '附件',
  1038. slot: 'bomArtFiles',
  1039. action: 'bomArtFiles',
  1040. minWidth: 150
  1041. },
  1042. {
  1043. label: '备注',
  1044. slot: 'remark',
  1045. action: 'remark'
  1046. }
  1047. ],
  1048. columns: [],
  1049. // 表格列配置
  1050. defaultColumns: [
  1051. {
  1052. prop: 'sort',
  1053. slot: 'sort',
  1054. label: '排序',
  1055. minWidth: 60
  1056. },
  1057. {
  1058. prop: 'code',
  1059. label: '参数编码',
  1060. showOverflowTooltip: true,
  1061. align: 'center',
  1062. minWidth: 110
  1063. },
  1064. {
  1065. prop: 'name',
  1066. label: '参数名称',
  1067. showOverflowTooltip: true,
  1068. align: 'center',
  1069. minWidth: 110
  1070. },
  1071. {
  1072. align: 'center',
  1073. prop: 'description',
  1074. label: '文本描述',
  1075. showOverflowTooltip: true,
  1076. minWidth: 110
  1077. },
  1078. {
  1079. prop: 'maxValue',
  1080. slot: 'maxValue',
  1081. label: '参数上限',
  1082. align: 'center'
  1083. },
  1084. {
  1085. prop: 'minValue',
  1086. slot: 'minValue',
  1087. label: '参数下限',
  1088. align: 'center'
  1089. },
  1090. {
  1091. prop: 'defaultValue',
  1092. slot: 'defaultValue',
  1093. label: '默认值',
  1094. align: 'center'
  1095. }
  1096. ],
  1097. levelOptions: [
  1098. {
  1099. label: '初级',
  1100. value: '1'
  1101. },
  1102. {
  1103. label: '中级',
  1104. value: '2'
  1105. },
  1106. {
  1107. label: '高级',
  1108. value: '3'
  1109. }
  1110. ],
  1111. // 表格列配置
  1112. jobColumns: [
  1113. {
  1114. label: '序号',
  1115. type: 'index',
  1116. width: 55,
  1117. align: 'center'
  1118. },
  1119. {
  1120. slot: 'type',
  1121. label: '类型',
  1122. showOverflowTooltip: true,
  1123. align: 'center',
  1124. minWidth: 110,
  1125. formatter: (_row) => {
  1126. return this.getDictValue('工种类型', _row.type);
  1127. }
  1128. },
  1129. {
  1130. align: 'center',
  1131. prop: 'code',
  1132. label: '编码',
  1133. showOverflowTooltip: true,
  1134. minWidth: 110
  1135. },
  1136. {
  1137. slot: 'name',
  1138. prop: 'name',
  1139. label: '名称',
  1140. showOverflowTooltip: true,
  1141. align: 'center',
  1142. minWidth: 110
  1143. },
  1144. {
  1145. slot: 'level',
  1146. prop: 'level',
  1147. label: '等级',
  1148. showOverflowTooltip: true,
  1149. align: 'center',
  1150. minWidth: 110,
  1151. formatter: (_row) => {
  1152. return this.levelOptions.filter(
  1153. (item) => _row.level == item.value
  1154. )[0].label;
  1155. }
  1156. },
  1157. {
  1158. slot: 'hourCost',
  1159. prop: 'hourCost',
  1160. label: '标准工时费',
  1161. showOverflowTooltip: true,
  1162. align: 'center',
  1163. minWidth: 110
  1164. },
  1165. {
  1166. columnKey: 'action',
  1167. label: '操作',
  1168. width: 260,
  1169. align: 'center',
  1170. resizable: false,
  1171. slot: 'action',
  1172. showOverflowTooltip: true
  1173. }
  1174. ],
  1175. // 表格选中数据
  1176. jobColumns1: [
  1177. {
  1178. label: '序号',
  1179. type: 'index',
  1180. width: 55,
  1181. align: 'center'
  1182. },
  1183. {
  1184. slot: 'type',
  1185. prop: 'type',
  1186. label: '类型',
  1187. showOverflowTooltip: true,
  1188. align: 'center',
  1189. minWidth: 110
  1190. },
  1191. {
  1192. slot: 'code',
  1193. prop: 'code',
  1194. label: '编码',
  1195. showOverflowTooltip: true,
  1196. align: 'center',
  1197. minWidth: 110
  1198. },
  1199. {
  1200. slot: 'name',
  1201. prop: 'name',
  1202. label: '名称',
  1203. showOverflowTooltip: true,
  1204. align: 'center',
  1205. minWidth: 110
  1206. },
  1207. {
  1208. slot: 'path',
  1209. prop: 'path',
  1210. label: '附件',
  1211. showOverflowTooltip: true,
  1212. align: 'center',
  1213. minWidth: 200
  1214. },
  1215. {
  1216. slot: 'versions',
  1217. prop: 'versions',
  1218. label: '版本',
  1219. showOverflowTooltip: true,
  1220. align: 'center',
  1221. minWidth: 110
  1222. },
  1223. {
  1224. slot: 'status',
  1225. prop: 'status',
  1226. label: '状态',
  1227. showOverflowTooltip: true,
  1228. align: 'center',
  1229. minWidth: 110
  1230. },
  1231. {
  1232. prop: 'createName',
  1233. label: '创建人',
  1234. showOverflowTooltip: true,
  1235. align: 'center',
  1236. minWidth: 110
  1237. },
  1238. {
  1239. prop: 'createTime',
  1240. label: '创建时间',
  1241. showOverflowTooltip: true,
  1242. align: 'center',
  1243. minWidth: 110
  1244. },
  1245. {
  1246. columnKey: 'action',
  1247. label: '操作',
  1248. width: 260,
  1249. align: 'center',
  1250. resizable: false,
  1251. slot: 'action',
  1252. showOverflowTooltip: true
  1253. }
  1254. ],
  1255. rowData: {},
  1256. treeData: {},
  1257. currentIndex: 0,
  1258. tableData: {},
  1259. beatParam: {},
  1260. normalHours: {}
  1261. };
  1262. },
  1263. created() {
  1264. this.requestDict('工种类型');
  1265. },
  1266. methods: {
  1267. addFile() {
  1268. let userInfo = JSON.parse(localStorage.getItem('info'));
  1269. this.tableData.taskParam[this.currentIndex]['fileParam'].push({
  1270. code: '',
  1271. type: '',
  1272. name: '',
  1273. versions: '',
  1274. name: '',
  1275. status: 1,
  1276. createName: userInfo.name,
  1277. createTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
  1278. });
  1279. this.$refs.fileTable.setData(
  1280. this.tableData.taskParam[this.currentIndex]['fileParam']
  1281. );
  1282. },
  1283. addJob() {
  1284. this.$refs.jobRef.open();
  1285. },
  1286. chooseJob(data) {
  1287. this.$refs.jobTable.setData([
  1288. ...data,
  1289. ...this.$refs.jobTable.getData()
  1290. ]);
  1291. this.$set(
  1292. this.tableData.taskParam[this.currentIndex],
  1293. 'aptitudeParam',
  1294. this.$refs.jobTable.getData()
  1295. );
  1296. },
  1297. determineChoose(title, row, idx) {
  1298. let type = '';
  1299. if (this.activeName === '材料定额') {
  1300. type = 'materialQuota';
  1301. } else if (this.activeName === '制造资源') {
  1302. type = 'resource';
  1303. } else if (this.activeName === '替代料') {
  1304. type = 'replaceMaterial';
  1305. }
  1306. if (title == '选择物料') {
  1307. this.$set(
  1308. this.tableData.taskParam[this.currentIndex][type][idx],
  1309. 'categoryName',
  1310. row.name
  1311. );
  1312. this.$set(
  1313. this.tableData.taskParam[this.currentIndex][type][idx],
  1314. 'categoryId',
  1315. row.id
  1316. );
  1317. this.$set(
  1318. this.tableData.taskParam[this.currentIndex][type][idx],
  1319. 'categoryCode',
  1320. row.code
  1321. );
  1322. this.$set(
  1323. this.tableData.taskParam[this.currentIndex][type][idx],
  1324. 'unit',
  1325. row.measuringUnit
  1326. );
  1327. this.$set(
  1328. this.tableData.taskParam[this.currentIndex][type][idx],
  1329. 'weightUnit',
  1330. row.weightUnit
  1331. );
  1332. this.$set(
  1333. this.tableData.taskParam[this.currentIndex][type][idx],
  1334. 'brandNum',
  1335. row.brandNum
  1336. );
  1337. this.$set(
  1338. this.tableData.taskParam[this.currentIndex][type][idx],
  1339. 'modelType',
  1340. row.modelType
  1341. );
  1342. }
  1343. },
  1344. uploadedSuccess(data, row) {
  1345. row.bomArtFiles = data[0].storePath;
  1346. this.filedList = [];
  1347. },
  1348. uploadedJobSuccess(data, row) {
  1349. row.path = data[0].storePath;
  1350. row.name = data[0].name;
  1351. this.jobFiledList = [];
  1352. },
  1353. downloadFile(url) {
  1354. getFile({ objectName: url }, '附件');
  1355. },
  1356. categorySelect(row, idx) {
  1357. this.$refs.productRefs.open(row, '选择物料', '1', idx);
  1358. },
  1359. handleDel(row, index) {
  1360. let type = '';
  1361. if (this.activeName === '材料定额') {
  1362. type = 'materialQuota';
  1363. } else if (this.activeName === '制造资源') {
  1364. type = 'resource';
  1365. } else if (this.activeName === '替代料') {
  1366. type = 'replaceMaterial';
  1367. } else if (this.activeName === '工种') {
  1368. type = 'aptitudeParam';
  1369. } else if (this.activeName === '工艺文件') {
  1370. type = 'fileParam';
  1371. }
  1372. this.tableData.taskParam[this.currentIndex][type].splice(index, 1);
  1373. },
  1374. add() {
  1375. let subCode = '0010';
  1376. let type = '';
  1377. if (this.activeName === '材料定额') {
  1378. type = 'materialQuota';
  1379. } else if (this.activeName === '制造资源') {
  1380. type = 'resource';
  1381. } else if (this.activeName === '替代料') {
  1382. type = 'replaceMaterial';
  1383. }
  1384. console.log(this.tableData.taskParam[this.currentIndex]);
  1385. if (this.tableData.taskParam[this.currentIndex][type].length) {
  1386. let max =
  1387. Math.max(
  1388. ...this.tableData.taskParam[this.currentIndex][type].map(
  1389. (i) => i.subCode
  1390. )
  1391. ) +
  1392. 10 +
  1393. '';
  1394. if (max.length < 4) {
  1395. max = new Array(4 - max.length).fill('0').join('') + max;
  1396. }
  1397. subCode = max.substring(0, max.length - 1) + '0';
  1398. }
  1399. this.tableData.taskParam[this.currentIndex][type].push({
  1400. subCode,
  1401. categoryId: '',
  1402. categoryName: '',
  1403. isReworkBom: 0,
  1404. brandNum: '',
  1405. count: '',
  1406. modelType: '',
  1407. unit: ''
  1408. });
  1409. },
  1410. /* 表格数据源 */
  1411. async datasource() {
  1412. return [];
  1413. },
  1414. tabsChange() {
  1415. console.log(this.activeName);
  1416. console.log(this.tableData.taskParam[this.currentIndex]);
  1417. if (this.activeName === '工艺参数') {
  1418. // 工艺参数
  1419. this.$refs.table.setData(
  1420. this.tableData.taskParam[this.currentIndex].produceList || []
  1421. );
  1422. } else if (this.activeName === '质检参数') {
  1423. // 质检参数
  1424. this.$refs.qualityTable.setData(
  1425. this.tableData.taskParam[this.currentIndex].qualityParam || []
  1426. );
  1427. } else if (this.activeName === '生产节拍') {
  1428. console.log(this.tableData.taskParam[this.currentIndex].beatParam);
  1429. this.beatParam =
  1430. this.tableData.taskParam[this.currentIndex].beatParam || {};
  1431. } else if (this.activeName === '标准工时') {
  1432. this.normalHours =
  1433. this.tableData.taskParam[this.currentIndex].normalHours || {};
  1434. } else if (this.activeName === '材料定额') {
  1435. this.$refs.materialTable.setData(
  1436. this.tableData.taskParam[this.currentIndex].materialQuota || []
  1437. );
  1438. } else if (this.activeName === '制造资源') {
  1439. this.$refs.resourceTable.setData(
  1440. this.tableData.taskParam[this.currentIndex].resource || []
  1441. );
  1442. } else if (this.activeName === '替代料') {
  1443. this.$refs.replaceMaterialTable.setData(
  1444. this.tableData.taskParam[this.currentIndex].replaceMaterial || []
  1445. );
  1446. } else if (this.activeName === '工种') {
  1447. if (
  1448. JSON.stringify(
  1449. this.tableData.taskParam[this.currentIndex].aptitudeParam
  1450. ) == '{}'
  1451. ) {
  1452. this.tableData.taskParam[this.currentIndex].aptitudeParam = [];
  1453. this.$refs.jobTable.setData([]);
  1454. } else {
  1455. this.$refs.jobTable.setData(
  1456. this.tableData.taskParam[this.currentIndex].aptitudeParam
  1457. );
  1458. }
  1459. } else if (this.activeName === '工艺文件') {
  1460. if (
  1461. JSON.stringify(
  1462. this.tableData.taskParam[this.currentIndex].fileParam
  1463. ) == '{}'
  1464. ) {
  1465. this.tableData.taskParam[this.currentIndex].fileParam = [];
  1466. this.$refs.fileTable.setData([]);
  1467. } else {
  1468. this.$refs.fileTable.setData(
  1469. this.tableData.taskParam[this.currentIndex].fileParam
  1470. );
  1471. }
  1472. }
  1473. },
  1474. openParam(type) {
  1475. let tableData = [];
  1476. if (type === '工艺') {
  1477. tableData = this.$refs.table.getData();
  1478. } else {
  1479. tableData = this.$refs.qualityTable.getData();
  1480. }
  1481. this.$refs.paramRefs.open(tableData);
  1482. },
  1483. chooseModal(data) {
  1484. let dom = null;
  1485. if (this.activeName === '工艺参数') {
  1486. dom = this.$refs.table;
  1487. } else if (this.activeName === '质检参数') {
  1488. dom = this.$refs.qualityTable;
  1489. }
  1490. dom.setData([...data, ...dom.getData()]);
  1491. this.$set(
  1492. this.tableData.taskParam[this.currentIndex],
  1493. this.activeName === '工艺参数' ? 'produceList' : 'qualityParam',
  1494. dom.getData()
  1495. );
  1496. },
  1497. remove(row, type) {
  1498. let dom = null;
  1499. if (type === '工艺') {
  1500. dom = this.$refs.table;
  1501. } else {
  1502. dom = this.$refs.qualityTable;
  1503. }
  1504. const data = dom.getData();
  1505. if (row.id) {
  1506. dom.setData(data.filter((d) => d.id !== row.id));
  1507. } else {
  1508. dom.setData(data.filter((d) => d.paramId !== row.paramId));
  1509. }
  1510. this.$set(
  1511. this.tableData.taskParam[this.currentIndex],
  1512. type === '工艺' ? 'produceList' : 'qualityParam',
  1513. dom.getData()
  1514. );
  1515. },
  1516. open(rowData, treeData, tableData, isView) {
  1517. this.columns = [];
  1518. this.columns1 = [];
  1519. this.isView = isView;
  1520. if (!this.isView) {
  1521. this.columns = this.defaultColumns.concat({
  1522. columnKey: 'action',
  1523. label: '操作',
  1524. align: 'center',
  1525. resizable: false,
  1526. slot: 'action',
  1527. showOverflowTooltip: true
  1528. });
  1529. this.columns1 = this.defaultColumns1.concat({
  1530. action: 'action',
  1531. slot: 'action',
  1532. label: '操作'
  1533. });
  1534. } else {
  1535. this.columns = this.defaultColumns;
  1536. this.columns1 = this.defaultColumns1;
  1537. }
  1538. this.rowData = JSON.parse(JSON.stringify(rowData));
  1539. this.treeData = JSON.parse(JSON.stringify(treeData));
  1540. this.tableData = JSON.parse(JSON.stringify(tableData));
  1541. this.currentIndex = tableData.taskParam.findIndex(
  1542. (item) => item.id === rowData.id
  1543. );
  1544. this.activeName = '工艺参数';
  1545. this.visible = true;
  1546. setTimeout(() => {
  1547. console.log(this.$refs);
  1548. // 工艺参数
  1549. this.$refs.table.setData(
  1550. this.tableData.taskParam[this.currentIndex].produceList
  1551. );
  1552. }, 500);
  1553. },
  1554. handleClose() {
  1555. this.visible = false;
  1556. this.$refs.table.setSelectedRows([]);
  1557. this.selection = [];
  1558. },
  1559. save() {
  1560. if (this.isView) {
  1561. this.handleClose();
  1562. } else {
  1563. // 保存生产节拍
  1564. let userInfo = JSON.parse(localStorage.getItem('info'));
  1565. this.beatParam.createName = userInfo.name;
  1566. this.beatParam.createTime = dayjs(new Date()).format(
  1567. 'YYYY-MM-DD HH:mm:ss'
  1568. );
  1569. this.beatParam.updateName = userInfo.name;
  1570. this.beatParam.updateTime = dayjs(new Date()).format(
  1571. 'YYYY-MM-DD HH:mm:ss'
  1572. );
  1573. this.tableData.taskParam[this.currentIndex].beatParam =
  1574. this.beatParam;
  1575. // 保存标准工时
  1576. this.tableData.taskParam[this.currentIndex].normalHours =
  1577. this.normalHours;
  1578. // 保存材料定额
  1579. this.tableData.taskParam[this.currentIndex].baseCount =
  1580. thsis.baseCount;
  1581. this.tableData.taskParam[this.currentIndex].baseCountUnit =
  1582. thsis.baseCountUnit;
  1583. workingProcedureUpdate({
  1584. id: this.tableData.id,
  1585. categoryId: this.treeData.categoryId,
  1586. bomCategoryId: this.treeData.id,
  1587. categoryCode: this.treeData.categoryCode,
  1588. taskParam: this.tableData.taskParam
  1589. }).then(() => {
  1590. this.$message.success('保存成功');
  1591. this.$emit('chooseProcess');
  1592. this.handleClose();
  1593. });
  1594. }
  1595. }
  1596. }
  1597. };
  1598. </script>
  1599. <style lang="scss" scoped>
  1600. .btns {
  1601. text-align: center;
  1602. padding: 10px 0;
  1603. }
  1604. .downLoad {
  1605. display: flex;
  1606. }
  1607. .toolbar_box {
  1608. float: right;
  1609. margin-right: 10px;
  1610. > div {
  1611. display: flex;
  1612. align-items: center;
  1613. justify-content: center;
  1614. > span {
  1615. width: 150px;
  1616. }
  1617. > div {
  1618. margin-left: 10px;
  1619. }
  1620. }
  1621. }
  1622. </style>