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.

2544 lines
83 KiB

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