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.

3004 lines
102 KiB

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