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.

2950 lines
99 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 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-button :loading="queryLoading" @click="getDataList()">查询</el-button>
  13. <el-button type="primary" @click="addModal()">新增</el-button>
  14. <el-button type="primary" @click="delModal()">删除</el-button>
  15. <download-excel
  16. :fields="fields()"
  17. :data="exportData"
  18. type="xls"
  19. :name="exportName"
  20. :header="exportHeader"
  21. :footer="exportFooter"
  22. :fetch="createExportData"
  23. :before-generate="startDownload"
  24. :before-finish="finishDownload"
  25. worksheet="导出信息"
  26. class="el-button el-button--primary el-button--medium">
  27. {{ "导出" }}
  28. </download-excel>
  29. </el-form-item>
  30. </el-form>
  31. <!-- bom列表 -->
  32. <el-table
  33. :height="height"
  34. :data="dataList"
  35. border
  36. @selection-change="selectionBom"
  37. style="width: 100%;">
  38. <el-table-column
  39. type="selection"
  40. header-align="center"
  41. align="center"
  42. :selectable="selectFlag"
  43. width="50">
  44. </el-table-column>
  45. <el-table-column
  46. v-for="(item,index) in columnList" :key="index"
  47. :sortable="item.columnSortable"
  48. :prop="item.columnProp"
  49. :header-align="item.headerAlign"
  50. :show-overflow-tooltip="item.showOverflowTooltip"
  51. :align="item.align"
  52. :fixed="item.fixed === ''?false:item.fixed"
  53. :min-width="item.columnWidth"
  54. :label="item.columnLabel">
  55. <template slot-scope="scope">
  56. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  57. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. fixed="right"
  62. header-align="center"
  63. align="center"
  64. width="120"
  65. label="操作">
  66. <template slot-scope="scope">
  67. <a type="text" size="small" @click="updateModal(scope.row)">编辑</a>
  68. <a type="text" size="small" @click="checkOutToRouting(scope.row.partNo)">切换Routing</a>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <!-- 复选统计 -->
  73. <selectDiv ref="selectDiv"></selectDiv>
  74. <!-- 分页插件 -->
  75. <el-pagination style="margin-top: 0px"
  76. @size-change="sizeChangeHandle"
  77. @current-change="currentChangeHandle"
  78. :current-page="pageIndex"
  79. :page-sizes="[20, 50, 100, 200, 500]"
  80. :page-size="pageSize"
  81. :total="totalPage"
  82. layout="total, sizes, prev, pager, next, jumper">
  83. </el-pagination>
  84. <!-- bom新增/编辑模态框 -->
  85. <el-dialog :close-on-click-modal="false" :before-close="closeModalX" v-drag :visible.sync="modalFlag" width="1110px">
  86. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 5px">
  87. <el-form-item prop="partNo" :rules="rules.partNo">
  88. <span v-if="!modalDisableFlag" slot="label" @click="queryPartList"><a herf="#">物料编码</a></span>
  89. <span v-else slot="label">物料编码</span>
  90. <el-input v-model="modalData.partNo" :disabled="modalDisableFlag" style="width: 221px"></el-input>
  91. </el-form-item>
  92. <el-form-item :label="'物料名称'" prop="partDesc" :rules="rules.partDesc">
  93. <el-input v-model="modalData.partDesc" disabled style="width: 221px"></el-input>
  94. </el-form-item>
  95. <el-form-item :label="'物料单位'">
  96. <el-input v-model="modalData.printUnitName" disabled style="width: 221px"></el-input>
  97. </el-form-item>
  98. <el-form-item :label="'制造类型'" prop="bomType" :rules="rules.bomType">
  99. <el-select v-model="modalData.bomType" :disabled="modalDisableFlag" style="width: 221px"> <!-- @change="bomTypeChange" -->
  100. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  101. <el-option label="Repair" value="Repair"></el-option>
  102. <el-option label="Purchase" value="Purchase"></el-option>
  103. <el-option label="Prototype" value="Prototype"></el-option>
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item :label="'净重'">
  107. <el-input class="inlineNumber numInput" v-model="modalData.netWeight" type="number" @input="handleInput(modalData.netWeight,1)" style="width: 120px"></el-input>
  108. </el-form-item>
  109. </el-form>
  110. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  111. <el-form-item label="生效日期" prop="effPhaseInDate" :rules="rules.effPhaseInDate">
  112. <el-date-picker
  113. :readonly="detailData.partNo != ''"
  114. style="width: 221px"
  115. v-model="modalData.effPhaseInDate"
  116. type="date"
  117. format="yyyy-MM-dd"
  118. placeholder="请选择日期"
  119. :editable=false>
  120. </el-date-picker>
  121. </el-form-item>
  122. <el-form-item label="失效日期">
  123. <el-date-picker
  124. readonly
  125. style="width: 221px"
  126. v-model="modalData.effPhaseOutDate"
  127. type="date"
  128. format="yyyy-MM-dd"
  129. placeholder="请选择日期"
  130. :editable=false>
  131. </el-date-picker>
  132. </el-form-item>
  133. <el-form-item :label="'BOM版本号'" prop="engChgLevel" :rules="rules.engChgLevel">
  134. <el-input v-model="modalData.engChgLevel" :disabled="modalDisableFlag" type="number" style="width: 221px"></el-input>
  135. </el-form-item>
  136. <el-form-item :label="'工程版本号'">
  137. <el-input v-model="modalData.engRevision" style="width: 221px"></el-input>
  138. </el-form-item>
  139. <el-form-item>
  140. <el-button v-if="modalData.flag === '1'" :loading="saveHeaderLoading" type="primary" @click="saveBomHeader" style="margin-top: 23px;width: 120px">保存</el-button>
  141. <el-button v-else type="primary" @click="copyBomRevision" style="margin-top: 23px;width: 120px">Copy</el-button>
  142. </el-form-item>
  143. </el-form>
  144. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  145. <el-form-item label="备注">
  146. <el-input type="textarea" v-model="modalData.noteText" :rows="3" resize='none' show-word-limit style="width: 1082px;height: 20px"></el-input>
  147. </el-form-item>
  148. </el-form>
  149. <el-tabs v-model="detailTable" style="margin-top: 50px; width: 100%; min-height: 120px" type="border-card" @tab-click="tabDetailClick" class="detail-tab">
  150. <!-- BOM明细信息页签 -->
  151. <el-tab-pane label="Product Structure" name="bom_detail">
  152. <el-form label-position="top" style="margin-top: -10px">
  153. <el-form-item>
  154. <el-button type="primary" @click="saveBomDetail" style="margin-left: 7px">新增</el-button>
  155. <el-button type="primary" @click="deleteBomDetail">删除</el-button>
  156. <el-button type="primary" @click="updateBomDetail">编辑</el-button>
  157. <el-button v-if="modalData.flag === '2'" type="primary" @click="copyBomAlternative()">Copy</el-button>
  158. <el-button v-if="detailData.status === 'Tentative' || detailData.status === 'Obsolete'" type="primary" @click="updateStatusToBuildable">Build</el-button>
  159. <el-button v-if="detailData.status === 'Buildable' && (modalData.effPhaseOutDate == null || modalData.effPhaseOutDate === '')" type="primary" @click="updateStatusToObsolete">Retire</el-button>
  160. <el-button v-if="modalData.flag === '2' && detailData.officialFlag !== 'Y'" type="primary" @click="toBecomeOfficialBom">转正式Bom</el-button>
  161. </el-form-item>
  162. </el-form>
  163. <el-form :inline="true" label-position="top" :model="detailData" :rules="rules" style="margin-left: 7px">
  164. <el-form-item :label="'替代编码'">
  165. <el-select v-model="detailData.alternativeNo" @change="alternativeChange" style="width: 221px">
  166. <el-option
  167. v-for = "(i, index) in detailDataList"
  168. :key = "index"
  169. :label = "i.alternativeNo"
  170. :value = "i.alternativeNo">
  171. </el-option>
  172. </el-select>
  173. </el-form-item>
  174. <el-form-item :label="'替代名称'">
  175. <el-input v-model="detailData.alternativeDescription" readonly style="width: 221px"></el-input>
  176. </el-form-item>
  177. <el-form-item :label="'状态'">
  178. <el-input v-model="detailData.status" readonly style="width: 221px"></el-input>
  179. </el-form-item>
  180. <el-form-item :label="'最小订单数'">
  181. <el-input class="inlineNumber numInput" v-model="detailData.minLotQty" @input="handleInput(detailData.minLotQty,2)" type="number" readonly style="width: 221px"></el-input>
  182. </el-form-item>
  183. </el-form>
  184. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px">
  185. <el-form-item label="备注">
  186. <el-input type="textarea" v-model="detailData.detailNoteText" :rows="3" resize='none' show-word-limit readonly style="width: 1073px;height: 20px"></el-input>
  187. </el-form-item>
  188. </el-form>
  189. </el-tab-pane>
  190. </el-tabs>
  191. <el-tabs v-model="subDetailTable" style="width: 100%; min-height: 330px" type="border-card" @tab-click="tabSubDetailClick" class="sub_detail-tab">
  192. <!-- BOM子明细信息页签 -->
  193. <el-tab-pane label="Components" name="bom_sub_detail">
  194. <el-form label-position="top" style="margin-top: 5px">
  195. <el-form-item>
  196. <el-button type="primary" @click="saveComponentModal" style="margin-left: 7px">新增</el-button>
  197. <el-button type="primary" @click="deleteComponentPart">删除</el-button>
  198. </el-form-item>
  199. </el-form>
  200. <el-table
  201. :data="subDetailList"
  202. height="256px"
  203. border
  204. ref="componentTable"
  205. @row-click="componentClickRow"
  206. :row-class-name="rowClassName"
  207. @selection-change="componentSelectionChange"
  208. style="width:100%">
  209. <el-table-column type="selection" align="center" width="50"></el-table-column>
  210. <el-table-column
  211. v-for="(item,index) in columnSubDetailList" :key="index"
  212. :sortable="item.columnSortable"
  213. :prop="item.columnProp"
  214. :header-align="item.headerAlign"
  215. :show-overflow-tooltip="item.showOverflowTooltip"
  216. :align="item.align"
  217. :fixed="item.fixed == ''?false:item.fixed"
  218. :min-width="item.columnWidth"
  219. :label="item.columnLabel">
  220. <template slot-scope="scope">
  221. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  222. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column
  226. fixed="right"
  227. header-align="center"
  228. align="center"
  229. width="100"
  230. label="操作">
  231. <template slot-scope="scope">
  232. <a type="text" size="small" @click="updateComponentModal(scope.row)">编辑</a>
  233. </template>
  234. </el-table-column>
  235. </el-table>
  236. </el-tab-pane>
  237. </el-tabs>
  238. <el-footer style="height:30px;margin-top:20px;text-align:center">
  239. <el-button :loading="saveAllLoading" type="primary" @click="saveData()">保存</el-button>
  240. <el-button type="primary" @click="closeModal()">关闭</el-button>
  241. </el-footer>
  242. </el-dialog>
  243. <!-- 明细新增模态框 -->
  244. <el-dialog title="替代" :close-on-click-modal="false" v-drag :visible.sync="saveDetailModalFlag" width="530px">
  245. <el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
  246. <el-form-item :label="'替代编码'" prop="alternativeNo" :rules="detailRules.alternativeNo">
  247. <el-input v-model="saveDetailData.alternativeNo" :disabled="saveDetailModalDisable" style="width: 235px"></el-input>
  248. </el-form-item>
  249. <el-form-item :label="'替代名称'" prop="alternativeDescription" :rules="detailRules.alternativeDescription">
  250. <el-input v-model="saveDetailData.alternativeDescription" style="width: 235px"></el-input>
  251. </el-form-item>
  252. </el-form>
  253. <el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
  254. <el-form-item :label="'状态'" prop="status" :rules="detailRules.status">
  255. <el-input v-model="saveDetailData.status" disabled style="width: 235px"></el-input>
  256. </el-form-item>
  257. <el-form-item :label="'最小订单数'" prop="minLotQty" :rules="detailRules.minLotQty">
  258. <el-input class="inlineNumber numInput" v-model="saveDetailData.minLotQty" @input="handleInput(saveDetailData.minLotQty,3)" type="number" style="width: 235px"></el-input>
  259. </el-form-item>
  260. </el-form>
  261. <el-form :inline="true" label-position="top" :model="saveDetailData" style="margin-left: 5px">
  262. <el-form-item label="备注">
  263. <el-input type="textarea" v-model="saveDetailData.detailNoteText" :rows="3" resize='none' show-word-limit style="width: 500px;height: 20px"></el-input>
  264. </el-form-item>
  265. </el-form>
  266. <el-footer style="height:35px;margin-top:65px;text-align:center">
  267. <el-button :loading="saveDetailLoading" type="primary" @click="detailDataSave()">保存</el-button>
  268. <el-button type="primary" @click="saveDetailModalFlag = false">关闭</el-button>
  269. </el-footer>
  270. </el-dialog>
  271. <!-- 物料模态框 -->
  272. <el-dialog title="物料清单" :close-on-click-modal="false" v-drag :visible.sync="partModelFlag" width="900px">
  273. <div class="rq">
  274. <el-form :inline="true" label-position="top" :model="partData">
  275. <el-form-item :label="'物料编码'">
  276. <el-input v-model="partData.partNo" clearable style="width: 120px"></el-input>
  277. </el-form-item>
  278. <el-form-item :label="'物料名称'">
  279. <el-input v-model="partData.partDesc" clearable style="width: 120px"></el-input>
  280. </el-form-item>
  281. <el-form-item :label="' '">
  282. <el-button type="primary" @click="queryPartList()">查询</el-button>
  283. </el-form-item>
  284. </el-form>
  285. <el-table
  286. :height="300"
  287. :data="partList"
  288. @row-dblclick="getRowData"
  289. border
  290. style="width: 100%;">
  291. <el-table-column
  292. v-for="(item,index) in partColumnList" :key="index"
  293. :sortable="item.columnSortable"
  294. :prop="item.columnProp"
  295. :header-align="item.headerAlign"
  296. :show-overflow-tooltip="item.showOverflowTooltip"
  297. :align="item.align"
  298. :fixed="item.fixed==''?false:item.fixed"
  299. :min-width="item.columnWidth"
  300. :label="item.columnLabel">
  301. <template slot-scope="scope">
  302. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  303. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  304. </template>
  305. </el-table-column>
  306. </el-table>
  307. </div>
  308. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  309. <el-button type="primary" @click="partModelFlag=false">关闭</el-button>
  310. </el-footer>
  311. </el-dialog>
  312. <!-- 子明细物料模态框 -->
  313. <el-dialog title="物料清单" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="700px">
  314. <el-form :inline="true" label-position="top" :model="componentPartData">
  315. <el-form-item :label="'物料编码'">
  316. <el-input v-model="componentPartData.partNo" clearable style="width: 120px"></el-input>
  317. </el-form-item>
  318. <el-form-item :label="'物料名称'">
  319. <el-input v-model="componentPartData.partDesc" clearable style="width: 120px"></el-input>
  320. </el-form-item>
  321. <el-form-item :label="'正式物料'">
  322. <el-select v-model="componentPartData.status" clearable style="width: 120px">
  323. <el-option label="临时物料" value="N"></el-option>
  324. <el-option label="正式物料" value="Y"></el-option>
  325. </el-select>
  326. </el-form-item>
  327. <el-form-item :label="' '">
  328. <el-button type="primary" @click="queryComponentPartList()">查询</el-button>
  329. </el-form-item>
  330. </el-form>
  331. <el-table
  332. :height="250"
  333. :data="componentPartList"
  334. @row-dblclick="getComponentRowData"
  335. border
  336. style="width: 100%;">
  337. <el-table-column
  338. v-for="(item,index) in componentPartColumnList" :key="index"
  339. :sortable="item.columnSortable"
  340. :prop="item.columnProp"
  341. :header-align="item.headerAlign"
  342. :show-overflow-tooltip="item.showOverflowTooltip"
  343. :align="item.align"
  344. :fixed="item.fixed==''?false:item.fixed"
  345. :min-width="item.columnWidth"
  346. :label="item.columnLabel">
  347. <template slot-scope="scope">
  348. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  349. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  350. </template>
  351. </el-table-column>
  352. </el-table>
  353. <el-footer style="height:35px;margin-top:10px;text-align:center">
  354. <el-button type="primary" @click="componentPartModelFlag = false">关闭</el-button>
  355. </el-footer>
  356. </el-dialog>
  357. <!-- 子明细新增模态框 -->
  358. <el-dialog title="新增子物料" :close-on-click-modal="false" v-drag :visible.sync="componentSaveModal" width="800px">
  359. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  360. <el-form-item :label="'序号'" prop="lineSequence" :rules="componentRules.lineSequence">
  361. <el-input class="inlineNumber numInput" v-model="componentData.lineSequence" type="number" style="width: 49px"></el-input>
  362. </el-form-item>
  363. <el-form-item prop="componentPart" :rules="componentRules.componentPart">
  364. <span v-if="!componentDisableFlag" slot="label" @click="queryComponentPartList"><a herf="#">子物料编码</a></span>
  365. <span v-if="componentDisableFlag" slot="label">子物料编码</span>
  366. <el-input v-model="componentData.componentPart" :disabled="componentDisableFlag" style="width: 175px"></el-input>
  367. </el-form-item>
  368. <el-form-item :label="'子物料名称'">
  369. <el-input v-model="componentData.componentPartDesc" disabled style="width: 327px"></el-input>
  370. </el-form-item>
  371. <el-form-item :label="'单位'">
  372. <el-input v-model="componentData.printUnitName" disabled style="width: 165px"></el-input>
  373. </el-form-item>
  374. </el-form>
  375. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  376. <el-form-item :label="'单位用量'" prop="qtyPerAssembly" :rules="componentRules.qtyPerAssembly">
  377. <el-input class="inlineNumber numInput" v-model="componentData.qtyPerAssembly" @input="handleInput16(componentData.qtyPerAssembly,1)" type="number" style="width: 144px"></el-input>
  378. </el-form-item>
  379. <el-form-item :label="'调机量'" prop="componentScrap" :rules="componentRules.componentScrap">
  380. <el-input class="inlineNumber numInput" v-model="componentData.componentScrap" @input="handleInput(componentData.componentScrap,5)" type="number" style="width: 80px"></el-input>
  381. </el-form-item>
  382. <el-form-item :label="'损耗率%'" prop="shrinkageFactor" :rules="componentRules.shrinkageFactor">
  383. <el-input class="inlineNumber numInput" v-model="componentData.shrinkageFactor" @input="handleInputB(componentData.shrinkageFactor)" type="number" style="width: 80px"></el-input>
  384. </el-form-item>
  385. <el-form-item>
  386. <span slot="label" @click="queryOperationList"><a>工序</a></span>
  387. <el-input v-model="componentData.operationId" style="width: 110px"></el-input>
  388. </el-form-item>
  389. <el-form-item>
  390. <span slot="label" @click="getBaseList(117)"><a herf="#">发料库位</a></span>
  391. <el-input v-model="componentData.issueToLocName" style="width: 110px"></el-input>
  392. </el-form-item>
  393. <el-form-item :label="'生产属性'" prop="issueType" :rules="componentRules.issueType">
  394. <el-select v-model="componentData.issueType" style="width: 165px">
  395. <el-option label="Reserve and Backflush" value="Reserve and Backflush"></el-option>
  396. <el-option label="Reserve" value="Reserve"></el-option>
  397. <el-option label="Backflush" value="Backflush"></el-option>
  398. </el-select>
  399. </el-form-item>
  400. </el-form>
  401. <el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
  402. <el-form-item label="备注">
  403. <el-input type="textarea" v-model="componentData.noteText" :rows="3" resize='none' show-word-limit style="width: 759px;height: 20px"></el-input>
  404. </el-form-item>
  405. </el-form>
  406. <el-footer style="height:35px;margin-top:65px;text-align:center">
  407. <el-button :loading="saveComponentLoading" type="primary" @click="componentDataSave">保存</el-button>
  408. <el-button type="primary" @click="componentSaveModal = false">关闭</el-button>
  409. </el-footer>
  410. </el-dialog>
  411. <!-- 工序 -->
  412. <el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="operationModelFlag" width="400px">
  413. <div class="rq">
  414. <el-form :inline="true" label-position="top" :model="operationData">
  415. <el-form-item :label="'模板名称'">
  416. <el-input v-model="operationData.operationName" clearable style="width: 120px"></el-input>
  417. </el-form-item>
  418. <el-form-item :label="' '">
  419. <el-button type="primary" @click="queryOperationList()">查询</el-button>
  420. </el-form-item>
  421. </el-form>
  422. <el-table
  423. :height="300"
  424. :data="operationList"
  425. @row-dblclick="getRowOperationData"
  426. border
  427. style="width: 100%;">
  428. <el-table-column
  429. v-for="(item,index) in operationDetailList" :key="index"
  430. :sortable="item.columnSortable"
  431. :prop="item.columnProp"
  432. :header-align="item.headerAlign"
  433. :show-overflow-tooltip="item.showOverflowTooltip"
  434. :align="item.align"
  435. :fixed="item.fixed==''?false:item.fixed"
  436. :min-width="item.columnWidth"
  437. :label="item.columnLabel">
  438. <template slot-scope="scope">
  439. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  440. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  441. </template>
  442. </el-table-column>
  443. </el-table>
  444. </div>
  445. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  446. <el-button type="primary" @click="operationModelFlag=false">关闭</el-button>
  447. </el-footer>
  448. </el-dialog>
  449. <!-- copyBom -->
  450. <el-dialog title="Copy Structure Revision" :close-on-click-modal="false" v-drag :visible.sync="copyBomModelFlag" width="450px">
  451. <fieldset style="width: 426px">
  452. <legend>Source Revision</legend>
  453. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  454. <el-form-item label="物料编码">
  455. <el-input v-model="modalData.partNo" readonly style="width: 185px"></el-input>
  456. </el-form-item>
  457. <el-form-item label="site">
  458. <el-input v-model="modalData.site" disabled style="width: 185px"></el-input>
  459. </el-form-item>
  460. </el-form>
  461. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  462. <el-form-item label="Bom版本号">
  463. <el-input v-model="modalData.engChgLevel" readonly style="width: 185px"></el-input>
  464. </el-form-item>
  465. <el-form-item label="制造类型">
  466. <el-input v-model="modalData.bomType" readonly style="width: 185px"></el-input>
  467. </el-form-item>
  468. </el-form>
  469. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  470. <el-form-item label="生效日期">
  471. <el-date-picker style="width: 185px" v-model="modalData.effPhaseInDate" readonly type="date" value-format="yyyy-MM-dd"></el-date-picker>
  472. </el-form-item>
  473. <el-form-item label="失效日期">
  474. <el-date-picker style="width: 185px" v-model="modalData.effPhaseOutDate" readonly type="date" value-format="yyyy-MM-dd"></el-date-picker>
  475. </el-form-item>
  476. </el-form>
  477. <el-table
  478. :data="detailDataList"
  479. height="100px"
  480. border
  481. style="width:100%">
  482. <el-table-column
  483. v-for="(item,index) in columnBomDetailList" :key="index"
  484. :sortable="item.columnSortable"
  485. :prop="item.columnProp"
  486. :header-align="item.headerAlign"
  487. :show-overflow-tooltip="item.showOverflowTooltip"
  488. :align="item.align"
  489. :fixed="item.fixed == ''?false:item.fixed"
  490. :min-width="item.columnWidth"
  491. :label="item.columnLabel">
  492. <template slot-scope="scope">
  493. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  494. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  495. </template>
  496. </el-table-column>
  497. </el-table>
  498. </fieldset>
  499. <fieldset style="width: 426px">
  500. <legend>Destination Revision</legend>
  501. <el-form :inline="true" label-position="top" :model="copyBomData" style="margin-left: 7px;margin-top: -5px;">
  502. <el-form-item label="物料编码">
  503. <el-input v-model="copyBomData.partNo" style="width: 185px"></el-input>
  504. </el-form-item>
  505. <el-form-item label="site">
  506. <el-input v-model="copyBomData.site" disabled style="width: 185px"></el-input>
  507. </el-form-item>
  508. </el-form>
  509. <el-form :inline="true" label-position="top" :model="copyBomData" style="margin-left: 7px;margin-top: -5px;">
  510. <el-form-item label="Bom版本号">
  511. <el-input v-model="copyBomData.engChgLevel" style="width: 185px"></el-input>
  512. </el-form-item>
  513. <el-form-item label="制造类型">
  514. <el-select v-model="copyBomData.bomType" style="width: 185px">
  515. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  516. <el-option label="Repair" value="Repair"></el-option>
  517. <el-option label="Purchase" value="Purchase"></el-option>
  518. <el-option label="Prototype" value="Prototype"></el-option>
  519. </el-select>
  520. </el-form-item>
  521. </el-form>
  522. <el-form :inline="true" label-position="top" :model="copyBomData" style="margin-left: 7px;margin-top: -5px;">
  523. <el-form-item label="生效日期">
  524. <el-date-picker style="width: 185px" v-model="copyBomData.effPhaseInDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  525. </el-form-item>
  526. <el-form-item label="失效日期">
  527. <el-date-picker style="width: 185px" v-model="copyBomData.effPhaseOutDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  528. </el-form-item>
  529. </el-form>
  530. </fieldset>
  531. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  532. <el-button type="primary" @click="copyBom">保存</el-button>
  533. <el-button type="primary" @click="copyBomModelFlag = false">关闭</el-button>
  534. </el-footer>
  535. </el-dialog>
  536. <!-- copyAlternative -->
  537. <el-dialog title="Copy Structure Alternative" :close-on-click-modal="false" v-drag :visible.sync="copyAlternativeModelFlag" width="450px">
  538. <fieldset style="width: 426px">
  539. <legend>Source Revision</legend>
  540. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px;margin-top: -5px;">
  541. <el-form-item label="物料编码">
  542. <el-input v-model="detailData.partNo" readonly style="width: 185px"></el-input>
  543. </el-form-item>
  544. <el-form-item label="site">
  545. <el-input v-model="detailData.site" disabled style="width: 185px"></el-input>
  546. </el-form-item>
  547. </el-form>
  548. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px;margin-top: -5px;">
  549. <el-form-item label="Bom版本号">
  550. <el-input v-model="detailData.engChgLevel" readonly style="width: 185px"></el-input>
  551. </el-form-item>
  552. <el-form-item label="制造类型">
  553. <el-input v-model="detailData.bomType" readonly style="width: 185px"></el-input>
  554. </el-form-item>
  555. </el-form>
  556. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px;margin-top: -5px;">
  557. <el-form-item label="替代编码">
  558. <el-input v-model="detailData.alternativeNo" readonly style="width: 185px"></el-input>
  559. </el-form-item>
  560. <el-form-item label="替代名称">
  561. <el-input v-model="detailData.alternativeDescription" readonly style="width: 185px"></el-input>
  562. </el-form-item>
  563. </el-form>
  564. </fieldset>
  565. <fieldset style="width: 426px">
  566. <legend>Destination Revision</legend>
  567. <el-form :inline="true" label-position="top" :model="copyAlternativeData" style="margin-left: 7px;margin-top: -5px;">
  568. <el-form-item label="物料编码">
  569. <el-input v-model="copyAlternativeData.partNo" style="width: 185px"></el-input>
  570. </el-form-item>
  571. <el-form-item label="site">
  572. <el-input v-model="copyAlternativeData.site" disabled style="width: 185px"></el-input>
  573. </el-form-item>
  574. </el-form>
  575. <el-form :inline="true" label-position="top" :model="copyAlternativeData" style="margin-left: 7px;margin-top: -5px;">
  576. <el-form-item label="Bom版本号">
  577. <el-input v-model="copyAlternativeData.engChgLevel" style="width: 185px"></el-input>
  578. </el-form-item>
  579. <el-form-item label="制造类型">
  580. <el-select v-model="copyAlternativeData.bomType" style="width: 185px">
  581. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  582. <el-option label="Repair" value="Repair"></el-option>
  583. <el-option label="Purchase" value="Purchase"></el-option>
  584. <el-option label="Prototype" value="Prototype"></el-option>
  585. </el-select>
  586. </el-form-item>
  587. </el-form>
  588. <el-form :inline="true" label-position="top" :model="copyAlternativeData" style="margin-left: 7px;margin-top: -5px;">
  589. <el-form-item label="替代编码">
  590. <el-input v-model="copyAlternativeData.alternativeNo" style="width: 185px"></el-input>
  591. </el-form-item>
  592. <el-form-item label="替代名称">
  593. <el-input v-model="copyAlternativeData.alternativeDescription" style="width: 185px"></el-input>
  594. </el-form-item>
  595. </el-form>
  596. </fieldset>
  597. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  598. <el-button type="primary" @click="copyAlternative">保存</el-button>
  599. <el-button type="primary" @click="copyAlternativeModelFlag = false">关闭</el-button>
  600. </el-footer>
  601. </el-dialog>
  602. <!-- chooseList模态框 -->
  603. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  604. </div>
  605. </template>
  606. <script>
  607. import {
  608. bomManagementSearch, // bom列表查询
  609. bomManagementSave, // bom新增
  610. bomManagementEdit, // bom编辑
  611. bomManagementDelete, // bom删除
  612. queryBomHeader, // 查询bom主信息
  613. saveBomHeader, // 新增bom主信息
  614. queryBomDetail, // 查bom明细
  615. bomDetailSave, // bom明细新增
  616. bomDetailUpdate, // bom明细编辑
  617. bomDetailDelete, // bom明细删除
  618. updateAlternativeStatus, // 修改明细状态
  619. queryPartList, // 查询物料清单
  620. queryBomComponent, // 查询bom子明细
  621. saveBomComponent, // 新增bom子明细
  622. updateBomComponent, // 修改bom子明细
  623. deleteBomComponent, // 删除bom子明细
  624. queryOperationList, // 根据物料编码查询工序
  625. getBomEngChgLevel, // 获取物料的bom版本号
  626. getComponentLineSequence, // 获取子料的序号
  627. copyBom, // 复制bom
  628. copyAlternative, // 复制alternative,
  629. toBecomeOfficialBom, // 转正式Bom
  630. } from '@/api/part/bomManagement.js'
  631. import ChooseList from '@/views/modules/common/Chooselist'
  632. import dayjs from "dayjs";
  633. import fa from "element-ui/src/locale/lang/fa";
  634. export default {
  635. // 组件
  636. components: {
  637. ChooseList
  638. },
  639. // 监听
  640. watch: {
  641. searchData: {
  642. deep: true,
  643. handler: function (newV, oldV) {
  644. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  645. }
  646. },
  647. saveDetailData: {
  648. deep: true,
  649. handler: function (newV, oldV) {
  650. this.saveDetailData.alternativeNo = this.saveDetailData.alternativeNo.toUpperCase()
  651. }
  652. }
  653. },
  654. // 对象
  655. data () {
  656. return {
  657. // 导出
  658. exportData: [],
  659. exportName: 'bom物料列表' + this.dayjs().format('YYYYMMDDHHmmss'),
  660. exportHeader: ['bom物料列表'],
  661. exportFooter: [],
  662. resultList: [],
  663. // ======== 行高 ========
  664. height: 200,
  665. // ======== 分页 ========
  666. pageIndex: 1,
  667. pageSize: 50,
  668. totalPage: 0,
  669. selectedDataNum: 0,
  670. // 条件查询
  671. searchData: {
  672. site: this.$store.state.user.site,
  673. partNo: '',
  674. partDesc: '',
  675. page: 1,
  676. limit: 10
  677. },
  678. // loading
  679. queryLoading: false,
  680. saveHeaderLoading: false,
  681. saveDetailLoading: false,
  682. saveComponentLoading: false,
  683. saveAllLoading: false,
  684. // 初始页签
  685. detailTable: 'bom_detail',
  686. subDetailTable: 'bom_sub_detail',
  687. // ======== 数据对象 ========
  688. modalData: {
  689. flag: '',
  690. title: '',
  691. site: this.$store.state.user.site,
  692. partNo: '',
  693. partDesc: '',
  694. engChgLevel: '',
  695. bomType: '',
  696. noteText: '',
  697. effPhaseInDate: '',
  698. effPhaseOutDate: '',
  699. engRevision: '',
  700. typeFlag: '',
  701. netWeight: '',
  702. createDate: '',
  703. createBy: '',
  704. updateDate: '',
  705. updateBy: '',
  706. printUnit: '',
  707. printUnitName: '',
  708. officialFlag: ''
  709. },
  710. detailData: {
  711. site: this.$store.state.user.site,
  712. partNo: '',
  713. engChgLevel: '',
  714. bomType: '',
  715. alternativeNo: '',
  716. alternativeDescription: '',
  717. minLotQty: '',
  718. defaultFlag: '',
  719. detailNoteText: '',
  720. status: '',
  721. createDate: '',
  722. createBy: '',
  723. updateDate: '',
  724. updateBy: '',
  725. officialFlag: 'N'
  726. },
  727. componentData: {
  728. flag: '',
  729. site: this.$store.state.user.site,
  730. partNo: '',
  731. engChgLevel: '',
  732. bomType: '',
  733. alternativeNo: '',
  734. componentPart: '',
  735. componentPartDesc: '',
  736. printUnit: '',
  737. printUnitName: '',
  738. qtyPerAssembly: '',
  739. componentScrap: '',
  740. issueType: '',
  741. shrinkageFactor: '',
  742. lineItemNo: '',
  743. operationId: '',
  744. issueToLoc: '',
  745. issueToLocName: '',
  746. noteText: '',
  747. createDate: '',
  748. createBy: '',
  749. updateDate: '',
  750. updateBy: '',
  751. lineSequence: ''
  752. },
  753. partData: {
  754. site: this.$store.state.user.site,
  755. partNo: '',
  756. partDesc: '',
  757. },
  758. componentPartData: {
  759. site: this.$store.state.user.site,
  760. partNo: '',
  761. partDesc: '',
  762. status: '',
  763. bomDetail: {}
  764. },
  765. saveDetailData: {
  766. flag: '',
  767. site: this.$store.state.user.site,
  768. partNo: '',
  769. engChgLevel: '',
  770. bomType: '',
  771. alternativeNo: '',
  772. alternativeDescription: '',
  773. minLotQty: '',
  774. defaultFlag: '',
  775. detailNoteText: '',
  776. status: '',
  777. createDate: '',
  778. createBy: '',
  779. updateDate: '',
  780. updateBy: '',
  781. officialFlag: ''
  782. },
  783. operationData: {
  784. site: this.$store.state.user.site,
  785. partNo: '',
  786. operationName: '',
  787. },
  788. copyBomData: {
  789. site: '',
  790. partNo: '',
  791. engChgLevel: '',
  792. bomType: '',
  793. effPhaseInDate: '',
  794. effPhaseOutDate: '',
  795. previousVersion: {},
  796. createBy: '',
  797. officialFlag: ''
  798. },
  799. copyAlternativeData: {
  800. site: '',
  801. partNo: '',
  802. engChgLevel: '',
  803. bomType: '',
  804. alternativeNo: '',
  805. alternativeDescription: '',
  806. minLotQty: '',
  807. defaultFlag: '',
  808. detailNoteText: '',
  809. status: '',
  810. previousVersion: {},
  811. createBy: '',
  812. officialFlag: ''
  813. },
  814. // ======== 数据列表 ========
  815. dataList: [],
  816. partList: [],
  817. componentPartList: [],
  818. componentPartSelections: [],
  819. subDetailList: [],
  820. detailDataList: [],
  821. checkedDetail: [],
  822. operationList: [],
  823. // ======== 列表表头 ========
  824. columnList: [
  825. {
  826. userId: this.$store.state.user.name,
  827. functionId: 104002,
  828. serialNumber: '104002Table1PartNo',
  829. tableId: '104002Table1',
  830. tableName: 'BOM信息表',
  831. columnProp: 'partNo',
  832. headerAlign: 'center',
  833. align: 'center',
  834. columnLabel: '物料编码',
  835. columnHidden: false,
  836. columnImage: false,
  837. columnSortable: false,
  838. sortLv: 0,
  839. status: true,
  840. fixed: '',
  841. columnWidth: 120
  842. },
  843. {
  844. userId: this.$store.state.user.name,
  845. functionId: 104002,
  846. serialNumber: '104002Table1PartDesc',
  847. tableId: '104002Table1',
  848. tableName: 'BOM信息表',
  849. columnProp: 'partDesc',
  850. headerAlign: 'center',
  851. align: 'left',
  852. columnLabel: '物料名称',
  853. columnHidden: false,
  854. columnImage: false,
  855. columnSortable: false,
  856. sortLv: 0,
  857. status: true,
  858. fixed: '',
  859. columnWidth: 120
  860. },
  861. {
  862. userId: this.$store.state.user.name,
  863. functionId: 104002,
  864. serialNumber: '104002Table1BomType',
  865. tableId: '104002Table1',
  866. tableName: 'BOM信息表',
  867. columnProp: 'bomType',
  868. headerAlign: 'center',
  869. align: 'center',
  870. columnLabel: '制造类型',
  871. columnHidden: false,
  872. columnImage: false,
  873. columnSortable: false,
  874. sortLv: 0,
  875. status: true,
  876. fixed: '',
  877. columnWidth: 120
  878. },
  879. {
  880. userId: this.$store.state.user.name,
  881. functionId: 104002,
  882. serialNumber: '104002Table1EngChgLevel',
  883. tableId: '104002Table1',
  884. tableName: 'BOM信息表',
  885. columnProp: 'engChgLevel',
  886. headerAlign: 'center',
  887. align: 'center',
  888. columnLabel: 'BOM版本号',
  889. columnHidden: false,
  890. columnImage: false,
  891. columnSortable: false,
  892. sortLv: 0,
  893. status: true,
  894. fixed: '',
  895. columnWidth: 120
  896. },
  897. {
  898. userId: this.$store.state.user.name,
  899. functionId: 104002,
  900. serialNumber: '104002Table1engRevision',
  901. tableId: '104002Table1',
  902. tableName: 'BOM信息表',
  903. columnProp: 'engRevision',
  904. headerAlign: 'center',
  905. align: 'center',
  906. columnLabel: '工程版本号',
  907. columnHidden: false,
  908. columnImage: false,
  909. columnSortable: false,
  910. sortLv: 0,
  911. status: true,
  912. fixed: '',
  913. columnWidth: 120
  914. },
  915. {
  916. userId: this.$store.state.user.name,
  917. functionId: 104002,
  918. serialNumber: '104002Table1NetWeight',
  919. tableId: '104002Table1',
  920. tableName: 'BOM信息表',
  921. columnProp: 'netWeight',
  922. headerAlign: 'center',
  923. align: 'right',
  924. columnLabel: '净重',
  925. columnHidden: false,
  926. columnImage: false,
  927. columnSortable: false,
  928. sortLv: 0,
  929. status: true,
  930. fixed: '',
  931. columnWidth: 80
  932. },
  933. {
  934. userId: this.$store.state.user.name,
  935. functionId: 104002,
  936. serialNumber: '104002Table1EffPhaseInDate',
  937. tableId: '104002Table1',
  938. tableName: 'BOM信息表',
  939. columnProp: 'effPhaseInDate',
  940. headerAlign: 'center',
  941. align: 'center',
  942. columnLabel: '生效日期',
  943. columnHidden: false,
  944. columnImage: false,
  945. columnSortable: false,
  946. sortLv: 0,
  947. status: true,
  948. fixed: '',
  949. columnWidth: 130
  950. },
  951. {
  952. userId: this.$store.state.user.name,
  953. functionId: 104002,
  954. serialNumber: '104002Table1EffPhaseOutDate',
  955. tableId: '104002Table1',
  956. tableName: 'BOM信息表',
  957. columnProp: 'effPhaseOutDate',
  958. headerAlign: 'center',
  959. align: 'center',
  960. columnLabel: '失效日期',
  961. columnHidden: false,
  962. columnImage: false,
  963. columnSortable: false,
  964. sortLv: 0,
  965. status: true,
  966. fixed: '',
  967. columnWidth: 130
  968. },
  969. {
  970. userId: this.$store.state.user.name,
  971. functionId: 104002,
  972. serialNumber: '104002Table1CreateDate',
  973. tableId: '104002Table1',
  974. tableName: 'BOM信息表',
  975. columnProp: 'createDate',
  976. headerAlign: 'center',
  977. align: 'center',
  978. columnLabel: '创建时间',
  979. columnHidden: false,
  980. columnImage: false,
  981. columnSortable: false,
  982. sortLv: 0,
  983. status: true,
  984. fixed: '',
  985. columnWidth: 130
  986. },
  987. {
  988. userId: this.$store.state.user.name,
  989. functionId: 104002,
  990. serialNumber: '104002Table1CreateBy',
  991. tableId: '104002Table1',
  992. tableName: 'BOM信息表',
  993. columnProp: 'createBy',
  994. headerAlign: 'center',
  995. align: 'center',
  996. columnLabel: '创建人',
  997. columnHidden: false,
  998. columnImage: false,
  999. columnSortable: false,
  1000. sortLv: 0,
  1001. status: true,
  1002. fixed: '',
  1003. columnWidth: 80
  1004. },
  1005. {
  1006. userId: this.$store.state.user.name,
  1007. functionId: 104002,
  1008. serialNumber: '104002Table1UpdateDate',
  1009. tableId: '104002Table1',
  1010. tableName: 'BOM信息表',
  1011. columnProp: 'updateDate',
  1012. headerAlign: 'center',
  1013. align: 'center',
  1014. columnLabel: '更新时间',
  1015. columnHidden: false,
  1016. columnImage: false,
  1017. columnSortable: false,
  1018. sortLv: 0,
  1019. status: true,
  1020. fixed: '',
  1021. columnWidth: 130
  1022. },
  1023. {
  1024. userId: this.$store.state.user.name,
  1025. functionId: 104002,
  1026. serialNumber: '104002Table1UpdateBy',
  1027. tableId: '104002Table1',
  1028. tableName: 'BOM信息表',
  1029. columnProp: 'updateBy',
  1030. headerAlign: 'center',
  1031. align: 'center',
  1032. columnLabel: '更新人',
  1033. columnHidden: false,
  1034. columnImage: false,
  1035. columnSortable: false,
  1036. sortLv: 0,
  1037. status: true,
  1038. fixed: '',
  1039. columnWidth: 80
  1040. }
  1041. ],
  1042. partColumnList: [
  1043. {
  1044. columnProp: 'partNo',
  1045. headerAlign: "center",
  1046. align: "center",
  1047. columnLabel: '物料编码',
  1048. columnHidden: false,
  1049. columnImage: false,
  1050. columnSortable: false,
  1051. sortLv: 0,
  1052. status: true,
  1053. fixed: '',
  1054. },
  1055. {
  1056. columnProp: 'partDesc',
  1057. headerAlign: "center",
  1058. align: "center",
  1059. columnLabel: '物料名称',
  1060. columnHidden: false,
  1061. columnImage: false,
  1062. columnSortable: false,
  1063. sortLv: 0,
  1064. status: true,
  1065. fixed: '',
  1066. },
  1067. {
  1068. columnProp: 'spec',
  1069. headerAlign: "center",
  1070. align: "center",
  1071. columnLabel: '规格型号',
  1072. columnHidden: false,
  1073. columnImage: false,
  1074. columnSortable: false,
  1075. sortLv: 0,
  1076. status: true,
  1077. fixed: '',
  1078. },
  1079. {
  1080. columnProp: 'printUnitName',
  1081. headerAlign: "center",
  1082. align: "center",
  1083. columnLabel: '计量单位',
  1084. columnHidden: false,
  1085. columnImage: false,
  1086. columnSortable: false,
  1087. sortLv: 0,
  1088. status: true,
  1089. fixed: '',
  1090. },
  1091. ],
  1092. componentPartColumnList: [
  1093. {
  1094. columnProp: 'partNo',
  1095. headerAlign: "center",
  1096. align: "center",
  1097. columnLabel: '物料编码',
  1098. columnHidden: false,
  1099. columnImage: false,
  1100. columnSortable: false,
  1101. sortLv: 0,
  1102. status: true,
  1103. fixed: '',
  1104. },
  1105. {
  1106. columnProp: 'partDesc',
  1107. headerAlign: "center",
  1108. align: "center",
  1109. columnLabel: '物料名称',
  1110. columnHidden: false,
  1111. columnImage: false,
  1112. columnSortable: false,
  1113. sortLv: 0,
  1114. status: true,
  1115. fixed: '',
  1116. },
  1117. {
  1118. columnProp: 'spec',
  1119. headerAlign: "center",
  1120. align: "center",
  1121. columnLabel: '规格型号',
  1122. columnHidden: false,
  1123. columnImage: false,
  1124. columnSortable: false,
  1125. sortLv: 0,
  1126. status: true,
  1127. fixed: '',
  1128. },
  1129. {
  1130. columnProp: 'printUnitName',
  1131. headerAlign: "center",
  1132. align: "center",
  1133. columnLabel: '计量单位',
  1134. columnHidden: false,
  1135. columnImage: false,
  1136. columnSortable: false,
  1137. sortLv: 0,
  1138. status: true,
  1139. fixed: '',
  1140. },
  1141. ],
  1142. columnSubDetailList: [
  1143. {
  1144. userId: this.$store.state.user.name,
  1145. functionId: 104002,
  1146. serialNumber: '104002Table2LineSequence',
  1147. tableId: '104002Table2',
  1148. tableName: 'BOM子物料表',
  1149. columnProp: 'lineSequence',
  1150. headerAlign: 'center',
  1151. align: 'center',
  1152. columnLabel: '序号',
  1153. columnHidden: false,
  1154. columnImage: false,
  1155. columnSortable: false,
  1156. sortLv: 0,
  1157. status: true,
  1158. fixed: '',
  1159. columnWidth: 60
  1160. },
  1161. {
  1162. userId: this.$store.state.user.name,
  1163. functionId: 104002,
  1164. serialNumber: '104002Table2ComponentPart',
  1165. tableId: '104002Table2',
  1166. tableName: 'BOM子物料表',
  1167. columnProp: 'componentPart',
  1168. headerAlign: 'center',
  1169. align: 'center',
  1170. columnLabel: '物料编码',
  1171. columnHidden: false,
  1172. columnImage: false,
  1173. columnSortable: false,
  1174. sortLv: 0,
  1175. status: true,
  1176. fixed: '',
  1177. columnWidth: 120
  1178. },
  1179. {
  1180. userId: this.$store.state.user.name,
  1181. functionId: 104002,
  1182. serialNumber: '104002Table2ComponentPartDesc',
  1183. tableId: '104002Table2',
  1184. tableName: 'BOM子物料表',
  1185. columnProp: 'componentPartDesc',
  1186. headerAlign: 'center',
  1187. align: 'left',
  1188. columnLabel: '物料名称',
  1189. columnHidden: false,
  1190. columnImage: false,
  1191. columnSortable: false,
  1192. sortLv: 0,
  1193. status: true,
  1194. fixed: '',
  1195. columnWidth: 120
  1196. },
  1197. {
  1198. userId: this.$store.state.user.name,
  1199. functionId: 104002,
  1200. serialNumber: '104002Table2QtyPerAssembly',
  1201. tableId: '104002Table2',
  1202. tableName: 'BOM子物料表',
  1203. columnProp: 'qtyPerAssembly',
  1204. headerAlign: 'center',
  1205. align: 'right',
  1206. columnLabel: '单位用量',
  1207. columnHidden: false,
  1208. columnImage: false,
  1209. columnSortable: false,
  1210. sortLv: 0,
  1211. status: true,
  1212. fixed: '',
  1213. columnWidth: 80
  1214. },
  1215. {
  1216. userId: this.$store.state.user.name,
  1217. functionId: 104002,
  1218. serialNumber: '104002Table2ComponentScrap',
  1219. tableId: '104002Table2',
  1220. tableName: 'BOM子物料表',
  1221. columnProp: 'componentScrap',
  1222. headerAlign: 'center',
  1223. align: 'right',
  1224. columnLabel: '调机量',
  1225. columnHidden: false,
  1226. columnImage: false,
  1227. columnSortable: false,
  1228. sortLv: 0,
  1229. status: true,
  1230. fixed: '',
  1231. columnWidth: 80
  1232. },
  1233. {
  1234. userId: this.$store.state.user.name,
  1235. functionId: 104002,
  1236. serialNumber: '104002Table2ShrinkageFactor',
  1237. tableId: '104002Table2',
  1238. tableName: 'BOM子物料表',
  1239. columnProp: 'shrinkageFactor',
  1240. headerAlign: 'center',
  1241. align: 'right',
  1242. columnLabel: '损耗率',
  1243. columnHidden: false,
  1244. columnImage: false,
  1245. columnSortable: false,
  1246. sortLv: 0,
  1247. status: true,
  1248. fixed: '',
  1249. columnWidth: 80
  1250. },
  1251. {
  1252. userId: this.$store.state.user.name,
  1253. functionId: 104002,
  1254. serialNumber: '104002Table2PrintUnitName',
  1255. tableId: '104002Table2',
  1256. tableName: 'BOM子物料表',
  1257. columnProp: 'printUnitName',
  1258. headerAlign: 'center',
  1259. align: 'center',
  1260. columnLabel: '单位',
  1261. columnHidden: false,
  1262. columnImage: false,
  1263. columnSortable: false,
  1264. sortLv: 0,
  1265. status: true,
  1266. fixed: '',
  1267. columnWidth: 60
  1268. },
  1269. {
  1270. userId: this.$store.state.user.name,
  1271. functionId: 104002,
  1272. serialNumber: '104002Table2IssueType',
  1273. tableId: '104002Table2',
  1274. tableName: 'BOM子物料表',
  1275. columnProp: 'issueTypeName',
  1276. headerAlign: 'center',
  1277. align: 'center',
  1278. columnLabel: '生产属性',
  1279. columnHidden: false,
  1280. columnImage: false,
  1281. columnSortable: false,
  1282. sortLv: 0,
  1283. status: true,
  1284. fixed: '',
  1285. columnWidth: 80
  1286. },
  1287. {
  1288. userId: this.$store.state.user.name,
  1289. functionId: 104002,
  1290. serialNumber: '104002Table2OperationDesc',
  1291. tableId: '104002Table2',
  1292. tableName: 'BOM子物料表',
  1293. columnProp: 'operationId',
  1294. headerAlign: 'center',
  1295. align: 'center',
  1296. columnLabel: '工序',
  1297. columnHidden: false,
  1298. columnImage: false,
  1299. columnSortable: false,
  1300. sortLv: 0,
  1301. status: true,
  1302. fixed: '',
  1303. columnWidth: 80
  1304. },
  1305. {
  1306. userId: this.$store.state.user.name,
  1307. functionId: 104002,
  1308. serialNumber: '104002Table2IssueToLoc',
  1309. tableId: '104002Table2',
  1310. tableName: 'BOM子物料表',
  1311. columnProp: 'issueToLocName',
  1312. headerAlign: 'center',
  1313. align: 'center',
  1314. columnLabel: '发料库位',
  1315. columnHidden: false,
  1316. columnImage: false,
  1317. columnSortable: false,
  1318. sortLv: 0,
  1319. status: true,
  1320. fixed: '',
  1321. columnWidth: 80
  1322. },
  1323. {
  1324. userId: this.$store.state.user.name,
  1325. functionId: 104002,
  1326. serialNumber: '104002Table2NoteText',
  1327. tableId: '104002Table2',
  1328. tableName: 'BOM子物料表',
  1329. columnProp: 'noteText',
  1330. headerAlign: 'center',
  1331. align: 'left',
  1332. columnLabel: '备注',
  1333. columnHidden: false,
  1334. columnImage: false,
  1335. columnSortable: false,
  1336. sortLv: 0,
  1337. status: true,
  1338. fixed: '',
  1339. columnWidth: 150
  1340. },
  1341. ],
  1342. operationDetailList: [
  1343. {
  1344. columnProp: 'operationNo',
  1345. headerAlign: "center",
  1346. align: "center",
  1347. columnLabel: '工序编码',
  1348. columnHidden: false,
  1349. columnImage: false,
  1350. columnSortable: false,
  1351. sortLv: 0,
  1352. status: true,
  1353. fixed: '',
  1354. },
  1355. {
  1356. columnProp: 'operationName',
  1357. headerAlign: "center",
  1358. align: "center",
  1359. columnLabel: '工序名称',
  1360. columnHidden: false,
  1361. columnImage: false,
  1362. columnSortable: false,
  1363. sortLv: 0,
  1364. status: true,
  1365. fixed: '',
  1366. }
  1367. ],
  1368. columnBomDetailList: [
  1369. {
  1370. columnProp: 'alternativeNo',
  1371. headerAlign: "center",
  1372. align: "center",
  1373. columnLabel: '替代编码',
  1374. columnHidden: false,
  1375. columnImage: false,
  1376. columnSortable: false,
  1377. sortLv: 0,
  1378. status: true,
  1379. fixed: '',
  1380. },
  1381. {
  1382. columnProp: 'alternativeDescription',
  1383. headerAlign: "center",
  1384. align: "center",
  1385. columnLabel: '替代名称',
  1386. columnHidden: false,
  1387. columnImage: false,
  1388. columnSortable: false,
  1389. sortLv: 0,
  1390. status: true,
  1391. fixed: '',
  1392. },
  1393. {
  1394. columnProp: 'status',
  1395. headerAlign: "center",
  1396. align: "center",
  1397. columnLabel: '状态',
  1398. columnHidden: false,
  1399. columnImage: false,
  1400. columnSortable: false,
  1401. sortLv: 0,
  1402. status: true,
  1403. fixed: '',
  1404. },
  1405. ],
  1406. // ======== 必填规则 ========
  1407. rules: {
  1408. partNo: [
  1409. {
  1410. required: true,
  1411. message: ' ',
  1412. trigger: 'change'
  1413. }
  1414. ],
  1415. partDesc: [
  1416. {
  1417. required: true,
  1418. message: ' ',
  1419. trigger: 'change'
  1420. }
  1421. ],
  1422. bomType: [
  1423. {
  1424. required: true,
  1425. message: ' ',
  1426. trigger: 'change'
  1427. }
  1428. ],
  1429. effPhaseInDate: [
  1430. {
  1431. required: true,
  1432. message: ' ',
  1433. trigger: 'change'
  1434. }
  1435. ],
  1436. engChgLevel: [
  1437. {
  1438. required: true,
  1439. message: ' ',
  1440. trigger: 'change'
  1441. }
  1442. ]
  1443. },
  1444. detailRules: {
  1445. alternativeNo: [
  1446. {
  1447. required: true,
  1448. message: ' ',
  1449. trigger: 'change'
  1450. }
  1451. ],
  1452. alternativeDescription: [
  1453. {
  1454. required: true,
  1455. message: ' ',
  1456. trigger: 'change'
  1457. }
  1458. ],
  1459. minLotQty: [
  1460. {
  1461. required: true,
  1462. message: ' ',
  1463. trigger: 'change'
  1464. }
  1465. ],
  1466. status: [
  1467. {
  1468. required: true,
  1469. message: ' ',
  1470. trigger: 'change'
  1471. }
  1472. ]
  1473. },
  1474. componentRules: {
  1475. componentPart: [
  1476. {
  1477. required: true,
  1478. message: ' ',
  1479. trigger: 'change'
  1480. }
  1481. ],
  1482. lineSequence: [
  1483. {
  1484. required: true,
  1485. message: ' ',
  1486. trigger: 'change'
  1487. }
  1488. ],
  1489. qtyPerAssembly: [
  1490. {
  1491. required: true,
  1492. message: ' ',
  1493. trigger: 'change'
  1494. }
  1495. ],
  1496. componentScrap: [
  1497. {
  1498. required: true,
  1499. message: ' ',
  1500. trigger: 'change'
  1501. }
  1502. ],
  1503. shrinkageFactor: [
  1504. {
  1505. required: true,
  1506. message: ' ',
  1507. trigger: 'change'
  1508. }
  1509. ],
  1510. issueType: [
  1511. {
  1512. required: true,
  1513. message: ' ',
  1514. trigger: 'change'
  1515. }
  1516. ]
  1517. },
  1518. // ======== 复选数据集 ========
  1519. bomSelections: [],
  1520. // ======== 模态框开关控制 ========
  1521. modalFlag: false,
  1522. modalDisableFlag: false,
  1523. partModelFlag: false,
  1524. componentPartModelFlag: false,
  1525. saveDetailModalFlag :false,
  1526. saveDetailModalDisable: false,
  1527. componentSaveModal: false,
  1528. componentDisableFlag: false,
  1529. operationModelFlag: false,
  1530. copyBomModelFlag: false,
  1531. copyAlternativeModelFlag: false
  1532. }
  1533. },
  1534. mounted () {
  1535. this.$nextTick(() => {
  1536. this.height = window.innerHeight - 180
  1537. })
  1538. },
  1539. created () {
  1540. this.getDataList()
  1541. },
  1542. activated() {
  1543. if (this.$route.params.partNo) {
  1544. this.searchData.partNo = this.$route.params.partNo
  1545. }
  1546. this.getDataList()
  1547. },
  1548. // js
  1549. methods: {
  1550. // ======== 分页相关方法 ========
  1551. /**
  1552. * 每页数
  1553. * @param val
  1554. */
  1555. sizeChangeHandle (val) {
  1556. this.pageSize = val
  1557. this.pageIndex = 1
  1558. this.getDataList()
  1559. },
  1560. /**
  1561. * 当前页
  1562. * @param val
  1563. */
  1564. currentChangeHandle (val) {
  1565. this.pageIndex = val
  1566. this.getDataList()
  1567. },
  1568. // ======== 页签切换相关方法 ========
  1569. /**
  1570. * 明细页签选择替换
  1571. * @param tab
  1572. * @param event
  1573. */
  1574. tabDetailClick (tab, event) {
  1575. // 刷新列表数据
  1576. this.refreshDetailTable()
  1577. },
  1578. /**
  1579. * 子明细页签选择替换
  1580. * @param tab
  1581. * @param event
  1582. */
  1583. tabSubDetailClick (tab, event) {
  1584. // 刷新列表数据
  1585. this.refreshSubDetailTable()
  1586. },
  1587. /**
  1588. * 刷新明细页签的table数据
  1589. */
  1590. refreshDetailTable () {
  1591. if (this.detailTable === 'bom_detail') {
  1592. }
  1593. },
  1594. /**
  1595. * 刷新子明细页签的table数据
  1596. */
  1597. refreshSubDetailTable () {
  1598. if (this.subDetailTable === 'bom_sub_detail') {
  1599. }
  1600. },
  1601. // ======== 列表数据操作方法 ========
  1602. /**
  1603. * 未知
  1604. * @returns {boolean}
  1605. */
  1606. selectFlag () {
  1607. return true
  1608. },
  1609. /**
  1610. * 获取数据列表
  1611. */
  1612. getDataList () {
  1613. this.searchData.limit = this.pageSize
  1614. this.searchData.page = this.pageIndex
  1615. this.queryLoading = true
  1616. bomManagementSearch(this.searchData).then(({data}) => {
  1617. if (data.code === 0) {
  1618. this.dataList = data.page.list
  1619. this.pageIndex = data.page.currPage
  1620. this.pageSize = data.page.pageSize
  1621. this.totalPage = data.page.totalCount
  1622. this.$refs.selectDiv.setLengthAll( this.dataList.length)
  1623. }
  1624. this.queryLoading = false
  1625. })
  1626. },
  1627. /**
  1628. * 复选列表信息
  1629. * @param val
  1630. */
  1631. selectionBom (val) {
  1632. this.bomSelections = val
  1633. this.$refs.selectDiv.setLengthselected(this.bomSelections.length)
  1634. },
  1635. // ======== 新增/编辑模态框 ========
  1636. /**
  1637. * bom新增模态框
  1638. */
  1639. addModal () {
  1640. this.modalData = {
  1641. flag: '1',
  1642. title: 'bom新增',
  1643. site: this.$store.state.user.site,
  1644. partNo: '',
  1645. partDesc: '',
  1646. engChgLevel: '',
  1647. bomType: 'Manufacturing',
  1648. noteText: '',
  1649. effPhaseInDate: new Date(+ new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''),
  1650. effPhaseOutDate: '',
  1651. engRevision: '',
  1652. typeFlag: 'B',
  1653. netWeight: 0,
  1654. createBy: this.$store.state.user.name,
  1655. printUnit: '',
  1656. printUnitName: '',
  1657. officialFlag: 'N'
  1658. }
  1659. this.detailData = {
  1660. site: this.$store.state.user.site,
  1661. partNo: '',
  1662. engChgLevel: '',
  1663. bomType: '',
  1664. alternativeNo: '',
  1665. alternativeDescription: '',
  1666. minLotQty: '',
  1667. defaultFlag: '',
  1668. detailNoteText: '',
  1669. status: '',
  1670. createDate: '',
  1671. createBy: this.$store.state.user.name,
  1672. updateDate: '',
  1673. updateBy: this.$store.state.user.name,
  1674. officialFlag: 'N'
  1675. }
  1676. this.detailDataList = []
  1677. this.subDetailList = []
  1678. this.modalDisableFlag = false
  1679. this.modalFlag = true
  1680. },
  1681. /**
  1682. * bom编辑模态框
  1683. */
  1684. async updateModal (row) {
  1685. this.modalData = {
  1686. flag: '2',
  1687. site: row.site,
  1688. partNo: row.partNo,
  1689. partDesc: row.partDesc,
  1690. engChgLevel: row.engChgLevel,
  1691. bomType: row.bomType,
  1692. noteText: row.noteText,
  1693. effPhaseInDate: row.effPhaseInDate,
  1694. effPhaseOutDate: row.effPhaseOutDate,
  1695. engRevision: row.engRevision,
  1696. typeFlag: row.typeFlag,
  1697. netWeight: row.netWeight,
  1698. updateBy: this.$store.state.user.name,
  1699. printUnit: row.printUnit,
  1700. printUnitName: row.printUnitName,
  1701. officialFlag: row.officialFlag
  1702. }
  1703. // 查bom明细
  1704. queryBomDetail(this.modalData).then(({data}) => {
  1705. if (data && data.code === 0) {
  1706. this.detailDataList = data.rows.detailList
  1707. this.subDetailList = data.rows.componentList
  1708. this.detailData = data.rows.detailData
  1709. this.modalDisableFlag = true
  1710. this.modalFlag = true
  1711. } else {
  1712. this.$alert(data.msg, '错误', {
  1713. confirmButtonText: '确定'
  1714. })
  1715. }
  1716. })
  1717. },
  1718. /**
  1719. * 替代新增模态框
  1720. */
  1721. saveBomDetail () {
  1722. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1723. this.$message.warning('请先选择Bom物料!')
  1724. return
  1725. }
  1726. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1727. this.$message.warning('请先填写Bom版本号!')
  1728. return
  1729. }
  1730. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1731. this.$message.warning('请先选择制造类型!')
  1732. return
  1733. }
  1734. this.saveDetailData = {
  1735. flag: '1',
  1736. site: this.$store.state.user.site,
  1737. partNo: this.modalData.partNo,
  1738. engChgLevel: this.modalData.engChgLevel,
  1739. bomType: this.modalData.bomType,
  1740. alternativeNo: '',
  1741. alternativeDescription: '',
  1742. minLotQty: 0,
  1743. defaultFlag: '',
  1744. detailNoteText: '',
  1745. status: 'Tentative',
  1746. createDate: '',
  1747. createBy: this.$store.state.user.name,
  1748. officialFlag: 'N'
  1749. }
  1750. // 查询bom主信息
  1751. queryBomHeader(this.modalData).then(({data}) => {
  1752. if (data && data.code === 0) {
  1753. if (data.rows.length > 0) {
  1754. this.saveDetailModalFlag = true
  1755. this.saveDetailModalDisable = false
  1756. } else {
  1757. this.$message.warning('请先保存BOM主记录!')
  1758. }
  1759. } else {
  1760. this.$alert(data.msg, '提示', {
  1761. confirmButtonText: '确定'
  1762. })
  1763. }
  1764. })
  1765. },
  1766. /**
  1767. * 替代编辑模态框
  1768. */
  1769. updateBomDetail () {
  1770. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1771. this.$message.warning('请先选择Bom物料!')
  1772. return
  1773. }
  1774. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1775. this.$message.warning('请先填写Bom版本号!')
  1776. return
  1777. }
  1778. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1779. this.$message.warning('请先选择制造类型!')
  1780. return
  1781. }
  1782. this.saveDetailData = {
  1783. flag: '2',
  1784. site: this.detailData.site,
  1785. partNo: this.detailData.partNo,
  1786. engChgLevel: this.detailData.engChgLevel,
  1787. bomType: this.detailData.bomType,
  1788. alternativeNo: this.detailData.alternativeNo,
  1789. alternativeDescription: this.detailData.alternativeDescription,
  1790. minLotQty: this.detailData.minLotQty,
  1791. defaultFlag: '',
  1792. detailNoteText: this.detailData.detailNoteText,
  1793. status: this.detailData.status,
  1794. updateBy: this.$store.state.user.name,
  1795. officialFlag: this.detailData.officialFlag
  1796. }
  1797. // 查询bom主信息
  1798. queryBomHeader(this.modalData).then(({data}) => {
  1799. if (data && data.code === 0) {
  1800. if (data.rows.length > 0) {
  1801. this.saveDetailModalFlag = true
  1802. this.saveDetailModalDisable = true
  1803. } else {
  1804. this.$message.warning('请先保存BOM主记录!')
  1805. }
  1806. } else {
  1807. this.$alert(data.msg, '提示', {
  1808. confirmButtonText: '确定'
  1809. })
  1810. }
  1811. })
  1812. },
  1813. /**
  1814. * 子明细新增模态框
  1815. */
  1816. saveComponentModal () {
  1817. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1818. this.$message.warning('请先选择替代!')
  1819. return
  1820. }
  1821. if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
  1822. this.$message.warning('不可编辑的替代状态!')
  1823. return
  1824. }
  1825. this.componentData = {
  1826. flag: '1',
  1827. site: this.$store.state.user.site,
  1828. partNo: this.modalData.partNo,
  1829. engChgLevel: this.modalData.engChgLevel,
  1830. bomType: this.modalData.bomType,
  1831. alternativeNo: this.detailData.alternativeNo,
  1832. componentPart: '',
  1833. componentPartDesc: '',
  1834. printUnit: '',
  1835. printUnitName: '',
  1836. qtyPerAssembly: 0,
  1837. componentScrap: 0,
  1838. issueType: 'Reserve and Backflush',
  1839. shrinkageFactor: 0,
  1840. lineItemNo: '',
  1841. operationId: '',
  1842. issueToLoc: '',
  1843. issueToLocName: '',
  1844. noteText: '',
  1845. createBy: this.$store.state.user.name,
  1846. lineSequence: ''
  1847. }
  1848. // 获取子料的序号
  1849. getComponentLineSequence(this.componentData).then(({data}) => {
  1850. if (data && data.code === 0) {
  1851. this.componentData.lineSequence = data.lineSequence
  1852. } else {
  1853. this.$alert(data.msg, '错误', {
  1854. confirmButtonText: '确定'
  1855. })
  1856. }
  1857. })
  1858. this.componentDisableFlag = false
  1859. this.componentSaveModal = true
  1860. },
  1861. /**
  1862. * 子明细编辑模态框
  1863. */
  1864. updateComponentModal (row) {
  1865. if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
  1866. this.$message.warning('不可编辑的替代状态!')
  1867. return
  1868. }
  1869. this.componentData = {
  1870. flag: '2',
  1871. site: row.site,
  1872. partNo: row.partNo,
  1873. engChgLevel: row.engChgLevel,
  1874. bomType: row.bomType,
  1875. alternativeNo: row.alternativeNo,
  1876. componentPart: row.componentPart,
  1877. componentPartDesc: row.componentPartDesc,
  1878. printUnit: row.printUnit,
  1879. printUnitName: row.printUnitName,
  1880. qtyPerAssembly: row.qtyPerAssembly,
  1881. componentScrap: row.componentScrap,
  1882. issueType: row.issueType,
  1883. shrinkageFactor: row.shrinkageFactor,
  1884. lineItemNo: row.lineItemNo,
  1885. operationId: row.operationId,
  1886. issueToLoc: row.issueToLoc,
  1887. issueToLocName: row.issueToLocName,
  1888. noteText: row.noteText,
  1889. updateBy: this.$store.state.user.name,
  1890. lineSequence: row.lineSequence
  1891. }
  1892. this.componentDisableFlag = true
  1893. this.componentSaveModal = true
  1894. },
  1895. // ======== 新增/编辑/删除方法 ========
  1896. /**
  1897. * bom新增/编辑
  1898. */
  1899. saveData () {
  1900. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1901. this.$message.warning('请选择物料编码!')
  1902. return
  1903. }
  1904. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  1905. this.$message.warning('请选择物料名称!')
  1906. return
  1907. }
  1908. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1909. this.$message.warning('请选择制造类型!')
  1910. return
  1911. }
  1912. if (this.modalData.effPhaseInDate === '' || this.modalData.effPhaseInDate == null) {
  1913. this.$message.warning('请选择生效日期!')
  1914. return
  1915. }
  1916. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1917. this.$message.warning('请填写BOM版本号!')
  1918. return
  1919. }
  1920. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1921. this.$message.warning('请选择替代!')
  1922. return
  1923. }
  1924. if (this.detailData.status === '' || this.detailData.status == null) {
  1925. this.$message.warning('请选择替代状态!')
  1926. return
  1927. }
  1928. let tempData = {
  1929. site: this.$store.state.user.site,
  1930. partNo: this.modalData.partNo,
  1931. partDesc: this.modalData.partDesc,
  1932. engChgLevel: this.modalData.engChgLevel,
  1933. bomType: this.modalData.bomType,
  1934. noteText: this.modalData.noteText,
  1935. effPhaseInDate: this.modalData.effPhaseInDate,
  1936. effPhaseOutDate: this.modalData.effPhaseOutDate,
  1937. engRevision: this.modalData.engRevision,
  1938. typeFlag: this.modalData.typeFlag,
  1939. netWeight: this.modalData.netWeight,
  1940. officialFlag: this.modalData.officialFlag,
  1941. alternativeNo: this.detailData.alternativeNo,
  1942. alternativeDescription: this.detailData.alternativeDescription,
  1943. minLotQty: this.detailData.minLotQty,
  1944. defaultFlag: this.detailData.defaultFlag,
  1945. detailNoteText: this.detailData.detailNoteText,
  1946. status: this.detailData.status,
  1947. createBy: this.$store.state.user.name,
  1948. updateBy: this.$store.state.user.name,
  1949. informationList: this.subDetailList
  1950. }
  1951. if (this.modalData.flag === '1') {
  1952. this.saveAllLoading = true
  1953. bomManagementSave(tempData).then(({data}) => {
  1954. if (data && data.code === 0) {
  1955. this.getDataList()
  1956. this.modalFlag = false
  1957. this.$message({
  1958. message: '操作成功',
  1959. type: 'success',
  1960. duration: 1500,
  1961. onClose: () => {}
  1962. })
  1963. } else {
  1964. this.$alert(data.msg, '错误', {
  1965. confirmButtonText: '确定'
  1966. })
  1967. }
  1968. this.saveAllLoading = false
  1969. })
  1970. } else {
  1971. this.saveAllLoading = true
  1972. bomManagementEdit(tempData).then(({data}) => {
  1973. if (data && data.code === 0) {
  1974. this.getDataList()
  1975. this.modalFlag = false
  1976. this.$message({
  1977. message: '操作成功',
  1978. type: 'success',
  1979. duration: 1500,
  1980. onClose: () => {}
  1981. })
  1982. } else {
  1983. this.$alert(data.msg, '错误', {
  1984. confirmButtonText: '确定'
  1985. })
  1986. }
  1987. this.saveAllLoading = false
  1988. })
  1989. }
  1990. },
  1991. /**
  1992. * 新增编辑模态框关闭
  1993. */
  1994. closeModal () {
  1995. // let tempArr = []
  1996. // tempArr.push(this.modalData)
  1997. // if (this.modalData.flag === '1') {
  1998. // this.$confirm(`是否不保存且删除该条BOM记录?`, '提示', {
  1999. // confirmButtonText: '确定',
  2000. // cancelButtonText: '取消',
  2001. // type: 'warning'
  2002. // }).then(() => {
  2003. // let tempData = {
  2004. // informationList: tempArr
  2005. // }
  2006. // bomManagementDelete(tempData).then(({data}) => {
  2007. // if (data && data.code === 0) {
  2008. // this.getDataList()
  2009. // this.modalFlag = false
  2010. // this.$message({
  2011. // message: '操作成功',
  2012. // type: 'success',
  2013. // duration: 1500,
  2014. // onClose: () => {}
  2015. // })
  2016. // } else {
  2017. // this.$alert(data.msg, '错误', {
  2018. // confirmButtonText: '确定'
  2019. // })
  2020. // }
  2021. // })
  2022. // }).catch(() => {
  2023. // })
  2024. // } else {
  2025. // this.modalFlag = false
  2026. // }
  2027. this.getDataList()
  2028. this.modalFlag = false
  2029. },
  2030. /**
  2031. * 新增编辑模态框关闭
  2032. */
  2033. closeModalX (done) {
  2034. // let tempArr = []
  2035. // tempArr.push(this.modalData)
  2036. // if (this.modalData.flag === '1') {
  2037. // this.$confirm(`是否不保存且删除该条BOM记录?`, '提示', {
  2038. // confirmButtonText: '确定',
  2039. // cancelButtonText: '取消',
  2040. // type: 'warning'
  2041. // }).then(() => {
  2042. // let tempData = {
  2043. // informationList: tempArr
  2044. // }
  2045. // bomManagementDelete(tempData).then(({data}) => {
  2046. // if (data && data.code === 0) {
  2047. // this.getDataList()
  2048. // done()
  2049. // this.$message({
  2050. // message: '操作成功',
  2051. // type: 'success',
  2052. // duration: 1500,
  2053. // onClose: () => {}
  2054. // })
  2055. // } else {
  2056. // this.$alert(data.msg, '错误', {
  2057. // confirmButtonText: '确定'
  2058. // })
  2059. // }
  2060. // })
  2061. // }).catch(() => {
  2062. // })
  2063. // } else {
  2064. // done()
  2065. // }
  2066. this.getDataList()
  2067. done()
  2068. },
  2069. /**
  2070. * bom删除
  2071. */
  2072. delModal () {
  2073. if (this.bomSelections.length === 0) {
  2074. this.$message.warning('请勾选要删除的BOM!')
  2075. return
  2076. }
  2077. this.$confirm(`是否删除这 `+ this.bomSelections.length +` 条BOM?`, '提示', {
  2078. confirmButtonText: '确定',
  2079. cancelButtonText: '取消',
  2080. type: 'warning'
  2081. }).then(() => {
  2082. let tempData = {
  2083. informationList: this.bomSelections
  2084. }
  2085. bomManagementDelete(tempData).then(({data}) => {
  2086. if (data && data.code === 0) {
  2087. this.getDataList()
  2088. this.bomSelections = []
  2089. this.$message({
  2090. message: '操作成功',
  2091. type: 'success',
  2092. duration: 1500,
  2093. onClose: () => {}
  2094. })
  2095. } else {
  2096. this.$alert(data.msg, '错误', {
  2097. confirmButtonText: '确定'
  2098. })
  2099. }
  2100. })
  2101. }).catch(() => {
  2102. })
  2103. },
  2104. /**
  2105. * 查询物料
  2106. */
  2107. queryPartList () {
  2108. queryPartList(this.partData).then(({data}) => {
  2109. if (data && data.code === 0) {
  2110. this.partList = data.rows
  2111. this.partModelFlag = true
  2112. } else {
  2113. this.$alert(data.msg, '错误', {
  2114. confirmButtonText: '确定'
  2115. })
  2116. }
  2117. })
  2118. },
  2119. /**
  2120. * 双击选中物料
  2121. * @param row
  2122. */
  2123. getRowData (row) {
  2124. this.modalData.partNo = row.partNo
  2125. this.modalData.partDesc = row.partDesc
  2126. this.modalData.printUnit = row.printUnit
  2127. this.modalData.printUnitName = row.printUnitName
  2128. // // 获取物料的bom版本号
  2129. // getBomEngChgLevel(this.modalData).then(({data}) => {
  2130. // if (data && data.code === 0) {
  2131. // this.modalData.engChgLevel = data.engChgLevel
  2132. // } else {
  2133. // this.$alert(data.msg, '错误', {
  2134. // confirmButtonText: '确定'
  2135. // })
  2136. // }
  2137. // this.partModelFlag = false
  2138. // })
  2139. this.partModelFlag = false
  2140. },
  2141. // bom类型改变
  2142. bomTypeChange () {
  2143. // 获取物料的bom版本号
  2144. getBomEngChgLevel(this.modalData).then(({data}) => {
  2145. if (data && data.code === 0) {
  2146. this.modalData.engChgLevel = data.engChgLevel
  2147. } else {
  2148. this.$alert(data.msg, '错误', {
  2149. confirmButtonText: '确定'
  2150. })
  2151. }
  2152. })
  2153. },
  2154. /**
  2155. * 双击选中工序
  2156. * @param row
  2157. */
  2158. getRowOperationData (row) {
  2159. this.componentData.operationId = row.operationId
  2160. this.operationModelFlag = false
  2161. },
  2162. getComponentRowData (row) {
  2163. this.componentData.componentPart = row.partNo
  2164. this.componentData.componentPartDesc = row.partDesc
  2165. this.componentData.printUnit = row.printUnit
  2166. this.componentData.printUnitName = row.printUnitName
  2167. this.componentPartModelFlag = false
  2168. },
  2169. /**
  2170. * 物料列表
  2171. */
  2172. queryComponentPartList () {
  2173. this.componentPartData.bomDetail = this.detailData
  2174. // 查询所有物料
  2175. queryPartList(this.componentPartData).then(({data}) => {
  2176. if (data && data.code === 0) {
  2177. this.componentPartList = data.rows
  2178. this.componentPartModelFlag = true
  2179. } else {
  2180. this.$alert(data.msg, '错误', {
  2181. confirmButtonText: '确定'
  2182. })
  2183. }
  2184. })
  2185. },
  2186. /**
  2187. * 表格的新增
  2188. * @param row
  2189. * @param rowIndex
  2190. */
  2191. rowClassName({ row, rowIndex }) {
  2192. row.xh = rowIndex + 1;
  2193. },
  2194. /**
  2195. * 单选框选中数据
  2196. * @param selection
  2197. */
  2198. componentSelectionChange(selection) {
  2199. this.checkedDetail = selection
  2200. },
  2201. /**
  2202. * 删除子物料
  2203. */
  2204. deleteComponentPart () {
  2205. if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
  2206. this.$message.warning('不可编辑的替代状态!')
  2207. return
  2208. }
  2209. if (this.checkedDetail.length === 0) {
  2210. this.$message.warning('请选择要删除子物料!')
  2211. return;
  2212. } else {
  2213. this.$confirm("请是否确认删除该子明细记录?", "提示", {
  2214. confirmButtonText: "确定",
  2215. cancelButtonText: "取消",
  2216. type: "warning"
  2217. }).then(() => {
  2218. let tempData = {
  2219. informationList: this.checkedDetail
  2220. }
  2221. deleteBomComponent(tempData).then(({data}) => {
  2222. if (data && data.code === 0) {
  2223. this.subDetailList = data.rows
  2224. this.$message({
  2225. message: '操作成功',
  2226. type: 'success',
  2227. duration: 1500,
  2228. onClose: () => {}
  2229. })
  2230. } else {
  2231. this.$alert(data.msg, '错误', {
  2232. confirmButtonText: '确定'
  2233. })
  2234. }
  2235. })
  2236. }).catch(() => {
  2237. })
  2238. }
  2239. },
  2240. /**
  2241. * 子物料
  2242. * @param row
  2243. */
  2244. // componentPartClickRow (row) {
  2245. // this.$refs.componentPartTable.toggleRowSelection(row)
  2246. // },
  2247. componentClickRow (row) {
  2248. this.$refs.componentTable.toggleRowSelection(row)
  2249. },
  2250. // /**
  2251. // * 多选子物料
  2252. // * @param val
  2253. // */
  2254. // selectionComponentPart (val) {
  2255. // this.componentPartSelections = val
  2256. // },
  2257. // getRowKeys(row) {
  2258. // // 唯一值,一般都为id
  2259. // return row.partNo
  2260. // },
  2261. /**
  2262. * 新增子明细方法
  2263. */
  2264. componentDataSave () {
  2265. if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
  2266. this.$message.warning('序号不能为空!')
  2267. return
  2268. }
  2269. if (this.componentData.partNo === '' || this.componentData.partNo == null) {
  2270. this.$message.warning('请选择主记录物料编码!')
  2271. return
  2272. }
  2273. if (this.componentData.bomType === '' || this.componentData.bomType == null) {
  2274. this.$message.warning('请选择主记录制造类型!')
  2275. return
  2276. }
  2277. if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
  2278. this.$message.warning('请填写主记录BOM版本号!')
  2279. return
  2280. }
  2281. if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
  2282. this.$message.warning('请选择子物料编码!')
  2283. return
  2284. }
  2285. if (this.componentData.qtyPerAssembly === '' || this.componentData.qtyPerAssembly == null) {
  2286. this.$message.warning('请填写单位用量!')
  2287. return
  2288. }
  2289. if (this.componentData.qtyPerAssembly === 0) {
  2290. this.$message.warning('单位用量不能为0!')
  2291. return
  2292. }
  2293. if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
  2294. this.$message.warning('请填写调机量!')
  2295. return
  2296. }
  2297. if (this.componentData.componentScrap === 0) {
  2298. this.$message.warning('调机量不能为0!')
  2299. return
  2300. }
  2301. if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
  2302. this.$message.warning('请填写损耗率!')
  2303. return
  2304. }
  2305. if (this.componentData.shrinkageFactor === 0) {
  2306. this.$message.warning('损耗率不能为0!')
  2307. return
  2308. }
  2309. if (this.componentData.issueType === '' || this.componentData.issueType == null) {
  2310. this.$message.warning('请选择生产属性!')
  2311. return
  2312. }
  2313. if (this.componentData.flag === '1') {
  2314. this.saveComponentLoading = true
  2315. saveBomComponent(this.componentData).then(({data}) => {
  2316. if (data && data.code === 0) {
  2317. this.subDetailList = data.rows
  2318. this.componentSaveModal = false
  2319. this.$message({
  2320. message: '操作成功',
  2321. type: 'success',
  2322. duration: 1500,
  2323. onClose: () => {}
  2324. })
  2325. } else {
  2326. this.$alert(data.msg, '错误', {
  2327. confirmButtonText: '确定'
  2328. })
  2329. }
  2330. this.saveComponentLoading = false
  2331. })
  2332. } else if (this.componentData.flag === '2') {
  2333. this.saveComponentLoading = true
  2334. updateBomComponent(this.componentData).then(({data}) => {
  2335. if (data && data.code === 0) {
  2336. this.subDetailList = data.rows
  2337. this.componentSaveModal = false
  2338. this.$message({
  2339. message: '操作成功',
  2340. type: 'success',
  2341. duration: 1500,
  2342. onClose: () => {}
  2343. })
  2344. } else {
  2345. this.$alert(data.msg, '错误', {
  2346. confirmButtonText: '确定'
  2347. })
  2348. }
  2349. this.saveComponentLoading = false
  2350. })
  2351. }
  2352. },
  2353. /**
  2354. * 回车事件
  2355. */
  2356. focusNextInput (index, type) {
  2357. let aaa = ''
  2358. if (this.subDetailList.length - 1 === index) {
  2359. aaa = `${type}0`
  2360. } else {
  2361. aaa = `${type}${index + 1}`
  2362. }
  2363. this.$nextTick(() => {
  2364. this.$refs[aaa].focus()
  2365. })
  2366. },
  2367. /**
  2368. * 保存主表信息
  2369. */
  2370. saveBomHeader () {
  2371. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  2372. this.$message.warning('请先选择Bom物料!')
  2373. return
  2374. }
  2375. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  2376. this.$message.warning('请先填写Bom版本号!')
  2377. return
  2378. }
  2379. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  2380. this.$message.warning('请先选择制造类型!')
  2381. return
  2382. }
  2383. if (this.modalData.typeFlag === '' || this.modalData.typeFlag == null) {
  2384. this.$message.warning('请先选择类型!')
  2385. return
  2386. }
  2387. this.saveHeaderLoading = true
  2388. // 新增主表信息
  2389. saveBomHeader(this.modalData).then(({data}) => {
  2390. if (data && data.code === 0) {
  2391. this.modalData = {
  2392. flag: '1',
  2393. title: 'bom新增',
  2394. site: data.rows.modalData.site,
  2395. partNo: data.rows.modalData.partNo,
  2396. partDesc: data.rows.modalData.partDesc,
  2397. engChgLevel: data.rows.modalData.engChgLevel,
  2398. bomType: data.rows.modalData.bomType,
  2399. noteText: data.rows.modalData.noteText,
  2400. effPhaseInDate: data.rows.modalData.effPhaseInDate,
  2401. effPhaseOutDate: data.rows.modalData.effPhaseOutDate,
  2402. engRevision: data.rows.modalData.engRevision,
  2403. typeFlag: data.rows.modalData.typeFlag,
  2404. netWeight: data.rows.modalData.netWeight,
  2405. officialFlag: data.rows.modalData.officialFlag
  2406. }
  2407. this.detailDataList = data.rows.detailDataList
  2408. this.detailData = data.rows.detailData
  2409. this.subDetailList = []
  2410. this.modalDisableFlag = true
  2411. this.$message({
  2412. message: '操作成功',
  2413. type: 'success',
  2414. duration: 1500,
  2415. onClose: () => {}
  2416. })
  2417. } else {
  2418. this.$alert(data.msg, '错误', {
  2419. confirmButtonText: '确定'
  2420. })
  2421. }
  2422. this.saveHeaderLoading = false
  2423. })
  2424. },
  2425. /**
  2426. * 复制bom的模态框
  2427. */
  2428. copyBomRevision () {
  2429. this.copyBomData = {
  2430. site: this.modalData.site,
  2431. partNo: this.modalData.partNo,
  2432. engChgLevel: this.modalData.engChgLevel + 1,
  2433. bomType: this.modalData.bomType,
  2434. effPhaseInDate: this.dayjs(new Date()).format('YYYY-MM-DD'),
  2435. effPhaseOutDate: '',
  2436. previousVersion: {},
  2437. createBy: this.$store.state.user.name,
  2438. officialFlag: 'N'
  2439. }
  2440. this.copyBomModelFlag = true
  2441. },
  2442. /**
  2443. * 复制bom的方法
  2444. */
  2445. copyBom () {
  2446. if (this.copyBomData.partNo === '' || this.copyBomData.partNo == null) {
  2447. this.$message.warning('请选择Bom物料!')
  2448. return
  2449. }
  2450. if (this.copyBomData.engChgLevel === '' || this.copyBomData.engChgLevel == null) {
  2451. this.$message.warning('请填写Bom版本号!')
  2452. return
  2453. }
  2454. if (this.copyBomData.bomType === '' || this.copyBomData.bomType == null) {
  2455. this.$message.warning('请选择制造类型!')
  2456. return
  2457. }
  2458. this.copyBomData.previousVersion = this.modalData
  2459. // 新增主表信息
  2460. copyBom(this.copyBomData).then(({data}) => {
  2461. if (data && data.code === 0) {
  2462. this.copyBomModelFlag = false
  2463. this.$message({
  2464. message: '操作成功',
  2465. type: 'success',
  2466. duration: 1500,
  2467. onClose: () => {}
  2468. })
  2469. } else {
  2470. this.$alert(data.msg, '错误', {
  2471. confirmButtonText: '确定'
  2472. })
  2473. }
  2474. })
  2475. },
  2476. /**
  2477. * 复制alternative的模态框
  2478. */
  2479. copyBomAlternative () {
  2480. this.copyAlternativeData = {
  2481. site: this.detailData.site,
  2482. partNo: this.detailData.partNo,
  2483. engChgLevel: this.detailData.engChgLevel,
  2484. bomType: this.detailData.bomType,
  2485. alternativeNo: this.detailData.alternativeNo,
  2486. alternativeDescription: this.detailData.alternativeDescription,
  2487. minLotQty: this.detailData.minLotQty,
  2488. defaultFlag: this.detailData.defaultFlag,
  2489. detailNoteText: this.detailData.detailNoteText,
  2490. status: 'Tentative',
  2491. officialFlag: 'N',
  2492. previousVersion: {},
  2493. createBy: this.$store.state.user.name
  2494. }
  2495. this.copyAlternativeModelFlag = true
  2496. },
  2497. /**
  2498. * 复制alternative的方法
  2499. */
  2500. copyAlternative () {
  2501. if (this.copyAlternativeData.partNo === '' || this.copyAlternativeData.partNo == null) {
  2502. this.$message.warning('请选择Bom物料!')
  2503. return
  2504. }
  2505. if (this.copyAlternativeData.engChgLevel === '' || this.copyAlternativeData.engChgLevel == null) {
  2506. this.$message.warning('请填写Bom版本号!')
  2507. return
  2508. }
  2509. if (this.copyAlternativeData.bomType === '' || this.copyAlternativeData.bomType == null) {
  2510. this.$message.warning('请选择制造类型!')
  2511. return
  2512. }
  2513. if (this.copyAlternativeData.alternativeNo === '' || this.copyAlternativeData.alternativeNo == null) {
  2514. this.$message.warning('请填写替代编码!')
  2515. return
  2516. }
  2517. if (this.copyAlternativeData.alternativeDescription === '' || this.copyAlternativeData.alternativeDescription == null) {
  2518. this.$message.warning('请填写替代名称!')
  2519. return
  2520. }
  2521. this.copyAlternativeData.previousVersion = this.detailData
  2522. copyAlternative(this.copyAlternativeData).then(({data}) => {
  2523. if (data && data.code === 0) {
  2524. this.detailDataList = data.rows.detailDataList
  2525. this.copyAlternativeModelFlag = false
  2526. this.$message({
  2527. message: '操作成功',
  2528. type: 'success',
  2529. duration: 1500,
  2530. onClose: () => {}
  2531. })
  2532. } else {
  2533. this.$alert(data.msg, '错误', {
  2534. confirmButtonText: '确定'
  2535. })
  2536. }
  2537. })
  2538. },
  2539. /**
  2540. * 新增替代方法
  2541. */
  2542. detailDataSave () {
  2543. if (this.saveDetailData.partNo === '' || this.saveDetailData.partNo == null) {
  2544. this.$message.warning('请先选择Bom物料!')
  2545. return
  2546. }
  2547. if (this.saveDetailData.engChgLevel === '' || this.saveDetailData.engChgLevel == null) {
  2548. this.$message.warning('请先填写Bom版本号!')
  2549. return
  2550. }
  2551. if (this.saveDetailData.bomType === '' || this.saveDetailData.bomType == null) {
  2552. this.$message.warning('请先选择制造类型!')
  2553. return
  2554. }
  2555. if (this.saveDetailData.alternativeNo === '' || this.saveDetailData.alternativeNo == null) {
  2556. this.$message.warning('请填写替代编码!')
  2557. return
  2558. }
  2559. if (this.saveDetailData.alternativeDescription === '' || this.saveDetailData.alternativeDescription == null) {
  2560. this.$message.warning('请填写替代名称!')
  2561. return
  2562. }
  2563. if (this.saveDetailData.status === '' || this.saveDetailData.status == null) {
  2564. this.$message.warning('请选择替代状态!')
  2565. return
  2566. }
  2567. if (this.saveDetailData.minLotQty === '' || this.saveDetailData.minLotQty == null) {
  2568. this.$message.warning('请填写最小订单数!')
  2569. return
  2570. }
  2571. this.saveDetailLoading = true
  2572. if (this.saveDetailData.flag === '1') {
  2573. bomDetailSave(this.saveDetailData).then(({data}) => {
  2574. if (data && data.code === 0) {
  2575. this.detailDataList = data.rows
  2576. this.detailData = this.saveDetailData
  2577. this.subDetailList = []
  2578. this.saveDetailModalFlag = false
  2579. this.$message({
  2580. message: '操作成功',
  2581. type: 'success',
  2582. duration: 1500,
  2583. onClose: () => {}
  2584. })
  2585. } else {
  2586. this.$alert(data.msg, '错误', {
  2587. confirmButtonText: '确定'
  2588. })
  2589. }
  2590. this.saveDetailLoading = false
  2591. })
  2592. } else {
  2593. bomDetailUpdate(this.saveDetailData).then(({data}) => {
  2594. if (data && data.code === 0) {
  2595. this.detailDataList = data.rows.detailDataList
  2596. this.detailData = data.rows.detailData
  2597. this.subDetailList = data.rows.subDetailList
  2598. this.saveDetailModalFlag = false
  2599. this.$message({
  2600. message: '操作成功',
  2601. type: 'success',
  2602. duration: 1500,
  2603. onClose: () => {}
  2604. })
  2605. } else {
  2606. this.$alert(data.msg, '错误', {
  2607. confirmButtonText: '确定'
  2608. })
  2609. }
  2610. this.saveDetailLoading = false
  2611. })
  2612. }
  2613. },
  2614. /**
  2615. * 删除替代
  2616. */
  2617. deleteBomDetail () {
  2618. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  2619. this.$message.warning('请选择要删除的替代编码!')
  2620. return
  2621. }
  2622. if (this.detailData.alternativeNo === '*') {
  2623. this.$message.warning('当前为默认替代,不可以删除!')
  2624. return
  2625. }
  2626. this.$confirm(`是否删除这项替代?`, '提示', {
  2627. confirmButtonText: '确定',
  2628. cancelButtonText: '取消',
  2629. type: 'warning'
  2630. }).then(() => {
  2631. bomDetailDelete(this.detailData).then(({data}) => {
  2632. if (data && data.code === 0) {
  2633. this.detailData = data.rows.detailData
  2634. this.detailDataList = data.rows.detailDataList
  2635. this.subDetailList = data.rows.subDetailList
  2636. this.$message({
  2637. message: '操作成功',
  2638. type: 'success',
  2639. duration: 1500,
  2640. onClose: () => {}
  2641. })
  2642. } else {
  2643. this.$alert(data.msg, '错误', {
  2644. confirmButtonText: '确定'
  2645. })
  2646. }
  2647. })
  2648. }).catch(() => {
  2649. })
  2650. },
  2651. /**
  2652. * 修改替代状态为 Buildable
  2653. */
  2654. updateStatusToBuildable () {
  2655. this.$confirm(`是否修改状态为Buildable?`, '提示', {
  2656. confirmButtonText: '确定',
  2657. cancelButtonText: '取消',
  2658. type: 'warning'
  2659. }).then(() => {
  2660. updateAlternativeStatus(this.detailData).then(({data}) => {
  2661. if (data && data.code === 0) {
  2662. this.detailDataList = data.rows.detailDataList
  2663. this.detailData = data.rows.detailData
  2664. this.subDetailList = data.rows.subDetailList
  2665. this.$message({
  2666. message: '操作成功',
  2667. type: 'success',
  2668. duration: 1500,
  2669. onClose: () => {}
  2670. })
  2671. } else {
  2672. this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
  2673. // 刷新替代和子明细
  2674. this.alternativeChange()
  2675. }
  2676. })
  2677. }).catch(() => {
  2678. })
  2679. },
  2680. /**
  2681. * 修改替代状态为 Obsolete
  2682. */
  2683. updateStatusToObsolete () {
  2684. this.$confirm(`是否修改状态为Obsolete?`, '提示', {
  2685. confirmButtonText: '确定',
  2686. cancelButtonText: '取消',
  2687. type: 'warning'
  2688. }).then(() => {
  2689. updateAlternativeStatus(this.detailData).then(({data}) => {
  2690. if (data && data.code === 0) {
  2691. this.detailDataList = data.rows.detailDataList
  2692. this.detailData = data.rows.detailData
  2693. this.subDetailList = data.rows.subDetailList
  2694. this.$message({
  2695. message: '操作成功',
  2696. type: 'success',
  2697. duration: 1500,
  2698. onClose: () => {}
  2699. })
  2700. } else {
  2701. this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
  2702. // 刷新替代和子明细
  2703. this.alternativeChange()
  2704. }
  2705. })
  2706. }).catch(() => {
  2707. })
  2708. },
  2709. /**
  2710. * 替代改变事件
  2711. */
  2712. alternativeChange () {
  2713. queryBomComponent(this.detailData).then(({data}) => {
  2714. if (data && data.code === 0) {
  2715. this.detailDataList = data.rows.detailDataList
  2716. this.detailData = data.rows.detailData
  2717. this.subDetailList = data.rows.subDetailList
  2718. } else {
  2719. this.$alert(data.msg, '错误', {
  2720. confirmButtonText: '确定'
  2721. })
  2722. }
  2723. })
  2724. },
  2725. // 临时Bom转为正式Bom
  2726. toBecomeOfficialBom () {
  2727. toBecomeOfficialBom(this.detailData).then(({data}) => {
  2728. if (data && data.code === 0) {
  2729. this.$message({
  2730. message: '操作成功',
  2731. type: 'success',
  2732. duration: 1500,
  2733. onClose: () => {}
  2734. })
  2735. } else {
  2736. this.$alert(data.msg, '错误', {
  2737. confirmButtonText: '确定'
  2738. })
  2739. }
  2740. })
  2741. },
  2742. // ======= 正则校验 =======
  2743. handleInput (value, type) {
  2744. // 大于等于0,且只能输入4位小数
  2745. let val = value.replace(/^\D*([0-9]\d*\.?\d{0,4})?.*$/,'$1')
  2746. if (val === null || val === undefined || val === '') {
  2747. val = 0
  2748. }
  2749. if (type === 1) {
  2750. this.modalData.netWeight = val
  2751. } else if (type === 2) {
  2752. this.detailData.minLotQty = val
  2753. } else if (type === 3) {
  2754. this.saveDetailData.minLotQty = val
  2755. }
  2756. // else if (type === 4) {
  2757. // this.componentData.qtyPerAssembly = val
  2758. // }
  2759. else if (type === 5) {
  2760. this.componentData.componentScrap = val
  2761. }
  2762. },
  2763. handleInput16 (value, type) {
  2764. // 大于等于0,且只能输入4位小数
  2765. let val = value.replace(/^\D*([0-9]\d*\.?\d{0,16})?.*$/,'$1')
  2766. if (val === null || val === undefined || val === '') {
  2767. val = 0
  2768. }
  2769. if (type === 1) {
  2770. this.componentData.qtyPerAssembly = val
  2771. }
  2772. },
  2773. handleInputB (value) {
  2774. // 0-100
  2775. const reg = /^(([1-9]?\d{0,1}(\.\d{1,2})?)|100|100\.(0){1,2})$/
  2776. if (reg.test(value) === true) {
  2777. this.componentData.shrinkageFactor = value
  2778. } else if (value > 100) {
  2779. this.componentData.shrinkageFactor = 100
  2780. } else {
  2781. this.componentData.shrinkageFactor = 0
  2782. }
  2783. },
  2784. // handleInputC (value, type) {
  2785. // // 正整数
  2786. // // let val = value.replace(/^\+?[1-9][0-9]*$/,'$1')
  2787. // // if (val === null || val === undefined || val === '') {
  2788. // // val = 1
  2789. // // }
  2790. // // if (type === 1) {
  2791. // // this.modalData.engChgLevel = val
  2792. // // }
  2793. // const reg = /^\+?[1-9][0-9]*$/
  2794. // if (reg.test(value) === true) {
  2795. // this.modalData.engChgLevel = value
  2796. // }
  2797. //
  2798. // },
  2799. /**
  2800. * 根据物料编码查询工序
  2801. */
  2802. queryOperationList () {
  2803. this.operationData.partNo = this.modalData.partNo
  2804. // 查询所有
  2805. queryOperationList(this.operationData).then(({data}) => {
  2806. if (data && data.code === 0) {
  2807. this.operationList = data.rows
  2808. this.operationModelFlag = true
  2809. } else {
  2810. this.$alert(data.msg, '错误', {
  2811. confirmButtonText: '确定'
  2812. })
  2813. }
  2814. })
  2815. },
  2816. // ======== chooseList相关方法 ========
  2817. /**
  2818. * 获取基础数据列表S
  2819. * @param val
  2820. * @param type
  2821. */
  2822. getBaseList (val, type) {
  2823. this.tagNo = val
  2824. this.$nextTick(() => {
  2825. let strVal = ''
  2826. if (val === 117) {
  2827. strVal = this.componentData.issueToLoc
  2828. }
  2829. this.$refs.baseList.init(val, strVal)
  2830. })
  2831. },
  2832. /**
  2833. * 列表方法的回调
  2834. * @param val
  2835. */
  2836. getBaseData (val) {
  2837. if (this.tagNo === 117) {
  2838. this.componentData.issueToLoc = val.location_id
  2839. this.componentData.issueToLocName = val.location_name
  2840. }
  2841. },
  2842. // ======== 导出相关方法 ========
  2843. /**
  2844. * 导出excel
  2845. */
  2846. async createExportData () {
  2847. this.searchData.limit = -1
  2848. this.searchData.page = 1
  2849. await bomManagementSearch(this.searchData).then(({data}) => {
  2850. this.resultList = data.page.list
  2851. })
  2852. return this.resultList
  2853. },
  2854. startDownload () {},
  2855. finishDownload () {},
  2856. fields () {
  2857. let json = '{'
  2858. this.columnList.forEach((item, index) => {
  2859. if (index == this.columnList.length - 1) {
  2860. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  2861. } else {
  2862. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  2863. }
  2864. })
  2865. json += '}'
  2866. let s = eval('(' + json + ')')
  2867. return s
  2868. },
  2869. // 切换到routing
  2870. checkOutToRouting (partNo) {
  2871. if (this.$router.resolve('part-routingManagement').resolved.name === '404') {
  2872. this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',})
  2873. } else {
  2874. this.$router.push({name:"part-routingManagement",params:{partNo: partNo}})
  2875. }
  2876. }
  2877. }
  2878. }
  2879. </script>
  2880. <style scoped lang="scss">
  2881. /deep/ .detail-tab .el-tabs__content {
  2882. height: 165px;
  2883. padding: 15px 0px 0px 0px;
  2884. }
  2885. /deep/ .sub_detail-tab .el-tabs__content {
  2886. height: 280px;
  2887. padding: 0px;
  2888. }
  2889. .numInput /deep/ .el-input__inner{
  2890. text-align: right;
  2891. }
  2892. /deep/ .inlineNumber input::-webkit-outer-spin-button,
  2893. /deep/ .inlineNumber input::-webkit-inner-spin-button {
  2894. -webkit-appearance: none;
  2895. }
  2896. /deep/ .inlineNumber input[type="number"]{
  2897. -moz-appearance: textfield;
  2898. padding-right: 5px !important;
  2899. }
  2900. </style>