processAndProduct.vue 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372
  1. <template>
  2. <!-- 实绩工序与产品关联 -->
  3. <div class="planProcessAndProduct">
  4. <div class="box">
  5. <div
  6. class="box-left"
  7. :style="listTopicTree.show ? null : { width: '22px' }"
  8. >
  9. <div
  10. class="box-left-bt"
  11. style="overflow: hidden;"
  12. >
  13. <span v-show="listTopicTree.show">工序结构</span>
  14. <div style="float: right;height: 100%;padding-right: 4px;">
  15. <span
  16. class="el-icon-d-arrow-right"
  17. style="cursor: pointer; transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out;"
  18. :style="listTopicTree.show ? { transform: 'rotate(180deg)'} : { transform: 'rotate(0deg)'} "
  19. @click="listTopicTree.show = !listTopicTree.show;"
  20. ></span>
  21. </div>
  22. </div>
  23. <div class="box-left-tree">
  24. <el-tree
  25. v-show="listTopicTree.show"
  26. :data="listTopicTree.data"
  27. :props="listTopicTree.defaultProps"
  28. v-loading="listTopicTree.loading"
  29. >
  30. <span
  31. class="custom-tree-node"
  32. :class="{'tree-row-on': filterForm.data.workprocid === data.id}"
  33. style="width:100%; font-size:12px;"
  34. slot-scope="{ node, data }"
  35. >
  36. <p
  37. style="overflow:hidden; text-overflow:ellipsis; white-space:nowrap;"
  38. :title="node.label"
  39. @click="selectByTopicId(data)"
  40. >{{ node.label }}</p>
  41. </span>
  42. </el-tree>
  43. </div>
  44. </div>
  45. <div
  46. class="box-right"
  47. :style="listTopicTree.show ? null : { 'margin-left': '22px' }"
  48. >
  49. <div class="box-top">
  50. <el-form
  51. style="overflow: hidden;"
  52. :style="filterForm.show ? null : { height: '0px' }"
  53. class="box-top-form"
  54. size="mini"
  55. label-width="60px"
  56. >
  57. <el-row>
  58. <el-col :span="8">
  59. <el-form-item label="产品">
  60. <el-select
  61. filterable
  62. clearable
  63. v-model="filterForm.data.productid"
  64. placeholder="产品"
  65. style="width: 100%;"
  66. >
  67. <el-option
  68. v-for="item of nameObj.productid.arr"
  69. :key="item.id"
  70. :value="item.id"
  71. :label="item.name"
  72. ></el-option>
  73. </el-select>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="8">
  77. <el-form-item label="工序">
  78. <el-select
  79. filterable
  80. clearable
  81. v-model="filterForm.data.workprocid"
  82. placeholder="工序"
  83. style="width: 100%;"
  84. >
  85. <el-option
  86. v-for="item of nameObj.workprocid.arr"
  87. :key="item.id"
  88. :value="item.id"
  89. :label="item.name"
  90. ></el-option>
  91. </el-select>
  92. </el-form-item>
  93. </el-col>
  94. <el-col :span="8">
  95. <el-form-item label="主产品">
  96. <el-select
  97. filterable
  98. clearable
  99. v-model="filterForm.data.isprimary"
  100. placeholder="主产品"
  101. style="width: 100%;"
  102. >
  103. <el-option
  104. value="0"
  105. label="否"
  106. ></el-option>
  107. <el-option
  108. value="1"
  109. label="是"
  110. ></el-option>
  111. </el-select>
  112. </el-form-item>
  113. </el-col>
  114. </el-row>
  115. <el-row>
  116. <el-col :span="8">
  117. <el-form-item label="公式版本">
  118. <el-date-picker
  119. type="month"
  120. v-model="filterForm.data.version"
  121. placeholder="公式版本"
  122. style="width: 100%;"
  123. format="yyyyMM"
  124. value-format="yyyyMM00"
  125. ></el-date-picker>
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="8">
  129. <el-form-item label="关联ID">
  130. <el-input
  131. clearable
  132. v-model="filterForm.data.aid"
  133. placeholder="关联ID"
  134. style="width: 100%;"
  135. ></el-input>
  136. </el-form-item>
  137. </el-col>
  138. <el-col :span="8">
  139. <el-form-item label="NC编码">
  140. <el-input clearable
  141. v-model="filterForm.data.materialCode"
  142. placeholder="NC物料编码"
  143. style="width: 100%;"
  144. ></el-input>
  145. </el-form-item>
  146. </el-col>
  147. </el-row>
  148. </el-form>
  149. <div class="box-top-gjl">
  150. <el-button
  151. class="button"
  152. type="primary"
  153. size="mini"
  154. icon="el-icon-plus"
  155. v-privilege="activeMenu + 'ADD'"
  156. @click="but_add"
  157. >新增</el-button>
  158. <el-button
  159. class="button"
  160. type="primary"
  161. size="mini"
  162. icon="el-icon-edit-outline"
  163. v-privilege="activeMenu + 'PUT'"
  164. @click="but_edit_plural()"
  165. :loading="loading"
  166. >修改</el-button>
  167. <el-button
  168. class="button"
  169. type="danger"
  170. size="mini"
  171. icon="el-icon-delete"
  172. v-privilege="activeMenu + 'DELETE'"
  173. @click="but_del_plural()"
  174. :loading="loading"
  175. >删除</el-button>
  176. <div style="float:right; text-align: right;">
  177. <el-button
  178. class="button"
  179. type="primary"
  180. size="mini"
  181. icon="el-icon-search"
  182. v-privilege="activeMenu + 'QUERY'"
  183. @click="getTableData(1)"
  184. >查询</el-button>
  185. <el-button
  186. class="button"
  187. type="primary"
  188. size="mini"
  189. icon="el-icon-refresh"
  190. v-privilege="activeMenu + 'QUERY'"
  191. @click="tableDataCancel();"
  192. >重置</el-button>
  193. <el-button
  194. size="mini"
  195. :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
  196. :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
  197. @click="filterForm.show = !filterForm.show;
  198. $nextTick(() => {
  199. singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
  200. }
  201. );"
  202. >{{ filterForm.show ? '收起' : '展开' }}</el-button>
  203. </div>
  204. </div>
  205. </div>
  206. <div class="box-bottom">
  207. <el-form
  208. size="mini"
  209. ref="dialog_form_arr"
  210. label-width="0px"
  211. :model="tableFormDataObj"
  212. >
  213. <el-table
  214. stripe
  215. id="singleTable"
  216. ref="singleTable"
  217. :data="tableData"
  218. v-loading="tableLoading"
  219. style="width: 100%;"
  220. :height="singleTableHeight"
  221. border
  222. size="mini"
  223. highlight-current-row
  224. @selection-change="handleSelectionChange"
  225. >
  226. <el-table-column
  227. type="selection"
  228. width="40"
  229. align="center"
  230. fixed="left"
  231. ></el-table-column>
  232. <el-table-column
  233. sortable
  234. prop="itemid"
  235. label="关联ID"
  236. min-width="100px"
  237. :show-overflow-tooltip="true"
  238. ></el-table-column>
  239. <el-table-column
  240. sortable
  241. prop="productid"
  242. label="产品"
  243. min-width="100px"
  244. :show-overflow-tooltip="true"
  245. >
  246. <template slot-scope="scope">
  247. <span>{{ nameObj.productid.obj[scope.row.productid] ? nameObj.productid.obj[scope.row.productid] : scope.row.productid }}</span>
  248. </template>
  249. </el-table-column>
  250. <el-table-column
  251. sortable
  252. prop="workprocid"
  253. label="工序"
  254. min-width="100px"
  255. :show-overflow-tooltip="true"
  256. >
  257. <template slot-scope="scope">
  258. <span>{{ nameObj.workprocid.obj[scope.row.workprocid] ? nameObj.workprocid.obj[scope.row.workprocid] : scope.row.workprocid }}</span>
  259. </template>
  260. </el-table-column>
  261. <el-table-column
  262. sortable
  263. prop="isprimary"
  264. label="主产品"
  265. min-width="100px"
  266. :show-overflow-tooltip="true"
  267. > <template slot-scope="scope">
  268. <el-form-item
  269. v-if="scope.row.isSelection"
  270. :prop="scope.row.itemid + '.isprimary'"
  271. :rules="dialog.editorBox.form.rules.isprimary"
  272. >
  273. <el-select
  274. filterable
  275. clearable
  276. style="width: 100%;"
  277. v-model="tableFormDataObj[scope.row.itemid].isprimary"
  278. >
  279. <el-option
  280. label="是"
  281. value="1"
  282. ></el-option>
  283. <el-option
  284. label="否"
  285. value="0"
  286. ></el-option>
  287. </el-select>
  288. <template
  289. slot="error"
  290. slot-scope="scope"
  291. >
  292. <p
  293. class="error"
  294. :title="scope.error"
  295. >{{ scope.error }}</p>
  296. </template>
  297. </el-form-item>
  298. <span
  299. v-else
  300. :class="{color_yes: scope.row.isprimary === '1', color_no: scope.row.isprimary === '0'}"
  301. >{{ scope.row.isprimary === '0' ? '否' : scope.row.isprimary === '1' ? '是' : '' }}</span>
  302. </template>
  303. </el-table-column>
  304. <el-table-column
  305. sortable
  306. prop="unitid"
  307. label="单位"
  308. min-width="100px"
  309. :show-overflow-tooltip="true"
  310. > <template slot-scope="scope">
  311. <el-form-item
  312. v-if="scope.row.isSelection"
  313. :prop="scope.row.itemid + '.unitid'"
  314. :rules="dialog.editorBox.form.rules.unitid"
  315. >
  316. <el-select
  317. filterable
  318. clearable
  319. style="width: 100%;"
  320. v-model="tableFormDataObj[scope.row.itemid].unitid"
  321. >
  322. <el-option
  323. v-for="item of nameObj.unitid.arr"
  324. :key="item.id"
  325. :value="item.id"
  326. :label="item.name"
  327. ></el-option>
  328. </el-select>
  329. <template
  330. slot="error"
  331. slot-scope="scope"
  332. >
  333. <p
  334. class="error"
  335. :title="scope.error"
  336. >{{ scope.error }}</p>
  337. </template>
  338. </el-form-item>
  339. <span v-else>{{ nameObj.unitid.obj[scope.row.unitid] ? nameObj.unitid.obj[scope.row.unitid] : scope.row.unitid }}</span>
  340. </template>
  341. </el-table-column>
  342. <el-table-column
  343. sortable
  344. prop="seqno"
  345. label="顺序号"
  346. min-width="100px"
  347. :show-overflow-tooltip="true"
  348. > <template slot-scope="scope">
  349. <el-form-item
  350. v-if="scope.row.isSelection"
  351. :prop="scope.row.itemid + '.seqno'"
  352. :rules="dialog.editorBox.form.rules.seqno"
  353. >
  354. <el-input
  355. clearable
  356. style="width: 100%;"
  357. v-model.trim="tableFormDataObj[scope.row.itemid].seqno"
  358. ></el-input>
  359. <template
  360. slot="error"
  361. slot-scope="scope"
  362. >
  363. <p
  364. class="error"
  365. :title="scope.error"
  366. >{{ scope.error }}</p>
  367. </template>
  368. </el-form-item>
  369. <span v-else>{{scope.row.seqno}}</span>
  370. </template>
  371. </el-table-column>
  372. <el-table-column
  373. sortable
  374. prop="mes_materialcode"
  375. label="NC物料编码"
  376. min-width="100px"
  377. :show-overflow-tooltip="true"
  378. ></el-table-column>
  379. <el-table-column
  380. sortable
  381. prop="isFinanceData"
  382. label="财务物料"
  383. min-width="100px"
  384. :show-overflow-tooltip="true"
  385. >
  386. <template slot-scope="scope">
  387. <el-form-item
  388. v-if="scope.row.isSelection"
  389. :prop="scope.row.itemid + '.isFinanceData'"
  390. :rules="dialog.editorBox.form.rules.isFinanceData"
  391. >
  392. <el-select
  393. filterable
  394. clearable
  395. style="width: 100%;"
  396. v-model="tableFormDataObj[scope.row.itemid].isFinanceData"
  397. >
  398. <el-option
  399. label="是"
  400. value="1"
  401. ></el-option>
  402. <el-option
  403. label="否"
  404. value="0"
  405. ></el-option>
  406. </el-select>
  407. <template
  408. slot="error"
  409. slot-scope="scope"
  410. >
  411. <p
  412. class="error"
  413. :title="scope.error"
  414. >{{ scope.error }}</p>
  415. </template>
  416. </el-form-item>
  417. <span
  418. v-else
  419. :class="{color_yes: scope.row.isFinanceData === '1', color_no: scope.row.isFinanceData === '0'}"
  420. >{{ scope.row.isFinanceData === '0' ? '否' : scope.row.isFinanceData === '1' ? '是' : '' }}</span>
  421. </template>
  422. </el-table-column>
  423. <el-table-column
  424. sortable
  425. prop="mes_prodline"
  426. label="MES产线"
  427. min-width="100px"
  428. :show-overflow-tooltip="true"
  429. > <template slot-scope="scope">
  430. <el-form-item
  431. v-if="scope.row.isSelection"
  432. :prop="scope.row.itemid + '.mes_prodline'"
  433. :rules="dialog.editorBox.form.rules.mes_prodline"
  434. >
  435. <el-input
  436. clearable
  437. style="width: 100%;"
  438. v-model.trim="tableFormDataObj[scope.row.itemid].mes_prodline"
  439. ></el-input>
  440. </el-form-item>
  441. <span v-else>{{scope.row.mes_prodline}}</span>
  442. </template>
  443. </el-table-column>
  444. <el-table-column
  445. sortable
  446. prop="digits"
  447. label="精度"
  448. min-width="100px"
  449. :show-overflow-tooltip="true"
  450. > <template slot-scope="scope">
  451. <el-form-item
  452. v-if="scope.row.isSelection"
  453. :prop="scope.row.itemid + '.digits'"
  454. :rules="dialog.editorBox.form.rules.digits"
  455. >
  456. <el-input
  457. clearable
  458. style="width: 100%;"
  459. v-model.trim="tableFormDataObj[scope.row.itemid].digits"
  460. ></el-input>
  461. </el-form-item>
  462. <span v-else>{{scope.row.digits}}</span>
  463. </template>
  464. </el-table-column>
  465. <el-table-column
  466. sortable
  467. prop="code"
  468. label="使用公式编辑"
  469. min-width="100px"
  470. :show-overflow-tooltip="true"
  471. > <template slot-scope="scope">
  472. <el-form-item
  473. v-if="scope.row.isSelection"
  474. :prop="scope.row.itemid + '.code'"
  475. :rules="dialog.editorBox.form.rules.code"
  476. >
  477. <el-select
  478. filterable
  479. clearable
  480. style="width: 100%;"
  481. v-model="tableFormDataObj[scope.row.itemid].code"
  482. >
  483. <el-option
  484. label="是"
  485. value="1"
  486. ></el-option>
  487. <el-option
  488. label="否"
  489. value="0"
  490. ></el-option>
  491. </el-select>
  492. <template
  493. slot="error"
  494. slot-scope="scope"
  495. >
  496. <p
  497. class="error"
  498. :title="scope.error"
  499. >{{ scope.error }}</p>
  500. </template>
  501. </el-form-item>
  502. <span
  503. v-else
  504. :class="{color_yes: scope.row.code === '1', color_no: scope.row.code === '0'}"
  505. >{{ scope.row.code === '0' ? '否' : scope.row.code === '1' ? '是' : '' }}</span>
  506. </template>
  507. </el-table-column>
  508. <el-table-column
  509. sortable
  510. prop="createman"
  511. label="创建人"
  512. width="60px"
  513. :show-overflow-tooltip="true"
  514. ></el-table-column>
  515. <el-table-column
  516. sortable
  517. prop="createtime"
  518. label="创建时间"
  519. width="125px"
  520. :show-overflow-tooltip="true"
  521. ></el-table-column>
  522. <el-table-column
  523. sortable
  524. prop="updateman"
  525. label="修改人"
  526. width="60px"
  527. :show-overflow-tooltip="true"
  528. ></el-table-column>
  529. <el-table-column
  530. sortable
  531. prop="updatetime"
  532. label="修改时间"
  533. width="125px"
  534. :show-overflow-tooltip="true"
  535. ></el-table-column>
  536. <el-table-column
  537. class-name="gn-TableDownloadExcel-none"
  538. label="操作"
  539. align="center"
  540. width="90px"
  541. fixed="right"
  542. >
  543. <template slot-scope="scope">
  544. <div>
  545. <el-button
  546. type="primary"
  547. size="mini"
  548. @click="but_equationEditing(scope.row)"
  549. :disabled="scope.row.code === '0'"
  550. >公式编辑</el-button>
  551. <!-- <el-button
  552. type="primary"
  553. size="mini"
  554. v-privilege="activeMenu + 'PUT'"
  555. @click="but_edit(scope.row)"
  556. >修改</el-button>
  557. <el-button
  558. type="danger"
  559. size="mini"
  560. v-privilege="activeMenu + 'DELETE'"
  561. @click="but_del(scope.row)"
  562. >删除</el-button> -->
  563. </div>
  564. </template>
  565. </el-table-column>
  566. </el-table>
  567. </el-form>
  568. <el-pagination
  569. layout="total, sizes, prev, pager, next, jumper"
  570. :total="total"
  571. :page-sizes="[10, 20, 50, 100, 500, 1000]"
  572. :page-size="pageSize"
  573. :current-page.sync="pageNum"
  574. @size-change="tableSizeChange"
  575. @current-change="getTableData()"
  576. style="text-align: right;margin-top: 10px;"
  577. ></el-pagination>
  578. </div>
  579. </div>
  580. </div>
  581. <el-dialog
  582. :title="'实绩工序与产品关联 - ' + (dialog.editorBox.type === 'add' ? '新增' : '修改')"
  583. :visible.sync="dialog.editorBox.show"
  584. width="600px"
  585. :close-on-click-modal="false"
  586. :show-close="!loading"
  587. >
  588. <div>
  589. <el-form
  590. ref="dialog_form"
  591. :model="dialog.editorBox.form.data"
  592. :rules="dialog.editorBox.form.rules"
  593. size="mini"
  594. label-width="95px"
  595. >
  596. <el-row>
  597. <el-col :span="12">
  598. <el-form-item
  599. label="产品"
  600. prop="productid"
  601. >
  602. <el-select
  603. filterable
  604. clearable
  605. style="width: 100%;"
  606. v-model="dialog.editorBox.form.data.productid"
  607. :disabled="dialog.editorBox.type !== 'add'"
  608. >
  609. <el-option
  610. v-for="item of nameObj.productid.arr"
  611. :key="item.id"
  612. :value="item.id"
  613. :label="item.name"
  614. ></el-option>
  615. </el-select>
  616. </el-form-item>
  617. </el-col>
  618. <el-col :span="12">
  619. <el-form-item
  620. label="工序"
  621. prop="workprocid"
  622. >
  623. <el-select
  624. filterable
  625. clearable
  626. style="width: 100%;"
  627. v-model="dialog.editorBox.form.data.workprocid"
  628. disabled
  629. >
  630. <el-option
  631. v-for="item of nameObj.workprocid.arr"
  632. :key="item.id"
  633. :value="item.id"
  634. :label="item.name"
  635. ></el-option>
  636. </el-select>
  637. </el-form-item>
  638. </el-col>
  639. </el-row>
  640. <el-row>
  641. <el-col :span="12">
  642. <el-form-item
  643. label="主产品"
  644. prop="isprimary"
  645. >
  646. <el-select
  647. filterable
  648. clearable
  649. style="width: 100%;"
  650. v-model="dialog.editorBox.form.data.isprimary"
  651. >
  652. <el-option
  653. value="0"
  654. label="否"
  655. ></el-option>
  656. <el-option
  657. value="1"
  658. label="是"
  659. ></el-option>
  660. </el-select>
  661. </el-form-item>
  662. </el-col>
  663. <el-col :span="12">
  664. <el-form-item
  665. label="单位"
  666. prop="unitid"
  667. >
  668. <el-select
  669. filterable
  670. clearable
  671. style="width: 100%;"
  672. v-model="dialog.editorBox.form.data.unitid"
  673. >
  674. <el-option
  675. v-for="item of nameObj.unitid.arr"
  676. :key="item.id"
  677. :value="item.id"
  678. :label="item.name"
  679. ></el-option>
  680. </el-select>
  681. </el-form-item>
  682. </el-col>
  683. </el-row>
  684. <el-row>
  685. <el-col :span="12">
  686. <el-form-item
  687. label="顺序号"
  688. prop="seqno"
  689. >
  690. <el-input
  691. clearable
  692. style="width: 100%;"
  693. v-model="dialog.editorBox.form.data.seqno"
  694. ></el-input>
  695. </el-form-item>
  696. </el-col>
  697. <el-col :span="12">
  698. <el-form-item
  699. label="使用公式编辑"
  700. prop="code"
  701. >
  702. <el-select
  703. filterable
  704. clearable
  705. style="width: 100%;"
  706. v-model="dialog.editorBox.form.data.code"
  707. >
  708. <el-option
  709. value="0"
  710. label="否"
  711. ></el-option>
  712. <el-option
  713. value="1"
  714. label="是"
  715. ></el-option>
  716. </el-select>
  717. </el-form-item>
  718. </el-col>
  719. </el-row>
  720. <el-row>
  721. <el-col :span="12">
  722. <el-form-item
  723. label="NC产线"
  724. prop="mes_prodline"
  725. >
  726. <el-input
  727. clearable
  728. style="width: 100%;"
  729. :maxlength="40"
  730. v-model="dialog.editorBox.form.data.mes_prodline"
  731. ></el-input>
  732. </el-form-item>
  733. </el-col>
  734. </el-row>
  735. <el-row>
  736. <el-col :span="12">
  737. <el-form-item
  738. label="精度"
  739. prop="digits"
  740. >
  741. <el-input
  742. clearable
  743. style="width: 100%;"
  744. :maxlength="40"
  745. v-model="dialog.editorBox.form.data.digits"
  746. ></el-input>
  747. </el-form-item>
  748. </el-col>
  749. </el-row>
  750. </el-form>
  751. </div>
  752. <span
  753. slot="footer"
  754. class="dialog-footer"
  755. >
  756. <el-button
  757. @click="dialog.editorBox.show = false"
  758. :loading="loading"
  759. >取 消</el-button>
  760. <el-button
  761. type="primary"
  762. @click="dataSave"
  763. :loading="loading"
  764. >保 存</el-button>
  765. </span>
  766. </el-dialog>
  767. <zj-formulaEditor :equationEditing="dialog.equationEditing"></zj-formulaEditor>
  768. </div>
  769. </template>
  770. <script>
  771. import formulaEditor from '@/components/zg/formulaEditor.vue';
  772. import { zCheckNumber1 } from '@/utils/validator.js';
  773. import { formatDate } from '@/utils/util.js';
  774. export default {
  775. name: 'planProcessAndProduct',
  776. components: {
  777. 'zj-formulaEditor': formulaEditor
  778. },
  779. data () {
  780. return {
  781. multipleSelection: [],
  782. tableFormDataObj: {},
  783. activeMenu: '',
  784. filterForm: {
  785. show: true,
  786. data: {
  787. productid: '',
  788. workprocid: '',
  789. isprimary: '',
  790. version: formatDate(new Date(), 'yyyyMM00'),
  791. aid: '',
  792. materialCode: ''
  793. },
  794. rules: {
  795. }
  796. },
  797. listTopicTree: {
  798. show: true,
  799. loading: false,
  800. data: [],
  801. defaultProps: {
  802. children: 'children',
  803. label: 'name'
  804. }
  805. },
  806. pageNum: 1,
  807. pageSize: 20,
  808. total: 0,
  809. singleTableHeight: 100,
  810. tableData: [
  811. // {
  812. // itemid: '010000C001R',
  813. // productid: '球团',
  814. // workprocid: '球团',
  815. // isprimary: '0',
  816. // unitid: '吨',
  817. // seqno: '1'
  818. // }
  819. ],
  820. nameObj: {
  821. productid: {
  822. obj: {},
  823. arr: []
  824. },
  825. workprocid: {
  826. obj: {},
  827. arr: []
  828. },
  829. unitid: {
  830. obj: {},
  831. arr: []
  832. }
  833. },
  834. loading: false,
  835. tableLoading: false,
  836. dialog: {
  837. editorBox: {
  838. show: false,
  839. type: '',
  840. form: {
  841. default: {
  842. workprocid: ''
  843. },
  844. data: {
  845. itemid: '',
  846. productid: '',
  847. workprocid: '',
  848. isprimary: '0',
  849. unitid: '',
  850. seqno: '',
  851. code: '',
  852. digits: ''
  853. },
  854. rules: {
  855. productid: [
  856. { required: true, message: '该项不能为空', trigger: 'change' }
  857. ],
  858. workprocid: [
  859. { required: true, message: '该项不能为空', trigger: 'change' }
  860. ],
  861. seqno: [
  862. { validator: zCheckNumber1, trigger: 'change' }
  863. ],
  864. mes_prodline: [
  865. ],
  866. digits: []
  867. }
  868. }
  869. },
  870. equationEditing: {
  871. show: false,
  872. form: {
  873. data: {
  874. clock: '',
  875. code: ''
  876. }
  877. }
  878. }
  879. }
  880. }
  881. },
  882. created () {
  883. this.activeMenu = window.localStorage.getItem('activeMenu');
  884. },
  885. mounted () {
  886. let that = this;
  887. window.PEDataObj = {
  888. // 将数据绑定到window上,供main页面使用
  889. vm: that,
  890. // tableArr:用于导出成Excel的表格的信息
  891. tableArr: [
  892. {
  893. name: '',
  894. id: 'singleTable'
  895. }
  896. ]
  897. };
  898. that.$nextTick(() => {
  899. // 立即获取的height有一定偏差,通过setTimeout延迟来解决
  900. setTimeout(() => {
  901. that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
  902. }, 1);
  903. });
  904. that.getNodeData();
  905. that.getNodeTreeData();
  906. that.getProductIdData();
  907. that.getUnitIdData();
  908. that.getTableData();
  909. },
  910. methods: {
  911. // 计算树区域高度
  912. getRoleHeight (dom) {
  913. return window.innerHeight - dom.offsetTop;
  914. },
  915. // 获取工序列表(产出)
  916. getNodeData () {
  917. let that = this
  918. let url = 'pass/ems/v1/trmworkprocs/getIdAndName?hasproduct=1';
  919. that.axios.get(url)
  920. .then(function (res) {
  921. if (res.code === '0') {
  922. let arr = [];
  923. let obj = {};
  924. for (let item of res.data) {
  925. arr.push({
  926. id: item.id,
  927. name: item.name
  928. })
  929. obj[item.id] = item.name;
  930. }
  931. that.nameObj.workprocid.arr = arr;
  932. that.nameObj.workprocid.obj = obj;
  933. } else {
  934. that.$message.error(res.message);
  935. }
  936. });
  937. },
  938. // 获取工序节点树(产出)
  939. getNodeTreeData () {
  940. let that = this
  941. let url = 'pass/ems/v1/trmworkprocs/gettree/?hasproduct=1';
  942. that.listTopicTree.loading = true;
  943. that.axios.get(url)
  944. .then(function (res) {
  945. if (res.code === '0') {
  946. that.listTopicTree.data = [{
  947. id: '',
  948. name: '所有记录',
  949. children: res.data
  950. }];
  951. } else {
  952. that.$message.error(res.message);
  953. }
  954. that.listTopicTree.loading = false;
  955. });
  956. },
  957. // 获取产品
  958. getProductIdData () {
  959. let that = this
  960. let url = 'pass/ems/v1/trmproducts/?pageSize=1000000';
  961. that.axios.get(url)
  962. .then(function (res) {
  963. if (res.code === '0') {
  964. let arr = [];
  965. let obj = {};
  966. for (let item of res.data.list) {
  967. arr.push({
  968. id: item.id,
  969. name: item.name
  970. })
  971. obj[item.id] = item.name;
  972. }
  973. that.nameObj.productid.arr = arr;
  974. that.nameObj.productid.obj = obj;
  975. } else {
  976. that.$message.error(res.message);
  977. }
  978. });
  979. },
  980. // 获取标准计量单位
  981. getUnitIdData () {
  982. let that = this
  983. let url = 'pass/ems/v1/trmunits/getIdAndName';
  984. that.axios.get(url)
  985. .then(function (res) {
  986. if (res.code === '0') {
  987. let arr = [];
  988. let obj = {};
  989. for (let item of res.data) {
  990. arr.push({
  991. id: item.id,
  992. name: item.name
  993. })
  994. obj[item.id] = item.name;
  995. if (item.name === '吨') {
  996. that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
  997. }
  998. }
  999. that.nameObj.unitid.arr = arr;
  1000. that.nameObj.unitid.obj = obj;
  1001. } else {
  1002. that.$message.error(res.message);
  1003. }
  1004. });
  1005. },
  1006. // 获取表格中的数据
  1007. getTableData (pageNum) {
  1008. let that = this,
  1009. params = {
  1010. productid: that.filterForm.data.productid,
  1011. workprocid: that.filterForm.data.workprocid,
  1012. isprimary: that.filterForm.data.isprimary,
  1013. version: that.filterForm.data.version,
  1014. itemid: that.filterForm.data.aid,
  1015. mes_materialcode: that.filterForm.data.materialCode
  1016. };
  1017. that.pageNum = pageNum || that.pageNum;
  1018. that.tableLoading = true;
  1019. that.dialog.editorBox.form.default.workprocid = that.filterForm.data.workprocid;
  1020. let url = 'pass/ems/v1/trmworkprocproducts/like/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize + '&itemtype=R';
  1021. that.axios.get(url, {
  1022. params: params
  1023. })
  1024. .then(function (res) {
  1025. if (res.code === '0') {
  1026. let arr = [];
  1027. for (let item of res.data.list) {
  1028. arr.push({
  1029. itemid: item.itemid,
  1030. productid: item.productid,
  1031. workprocid: item.workprocid,
  1032. isprimary: item.isprimary,
  1033. unitid: item.unitid,
  1034. seqno: item.seqno,
  1035. mes_materialcode: item.mesMaterialcode,
  1036. isFinanceData: item.isfinancedata,
  1037. mes_prodline: item.mesProdline,
  1038. code: item.code,
  1039. createman: item.createman,
  1040. createtime: item.createtime,
  1041. updateman: item.updateman,
  1042. updatetime: item.updatetime,
  1043. digits: item.digits
  1044. })
  1045. }
  1046. that.tableData = arr;
  1047. that.total = res.data.total;
  1048. } else {
  1049. that.$message.error(res.message);
  1050. }
  1051. that.tableLoading = false;
  1052. }).catch(function () {
  1053. that.tableLoading = false;
  1054. });
  1055. },
  1056. // 改变表格显示条数
  1057. tableSizeChange (val) {
  1058. let that = this;
  1059. that.pageSize = val;
  1060. that.getTableData(1);
  1061. },
  1062. // 重置搜索
  1063. tableDataCancel () {
  1064. let that = this;
  1065. that.filterForm.data.workprocid = '';
  1066. that.filterForm.data.productid = '';
  1067. that.filterForm.data.version = '';
  1068. that.filterForm.data.aid = '';
  1069. that.filterForm.data.materialCode = '';
  1070. that.getTableData(1);
  1071. },
  1072. // 表格中多选按钮的相关方法
  1073. handleSelectionChange (val) {
  1074. let that = this;
  1075. let tableFormDataObj = {};
  1076. for (let item of that.tableData) {
  1077. item.isSelection = false;
  1078. }
  1079. for (let item of val) {
  1080. let obj = {};
  1081. let xId = item.itemid;
  1082. if (that.tableFormDataObj[xId]) {
  1083. tableFormDataObj[xId] = that.tableFormDataObj[xId];
  1084. } else {
  1085. for (let key in item) {
  1086. obj[key] = item[key];
  1087. }
  1088. tableFormDataObj[xId] = obj;
  1089. }
  1090. item.isSelection = true;
  1091. }
  1092. that.tableFormDataObj = tableFormDataObj;
  1093. that.multipleSelection = val;
  1094. },
  1095. but_add () {
  1096. let that = this;
  1097. if (!that.dialog.editorBox.form.default.workprocid) {
  1098. that.$message.error('请先选择左侧的详细工序');
  1099. return;
  1100. }
  1101. that.dialog.editorBox.form.data.itemid = '';
  1102. that.dialog.editorBox.form.data.productid = '';
  1103. that.dialog.editorBox.form.data.mes_prodline = '';
  1104. that.dialog.editorBox.form.data.workprocid = that.dialog.editorBox.form.default.workprocid;
  1105. that.dialog.editorBox.form.data.isprimary = '0';
  1106. that.dialog.editorBox.form.data.unitid = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : '';
  1107. that.dialog.editorBox.form.data.seqno = '';
  1108. that.dialog.editorBox.form.data.code = '0';
  1109. that.dialog.editorBox.type = 'add';
  1110. that.dialog.editorBox.show = true;
  1111. setTimeout(() => {
  1112. that.$refs['dialog_form'].clearValidate();
  1113. }, 100);
  1114. },
  1115. // 批量修改
  1116. but_edit_plural () {
  1117. let that = this;
  1118. if (that.multipleSelection.length > 0) {
  1119. that.$refs['dialog_form_arr'].validate((valid) => {
  1120. if (valid) {
  1121. let SubmitData = [];
  1122. for (let key in that.tableFormDataObj) {
  1123. SubmitData.push({
  1124. itemid: that.tableFormDataObj[key].itemid,
  1125. isprimary: that.tableFormDataObj[key].isprimary,
  1126. unitid: that.tableFormDataObj[key].unitid,
  1127. seqno: that.tableFormDataObj[key].seqno,
  1128. code: that.tableFormDataObj[key].code,
  1129. isFinanceData: that.tableFormDataObj[key].isFinanceData,
  1130. mes_prodline: that.tableFormDataObj[key].mes_prodline,
  1131. digits: that.tableFormDataObj[key].digits
  1132. });
  1133. }
  1134. that.loading = true;
  1135. that.axios.put('pass/ems/v1/trmworkprocproducts/', SubmitData)
  1136. .then(function (res) {
  1137. if (res.code === '0') {
  1138. that.$message({
  1139. message: '修改成功',
  1140. type: 'success'
  1141. });
  1142. that.getTableData();
  1143. that.dialog.editorBox.show = false;
  1144. } else {
  1145. that.$message.error(res.message);
  1146. }
  1147. that.loading = false;
  1148. }).catch(function () {
  1149. that.loading = false;
  1150. });
  1151. }
  1152. });
  1153. } else {
  1154. this.$message.error('至少要选择一条数据');
  1155. }
  1156. },
  1157. // 批量删除
  1158. but_del_plural () {
  1159. let that = this;
  1160. if (that.multipleSelection.length > 0) {
  1161. let ids = [];
  1162. for (let item of that.multipleSelection) {
  1163. ids.push(item.itemid);
  1164. }
  1165. that.$confirm('是否删除已选数据?', '提示', {
  1166. confirmButtonText: '确定',
  1167. cancelButtonText: '取消',
  1168. state: 'warning'
  1169. }).then(() => {
  1170. that.axios.delete('pass/ems/v1/trmworkprocproducts/' + ids.toString())
  1171. .then(function (res) {
  1172. if (res.code === '0') {
  1173. that.$message({
  1174. message: '删除成功',
  1175. type: 'success'
  1176. });
  1177. that.getTableData();
  1178. } else {
  1179. if (res.code === '51') {
  1180. }
  1181. that.$message.error(res.message);
  1182. }
  1183. }).catch(function () {
  1184. });
  1185. }).catch(() => {
  1186. });
  1187. } else {
  1188. this.$message.error('至少要选择一条数据');
  1189. }
  1190. },
  1191. // but_edit (row) {
  1192. // let that = this;
  1193. // that.dialog.editorBox.form.data.itemid = row.itemid;
  1194. // that.dialog.editorBox.form.data.productid = row.productid;
  1195. // that.dialog.editorBox.form.data.workprocid = row.workprocid;
  1196. // that.dialog.editorBox.form.data.isprimary = row.isprimary;
  1197. // that.dialog.editorBox.form.data.unitid = row.unitid;
  1198. // that.dialog.editorBox.form.data.seqno = row.seqno;
  1199. // that.dialog.editorBox.form.data.code = row.code;
  1200. // that.dialog.editorBox.type = 'edit';
  1201. // that.dialog.editorBox.show = true;
  1202. // },
  1203. // but_del (row) {
  1204. // let that = this;
  1205. // that.$confirm('是否删除该条数据?', '提示', {
  1206. // confirmButtonText: '确定',
  1207. // cancelButtonText: '取消',
  1208. // state: 'warning'
  1209. // }).then(() => {
  1210. // that.axios.delete('pass/ems/v1/trmworkprocproducts/' + row.itemid)
  1211. // .then(function (res) {
  1212. // if (res.code === '0') {
  1213. // that.$message({
  1214. // message: '删除成功',
  1215. // type: 'success'
  1216. // });
  1217. // that.getTableData();
  1218. // } else {
  1219. // that.$message.error(res.message);
  1220. // }
  1221. // }).catch(function () {
  1222. // });
  1223. // }).catch(() => {
  1224. // });
  1225. // },
  1226. dataSave () {
  1227. let that = this;
  1228. let SubmitData = {
  1229. itemid: that.dialog.editorBox.form.data.itemid,
  1230. productid: that.dialog.editorBox.form.data.productid,
  1231. workprocid: that.dialog.editorBox.form.data.workprocid,
  1232. isprimary: that.dialog.editorBox.form.data.isprimary,
  1233. unitid: that.dialog.editorBox.form.data.unitid,
  1234. seqno: that.dialog.editorBox.form.data.seqno,
  1235. code: that.dialog.editorBox.form.data.code,
  1236. mes_prodline: that.dialog.editorBox.form.data.mes_prodline,
  1237. digits: that.dialog.editorBox.form.data.digits,
  1238. itemtype: 'R'
  1239. };
  1240. that.$refs['dialog_form'].validate((valid) => {
  1241. if (valid) {
  1242. if (that.dialog.editorBox.type === 'add') {
  1243. that.loading = true;
  1244. that.axios.post('pass/ems/v1/trmworkprocproducts/', SubmitData, {
  1245. contentType: 'application/json'
  1246. })
  1247. .then(function (res) {
  1248. if (res.code === '0') {
  1249. that.$message({
  1250. message: '新增成功',
  1251. type: 'success'
  1252. });
  1253. that.getTableData();
  1254. that.dialog.editorBox.show = false;
  1255. } else {
  1256. that.$message.error(res.message);
  1257. }
  1258. that.loading = false;
  1259. }).catch(function () {
  1260. that.loading = false;
  1261. });
  1262. } else {
  1263. that.loading = true;
  1264. that.axios.put('pass/ems/v1/trmworkprocproducts/' + SubmitData.itemid, SubmitData)
  1265. .then(function (res) {
  1266. if (res.code === '0') {
  1267. that.$message({
  1268. message: '修改成功',
  1269. type: 'success'
  1270. });
  1271. that.getTableData();
  1272. that.dialog.editorBox.show = false;
  1273. } else {
  1274. that.$message.error(res.message);
  1275. }
  1276. that.loading = false;
  1277. }).catch(function () {
  1278. that.loading = false;
  1279. });
  1280. }
  1281. }
  1282. });
  1283. },
  1284. but_equationEditing (row) {
  1285. let that = this;
  1286. that.dialog.equationEditing.form.data.clock = that.filterForm.data.version;
  1287. that.dialog.equationEditing.form.data.code = row.itemid;
  1288. that.dialog.equationEditing.show = true;
  1289. },
  1290. selectByTopicId (data) {
  1291. let that = this;
  1292. that.filterForm.data.workprocid = data.id;
  1293. that.getTableData(1);
  1294. }
  1295. }
  1296. }
  1297. </script>
  1298. <style lang="less">
  1299. .planProcessAndProduct {
  1300. min-width: 700px;
  1301. height: 100%;
  1302. .box {
  1303. height: 100%;
  1304. padding: 15px 15px 0 15px;
  1305. .box-left {
  1306. float: left;
  1307. width: 200px;
  1308. height: calc(100% - 3px);
  1309. overflow: auto;
  1310. .box-left-bt {
  1311. line-height: 35px;
  1312. font-size: 16px;
  1313. border-bottom: 1px solid #ccc;
  1314. }
  1315. .box-left-tree {
  1316. height: calc(100% - 50px);
  1317. overflow: auto;
  1318. padding: 7px 7px 0 0;
  1319. .tree-row-on {
  1320. color: #3279e8;
  1321. font-weight: 600;
  1322. }
  1323. }
  1324. }
  1325. .box-right {
  1326. border-left: 1px solid #ccc;
  1327. margin-left: 200px;
  1328. .box-top {
  1329. .box-top-form {
  1330. padding-left: 7px;
  1331. .el-form-item {
  1332. margin-bottom: 7px;
  1333. }
  1334. }
  1335. .box-top-gjl {
  1336. overflow: hidden;
  1337. // margin-top: -7px;
  1338. padding: 7px 0 7px 7px;
  1339. border-top: 1px solid #ccc;
  1340. // border-bottom: 1px solid #ccc;
  1341. // margin-bottom: 6px;
  1342. }
  1343. }
  1344. .box-bottom {
  1345. padding-left: 7px;
  1346. }
  1347. }
  1348. .el-table .el-table__row {
  1349. height: 35px;
  1350. }
  1351. .el-table__body .el-form-item--mini.el-form-item {
  1352. margin: 0px;
  1353. .error {
  1354. overflow: hidden;
  1355. color: #f56c6c;
  1356. font-size: 12px;
  1357. line-height: 1;
  1358. }
  1359. }
  1360. }
  1361. .color_no {
  1362. color: #7a7a7a;
  1363. }
  1364. .color_yes {
  1365. color: #1a9f17;
  1366. }
  1367. }
  1368. </style>