plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2361 lines
79 KiB

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