plm前端
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.

4083 lines
137 KiB

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