You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4302 lines
152 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 查询条件 -->
  4. <el-form :inline="true" label-position="top" :model="searchData">
  5. <el-form-item :label="'BU'">
  6. <el-select v-model="searchData.buNo" placeholder="请选择" clearable style="width: 90px">
  7. <el-option
  8. v-for = "i in buList"
  9. :key = "i.buNo"
  10. :label = "i.buDesc"
  11. :value = "i.buNo">
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item :label="'物料编码'">
  16. <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item :label="'物料名称'">
  19. <el-input v-model="searchData.partDesc" clearable style="width: 300px"></el-input>
  20. </el-form-item>
  21. <!-- <el-form-item :label="'制造类型'">-->
  22. <!-- <el-select v-model="searchData.bomType" clearable style="width: 120px">-->
  23. <!-- <el-option label="Manufacturing" value="Manufacturing"></el-option>-->
  24. <!-- <el-option label="Repair" value="Repair"></el-option>-->
  25. <!-- <el-option label="Purchase" value="Purchase"></el-option>-->
  26. <!-- <el-option label="Prototype" value="Prototype"></el-option>-->
  27. <!-- </el-select>-->
  28. <!-- </el-form-item>-->
  29. <el-form-item :label="'BOM版本号'">
  30. <el-input v-model="searchData.engChgLevel" clearable style="width: 70px"></el-input>
  31. </el-form-item>
  32. <el-form-item :label="'BOM状态'">
  33. <el-select v-model="searchData.status" clearable style="width: 120px">
  34. <el-option label="Tentative" value="Tentative"></el-option>
  35. <el-option label="Buildable" value="Buildable"></el-option>
  36. <el-option label="Obsolete" value="Obsolete"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item :label="' '">
  40. <el-button v-if="!authSearch" @click="getDataList">查询</el-button>
  41. <el-button v-if="!authSave" type="primary" @click="addModal">新增</el-button>
  42. <el-button v-if="!authDelete" type="primary" @click="delModal">删除</el-button>
  43. <!-- <el-button type="primary" @click="exportWordOrPdf">导出Word</el-button>-->
  44. <download-excel
  45. :fields="fields()"
  46. :data="exportData"
  47. type="xls"
  48. :name="exportName"
  49. :header="exportHeader"
  50. :footer="exportFooter"
  51. :fetch="createExportData"
  52. :before-generate="startDownload"
  53. :before-finish="finishDownload"
  54. worksheet="导出信息"
  55. class="el-button el-button--primary el-button--medium">
  56. {{ "导出" }}
  57. </download-excel>
  58. </el-form-item>
  59. </el-form>
  60. <!-- bom列表 -->
  61. <el-table
  62. @header-dragend="handleColumnResize"
  63. :height="height"
  64. :data="dataList"
  65. border
  66. @selection-change="selectionBom"
  67. style="width: 100%;">
  68. <el-table-column
  69. type="selection"
  70. header-align="center"
  71. align="center"
  72. width="50">
  73. </el-table-column>
  74. <el-table-column
  75. v-for="(item,index) in columnList" :key="index"
  76. :sortable="item.columnSortable"
  77. :prop="item.columnProp"
  78. :header-align="item.headerAlign"
  79. :show-overflow-tooltip="item.showOverflowTooltip"
  80. :align="item.align"
  81. :fixed="item.fixed === ''?false:item.fixed"
  82. :min-width="item.columnWidth"
  83. :label="item.columnLabel">
  84. <template slot-scope="scope">
  85. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  86. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. fixed="right"
  91. header-align="center"
  92. align="center"
  93. width="120"
  94. label="操作">
  95. <template slot-scope="scope">
  96. <el-link v-if="!authUpdate" style="cursor: pointer" @click="updateModal(scope.row)">编辑</el-link>
  97. <el-link style="cursor: pointer" @click="checkOutToRouting(scope.row.partNo)">切换Routing</el-link>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <!-- 复选统计 -->
  102. <selectDiv ref="selectDiv"></selectDiv>
  103. <!-- 分页插件 -->
  104. <el-pagination
  105. @size-change="sizeChangeHandle"
  106. @current-change="currentChangeHandle"
  107. :current-page="pageIndex"
  108. :page-sizes="[20, 50, 100, 200, 500]"
  109. :page-size="pageSize"
  110. :total="totalPage"
  111. layout="total, sizes, prev, pager, next, jumper">
  112. </el-pagination>
  113. <!-- bom新增/编辑模态框 -->
  114. <el-dialog :close-on-click-modal="false" top="8vh" :before-close="closeModalX" v-drag :visible.sync="modalFlag" width="1110px">
  115. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 5px">
  116. <el-form-item label="BU" prop="bu">
  117. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" @change="userBuChange" style="width: 150px">
  118. <el-option
  119. v-for = "i in userBuList"
  120. :key = "i.buNo"
  121. :label = "i.buDesc"
  122. :value = "i.buNo">
  123. </el-option>
  124. </el-select>
  125. </el-form-item>
  126. <el-form-item prop="partNo">
  127. <span v-if="!modalDisableFlag" slot="label" @click="queryPartList"><a herf="#">物料编码</a></span>
  128. <span v-else slot="label">物料编码</span>
  129. <el-input v-model="modalData.partNo" :disabled="modalDisableFlag" @blur="partNoBlur" style="width: 150px"></el-input>
  130. </el-form-item>
  131. <el-form-item :label="'物料名称'" prop="partDesc">
  132. <el-input v-model="modalData.partDesc" disabled style="width: 340px"></el-input>
  133. </el-form-item>
  134. <el-form-item :label="'物料单位'">
  135. <el-input v-model="modalData.printUnitName" disabled style="width: 100px"></el-input>
  136. </el-form-item>
  137. <el-form-item :label="'制造类型'" prop="bomType">
  138. <el-select v-model="modalData.bomType" @change="bomTypeChange" disabled style="width: 130px">
  139. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  140. <el-option label="Repair" value="Repair"></el-option>
  141. <el-option label="Purchase" value="Purchase"></el-option>
  142. <el-option label="Prototype" value="Prototype"></el-option>
  143. </el-select>
  144. </el-form-item>
  145. </el-form>
  146. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  147. <el-form-item label="生效日期" prop="effPhaseInDate">
  148. <el-date-picker
  149. style="width: 150px"
  150. v-model="modalData.effPhaseInDate"
  151. type="date"
  152. value-format="yyyy-MM-dd"
  153. format="yyyy-MM-dd"
  154. placeholder="请选择日期">
  155. </el-date-picker>
  156. </el-form-item>
  157. <el-form-item label="失效日期">
  158. <el-date-picker
  159. :readonly="!modalDisableFlag"
  160. style="width: 150px"
  161. v-model="modalData.effPhaseOutDate"
  162. type="date"
  163. value-format="yyyy-MM-dd"
  164. format="yyyy-MM-dd"
  165. placeholder="请选择日期">
  166. </el-date-picker>
  167. </el-form-item>
  168. <el-form-item :label="'BOM版本号'" prop="engChgLevel">
  169. <el-input-number :controls="false" :step="0" v-model="modalData.engChgLevel" :disabled="modalDisableFlag" style="width: 110px"></el-input-number>
  170. </el-form-item>
  171. <el-form-item :label="'工程版本号'">
  172. <el-input v-model="modalData.engRevision" style="width: 110px"></el-input>
  173. </el-form-item>
  174. <el-form-item :label="'净重'">
  175. <el-input-number :controls="false" :step="0" v-model="modalData.netWeight" style="width: 90px"></el-input-number>
  176. </el-form-item>
  177. <el-form-item prop="processUnit">
  178. <span slot="label" @click="getBaseList(510)"><a>工序单位</a></span>
  179. <el-input v-model="modalData.processUnitName" readonly style="width: 100px"></el-input>
  180. </el-form-item>
  181. <el-form-item :label="'损耗率%'">
  182. <el-input-number :controls="false" :step="0" disabled v-model="modalData.shrinkageFactor" style="width: 100px"></el-input-number>
  183. </el-form-item>
  184. <el-form-item>
  185. <el-button v-if="modalData.flag === '1' && headerSaveFlag" :loading="saveHeaderLoading" type="primary" @click="saveBomHeader" style="margin-top: 23px;width: 100px">保存</el-button>
  186. <el-button v-else-if="modalData.flag === '2'" type="primary" @click="copyBomRevision" style="margin-top: 23px;width: 100px">Copy</el-button>
  187. </el-form-item>
  188. </el-form>
  189. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  190. <el-form-item label="备注">
  191. <el-input type="textarea" v-model="modalData.noteText" :rows="3" resize='none' show-word-limit style="width: 1082px;height: 20px"></el-input>
  192. </el-form-item>
  193. </el-form>
  194. <el-tabs v-model="detailTable" style="margin-top: 50px; width: 100%; min-height: 120px" type="border-card" class="detail-tab">
  195. <!-- BOM明细信息页签 -->
  196. <el-tab-pane label="Product Structure" name="bom_detail">
  197. <el-form label-position="top" style="margin-top: -10px">
  198. <el-form-item>
  199. <!-- <el-button type="primary" @click="saveBomDetail" style="margin-left: 7px">新增</el-button>-->
  200. <!-- <el-button type="primary" :loading="alternativeLoading" @click="deleteBomDetail">删除</el-button>-->
  201. <el-button type="primary" :loading="alternativeLoading" @click="updateBomDetail" style="margin-left: 7px">编辑</el-button>
  202. <el-button v-if="modalData.flag === '2'" type="primary" :loading="alternativeLoading" @click="copyBomAlternative">Copy</el-button>
  203. <el-button v-if="detailData.status === 'Tentative' || detailData.status === 'Obsolete'" type="primary" :loading="alternativeLoading" @click="updateStatusToBuildable">Build</el-button>
  204. <el-button v-if="detailData.status === 'Buildable'" type="primary" :loading="alternativeLoading" @click="updateStatusToObsolete">Retire</el-button>
  205. </el-form-item>
  206. </el-form>
  207. <el-form :inline="true" label-position="top" :model="detailData" :rules="rules" style="margin-left: 7px">
  208. <el-form-item :label="'替代编码'">
  209. <el-select v-model="detailData.alternativeNo" @change="alternativeChange" style="width: 165px">
  210. <el-option
  211. v-for = "(i, index) in detailDataList"
  212. :key = "index"
  213. :label = "i.alternativeNo"
  214. :value = "i.alternativeNo">
  215. </el-option>
  216. </el-select>
  217. </el-form-item>
  218. <el-form-item :label="'替代名称'">
  219. <el-input v-model="detailData.alternativeDescription" readonly style="width: 300px"></el-input>
  220. </el-form-item>
  221. <el-form-item :label="'状态'">
  222. <el-input v-model="detailData.status" readonly style="width: 150px"></el-input>
  223. </el-form-item>
  224. <el-form-item :label="'最小订单数'">
  225. <el-input class="inlineNumber numInput" v-model="detailData.minLotQty" readonly type="number" style="width: 100px"></el-input>
  226. </el-form-item>
  227. </el-form>
  228. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px">
  229. <el-form-item label="备注">
  230. <el-input type="textarea" v-model="detailData.detailNoteText" :rows="3" resize='none' show-word-limit readonly style="width: 1073px;height: 20px"></el-input>
  231. </el-form-item>
  232. </el-form>
  233. </el-tab-pane>
  234. </el-tabs>
  235. <el-tabs v-model="subDetailTable" style="width: 100%; min-height: 330px" type="border-card" @tab-click="tabSubDetailClick" class="sub_detail-tab">
  236. <!-- BOM子明细信息页签 -->
  237. <el-tab-pane label="Components" name="bom_sub_detail">
  238. <el-form label-position="top" style="margin-top: 5px">
  239. <el-form-item>
  240. <el-button type="primary" :loading="alternativeLoading" @click="saveComponentModal" style="margin-left: 7px">新增</el-button>
  241. <el-button type="primary" :loading="alternativeLoading" @click="batchSaveComponentModal" style="margin-left: 7px">批量新增</el-button>
  242. <el-button type="primary" icon="el-icon-upload" @click="bomComponentUpload">导入</el-button>
  243. <el-button type="primary" :loading="alternativeLoading" @click="deleteComponentPart">删除</el-button>
  244. </el-form-item>
  245. </el-form>
  246. <div class="rq ">
  247. <el-table
  248. :data="subDetailList"
  249. height="256px"
  250. border
  251. @selection-change="componentSelectionChange"
  252. style="width:100%">
  253. <el-table-column type="selection" align="center" width="50"></el-table-column>
  254. <el-table-column
  255. v-for="(item,index) in columnSubDetailList1" :key="index"
  256. :sortable="item.columnSortable"
  257. :prop="item.columnProp"
  258. :header-align="item.headerAlign"
  259. :show-overflow-tooltip="item.showOverflowTooltip"
  260. :align="item.align"
  261. :fixed="item.fixed == ''?false:item.fixed"
  262. :min-width="item.columnWidth"
  263. :label="item.columnLabel">
  264. <template slot-scope="scope">
  265. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  266. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  267. </template>
  268. </el-table-column>
  269. <el-table-column
  270. prop=""
  271. header-align="center"
  272. align="right"
  273. min-width="80"
  274. label="单位用量">
  275. <template slot-scope="scope">
  276. <el-input-number :controls="false" :step="0" :ref="`qtyPerAssembly${scope.$index}`" v-model="scope.row.qtyPerAssembly" @keyup.enter.native="focusNextInput(scope.$index, 'qtyPerAssembly')" style="height: 11px; width: 98%"></el-input-number>
  277. </template>
  278. </el-table-column>
  279. <el-table-column
  280. prop=""
  281. header-align="center"
  282. align="right"
  283. min-width="80"
  284. label="调机量">
  285. <template slot-scope="scope">
  286. <el-input-number :controls="false" :step="0" :ref="`componentScrap${scope.$index}`" v-model="scope.row.componentScrap" @keyup.enter.native="focusNextInput(scope.$index, 'componentScrap')" style="height: 11px; width: 98%"></el-input-number>
  287. </template>
  288. </el-table-column>
  289. <el-table-column
  290. prop=""
  291. header-align="center"
  292. align="right"
  293. min-width="80"
  294. label="损耗率">
  295. <template slot-scope="scope">
  296. <el-input-number :controls="false" :step="0" :ref="`shrinkageFactor${scope.$index}`" v-model="scope.row.shrinkageFactor" @keyup.enter.native="focusNextInput(scope.$index, 'shrinkageFactor')" style="height: 11px; width: 98%"></el-input-number>
  297. </template>
  298. </el-table-column>
  299. <el-table-column
  300. v-for="(item,index) in columnSubDetailList2" :key="index"
  301. :sortable="item.columnSortable"
  302. :prop="item.columnProp"
  303. :header-align="item.headerAlign"
  304. :show-overflow-tooltip="item.showOverflowTooltip"
  305. :align="item.align"
  306. :fixed="item.fixed == ''?false:item.fixed"
  307. :min-width="item.columnWidth"
  308. :label="item.columnLabel">
  309. <template slot-scope="scope">
  310. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  311. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  312. </template>
  313. </el-table-column>
  314. <el-table-column
  315. fixed="right"
  316. header-align="center"
  317. align="center"
  318. width="100"
  319. label="操作">
  320. <template slot-scope="scope">
  321. <el-link style="cursor: pointer" @click="updateComponentModal(scope.row)">编辑</el-link>
  322. </template>
  323. </el-table-column>
  324. </el-table>
  325. </div>
  326. </el-tab-pane>
  327. </el-tabs>
  328. <el-footer style="height:30px;margin-top:20px;text-align:center">
  329. <el-button :loading="saveAllLoading" type="primary" @click="saveData(true)">应用</el-button>
  330. <el-button :loading="saveAllLoading" type="primary" @click="saveData(false)">保存</el-button>
  331. <el-button type="primary" @click="closeModal">关闭</el-button>
  332. </el-footer>
  333. </el-dialog>
  334. <!-- 明细新增模态框 -->
  335. <el-dialog title="替代" :close-on-click-modal="false" v-drag :visible.sync="saveDetailModalFlag" width="530px">
  336. <el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
  337. <el-form-item :label="'替代编码'" prop="alternativeNo">
  338. <el-input v-model="saveDetailData.alternativeNo" :disabled="saveDetailModalDisable" style="width: 235px"></el-input>
  339. </el-form-item>
  340. <el-form-item :label="'替代名称'" prop="alternativeDescription">
  341. <el-input v-model="saveDetailData.alternativeDescription" style="width: 235px"></el-input>
  342. </el-form-item>
  343. </el-form>
  344. <el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
  345. <el-form-item :label="'状态'" prop="status">
  346. <el-input v-model="saveDetailData.status" disabled style="width: 235px"></el-input>
  347. </el-form-item>
  348. <el-form-item :label="'最小订单数'" prop="minLotQty">
  349. <el-input-number :controls="false" :step="0" v-model="saveDetailData.minLotQty" style="width: 235px"></el-input-number>
  350. </el-form-item>
  351. </el-form>
  352. <el-form :inline="true" label-position="top" :model="saveDetailData" style="margin-left: 5px">
  353. <el-form-item label="备注">
  354. <el-input type="textarea" v-model="saveDetailData.detailNoteText" :rows="3" resize='none' show-word-limit style="width: 500px;height: 20px"></el-input>
  355. </el-form-item>
  356. </el-form>
  357. <el-footer style="height:35px;margin-top:65px;text-align:center">
  358. <el-button :loading="saveDetailLoading" type="primary" @click="detailDataSave">保存</el-button>
  359. <el-button type="primary" @click="saveDetailModalFlag = false">关闭</el-button>
  360. </el-footer>
  361. </el-dialog>
  362. <!-- 物料模态框 -->
  363. <el-dialog title="物料清单" :close-on-click-modal="false" v-drag :visible.sync="partModelFlag" width="900px">
  364. <div class="rq">
  365. <el-form :inline="true" label-position="top" :model="partData">
  366. <el-form-item :label="'物料编码'">
  367. <el-input v-model="partData.partNo" clearable style="width: 120px"></el-input>
  368. </el-form-item>
  369. <el-form-item :label="'物料名称'">
  370. <el-input v-model="partData.partDesc" clearable style="width: 120px"></el-input>
  371. </el-form-item>
  372. <el-form-item :label="' '">
  373. <el-button type="primary" @click="queryPartList">查询</el-button>
  374. </el-form-item>
  375. </el-form>
  376. <el-table
  377. :height="300"
  378. :data="partList"
  379. @row-dblclick="getRowData"
  380. border
  381. style="width: 100%;">
  382. <el-table-column
  383. v-for="(item,index) in partColumnList" :key="index"
  384. :sortable="item.columnSortable"
  385. :prop="item.columnProp"
  386. :header-align="item.headerAlign"
  387. :show-overflow-tooltip="item.showOverflowTooltip"
  388. :align="item.align"
  389. :fixed="item.fixed==''?false:item.fixed"
  390. :min-width="item.columnWidth"
  391. :label="item.columnLabel">
  392. <template slot-scope="scope">
  393. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  394. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  395. </template>
  396. </el-table-column>
  397. </el-table>
  398. <!-- 分页插件 -->
  399. <el-pagination
  400. @size-change="sizeChangeHandle2"
  401. @current-change="currentChangeHandle2"
  402. :current-page="pageIndex2"
  403. :page-sizes="[20, 50, 100, 200, 500]"
  404. :page-size="pageSize2"
  405. :total="totalPage2"
  406. layout="total, sizes, prev, pager, next, jumper">
  407. </el-pagination>
  408. </div>
  409. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  410. <el-button type="primary" @click="partModelFlag=false">关闭</el-button>
  411. </el-footer>
  412. </el-dialog>
  413. <!-- 子明细物料模态框 -->
  414. <el-dialog title="物料清单" top="17vh" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="700px">
  415. <el-form :inline="true" label-position="top" :model="componentPartData">
  416. <el-form-item :label="'物料编码'">
  417. <el-input v-model="componentPartData.partNo" clearable style="width: 120px"></el-input>
  418. </el-form-item>
  419. <el-form-item :label="'物料名称'">
  420. <el-input v-model="componentPartData.partDesc" clearable style="width: 120px"></el-input>
  421. </el-form-item>
  422. <el-form-item :label="' '">
  423. <el-button type="primary" @click="queryComponentPartList">查询</el-button>
  424. </el-form-item>
  425. </el-form>
  426. <el-table
  427. :height="250"
  428. :data="componentPartList"
  429. @row-dblclick="getComponentRowData"
  430. border
  431. style="width: 100%;">
  432. <el-table-column
  433. v-for="(item,index) in componentPartColumnList" :key="index"
  434. :sortable="item.columnSortable"
  435. :prop="item.columnProp"
  436. :header-align="item.headerAlign"
  437. :show-overflow-tooltip="item.showOverflowTooltip"
  438. :align="item.align"
  439. :fixed="item.fixed==''?false:item.fixed"
  440. :min-width="item.columnWidth"
  441. :label="item.columnLabel">
  442. <template slot-scope="scope">
  443. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  444. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  445. </template>
  446. </el-table-column>
  447. </el-table>
  448. <!-- 分页插件 -->
  449. <el-pagination
  450. @size-change="sizeChangeHandle3"
  451. @current-change="currentChangeHandle3"
  452. :current-page="pageIndex3"
  453. :page-sizes="[20, 50, 100, 200, 500]"
  454. :page-size="pageSize3"
  455. :total="totalPage3"
  456. layout="total, sizes, prev, pager, next, jumper">
  457. </el-pagination>
  458. <el-footer style="height:35px;margin-top:10px;text-align:center">
  459. <el-button type="primary" @click="componentPartModelFlag = false">关闭</el-button>
  460. </el-footer>
  461. </el-dialog>
  462. <!-- 子明细新增模态框 -->
  463. <el-dialog title="子物料" :close-on-click-modal="false" top="25vh" v-drag :visible.sync="componentSaveModal" width="800px">
  464. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  465. <el-form-item :label="'序号'" prop="lineSequence">
  466. <el-input-number :controls="false" :step="0" v-model="componentData.lineSequence" style="width: 49px"></el-input-number>
  467. </el-form-item>
  468. <el-form-item prop="componentPart">
  469. <span v-if="!componentDisableFlag" slot="label" @click="queryComponentPartModal"><a herf="#">子物料编码</a></span>
  470. <span v-if="componentDisableFlag" slot="label">子物料编码</span>
  471. <el-input v-model="componentData.componentPart" :disabled="componentDisableFlag" @blur="componentPartBlur" style="width: 130px"></el-input>
  472. </el-form-item>
  473. <el-form-item :label="'子物料名称'">
  474. <el-input v-model="componentData.componentPartDesc" disabled style="width: 249px"></el-input>
  475. </el-form-item>
  476. <el-form-item :label="'物料单位'">
  477. <el-input v-model="componentData.printUnitName" disabled style="width: 110px"></el-input>
  478. </el-form-item>
  479. <el-form-item :label="'消耗项目'" prop="consumptionItem">
  480. <el-select v-model="componentData.consumptionItem" style="width: 167px">
  481. <el-option label="Consumed" value="Consumed"></el-option>
  482. <el-option label="Not Consumed" value="Not Consumed"></el-option>
  483. </el-select>
  484. </el-form-item>
  485. </el-form>
  486. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  487. <el-form-item :label="'单位用量'" prop="qtyPerAssembly">
  488. <el-input-number :controls="false" :step="0" v-model="componentData.qtyPerAssembly" style="width: 144px"></el-input-number>
  489. </el-form-item>
  490. <el-form-item :label="'调机量'" prop="componentScrap">
  491. <el-input-number :controls="false" :step="0" v-model="componentData.componentScrap" style="width: 80px"></el-input-number>
  492. </el-form-item>
  493. <el-form-item :label="'损耗率%'" prop="shrinkageFactor">
  494. <el-input-number :controls="false" :step="0" min="0" max="100" v-model="componentData.shrinkageFactor" style="width: 80px"></el-input-number>
  495. </el-form-item>
  496. <el-form-item>
  497. <span slot="label" @click="queryOperationList"><a>工序</a></span>
  498. <el-input v-model="componentData.operationNo" readonly style="width: 110px"></el-input>
  499. </el-form-item>
  500. <el-form-item>
  501. <span style="cursor: pointer" slot="label" @click="getBaseList(215)"><a herf="#">发料库位</a></span>
  502. <el-input v-model="componentData.issueToLocName" readonly style="width: 110px"></el-input>
  503. </el-form-item>
  504. <el-form-item :label="'生产属性'" prop="issueType">
  505. <el-select v-model="componentData.issueType" style="width: 167px">
  506. <el-option label="Reserve And Backflush" value="Reserve And Backflush"></el-option>
  507. <el-option label="Reserve" value="Reserve"></el-option>
  508. <el-option label="Backflush" value="Backflush"></el-option>
  509. <el-option label="Manual" value="Manual"></el-option>
  510. </el-select>
  511. </el-form-item>
  512. </el-form>
  513. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  514. <el-form-item :label="'实际生产数量'">
  515. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.productionData" :disabled="!productionDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  516. </el-form-item>
  517. <el-form-item :label="'材料数量'">
  518. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialData" :disabled="!materialDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  519. </el-form-item>
  520. <el-form-item :label="'成品数量'">
  521. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.finishedProductData" :disabled="!finishedProductDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  522. </el-form-item>
  523. <el-form-item :label="'用量损耗'">
  524. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.consumptionLoss" :disabled="!consumptionLossFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  525. </el-form-item>
  526. </el-form>
  527. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  528. <el-form-item :label="'涂胶长度'">
  529. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.coatingLength" :disabled="!coatingLengthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  530. </el-form-item>
  531. <el-form-item :label="'胶水克重'">
  532. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.glueWeight" :disabled="!glueWeightFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  533. </el-form-item>
  534. <el-form-item :label="'材料宽度'">
  535. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialWidth" :disabled="!materialWidthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  536. </el-form-item>
  537. <el-form-item :label="'宽度换算单位'">
  538. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.widthConversion" :disabled="!widthConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  539. </el-form-item>
  540. </el-form>
  541. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  542. <el-form-item :label="'材料长度1'">
  543. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialLength" :disabled="!materialLengthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  544. </el-form-item>
  545. <el-form-item :label="'材料厚度'">
  546. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialThickness" :disabled="!materialThicknessFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  547. </el-form-item>
  548. <el-form-item :label="'面积单位换算'">
  549. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.areaConversion" :disabled="!areaConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  550. </el-form-item>
  551. <el-form-item :label="'密度单位换算'">
  552. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.densityConversion" :disabled="!densityConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  553. </el-form-item>
  554. </el-form>
  555. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  556. <el-form-item :label="'材料克重'">
  557. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialWeight" :disabled="!materialWeightFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  558. </el-form-item>
  559. <el-form-item :label="'材料长度2'">
  560. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialLength2" :disabled="!materialLength2Family.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  561. </el-form-item>
  562. <el-form-item :label="'单位换算'">
  563. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.unitConversion" :disabled="!unitConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  564. </el-form-item>
  565. </el-form>
  566. <el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
  567. <el-form-item label="备注">
  568. <el-input type="textarea" v-model="componentData.noteText" :rows="3" resize='none' show-word-limit style="width: 759px;height: 20px"></el-input>
  569. </el-form-item>
  570. </el-form>
  571. <el-footer style="height:35px;margin-top:65px;text-align:center">
  572. <el-button :loading="computeLoading" type="primary" @click="computeQtyPerAssembly()">计算</el-button>
  573. <el-button v-if="componentData.flag === '1'" type="primary" @click="componentDataSave(true)">应用</el-button>
  574. <el-button type="primary" @click="componentDataSave(false)">保存</el-button>
  575. <el-button type="primary" @click="componentSaveModal = false">关闭</el-button>
  576. </el-footer>
  577. </el-dialog>
  578. <!-- 工序 -->
  579. <el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="operationModelFlag" width="700px">
  580. <div class="rq">
  581. <el-form :inline="true" label-position="top" :model="operationData">
  582. <el-form-item label="Routing版本号">
  583. <el-input v-model="operationData.routingRevision" clearable style="width: 120px"></el-input>
  584. </el-form-item>
  585. <el-form-item label="工艺类型">
  586. <el-select v-model="operationData.routingType" clearable style="width: 120px">
  587. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  588. <el-option label="Repair" value="Repair"></el-option>
  589. <el-option label="Prototype" value="Prototype"></el-option>
  590. </el-select>
  591. </el-form-item>
  592. <el-form-item label="替代编码">
  593. <el-input v-model="operationData.alternativeNo" clearable style="width: 120px"></el-input>
  594. </el-form-item>
  595. <el-form-item label="工序编码">
  596. <el-input v-model="operationData.operationNo" clearable style="width: 120px"></el-input>
  597. </el-form-item>
  598. <el-form-item :label="' '">
  599. <el-button type="primary" @click="queryOperationList">查询</el-button>
  600. </el-form-item>
  601. </el-form>
  602. <el-table
  603. :height="300"
  604. :data="operationList"
  605. @row-dblclick="getRowOperationData"
  606. border
  607. style="width: 100%;">
  608. <el-table-column
  609. v-for="(item,index) in operationDetailList" :key="index"
  610. :sortable="item.columnSortable"
  611. :prop="item.columnProp"
  612. :header-align="item.headerAlign"
  613. :show-overflow-tooltip="item.showOverflowTooltip"
  614. :align="item.align"
  615. :fixed="item.fixed==''?false:item.fixed"
  616. :min-width="item.columnWidth"
  617. :label="item.columnLabel">
  618. <template slot-scope="scope">
  619. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  620. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  621. </template>
  622. </el-table-column>
  623. </el-table>
  624. </div>
  625. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  626. <el-button type="primary" @click="operationModelFlag=false">关闭</el-button>
  627. </el-footer>
  628. </el-dialog>
  629. <!-- copyBom -->
  630. <el-dialog title="Copy Structure Revision" :close-on-click-modal="false" v-drag :visible.sync="copyBomModelFlag" width="450px">
  631. <fieldset style="width: 426px">
  632. <legend>Source Revision</legend>
  633. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  634. <el-form-item label="物料编码">
  635. <el-input v-model="modalData.partNo" readonly style="width: 120px"></el-input>
  636. </el-form-item>
  637. <el-form-item label="物料名称">
  638. <el-input v-model="modalData.partDesc" readonly style="width: 249px"></el-input>
  639. </el-form-item>
  640. </el-form>
  641. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  642. <el-form-item label="Site">
  643. <el-input v-model="modalData.site" readonly style="width: 85px"></el-input>
  644. </el-form-item>
  645. <el-form-item label="BOM版本号">
  646. <el-input v-model="modalData.engChgLevel" readonly style="width: 85px"></el-input>
  647. </el-form-item>
  648. <el-form-item label="制造类型">
  649. <el-input v-model="modalData.bomType" readonly style="width: 185px"></el-input>
  650. </el-form-item>
  651. </el-form>
  652. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  653. <el-form-item label="生效日期">
  654. <el-date-picker style="width: 185px" v-model="modalData.effPhaseInDate" readonly type="date" value-format="yyyy-MM-dd"></el-date-picker>
  655. </el-form-item>
  656. <el-form-item label="失效日期">
  657. <el-date-picker style="width: 185px" v-model="modalData.effPhaseOutDate" readonly type="date" value-format="yyyy-MM-dd"></el-date-picker>
  658. </el-form-item>
  659. </el-form>
  660. <el-table
  661. :data="detailDataList"
  662. height="100px"
  663. border
  664. style="width:100%">
  665. <el-table-column
  666. v-for="(item,index) in columnBomDetailList" :key="index"
  667. :sortable="item.columnSortable"
  668. :prop="item.columnProp"
  669. :header-align="item.headerAlign"
  670. :show-overflow-tooltip="item.showOverflowTooltip"
  671. :align="item.align"
  672. :fixed="item.fixed == ''?false:item.fixed"
  673. :min-width="item.columnWidth"
  674. :label="item.columnLabel">
  675. <template slot-scope="scope">
  676. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  677. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  678. </template>
  679. </el-table-column>
  680. </el-table>
  681. </fieldset>
  682. <fieldset style="width: 426px">
  683. <legend>Destination Revision</legend>
  684. <el-form :inline="true" label-position="top" :model="copyBomData" style="margin-left: 7px;margin-top: -5px;">
  685. <el-form-item>
  686. <span slot="label" @click="queryCopyPartModal"><a herf="#">物料编码</a></span>
  687. <el-input v-model="copyBomData.partNo" @change="copyBomTypeChange" @blur="copyPartBlur" style="width: 120px"></el-input>
  688. </el-form-item>
  689. <el-form-item :label="'物料名称'">
  690. <el-input v-model="copyBomData.partDesc" disabled style="width: 249px"></el-input>
  691. </el-form-item>
  692. </el-form>
  693. <el-form :inline="true" label-position="top" :model="copyBomData" style="margin-left: 7px;margin-top: -5px;">
  694. <el-form-item label="Site">
  695. <el-input v-model="copyBomData.site" disabled style="width: 85px"></el-input>
  696. </el-form-item>
  697. <el-form-item label="BOM版本号">
  698. <el-input v-model="copyBomData.engChgLevel" disabled style="width: 85px"></el-input>
  699. </el-form-item>
  700. <el-form-item label="制造类型">
  701. <el-select v-model="copyBomData.bomType" @change="copyBomTypeChange" style="width: 185px">
  702. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  703. <el-option label="Repair" value="Repair"></el-option>
  704. <el-option label="Purchase" value="Purchase"></el-option>
  705. <el-option label="Prototype" value="Prototype"></el-option>
  706. </el-select>
  707. </el-form-item>
  708. </el-form>
  709. <el-form :inline="true" label-position="top" :model="copyBomData" style="margin-left: 7px;margin-top: -5px;">
  710. <el-form-item label="生效日期">
  711. <el-date-picker style="width: 185px" v-model="copyBomData.effPhaseInDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  712. </el-form-item>
  713. <el-form-item label="失效日期">
  714. <el-date-picker style="width: 185px" v-model="copyBomData.effPhaseOutDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  715. </el-form-item>
  716. </el-form>
  717. </fieldset>
  718. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  719. <el-button type="primary" :loading="copyLoading" @click="copyBom">保存</el-button>
  720. <el-button type="primary" @click="copyBomModelFlag = false">关闭</el-button>
  721. </el-footer>
  722. </el-dialog>
  723. <!-- copy物料模态框 -->
  724. <el-dialog title="物料清单" top="17vh" :close-on-click-modal="false" v-drag :visible.sync="copyPartModelFlag" width="700px">
  725. <el-form :inline="true" label-position="top" :model="copyPartData">
  726. <el-form-item :label="'物料编码'">
  727. <el-input v-model="copyPartData.partNo" clearable style="width: 120px"></el-input>
  728. </el-form-item>
  729. <el-form-item :label="'物料名称'">
  730. <el-input v-model="copyPartData.partDesc" clearable style="width: 120px"></el-input>
  731. </el-form-item>
  732. <el-form-item :label="' '">
  733. <el-button type="primary" @click="queryCopyPartList">查询</el-button>
  734. </el-form-item>
  735. </el-form>
  736. <el-table
  737. :height="250"
  738. :data="copyPartList"
  739. @row-dblclick="getCopyRowData"
  740. border
  741. style="width: 100%;">
  742. <el-table-column
  743. v-for="(item,index) in componentPartColumnList" :key="index"
  744. :sortable="item.columnSortable"
  745. :prop="item.columnProp"
  746. :header-align="item.headerAlign"
  747. :show-overflow-tooltip="item.showOverflowTooltip"
  748. :align="item.align"
  749. :fixed="item.fixed==''?false:item.fixed"
  750. :min-width="item.columnWidth"
  751. :label="item.columnLabel">
  752. <template slot-scope="scope">
  753. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  754. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  755. </template>
  756. </el-table-column>
  757. </el-table>
  758. <!-- 分页插件 -->
  759. <el-pagination
  760. @size-change="sizeChangeHandle4"
  761. @current-change="currentChangeHandle4"
  762. :current-page="pageIndex4"
  763. :page-sizes="[20, 50, 100, 200, 500]"
  764. :page-size="pageSize4"
  765. :total="totalPage4"
  766. layout="total, sizes, prev, pager, next, jumper">
  767. </el-pagination>
  768. <el-footer style="height:35px;margin-top:10px;text-align:center">
  769. <el-button type="primary" @click="copyPartModelFlag = false">关闭</el-button>
  770. </el-footer>
  771. </el-dialog>
  772. <!-- copyAlternative -->
  773. <el-dialog title="Copy Structure Alternative" :close-on-click-modal="false" v-drag :visible.sync="copyAlternativeModelFlag" width="450px">
  774. <fieldset style="width: 426px">
  775. <legend>Source Revision</legend>
  776. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px;margin-top: -5px;">
  777. <el-form-item label="物料编码">
  778. <el-input v-model="detailData.partNo" readonly style="width: 120px"></el-input>
  779. </el-form-item>
  780. <el-form-item label="物料名称">
  781. <el-input v-model="modalData.partDesc" readonly style="width: 249px"></el-input>
  782. </el-form-item>
  783. </el-form>
  784. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px;margin-top: -5px;">
  785. <el-form-item label="Site">
  786. <el-input v-model="detailData.site" readonly style="width: 85px"></el-input>
  787. </el-form-item>
  788. <el-form-item label="BOM版本号">
  789. <el-input v-model="detailData.engChgLevel" readonly style="width: 85px"></el-input>
  790. </el-form-item>
  791. <el-form-item label="制造类型">
  792. <el-input v-model="detailData.bomType" readonly style="width: 185px"></el-input>
  793. </el-form-item>
  794. </el-form>
  795. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px;margin-top: -5px;">
  796. <el-form-item label="替代编码">
  797. <el-input v-model="detailData.alternativeNo" readonly style="width: 185px"></el-input>
  798. </el-form-item>
  799. <el-form-item label="替代名称">
  800. <el-input v-model="detailData.alternativeDescription" readonly style="width: 185px"></el-input>
  801. </el-form-item>
  802. </el-form>
  803. </fieldset>
  804. <fieldset style="width: 426px">
  805. <legend>Destination Revision</legend>
  806. <el-form :inline="true" label-position="top" :model="copyAlternativeData" style="margin-left: 7px;margin-top: -5px;">
  807. <el-form-item>
  808. <span slot="label" @click="queryCopyPartModal"><a herf="#">物料编码</a></span>
  809. <el-input v-model="copyAlternativeData.partNo" @blur="copyPartBlur" style="width: 120px"></el-input>
  810. </el-form-item>
  811. <el-form-item :label="'物料名称'">
  812. <el-input v-model="copyAlternativeData.partDesc" disabled style="width: 249px"></el-input>
  813. </el-form-item>
  814. </el-form>
  815. <el-form :inline="true" label-position="top" :model="copyAlternativeData" style="margin-left: 7px;margin-top: -5px;">
  816. <el-form-item label="Site">
  817. <el-input v-model="copyAlternativeData.site" disabled style="width: 85px"></el-input>
  818. </el-form-item>
  819. <el-form-item label="BOM版本号">
  820. <el-input v-model="copyAlternativeData.engChgLevel" style="width: 85px"></el-input>
  821. </el-form-item>
  822. <el-form-item label="制造类型">
  823. <el-select v-model="copyAlternativeData.bomType" style="width: 185px">
  824. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  825. <el-option label="Repair" value="Repair"></el-option>
  826. <el-option label="Purchase" value="Purchase"></el-option>
  827. <el-option label="Prototype" value="Prototype"></el-option>
  828. </el-select>
  829. </el-form-item>
  830. </el-form>
  831. <el-form :inline="true" label-position="top" :model="copyAlternativeData" style="margin-left: 7px;margin-top: -5px;">
  832. <el-form-item label="替代编码">
  833. <el-input v-model="copyAlternativeData.alternativeNo" style="width: 185px"></el-input>
  834. </el-form-item>
  835. <el-form-item label="替代名称">
  836. <el-input v-model="copyAlternativeData.alternativeDescription" style="width: 185px"></el-input>
  837. </el-form-item>
  838. </el-form>
  839. </fieldset>
  840. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  841. <el-button type="primary" @click="copyAlternative">保存</el-button>
  842. <el-button type="primary" @click="copyAlternativeModelFlag = false">关闭</el-button>
  843. </el-footer>
  844. </el-dialog>
  845. <!-- &lt;!&ndash; 批量新增子明细物料模态框 &ndash;&gt;-->
  846. <!-- <el-dialog title="物料清单" top="17vh" :close-on-click-modal="false" v-drag :visible.sync="batchComponentPartModelFlag" width="1060px">-->
  847. <!-- <el-form :inline="true" label-position="top" :model="batchComponentPartData">-->
  848. <!-- <el-form-item :label="'物料编码'">-->
  849. <!-- <el-input v-model="batchComponentPartData.partNo" clearable style="width: 120px"></el-input>-->
  850. <!-- </el-form-item>-->
  851. <!-- <el-form-item :label="'物料名称'">-->
  852. <!-- <el-input v-model="batchComponentPartData.partDesc" clearable style="width: 120px"></el-input>-->
  853. <!-- </el-form-item>-->
  854. <!-- <el-form-item :label="' '">-->
  855. <!-- <el-button type="primary" @click="queryBatchComponentPartList">查询</el-button>-->
  856. <!-- </el-form-item>-->
  857. <!-- <el-form-item :label="'损耗率%'" style="margin-left: 545px">-->
  858. <!-- <el-input-number :controls="false" :step="0" min="0" max="100" v-model="batchComponentPartData.shrinkageFactor" style="width: 80px"></el-input-number>-->
  859. <!-- </el-form-item>-->
  860. <!-- </el-form>-->
  861. <!-- <el-table-->
  862. <!-- :height="400"-->
  863. <!-- :data="batchComponentPartList"-->
  864. <!-- ref="batchSaveTable"-->
  865. <!-- @row-click="batchSaveClickRow"-->
  866. <!-- @selection-change="selectionSaveComponent"-->
  867. <!-- border-->
  868. <!-- style="width: 100%;">-->
  869. <!-- <el-table-column-->
  870. <!-- type="selection"-->
  871. <!-- header-align="center"-->
  872. <!-- align="center"-->
  873. <!-- width="50">-->
  874. <!-- </el-table-column>-->
  875. <!-- <el-table-column-->
  876. <!-- v-for="(item,index) in componentPartColumnList" :key="index"-->
  877. <!-- :sortable="item.columnSortable"-->
  878. <!-- :prop="item.columnProp"-->
  879. <!-- :header-align="item.headerAlign"-->
  880. <!-- :show-overflow-tooltip="item.showOverflowTooltip"-->
  881. <!-- :align="item.align"-->
  882. <!-- :fixed="item.fixed==''?false:item.fixed"-->
  883. <!-- :min-width="item.columnWidth"-->
  884. <!-- :label="item.columnLabel">-->
  885. <!-- <template slot-scope="scope">-->
  886. <!-- <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>-->
  887. <!-- <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>-->
  888. <!-- </template>-->
  889. <!-- </el-table-column>-->
  890. <!-- </el-table>-->
  891. <!-- &lt;!&ndash; 分页插件 &ndash;&gt;-->
  892. <!-- <el-pagination-->
  893. <!-- @size-change="sizeChangeHandle5"-->
  894. <!-- @current-change="currentChangeHandle5"-->
  895. <!-- :current-page="pageIndex5"-->
  896. <!-- :page-sizes="[20, 50, 100, 200, 500]"-->
  897. <!-- :page-size="pageSize5"-->
  898. <!-- :total="totalPage5"-->
  899. <!-- layout="total, sizes, prev, pager, next, jumper">-->
  900. <!-- </el-pagination>-->
  901. <!-- <el-footer style="height:35px;margin-top:10px;text-align:center">-->
  902. <!-- <el-button type="primary" @click="batchComponentDataSave">保存</el-button>-->
  903. <!-- <el-button type="primary" @click="batchComponentPartModelFlag = false">关闭</el-button>-->
  904. <!-- </el-footer>-->
  905. <!-- </el-dialog>-->
  906. <!-- 默认库位-> 快速新增 -->
  907. <el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="batchComponentPartModelFlag" width="1170px">
  908. <div style="font-size: 12px">
  909. <el-form :inline="true" label-position="top" :model="batchComponentPartData">
  910. <el-form-item :label="'物料编码'">
  911. <el-input v-model="batchComponentPartData.partNo" clearable style="width: 120px"></el-input>
  912. </el-form-item>
  913. <el-form-item :label="'物料名称'">
  914. <el-input v-model="batchComponentPartData.partDesc" clearable style="width: 120px"></el-input>
  915. </el-form-item>
  916. <el-form-item :label="' '">
  917. <el-button type="primary" @click="queryBatchComponentPartList">查询</el-button>
  918. </el-form-item>
  919. <el-form-item :label="'损耗率%'" style="margin-left: 725px">
  920. <el-input-number :controls="false" :step="0" min="0" max="100" v-model="batchComponentPartData.shrinkageFactor" style="width: 80px"></el-input-number>
  921. </el-form-item>
  922. </el-form>
  923. </div>
  924. <el-container>
  925. <el-main style="width: 770px; padding: 1px">
  926. <span style="font-size: 12px" >可选物料</span>
  927. <el-table
  928. height="400px"
  929. :data="batchComponentPartList"
  930. border
  931. ref="batchSaveTable"
  932. @row-click="batchSaveClickRow"
  933. @selection-change="selectionSaveComponent"
  934. highlight-current-row
  935. style="width: 100%">
  936. <el-table-column
  937. type="selection"
  938. header-align="center"
  939. align="center"
  940. width="50">
  941. </el-table-column>
  942. <el-table-column
  943. v-for="(item,index) in componentPartColumnList" :key="index"
  944. :sortable="item.columnSortable"
  945. :prop="item.columnProp"
  946. :header-align="item.headerAlign"
  947. :show-overflow-tooltip="item.showOverflowTooltip"
  948. :align="item.align"
  949. :fixed="item.fixed==''?false:item.fixed"
  950. :min-width="item.columnWidth"
  951. :label="item.columnLabel">
  952. <template slot-scope="scope">
  953. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  954. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  955. </template>
  956. </el-table-column>
  957. </el-table>
  958. <!-- 分页插件 -->
  959. <el-pagination
  960. @size-change="sizeChangeHandle5"
  961. @current-change="currentChangeHandle5"
  962. :current-page="pageIndex5"
  963. :page-sizes="[20, 50, 100, 200, 500]"
  964. :page-size="pageSize5"
  965. :total="totalPage5"
  966. layout="total, sizes, prev, pager, next, jumper">
  967. </el-pagination>
  968. </el-main>
  969. <el-main style="width: 111px;padding: -1px">
  970. <div style="margin-top: 182px;margin-left: 5px">
  971. <el-button type="primary" @click="batchAddPart">添加>></el-button>
  972. </div>
  973. <div style="margin-top: 15px;margin-left: 5px">
  974. <el-button type="primary" @click="batchDeletePart">删除<<</el-button>
  975. </div>
  976. </el-main>
  977. <el-main style="width: 400px;padding: 1px">
  978. <span style="font-size: 12px" >已选物料</span>
  979. <el-table
  980. height="400px"
  981. :data="choosePartList"
  982. border
  983. ref="batchSaveTable2"
  984. @row-click="batchSaveClickRow2"
  985. @selection-change="selectionSaveComponent2"
  986. highlight-current-row
  987. style="width: 100%">
  988. <el-table-column
  989. type="selection"
  990. header-align="center"
  991. align="center"
  992. width="50">
  993. </el-table-column>
  994. <el-table-column
  995. prop="partNo"
  996. header-align="center"
  997. align="center"
  998. min-width="100"
  999. label="物料编码">
  1000. </el-table-column>
  1001. <el-table-column
  1002. prop="partDesc"
  1003. header-align="center"
  1004. align="center"
  1005. min-width="190"
  1006. label="物料名称">
  1007. </el-table-column>
  1008. </el-table>
  1009. </el-main>
  1010. </el-container>
  1011. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  1012. <el-button type="primary" @click="batchComponentDataSave">保存</el-button>
  1013. <el-button type="primary" @click="batchComponentPartModelFlag = false">关闭</el-button>
  1014. </el-footer>
  1015. </el-dialog>
  1016. <!-- 导入 -->
  1017. <bom-component-upload ref="BomComponentUpload" @refreshPageTables="queryBomComponentTable" v-drag></bom-component-upload>
  1018. <!-- chooseList模态框 -->
  1019. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  1020. </div>
  1021. </template>
  1022. <script>
  1023. import {
  1024. bomManagementSearch, // bom列表查询
  1025. bomManagementSave, // bom新增
  1026. bomManagementEdit, // bom编辑
  1027. bomManagementDelete, // bom删除
  1028. queryBomHeader, // 查询bom主信息
  1029. saveBomHeader, // 新增bom主信息
  1030. queryBomDetail, // 查bom明细
  1031. bomDetailSave, // bom明细新增
  1032. bomDetailUpdate, // bom明细编辑
  1033. bomDetailDelete, // bom明细删除
  1034. updateAlternativeStatus, // 修改明细状态
  1035. queryPartList, // 查询物料清单
  1036. queryPartListBom, // 查出可创建BOM的物料
  1037. queryBomComponent, // 查询bom子明细
  1038. saveBomComponent, // 新增bom子明细
  1039. updateBomComponent, // 修改bom子明细
  1040. deleteBomComponent, // 删除bom子明细
  1041. queryOperationList, // 根据物料编码查询工序
  1042. getComponentLineSequence, // 获取子料的序号
  1043. copyBom, // 复制bom
  1044. copyAlternative, // 复制alternative,
  1045. queryBomComponentTable, // 刷新子物料
  1046. getBomEngChgLevel, // 获取物料的BOM版本号
  1047. queryPartListAll, // 查询包含Purchase(Raw)的物料
  1048. batchSaveBomComponent, // 批量新增子件
  1049. exportWordOrPdf, // 导出word
  1050. computeQtyPerAssemblySave, // 计算单位用量(新增)
  1051. computeQtyPerAssemblyEdit, // 计算单位用量(修改)
  1052. } from '@/api/part/bomManagement.js'
  1053. import {getSiteAndBuByUserName, getSiteAndBuByUserName2} from "@/api/qc/qc.js"
  1054. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  1055. import ChooseList from '@/views/modules/common/Chooselist_eam'
  1056. import BomComponentUpload from "./bom_component_upload.vue";
  1057. import {Decimal} from "decimal.js";
  1058. import {updateColumnSize} from "../../../api/table";
  1059. export default {
  1060. // 组件
  1061. components: {
  1062. BomComponentUpload,
  1063. ChooseList
  1064. },
  1065. // 监听
  1066. watch: {
  1067. searchData: {
  1068. deep: true,
  1069. handler: function (newV, oldV) {
  1070. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  1071. }
  1072. },
  1073. modalData: {
  1074. deep: true,
  1075. handler: function (newV, oldV) {
  1076. this.modalData.partNo = this.modalData.partNo.toUpperCase()
  1077. }
  1078. },
  1079. saveDetailData: {
  1080. deep: true,
  1081. handler: function (newV, oldV) {
  1082. this.saveDetailData.alternativeNo = this.saveDetailData.alternativeNo.toUpperCase()
  1083. }
  1084. },
  1085. componentData: {
  1086. deep: true,
  1087. handler: function (newV, oldV) {
  1088. this.componentData.componentPart = this.componentData.componentPart.toUpperCase()
  1089. }
  1090. },
  1091. copyBomData: {
  1092. deep: true,
  1093. handler: function (newV, oldV) {
  1094. this.copyBomData.partNo = this.copyBomData.partNo.toUpperCase()
  1095. }
  1096. },
  1097. copyAlternativeData: {
  1098. deep: true,
  1099. handler: function (newV, oldV) {
  1100. this.copyAlternativeData.partNo = this.copyAlternativeData.partNo.toUpperCase()
  1101. }
  1102. },
  1103. // partData: {
  1104. // deep: true,
  1105. // handler: function (newV, oldV) {
  1106. // this.partData.partNo = this.partData.partNo.toUpperCase()
  1107. // }
  1108. // }
  1109. },
  1110. // 对象
  1111. data () {
  1112. return {
  1113. // 导出
  1114. exportData: [],
  1115. exportName: 'BOM物料列表' + this.dayjs().format('YYYYMMDDHHmmss'),
  1116. exportHeader: ['BOM物料列表'],
  1117. exportFooter: [],
  1118. resultList: [],
  1119. userBuList: [],
  1120. buList: [],
  1121. // ======== 行高 ========
  1122. height: 200,
  1123. // ======== 分页 ========
  1124. pageIndex: 1,
  1125. pageSize: 50,
  1126. totalPage: 0,
  1127. pageIndex2: 1,
  1128. pageSize2: 20,
  1129. totalPage2: 0,
  1130. pageIndex3: 1,
  1131. pageSize3: 20,
  1132. totalPage3: 0,
  1133. pageIndex4: 1,
  1134. pageSize4: 20,
  1135. totalPage4: 0,
  1136. pageIndex5: 1,
  1137. pageSize5: 20,
  1138. totalPage5: 0,
  1139. selectedDataNum: 0,
  1140. // 条件查询
  1141. searchData: {
  1142. site: '',
  1143. buNo: '',
  1144. userName: this.$store.state.user.name,
  1145. partNo: '',
  1146. partDesc: '',
  1147. bomType: '',
  1148. engChgLevel: '',
  1149. status: '',
  1150. page: 1,
  1151. limit: 10
  1152. },
  1153. // loading
  1154. saveHeaderLoading: false,
  1155. saveDetailLoading: false,
  1156. saveAllLoading: false,
  1157. copyLoading: false,
  1158. alternativeLoading: false,
  1159. computeLoading: false,
  1160. // 初始页签
  1161. detailTable: 'bom_detail',
  1162. subDetailTable: 'bom_sub_detail',
  1163. // ======== 数据对象 ========
  1164. modalData: {
  1165. flag: '',
  1166. title: '',
  1167. bu: '',
  1168. site: '',
  1169. buNo: '',
  1170. partNo: '',
  1171. partDesc: '',
  1172. engChgLevel: '',
  1173. bomType: '',
  1174. noteText: '',
  1175. effPhaseInDate: '',
  1176. effPhaseOutDate: '',
  1177. engRevision: '',
  1178. typeFlag: '',
  1179. netWeight: '',
  1180. createDate: '',
  1181. createBy: '',
  1182. updateDate: '',
  1183. updateBy: '',
  1184. printUnit: '',
  1185. printUnitName: '',
  1186. yieldRate: '',
  1187. shrinkageFactor: '',
  1188. processUnit: '',
  1189. processUnitName: ''
  1190. },
  1191. detailData: {
  1192. site: this.$store.state.user.site,
  1193. partNo: '',
  1194. engChgLevel: '',
  1195. bomType: '',
  1196. alternativeNo: '',
  1197. alternativeDescription: '',
  1198. minLotQty: '',
  1199. defaultFlag: '',
  1200. detailNoteText: '',
  1201. status: '',
  1202. createDate: '',
  1203. createBy: '',
  1204. updateDate: '',
  1205. updateBy: '',
  1206. },
  1207. componentData: {
  1208. flag: '',
  1209. site: this.$store.state.user.site,
  1210. partNo: '',
  1211. engChgLevel: '',
  1212. bomType: '',
  1213. alternativeNo: '',
  1214. componentPart: '',
  1215. componentPartDesc: '',
  1216. printUnit: '',
  1217. printUnitName: '',
  1218. qtyPerAssembly: '',
  1219. componentScrap: '',
  1220. issueType: '',
  1221. shrinkageFactor: '',
  1222. lineItemNo: '',
  1223. operationId: '',
  1224. operationNo: '',
  1225. issueToLoc: '',
  1226. issueToLocName: '',
  1227. noteText: '',
  1228. createDate: '',
  1229. createBy: '',
  1230. updateDate: '',
  1231. updateBy: '',
  1232. lineSequence: '',
  1233. consumptionItem: '',
  1234. productFlag: '',
  1235. familyID: '',
  1236. productionData: undefined,
  1237. materialData: undefined,
  1238. finishedProductData: undefined,
  1239. consumptionLoss: undefined,
  1240. coatingLength: undefined,
  1241. glueWeight: undefined,
  1242. materialWidth: undefined,
  1243. widthConversion: undefined,
  1244. materialLength: undefined,
  1245. materialThickness: undefined,
  1246. areaConversion: undefined,
  1247. densityConversion: undefined,
  1248. materialWeight: undefined,
  1249. materialLength2: undefined,
  1250. unitConversion: undefined
  1251. },
  1252. partData: {
  1253. site: '',
  1254. buNo: '',
  1255. partNo: '',
  1256. partDesc: '',
  1257. page: 1,
  1258. limit: 10
  1259. },
  1260. componentPartData: {
  1261. site: '',
  1262. buNo: '',
  1263. partNo: '',
  1264. partDesc: '',
  1265. page: 1,
  1266. limit: 10
  1267. },
  1268. batchComponentPartData: {
  1269. site: '',
  1270. buNo: '',
  1271. partNo: '',
  1272. partDesc: '',
  1273. shrinkageFactor: '',
  1274. page: 1,
  1275. limit: 10
  1276. },
  1277. copyPartData: {
  1278. type: '',
  1279. site: '',
  1280. buNo: '',
  1281. partNo: '',
  1282. partDesc: '',
  1283. page: 1,
  1284. limit: 10
  1285. },
  1286. saveDetailData: {
  1287. flag: '',
  1288. site: this.$store.state.user.site,
  1289. partNo: '',
  1290. engChgLevel: '',
  1291. bomType: '',
  1292. alternativeNo: '',
  1293. alternativeDescription: '',
  1294. minLotQty: '',
  1295. defaultFlag: '',
  1296. detailNoteText: '',
  1297. status: '',
  1298. createDate: '',
  1299. createBy: '',
  1300. updateDate: '',
  1301. updateBy: '',
  1302. },
  1303. operationData: {
  1304. site: '',
  1305. buNo: '',
  1306. partNo: '',
  1307. routingRevision: '',
  1308. routingType: '',
  1309. alternativeNo: '',
  1310. operationNo: '',
  1311. operationName: '',
  1312. },
  1313. copyBomData: {
  1314. site: '',
  1315. buNo: '',
  1316. partNo: '',
  1317. partDesc: '',
  1318. engChgLevel: '',
  1319. bomType: '',
  1320. effPhaseInDate: '',
  1321. effPhaseOutDate: '',
  1322. previousVersion: {},
  1323. createBy: '',
  1324. },
  1325. copyAlternativeData: {
  1326. site: '',
  1327. partNo: '',
  1328. partDesc: '',
  1329. engChgLevel: '',
  1330. bomType: '',
  1331. alternativeNo: '',
  1332. alternativeDescription: '',
  1333. minLotQty: '',
  1334. defaultFlag: '',
  1335. detailNoteText: '',
  1336. status: '',
  1337. previousVersion: {},
  1338. createBy: '',
  1339. },
  1340. // ======== 数据列表 ========
  1341. dataList: [],
  1342. partList: [],
  1343. componentPartList: [],
  1344. batchComponentPartList: [],
  1345. copyPartList: [],
  1346. componentPartSelections: [],
  1347. subDetailList: [],
  1348. detailDataList: [],
  1349. checkedDetail: [],
  1350. checkedByProduct: [],
  1351. operationList: [],
  1352. choosePartList: [],
  1353. // ======== 列表表头 ========
  1354. columnList: [
  1355. {
  1356. userId: this.$store.state.user.name,
  1357. functionId: 601002,
  1358. serialNumber: '601002Table1Bu',
  1359. tableId: '601002Table1',
  1360. tableName: 'BOM信息表',
  1361. columnProp: 'buDesc',
  1362. headerAlign: 'center',
  1363. align: 'center',
  1364. columnLabel: 'BU',
  1365. columnHidden: false,
  1366. columnImage: false,
  1367. columnSortable: false,
  1368. sortLv: 0,
  1369. status: true,
  1370. fixed: '',
  1371. columnWidth: 100
  1372. },
  1373. {
  1374. userId: this.$store.state.user.name,
  1375. functionId: 601002,
  1376. serialNumber: '601002Table1PartNo',
  1377. tableId: '601002Table1',
  1378. tableName: 'BOM信息表',
  1379. columnProp: 'partNo',
  1380. headerAlign: 'center',
  1381. align: 'center',
  1382. columnLabel: '物料编码',
  1383. columnHidden: false,
  1384. columnImage: false,
  1385. columnSortable: false,
  1386. sortLv: 0,
  1387. status: true,
  1388. fixed: '',
  1389. columnWidth: 120
  1390. },
  1391. {
  1392. userId: this.$store.state.user.name,
  1393. functionId: 601002,
  1394. serialNumber: '601002Table1PartDesc',
  1395. tableId: '601002Table1',
  1396. tableName: 'BOM信息表',
  1397. columnProp: 'partDesc',
  1398. headerAlign: 'center',
  1399. align: 'center',
  1400. columnLabel: '物料名称',
  1401. columnHidden: false,
  1402. columnImage: false,
  1403. columnSortable: false,
  1404. sortLv: 0,
  1405. status: true,
  1406. fixed: '',
  1407. columnWidth: 300
  1408. },
  1409. {
  1410. userId: this.$store.state.user.name,
  1411. functionId: 601002,
  1412. serialNumber: '601002Table1BomType',
  1413. tableId: '601002Table1',
  1414. tableName: 'BOM信息表',
  1415. columnProp: 'bomType',
  1416. headerAlign: 'center',
  1417. align: 'center',
  1418. columnLabel: '制造类型',
  1419. columnHidden: false,
  1420. columnImage: false,
  1421. columnSortable: false,
  1422. sortLv: 0,
  1423. status: true,
  1424. fixed: '',
  1425. columnWidth: 120
  1426. },
  1427. {
  1428. userId: this.$store.state.user.name,
  1429. functionId: 601002,
  1430. serialNumber: '601002Table1EngChgLevel',
  1431. tableId: '601002Table1',
  1432. tableName: 'BOM信息表',
  1433. columnProp: 'engChgLevel',
  1434. headerAlign: 'center',
  1435. align: 'center',
  1436. columnLabel: 'BOM版本号',
  1437. columnHidden: false,
  1438. columnImage: false,
  1439. columnSortable: false,
  1440. sortLv: 0,
  1441. status: true,
  1442. fixed: '',
  1443. columnWidth: 80
  1444. },
  1445. {
  1446. userId: this.$store.state.user.name,
  1447. functionId: 601002,
  1448. serialNumber: '601002Table1engRevision',
  1449. tableId: '601002Table1',
  1450. tableName: 'BOM信息表',
  1451. columnProp: 'engRevision',
  1452. headerAlign: 'center',
  1453. align: 'center',
  1454. columnLabel: '工程版本号',
  1455. columnHidden: false,
  1456. columnImage: false,
  1457. columnSortable: false,
  1458. sortLv: 0,
  1459. status: true,
  1460. fixed: '',
  1461. columnWidth: 100
  1462. },
  1463. {
  1464. userId: this.$store.state.user.name,
  1465. functionId: 601002,
  1466. serialNumber: '601002Table1NetWeight',
  1467. tableId: '601002Table1',
  1468. tableName: 'BOM信息表',
  1469. columnProp: 'netWeight',
  1470. headerAlign: 'center',
  1471. align: 'right',
  1472. columnLabel: '净重',
  1473. columnHidden: false,
  1474. columnImage: false,
  1475. columnSortable: false,
  1476. sortLv: 0,
  1477. status: true,
  1478. fixed: '',
  1479. columnWidth: 80
  1480. },
  1481. {
  1482. userId: this.$store.state.user.name,
  1483. functionId: 601002,
  1484. serialNumber: '601002Table1EffPhaseInDate',
  1485. tableId: '601002Table1',
  1486. tableName: 'BOM信息表',
  1487. columnProp: 'effPhaseInDate',
  1488. headerAlign: 'center',
  1489. align: 'center',
  1490. columnLabel: '生效日期',
  1491. columnHidden: false,
  1492. columnImage: false,
  1493. columnSortable: false,
  1494. sortLv: 0,
  1495. status: true,
  1496. fixed: '',
  1497. columnWidth: 130
  1498. },
  1499. {
  1500. userId: this.$store.state.user.name,
  1501. functionId: 601002,
  1502. serialNumber: '601002Table1EffPhaseOutDate',
  1503. tableId: '601002Table1',
  1504. tableName: 'BOM信息表',
  1505. columnProp: 'effPhaseOutDate',
  1506. headerAlign: 'center',
  1507. align: 'center',
  1508. columnLabel: '失效日期',
  1509. columnHidden: false,
  1510. columnImage: false,
  1511. columnSortable: false,
  1512. sortLv: 0,
  1513. status: true,
  1514. fixed: '',
  1515. columnWidth: 130
  1516. },
  1517. {
  1518. userId: this.$store.state.user.name,
  1519. functionId: 601002,
  1520. serialNumber: '601002Table1CreateDate',
  1521. tableId: '601002Table1',
  1522. tableName: 'BOM信息表',
  1523. columnProp: 'createDate',
  1524. headerAlign: 'center',
  1525. align: 'center',
  1526. columnLabel: '创建时间',
  1527. columnHidden: false,
  1528. columnImage: false,
  1529. columnSortable: false,
  1530. sortLv: 0,
  1531. status: true,
  1532. fixed: '',
  1533. columnWidth: 130
  1534. },
  1535. {
  1536. userId: this.$store.state.user.name,
  1537. functionId: 601002,
  1538. serialNumber: '601002Table1CreateBy',
  1539. tableId: '601002Table1',
  1540. tableName: 'BOM信息表',
  1541. columnProp: 'createBy',
  1542. headerAlign: 'center',
  1543. align: 'center',
  1544. columnLabel: '创建人',
  1545. columnHidden: false,
  1546. columnImage: false,
  1547. columnSortable: false,
  1548. sortLv: 0,
  1549. status: true,
  1550. fixed: '',
  1551. columnWidth: 100
  1552. },
  1553. {
  1554. userId: this.$store.state.user.name,
  1555. functionId: 601002,
  1556. serialNumber: '601002Table1UpdateDate',
  1557. tableId: '601002Table1',
  1558. tableName: 'BOM信息表',
  1559. columnProp: 'updateDate',
  1560. headerAlign: 'center',
  1561. align: 'center',
  1562. columnLabel: '更新时间',
  1563. columnHidden: false,
  1564. columnImage: false,
  1565. columnSortable: false,
  1566. sortLv: 0,
  1567. status: true,
  1568. fixed: '',
  1569. columnWidth: 130
  1570. },
  1571. {
  1572. userId: this.$store.state.user.name,
  1573. functionId: 601002,
  1574. serialNumber: '601002Table1UpdateBy',
  1575. tableId: '601002Table1',
  1576. tableName: 'BOM信息表',
  1577. columnProp: 'updateBy',
  1578. headerAlign: 'center',
  1579. align: 'center',
  1580. columnLabel: '更新人',
  1581. columnHidden: false,
  1582. columnImage: false,
  1583. columnSortable: false,
  1584. sortLv: 0,
  1585. status: true,
  1586. fixed: '',
  1587. columnWidth: 100
  1588. }
  1589. ],
  1590. partColumnList: [
  1591. {
  1592. columnProp: 'partNo',
  1593. headerAlign: "center",
  1594. align: "center",
  1595. columnLabel: '物料编码',
  1596. columnHidden: false,
  1597. columnImage: false,
  1598. columnSortable: false,
  1599. sortLv: 0,
  1600. status: true,
  1601. fixed: '',
  1602. columnWidth: 120
  1603. },
  1604. {
  1605. columnProp: 'partDesc',
  1606. headerAlign: "center",
  1607. align: "center",
  1608. columnLabel: '物料名称',
  1609. columnHidden: false,
  1610. columnImage: false,
  1611. status: true,
  1612. fixed: '',
  1613. columnWidth: 300
  1614. },
  1615. {
  1616. columnProp: 'spec',
  1617. headerAlign: "center",
  1618. align: "center",
  1619. columnLabel: '规格型号',
  1620. columnHidden: false,
  1621. columnImage: false,
  1622. status: true,
  1623. fixed: '',
  1624. columnWidth: 300
  1625. },
  1626. {
  1627. columnProp: 'printUnitName',
  1628. headerAlign: "center",
  1629. align: "center",
  1630. columnLabel: '计量单位',
  1631. columnHidden: false,
  1632. columnImage: false,
  1633. status: true,
  1634. fixed: '',
  1635. columnWidth: 100
  1636. },
  1637. {
  1638. columnProp: 'partType2',
  1639. headerAlign: "center",
  1640. align: "center",
  1641. columnLabel: '零件类型',
  1642. columnHidden: false,
  1643. columnImage: false,
  1644. status: true,
  1645. fixed: '',
  1646. columnWidth: 100
  1647. },
  1648. {
  1649. columnProp: 'yieldRate',
  1650. headerAlign: "center",
  1651. align: "right",
  1652. columnLabel: '良品率',
  1653. columnHidden: false,
  1654. columnImage: false,
  1655. status: true,
  1656. fixed: '',
  1657. columnWidth: 100
  1658. },
  1659. ],
  1660. componentPartColumnList: [
  1661. {
  1662. columnProp: 'partNo',
  1663. headerAlign: "center",
  1664. align: "center",
  1665. columnLabel: '物料编码',
  1666. columnHidden: false,
  1667. columnImage: false,
  1668. status: true,
  1669. fixed: '',
  1670. columnWidth: 120
  1671. },
  1672. {
  1673. columnProp: 'partDesc',
  1674. headerAlign: "center",
  1675. align: "center",
  1676. columnLabel: '物料名称',
  1677. columnHidden: false,
  1678. columnImage: false,
  1679. status: true,
  1680. fixed: '',
  1681. columnWidth: 300
  1682. },
  1683. {
  1684. columnProp: 'spec',
  1685. headerAlign: "center",
  1686. align: "center",
  1687. columnLabel: '规格型号',
  1688. columnHidden: false,
  1689. columnImage: false,
  1690. status: true,
  1691. fixed: '',
  1692. columnWidth: 300
  1693. },
  1694. {
  1695. columnProp: 'printUnitName',
  1696. headerAlign: "center",
  1697. align: "center",
  1698. columnLabel: '计量单位',
  1699. columnHidden: false,
  1700. columnImage: false,
  1701. status: true,
  1702. fixed: '',
  1703. columnWidth: 100
  1704. },
  1705. {
  1706. columnProp: 'partType2',
  1707. headerAlign: "center",
  1708. align: "center",
  1709. columnLabel: '零件类型',
  1710. columnHidden: false,
  1711. columnImage: false,
  1712. status: true,
  1713. fixed: '',
  1714. columnWidth: 100
  1715. }
  1716. ],
  1717. columnSubDetailList1: [
  1718. {
  1719. userId: this.$store.state.user.name,
  1720. functionId: 601002,
  1721. serialNumber: '601002Table2LineSequence',
  1722. tableId: '601002Table2',
  1723. tableName: 'BOM子物料表',
  1724. columnProp: 'lineSequence',
  1725. headerAlign: 'center',
  1726. align: 'center',
  1727. columnLabel: '序号',
  1728. columnHidden: false,
  1729. columnImage: false,
  1730. columnSortable: false,
  1731. sortLv: 0,
  1732. status: true,
  1733. fixed: '',
  1734. columnWidth: 50
  1735. },
  1736. {
  1737. userId: this.$store.state.user.name,
  1738. functionId: 601002,
  1739. serialNumber: '601002Table2ComponentPart',
  1740. tableId: '601002Table2',
  1741. tableName: 'BOM子物料表',
  1742. columnProp: 'componentPart',
  1743. headerAlign: 'center',
  1744. align: 'left',
  1745. columnLabel: '物料编码',
  1746. columnHidden: false,
  1747. columnImage: false,
  1748. columnSortable: false,
  1749. sortLv: 0,
  1750. status: true,
  1751. fixed: '',
  1752. columnWidth: 120
  1753. },
  1754. {
  1755. userId: this.$store.state.user.name,
  1756. functionId: 601002,
  1757. serialNumber: '601002Table2ComponentPartDesc',
  1758. tableId: '601002Table2',
  1759. tableName: 'BOM子物料表',
  1760. columnProp: 'componentPartDesc',
  1761. headerAlign: 'center',
  1762. align: 'left',
  1763. columnLabel: '物料名称',
  1764. columnHidden: false,
  1765. columnImage: false,
  1766. columnSortable: false,
  1767. sortLv: 0,
  1768. status: true,
  1769. fixed: '',
  1770. columnWidth: 300
  1771. },
  1772. ],
  1773. columnSubDetailList2: [
  1774. {
  1775. userId: this.$store.state.user.name,
  1776. functionId: 601002,
  1777. serialNumber: '601002Table2ConsumptionItem',
  1778. tableId: '601002Table2',
  1779. tableName: 'BOM子物料表',
  1780. columnProp: 'consumptionItem',
  1781. headerAlign: 'center',
  1782. align: 'center',
  1783. columnLabel: '消耗项目',
  1784. columnHidden: false,
  1785. columnImage: false,
  1786. columnSortable: false,
  1787. sortLv: 0,
  1788. status: true,
  1789. fixed: '',
  1790. columnWidth: 80
  1791. },
  1792. {
  1793. userId: this.$store.state.user.name,
  1794. functionId: 601002,
  1795. serialNumber: '601002Table2PrintUnitName',
  1796. tableId: '601002Table2',
  1797. tableName: 'BOM子物料表',
  1798. columnProp: 'printUnitName',
  1799. headerAlign: 'center',
  1800. align: 'center',
  1801. columnLabel: '物料单位',
  1802. columnHidden: false,
  1803. columnImage: false,
  1804. columnSortable: false,
  1805. sortLv: 0,
  1806. status: true,
  1807. fixed: '',
  1808. columnWidth: 60
  1809. },
  1810. {
  1811. userId: this.$store.state.user.name,
  1812. functionId: 601002,
  1813. serialNumber: '601002Table2IssueType',
  1814. tableId: '601002Table2',
  1815. tableName: 'BOM子物料表',
  1816. columnProp: 'issueType',
  1817. headerAlign: 'center',
  1818. align: 'center',
  1819. columnLabel: '生产属性',
  1820. columnHidden: false,
  1821. columnImage: false,
  1822. columnSortable: false,
  1823. sortLv: 0,
  1824. status: true,
  1825. fixed: '',
  1826. columnWidth: 140
  1827. },
  1828. {
  1829. userId: this.$store.state.user.name,
  1830. functionId: 601002,
  1831. serialNumber: '601002Table2OperationDesc',
  1832. tableId: '601002Table2',
  1833. tableName: 'BOM子物料表',
  1834. columnProp: 'operationNo',
  1835. headerAlign: 'center',
  1836. align: 'center',
  1837. columnLabel: '工序',
  1838. columnHidden: false,
  1839. columnImage: false,
  1840. columnSortable: false,
  1841. sortLv: 0,
  1842. status: true,
  1843. fixed: '',
  1844. columnWidth: 80
  1845. },
  1846. {
  1847. userId: this.$store.state.user.name,
  1848. functionId: 601002,
  1849. serialNumber: '601002Table2IssueToLoc',
  1850. tableId: '601002Table2',
  1851. tableName: 'BOM子物料表',
  1852. columnProp: 'issueToLocName',
  1853. headerAlign: 'center',
  1854. align: 'center',
  1855. columnLabel: '发料库位',
  1856. columnHidden: false,
  1857. columnImage: false,
  1858. columnSortable: false,
  1859. sortLv: 0,
  1860. status: true,
  1861. fixed: '',
  1862. columnWidth: 80
  1863. },
  1864. {
  1865. userId: this.$store.state.user.name,
  1866. functionId: 601002,
  1867. serialNumber: '601002Table2NoteText',
  1868. tableId: '601002Table2',
  1869. tableName: 'BOM子物料表',
  1870. columnProp: 'noteText',
  1871. headerAlign: 'center',
  1872. align: 'center',
  1873. columnLabel: '备注',
  1874. columnHidden: false,
  1875. columnImage: false,
  1876. columnSortable: false,
  1877. sortLv: 0,
  1878. status: true,
  1879. fixed: '',
  1880. columnWidth: 150
  1881. },
  1882. ],
  1883. operationDetailList: [
  1884. {
  1885. columnProp: 'routingRevision',
  1886. headerAlign: "center",
  1887. align: "center",
  1888. columnLabel: 'Routing版本号',
  1889. columnHidden: false,
  1890. columnImage: false,
  1891. status: true,
  1892. fixed: '',
  1893. columnWidth: 100
  1894. },
  1895. {
  1896. columnProp: 'routingType',
  1897. headerAlign: "center",
  1898. align: "center",
  1899. columnLabel: '工艺类型',
  1900. columnHidden: false,
  1901. columnImage: false,
  1902. status: true,
  1903. fixed: '',
  1904. columnWidth: 100
  1905. },
  1906. {
  1907. columnProp: 'alternativeNo',
  1908. headerAlign: "center",
  1909. align: "center",
  1910. columnLabel: '替代编码',
  1911. columnHidden: false,
  1912. columnImage: false,
  1913. status: true,
  1914. fixed: '',
  1915. columnWidth: 80
  1916. },
  1917. {
  1918. columnProp: 'alternativeDescription',
  1919. headerAlign: "center",
  1920. align: "center",
  1921. columnLabel: '替代名称',
  1922. columnHidden: false,
  1923. columnImage: false,
  1924. status: true,
  1925. fixed: '',
  1926. columnWidth: 100
  1927. },
  1928. {
  1929. columnProp: 'status',
  1930. headerAlign: "center",
  1931. align: "center",
  1932. columnLabel: '替代状态',
  1933. columnHidden: false,
  1934. columnImage: false,
  1935. status: true,
  1936. fixed: '',
  1937. columnWidth: 80
  1938. },
  1939. {
  1940. columnProp: 'operationNo',
  1941. headerAlign: "center",
  1942. align: "center",
  1943. columnLabel: '工序编码',
  1944. columnHidden: false,
  1945. columnImage: false,
  1946. status: true,
  1947. fixed: '',
  1948. columnWidth: 80
  1949. },
  1950. {
  1951. columnProp: 'operationName',
  1952. headerAlign: "center",
  1953. align: "center",
  1954. columnLabel: '工序名称',
  1955. columnHidden: false,
  1956. columnImage: false,
  1957. status: true,
  1958. fixed: '',
  1959. columnWidth: 100
  1960. }
  1961. ],
  1962. columnBomDetailList: [
  1963. {
  1964. columnProp: 'alternativeNo',
  1965. headerAlign: "center",
  1966. align: "center",
  1967. columnLabel: '替代编码',
  1968. columnHidden: false,
  1969. columnImage: false,
  1970. status: true,
  1971. fixed: '',
  1972. columnWidth: 100
  1973. },
  1974. {
  1975. columnProp: 'alternativeDescription',
  1976. headerAlign: "center",
  1977. align: "center",
  1978. columnLabel: '替代名称',
  1979. columnHidden: false,
  1980. columnImage: false,
  1981. status: true,
  1982. fixed: '',
  1983. columnWidth: 200
  1984. },
  1985. {
  1986. columnProp: 'status',
  1987. headerAlign: "center",
  1988. align: "center",
  1989. columnLabel: '状态',
  1990. columnHidden: false,
  1991. columnImage: false,
  1992. status: true,
  1993. fixed: '',
  1994. columnWidth: 100
  1995. },
  1996. ],
  1997. // ======== 必填规则 ========
  1998. rules: {
  1999. partNo: [
  2000. {
  2001. required: true,
  2002. message: ' ',
  2003. trigger: ['blur','change']
  2004. }
  2005. ],
  2006. partDesc: [
  2007. {
  2008. required: true,
  2009. message: ' ',
  2010. trigger: ['blur','change']
  2011. }
  2012. ],
  2013. bomType: [
  2014. {
  2015. required: true,
  2016. message: ' ',
  2017. trigger: ['blur','change']
  2018. }
  2019. ],
  2020. effPhaseInDate: [
  2021. {
  2022. required: true,
  2023. message: ' ',
  2024. trigger: ['blur','change']
  2025. }
  2026. ],
  2027. engChgLevel: [
  2028. {
  2029. required: true,
  2030. message: ' ',
  2031. trigger: ['blur','change']
  2032. }
  2033. ],
  2034. processUnit: [
  2035. {
  2036. required: true,
  2037. message: ' ',
  2038. trigger: ['blur','change']
  2039. }
  2040. ]
  2041. },
  2042. detailRules: {
  2043. alternativeNo: [
  2044. {
  2045. required: true,
  2046. message: ' ',
  2047. trigger: ['blur','change']
  2048. }
  2049. ],
  2050. alternativeDescription: [
  2051. {
  2052. required: true,
  2053. message: ' ',
  2054. trigger: ['blur','change']
  2055. }
  2056. ],
  2057. minLotQty: [
  2058. {
  2059. required: true,
  2060. message: ' ',
  2061. trigger: ['blur','change']
  2062. }
  2063. ],
  2064. status: [
  2065. {
  2066. required: true,
  2067. message: ' ',
  2068. trigger: ['blur','change']
  2069. }
  2070. ]
  2071. },
  2072. componentRules: {
  2073. componentPart: [
  2074. {
  2075. required: true,
  2076. message: ' ',
  2077. trigger: ['blur','change']
  2078. }
  2079. ],
  2080. lineSequence: [
  2081. {
  2082. required: true,
  2083. message: ' ',
  2084. trigger: ['blur','change']
  2085. }
  2086. ],
  2087. qtyPerAssembly: [
  2088. {
  2089. required: true,
  2090. message: ' ',
  2091. trigger: ['blur','change']
  2092. }
  2093. ],
  2094. componentScrap: [
  2095. {
  2096. required: true,
  2097. message: ' ',
  2098. trigger: ['blur','change']
  2099. }
  2100. ],
  2101. shrinkageFactor: [
  2102. {
  2103. required: true,
  2104. message: ' ',
  2105. trigger: ['blur','change']
  2106. }
  2107. ],
  2108. issueType: [
  2109. {
  2110. required: true,
  2111. message: ' ',
  2112. trigger: ['blur','change']
  2113. }
  2114. ],
  2115. consumptionItem: [
  2116. {
  2117. required: true,
  2118. message: ' ',
  2119. trigger: ['blur','change']
  2120. }
  2121. ]
  2122. },
  2123. // ======== 复选数据集 ========
  2124. bomSelections: [],
  2125. batchComponentSelections: [],
  2126. batchComponentSelections2: [],
  2127. // ======== 模态框开关控制 ========
  2128. authSearch: false,
  2129. authSave: false,
  2130. authUpdate: false,
  2131. authDelete: false,
  2132. modalFlag: false,
  2133. modalDisableFlag: false,
  2134. partModelFlag: false,
  2135. componentPartModelFlag: false,
  2136. copyPartModelFlag: false,
  2137. saveDetailModalFlag :false,
  2138. saveDetailModalDisable: false,
  2139. componentSaveModal: false,
  2140. componentDisableFlag: false,
  2141. operationModelFlag: false,
  2142. copyBomModelFlag: false,
  2143. copyAlternativeModelFlag: false,
  2144. headerSaveFlag: false,
  2145. menuId: this.$route.meta.menuId,
  2146. batchComponentPartModelFlag: false,
  2147. // ======== 子物料字段分类集合 ========
  2148. productionDataFamily: ['RFID003', 'RFID004', 'RFID005', 'RFID006', 'RFID007', 'RFID008', 'RFID009', 'RFID012', 'RFID023', 'RFID024', 'RFID025', 'RFID027'],
  2149. materialDataFamily: ['RFID011', 'RFID020', 'RFID021', 'RFID022'],
  2150. finishedProductDataFamily: ['RFID020', 'RFID021', 'RFID022'],
  2151. consumptionLossFamily: ['RFID001', 'RFID002', 'RFID014', 'RFID015', 'RFID016', 'RFID017', 'RFID018', 'RFID019'],
  2152. coatingLengthFamily: ['RFID013'],
  2153. glueWeightFamily: ['RFID013'],
  2154. materialWidthFamily: ['RFID014', 'RFID015'],
  2155. widthConversionFamily: ['RFID014', 'RFID015'],
  2156. materialLengthFamily: ['RFID016', 'RFID017'],
  2157. materialThicknessFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
  2158. areaConversionFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
  2159. densityConversionFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
  2160. materialWeightFamily: ['RFID018', 'RFID019'],
  2161. materialLength2Family: ['RFID018', 'RFID019'],
  2162. unitConversionFamily: ['RFID018', 'RFID019'],
  2163. }
  2164. },
  2165. mounted () {
  2166. this.$nextTick(() => {
  2167. this.height = window.innerHeight - 170
  2168. })
  2169. },
  2170. created () {
  2171. // 按钮控制
  2172. this.getButtonAuthData()
  2173. // 获取用户的 site 和 bu
  2174. this.getSiteAndBuByUserName()
  2175. // 获取用户的 site 和 bu
  2176. this.getSiteAndBuByUserName2()
  2177. // 动态列
  2178. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  2179. if (!this.authSearch) {
  2180. // 获取数据列表
  2181. this.getDataList()
  2182. }
  2183. },
  2184. activated () {
  2185. if (!this.authSearch) {
  2186. if (this.$route.params.type === 'quote'){
  2187. this.searchData.partNo = this.$route.params.partNo
  2188. this.searchData.bomType = this.$route.params.bomType
  2189. this.searchData.engChgLevel = this.$route.params.engChgLevel
  2190. }else if (this.$route.params.partNo) {
  2191. this.searchData.partNo = this.$route.params.partNo
  2192. }
  2193. this.getDataList()
  2194. } else {
  2195. this.$message.warning('无操作权限!')
  2196. }
  2197. },
  2198. methods: {
  2199. handleColumnResize(newWidth, oldWidth, column, event){
  2200. let inData= this.columnList.filter(item => item.columnProp === column.property)[0]
  2201. inData.columnWidth=newWidth
  2202. updateColumnSize(inData).then(({data}) => {
  2203. if (data.code === 0) {
  2204. console.log("栏位宽度保存成功!")
  2205. }
  2206. })
  2207. },
  2208. // 导出word
  2209. exportWordOrPdf () {
  2210. let tempData = {
  2211. isPdf: true,
  2212. code: '123'
  2213. }
  2214. exportWordOrPdf(tempData).then(({data}) => {
  2215. // 不限制文件下载类型
  2216. const blob = new Blob([data], {type: "application/octet-stream"})
  2217. // 下载文件名称
  2218. const fileName = tempData.isPdf ? tempData.code + '.pdf' : tempData.code + '.doc'
  2219. // a标签下载
  2220. const linkNode = document.createElement('a')
  2221. // a标签的download属性规定下载文件的名称
  2222. linkNode.download = fileName
  2223. linkNode.style.display = 'none'
  2224. // 生成一个Blob URL
  2225. linkNode.href = URL.createObjectURL(blob)
  2226. document.body.appendChild(linkNode)
  2227. // 模拟在按钮上的一次鼠标单击
  2228. linkNode.click()
  2229. // 释放URL 对象
  2230. URL.revokeObjectURL(linkNode.href)
  2231. document.body.removeChild(linkNode)
  2232. })
  2233. },
  2234. // bu改变事件
  2235. userBuChange () {
  2236. this.modalData.site = this.modalData.bu.split('_')[0]
  2237. this.modalData.buNo = this.modalData.bu.split('_')[1]
  2238. },
  2239. // 获取用户的bu
  2240. getSiteAndBuByUserName () {
  2241. let tempData = {
  2242. username: this.$store.state.user.name,
  2243. }
  2244. getSiteAndBuByUserName(tempData).then(({data}) => {
  2245. if (data.code === 0) {
  2246. this.userBuList = data.rows
  2247. }
  2248. })
  2249. },
  2250. // 获取用户的bu
  2251. getSiteAndBuByUserName2 () {
  2252. let tempData = {
  2253. username: this.$store.state.user.name,
  2254. }
  2255. getSiteAndBuByUserName2(tempData).then(({data}) => {
  2256. if (data.code === 0) {
  2257. this.buList = data.rows
  2258. }
  2259. })
  2260. },
  2261. // ======== 分页相关方法 ========
  2262. /**
  2263. * 每页数
  2264. * @param val
  2265. */
  2266. sizeChangeHandle (val) {
  2267. this.pageSize = val
  2268. this.pageIndex = 1
  2269. this.getDataList()
  2270. },
  2271. /**
  2272. * 当前页
  2273. * @param val
  2274. */
  2275. currentChangeHandle (val) {
  2276. this.pageIndex = val
  2277. this.getDataList()
  2278. },
  2279. /**
  2280. * 每页数
  2281. * @param val
  2282. */
  2283. sizeChangeHandle2 (val) {
  2284. this.pageSize2 = val
  2285. this.pageIndex2 = 1
  2286. this.queryPartList()
  2287. },
  2288. /**
  2289. * 当前页
  2290. * @param val
  2291. */
  2292. currentChangeHandle2 (val) {
  2293. this.pageIndex2 = val
  2294. this.queryPartList()
  2295. },
  2296. /**
  2297. * 每页数
  2298. * @param val
  2299. */
  2300. sizeChangeHandle3 (val) {
  2301. this.pageSize3 = val
  2302. this.pageIndex3 = 1
  2303. this.queryComponentPartModal()
  2304. },
  2305. /**
  2306. * 当前页
  2307. * @param val
  2308. */
  2309. currentChangeHandle3 (val) {
  2310. this.pageIndex3 = val
  2311. this.queryComponentPartModal()
  2312. },
  2313. /**
  2314. * 每页数
  2315. * @param val
  2316. */
  2317. sizeChangeHandle4 (val) {
  2318. this.pageSize4 = val
  2319. this.pageIndex4 = 1
  2320. this.queryCopyPartModal()
  2321. },
  2322. /**
  2323. * 当前页
  2324. * @param val
  2325. */
  2326. currentChangeHandle4 (val) {
  2327. this.pageIndex4 = val
  2328. this.queryCopyPartModal()
  2329. },
  2330. /**
  2331. * 每页数
  2332. * @param val
  2333. */
  2334. sizeChangeHandle5 (val) {
  2335. this.pageSize5 = val
  2336. this.pageIndex5 = 1
  2337. this.queryBatchComponentPartList()
  2338. },
  2339. /**
  2340. * 当前页
  2341. * @param val
  2342. */
  2343. currentChangeHandle5 (val) {
  2344. this.pageIndex5 = val
  2345. this.queryBatchComponentPartList()
  2346. },
  2347. // ======== 页签切换相关方法 ========
  2348. /**
  2349. * 子明细页签选择替换
  2350. */
  2351. tabSubDetailClick (tab, event) {
  2352. // 刷新列表数据
  2353. this.refreshSubDetailTable()
  2354. },
  2355. /**
  2356. * 刷新子明细页签的table数据
  2357. */
  2358. refreshSubDetailTable () {
  2359. if (this.subDetailTable === 'bom_sub_detail') {
  2360. this.queryBomComponentTable()
  2361. }
  2362. },
  2363. // 刷新方法
  2364. queryBomComponentTable () {
  2365. queryBomComponentTable(this.detailData).then(({data}) => {
  2366. if (data.code === 0) {
  2367. this.subDetailList = data.rows
  2368. }
  2369. })
  2370. },
  2371. // ======== 列表数据操作方法 ========
  2372. /**
  2373. * 获取数据列表
  2374. */
  2375. getDataList () {
  2376. this.searchData.limit = this.pageSize
  2377. this.searchData.page = this.pageIndex
  2378. bomManagementSearch(this.searchData).then(({data}) => {
  2379. if (data.code === 0) {
  2380. this.dataList = data.page.list
  2381. this.pageIndex = data.page.currPage
  2382. this.pageSize = data.page.pageSize
  2383. this.totalPage = data.page.totalCount
  2384. this.$refs.selectDiv.setLengthAll( this.dataList.length)
  2385. }
  2386. })
  2387. },
  2388. /**
  2389. * 复选列表信息
  2390. * @param val
  2391. */
  2392. selectionBom (val) {
  2393. this.bomSelections = val
  2394. this.$refs.selectDiv.setLengthselected(this.bomSelections.length)
  2395. },
  2396. // 点击行选中复选框
  2397. batchSaveClickRow (row) {
  2398. this.$refs.batchSaveTable.toggleRowSelection(row)
  2399. },
  2400. // 复选子物料信息
  2401. selectionSaveComponent (val) {
  2402. this.batchComponentSelections = val
  2403. },
  2404. // 点击行选中复选框
  2405. batchSaveClickRow2 (row) {
  2406. this.$refs.batchSaveTable2.toggleRowSelection(row)
  2407. },
  2408. // 复选子物料信息
  2409. selectionSaveComponent2 (val) {
  2410. this.batchComponentSelections2 = val
  2411. },
  2412. // ======== 新增/编辑模态框 ========
  2413. /**
  2414. * bom新增模态框
  2415. */
  2416. addModal () {
  2417. this.modalData = {
  2418. flag: '1',
  2419. title: 'bom新增',
  2420. bu: this.userBuList[0].buNo,
  2421. site: this.userBuList[0].buNo.split('_')[0],
  2422. buNo: this.userBuList[0].buNo.split('_')[1],
  2423. partNo: '',
  2424. partDesc: '',
  2425. engChgLevel: undefined,
  2426. bomType: 'Manufacturing',
  2427. noteText: '',
  2428. effPhaseInDate: new Date(+ new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''),
  2429. effPhaseOutDate: '',
  2430. engRevision: '',
  2431. typeFlag: 'B',
  2432. netWeight: '',
  2433. createBy: this.$store.state.user.name,
  2434. printUnit: '',
  2435. printUnitName: '',
  2436. yieldRate: '',
  2437. shrinkageFactor: '',
  2438. processUnit: '',
  2439. processUnitName: ''
  2440. }
  2441. this.detailData = {
  2442. site: '',
  2443. buNo: '',
  2444. partNo: '',
  2445. engChgLevel: '',
  2446. bomType: '',
  2447. alternativeNo: '',
  2448. alternativeDescription: '',
  2449. minLotQty: '',
  2450. defaultFlag: '',
  2451. detailNoteText: '',
  2452. status: '',
  2453. createDate: '',
  2454. createBy: this.$store.state.user.name,
  2455. updateDate: '',
  2456. updateBy: this.$store.state.user.name,
  2457. }
  2458. this.detailDataList = []
  2459. this.subDetailList = []
  2460. this.headerSaveFlag = true
  2461. this.modalDisableFlag = false
  2462. this.modalFlag = true
  2463. },
  2464. /**
  2465. * bom编辑模态框
  2466. */
  2467. async updateModal (row) {
  2468. this.modalData = {
  2469. flag: '2',
  2470. bu: row.site + '_' + row.buNo,
  2471. site: row.site,
  2472. buNo: row.buNo,
  2473. partNo: row.partNo,
  2474. partDesc: row.partDesc,
  2475. engChgLevel: row.engChgLevel,
  2476. bomType: row.bomType,
  2477. noteText: row.noteText,
  2478. effPhaseInDate: row.effPhaseInDate,
  2479. effPhaseOutDate: row.effPhaseOutDate,
  2480. engRevision: row.engRevision,
  2481. typeFlag: row.typeFlag,
  2482. netWeight: row.netWeight,
  2483. updateBy: this.$store.state.user.name,
  2484. printUnit: row.printUnit,
  2485. printUnitName: row.printUnitName,
  2486. alternativeNo: row.alternativeNo,
  2487. yieldRate: row.yieldRate,
  2488. shrinkageFactor: new Decimal(100).sub(new Decimal(row.yieldRate)).toNumber(),
  2489. processUnit: row.processUnit,
  2490. processUnitName: row.processUnitName
  2491. }
  2492. this.subDetailTable = 'bom_sub_detail'
  2493. // 查bom明细
  2494. queryBomDetail(this.modalData).then(({data}) => {
  2495. if (data && data.code === 0) {
  2496. this.detailDataList = data.rows.detailList
  2497. this.subDetailList = data.rows.componentList
  2498. this.detailData = data.rows.detailData
  2499. this.modalDisableFlag = true
  2500. this.modalFlag = true
  2501. } else {
  2502. this.$alert(data.msg, '错误', {
  2503. confirmButtonText: '确定'
  2504. })
  2505. }
  2506. })
  2507. },
  2508. /**
  2509. * 替代新增模态框
  2510. */
  2511. saveBomDetail () {
  2512. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  2513. this.$message.warning('请先选择Bom物料!')
  2514. return
  2515. }
  2516. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  2517. this.$message.warning('请先填写Bom版本号!')
  2518. return
  2519. }
  2520. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  2521. this.$message.warning('请先选择制造类型!')
  2522. return
  2523. }
  2524. this.saveDetailData = {
  2525. flag: '1',
  2526. site: this.modalData.site,
  2527. buNo: this.modalData.buNo,
  2528. partNo: this.modalData.partNo,
  2529. engChgLevel: this.modalData.engChgLevel,
  2530. bomType: this.modalData.bomType,
  2531. alternativeNo: '',
  2532. alternativeDescription: '',
  2533. minLotQty: 0,
  2534. defaultFlag: '',
  2535. detailNoteText: '',
  2536. status: 'Tentative',
  2537. createDate: '',
  2538. createBy: this.$store.state.user.name,
  2539. }
  2540. // 查询bom主信息
  2541. queryBomHeader(this.modalData).then(({data}) => {
  2542. if (data && data.code === 0) {
  2543. if (data.rows.length > 0) {
  2544. this.saveDetailModalFlag = true
  2545. this.saveDetailModalDisable = false
  2546. } else {
  2547. this.$message.warning('请先保存BOM主记录!')
  2548. }
  2549. } else {
  2550. this.$alert(data.msg, '提示', {
  2551. confirmButtonText: '确定'
  2552. })
  2553. }
  2554. })
  2555. },
  2556. /**
  2557. * 替代编辑模态框
  2558. */
  2559. updateBomDetail () {
  2560. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  2561. this.$message.warning('请先选择Bom物料!')
  2562. return
  2563. }
  2564. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  2565. this.$message.warning('请先填写Bom版本号!')
  2566. return
  2567. }
  2568. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  2569. this.$message.warning('请先选择制造类型!')
  2570. return
  2571. }
  2572. this.saveDetailData = {
  2573. flag: '2',
  2574. site: this.detailData.site,
  2575. buNo: this.detailData.buNo,
  2576. partNo: this.detailData.partNo,
  2577. engChgLevel: this.detailData.engChgLevel,
  2578. bomType: this.detailData.bomType,
  2579. alternativeNo: this.detailData.alternativeNo,
  2580. alternativeDescription: this.detailData.alternativeDescription,
  2581. minLotQty: this.detailData.minLotQty,
  2582. defaultFlag: '',
  2583. detailNoteText: this.detailData.detailNoteText,
  2584. status: this.detailData.status,
  2585. updateBy: this.$store.state.user.name,
  2586. }
  2587. // 查询bom主信息
  2588. queryBomHeader(this.modalData).then(({data}) => {
  2589. if (data && data.code === 0) {
  2590. if (data.rows.length > 0) {
  2591. this.saveDetailModalFlag = true
  2592. this.saveDetailModalDisable = true
  2593. } else {
  2594. this.$message.warning('请先保存BOM主记录!')
  2595. }
  2596. } else {
  2597. this.$alert(data.msg, '提示', {
  2598. confirmButtonText: '确定'
  2599. })
  2600. }
  2601. })
  2602. },
  2603. /**
  2604. * 子明细新增模态框
  2605. */
  2606. saveComponentModal () {
  2607. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  2608. this.$message.warning('请先选择替代!')
  2609. return
  2610. }
  2611. this.componentData = {
  2612. flag: '1',
  2613. site: this.modalData.site,
  2614. buNo: this.modalData.buNo,
  2615. partNo: this.modalData.partNo,
  2616. engChgLevel: this.modalData.engChgLevel,
  2617. bomType: this.modalData.bomType,
  2618. alternativeNo: this.detailData.alternativeNo,
  2619. componentPart: '',
  2620. componentPartDesc: '',
  2621. printUnit: '',
  2622. printUnitName: '',
  2623. qtyPerAssembly: 0,
  2624. componentScrap: 0,
  2625. issueType: 'Reserve And Backflush',
  2626. shrinkageFactor: this.modalData.shrinkageFactor,
  2627. lineItemNo: '',
  2628. operationId: '',
  2629. operationNo: '',
  2630. issueToLoc: '',
  2631. issueToLocName: '',
  2632. noteText: '',
  2633. createBy: this.$store.state.user.name,
  2634. lineSequence: '',
  2635. consumptionItem: 'Consumed',
  2636. productFlag: 'component',
  2637. familyID: '',
  2638. productionData: undefined,
  2639. materialData: undefined,
  2640. finishedProductData: undefined,
  2641. consumptionLoss: undefined,
  2642. coatingLength: undefined,
  2643. glueWeight: undefined,
  2644. materialWidth: undefined,
  2645. widthConversion: undefined,
  2646. materialLength: undefined,
  2647. materialThickness: undefined,
  2648. areaConversion: undefined,
  2649. densityConversion: undefined,
  2650. materialWeight: undefined,
  2651. materialLength2: undefined,
  2652. unitConversion: undefined
  2653. }
  2654. // 获取子料的序号
  2655. getComponentLineSequence(this.componentData).then(({data}) => {
  2656. if (data && data.code === 0) {
  2657. this.componentData.lineSequence = data.lineSequence
  2658. } else {
  2659. this.$alert(data.msg, '错误', {
  2660. confirmButtonText: '确定'
  2661. })
  2662. }
  2663. })
  2664. this.componentDisableFlag = false
  2665. this.componentSaveModal = true
  2666. },
  2667. // 批量新增子物料模态框
  2668. batchSaveComponentModal () {
  2669. this.pageSize5 = 20
  2670. this.pageIndex5 = 1
  2671. this.batchComponentPartData.partNo = ''
  2672. this.batchComponentPartData.partDesc = ''
  2673. this.batchComponentPartData.limit = this.pageSize5
  2674. this.batchComponentPartData.page = this.pageIndex5
  2675. this.batchComponentPartData.site = this.modalData.site
  2676. this.batchComponentPartData.buNo = this.modalData.buNo
  2677. // 查询所有物料
  2678. queryPartListAll(this.batchComponentPartData).then(({data}) => {
  2679. if (data && data.code === 0) {
  2680. this.batchComponentPartList = data.page.list
  2681. this.pageIndex5 = data.page.currPage
  2682. this.pageSize5 = data.page.pageSize
  2683. this.totalPage5 = data.page.totalCount
  2684. this.batchComponentPartModelFlag = true
  2685. } else {
  2686. this.batchComponentPartList = []
  2687. }
  2688. })
  2689. this.batchComponentPartData.shrinkageFactor = this.modalData.shrinkageFactor
  2690. this.choosePartList = []
  2691. },
  2692. // 子物料批量导入
  2693. bomComponentUpload () {
  2694. let currentData = {
  2695. site: this.detailData.site,
  2696. buNo: this.detailData.buNo,
  2697. partNo: this.detailData.partNo,
  2698. engChgLevel: this.detailData.engChgLevel,
  2699. bomType: this.detailData.bomType,
  2700. alternativeNo: this.detailData.alternativeNo,
  2701. createBy: this.$store.state.user.name,
  2702. shrinkageFactor: this.modalData.shrinkageFactor
  2703. }
  2704. //打开组件 去做新增业务
  2705. this.$nextTick(() => {
  2706. this.$refs.BomComponentUpload.init(currentData)
  2707. })
  2708. },
  2709. /**
  2710. * 副产品新增模态框
  2711. */
  2712. saveByProductModal () {
  2713. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  2714. this.$message.warning('请先选择替代!')
  2715. return
  2716. }
  2717. // if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
  2718. // this.$message.warning('不可编辑的替代状态!')
  2719. // return
  2720. // }
  2721. this.componentData = {
  2722. flag: '1',
  2723. site: this.$store.state.user.site,
  2724. partNo: this.modalData.partNo,
  2725. engChgLevel: this.modalData.engChgLevel,
  2726. bomType: this.modalData.bomType,
  2727. alternativeNo: this.detailData.alternativeNo,
  2728. componentPart: '',
  2729. componentPartDesc: '',
  2730. printUnit: '',
  2731. printUnitName: '',
  2732. qtyPerAssembly: 0,
  2733. componentScrap: 0,
  2734. issueType: 'Reserve And Backflush',
  2735. shrinkageFactor: 0,
  2736. lineItemNo: '',
  2737. operationId: '',
  2738. operationNo: '',
  2739. issueToLoc: '',
  2740. issueToLocName: '',
  2741. noteText: '',
  2742. createBy: this.$store.state.user.name,
  2743. lineSequence: '',
  2744. consumptionItem: '',
  2745. productFlag: 'byProduct'
  2746. }
  2747. // 获取子料的序号
  2748. getComponentLineSequence(this.componentData).then(({data}) => {
  2749. if (data && data.code === 0) {
  2750. this.componentData.lineSequence = data.lineSequence
  2751. } else {
  2752. this.$alert(data.msg, '错误', {
  2753. confirmButtonText: '确定'
  2754. })
  2755. }
  2756. })
  2757. this.componentDisableFlag = false
  2758. this.componentSaveModal = true
  2759. },
  2760. /**
  2761. * 子明细编辑模态框
  2762. */
  2763. updateComponentModal (row) {
  2764. this.componentData = {
  2765. flag: '2',
  2766. site: row.site,
  2767. buNo: row.buNo,
  2768. partNo: row.partNo,
  2769. engChgLevel: row.engChgLevel,
  2770. bomType: row.bomType,
  2771. alternativeNo: row.alternativeNo,
  2772. componentPart: row.componentPart,
  2773. componentPartDesc: row.componentPartDesc,
  2774. printUnit: row.printUnit,
  2775. printUnitName: row.printUnitName,
  2776. qtyPerAssembly: row.qtyPerAssembly,
  2777. componentScrap: row.componentScrap,
  2778. issueType: row.issueType,
  2779. shrinkageFactor: row.shrinkageFactor,
  2780. lineItemNo: row.lineItemNo,
  2781. operationId: row.operationId,
  2782. operationNo: row.operationNo,
  2783. issueToLoc: row.issueToLoc,
  2784. issueToLocName: row.issueToLocName,
  2785. noteText: row.noteText,
  2786. updateBy: this.$store.state.user.name,
  2787. lineSequence: row.lineSequence,
  2788. consumptionItem: row.consumptionItem,
  2789. productFlag: 'component',
  2790. familyID: row.familyID,
  2791. productionData: row.productionData == null ? undefined : row.productionData,
  2792. materialData: row.materialData == null ? undefined : row.materialData,
  2793. finishedProductData: row.finishedProductData == null ? undefined : row.finishedProductData,
  2794. consumptionLoss: row.consumptionLoss == null ? undefined : row.consumptionLoss,
  2795. coatingLength: row.coatingLength == null ? undefined : row.coatingLength,
  2796. glueWeight: row.glueWeight == null ? undefined : row.glueWeight,
  2797. materialWidth: row.materialWidth == null ? undefined : row.materialWidth,
  2798. widthConversion: row.widthConversion == null ? undefined : row.widthConversion,
  2799. materialLength: row.materialLength == null ? undefined : row.materialLength,
  2800. materialThickness: row.materialThickness == null ? undefined : row.materialThickness,
  2801. areaConversion: row.areaConversion == null ? undefined : row.areaConversion,
  2802. densityConversion: row.densityConversion == null ? undefined : row.densityConversion,
  2803. materialWeight: row.materialWeight == null ? undefined : row.materialWeight,
  2804. materialLength2: row.materialLength2 == null ? undefined : row.materialLength2,
  2805. unitConversion: row.unitConversion == null ? undefined : row.unitConversion,
  2806. }
  2807. this.componentDisableFlag = true
  2808. this.componentSaveModal = true
  2809. },
  2810. // ======== 新增/编辑/删除方法 ========
  2811. /**
  2812. * bom新增/编辑
  2813. */
  2814. saveData (isClose) {
  2815. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  2816. this.$message.warning('请选择物料编码!')
  2817. return
  2818. }
  2819. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  2820. this.$message.warning('请选择物料名称!')
  2821. return
  2822. }
  2823. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  2824. this.$message.warning('请选择制造类型!')
  2825. return
  2826. }
  2827. if (this.modalData.effPhaseInDate === '' || this.modalData.effPhaseInDate == null) {
  2828. this.$message.warning('请选择生效日期!')
  2829. return
  2830. }
  2831. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  2832. this.$message.warning('请填写BOM版本号!')
  2833. return
  2834. }
  2835. if (this.modalData.processUnit === '' || this.modalData.processUnit == null) {
  2836. this.$message.warning('请选择工序单位!')
  2837. return
  2838. }
  2839. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  2840. this.$message.warning('请选择替代!')
  2841. return
  2842. }
  2843. if (this.detailData.status === '' || this.detailData.status == null) {
  2844. this.$message.warning('请选择替代状态!')
  2845. return
  2846. }
  2847. let tempData = {
  2848. site: this.modalData.site,
  2849. buNo: this.modalData.buNo,
  2850. partNo: this.modalData.partNo,
  2851. partDesc: this.modalData.partDesc,
  2852. engChgLevel: this.modalData.engChgLevel,
  2853. bomType: this.modalData.bomType,
  2854. noteText: this.modalData.noteText,
  2855. effPhaseInDate: this.modalData.effPhaseInDate,
  2856. effPhaseOutDate: this.modalData.effPhaseOutDate,
  2857. engRevision: this.modalData.engRevision,
  2858. typeFlag: this.modalData.typeFlag,
  2859. netWeight: this.modalData.netWeight,
  2860. alternativeNo: this.detailData.alternativeNo,
  2861. alternativeDescription: this.detailData.alternativeDescription,
  2862. minLotQty: this.detailData.minLotQty,
  2863. defaultFlag: this.detailData.defaultFlag,
  2864. detailNoteText: this.detailData.detailNoteText,
  2865. status: this.detailData.status,
  2866. createBy: this.$store.state.user.name,
  2867. updateBy: this.$store.state.user.name,
  2868. informationList: this.subDetailList,
  2869. processUnit: this.modalData.processUnit
  2870. }
  2871. // if (this.modalData.flag === '1') {
  2872. this.saveAllLoading = true
  2873. bomManagementSave(tempData).then(({data}) => {
  2874. if (data && data.code === 0) {
  2875. if (isClose) {
  2876. this.updateModal(data.rows)
  2877. } else {
  2878. this.getDataList()
  2879. this.modalFlag = false
  2880. }
  2881. this.$message({
  2882. message: '操作成功',
  2883. type: 'success',
  2884. duration: 1500,
  2885. onClose: () => {}
  2886. })
  2887. } else {
  2888. this.$alert(data.msg, '错误', {
  2889. confirmButtonText: '确定'
  2890. })
  2891. }
  2892. this.saveAllLoading = false
  2893. }).catch(() => {
  2894. this.saveAllLoading = false
  2895. })
  2896. // } else {
  2897. // this.saveAllLoading = true
  2898. // bomManagementEdit(tempData).then(({data}) => {
  2899. // if (data && data.code === 0) {
  2900. // this.getDataList()
  2901. // this.modalFlag = false
  2902. // this.$message({
  2903. // message: '操作成功',
  2904. // type: 'success',
  2905. // duration: 1500,
  2906. // onClose: () => {}
  2907. // })
  2908. // } else {
  2909. // this.$alert(data.msg, '错误', {
  2910. // confirmButtonText: '确定'
  2911. // })
  2912. // }
  2913. // this.saveAllLoading = false
  2914. // })
  2915. // }
  2916. },
  2917. /**
  2918. * 新增编辑模态框关闭
  2919. */
  2920. closeModal () {
  2921. this.getDataList()
  2922. this.modalFlag = false
  2923. },
  2924. /**
  2925. * 新增编辑模态框关闭
  2926. */
  2927. closeModalX (done) {
  2928. this.getDataList()
  2929. done()
  2930. },
  2931. /**
  2932. * bom删除
  2933. */
  2934. delModal () {
  2935. if (this.bomSelections.length === 0) {
  2936. this.$message.warning('请勾选要删除的BOM!')
  2937. return
  2938. }
  2939. this.$confirm(`是否删除这 `+ this.bomSelections.length +` 条BOM?`, '提示', {
  2940. confirmButtonText: '确定',
  2941. cancelButtonText: '取消',
  2942. type: 'warning'
  2943. }).then(() => {
  2944. let tempData = {
  2945. informationList: this.bomSelections
  2946. }
  2947. bomManagementDelete(tempData).then(({data}) => {
  2948. if (data && data.code === 0) {
  2949. this.getDataList()
  2950. this.bomSelections = []
  2951. this.$message({
  2952. message: '操作成功',
  2953. type: 'success',
  2954. duration: 1500,
  2955. onClose: () => {}
  2956. })
  2957. } else {
  2958. this.$alert(data.msg, '错误', {
  2959. confirmButtonText: '确定'
  2960. })
  2961. }
  2962. })
  2963. })
  2964. },
  2965. /**
  2966. * 查询物料
  2967. */
  2968. queryPartList () {
  2969. this.partData.limit = this.pageSize2
  2970. this.partData.page = this.pageIndex2
  2971. this.partData.site = this.modalData.bu.split('_')[0]
  2972. this.partData.buNo = this.modalData.bu.split('_')[1]
  2973. queryPartListBom(this.partData).then(({data}) => {
  2974. if (data && data.code === 0) {
  2975. this.partList = data.page.list
  2976. this.pageIndex2 = data.page.currPage
  2977. this.pageSize2 = data.page.pageSize
  2978. this.totalPage2 = data.page.totalCount
  2979. this.partModelFlag = true
  2980. } else {
  2981. this.$alert(data.msg, '错误', {
  2982. confirmButtonText: '确定'
  2983. })
  2984. }
  2985. })
  2986. },
  2987. // 物料编码失焦事件
  2988. partNoBlur () {
  2989. if (this.modalData.partNo != null && this.modalData.partNo !== '') {
  2990. this.partData.limit = this.pageSize2
  2991. this.partData.page = this.pageIndex2
  2992. this.partData.site = this.modalData.bu.split('_')[0]
  2993. this.partData.buNo = this.modalData.bu.split('_')[1]
  2994. this.partData.partNo = this.modalData.partNo
  2995. queryPartList(this.partData).then(({data}) => {
  2996. if (data && data.code === 0) {
  2997. if (data.page.list.length === 1) {
  2998. this.modalData.partDesc = data.page.list[0].partDesc
  2999. this.modalData.printUnit = data.page.list[0].printUnit
  3000. this.modalData.printUnitName = data.page.list[0].printUnitName
  3001. this.modalData.shrinkageFactor = new Decimal(100).sub(new Decimal(data.page.list[0].yieldRate)).toNumber()
  3002. // 获取物料的routing版本号
  3003. getBomEngChgLevel(this.modalData).then(({data}) => {
  3004. if (data && data.code === 0) {
  3005. this.modalData.engChgLevel = data.engChgLevel
  3006. } else {
  3007. this.modalData.engChgLevel = ''
  3008. }
  3009. })
  3010. } else {
  3011. this.modalData.partDesc = ''
  3012. this.modalData.printUnit = ''
  3013. this.modalData.printUnitName = ''
  3014. this.modalData.engChgLevel = ''
  3015. this.modalData.shrinkageFactor = ''
  3016. }
  3017. }
  3018. })
  3019. } else {
  3020. this.modalData.partDesc = ''
  3021. this.modalData.printUnit = ''
  3022. this.modalData.printUnitName = ''
  3023. this.modalData.engChgLevel = ''
  3024. this.modalData.shrinkageFactor = ''
  3025. }
  3026. },
  3027. /**
  3028. * BOM类型改变
  3029. */
  3030. bomTypeChange () {
  3031. // 获取物料的Bom版本号
  3032. getBomEngChgLevel(this.modalData).then(({data}) => {
  3033. if (data && data.code === 0) {
  3034. this.modalData.engChgLevel = data.engChgLevel
  3035. } else {
  3036. this.modalData.engChgLevel = ''
  3037. }
  3038. })
  3039. },
  3040. /**
  3041. * 双击选中物料
  3042. * @param row
  3043. */
  3044. getRowData (row) {
  3045. this.modalData.partNo = row.partNo
  3046. this.modalData.partDesc = row.partDesc
  3047. this.modalData.printUnit = row.printUnit
  3048. this.modalData.printUnitName = row.printUnitName
  3049. this.modalData.shrinkageFactor = new Decimal(100).sub(new Decimal(row.yieldRate)).toNumber()
  3050. // 获取物料的routing版本号
  3051. getBomEngChgLevel(this.modalData).then(({data}) => {
  3052. if (data && data.code === 0) {
  3053. this.modalData.engChgLevel = data.engChgLevel
  3054. } else {
  3055. this.modalData.engChgLevel = ''
  3056. }
  3057. this.partModelFlag = false
  3058. })
  3059. },
  3060. /**
  3061. * 双击选中工序
  3062. * @param row
  3063. */
  3064. getRowOperationData (row) {
  3065. this.componentData.operationId = row.operationId
  3066. this.componentData.operationNo = row.operationNo
  3067. this.operationModelFlag = false
  3068. },
  3069. // 双击选中子物料
  3070. getComponentRowData (row) {
  3071. this.componentData.componentPart = row.partNo
  3072. this.componentData.componentPartDesc = row.partDesc
  3073. this.componentData.printUnit = row.printUnit
  3074. this.componentData.printUnitName = row.printUnitName
  3075. this.componentData.familyID = row.familyID
  3076. if (this.widthConversionFamily.includes(row.familyID)) {
  3077. this.componentData.widthConversion = 1
  3078. } else if (this.areaConversionFamily.includes(row.familyID)) {
  3079. this.componentData.areaConversion = 1
  3080. } else if (this.densityConversionFamily.includes(row.familyID)) {
  3081. this.componentData.densityConversion = 1
  3082. } else if (this.unitConversionFamily.includes(row.familyID)) {
  3083. this.componentData.unitConversion = 1
  3084. } else if (this.consumptionLossFamily.includes(row.familyID)) {
  3085. this.componentData.consumptionLoss = 1
  3086. }
  3087. this.componentPartModelFlag = false
  3088. },
  3089. // 双击选择copy物料
  3090. getCopyRowData (row) {
  3091. if (this.copyPartData.type === '1') {
  3092. this.copyBomData.partNo = row.partNo
  3093. this.copyBomData.partDesc = row.partDesc
  3094. this.copyBomTypeChange()
  3095. } else {
  3096. this.copyAlternativeData.partNo = row.partNo
  3097. this.copyAlternativeData.partDesc = row.partDesc
  3098. }
  3099. this.copyPartModelFlag = false
  3100. },
  3101. /**
  3102. * 子物料列表
  3103. */
  3104. queryComponentPartModal () {
  3105. this.componentPartData.limit = this.pageSize3
  3106. this.componentPartData.page = this.pageIndex3
  3107. this.componentPartData.site = this.modalData.site
  3108. this.componentPartData.buNo = this.modalData.buNo
  3109. // 查询所有物料
  3110. queryPartListAll(this.componentPartData).then(({data}) => {
  3111. if (data && data.code === 0) {
  3112. this.componentPartList = data.page.list
  3113. this.pageIndex3 = data.page.currPage
  3114. this.pageSize3 = data.page.pageSize
  3115. this.totalPage3 = data.page.totalCount
  3116. this.componentPartModelFlag = true
  3117. } else {
  3118. this.componentPartList = []
  3119. }
  3120. })
  3121. },
  3122. /**
  3123. * copy物料列表
  3124. */
  3125. queryCopyPartModal () {
  3126. this.copyPartData.limit = this.pageSize4
  3127. this.copyPartData.page = this.pageIndex4
  3128. this.copyPartData.site = this.modalData.site
  3129. this.copyPartData.buNo = this.modalData.buNo
  3130. // 查询所有物料
  3131. queryPartList(this.copyPartData).then(({data}) => {
  3132. if (data && data.code === 0) {
  3133. this.copyPartList = data.page.list
  3134. this.pageIndex4 = data.page.currPage
  3135. this.pageSize4 = data.page.pageSize
  3136. this.totalPage4 = data.page.totalCount
  3137. this.copyPartModelFlag = true
  3138. } else {
  3139. this.$alert(data.msg, '错误', {
  3140. confirmButtonText: '确定'
  3141. })
  3142. }
  3143. })
  3144. },
  3145. /**
  3146. * 子物料查询列表
  3147. */
  3148. queryComponentPartList () {
  3149. this.componentPartData.limit = this.pageSize3
  3150. this.componentPartData.page = this.pageIndex3
  3151. // 查询所有物料
  3152. queryPartListAll(this.componentPartData).then(({data}) => {
  3153. if (data && data.code === 0) {
  3154. this.componentPartList = data.page.list
  3155. this.pageIndex3 = data.page.currPage
  3156. this.pageSize3 = data.page.pageSize
  3157. this.totalPage3 = data.page.totalCount
  3158. } else {
  3159. this.componentPartList = []
  3160. }
  3161. })
  3162. },
  3163. /**
  3164. * 子物料查询列表
  3165. */
  3166. queryBatchComponentPartList () {
  3167. this.batchComponentPartData.limit = this.pageSize5
  3168. this.batchComponentPartData.page = this.pageIndex5
  3169. // 查询所有物料
  3170. queryPartListAll(this.batchComponentPartData).then(({data}) => {
  3171. if (data && data.code === 0) {
  3172. this.batchComponentPartList = data.page.list
  3173. this.pageIndex5 = data.page.currPage
  3174. this.pageSize5 = data.page.pageSize
  3175. this.totalPage5 = data.page.totalCount
  3176. } else {
  3177. this.batchComponentPartList = []
  3178. }
  3179. })
  3180. },
  3181. /**
  3182. * copy物料查询列表
  3183. */
  3184. queryCopyPartList () {
  3185. this.copyPartData.limit = this.pageSize4
  3186. this.copyPartData.page = this.pageIndex4
  3187. // 查询所有物料
  3188. queryPartList(this.copyPartData).then(({data}) => {
  3189. if (data && data.code === 0) {
  3190. this.copyPartList = data.page.list
  3191. this.pageIndex4 = data.page.currPage
  3192. this.pageSize4 = data.page.pageSize
  3193. this.totalPage4 = data.page.totalCount
  3194. } else {
  3195. this.copyPartList = []
  3196. }
  3197. })
  3198. },
  3199. // 子物料编码失焦事件
  3200. componentPartBlur () {
  3201. if (this.componentData.componentPart != null && this.componentData.componentPart !== '') {
  3202. this.componentPartData.limit = this.pageSize3
  3203. this.componentPartData.page = this.pageIndex3
  3204. this.componentPartData.site = this.modalData.site
  3205. this.componentPartData.buNo = this.modalData.buNo
  3206. this.componentPartData.partNo = this.componentData.componentPart
  3207. queryPartListAll(this.componentPartData).then(({data}) => {
  3208. if (data && data.code === 0) {
  3209. if (data.page.list.length > 0) {
  3210. this.componentData.componentPartDesc = data.page.list[0].partDesc
  3211. this.componentData.printUnit = data.page.list[0].printUnit
  3212. this.componentData.printUnitName = data.page.list[0].printUnitName
  3213. this.componentData.familyID = data.page.list[0].familyID
  3214. if (this.widthConversionFamily.includes(data.page.list[0].familyID)) {
  3215. this.componentData.widthConversion = 1
  3216. } else if (this.areaConversionFamily.includes(data.page.list[0].familyID)) {
  3217. this.componentData.areaConversion = 1
  3218. } else if (this.densityConversionFamily.includes(data.page.list[0].familyID)) {
  3219. this.componentData.densityConversion = 1
  3220. } else if (this.unitConversionFamily.includes(data.page.list[0].familyID)) {
  3221. this.componentData.unitConversion = 1
  3222. } else if (this.consumptionLossFamily.includes(data.page.list[0].familyID)) {
  3223. this.componentData.consumptionLoss = 1
  3224. }
  3225. return
  3226. }
  3227. }
  3228. })
  3229. }
  3230. this.componentData.componentPartDesc = ''
  3231. this.componentData.printUnit = ''
  3232. this.componentData.printUnitName = ''
  3233. this.componentData.familyID = ''
  3234. },
  3235. // copy物料编码失焦事件
  3236. copyPartBlur () {
  3237. if (this.copyPartData.type === '1') {
  3238. if (this.copyBomData.partNo != null && this.copyBomData.partNo !== '') {
  3239. this.copyPartData.limit = this.pageSize4
  3240. this.copyPartData.page = this.pageIndex4
  3241. this.copyPartData.partNo = this.copyBomData.partNo
  3242. queryPartList(this.copyPartData).then(({data}) => {
  3243. if (data && data.code === 0) {
  3244. if (data.page.list.length === 1) {
  3245. this.copyBomData.partDesc = data.page.list[0].partDesc
  3246. return
  3247. }
  3248. }
  3249. })
  3250. }
  3251. this.copyBomData.partDesc = ''
  3252. } else {
  3253. if (this.copyAlternativeData.partNo != null && this.copyAlternativeData.partNo !== '') {
  3254. this.copyPartData.limit = this.pageSize4
  3255. this.copyPartData.page = this.pageIndex4
  3256. this.copyPartData.partNo = this.copyAlternativeData.partNo
  3257. queryPartList(this.copyPartData).then(({data}) => {
  3258. if (data && data.code === 0) {
  3259. if (data.page.list.length === 1) {
  3260. this.copyAlternativeData.partDesc = data.page.list[0].partDesc
  3261. return
  3262. }
  3263. }
  3264. })
  3265. }
  3266. this.copyAlternativeData.partDesc = ''
  3267. }
  3268. },
  3269. // copy BOM类型改变
  3270. copyBomTypeChange () {
  3271. // 获取物料的bom版本号
  3272. getBomEngChgLevel(this.copyBomData).then(({data}) => {
  3273. if (data && data.code === 0) {
  3274. this.copyBomData.engChgLevel = data.engChgLevel
  3275. } else {
  3276. this.$alert(data.msg, '错误', {
  3277. confirmButtonText: '确定'
  3278. })
  3279. }
  3280. })
  3281. },
  3282. /**
  3283. * 表格的新增
  3284. * @param row
  3285. * @param rowIndex
  3286. */
  3287. rowClassName({ row, rowIndex }) {
  3288. row.xh = rowIndex + 1
  3289. },
  3290. /**
  3291. * 选中数据
  3292. * @param selection
  3293. */
  3294. componentSelectionChange(selection) {
  3295. this.checkedDetail = selection
  3296. },
  3297. /**
  3298. * 删除子物料
  3299. */
  3300. deleteComponentPart () {
  3301. // if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
  3302. // this.$message.warning('不可编辑的替代状态!')
  3303. // return
  3304. // }
  3305. if (this.checkedDetail.length === 0) {
  3306. this.$message.warning('请选择要删除子物料!')
  3307. return
  3308. } else {
  3309. this.$confirm("请是否确认删除该子明细记录?", "提示", {
  3310. confirmButtonText: "确定",
  3311. cancelButtonText: "取消",
  3312. type: "warning"
  3313. }).then(() => {
  3314. let tempData = {
  3315. informationList: this.checkedDetail,
  3316. productFlag: 'component'
  3317. }
  3318. deleteBomComponent(tempData).then(({data}) => {
  3319. if (data && data.code === 0) {
  3320. this.subDetailList = data.rows.subDetailList
  3321. this.$message({
  3322. message: '操作成功',
  3323. type: 'success',
  3324. duration: 1500,
  3325. onClose: () => {}
  3326. })
  3327. } else {
  3328. this.$alert(data.msg, '错误', {
  3329. confirmButtonText: '确定'
  3330. })
  3331. }
  3332. })
  3333. })
  3334. }
  3335. },
  3336. // /**
  3337. // * 子物料
  3338. // * @param row
  3339. // */
  3340. // componentClickRow (row) {
  3341. // this.$refs.componentTable.toggleRowSelection(row)
  3342. // },
  3343. /**
  3344. * 新增子明细方法
  3345. */
  3346. componentDataSave (isClose) {
  3347. if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
  3348. this.$message.warning('序号不能为空!')
  3349. return
  3350. }
  3351. if (this.componentData.partNo === '' || this.componentData.partNo == null) {
  3352. this.$message.warning('请选择主记录物料编码!')
  3353. return
  3354. }
  3355. if (this.componentData.bomType === '' || this.componentData.bomType == null) {
  3356. this.$message.warning('请选择主记录制造类型!')
  3357. return
  3358. }
  3359. if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
  3360. this.$message.warning('请填写主记录BOM版本号!')
  3361. return
  3362. }
  3363. if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
  3364. this.$message.warning('请选择子物料编码!')
  3365. return
  3366. }
  3367. if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) {
  3368. this.$message.warning('请选择消耗项目!')
  3369. return
  3370. }
  3371. if (this.componentData.qtyPerAssembly === '' || this.componentData.qtyPerAssembly == null) {
  3372. this.$message.warning('请填写单位用量!')
  3373. return
  3374. }
  3375. if (this.componentData.qtyPerAssembly === 0) {
  3376. this.$message.warning('单位用量不能为0!')
  3377. return
  3378. }
  3379. if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
  3380. this.$message.warning('请填写调机量!')
  3381. return
  3382. }
  3383. if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
  3384. this.$message.warning('请填写损耗率!')
  3385. return
  3386. }
  3387. if (this.componentData.issueType === '' || this.componentData.issueType == null) {
  3388. this.$message.warning('请选择生产属性!')
  3389. return
  3390. }
  3391. if (this.componentData.flag === '1') {
  3392. saveBomComponent(this.componentData).then(({data}) => {
  3393. if (data && data.code === 0) {
  3394. this.subDetailList = data.rows.subDetailList
  3395. if (isClose) {
  3396. if (this.subDetailTable === 'by_products') {
  3397. this.saveByProductModal()
  3398. } else {
  3399. this.saveComponentModal()
  3400. }
  3401. } else {
  3402. this.componentSaveModal = false
  3403. }
  3404. this.$message({
  3405. message: '操作成功',
  3406. type: 'success',
  3407. duration: 1500,
  3408. onClose: () => {}
  3409. })
  3410. } else {
  3411. this.$alert(data.msg, '错误', {
  3412. confirmButtonText: '确定'
  3413. })
  3414. }
  3415. })
  3416. } else if (this.componentData.flag === '2') {
  3417. updateBomComponent(this.componentData).then(({data}) => {
  3418. if (data && data.code === 0) {
  3419. this.subDetailList = data.rows.subDetailList
  3420. this.componentSaveModal = false
  3421. this.$message({
  3422. message: '操作成功',
  3423. type: 'success',
  3424. duration: 1500,
  3425. onClose: () => {}
  3426. })
  3427. } else {
  3428. this.$alert(data.msg, '错误', {
  3429. confirmButtonText: '确定'
  3430. })
  3431. }
  3432. })
  3433. }
  3434. },
  3435. // 计算单位用量
  3436. computeQtyPerAssembly () {
  3437. if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
  3438. this.$message.warning('序号不能为空!')
  3439. return
  3440. }
  3441. if (this.componentData.partNo === '' || this.componentData.partNo == null) {
  3442. this.$message.warning('请选择主记录物料编码!')
  3443. return
  3444. }
  3445. if (this.componentData.bomType === '' || this.componentData.bomType == null) {
  3446. this.$message.warning('请选择主记录制造类型!')
  3447. return
  3448. }
  3449. if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
  3450. this.$message.warning('请填写主记录BOM版本号!')
  3451. return
  3452. }
  3453. if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
  3454. this.$message.warning('请选择子物料编码!')
  3455. return
  3456. }
  3457. if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) {
  3458. this.$message.warning('请选择消耗项目!')
  3459. return
  3460. }
  3461. if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
  3462. this.$message.warning('请填写调机量!')
  3463. return
  3464. }
  3465. if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
  3466. this.$message.warning('请填写损耗率!')
  3467. return
  3468. }
  3469. if (this.componentData.issueType === '' || this.componentData.issueType == null) {
  3470. this.$message.warning('请选择生产属性!')
  3471. return
  3472. }
  3473. this.computeLoading = true
  3474. if (this.componentData.flag === '1') {
  3475. computeQtyPerAssemblySave(this.componentData).then(({data}) => {
  3476. if (data && data.code === 0) {
  3477. this.subDetailList = data.rows.subDetailList
  3478. // 换成修改子物料模态框
  3479. this.updateComponentModal(data.rows.rowData)
  3480. this.$message({
  3481. message: '操作成功',
  3482. type: 'success',
  3483. duration: 1500,
  3484. onClose: () => {}
  3485. })
  3486. } else {
  3487. this.$alert(data.msg, '错误', {
  3488. confirmButtonText: '确定'
  3489. })
  3490. }
  3491. this.computeLoading = false
  3492. }).catch(() => {
  3493. this.computeLoading = false
  3494. })
  3495. } else if (this.componentData.flag === '2') {
  3496. computeQtyPerAssemblyEdit(this.componentData).then(({data}) => {
  3497. if (data && data.code === 0) {
  3498. this.subDetailList = data.rows.subDetailList
  3499. // 换成修改子物料模态框
  3500. this.updateComponentModal(data.rows.rowData)
  3501. this.$message({
  3502. message: '操作成功',
  3503. type: 'success',
  3504. duration: 1500,
  3505. onClose: () => {}
  3506. })
  3507. } else {
  3508. this.$alert(data.msg, '错误', {
  3509. confirmButtonText: '确定'
  3510. })
  3511. }
  3512. this.computeLoading = false
  3513. }).catch(() => {
  3514. this.computeLoading = false
  3515. })
  3516. }
  3517. },
  3518. // 批量新增子件
  3519. batchComponentDataSave () {
  3520. this.$confirm("是否确认添加该"+ this.choosePartList.length +"条子件记录?", "提示", {
  3521. confirmButtonText: "确定",
  3522. cancelButtonText: "取消",
  3523. type: "warning"
  3524. }).then(() => {
  3525. let tempData = {
  3526. site: this.modalData.site,
  3527. buNo: this.modalData.buNo,
  3528. partNo: this.modalData.partNo,
  3529. engChgLevel: this.modalData.engChgLevel,
  3530. bomType: this.modalData.bomType,
  3531. alternativeNo: this.detailData.alternativeNo,
  3532. consumptionItem: 'Consumed',
  3533. qtyPerAssembly: 0,
  3534. componentScrap: 0,
  3535. shrinkageFactor: this.batchComponentPartData.shrinkageFactor,
  3536. lineItemNo: '',
  3537. operationId: '',
  3538. operationNo: '',
  3539. issueToLoc: '',
  3540. issueToLocName: '',
  3541. noteText: '',
  3542. createBy: this.$store.state.user.name,
  3543. lineSequence: '',
  3544. issueType: 'Reserve And Backflush',
  3545. productFlag: 'component',
  3546. batchSaveList: this.choosePartList
  3547. }
  3548. batchSaveBomComponent(tempData).then(({data}) => {
  3549. if (data && data.code === 0) {
  3550. this.subDetailList = data.rows.subDetailList
  3551. this.batchComponentPartModelFlag = false
  3552. this.$message({
  3553. message: '操作成功',
  3554. type: 'success',
  3555. duration: 1500,
  3556. onClose: () => {}
  3557. })
  3558. } else {
  3559. this.$alert(data.msg, '错误', {
  3560. confirmButtonText: '确定'
  3561. })
  3562. }
  3563. this.batchComponentPartData = {
  3564. site: '',
  3565. buNo: '',
  3566. partNo: '',
  3567. partDesc: '',
  3568. shrinkageFactor: '',
  3569. page: 1,
  3570. limit: 10
  3571. }
  3572. })
  3573. })
  3574. },
  3575. batchAddPart () {
  3576. if (this.batchComponentSelections == null || this.batchComponentSelections.length === 0) {
  3577. this.$message.warning('请选择可选物料!')
  3578. return
  3579. }
  3580. // 创建一个 Set 来存储已选择的元素
  3581. const chosenSet = new Set(this.choosePartList.map(item => `${item.site}-${item.partNo}`))
  3582. // 检查是否有重复元素
  3583. const hasDuplicates = this.batchComponentSelections.some(item => chosenSet.has(`${item.site}-${item.partNo}`))
  3584. if (hasDuplicates) {
  3585. this.$message.warning('所选物料中包含已存在的物料,请重新选择!')
  3586. return
  3587. }
  3588. this.choosePartList = [...this.choosePartList, ...this.batchComponentSelections]
  3589. },
  3590. batchDeletePart () {
  3591. if (this.batchComponentSelections2 == null || this.batchComponentSelections2.length === 0) {
  3592. this.$message.warning('请选择已选物料!')
  3593. return
  3594. }
  3595. // 创建一个 Set 来存储 batchComponentSelections 中的键值对
  3596. const set = new Set(this.batchComponentSelections2.map(item => `${item.site}-${item.partNo}`))
  3597. // 过滤 choosePartList,移除与 batchComponentSelections 匹配的元素
  3598. this.choosePartList = this.choosePartList.filter(item => !set.has(`${item.site}-${item.partNo}`))
  3599. },
  3600. /**
  3601. * 回车事件
  3602. */
  3603. focusNextInput (index, type) {
  3604. let aaa = ''
  3605. if (this.subDetailList.length - 1 === index) {
  3606. aaa = `${type}0`
  3607. } else {
  3608. aaa = `${type}${index + 1}`
  3609. }
  3610. this.$nextTick(() => {
  3611. this.$refs[aaa].focus()
  3612. })
  3613. },
  3614. /**
  3615. * 保存主表信息
  3616. */
  3617. saveBomHeader () {
  3618. if (this.modalData.bu === '' || this.modalData.bu == null) {
  3619. this.$message.warning('请选择BU!')
  3620. return
  3621. }
  3622. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  3623. this.$message.warning('请先选择Bom物料!')
  3624. return
  3625. }
  3626. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  3627. this.$message.warning('请先填写Bom版本号!')
  3628. return
  3629. }
  3630. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  3631. this.$message.warning('请先选择制造类型!')
  3632. return
  3633. }
  3634. if (this.modalData.processUnit === '' || this.modalData.processUnit == null) {
  3635. this.$message.warning('请先选择工序单位!')
  3636. return
  3637. }
  3638. this.saveHeaderLoading = true
  3639. // 新增主表信息
  3640. saveBomHeader(this.modalData).then(({data}) => {
  3641. if (data && data.code === 0) {
  3642. this.modalData = {
  3643. flag: '1',
  3644. title: 'bom新增',
  3645. bu: data.rows.modalData.site + '_' + data.rows.modalData.buNo,
  3646. site: data.rows.modalData.site,
  3647. buNo: data.rows.modalData.buNo,
  3648. partNo: data.rows.modalData.partNo,
  3649. partDesc: data.rows.modalData.partDesc,
  3650. engChgLevel: data.rows.modalData.engChgLevel,
  3651. bomType: data.rows.modalData.bomType,
  3652. noteText: data.rows.modalData.noteText,
  3653. effPhaseInDate: data.rows.modalData.effPhaseInDate,
  3654. effPhaseOutDate: data.rows.modalData.effPhaseOutDate,
  3655. engRevision: data.rows.modalData.engRevision,
  3656. netWeight: data.rows.modalData.netWeight,
  3657. yieldRate: data.rows.modalData.yieldRate,
  3658. printUnit: data.rows.modalData.printUnit,
  3659. printUnitName: data.rows.modalData.printUnitName,
  3660. shrinkageFactor: new Decimal(100).sub(new Decimal(data.rows.modalData.yieldRate)).toNumber(),
  3661. processUnit: data.rows.modalData.processUnit,
  3662. processUnitName: data.rows.modalData.processUnitName
  3663. }
  3664. this.detailDataList = data.rows.detailDataList
  3665. this.detailData = data.rows.detailData
  3666. this.subDetailList = []
  3667. this.modalDisableFlag = true
  3668. this.headerSaveFlag = false
  3669. this.$message({
  3670. message: '操作成功',
  3671. type: 'success',
  3672. duration: 1500,
  3673. onClose: () => {}
  3674. })
  3675. } else {
  3676. this.$alert(data.msg, '错误', {
  3677. confirmButtonText: '确定'
  3678. })
  3679. }
  3680. this.saveHeaderLoading = false
  3681. })
  3682. },
  3683. /**
  3684. * 复制bom的模态框
  3685. */
  3686. copyBomRevision () {
  3687. this.copyBomData = {
  3688. site: this.modalData.site,
  3689. buNo: this.modalData.buNo,
  3690. partNo: this.modalData.partNo,
  3691. partDesc: this.modalData.partDesc,
  3692. engChgLevel: this.modalData.engChgLevel + 1,
  3693. bomType: this.modalData.bomType,
  3694. effPhaseInDate: this.dayjs(new Date()).format('YYYY-MM-DD'),
  3695. effPhaseOutDate: '',
  3696. previousVersion: {},
  3697. createBy: this.$store.state.user.name,
  3698. }
  3699. this.copyPartData = {
  3700. type: '1',
  3701. site: this.modalData.site,
  3702. buNo: this.modalData.buNo,
  3703. partNo: '',
  3704. partDesc: '',
  3705. page: 1,
  3706. limit: 10
  3707. }
  3708. this.copyBomModelFlag = true
  3709. },
  3710. /**
  3711. * 复制bom的方法
  3712. */
  3713. copyBom () {
  3714. if (this.copyBomData.partNo === '' || this.copyBomData.partNo == null) {
  3715. this.$message.warning('请选择Bom物料!')
  3716. return
  3717. }
  3718. if (this.copyBomData.engChgLevel === '' || this.copyBomData.engChgLevel == null) {
  3719. this.$message.warning('请填写Bom版本号!')
  3720. return
  3721. }
  3722. if (this.copyBomData.bomType === '' || this.copyBomData.bomType == null) {
  3723. this.$message.warning('请选择制造类型!')
  3724. return
  3725. }
  3726. if (this.copyBomData.effPhaseOutDate != null && this.copyBomData.effPhaseOutDate !== '' && this.copyBomData.effPhaseOutDate < this.copyBomData.effPhaseInDate) {
  3727. this.$message.warning('失效日期必须大于生效日期!')
  3728. return
  3729. }
  3730. this.copyBomData.previousVersion = this.modalData
  3731. this.copyLoading = true
  3732. // 新增主表信息
  3733. copyBom(this.copyBomData).then(({data}) => {
  3734. if (data && data.code === 0) {
  3735. this.copyBomModelFlag = false
  3736. this.updateModal(data.rows)
  3737. this.$message({
  3738. message: '操作成功',
  3739. type: 'success',
  3740. duration: 1500,
  3741. onClose: () => {}
  3742. })
  3743. } else {
  3744. this.$alert(data.msg, '错误', {
  3745. confirmButtonText: '确定'
  3746. })
  3747. }
  3748. this.copyLoading = false
  3749. }).catch(()=>{
  3750. this.copyLoading = false
  3751. })
  3752. },
  3753. /**
  3754. * 复制alternative的模态框
  3755. */
  3756. copyBomAlternative () {
  3757. this.copyAlternativeData = {
  3758. site: this.detailData.site,
  3759. buNo: this.detailData.buNo,
  3760. partNo: this.detailData.partNo,
  3761. partDesc: this.modalData.partDesc,
  3762. engChgLevel: this.detailData.engChgLevel,
  3763. bomType: this.detailData.bomType,
  3764. alternativeNo: this.detailData.alternativeNo,
  3765. alternativeDescription: this.detailData.alternativeDescription,
  3766. minLotQty: this.detailData.minLotQty,
  3767. defaultFlag: this.detailData.defaultFlag,
  3768. detailNoteText: this.detailData.detailNoteText,
  3769. status: 'Tentative',
  3770. previousVersion: {},
  3771. createBy: this.$store.state.user.name
  3772. }
  3773. this.copyPartData = {
  3774. type: '2',
  3775. site: this.detailData.site,
  3776. buNo: this.detailData.buNo,
  3777. partNo: '',
  3778. partDesc: '',
  3779. page: 1,
  3780. limit: 10
  3781. }
  3782. this.copyAlternativeModelFlag = true
  3783. },
  3784. /**
  3785. * 复制alternative的方法
  3786. */
  3787. copyAlternative () {
  3788. if (this.copyAlternativeData.partNo === '' || this.copyAlternativeData.partNo == null) {
  3789. this.$message.warning('请选择Bom物料!')
  3790. return
  3791. }
  3792. if (this.copyAlternativeData.engChgLevel === '' || this.copyAlternativeData.engChgLevel == null) {
  3793. this.$message.warning('请填写Bom版本号!')
  3794. return
  3795. }
  3796. if (this.copyAlternativeData.bomType === '' || this.copyAlternativeData.bomType == null) {
  3797. this.$message.warning('请选择制造类型!')
  3798. return
  3799. }
  3800. if (this.copyAlternativeData.alternativeNo === '' || this.copyAlternativeData.alternativeNo == null) {
  3801. this.$message.warning('请填写替代编码!')
  3802. return
  3803. }
  3804. if (this.copyAlternativeData.alternativeDescription === '' || this.copyAlternativeData.alternativeDescription == null) {
  3805. this.$message.warning('请填写替代名称!')
  3806. return
  3807. }
  3808. this.copyAlternativeData.previousVersion = this.detailData
  3809. copyAlternative(this.copyAlternativeData).then(({data}) => {
  3810. if (data && data.code === 0) {
  3811. this.updateModal(data.rows)
  3812. this.copyAlternativeModelFlag = false
  3813. this.$message({
  3814. message: '操作成功',
  3815. type: 'success',
  3816. duration: 1500,
  3817. onClose: () => {}
  3818. })
  3819. } else {
  3820. this.$alert(data.msg, '错误', {
  3821. confirmButtonText: '确定'
  3822. })
  3823. }
  3824. })
  3825. },
  3826. /**
  3827. * 新增替代方法
  3828. */
  3829. detailDataSave () {
  3830. if (this.saveDetailData.partNo === '' || this.saveDetailData.partNo == null) {
  3831. this.$message.warning('请先选择Bom物料!')
  3832. return
  3833. }
  3834. if (this.saveDetailData.engChgLevel === '' || this.saveDetailData.engChgLevel == null) {
  3835. this.$message.warning('请先填写Bom版本号!')
  3836. return
  3837. }
  3838. if (this.saveDetailData.bomType === '' || this.saveDetailData.bomType == null) {
  3839. this.$message.warning('请先选择制造类型!')
  3840. return
  3841. }
  3842. if (this.saveDetailData.alternativeNo === '' || this.saveDetailData.alternativeNo == null) {
  3843. this.$message.warning('请填写替代编码!')
  3844. return
  3845. }
  3846. if (this.saveDetailData.alternativeDescription === '' || this.saveDetailData.alternativeDescription == null) {
  3847. this.$message.warning('请填写替代名称!')
  3848. return
  3849. }
  3850. if (this.saveDetailData.status === '' || this.saveDetailData.status == null) {
  3851. this.$message.warning('请选择替代状态!')
  3852. return
  3853. }
  3854. if (this.saveDetailData.minLotQty === '' || this.saveDetailData.minLotQty == null) {
  3855. this.$message.warning('请填写最小订单数!')
  3856. return
  3857. }
  3858. this.saveDetailLoading = true
  3859. if (this.saveDetailData.flag === '1') {
  3860. bomDetailSave(this.saveDetailData).then(({data}) => {
  3861. if (data && data.code === 0) {
  3862. this.detailDataList = data.rows
  3863. this.detailData = this.saveDetailData
  3864. this.subDetailList = []
  3865. this.saveDetailModalFlag = false
  3866. this.$message({
  3867. message: '操作成功',
  3868. type: 'success',
  3869. duration: 1500,
  3870. onClose: () => {}
  3871. })
  3872. } else {
  3873. this.$alert(data.msg, '错误', {
  3874. confirmButtonText: '确定'
  3875. })
  3876. }
  3877. this.saveDetailLoading = false
  3878. })
  3879. } else {
  3880. bomDetailUpdate(this.saveDetailData).then(({data}) => {
  3881. if (data && data.code === 0) {
  3882. this.detailDataList = data.rows.detailDataList
  3883. this.detailData = data.rows.detailData
  3884. this.subDetailList = data.rows.subDetailList
  3885. this.saveDetailModalFlag = false
  3886. this.$message({
  3887. message: '操作成功',
  3888. type: 'success',
  3889. duration: 1500,
  3890. onClose: () => {}
  3891. })
  3892. } else {
  3893. this.$alert(data.msg, '错误', {
  3894. confirmButtonText: '确定'
  3895. })
  3896. }
  3897. this.saveDetailLoading = false
  3898. })
  3899. }
  3900. },
  3901. /**
  3902. * 删除替代
  3903. */
  3904. deleteBomDetail () {
  3905. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  3906. this.$message.warning('请选择要删除的替代编码!')
  3907. return
  3908. }
  3909. if (this.detailData.alternativeNo === '*') {
  3910. this.$message.warning('当前为默认替代,不可以删除!')
  3911. return
  3912. }
  3913. this.$confirm(`是否删除这项替代?`, '提示', {
  3914. confirmButtonText: '确定',
  3915. cancelButtonText: '取消',
  3916. type: 'warning'
  3917. }).then(() => {
  3918. bomDetailDelete(this.detailData).then(({data}) => {
  3919. if (data && data.code === 0) {
  3920. this.detailData = data.rows.detailData
  3921. this.detailDataList = data.rows.detailDataList
  3922. this.subDetailList = data.rows.subDetailList
  3923. this.$message({
  3924. message: '操作成功',
  3925. type: 'success',
  3926. duration: 1500,
  3927. onClose: () => {}
  3928. })
  3929. } else {
  3930. this.$alert(data.msg, '错误', {
  3931. confirmButtonText: '确定'
  3932. })
  3933. }
  3934. })
  3935. })
  3936. },
  3937. /**
  3938. * 修改替代状态为 Buildable
  3939. */
  3940. updateStatusToBuildable () {
  3941. this.$confirm(`是否修改状态为Buildable?`, '提示', {
  3942. confirmButtonText: '确定',
  3943. cancelButtonText: '取消',
  3944. type: 'warning'
  3945. }).then(() => {
  3946. updateAlternativeStatus(this.detailData).then(({data}) => {
  3947. if (data && data.code === 0) {
  3948. this.detailDataList = data.rows.detailDataList
  3949. this.detailData = data.rows.detailData
  3950. this.subDetailList = data.rows.subDetailList
  3951. this.$message({
  3952. message: '操作成功',
  3953. type: 'success',
  3954. duration: 1500,
  3955. onClose: () => {}
  3956. })
  3957. } else {
  3958. this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
  3959. // 刷新替代和子明细
  3960. this.alternativeChange()
  3961. }
  3962. })
  3963. })
  3964. },
  3965. /**
  3966. * 修改替代状态为 Obsolete
  3967. */
  3968. updateStatusToObsolete () {
  3969. this.$confirm(`是否修改状态为Obsolete?`, '提示', {
  3970. confirmButtonText: '确定',
  3971. cancelButtonText: '取消',
  3972. type: 'warning'
  3973. }).then(() => {
  3974. updateAlternativeStatus(this.detailData).then(({data}) => {
  3975. if (data && data.code === 0) {
  3976. this.detailDataList = data.rows.detailDataList
  3977. this.detailData = data.rows.detailData
  3978. this.subDetailList = data.rows.subDetailList
  3979. this.$message({
  3980. message: '操作成功',
  3981. type: 'success',
  3982. duration: 1500,
  3983. onClose: () => {}
  3984. })
  3985. } else {
  3986. this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
  3987. // 刷新替代和子明细
  3988. this.alternativeChange()
  3989. }
  3990. })
  3991. })
  3992. },
  3993. /**
  3994. * 替代改变事件
  3995. */
  3996. alternativeChange () {
  3997. this.alternativeLoading = true
  3998. queryBomComponent(this.detailData).then(({data}) => {
  3999. if (data && data.code === 0) {
  4000. this.detailDataList = data.rows.detailDataList
  4001. this.detailData = data.rows.detailData
  4002. this.subDetailList = data.rows.subDetailList
  4003. } else {
  4004. this.$alert(data.msg, '错误', {
  4005. confirmButtonText: '确定'
  4006. })
  4007. }
  4008. this.alternativeLoading = false
  4009. }).catch(()=>{
  4010. this.alternativeLoading = false
  4011. })
  4012. },
  4013. /**
  4014. * 根据物料编码查询工序
  4015. */
  4016. queryOperationList () {
  4017. this.operationData.site = this.modalData.site
  4018. this.operationData.buNo = this.modalData.buNo
  4019. this.operationData.partNo = this.modalData.partNo
  4020. // 查询所有
  4021. queryOperationList(this.operationData).then(({data}) => {
  4022. if (data && data.code === 0) {
  4023. this.operationList = data.rows
  4024. this.operationData = {
  4025. site: this.modalData.site,
  4026. buNo: this.modalData.buNo,
  4027. partNo: this.modalData.partNo,
  4028. routingRevision: '',
  4029. routingType: '',
  4030. alternativeNo: '',
  4031. operationNo: '',
  4032. operationName: '',
  4033. }
  4034. this.operationModelFlag = true
  4035. } else {
  4036. this.$alert(data.msg, '错误', {
  4037. confirmButtonText: '确定'
  4038. })
  4039. }
  4040. })
  4041. },
  4042. // ======== chooseList相关方法 ========
  4043. /**
  4044. * 获取基础数据列表S
  4045. * @param val
  4046. * @param type
  4047. */
  4048. getBaseList (val, type) {
  4049. this.tagNo = val
  4050. this.$nextTick(() => {
  4051. let strVal = ''
  4052. let conSql = ''
  4053. if (val === 215) {
  4054. strVal = this.componentData.issueToLoc
  4055. }
  4056. if (val === 510) {
  4057. conSql = " and site = '" + this.modalData.site + "'"
  4058. }
  4059. this.$refs.baseList.init(val, strVal, conSql)
  4060. })
  4061. },
  4062. /**
  4063. * 列表方法的回调
  4064. * @param val
  4065. */
  4066. getBaseData (val) {
  4067. if (this.tagNo === 215) {
  4068. this.componentData.issueToLoc = val.location_id
  4069. this.componentData.issueToLocName = val.location_name
  4070. }
  4071. if (this.tagNo === 510) {
  4072. this.modalData.processUnit = val.UMID
  4073. this.modalData.processUnitName = val.UMName
  4074. }
  4075. },
  4076. // ======== 导出相关方法 ========
  4077. /**
  4078. * 导出excel
  4079. */
  4080. async createExportData () {
  4081. this.searchData.limit = -1
  4082. this.searchData.page = 1
  4083. await bomManagementSearch(this.searchData).then(({data}) => {
  4084. this.resultList = data.page.list
  4085. })
  4086. return this.resultList
  4087. },
  4088. startDownload () {},
  4089. finishDownload () {},
  4090. fields () {
  4091. let json = '{'
  4092. this.columnList.forEach((item, index) => {
  4093. if (index == this.columnList.length - 1) {
  4094. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  4095. } else {
  4096. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  4097. }
  4098. })
  4099. json += '}'
  4100. let s = eval('(' + json + ')')
  4101. return s
  4102. },
  4103. // 动态列开始 获取 用户保存的 格式列
  4104. async getTableUserColumn(tableId, columnId) {
  4105. let queryTableUser = {
  4106. userId: this.$store.state.user.name,
  4107. functionId: this.$route.meta.menuId,
  4108. tableId: tableId,
  4109. status: true,
  4110. languageCode: this.$i18n.locale
  4111. }
  4112. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  4113. if (data.rows.length > 0) {
  4114. switch (columnId) {
  4115. case 1:
  4116. this.columnList = data.rows
  4117. break;
  4118. }
  4119. } else {
  4120. this.getColumnList(tableId, columnId)
  4121. }
  4122. })
  4123. },
  4124. // 获取 tableDefault 列
  4125. async getColumnList (tableId, columnId) {
  4126. let queryTable= {
  4127. functionId: this.$route.meta.menuId,
  4128. tableId: tableId,
  4129. languageCode: this.$i18n.locale
  4130. }
  4131. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  4132. if (!data.rows.length === 0) {
  4133. switch (columnId) {
  4134. case 1:
  4135. this.columnList = data.rows
  4136. break;
  4137. }
  4138. }
  4139. })
  4140. },
  4141. //获取按钮的权限数据
  4142. getButtonAuthData () {
  4143. let searchFlag = this.isAuth(this.menuId+":search")
  4144. let saveFlag = this.isAuth(this.menuId+":save")
  4145. let updateFlag = this.isAuth(this.menuId+":update")
  4146. let deleteFlag = this.isAuth(this.menuId+":delete")
  4147. //处理页面的权限数据
  4148. this.authSearch = !searchFlag
  4149. this.authSave = !saveFlag
  4150. this.authUpdate = !updateFlag
  4151. this.authDelete = !deleteFlag
  4152. },
  4153. // 切换到routing
  4154. checkOutToRouting (partNo) {
  4155. if (this.$router.resolve('part-routingManagement').resolved.name === '404') {
  4156. this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',})
  4157. } else {
  4158. this.$router.push({name:"part-routingManagement",params:{partNo: partNo}})
  4159. }
  4160. }
  4161. }
  4162. }
  4163. </script>
  4164. <style scoped lang="scss">
  4165. /deep/ .detail-tab .el-tabs__content {
  4166. height: 165px;
  4167. padding: 15px 0px 0px 0px;
  4168. }
  4169. /deep/ .sub_detail-tab .el-tabs__content {
  4170. height: 280px;
  4171. padding: 0px;
  4172. }
  4173. .el-table /deep/ .cell{
  4174. height: auto;
  4175. line-height: 1.5;
  4176. }
  4177. .numInput /deep/ .el-input__inner{
  4178. text-align: right;
  4179. }
  4180. /deep/ .inlineNumber input::-webkit-outer-spin-button,
  4181. /deep/ .inlineNumber input::-webkit-inner-spin-button {
  4182. -webkit-appearance: none;
  4183. }
  4184. /deep/ .inlineNumber input[type="number"]{
  4185. -moz-appearance: textfield;
  4186. padding-right: 5px !important;
  4187. }
  4188. </style>