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.

2181 lines
71 KiB

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