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.

2430 lines
80 KiB

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