workingProcedure.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887
  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="deviceTabRef"
  599. :columns="standardCol"
  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="danger" @click="handleDel(row, $index)"
  610. >删除</el-link
  611. >
  612. </template>
  613. </ele-pro-table>
  614. </el-tab-pane>
  615. <el-tab-pane label="制造资源" name="制造资源">
  616. <ele-pro-table
  617. ref="resourceTable"
  618. :columns="columns1"
  619. :datasource="datasource"
  620. :need-page="false"
  621. :immediate="true"
  622. >
  623. <!-- 表头工具栏 -->
  624. <template v-if="!isView" v-slot:toolbar>
  625. <el-button type="primary" @click="add">添加</el-button>
  626. </template>
  627. <template v-slot:action="{ row, $index }">
  628. <el-link type="primary" @click="handleDel(row, $index)"
  629. >删除</el-link
  630. >
  631. </template>
  632. <template v-slot:subCode="{ row }">
  633. <div v-if="isView">{{ row.subCode }}</div>
  634. <el-input
  635. v-else
  636. v-model="row.subCode"
  637. placeholder="请输入"
  638. ></el-input>
  639. </template>
  640. <template v-slot:isReworkBom="{ row }">
  641. <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
  642. <div v-else>
  643. <el-select v-model="row.isReworkBom">
  644. <el-option
  645. v-for="item in isReworkBomList"
  646. :key="item.value"
  647. :label="item.label"
  648. :value="item.value"
  649. >
  650. </el-option>
  651. </el-select>
  652. </div>
  653. </template>
  654. <template v-slot:unit="{ row }">
  655. <div v-if="isView">{{ row.unit }}</div>
  656. <div v-else>
  657. <DictSelection
  658. dictName="计量单位"
  659. v-model="row.unit"
  660. ></DictSelection>
  661. </div>
  662. </template>
  663. <template v-slot:count="{ row }">
  664. <div v-if="isView">{{ row.count }}</div>
  665. <el-input
  666. v-else
  667. v-model="row.count"
  668. placeholder="请输入"
  669. @input="
  670. (value) =>
  671. (row.count = value.replace(
  672. /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
  673. '$1$2.$3'
  674. ))
  675. "
  676. ></el-input>
  677. </template>
  678. <template v-slot:categoryName="{ row, $index }">
  679. <div v-if="isView">{{ row.categoryName }}</div>
  680. <div v-else
  681. ><el-input
  682. :value="row.categoryName"
  683. placeholder="请选择"
  684. @click.native="categorySelect(row, $index)"
  685. ></el-input
  686. ></div>
  687. </template>
  688. <template v-slot:bomArtFiles="{ row }">
  689. <div v-if="isView">附件</div>
  690. <div v-else
  691. ><div class="downLoad">
  692. <fileUpload
  693. v-model="filedList"
  694. :show-file-list="false"
  695. module="main"
  696. @input="uploadedSuccess($event, row)"
  697. :showLib="false"
  698. :limit="1"
  699. />
  700. <div v-if="row.bomArtFiles">
  701. <el-button
  702. style="margin-left: 10px"
  703. size="mini"
  704. type="primary"
  705. @click="downloadFile(row.bomArtFiles)"
  706. >下载</el-button
  707. >
  708. </div></div
  709. >
  710. </div>
  711. </template>
  712. <template v-slot:remark="{ row }">
  713. <div v-if="isView">{{ row.remark }}</div>
  714. <el-input
  715. v-else
  716. v-model="row.remark"
  717. placeholder="请输入"
  718. ></el-input>
  719. </template>
  720. </ele-pro-table>
  721. </el-tab-pane>
  722. <el-tab-pane label="替代料" name="替代料">
  723. <ele-pro-table
  724. ref="replaceMaterialTable"
  725. :columns="columns1"
  726. :datasource="datasource"
  727. :need-page="false"
  728. :immediate="true"
  729. >
  730. <!-- 表头工具栏 -->
  731. <template v-if="!isView" v-slot:toolbar>
  732. <el-button type="primary" @click="add">添加</el-button>
  733. </template>
  734. <template v-slot:action="{ row, $index }">
  735. <el-link type="primary" @click="handleDel(row, $index)"
  736. >删除</el-link
  737. >
  738. </template>
  739. <template v-slot:subCode="{ row }">
  740. <div v-if="isView">{{ row.subCode }}</div>
  741. <el-input
  742. v-else
  743. v-model="row.subCode"
  744. placeholder="请输入"
  745. ></el-input>
  746. </template>
  747. <template v-slot:isReworkBom="{ row }">
  748. <div v-if="isView">{{ isReworkBom[row.isReworkBom] }}</div>
  749. <div v-else>
  750. <el-select v-model="row.isReworkBom">
  751. <el-option
  752. v-for="item in isReworkBomList"
  753. :key="item.value"
  754. :label="item.label"
  755. :value="item.value"
  756. >
  757. </el-option>
  758. </el-select>
  759. </div>
  760. </template>
  761. <template v-slot:unit="{ row }">
  762. <div v-if="isView">{{ row.unit }}</div>
  763. <div v-else>
  764. <DictSelection
  765. dictName="计量单位"
  766. v-model="row.unit"
  767. ></DictSelection>
  768. </div>
  769. </template>
  770. <template v-slot:count="{ row }">
  771. <div v-if="isView">{{ row.count }}</div>
  772. <el-input
  773. v-else
  774. v-model="row.count"
  775. placeholder="请输入"
  776. @input="
  777. (value) =>
  778. (row.count = value.replace(
  779. /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
  780. '$1$2.$3'
  781. ))
  782. "
  783. ></el-input>
  784. </template>
  785. <template v-slot:categoryName="{ row, $index }">
  786. <div v-if="isView">{{ row.categoryName }}</div>
  787. <div v-else
  788. ><el-input
  789. :value="row.categoryName"
  790. placeholder="请选择"
  791. @click.native="categorySelect(row, $index)"
  792. ></el-input
  793. ></div>
  794. </template>
  795. <template v-slot:bomArtFiles="{ row }">
  796. <div v-if="isView">附件</div>
  797. <div v-else
  798. ><div class="downLoad">
  799. <fileUpload
  800. v-model="filedList"
  801. :show-file-list="false"
  802. module="main"
  803. @input="uploadedSuccess($event, row)"
  804. :showLib="false"
  805. :limit="1"
  806. />
  807. <div v-if="row.bomArtFiles">
  808. <el-button
  809. style="margin-left: 10px"
  810. size="mini"
  811. type="primary"
  812. @click="downloadFile(row.bomArtFiles)"
  813. >下载</el-button
  814. >
  815. </div></div
  816. >
  817. </div>
  818. </template>
  819. <template v-slot:remark="{ row }">
  820. <div v-if="isView">{{ row.remark }}</div>
  821. <el-input
  822. v-else
  823. v-model="row.remark"
  824. placeholder="请输入"
  825. ></el-input>
  826. </template>
  827. </ele-pro-table>
  828. </el-tab-pane>
  829. <el-tab-pane label="工种" name="工种">
  830. <ele-pro-table
  831. ref="jobTable"
  832. :columns="jobColumns"
  833. :datasource="datasource"
  834. row-key="id"
  835. >
  836. <!-- 表头工具栏 -->
  837. <template v-slot:toolbar>
  838. <el-button
  839. size="small"
  840. type="primary"
  841. icon="el-icon-plus"
  842. class="ele-btn-icon"
  843. @click="addJob"
  844. >新增</el-button
  845. >
  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. </ele-pro-table>
  853. </el-tab-pane>
  854. <el-tab-pane label="工艺文件" name="工艺文件">
  855. <ele-pro-table
  856. ref="fileTable"
  857. :columns="jobColumns1"
  858. :datasource="datasource"
  859. :need-page="false"
  860. :immediate="true"
  861. >
  862. <!-- 表头工具栏 -->
  863. <template v-if="!isView" v-slot:toolbar>
  864. <el-button type="primary" @click="addFile">添加</el-button>
  865. </template>
  866. <template v-slot:action="{ row, $index }">
  867. <el-link type="primary" @click="handleDel(row, $index)"
  868. >删除</el-link
  869. >
  870. </template>
  871. <template v-slot:type="{ row }">
  872. <div v-if="isView">{{ row.type }}</div>
  873. <el-input
  874. v-else
  875. v-model="row.type"
  876. placeholder="请输入"
  877. ></el-input>
  878. </template>
  879. <template v-slot:code="{ row }">
  880. <div v-if="isView">{{ row.code }}</div>
  881. <el-input
  882. v-else
  883. v-model="row.code"
  884. placeholder="请输入"
  885. ></el-input>
  886. </template>
  887. <template v-slot:versions="{ row }">
  888. <div v-if="isView">{{ row.versions }}</div>
  889. <el-input
  890. v-else
  891. v-model="row.versions"
  892. placeholder="请输入"
  893. ></el-input>
  894. </template>
  895. <template v-slot:status="{ row }">
  896. <div v-if="isView">{{
  897. statusOption.filter((item) => item.value == row.status)[0].label
  898. }}</div>
  899. <div v-else>
  900. <template>
  901. <el-select v-model="row.status" placeholder="请选择">
  902. <el-option
  903. v-for="item in statusOption"
  904. :label="item.label"
  905. :value="item.value"
  906. :key="item.value"
  907. >
  908. </el-option>
  909. </el-select>
  910. </template>
  911. </div>
  912. </template>
  913. <template v-slot:path="{ row }">
  914. <div v-if="isView">附件</div>
  915. <div v-else
  916. ><div class="downLoad">
  917. <fileUpload
  918. v-model="jobFiledList"
  919. :show-file-list="false"
  920. module="main"
  921. @input="uploadedJobSuccess($event, row)"
  922. :showLib="false"
  923. :limit="1"
  924. />
  925. <div v-if="row.path">
  926. <el-button
  927. style="margin-left: 10px"
  928. size="mini"
  929. type="primary"
  930. @click="downloadFile(row.path)"
  931. >下载</el-button
  932. >
  933. </div></div
  934. >
  935. </div>
  936. </template>
  937. <template v-slot:remark="{ row }">
  938. <div v-if="isView">{{ row.remark }}</div>
  939. <el-input
  940. v-else
  941. v-model="row.remark"
  942. placeholder="请输入"
  943. ></el-input>
  944. </template>
  945. </ele-pro-table>
  946. </el-tab-pane>
  947. <el-tab-pane label="标准产出" name="标准产出">
  948. <ele-pro-table
  949. ref="standard"
  950. :columns="standardCol"
  951. :datasource="datasource"
  952. :need-page="false"
  953. :immediate="true"
  954. >
  955. <!-- 表头工具栏 -->
  956. <template v-if="!isView" v-slot:toolbar>
  957. <el-button type="primary" @click="add">添加</el-button>
  958. </template>
  959. <template v-slot:action="{ row, $index }">
  960. <el-link type="danger" @click="handleDel(row, $index)"
  961. >删除</el-link
  962. >
  963. </template>
  964. </ele-pro-table>
  965. </el-tab-pane>
  966. </el-tabs>
  967. </el-card>
  968. <!-- 选择工艺参数 -->
  969. <jobDialog ref="jobRef" @chooseModal="chooseJob"></jobDialog>
  970. <ParamModal ref="paramRefs" @chooseModal="chooseModal"></ParamModal>
  971. <ProductModal ref="productRefs" @changeProduct="determineChoose" />
  972. <ProductModalMultiple
  973. ref="productMultipleRefs"
  974. @selection="addProductList"
  975. ></ProductModalMultiple>
  976. <standardOutput
  977. ref="standardOutputRefs"
  978. @selection="chooseStandardList"
  979. ></standardOutput>
  980. <div class="btns">
  981. <el-button type="primary" size="small" @click="save">{{
  982. isView ? '确定' : '保存'
  983. }}</el-button>
  984. <el-button size="small" @click="handleClose">关闭</el-button>
  985. </div>
  986. </el-dialog>
  987. </template>
  988. <script>
  989. import dictMixins from '@/mixins/dictMixins';
  990. import * as dayjs from 'dayjs';
  991. import { getFile } from '@/api/system/file';
  992. import fileUpload from '@/components/upload/fileUpload';
  993. import { workingProcedureUpdate } from '@/api/material/BOM';
  994. import ParamModal from '@/views/technology/productParam/components/ParamModal.vue';
  995. import ProductModal from '@/components/select/bom/ProductModal.vue';
  996. import ProductModalMultiple from './ProductModalMultiple.vue';
  997. import userSearch from './user-search.vue';
  998. import jobDialog from './jobDialog.vue';
  999. import standardOutput from './standardOutput.vue';
  1000. export default {
  1001. components: {
  1002. userSearch,
  1003. ParamModal,
  1004. fileUpload,
  1005. ProductModal,
  1006. jobDialog,
  1007. ProductModalMultiple,
  1008. standardOutput
  1009. },
  1010. mixins: [dictMixins],
  1011. data() {
  1012. return {
  1013. baseCount: '',
  1014. baseCountUnit: '',
  1015. isView: false,
  1016. filedList: [],
  1017. jobFiledList: [],
  1018. activeName: '工艺参数',
  1019. attributeData: {},
  1020. visible: false,
  1021. title: '配置',
  1022. form: {},
  1023. statusOption: [
  1024. {
  1025. label: '启用',
  1026. value: 1
  1027. },
  1028. {
  1029. label: '停用',
  1030. value: 0
  1031. }
  1032. ],
  1033. isReworkBom: ['否', '是'],
  1034. isReworkBomList: [
  1035. { label: '否', value: 0 },
  1036. { label: '是', value: 1 }
  1037. ],
  1038. // 表格列配置
  1039. columns1: [],
  1040. defaultColumns1: [
  1041. {
  1042. type: 'index',
  1043. width: 55,
  1044. align: 'center'
  1045. },
  1046. {
  1047. label: '子项编号',
  1048. prop: 'subCode',
  1049. slot: 'subCode',
  1050. action: 'subCode'
  1051. },
  1052. {
  1053. label: '物料名称',
  1054. prop: 'categoryName',
  1055. slot: 'categoryName',
  1056. action: 'categoryName'
  1057. },
  1058. {
  1059. label: '是否回收料',
  1060. prop: 'isReworkBom',
  1061. slot: 'isReworkBom',
  1062. action: 'isReworkBom'
  1063. },
  1064. {
  1065. label: '编码',
  1066. prop: 'categoryCode'
  1067. },
  1068. {
  1069. label: '牌号',
  1070. prop: 'brandNum'
  1071. },
  1072. {
  1073. label: '型号',
  1074. prop: 'modelType'
  1075. },
  1076. {
  1077. label: '数量',
  1078. slot: 'count',
  1079. action: 'count'
  1080. },
  1081. {
  1082. label: '单位',
  1083. slot: 'unit',
  1084. action: 'unit'
  1085. },
  1086. {
  1087. label: '附件',
  1088. slot: 'bomArtFiles',
  1089. action: 'bomArtFiles',
  1090. minWidth: 150
  1091. },
  1092. {
  1093. label: '备注',
  1094. slot: 'remark',
  1095. action: 'remark'
  1096. }
  1097. ],
  1098. columns: [],
  1099. // 表格列配置
  1100. defaultColumns: [
  1101. {
  1102. prop: 'sort',
  1103. slot: 'sort',
  1104. label: '排序',
  1105. minWidth: 60
  1106. },
  1107. {
  1108. prop: 'code',
  1109. label: '参数编码',
  1110. showOverflowTooltip: true,
  1111. align: 'center',
  1112. minWidth: 110
  1113. },
  1114. {
  1115. prop: 'name',
  1116. label: '参数名称',
  1117. showOverflowTooltip: true,
  1118. align: 'center',
  1119. minWidth: 110
  1120. },
  1121. {
  1122. align: 'center',
  1123. prop: 'description',
  1124. label: '文本描述',
  1125. showOverflowTooltip: true,
  1126. minWidth: 110
  1127. },
  1128. {
  1129. prop: 'maxValue',
  1130. slot: 'maxValue',
  1131. label: '参数上限',
  1132. align: 'center'
  1133. },
  1134. {
  1135. prop: 'minValue',
  1136. slot: 'minValue',
  1137. label: '参数下限',
  1138. align: 'center'
  1139. },
  1140. {
  1141. prop: 'defaultValue',
  1142. slot: 'defaultValue',
  1143. label: '默认值',
  1144. align: 'center'
  1145. }
  1146. ],
  1147. levelOptions: [
  1148. {
  1149. label: '初级',
  1150. value: '1'
  1151. },
  1152. {
  1153. label: '中级',
  1154. value: '2'
  1155. },
  1156. {
  1157. label: '高级',
  1158. value: '3'
  1159. }
  1160. ],
  1161. // 表格列配置
  1162. jobColumns: [
  1163. {
  1164. label: '序号',
  1165. type: 'index',
  1166. width: 55,
  1167. align: 'center'
  1168. },
  1169. {
  1170. slot: 'type',
  1171. label: '类型',
  1172. showOverflowTooltip: true,
  1173. align: 'center',
  1174. minWidth: 110,
  1175. formatter: (_row) => {
  1176. return this.getDictValue('工种类型', _row.type);
  1177. }
  1178. },
  1179. {
  1180. align: 'center',
  1181. prop: 'code',
  1182. label: '编码',
  1183. showOverflowTooltip: true,
  1184. minWidth: 110
  1185. },
  1186. {
  1187. slot: 'name',
  1188. prop: 'name',
  1189. label: '名称',
  1190. showOverflowTooltip: true,
  1191. align: 'center',
  1192. minWidth: 110
  1193. },
  1194. {
  1195. slot: 'level',
  1196. prop: 'level',
  1197. label: '等级',
  1198. showOverflowTooltip: true,
  1199. align: 'center',
  1200. minWidth: 110,
  1201. formatter: (_row) => {
  1202. return this.levelOptions.filter(
  1203. (item) => _row.level == item.value
  1204. )[0].label;
  1205. }
  1206. },
  1207. {
  1208. slot: 'hourCost',
  1209. prop: 'hourCost',
  1210. label: '标准工时费',
  1211. showOverflowTooltip: true,
  1212. align: 'center',
  1213. minWidth: 110
  1214. },
  1215. {
  1216. columnKey: 'action',
  1217. label: '操作',
  1218. width: 260,
  1219. align: 'center',
  1220. resizable: false,
  1221. slot: 'action',
  1222. showOverflowTooltip: true
  1223. }
  1224. ],
  1225. // 表格选中数据
  1226. jobColumns1: [
  1227. {
  1228. label: '序号',
  1229. type: 'index',
  1230. width: 55,
  1231. align: 'center'
  1232. },
  1233. {
  1234. slot: 'type',
  1235. prop: 'type',
  1236. label: '类型',
  1237. showOverflowTooltip: true,
  1238. align: 'center',
  1239. minWidth: 110
  1240. },
  1241. {
  1242. slot: 'code',
  1243. prop: 'code',
  1244. label: '编码',
  1245. showOverflowTooltip: true,
  1246. align: 'center',
  1247. minWidth: 110
  1248. },
  1249. {
  1250. slot: 'name',
  1251. prop: 'name',
  1252. label: '名称',
  1253. showOverflowTooltip: true,
  1254. align: 'center',
  1255. minWidth: 110
  1256. },
  1257. {
  1258. slot: 'path',
  1259. prop: 'path',
  1260. label: '附件',
  1261. showOverflowTooltip: true,
  1262. align: 'center',
  1263. minWidth: 200
  1264. },
  1265. {
  1266. slot: 'versions',
  1267. prop: 'versions',
  1268. label: '版本',
  1269. showOverflowTooltip: true,
  1270. align: 'center',
  1271. minWidth: 110
  1272. },
  1273. {
  1274. slot: 'status',
  1275. prop: 'status',
  1276. label: '状态',
  1277. showOverflowTooltip: true,
  1278. align: 'center',
  1279. minWidth: 110
  1280. },
  1281. {
  1282. prop: 'createName',
  1283. label: '创建人',
  1284. showOverflowTooltip: true,
  1285. align: 'center',
  1286. minWidth: 110
  1287. },
  1288. {
  1289. prop: 'createTime',
  1290. label: '创建时间',
  1291. showOverflowTooltip: true,
  1292. align: 'center',
  1293. minWidth: 110
  1294. },
  1295. {
  1296. columnKey: 'action',
  1297. label: '操作',
  1298. width: 260,
  1299. align: 'center',
  1300. resizable: false,
  1301. slot: 'action',
  1302. showOverflowTooltip: true
  1303. }
  1304. ],
  1305. standardCol: [
  1306. {
  1307. prop: 'code',
  1308. label: '编码'
  1309. },
  1310. {
  1311. prop: 'name',
  1312. label: '名称',
  1313. showOverflowTooltip: true
  1314. },
  1315. {
  1316. prop: 'brandNum',
  1317. label: '牌号'
  1318. },
  1319. {
  1320. prop: 'modelType',
  1321. label: '型号',
  1322. align: 'center',
  1323. showOverflowTooltip: true
  1324. },
  1325. {
  1326. prop: 'specification',
  1327. label: '规格',
  1328. align: 'center',
  1329. showOverflowTooltip: true
  1330. },
  1331. {
  1332. prop: 'measuringUnit',
  1333. label: '计量单位',
  1334. showOverflowTooltip: true,
  1335. minWidth: 90
  1336. },
  1337. {
  1338. columnKey: 'action',
  1339. label: '操作',
  1340. align: 'center',
  1341. resizable: false,
  1342. slot: 'action',
  1343. showOverflowTooltip: true
  1344. }
  1345. ],
  1346. rowData: {},
  1347. treeData: {},
  1348. currentIndex: 0,
  1349. tableData: {},
  1350. beatParam: {},
  1351. normalHours: {}
  1352. };
  1353. },
  1354. created() {
  1355. this.requestDict('工种类型');
  1356. },
  1357. methods: {
  1358. addFile() {
  1359. let userInfo = JSON.parse(localStorage.getItem('info'));
  1360. this.tableData.taskParam[this.currentIndex]['fileParam'].push({
  1361. code: '',
  1362. type: '',
  1363. name: '',
  1364. versions: '',
  1365. name: '',
  1366. status: 1,
  1367. createName: userInfo.name,
  1368. createTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
  1369. });
  1370. this.$refs.fileTable.setData(
  1371. this.tableData.taskParam[this.currentIndex]['fileParam']
  1372. );
  1373. },
  1374. addJob() {
  1375. this.$refs.jobRef.open();
  1376. },
  1377. chooseJob(data) {
  1378. this.$refs.jobTable.setData([
  1379. ...data,
  1380. ...this.$refs.jobTable.getData()
  1381. ]);
  1382. this.$set(
  1383. this.tableData.taskParam[this.currentIndex],
  1384. 'aptitudeParam',
  1385. this.$refs.jobTable.getData()
  1386. );
  1387. },
  1388. determineChoose(title, row, idx) {
  1389. let type = '';
  1390. if (this.activeName === '材料定额') {
  1391. type = 'materialQuota';
  1392. } else if (this.activeName === '制造资源') {
  1393. type = 'resource';
  1394. } else if (this.activeName === '替代料') {
  1395. type = 'replaceMaterial';
  1396. }
  1397. if (title == '选择物料') {
  1398. this.$set(
  1399. this.tableData.taskParam[this.currentIndex][type][idx],
  1400. 'categoryName',
  1401. row.name
  1402. );
  1403. this.$set(
  1404. this.tableData.taskParam[this.currentIndex][type][idx],
  1405. 'categoryId',
  1406. row.id
  1407. );
  1408. this.$set(
  1409. this.tableData.taskParam[this.currentIndex][type][idx],
  1410. 'categoryCode',
  1411. row.code
  1412. );
  1413. this.$set(
  1414. this.tableData.taskParam[this.currentIndex][type][idx],
  1415. 'unit',
  1416. row.measuringUnit
  1417. );
  1418. this.$set(
  1419. this.tableData.taskParam[this.currentIndex][type][idx],
  1420. 'weightUnit',
  1421. row.weightUnit
  1422. );
  1423. this.$set(
  1424. this.tableData.taskParam[this.currentIndex][type][idx],
  1425. 'brandNum',
  1426. row.brandNum
  1427. );
  1428. this.$set(
  1429. this.tableData.taskParam[this.currentIndex][type][idx],
  1430. 'modelType',
  1431. row.modelType
  1432. );
  1433. }
  1434. },
  1435. uploadedSuccess(data, row) {
  1436. row.bomArtFiles = data[0].storePath;
  1437. this.filedList = [];
  1438. },
  1439. uploadedJobSuccess(data, row) {
  1440. row.path = data[0].storePath;
  1441. row.name = data[0].name;
  1442. this.jobFiledList = [];
  1443. },
  1444. downloadFile(url) {
  1445. getFile({ objectName: url }, '附件');
  1446. },
  1447. categorySelect(row, idx) {
  1448. this.$refs.productRefs.open(row, '选择物料', '1', idx);
  1449. },
  1450. handleDel(row, index) {
  1451. let type = '';
  1452. if (this.activeName === '材料定额') {
  1453. type = 'materialQuota';
  1454. } else if (this.activeName === '制造资源') {
  1455. type = 'resource';
  1456. } else if (this.activeName === '替代料') {
  1457. type = 'replaceMaterial';
  1458. } else if (this.activeName === '工种') {
  1459. type = 'aptitudeParam';
  1460. } else if (this.activeName === '工艺文件') {
  1461. type = 'fileParam';
  1462. } else if (this.activeName === '标准产出') {
  1463. type = 'standardOutput';
  1464. } else if (this.activeName === '关键设备') {
  1465. type = 'standardDevice';
  1466. }
  1467. this.tableData.taskParam[this.currentIndex][type].splice(index, 1);
  1468. },
  1469. addProductList(list) {
  1470. console.log(list);
  1471. let subCode = 0;
  1472. let array = [];
  1473. list.map((item, index) => {
  1474. // let max = '';
  1475. // if (
  1476. // this.tableData.taskParam[this.currentIndex]['materialQuota']
  1477. // .length > 0
  1478. // ) {
  1479. // max = Number(
  1480. // Math.max(
  1481. // ...this.tableData.taskParam[this.currentIndex][
  1482. // 'materialQuota'
  1483. // ].map((i) => i.subCode)
  1484. // )
  1485. // );
  1486. // subCode = max + index + 1;
  1487. // } else {
  1488. // max = 1;
  1489. // subCode = max + index;
  1490. // }
  1491. let max = '';
  1492. if (
  1493. this.tableData.taskParam[this.currentIndex]['materialQuota']
  1494. .length > 0
  1495. ) {
  1496. max =
  1497. Math.max(
  1498. ...this.tableData.taskParam[this.currentIndex][
  1499. 'materialQuota'
  1500. ].map((i) => i.subCode)
  1501. ) +
  1502. 10 * ++index +
  1503. '';
  1504. console.log(max);
  1505. if (max.length < 4) {
  1506. max = new Array(4 - max.length).fill('0').join('') + max;
  1507. }
  1508. } else {
  1509. max = 10 * ++index + '';
  1510. if (max.length < 4) {
  1511. max = new Array(4 - max.length).fill('0').join('') + max;
  1512. }
  1513. }
  1514. subCode = max.substring(0, max.length - 1) + '0';
  1515. array.push({
  1516. subCode,
  1517. categoryId: item.categoryId,
  1518. categoryName: item.name,
  1519. categoryCode: item.categoryCode,
  1520. isReworkBom: 0,
  1521. brandNum: item.brandNum,
  1522. weightUnit: item.weightUnit,
  1523. count: '',
  1524. modelType: item.modelType,
  1525. unit: item.measuringUnit
  1526. });
  1527. });
  1528. console.log(array);
  1529. this.tableData.taskParam[this.currentIndex].materialQuota =
  1530. this.tableData.taskParam[this.currentIndex].materialQuota.concat(
  1531. array
  1532. );
  1533. console.log(this.tableData.taskParam[this.currentIndex].materialQuota);
  1534. this.$refs.materialTable.setData(
  1535. this.tableData.taskParam[this.currentIndex].materialQuota
  1536. );
  1537. },
  1538. add() {
  1539. let subCode = '0010';
  1540. let type = '';
  1541. if (this.activeName === '材料定额') {
  1542. this.$refs.productMultipleRefs.open(1);
  1543. return;
  1544. } else if (this.activeName === '标准产出') {
  1545. this.$refs.standardOutputRefs.open(9);
  1546. return;
  1547. } else if (this.activeName === '关键设备') {
  1548. this.$refs.standardOutputRefs.open(4);
  1549. return;
  1550. } else if (this.activeName === '制造资源') {
  1551. type = 'resource';
  1552. } else if (this.activeName === '替代料') {
  1553. type = 'replaceMaterial';
  1554. }
  1555. console.log(this.tableData.taskParam[this.currentIndex]);
  1556. if (this.tableData.taskParam[this.currentIndex][type].length) {
  1557. let max =
  1558. Math.max(
  1559. ...this.tableData.taskParam[this.currentIndex][type].map(
  1560. (i) => i.subCode
  1561. )
  1562. ) +
  1563. 10 +
  1564. '';
  1565. if (max.length < 4) {
  1566. max = new Array(4 - max.length).fill('0').join('') + max;
  1567. }
  1568. subCode = max.substring(0, max.length - 1) + '0';
  1569. }
  1570. this.tableData.taskParam[this.currentIndex][type].push({
  1571. subCode,
  1572. categoryId: '',
  1573. categoryName: '',
  1574. isReworkBom: 0,
  1575. brandNum: '',
  1576. count: '',
  1577. modelType: '',
  1578. unit: ''
  1579. });
  1580. },
  1581. /* 表格数据源 */
  1582. async datasource() {
  1583. return [];
  1584. },
  1585. tabsChange() {
  1586. console.log(this.activeName);
  1587. console.log(this.tableData.taskParam[this.currentIndex]);
  1588. if (this.activeName === '工艺参数') {
  1589. // 工艺参数
  1590. this.$refs.table.setData(
  1591. this.tableData.taskParam[this.currentIndex].produceList || []
  1592. );
  1593. } else if (this.activeName === '质检参数') {
  1594. // 质检参数
  1595. this.$refs.qualityTable.setData(
  1596. this.tableData.taskParam[this.currentIndex].qualityParam || []
  1597. );
  1598. } else if (this.activeName === '生产节拍') {
  1599. console.log(this.tableData.taskParam[this.currentIndex].beatParam);
  1600. this.beatParam =
  1601. this.tableData.taskParam[this.currentIndex].beatParam || {};
  1602. } else if (this.activeName === '标准工时') {
  1603. this.normalHours =
  1604. this.tableData.taskParam[this.currentIndex].normalHours || {};
  1605. } else if (this.activeName === '材料定额') {
  1606. this.$refs.materialTable.setData(
  1607. this.tableData.taskParam[this.currentIndex].materialQuota || []
  1608. );
  1609. } else if (this.activeName === '制造资源') {
  1610. this.$refs.resourceTable.setData(
  1611. this.tableData.taskParam[this.currentIndex].resource || []
  1612. );
  1613. } else if (this.activeName === '替代料') {
  1614. this.$refs.replaceMaterialTable.setData(
  1615. this.tableData.taskParam[this.currentIndex].replaceMaterial || []
  1616. );
  1617. } else if (this.activeName === '工种') {
  1618. if (
  1619. JSON.stringify(
  1620. this.tableData.taskParam[this.currentIndex].aptitudeParam
  1621. ) == '{}'
  1622. ) {
  1623. this.tableData.taskParam[this.currentIndex].aptitudeParam = [];
  1624. this.$refs.jobTable.setData([]);
  1625. } else {
  1626. this.$refs.jobTable.setData(
  1627. this.tableData.taskParam[this.currentIndex].aptitudeParam
  1628. );
  1629. }
  1630. } else if (this.activeName === '工艺文件') {
  1631. if (
  1632. JSON.stringify(
  1633. this.tableData.taskParam[this.currentIndex].fileParam
  1634. ) == '{}'
  1635. ) {
  1636. this.tableData.taskParam[this.currentIndex].fileParam = [];
  1637. this.$refs.fileTable.setData([]);
  1638. } else {
  1639. this.$refs.fileTable.setData(
  1640. this.tableData.taskParam[this.currentIndex].fileParam
  1641. );
  1642. }
  1643. } else if (this.activeName === '标准产出') {
  1644. this.$refs.standard.setData(
  1645. this.tableData.taskParam[this.currentIndex].standardOutput || []
  1646. );
  1647. } else if (this.activeName === '关键设备') {
  1648. this.$refs.deviceTabRef.setData(
  1649. this.tableData.taskParam[this.currentIndex].standardDevice || []
  1650. );
  1651. }
  1652. },
  1653. openParam(type) {
  1654. let tableData = [];
  1655. if (type === '工艺') {
  1656. tableData = this.$refs.table.getData();
  1657. } else {
  1658. tableData = this.$refs.qualityTable.getData();
  1659. }
  1660. this.$refs.paramRefs.open(tableData);
  1661. },
  1662. chooseModal(data) {
  1663. let dom = null;
  1664. if (this.activeName === '工艺参数') {
  1665. dom = this.$refs.table;
  1666. } else if (this.activeName === '质检参数') {
  1667. dom = this.$refs.qualityTable;
  1668. }
  1669. dom.setData([...data, ...dom.getData()]);
  1670. this.$set(
  1671. this.tableData.taskParam[this.currentIndex],
  1672. this.activeName === '工艺参数' ? 'produceList' : 'qualityParam',
  1673. dom.getData()
  1674. );
  1675. },
  1676. chooseStandardList(type, data) {
  1677. let dom = null;
  1678. if (type == 9) {
  1679. dom = this.$refs.standard;
  1680. dom.setData([data[0]]);
  1681. this.$set(
  1682. this.tableData.taskParam[this.currentIndex],
  1683. 'standardOutput',
  1684. dom.getData()
  1685. );
  1686. } else if (type == 4) {
  1687. dom = this.$refs.deviceTabRef;
  1688. dom.setData([data[0]]);
  1689. this.$set(
  1690. this.tableData.taskParam[this.currentIndex],
  1691. 'standardDevice',
  1692. dom.getData()
  1693. );
  1694. }
  1695. },
  1696. remove(row, type) {
  1697. let dom = null;
  1698. if (type === '工艺') {
  1699. dom = this.$refs.table;
  1700. } else {
  1701. dom = this.$refs.qualityTable;
  1702. }
  1703. const data = dom.getData();
  1704. if (row.id) {
  1705. dom.setData(data.filter((d) => d.id !== row.id));
  1706. } else {
  1707. dom.setData(data.filter((d) => d.paramId !== row.paramId));
  1708. }
  1709. this.$set(
  1710. this.tableData.taskParam[this.currentIndex],
  1711. type === '工艺' ? 'produceList' : 'qualityParam',
  1712. dom.getData()
  1713. );
  1714. },
  1715. open(rowData, treeData, tableData, isView) {
  1716. this.columns = [];
  1717. this.columns1 = [];
  1718. this.isView = isView;
  1719. if (!this.isView) {
  1720. this.columns = this.defaultColumns.concat({
  1721. columnKey: 'action',
  1722. label: '操作',
  1723. align: 'center',
  1724. resizable: false,
  1725. slot: 'action',
  1726. showOverflowTooltip: true
  1727. });
  1728. this.columns1 = this.defaultColumns1.concat({
  1729. action: 'action',
  1730. slot: 'action',
  1731. label: '操作'
  1732. });
  1733. } else {
  1734. this.columns = this.defaultColumns;
  1735. this.columns1 = this.defaultColumns1;
  1736. }
  1737. this.rowData = JSON.parse(JSON.stringify(rowData));
  1738. this.treeData = JSON.parse(JSON.stringify(treeData));
  1739. this.tableData = JSON.parse(JSON.stringify(tableData));
  1740. this.currentIndex = tableData.taskParam.findIndex(
  1741. (item) => item.id === rowData.id
  1742. );
  1743. this.activeName = '工艺参数';
  1744. this.visible = true;
  1745. setTimeout(() => {
  1746. console.log(this.$refs);
  1747. // 工艺参数
  1748. this.$refs.table.setData(
  1749. this.tableData.taskParam[this.currentIndex].produceList
  1750. );
  1751. }, 500);
  1752. },
  1753. handleClose() {
  1754. this.visible = false;
  1755. this.$refs.table.setSelectedRows([]);
  1756. this.selection = [];
  1757. },
  1758. save() {
  1759. if (this.isView) {
  1760. this.handleClose();
  1761. } else {
  1762. // 保存生产节拍
  1763. let userInfo = JSON.parse(localStorage.getItem('info'));
  1764. this.beatParam.createName = userInfo.name;
  1765. this.beatParam.createTime = dayjs(new Date()).format(
  1766. 'YYYY-MM-DD HH:mm:ss'
  1767. );
  1768. this.beatParam.updateName = userInfo.name;
  1769. this.beatParam.updateTime = dayjs(new Date()).format(
  1770. 'YYYY-MM-DD HH:mm:ss'
  1771. );
  1772. this.tableData.taskParam[this.currentIndex].beatParam =
  1773. this.beatParam;
  1774. // 保存标准工时
  1775. this.tableData.taskParam[this.currentIndex].normalHours =
  1776. this.normalHours;
  1777. // 保存材料定额
  1778. this.tableData.taskParam[this.currentIndex].baseCount =
  1779. this.baseCount;
  1780. this.tableData.taskParam[this.currentIndex].baseCountUnit =
  1781. this.baseCountUnit;
  1782. workingProcedureUpdate({
  1783. id: this.tableData.id,
  1784. categoryId: this.treeData.categoryId,
  1785. bomCategoryId: this.treeData.id,
  1786. categoryCode: this.treeData.categoryCode,
  1787. taskParam: this.tableData.taskParam
  1788. }).then(() => {
  1789. this.$message.success('保存成功');
  1790. this.$emit('chooseProcess');
  1791. this.handleClose();
  1792. });
  1793. }
  1794. }
  1795. }
  1796. };
  1797. </script>
  1798. <style lang="scss" scoped>
  1799. .btns {
  1800. text-align: center;
  1801. padding: 10px 0;
  1802. }
  1803. .downLoad {
  1804. display: flex;
  1805. }
  1806. .toolbar_box {
  1807. float: right;
  1808. margin-right: 10px;
  1809. > div {
  1810. display: flex;
  1811. align-items: center;
  1812. justify-content: center;
  1813. > span {
  1814. width: 150px;
  1815. }
  1816. > div {
  1817. margin-left: 10px;
  1818. }
  1819. }
  1820. }
  1821. </style>