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.

2129 lines
69 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  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="100"
  65. label="操作">
  66. <template slot-scope="scope">
  67. <a type="text" size="small" @click="updateModal(scope.row)">编辑</a>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <!-- 复选统计 -->
  72. <selectDiv ref="selectDiv"></selectDiv>
  73. <!-- 分页插件 -->
  74. <el-pagination style="margin-top: 0px"
  75. @size-change="sizeChangeHandle"
  76. @current-change="currentChangeHandle"
  77. :current-page="pageIndex"
  78. :page-sizes="[20, 50, 100, 200, 500]"
  79. :page-size="pageSize"
  80. :total="totalPage"
  81. layout="total, sizes, prev, pager, next, jumper">
  82. </el-pagination>
  83. <!-- bom新增/编辑模态框 -->
  84. <el-dialog :close-on-click-modal="false" :before-close="closeModalX" v-drag :visible.sync="modalFlag" width="1110px">
  85. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 5px">
  86. <el-form-item prop="partNo" :rules="rules.partNo">
  87. <span v-if="!modalDisableFlag" slot="label" @click="queryPartList()"><a herf="#">物料编码</a></span>
  88. <span v-if="modalDisableFlag" slot="label">物料编码</span>
  89. <el-input v-model="modalData.partNo" :disabled="modalDisableFlag" style="width: 221px"></el-input>
  90. </el-form-item>
  91. <el-form-item :label="'物料名称'" prop="partDesc" :rules="rules.partDesc">
  92. <el-input v-model="modalData.partDesc" disabled style="width: 221px"></el-input>
  93. </el-form-item>
  94. <el-form-item :label="'制造类型'" prop="bomType" :rules="rules.bomType">
  95. <el-select v-model="modalData.bomType" :disabled="modalDisableFlag" style="width: 221px">
  96. <el-option label="制造" value="manufacturing"></el-option>
  97. </el-select>
  98. </el-form-item>
  99. <!-- <el-form-item :label="'类型'" prop="typeFlag" :rules="rules.typeFlag">-->
  100. <!-- <el-select v-model="modalData.typeFlag" disabled style="width: 142px">-->
  101. <!-- <el-option label="BOM" value="B"></el-option>-->
  102. <!-- <el-option label="配方" value="F"></el-option>-->
  103. <!-- </el-select>-->
  104. <!-- </el-form-item>-->
  105. <el-form-item :label="'净重'">
  106. <el-input class="numInput" v-model="modalData.netWeight" type="number" @input="handleInput(modalData.netWeight,1)" style="width: 221px"></el-input>
  107. </el-form-item>
  108. </el-form>
  109. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  110. <el-form-item label="开始日期" prop="effPhaseInDate" :rules="rules.effPhaseInDate">
  111. <el-date-picker
  112. style="width: 221px"
  113. v-model="modalData.effPhaseInDate"
  114. type="date"
  115. format="yyyy-MM-dd"
  116. placeholder="请选择日期"
  117. :editable=false>
  118. </el-date-picker>
  119. </el-form-item>
  120. <el-form-item label="结束日期" prop="effPhaseOutDate" :rules="rules.effPhaseOutDate">
  121. <el-date-picker
  122. style="width: 221px"
  123. v-model="modalData.effPhaseOutDate"
  124. type="date"
  125. format="yyyy-MM-dd"
  126. placeholder="请选择日期"
  127. :editable=false>
  128. </el-date-picker>
  129. </el-form-item>
  130. <el-form-item :label="'BOM版本号'" prop="engChgLevel" :rules="rules.engChgLevel">
  131. <el-input v-model="modalData.engChgLevel" :disabled="modalDisableFlag" style="width: 221px"></el-input>
  132. </el-form-item>
  133. <el-form-item :label="'工程版本号'">
  134. <el-input v-model="modalData.engRevision" style="width: 221px"></el-input>
  135. </el-form-item>
  136. <el-form-item v-if="!modalDisableFlag">
  137. <el-button :loading="saveHeaderLoading" type="primary" @click="saveBomHeader()" style="margin-top: 23px;width: 120px">保存</el-button>
  138. </el-form-item>
  139. </el-form>
  140. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  141. <el-form-item label="备注">
  142. <el-input type="textarea" v-model="modalData.noteText" :rows="3" resize='none' show-word-limit style="width: 1082px;height: 20px"></el-input>
  143. </el-form-item>
  144. </el-form>
  145. <el-tabs v-model="detailTable" style="margin-top: 50px; width: 100%; min-height: 120px" type="border-card" @tab-click="tabDetailClick" class="detail-tab">
  146. <!-- BOM明细信息页签 -->
  147. <el-tab-pane label="Product Structure" name="bom_detail">
  148. <el-form label-position="top" style="margin-top: -10px">
  149. <el-form-item>
  150. <el-button type="primary" @click="saveBomDetail()" style="margin-left: 7px">新增</el-button>
  151. <el-button type="primary" @click="deleteBomDetail()">删除</el-button>
  152. </el-form-item>
  153. </el-form>
  154. <el-form :inline="true" label-position="top" :model="detailData" :rules="rules" style="margin-left: 7px">
  155. <el-form-item :label="'替代编码'" prop="alternativeNo" :rules="rules.alternativeNo">
  156. <el-select v-model="detailData.alternativeNo" @change="alternativeChange()" style="width: 221px">
  157. <el-option
  158. v-for = "(i, index) in detailDataList"
  159. :key = "index"
  160. :label = "i.alternativeNo"
  161. :value = "i.alternativeNo">
  162. </el-option>
  163. </el-select>
  164. </el-form-item>
  165. <el-form-item :label="'替代名称'">
  166. <el-input v-model="detailData.alternativeDescription" style="width: 221px"></el-input>
  167. </el-form-item>
  168. <el-form-item :label="'最小订单数'">
  169. <el-input class="numInput" v-model="detailData.minLotQty" @input="handleInput(detailData.minLotQty,2)" type="number" style="width: 221px"></el-input>
  170. </el-form-item>
  171. </el-form>
  172. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px">
  173. <el-form-item label="备注">
  174. <el-input type="textarea" v-model="detailData.detailNoteText" :rows="3" resize='none' show-word-limit style="width: 1073px;height: 20px"></el-input>
  175. </el-form-item>
  176. </el-form>
  177. </el-tab-pane>
  178. </el-tabs>
  179. <el-tabs v-model="subDetailTable" style="width: 100%; min-height: 330px" type="border-card" @tab-click="tabSubDetailClick" class="sub_detail-tab">
  180. <!-- BOM子明细信息页签 -->
  181. <el-tab-pane label="Components" name="bom_sub_detail">
  182. <el-form label-position="top" style="margin-top: 5px">
  183. <el-form-item>
  184. <el-button type="primary" @click="saveComponentModal()" style="margin-left: 7px">新增</el-button>
  185. <el-button type="primary" @click="deleteComponentPart()">删除</el-button>
  186. </el-form-item>
  187. </el-form>
  188. <el-table
  189. :data="subDetailList"
  190. height="256px"
  191. border
  192. ref="componentTable"
  193. @row-click="componentClickRow"
  194. :row-class-name="rowClassName"
  195. @selection-change="componentSelectionChange"
  196. style="width:100%">
  197. <el-table-column type="selection" align="center" width="50"></el-table-column>
  198. <el-table-column
  199. v-for="(item,index) in columnSubDetailList" :key="index"
  200. :sortable="item.columnSortable"
  201. :prop="item.columnProp"
  202. :header-align="item.headerAlign"
  203. :show-overflow-tooltip="item.showOverflowTooltip"
  204. :align="item.align"
  205. :fixed="item.fixed == ''?false:item.fixed"
  206. :min-width="item.columnWidth"
  207. :label="item.columnLabel">
  208. <template slot-scope="scope">
  209. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  210. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  211. </template>
  212. </el-table-column>
  213. <el-table-column
  214. fixed="right"
  215. header-align="center"
  216. align="center"
  217. width="100"
  218. label="操作">
  219. <template slot-scope="scope">
  220. <a type="text" size="small" @click="updateComponentModal(scope.row)">编辑</a>
  221. </template>
  222. </el-table-column>
  223. </el-table>
  224. </el-tab-pane>
  225. </el-tabs>
  226. <el-footer style="height:30px;margin-top:20px;text-align:center">
  227. <el-button :loading="saveAllLoading" type="primary" @click="saveData()">保存</el-button>
  228. <el-button type="primary" @click="closeModal()">关闭</el-button>
  229. </el-footer>
  230. </el-dialog>
  231. <!-- 明细新增模态框 -->
  232. <el-dialog title="新增替代" :close-on-click-modal="false" v-drag :visible.sync="saveDetailModalFlag" width="630px">
  233. <el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
  234. <el-form-item :label="'替代编码'" prop="alternativeNo" :rules="detailRules.alternativeNo">
  235. <el-input v-model="saveDetailData.alternativeNo" style="width: 221px"></el-input>
  236. </el-form-item>
  237. <el-form-item :label="'替代名称'" prop="alternativeDescription" :rules="detailRules.alternativeDescription">
  238. <el-input v-model="saveDetailData.alternativeDescription" style="width: 221px"></el-input>
  239. </el-form-item>
  240. <el-form-item :label="'最小订单数'" prop="minLotQty" :rules="detailRules.minLotQty">
  241. <el-input class="numInput" v-model="saveDetailData.minLotQty" @input="handleInput(saveDetailData.minLotQty,3)" type="number" style="width: 120px"></el-input>
  242. </el-form-item>
  243. </el-form>
  244. <el-form :inline="true" label-position="top" :model="saveDetailData" style="margin-left: 5px">
  245. <el-form-item label="备注">
  246. <el-input type="textarea" v-model="saveDetailData.detailNoteText" :rows="3" resize='none' show-word-limit style="width: 600px;height: 20px"></el-input>
  247. </el-form-item>
  248. </el-form>
  249. <el-footer style="height:35px;margin-top:65px;text-align:center">
  250. <el-button :loading="saveDetailLoading" type="primary" @click="detailDataSave()">保存</el-button>
  251. <el-button type="primary" @click="saveDetailModalFlag = false">关闭</el-button>
  252. </el-footer>
  253. </el-dialog>
  254. <!-- 物料模态框 -->
  255. <el-dialog title="物料清单" :close-on-click-modal="false" v-drag :visible.sync="partModelFlag" width="520px">
  256. <div class="rq">
  257. <el-form :inline="true" label-position="top" :model="partData">
  258. <el-form-item :label="'物料编码'">
  259. <el-input v-model="partData.partNo" clearable style="width: 120px"></el-input>
  260. </el-form-item>
  261. <el-form-item :label="'物料名称'">
  262. <el-input v-model="partData.partDesc" clearable style="width: 120px"></el-input>
  263. </el-form-item>
  264. <el-form-item :label="' '">
  265. <el-button type="primary" @click="queryPartList()">查询</el-button>
  266. </el-form-item>
  267. </el-form>
  268. <el-table
  269. :height="300"
  270. :data="partList"
  271. @row-dblclick="getRowData"
  272. border
  273. style="width: 100%;">
  274. <el-table-column
  275. v-for="(item,index) in partColumnList" :key="index"
  276. :sortable="item.columnSortable"
  277. :prop="item.columnProp"
  278. :header-align="item.headerAlign"
  279. :show-overflow-tooltip="item.showOverflowTooltip"
  280. :align="item.align"
  281. :fixed="item.fixed==''?false:item.fixed"
  282. :min-width="item.columnWidth"
  283. :label="item.columnLabel">
  284. <template slot-scope="scope">
  285. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  286. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  287. </template>
  288. </el-table-column>
  289. </el-table>
  290. </div>
  291. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  292. <el-button type="primary" @click="partModelFlag=false">关闭</el-button>
  293. </el-footer>
  294. </el-dialog>
  295. <!-- 子明细物料模态框 -->
  296. <el-dialog title="物料清单" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="520px">
  297. <el-form :inline="true" label-position="top" :model="componentPartData">
  298. <el-form-item :label="'物料编码'">
  299. <el-input v-model="componentPartData.partNo" clearable style="width: 120px"></el-input>
  300. </el-form-item>
  301. <el-form-item :label="'物料名称'">
  302. <el-input v-model="componentPartData.partDesc" clearable style="width: 120px"></el-input>
  303. </el-form-item>
  304. <el-form-item :label="' '">
  305. <el-button type="primary" @click="queryComponentPartList()">查询</el-button>
  306. </el-form-item>
  307. </el-form>
  308. <el-table
  309. :height="300"
  310. :data="componentPartList"
  311. @row-dblclick="getComponentRowData"
  312. border
  313. style="width: 100%;">
  314. <el-table-column
  315. v-for="(item,index) in componentPartColumnList" :key="index"
  316. :sortable="item.columnSortable"
  317. :prop="item.columnProp"
  318. :header-align="item.headerAlign"
  319. :show-overflow-tooltip="item.showOverflowTooltip"
  320. :align="item.align"
  321. :fixed="item.fixed==''?false:item.fixed"
  322. :min-width="item.columnWidth"
  323. :label="item.columnLabel">
  324. <template slot-scope="scope">
  325. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  326. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  327. </template>
  328. </el-table-column>
  329. </el-table>
  330. </el-dialog>
  331. <!-- 子明细新增模态框 -->
  332. <el-dialog title="新增子物料" :close-on-click-modal="false" v-drag :visible.sync="componentSaveModal" width="500px">
  333. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  334. <el-form-item prop="componentPart" :rules="componentRules.componentPart">
  335. <span v-if="!componentDisableFlag" slot="label" @click="queryComponentPartList()"><a herf="#">子物料编码</a></span>
  336. <span v-if="componentDisableFlag" slot="label">子物料编码</span>
  337. <el-input v-model="componentData.componentPart" :disabled="componentDisableFlag" style="width: 221px"></el-input>
  338. </el-form-item>
  339. <el-form-item :label="'子物料名称'" prop="componentPartDesc" :rules="componentRules.componentPartDesc">
  340. <el-input v-model="componentData.componentPartDesc" disabled style="width: 221px"></el-input>
  341. </el-form-item>
  342. </el-form>
  343. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  344. <el-form-item :label="'单位用量'" prop="qtyPerAssembly" :rules="componentRules.qtyPerAssembly">
  345. <el-input class="numInput" v-model="componentData.qtyPerAssembly" @input="handleInput(componentData.qtyPerAssembly,4)" type="number" style="width: 142px"></el-input>
  346. </el-form-item>
  347. <el-form-item :label="'调机量'" prop="componentScrap" :rules="componentRules.componentScrap">
  348. <el-input class="numInput" v-model="componentData.componentScrap" @input="handleInput(componentData.componentScrap,5)" type="number" style="width: 142px"></el-input>
  349. </el-form-item>
  350. <el-form-item :label="'损耗率%'" prop="shrinkageFactor" :rules="componentRules.shrinkageFactor">
  351. <el-input class="numInput" v-model="componentData.shrinkageFactor" @input="handleInputB(componentData.shrinkageFactor)" type="number" style="width: 142px"></el-input>
  352. </el-form-item>
  353. </el-form>
  354. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  355. <el-form-item :label="'单位'">
  356. <el-input v-model="componentData.printUnitName" disabled style="width: 221px"></el-input>
  357. </el-form-item>
  358. <el-form-item :label="'生产属性'" prop="issueType" :rules="componentRules.issueType">
  359. <el-select v-model="componentData.issueType" clearable style="width: 221px">
  360. <el-option label="领退料倒冲" value="A"></el-option>
  361. <el-option label="工单倒冲" value="B"></el-option>
  362. <el-option label="生产订单倒冲" value="C"></el-option>
  363. <el-option label="投料倒冲" value="D"></el-option>
  364. <el-option label="批次倒冲" value="E"></el-option>
  365. <el-option label="销售订单倒冲" value="F"></el-option>
  366. <el-option label="项目倒冲" value="G"></el-option>
  367. </el-select>
  368. </el-form-item>
  369. </el-form>
  370. <el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
  371. <el-form-item>
  372. <span slot="label" @click="getBaseList(103)"><a herf="#">工序</a></span>
  373. <el-input v-model="componentData.operationName" style="width: 221px"></el-input>
  374. </el-form-item>
  375. <el-form-item>
  376. <span slot="label" @click="getBaseList(117)"><a herf="#">发料库位</a></span>
  377. <el-input v-model="componentData.issueToLocName" style="width: 221px"></el-input>
  378. </el-form-item>
  379. </el-form>
  380. <el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
  381. <el-form-item label="备注">
  382. <el-input type="textarea" v-model="componentData.noteText" :rows="3" resize='none' show-word-limit style="width: 455px;height: 20px"></el-input>
  383. </el-form-item>
  384. </el-form>
  385. <el-footer style="height:35px;margin-top:65px;text-align:center">
  386. <el-button :loading="saveComponentLoading" type="primary" @click="componentDataSave()">保存</el-button>
  387. <el-button type="primary" @click="componentSaveModal = false">关闭</el-button>
  388. </el-footer>
  389. </el-dialog>
  390. <!-- chooseList模态框 -->
  391. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  392. </div>
  393. </template>
  394. <script>
  395. import {
  396. bomManagementSearch, // bom列表查询
  397. bomManagementSave, // bom新增
  398. bomManagementEdit, // bom编辑
  399. bomManagementDelete, // bom删除
  400. queryBomHeader, // 查询bom主信息
  401. saveBomHeader, // 新增bom主信息
  402. queryBomDetail, // 查bom明细
  403. bomDetailSave, // bom明细新增
  404. bomDetailDelete, // bom明细删除
  405. queryPartList, // 查询物料清单
  406. queryBomComponent, // 查询bom子明细
  407. saveBomComponent, // 新增bom子明细
  408. updateBomComponent, // 修改bom子明细
  409. deleteBomComponent, // 删除bom子明细
  410. } from '@/api/part/bomManagement.js'
  411. import ChooseList from '@/views/modules/common/Chooselist'
  412. import dayjs from "dayjs";
  413. import fa from "element-ui/src/locale/lang/fa";
  414. export default {
  415. // 组件
  416. components: {
  417. ChooseList
  418. },
  419. // 监听
  420. watch: {
  421. searchData: {
  422. deep: true,
  423. handler: function (newV, oldV) {
  424. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  425. }
  426. },
  427. saveDetailData: {
  428. deep: true,
  429. handler: function (newV, oldV) {
  430. this.saveDetailData.alternativeNo = this.saveDetailData.alternativeNo.toUpperCase()
  431. }
  432. }
  433. },
  434. // 对象
  435. data () {
  436. return {
  437. // 导出
  438. exportData: [],
  439. exportName: 'bom物料列表' + this.dayjs().format('YYYYMMDDHHmmss'),
  440. exportHeader: ['bom物料列表'],
  441. exportFooter: [],
  442. resultList: [],
  443. // ======== 行高 ========
  444. height: 200,
  445. // ======== 分页 ========
  446. pageIndex: 1,
  447. pageSize: 50,
  448. totalPage: 0,
  449. selectedDataNum: 0,
  450. // 条件查询
  451. searchData: {
  452. site: this.$store.state.user.site,
  453. partNo: '',
  454. partDesc: '',
  455. page: 1,
  456. limit: 10
  457. },
  458. // loading
  459. queryLoading: false,
  460. saveHeaderLoading: false,
  461. saveDetailLoading: false,
  462. saveComponentLoading: false,
  463. saveAllLoading: false,
  464. // 初始页签
  465. detailTable: 'bom_detail',
  466. subDetailTable: 'bom_sub_detail',
  467. // ======== 数据对象 ========
  468. modalData: {
  469. flag: '',
  470. title: '',
  471. site: this.$store.state.user.site,
  472. partNo: '',
  473. partDesc: '',
  474. engChgLevel: '',
  475. bomType: '',
  476. noteText: '',
  477. effPhaseInDate: '',
  478. effPhaseOutDate: '',
  479. engRevision: '',
  480. typeFlag: '',
  481. netWeight: '',
  482. createDate: '',
  483. createBy: '',
  484. updateDate: '',
  485. updateBy: ''
  486. },
  487. detailData: {
  488. site: this.$store.state.user.site,
  489. partNo: '',
  490. engChgLevel: '',
  491. bomType: '',
  492. alternativeNo: '',
  493. alternativeDescription: '',
  494. minLotQty: '',
  495. defaultFlag: '',
  496. detailNoteText: '',
  497. createDate: '',
  498. createBy: '',
  499. updateDate: '',
  500. updateBy: ''
  501. },
  502. componentData: {
  503. flag: '',
  504. site: this.$store.state.user.site,
  505. partNo: '',
  506. engChgLevel: '',
  507. bomType: '',
  508. alternativeNo: '',
  509. componentPart: '',
  510. componentPartDesc: '',
  511. printUnit: '',
  512. printUnitName: '',
  513. qtyPerAssembly: '',
  514. componentScrap: '',
  515. issueType: '',
  516. shrinkageFactor: '',
  517. lineItemNo: '',
  518. operationNo: '',
  519. operationName: '',
  520. issueToLoc: '',
  521. issueToLocName: '',
  522. noteText: '',
  523. createDate: '',
  524. createBy: '',
  525. updateDate: '',
  526. updateBy: ''
  527. },
  528. partData: {
  529. site: this.$store.state.user.site,
  530. partNo: '',
  531. partDesc: '',
  532. },
  533. componentPartData: {
  534. site: this.$store.state.user.site,
  535. partNo: '',
  536. partDesc: '',
  537. },
  538. saveDetailData: {
  539. site: this.$store.state.user.site,
  540. partNo: '',
  541. engChgLevel: '',
  542. bomType: '',
  543. alternativeNo: '',
  544. alternativeDescription: '',
  545. minLotQty: '',
  546. defaultFlag: '',
  547. detailNoteText: '',
  548. createDate: '',
  549. createBy: '',
  550. updateDate: '',
  551. updateBy: ''
  552. },
  553. // ======== 数据列表 ========
  554. dataList: [],
  555. partList: [],
  556. componentPartList: [],
  557. componentPartSelections: [],
  558. subDetailList: [],
  559. detailDataList: [],
  560. checkedDetail: [],
  561. // ======== 列表表头 ========
  562. columnList: [
  563. {
  564. userId: this.$store.state.user.name,
  565. functionId: 104002,
  566. serialNumber: '104002Table1PartNo',
  567. tableId: '104002Table1',
  568. tableName: 'BOM信息表',
  569. columnProp: 'partNo',
  570. headerAlign: 'center',
  571. align: 'center',
  572. columnLabel: '物料编码',
  573. columnHidden: false,
  574. columnImage: false,
  575. columnSortable: false,
  576. sortLv: 0,
  577. status: true,
  578. fixed: '',
  579. columnWidth: 120
  580. },
  581. {
  582. userId: this.$store.state.user.name,
  583. functionId: 104002,
  584. serialNumber: '104002Table1PartDesc',
  585. tableId: '104002Table1',
  586. tableName: 'BOM信息表',
  587. columnProp: 'partDesc',
  588. headerAlign: 'center',
  589. align: 'left',
  590. columnLabel: '物料名称',
  591. columnHidden: false,
  592. columnImage: false,
  593. columnSortable: false,
  594. sortLv: 0,
  595. status: true,
  596. fixed: '',
  597. columnWidth: 120
  598. },
  599. {
  600. userId: this.$store.state.user.name,
  601. functionId: 104002,
  602. serialNumber: '104002Table1BomType',
  603. tableId: '104002Table1',
  604. tableName: 'BOM信息表',
  605. columnProp: 'bomType',
  606. headerAlign: 'center',
  607. align: 'center',
  608. columnLabel: '制造类型',
  609. columnHidden: false,
  610. columnImage: false,
  611. columnSortable: false,
  612. sortLv: 0,
  613. status: true,
  614. fixed: '',
  615. columnWidth: 120
  616. },
  617. {
  618. userId: this.$store.state.user.name,
  619. functionId: 104002,
  620. serialNumber: '104002Table1EngChgLevel',
  621. tableId: '104002Table1',
  622. tableName: 'BOM信息表',
  623. columnProp: 'engChgLevel',
  624. headerAlign: 'center',
  625. align: 'center',
  626. columnLabel: 'BOM版本号',
  627. columnHidden: false,
  628. columnImage: false,
  629. columnSortable: false,
  630. sortLv: 0,
  631. status: true,
  632. fixed: '',
  633. columnWidth: 120
  634. },
  635. {
  636. userId: this.$store.state.user.name,
  637. functionId: 104002,
  638. serialNumber: '104002Table1engRevision',
  639. tableId: '104002Table1',
  640. tableName: 'BOM信息表',
  641. columnProp: 'engRevision',
  642. headerAlign: 'center',
  643. align: 'center',
  644. columnLabel: '工程版本号',
  645. columnHidden: false,
  646. columnImage: false,
  647. columnSortable: false,
  648. sortLv: 0,
  649. status: true,
  650. fixed: '',
  651. columnWidth: 120
  652. },
  653. {
  654. userId: this.$store.state.user.name,
  655. functionId: 104002,
  656. serialNumber: '104002Table1NetWeight',
  657. tableId: '104002Table1',
  658. tableName: 'BOM信息表',
  659. columnProp: 'netWeight',
  660. headerAlign: 'center',
  661. align: 'right',
  662. columnLabel: '净重',
  663. columnHidden: false,
  664. columnImage: false,
  665. columnSortable: false,
  666. sortLv: 0,
  667. status: true,
  668. fixed: '',
  669. columnWidth: 80
  670. },
  671. {
  672. userId: this.$store.state.user.name,
  673. functionId: 104002,
  674. serialNumber: '104002Table1EffPhaseInDate',
  675. tableId: '104002Table1',
  676. tableName: 'BOM信息表',
  677. columnProp: 'effPhaseInDate',
  678. headerAlign: 'center',
  679. align: 'center',
  680. columnLabel: '开始时间',
  681. columnHidden: false,
  682. columnImage: false,
  683. columnSortable: false,
  684. sortLv: 0,
  685. status: true,
  686. fixed: '',
  687. columnWidth: 130
  688. },
  689. {
  690. userId: this.$store.state.user.name,
  691. functionId: 104002,
  692. serialNumber: '104002Table1EffPhaseOutDate',
  693. tableId: '104002Table1',
  694. tableName: 'BOM信息表',
  695. columnProp: 'effPhaseOutDate',
  696. headerAlign: 'center',
  697. align: 'center',
  698. columnLabel: '结束时间',
  699. columnHidden: false,
  700. columnImage: false,
  701. columnSortable: false,
  702. sortLv: 0,
  703. status: true,
  704. fixed: '',
  705. columnWidth: 130
  706. },
  707. {
  708. userId: this.$store.state.user.name,
  709. functionId: 104002,
  710. serialNumber: '104002Table1CreateDate',
  711. tableId: '104002Table1',
  712. tableName: 'BOM信息表',
  713. columnProp: 'createDate',
  714. headerAlign: 'center',
  715. align: 'center',
  716. columnLabel: '创建时间',
  717. columnHidden: false,
  718. columnImage: false,
  719. columnSortable: false,
  720. sortLv: 0,
  721. status: true,
  722. fixed: '',
  723. columnWidth: 130
  724. },
  725. {
  726. userId: this.$store.state.user.name,
  727. functionId: 104002,
  728. serialNumber: '104002Table1CreateBy',
  729. tableId: '104002Table1',
  730. tableName: 'BOM信息表',
  731. columnProp: 'createBy',
  732. headerAlign: 'center',
  733. align: 'center',
  734. columnLabel: '创建人',
  735. columnHidden: false,
  736. columnImage: false,
  737. columnSortable: false,
  738. sortLv: 0,
  739. status: true,
  740. fixed: '',
  741. columnWidth: 80
  742. },
  743. {
  744. userId: this.$store.state.user.name,
  745. functionId: 104002,
  746. serialNumber: '104002Table1UpdateDate',
  747. tableId: '104002Table1',
  748. tableName: 'BOM信息表',
  749. columnProp: 'updateDate',
  750. headerAlign: 'center',
  751. align: 'center',
  752. columnLabel: '更新时间',
  753. columnHidden: false,
  754. columnImage: false,
  755. columnSortable: false,
  756. sortLv: 0,
  757. status: true,
  758. fixed: '',
  759. columnWidth: 130
  760. },
  761. {
  762. userId: this.$store.state.user.name,
  763. functionId: 104002,
  764. serialNumber: '104002Table1UpdateBy',
  765. tableId: '104002Table1',
  766. tableName: 'BOM信息表',
  767. columnProp: 'updateBy',
  768. headerAlign: 'center',
  769. align: 'center',
  770. columnLabel: '更新人',
  771. columnHidden: false,
  772. columnImage: false,
  773. columnSortable: false,
  774. sortLv: 0,
  775. status: true,
  776. fixed: '',
  777. columnWidth: 80
  778. }
  779. ],
  780. partColumnList: [
  781. {
  782. columnProp: 'partNo',
  783. headerAlign: "center",
  784. align: "center",
  785. columnLabel: '物料编码',
  786. columnHidden: false,
  787. columnImage: false,
  788. columnSortable: false,
  789. sortLv: 0,
  790. status: true,
  791. fixed: '',
  792. },
  793. {
  794. columnProp: 'partDesc',
  795. headerAlign: "center",
  796. align: "center",
  797. columnLabel: '物料名称',
  798. columnHidden: false,
  799. columnImage: false,
  800. columnSortable: false,
  801. sortLv: 0,
  802. status: true,
  803. fixed: '',
  804. },
  805. ],
  806. componentPartColumnList: [
  807. {
  808. columnProp: 'partNo',
  809. headerAlign: "center",
  810. align: "center",
  811. columnLabel: '物料编码',
  812. columnHidden: false,
  813. columnImage: false,
  814. columnSortable: false,
  815. sortLv: 0,
  816. status: true,
  817. fixed: '',
  818. },
  819. {
  820. columnProp: 'partDesc',
  821. headerAlign: "center",
  822. align: "center",
  823. columnLabel: '物料名称',
  824. columnHidden: false,
  825. columnImage: false,
  826. columnSortable: false,
  827. sortLv: 0,
  828. status: true,
  829. fixed: '',
  830. }
  831. ],
  832. columnSubDetailList: [
  833. {
  834. userId: this.$store.state.user.name,
  835. functionId: 104002,
  836. serialNumber: '104002Table2ComponentPart',
  837. tableId: '104002Table2',
  838. tableName: 'BOM子物料表',
  839. columnProp: 'componentPart',
  840. headerAlign: 'center',
  841. align: 'center',
  842. columnLabel: '物料编码',
  843. columnHidden: false,
  844. columnImage: false,
  845. columnSortable: false,
  846. sortLv: 0,
  847. status: true,
  848. fixed: '',
  849. columnWidth: 120
  850. },
  851. {
  852. userId: this.$store.state.user.name,
  853. functionId: 104002,
  854. serialNumber: '104002Table2ComponentPartDesc',
  855. tableId: '104002Table2',
  856. tableName: 'BOM子物料表',
  857. columnProp: 'componentPartDesc',
  858. headerAlign: 'center',
  859. align: 'left',
  860. columnLabel: '物料名称',
  861. columnHidden: false,
  862. columnImage: false,
  863. columnSortable: false,
  864. sortLv: 0,
  865. status: true,
  866. fixed: '',
  867. columnWidth: 120
  868. },
  869. {
  870. userId: this.$store.state.user.name,
  871. functionId: 104002,
  872. serialNumber: '104002Table2QtyPerAssembly',
  873. tableId: '104002Table2',
  874. tableName: 'BOM子物料表',
  875. columnProp: 'qtyPerAssembly',
  876. headerAlign: 'center',
  877. align: 'right',
  878. columnLabel: '单位用量',
  879. columnHidden: false,
  880. columnImage: false,
  881. columnSortable: false,
  882. sortLv: 0,
  883. status: true,
  884. fixed: '',
  885. columnWidth: 80
  886. },
  887. {
  888. userId: this.$store.state.user.name,
  889. functionId: 104002,
  890. serialNumber: '104002Table2ComponentScrap',
  891. tableId: '104002Table2',
  892. tableName: 'BOM子物料表',
  893. columnProp: 'componentScrap',
  894. headerAlign: 'center',
  895. align: 'right',
  896. columnLabel: '调机量',
  897. columnHidden: false,
  898. columnImage: false,
  899. columnSortable: false,
  900. sortLv: 0,
  901. status: true,
  902. fixed: '',
  903. columnWidth: 80
  904. },
  905. {
  906. userId: this.$store.state.user.name,
  907. functionId: 104002,
  908. serialNumber: '104002Table2ShrinkageFactor',
  909. tableId: '104002Table2',
  910. tableName: 'BOM子物料表',
  911. columnProp: 'shrinkageFactor',
  912. headerAlign: 'center',
  913. align: 'right',
  914. columnLabel: '损耗率',
  915. columnHidden: false,
  916. columnImage: false,
  917. columnSortable: false,
  918. sortLv: 0,
  919. status: true,
  920. fixed: '',
  921. columnWidth: 80
  922. },
  923. {
  924. userId: this.$store.state.user.name,
  925. functionId: 104002,
  926. serialNumber: '104002Table2PrintUnitName',
  927. tableId: '104002Table2',
  928. tableName: 'BOM子物料表',
  929. columnProp: 'printUnitName',
  930. headerAlign: 'center',
  931. align: 'center',
  932. columnLabel: '单位',
  933. columnHidden: false,
  934. columnImage: false,
  935. columnSortable: false,
  936. sortLv: 0,
  937. status: true,
  938. fixed: '',
  939. columnWidth: 60
  940. },
  941. {
  942. userId: this.$store.state.user.name,
  943. functionId: 104002,
  944. serialNumber: '104002Table2IssueType',
  945. tableId: '104002Table2',
  946. tableName: 'BOM子物料表',
  947. columnProp: 'issueTypeName',
  948. headerAlign: 'center',
  949. align: 'center',
  950. columnLabel: '生产属性',
  951. columnHidden: false,
  952. columnImage: false,
  953. columnSortable: false,
  954. sortLv: 0,
  955. status: true,
  956. fixed: '',
  957. columnWidth: 80
  958. },
  959. {
  960. userId: this.$store.state.user.name,
  961. functionId: 104002,
  962. serialNumber: '104002Table2OperationDesc',
  963. tableId: '104002Table2',
  964. tableName: 'BOM子物料表',
  965. columnProp: 'operationNo',
  966. headerAlign: 'center',
  967. align: 'left',
  968. columnLabel: '工序',
  969. columnHidden: false,
  970. columnImage: false,
  971. columnSortable: false,
  972. sortLv: 0,
  973. status: true,
  974. fixed: '',
  975. columnWidth: 80
  976. },
  977. {
  978. userId: this.$store.state.user.name,
  979. functionId: 104002,
  980. serialNumber: '104002Table2IssueToLoc',
  981. tableId: '104002Table2',
  982. tableName: 'BOM子物料表',
  983. columnProp: 'issueToLocName',
  984. headerAlign: 'center',
  985. align: 'center',
  986. columnLabel: '发料库位',
  987. columnHidden: false,
  988. columnImage: false,
  989. columnSortable: false,
  990. sortLv: 0,
  991. status: true,
  992. fixed: '',
  993. columnWidth: 80
  994. },
  995. {
  996. userId: this.$store.state.user.name,
  997. functionId: 104002,
  998. serialNumber: '104002Table2NoteText',
  999. tableId: '104002Table2',
  1000. tableName: 'BOM子物料表',
  1001. columnProp: 'componentNoteText',
  1002. headerAlign: 'center',
  1003. align: 'left',
  1004. columnLabel: '备注',
  1005. columnHidden: false,
  1006. columnImage: false,
  1007. columnSortable: false,
  1008. sortLv: 0,
  1009. status: true,
  1010. fixed: '',
  1011. columnWidth: 150
  1012. },
  1013. ],
  1014. // ======== 必填规则 ========
  1015. rules: {
  1016. partNo: [
  1017. {
  1018. required: true,
  1019. message: ' ',
  1020. trigger: 'change'
  1021. }
  1022. ],
  1023. partDesc: [
  1024. {
  1025. required: true,
  1026. message: ' ',
  1027. trigger: 'change'
  1028. }
  1029. ],
  1030. bomType: [
  1031. {
  1032. required: true,
  1033. message: ' ',
  1034. trigger: 'change'
  1035. }
  1036. ],
  1037. effPhaseInDate: [
  1038. {
  1039. required: true,
  1040. message: ' ',
  1041. trigger: 'change'
  1042. }
  1043. ],
  1044. effPhaseOutDate: [
  1045. {
  1046. required: true,
  1047. message: ' ',
  1048. trigger: 'change'
  1049. }
  1050. ],
  1051. engChgLevel: [
  1052. {
  1053. required: true,
  1054. message: ' ',
  1055. trigger: 'change'
  1056. }
  1057. ],
  1058. alternativeNo: [
  1059. {
  1060. required: true,
  1061. message: ' ',
  1062. trigger: 'change'
  1063. }
  1064. ]
  1065. },
  1066. detailRules: {
  1067. alternativeNo: [
  1068. {
  1069. required: true,
  1070. message: ' ',
  1071. trigger: 'change'
  1072. }
  1073. ],
  1074. alternativeDescription: [
  1075. {
  1076. required: true,
  1077. message: ' ',
  1078. trigger: 'change'
  1079. }
  1080. ],
  1081. minLotQty: [
  1082. {
  1083. required: true,
  1084. message: ' ',
  1085. trigger: 'change'
  1086. }
  1087. ],
  1088. },
  1089. componentRules: {
  1090. componentPart: [
  1091. {
  1092. required: true,
  1093. message: ' ',
  1094. trigger: 'change'
  1095. }
  1096. ],
  1097. componentPartDesc: [
  1098. {
  1099. required: true,
  1100. message: ' ',
  1101. trigger: 'change'
  1102. }
  1103. ],
  1104. qtyPerAssembly: [
  1105. {
  1106. required: true,
  1107. message: ' ',
  1108. trigger: 'change'
  1109. }
  1110. ],
  1111. componentScrap: [
  1112. {
  1113. required: true,
  1114. message: ' ',
  1115. trigger: 'change'
  1116. }
  1117. ],
  1118. shrinkageFactor: [
  1119. {
  1120. required: true,
  1121. message: ' ',
  1122. trigger: 'change'
  1123. }
  1124. ],
  1125. issueType: [
  1126. {
  1127. required: true,
  1128. message: ' ',
  1129. trigger: 'change'
  1130. }
  1131. ]
  1132. },
  1133. // ======== 复选数据集 ========
  1134. bomSelections: [],
  1135. // ======== 模态框开关控制 ========
  1136. modalFlag: false,
  1137. modalDisableFlag: false,
  1138. partModelFlag: false,
  1139. componentPartModelFlag: false,
  1140. saveDetailModalFlag :false,
  1141. componentSaveModal: false,
  1142. componentDisableFlag: false
  1143. }
  1144. },
  1145. mounted () {
  1146. this.$nextTick(() => {
  1147. this.height = window.innerHeight - 180
  1148. })
  1149. },
  1150. created () {
  1151. this.getDataList()
  1152. },
  1153. // js
  1154. methods: {
  1155. // ======== 分页相关方法 ========
  1156. /**
  1157. * 每页数
  1158. * @param val
  1159. */
  1160. sizeChangeHandle (val) {
  1161. this.pageSize = val
  1162. this.pageIndex = 1
  1163. this.getDataList()
  1164. },
  1165. /**
  1166. * 当前页
  1167. * @param val
  1168. */
  1169. currentChangeHandle (val) {
  1170. this.pageIndex = val
  1171. this.getDataList()
  1172. },
  1173. // ======== 页签切换相关方法 ========
  1174. /**
  1175. * 明细页签选择替换
  1176. * @param tab
  1177. * @param event
  1178. */
  1179. tabDetailClick (tab, event) {
  1180. // 刷新列表数据
  1181. this.refreshDetailTable()
  1182. },
  1183. /**
  1184. * 子明细页签选择替换
  1185. * @param tab
  1186. * @param event
  1187. */
  1188. tabSubDetailClick (tab, event) {
  1189. // 刷新列表数据
  1190. this.refreshSubDetailTable()
  1191. },
  1192. /**
  1193. * 刷新明细页签的table数据
  1194. */
  1195. refreshDetailTable () {
  1196. if (this.detailTable === 'bom_detail') {
  1197. }
  1198. },
  1199. /**
  1200. * 刷新子明细页签的table数据
  1201. */
  1202. refreshSubDetailTable () {
  1203. if (this.subDetailTable === 'bom_sub_detail') {
  1204. }
  1205. },
  1206. // ======== 列表数据操作方法 ========
  1207. /**
  1208. * 未知
  1209. * @returns {boolean}
  1210. */
  1211. selectFlag () {
  1212. return true
  1213. },
  1214. /**
  1215. * 获取数据列表
  1216. */
  1217. getDataList () {
  1218. this.searchData.limit = this.pageSize
  1219. this.searchData.page = this.pageIndex
  1220. this.queryLoading = true
  1221. bomManagementSearch(this.searchData).then(({data}) => {
  1222. if (data.code === 0) {
  1223. this.dataList = data.page.list
  1224. this.pageIndex = data.page.currPage
  1225. this.pageSize = data.page.pageSize
  1226. this.totalPage = data.page.totalCount
  1227. this.$refs.selectDiv.setLengthAll( this.dataList.length)
  1228. }
  1229. this.queryLoading = false
  1230. })
  1231. },
  1232. /**
  1233. * 复选列表信息
  1234. * @param val
  1235. */
  1236. selectionBom (val) {
  1237. this.bomSelections = val
  1238. this.$refs.selectDiv.setLengthselected(this.bomSelections.length)
  1239. },
  1240. // ======== 新增/编辑模态框 ========
  1241. /**
  1242. * bom新增模态框
  1243. */
  1244. addModal () {
  1245. this.modalData = {
  1246. flag: '1',
  1247. title: 'bom新增',
  1248. site: this.$store.state.user.site,
  1249. partNo: '',
  1250. partDesc: '',
  1251. engChgLevel: '',
  1252. bomType: 'manufacturing',
  1253. noteText: '',
  1254. effPhaseInDate: new Date(+ new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''),
  1255. effPhaseOutDate: '',
  1256. engRevision: '',
  1257. typeFlag: 'B',
  1258. netWeight: 0,
  1259. createBy: this.$store.state.user.name
  1260. }
  1261. this.detailData = {
  1262. site: this.$store.state.user.site,
  1263. partNo: '',
  1264. engChgLevel: '',
  1265. bomType: '',
  1266. alternativeNo: '',
  1267. alternativeDescription: '',
  1268. minLotQty: '',
  1269. defaultFlag: '',
  1270. detailNoteText: '',
  1271. createDate: '',
  1272. createBy: '',
  1273. updateDate: '',
  1274. updateBy: ''
  1275. }
  1276. this.subDetailList = []
  1277. this.modalDisableFlag = false
  1278. this.modalFlag = true
  1279. },
  1280. /**
  1281. * bom编辑模态框
  1282. */
  1283. async updateModal (row) {
  1284. this.modalData = {
  1285. flag: '2',
  1286. site: row.site,
  1287. partNo: row.partNo,
  1288. partDesc: row.partDesc,
  1289. engChgLevel: row.engChgLevel,
  1290. bomType: row.bomType,
  1291. noteText: row.noteText,
  1292. effPhaseInDate: row.effPhaseInDate,
  1293. effPhaseOutDate: row.effPhaseOutDate,
  1294. engRevision: row.engRevision,
  1295. typeFlag: row.typeFlag,
  1296. netWeight: row.netWeight,
  1297. updateBy: this.$store.state.user.name
  1298. }
  1299. // 查bom明细
  1300. queryBomDetail(this.modalData).then(({data}) => {
  1301. if (data && data.code === 0) {
  1302. this.detailDataList = data.rows.detailList
  1303. this.subDetailList = data.rows.componentList
  1304. this.detailData = data.rows.detailData
  1305. this.modalDisableFlag = true
  1306. this.modalFlag = true
  1307. } else {
  1308. this.$alert(data.msg, '错误', {
  1309. confirmButtonText: '确定'
  1310. })
  1311. }
  1312. })
  1313. },
  1314. /**
  1315. * 新增子明细
  1316. */
  1317. saveComponentModal () {
  1318. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1319. this.$message.warning('请先选择替代!')
  1320. return
  1321. }
  1322. this.componentData = {
  1323. flag: '1',
  1324. site: this.$store.state.user.site,
  1325. partNo: this.modalData.partNo,
  1326. engChgLevel: this.modalData.engChgLevel,
  1327. bomType: this.modalData.bomType,
  1328. alternativeNo: this.detailData.alternativeNo,
  1329. componentPart: '',
  1330. componentPartDesc: '',
  1331. printUnit: '',
  1332. printUnitName: '',
  1333. qtyPerAssembly: 0,
  1334. componentScrap: 0,
  1335. issueType: '',
  1336. shrinkageFactor: 0,
  1337. lineItemNo: '',
  1338. operationNo: '',
  1339. operationName: '',
  1340. issueToLoc: '',
  1341. issueToLocName: '',
  1342. noteText: '',
  1343. createBy: this.$store.state.user.name,
  1344. }
  1345. this.componentDisableFlag = false
  1346. this.componentSaveModal = true
  1347. },
  1348. /**
  1349. * 编辑模态框
  1350. */
  1351. updateComponentModal (row) {
  1352. this.componentData = {
  1353. flag: '2',
  1354. site: row.site,
  1355. partNo: row.partNo,
  1356. engChgLevel: row.engChgLevel,
  1357. bomType: row.bomType,
  1358. alternativeNo: row.alternativeNo,
  1359. componentPart: row.componentPart,
  1360. componentPartDesc: row.componentPartDesc,
  1361. printUnit: row.printUnit,
  1362. printUnitName: row.printUnitName,
  1363. qtyPerAssembly: row.qtyPerAssembly,
  1364. componentScrap: row.componentScrap,
  1365. issueType: row.issueType,
  1366. shrinkageFactor: row.shrinkageFactor,
  1367. lineItemNo: row.lineItemNo,
  1368. operationNo: row.operationNo,
  1369. operationName: row.operationName,
  1370. issueToLoc: row.issueToLoc,
  1371. issueToLocName: row.issueToLocName,
  1372. noteText: row.noteText,
  1373. updateBy: this.$store.state.user.name,
  1374. }
  1375. this.componentDisableFlag = true
  1376. this.componentSaveModal = true
  1377. },
  1378. // ======== 新增/编辑/删除方法 ========
  1379. /**
  1380. * bom新增/编辑
  1381. */
  1382. saveData () {
  1383. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1384. this.$message.warning('请选择物料编码!')
  1385. return
  1386. }
  1387. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  1388. this.$message.warning('请选择物料名称!')
  1389. return
  1390. }
  1391. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1392. this.$message.warning('请选择制造类型!')
  1393. return
  1394. }
  1395. if (this.modalData.effPhaseInDate === '' || this.modalData.effPhaseInDate == null) {
  1396. this.$message.warning('请选择开始时间!')
  1397. return
  1398. }
  1399. if (this.modalData.effPhaseOutDate === '' || this.modalData.effPhaseOutDate == null) {
  1400. this.$message.warning('请选择结束时间!')
  1401. return
  1402. }
  1403. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1404. this.$message.warning('请填写BOM版本号!')
  1405. return
  1406. }
  1407. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1408. this.$message.warning('请选择替代!')
  1409. return
  1410. }
  1411. let tempData = {
  1412. site: this.$store.state.user.site,
  1413. partNo: this.modalData.partNo,
  1414. partDesc: this.modalData.partDesc,
  1415. engChgLevel: this.modalData.engChgLevel,
  1416. bomType: this.modalData.bomType,
  1417. noteText: this.modalData.noteText,
  1418. effPhaseInDate: this.modalData.effPhaseInDate,
  1419. effPhaseOutDate: this.modalData.effPhaseOutDate,
  1420. engRevision: this.modalData.engRevision,
  1421. typeFlag: this.modalData.typeFlag,
  1422. netWeight: this.modalData.netWeight,
  1423. alternativeNo: this.detailData.alternativeNo,
  1424. alternativeDescription: this.detailData.alternativeDescription,
  1425. minLotQty: this.detailData.minLotQty,
  1426. defaultFlag: this.detailData.defaultFlag,
  1427. detailNoteText: this.detailData.detailNoteText,
  1428. createBy: this.$store.state.user.name,
  1429. updateBy: this.$store.state.user.name,
  1430. informationList: this.subDetailList
  1431. }
  1432. if (this.modalData.flag === '1') {
  1433. this.saveAllLoading = true
  1434. bomManagementSave(tempData).then(({data}) => {
  1435. if (data && data.code === 0) {
  1436. this.getDataList()
  1437. this.modalFlag = false
  1438. this.$message({
  1439. message: '操作成功',
  1440. type: 'success',
  1441. duration: 1500,
  1442. onClose: () => {}
  1443. })
  1444. } else {
  1445. this.$alert(data.msg, '错误', {
  1446. confirmButtonText: '确定'
  1447. })
  1448. }
  1449. this.saveAllLoading = false
  1450. })
  1451. } else {
  1452. this.saveAllLoading = true
  1453. bomManagementEdit(tempData).then(({data}) => {
  1454. if (data && data.code === 0) {
  1455. this.getDataList()
  1456. this.modalFlag = false
  1457. this.$message({
  1458. message: '操作成功',
  1459. type: 'success',
  1460. duration: 1500,
  1461. onClose: () => {}
  1462. })
  1463. } else {
  1464. this.$alert(data.msg, '错误', {
  1465. confirmButtonText: '确定'
  1466. })
  1467. }
  1468. this.saveAllLoading = false
  1469. })
  1470. }
  1471. },
  1472. /**
  1473. * 新增编辑模态框关闭
  1474. */
  1475. closeModal () {
  1476. let tempArr = []
  1477. tempArr.push(this.modalData)
  1478. if (this.modalData.flag === '1') {
  1479. this.$confirm(`是否不保存且删除该条BOM记录?`, '提示', {
  1480. confirmButtonText: '确定',
  1481. cancelButtonText: '取消',
  1482. type: 'warning'
  1483. }).then(() => {
  1484. let tempData = {
  1485. informationList: tempArr
  1486. }
  1487. bomManagementDelete(tempData).then(({data}) => {
  1488. if (data && data.code === 0) {
  1489. this.getDataList()
  1490. this.modalFlag = false
  1491. this.$message({
  1492. message: '操作成功',
  1493. type: 'success',
  1494. duration: 1500,
  1495. onClose: () => {}
  1496. })
  1497. } else {
  1498. this.$alert(data.msg, '错误', {
  1499. confirmButtonText: '确定'
  1500. })
  1501. }
  1502. })
  1503. }).catch(() => {
  1504. })
  1505. } else {
  1506. this.modalFlag = false
  1507. }
  1508. },
  1509. /**
  1510. * 新增编辑模态框关闭
  1511. */
  1512. closeModalX (done) {
  1513. let tempArr = []
  1514. tempArr.push(this.modalData)
  1515. if (this.modalData.flag === '1') {
  1516. this.$confirm(`是否不保存且删除该条BOM记录?`, '提示', {
  1517. confirmButtonText: '确定',
  1518. cancelButtonText: '取消',
  1519. type: 'warning'
  1520. }).then(() => {
  1521. let tempData = {
  1522. informationList: tempArr
  1523. }
  1524. bomManagementDelete(tempData).then(({data}) => {
  1525. if (data && data.code === 0) {
  1526. this.getDataList()
  1527. done()
  1528. this.$message({
  1529. message: '操作成功',
  1530. type: 'success',
  1531. duration: 1500,
  1532. onClose: () => {}
  1533. })
  1534. } else {
  1535. this.$alert(data.msg, '错误', {
  1536. confirmButtonText: '确定'
  1537. })
  1538. }
  1539. })
  1540. }).catch(() => {
  1541. })
  1542. } else {
  1543. done()
  1544. }
  1545. },
  1546. /**
  1547. * bom删除
  1548. */
  1549. delModal () {
  1550. if(this.bomSelections.length === 0){
  1551. this.$message.warning('请勾选要删除的BOM!')
  1552. return
  1553. }
  1554. this.$confirm(`是否删除这 `+ this.bomSelections.length +` 条BOM?`, '提示', {
  1555. confirmButtonText: '确定',
  1556. cancelButtonText: '取消',
  1557. type: 'warning'
  1558. }).then(() => {
  1559. let tempData = {
  1560. informationList: this.bomSelections
  1561. }
  1562. bomManagementDelete(tempData).then(({data}) => {
  1563. if (data && data.code === 0) {
  1564. this.getDataList()
  1565. this.bomSelections = []
  1566. this.$message({
  1567. message: '操作成功',
  1568. type: 'success',
  1569. duration: 1500,
  1570. onClose: () => {}
  1571. })
  1572. } else {
  1573. this.$alert(data.msg, '错误', {
  1574. confirmButtonText: '确定'
  1575. })
  1576. }
  1577. })
  1578. }).catch(() => {
  1579. })
  1580. },
  1581. /**
  1582. * 查询物料
  1583. */
  1584. queryPartList () {
  1585. queryPartList(this.partData).then(({data}) => {
  1586. if (data && data.code === 0) {
  1587. this.partList = data.rows
  1588. this.partModelFlag = true
  1589. } else {
  1590. this.$alert(data.msg, '错误', {
  1591. confirmButtonText: '确定'
  1592. })
  1593. }
  1594. })
  1595. },
  1596. /**
  1597. * 双击选中物料
  1598. * @param row
  1599. */
  1600. getRowData (row) {
  1601. this.modalData.partNo = row.partNo
  1602. this.modalData.partDesc = row.partDesc
  1603. this.partModelFlag = false
  1604. },
  1605. getComponentRowData (row) {
  1606. this.componentData.componentPart = row.partNo
  1607. this.componentData.componentPartDesc = row.partDesc
  1608. this.componentData.printUnit = row.printUnit
  1609. this.componentData.printUnitName = row.printUnitName
  1610. this.componentPartModelFlag = false
  1611. },
  1612. /**
  1613. * 物料列表
  1614. */
  1615. queryComponentPartList () {
  1616. // 查询所有物料
  1617. queryPartList(this.componentPartData).then(({data}) => {
  1618. if (data && data.code === 0) {
  1619. this.componentPartList = data.rows
  1620. this.componentPartModelFlag = true
  1621. } else {
  1622. this.$alert(data.msg, '错误', {
  1623. confirmButtonText: '确定'
  1624. })
  1625. }
  1626. })
  1627. },
  1628. /**
  1629. * 表格的新增
  1630. * @param row
  1631. * @param rowIndex
  1632. */
  1633. rowClassName({ row, rowIndex }) {
  1634. row.xh = rowIndex + 1;
  1635. },
  1636. /**
  1637. * 单选框选中数据
  1638. * @param selection
  1639. */
  1640. componentSelectionChange(selection) {
  1641. this.checkedDetail = selection
  1642. },
  1643. /**
  1644. * 删除子物料
  1645. */
  1646. deleteComponentPart () {
  1647. if (this.checkedDetail.length === 0) {
  1648. this.$message.warning('请选择要删除子物料!')
  1649. return
  1650. } else {
  1651. this.$confirm("请是否确认删除该子明细记录?", "提示", {
  1652. confirmButtonText: "确定",
  1653. cancelButtonText: "取消",
  1654. type: "warning"
  1655. }).then(() => {
  1656. let tempData = {
  1657. informationList: this.checkedDetail
  1658. }
  1659. deleteBomComponent(tempData).then(({data}) => {
  1660. if (data && data.code === 0) {
  1661. this.subDetailList = data.rows
  1662. this.$message({
  1663. message: '操作成功',
  1664. type: 'success',
  1665. duration: 1500,
  1666. onClose: () => {}
  1667. })
  1668. } else {
  1669. this.$alert(data.msg, '错误', {
  1670. confirmButtonText: '确定'
  1671. })
  1672. }
  1673. })
  1674. }).catch(() => {
  1675. })
  1676. }
  1677. },
  1678. /**
  1679. * 子物料
  1680. * @param row
  1681. */
  1682. // componentPartClickRow (row) {
  1683. // this.$refs.componentPartTable.toggleRowSelection(row)
  1684. // },
  1685. componentClickRow (row) {
  1686. this.$refs.componentTable.toggleRowSelection(row)
  1687. },
  1688. // /**
  1689. // * 多选子物料
  1690. // * @param val
  1691. // */
  1692. // selectionComponentPart (val) {
  1693. // this.componentPartSelections = val
  1694. // },
  1695. // getRowKeys(row) {
  1696. // // 唯一值,一般都为id
  1697. // return row.partNo
  1698. // },
  1699. /**
  1700. * 新增子明细方法
  1701. */
  1702. componentDataSave () {
  1703. if (this.componentData.partNo === '' || this.componentData.partNo == null) {
  1704. this.$message.warning('请选择主记录物料编码!')
  1705. return
  1706. }
  1707. if (this.componentData.bomType === '' || this.componentData.bomType == null) {
  1708. this.$message.warning('请选择主记录制造类型!')
  1709. return
  1710. }
  1711. if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
  1712. this.$message.warning('请填写主记录BOM版本号!')
  1713. return
  1714. }
  1715. if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
  1716. this.$message.warning('请选择子物料编码!')
  1717. return
  1718. }
  1719. if (this.componentData.componentPartDesc === '' || this.componentData.componentPartDesc == null) {
  1720. this.$message.warning('请选择子物料名称!')
  1721. return
  1722. }
  1723. if (this.componentData.qtyPerAssembly === '' || this.componentData.qtyPerAssembly == null) {
  1724. this.$message.warning('请填写单位用量!')
  1725. return
  1726. }
  1727. if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
  1728. this.$message.warning('请填写调机量!')
  1729. return
  1730. }
  1731. if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
  1732. this.$message.warning('请填写损耗率!')
  1733. return
  1734. }
  1735. if (this.componentData.issueType === '' || this.componentData.issueType == null) {
  1736. this.$message.warning('请选择生产属性!')
  1737. return
  1738. }
  1739. if (this.componentData.flag === '1') {
  1740. this.saveComponentLoading = true
  1741. saveBomComponent(this.componentData).then(({data}) => {
  1742. if (data && data.code === 0) {
  1743. this.subDetailList = data.rows
  1744. this.componentSaveModal = false
  1745. this.$message({
  1746. message: '操作成功',
  1747. type: 'success',
  1748. duration: 1500,
  1749. onClose: () => {}
  1750. })
  1751. } else {
  1752. this.$alert(data.msg, '错误', {
  1753. confirmButtonText: '确定'
  1754. })
  1755. }
  1756. this.saveComponentLoading = false
  1757. })
  1758. } else if (this.componentData.flag === '2') {
  1759. this.saveComponentLoading = true
  1760. updateBomComponent(this.componentData).then(({data}) => {
  1761. if (data && data.code === 0) {
  1762. this.subDetailList = data.rows
  1763. this.componentSaveModal = false
  1764. this.$message({
  1765. message: '操作成功',
  1766. type: 'success',
  1767. duration: 1500,
  1768. onClose: () => {}
  1769. })
  1770. } else {
  1771. this.$alert(data.msg, '错误', {
  1772. confirmButtonText: '确定'
  1773. })
  1774. }
  1775. this.saveComponentLoading = false
  1776. })
  1777. }
  1778. },
  1779. /**
  1780. * 回车事件
  1781. */
  1782. focusNextInput (index, type) {
  1783. let aaa = ''
  1784. if (this.subDetailList.length - 1 === index) {
  1785. aaa = `${type}0`
  1786. } else {
  1787. aaa = `${type}${index + 1}`
  1788. }
  1789. this.$nextTick(() => {
  1790. this.$refs[aaa].focus()
  1791. })
  1792. },
  1793. /**
  1794. * 保存主表信息
  1795. */
  1796. saveBomHeader () {
  1797. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1798. this.$message.warning('请先选择Bom物料!')
  1799. return
  1800. }
  1801. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1802. this.$message.warning('请先填写Bom版本号!')
  1803. return
  1804. }
  1805. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1806. this.$message.warning('请先选择制造类型!')
  1807. return
  1808. }
  1809. if (this.modalData.typeFlag === '' || this.modalData.typeFlag == null) {
  1810. this.$message.warning('请先选择类型!')
  1811. return
  1812. }
  1813. this.saveHeaderLoading = true
  1814. // 新增主表信息
  1815. saveBomHeader(this.modalData).then(({data}) => {
  1816. if (data && data.code === 0) {
  1817. this.modalData = {
  1818. flag: '1',
  1819. title: 'bom新增',
  1820. site: data.rows.modalData.site,
  1821. partNo: data.rows.modalData.partNo,
  1822. partDesc: data.rows.modalData.partDesc,
  1823. engChgLevel: data.rows.modalData.engChgLevel,
  1824. bomType: data.rows.modalData.bomType,
  1825. noteText: data.rows.modalData.noteText,
  1826. effPhaseInDate: data.rows.modalData.effPhaseInDate,
  1827. effPhaseOutDate: data.rows.modalData.effPhaseOutDate,
  1828. engRevision: data.rows.modalData.engRevision,
  1829. typeFlag: data.rows.modalData.typeFlag,
  1830. netWeight: data.rows.modalData.netWeight,
  1831. }
  1832. this.detailDataList = data.rows.detailDataList
  1833. this.detailData = data.rows.detailData
  1834. this.subDetailList = []
  1835. this.modalDisableFlag = true
  1836. this.$message({
  1837. message: '操作成功',
  1838. type: 'success',
  1839. duration: 1500,
  1840. onClose: () => {}
  1841. })
  1842. } else {
  1843. this.$alert(data.msg, '错误', {
  1844. confirmButtonText: '确定'
  1845. })
  1846. }
  1847. this.saveHeaderLoading = false
  1848. })
  1849. },
  1850. /**
  1851. * 新增替代模态框
  1852. */
  1853. saveBomDetail () {
  1854. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1855. this.$message.warning('请先选择Bom物料!')
  1856. return
  1857. }
  1858. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1859. this.$message.warning('请先填写Bom版本号!')
  1860. return
  1861. }
  1862. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1863. this.$message.warning('请先选择制造类型!')
  1864. return
  1865. }
  1866. this.saveDetailData = {
  1867. site: this.$store.state.user.site,
  1868. partNo: this.modalData.partNo,
  1869. engChgLevel: this.modalData.engChgLevel,
  1870. bomType: this.modalData.bomType,
  1871. alternativeNo: '',
  1872. alternativeDescription: '',
  1873. minLotQty: 0,
  1874. defaultFlag: '',
  1875. detailNoteText: '',
  1876. createDate: '',
  1877. createBy: this.$store.state.user.name,
  1878. }
  1879. // 查询bom主信息
  1880. queryBomHeader(this.modalData).then(({data}) => {
  1881. if (data && data.code === 0) {
  1882. if (data.rows.length > 0) {
  1883. this.saveDetailModalFlag = true
  1884. } else {
  1885. this.$message.warning('请先保存BOM主记录!')
  1886. }
  1887. } else {
  1888. this.$alert(data.msg, '提示', {
  1889. confirmButtonText: '确定'
  1890. })
  1891. }
  1892. })
  1893. },
  1894. /**
  1895. * 新增替代方法
  1896. */
  1897. detailDataSave () {
  1898. if (this.saveDetailData.partNo === '' || this.saveDetailData.partNo == null) {
  1899. this.$message.warning('请先选择Bom物料!')
  1900. return
  1901. }
  1902. if (this.saveDetailData.engChgLevel === '' || this.saveDetailData.engChgLevel == null) {
  1903. this.$message.warning('请先填写Bom版本号!')
  1904. return
  1905. }
  1906. if (this.saveDetailData.bomType === '' || this.saveDetailData.bomType == null) {
  1907. this.$message.warning('请先选择制造类型!')
  1908. return
  1909. }
  1910. if (this.saveDetailData.alternativeNo === '' || this.saveDetailData.alternativeNo == null) {
  1911. this.$message.warning('请填写替代编码!')
  1912. return
  1913. }
  1914. if (this.saveDetailData.alternativeDescription === '' || this.saveDetailData.alternativeDescription == null) {
  1915. this.$message.warning('请填写替代名称!')
  1916. return
  1917. }
  1918. if (this.saveDetailData.minLotQty === '' || this.saveDetailData.minLotQty == null) {
  1919. this.$message.warning('请填写最小订单数!')
  1920. return
  1921. }
  1922. this.saveDetailLoading = true
  1923. bomDetailSave(this.saveDetailData).then(({data}) => {
  1924. if (data && data.code === 0) {
  1925. this.detailDataList = data.rows
  1926. this.detailData = this.saveDetailData
  1927. this.subDetailList = []
  1928. this.saveDetailModalFlag = false
  1929. this.$message({
  1930. message: '操作成功',
  1931. type: 'success',
  1932. duration: 1500,
  1933. onClose: () => {}
  1934. })
  1935. } else {
  1936. this.$alert(data.msg, '错误', {
  1937. confirmButtonText: '确定'
  1938. })
  1939. }
  1940. this.saveDetailLoading = false
  1941. })
  1942. },
  1943. /**
  1944. * 删除替代
  1945. */
  1946. deleteBomDetail () {
  1947. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1948. this.$message.warning('请选择要删除的替代编码!')
  1949. return
  1950. }
  1951. if (this.detailData.alternativeNo === '*') {
  1952. this.$message.warning('当前为默认替代,不可以删除!')
  1953. return
  1954. }
  1955. this.$confirm(`是否删除这项替代?`, '提示', {
  1956. confirmButtonText: '确定',
  1957. cancelButtonText: '取消',
  1958. type: 'warning'
  1959. }).then(() => {
  1960. bomDetailDelete(this.detailData).then(({data}) => {
  1961. if (data && data.code === 0) {
  1962. this.detailData = data.rows.detailData
  1963. this.detailDataList = data.rows.detailDataList
  1964. this.subDetailList = data.rows.subDetailList
  1965. this.$message({
  1966. message: '操作成功',
  1967. type: 'success',
  1968. duration: 1500,
  1969. onClose: () => {}
  1970. })
  1971. } else {
  1972. this.$alert(data.msg, '错误', {
  1973. confirmButtonText: '确定'
  1974. })
  1975. }
  1976. })
  1977. }).catch(() => {
  1978. })
  1979. },
  1980. /**
  1981. * 替代改变事件
  1982. */
  1983. alternativeChange () {
  1984. queryBomComponent(this.detailData).then(({data}) => {
  1985. if (data && data.code === 0) {
  1986. this.detailData = data.rows.detailData
  1987. this.subDetailList = data.rows.componentList
  1988. } else {
  1989. this.$alert(data.msg, '错误', {
  1990. confirmButtonText: '确定'
  1991. })
  1992. }
  1993. })
  1994. },
  1995. // ======= 正则校验 =======
  1996. handleInput (value, type) {
  1997. // 大于等于0,且只能输入4位小数
  1998. let val = value.replace(/^\D*([0-9]\d*\.?\d{0,4})?.*$/,'$1')
  1999. if (val == null || val == undefined || val == '') {
  2000. val = 0
  2001. }
  2002. if (type === 1) {
  2003. this.modalData.netWeight = val
  2004. } else if (type === 2) {
  2005. this.detailData.minLotQty = val
  2006. } else if (type === 3) {
  2007. this.saveDetailData.minLotQty = val
  2008. } else if (type === 4) {
  2009. this.componentData.qtyPerAssembly = val
  2010. } else if (type === 5) {
  2011. this.componentData.componentScrap = val
  2012. }
  2013. },
  2014. handleInputB (value) {
  2015. const reg = /^(([1-9]?\d{0,1}(\.\d{1,2})?)|100|100\.(0){1,2})$/
  2016. if (reg.test(value) === true) {
  2017. this.componentData.shrinkageFactor = value
  2018. } else if (value > 100) {
  2019. this.componentData.shrinkageFactor = 100
  2020. } else {
  2021. this.componentData.shrinkageFactor = 0
  2022. }
  2023. },
  2024. // ======== chooseList相关方法 ========
  2025. /**
  2026. * 获取基础数据列表S
  2027. * @param val
  2028. * @param type
  2029. */
  2030. getBaseList (val, type) {
  2031. this.tagNo = val
  2032. this.$nextTick(() => {
  2033. let strVal = ''
  2034. if (val === 117) {
  2035. strVal = this.componentData.issueToLoc
  2036. }
  2037. this.$refs.baseList.init(val, strVal)
  2038. })
  2039. },
  2040. /**
  2041. * 列表方法的回调
  2042. * @param val
  2043. */
  2044. getBaseData (val) {
  2045. if (this.tagNo === 117) {
  2046. this.componentData.issueToLoc = val.location_id
  2047. this.componentData.issueToLocName = val.location_name
  2048. }
  2049. },
  2050. // ======== 导出相关方法 ========
  2051. /**
  2052. * 导出excel
  2053. */
  2054. async createExportData () {
  2055. this.searchData.limit = -1
  2056. this.searchData.page = 1
  2057. await bomManagementSearch(this.searchData).then(({data}) => {
  2058. this.resultList = data.page.list
  2059. })
  2060. return this.resultList
  2061. },
  2062. startDownload () {
  2063. },
  2064. finishDownload () {
  2065. },
  2066. fields () {
  2067. let json = '{'
  2068. this.columnList.forEach((item, index) => {
  2069. if (index == this.columnList.length - 1) {
  2070. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  2071. } else {
  2072. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  2073. }
  2074. })
  2075. json += '}'
  2076. let s = eval('(' + json + ')')
  2077. return s
  2078. }
  2079. }
  2080. }
  2081. </script>
  2082. <style scoped lang="scss">
  2083. /deep/ .detail-tab .el-tabs__content {
  2084. height: 165px;
  2085. padding: 15px 0px 0px 0px;
  2086. }
  2087. /deep/ .sub_detail-tab .el-tabs__content {
  2088. height: 280px;
  2089. padding: 0px;
  2090. }
  2091. .numInput /deep/ .el-input__inner{
  2092. text-align: right;
  2093. }
  2094. </style>