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.

2244 lines
73 KiB

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