fankuang.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  1. <template>
  2. <div class="app-container" style="width: 100%;">
  3. <!--表格-->
  4. <el-table
  5. :data="tableData"
  6. ref="tableRef">
  7. <el-table-column prop="machineId" fixed :label="$t('planTable.machineNo')" header-align="center" align="center" width="111px" ></el-table-column>
  8. <el-table-column prop="productionDigit" fixed :label="$t('planTable.productionDigit')" header-align="center" align="center" width="111.2px"></el-table-column>
  9. <el-table-column :label="$t('planTable.inMachineProduct')" header-align="center" >
  10. <el-table-column prop="productTypeName" fixed :label="$t('planTable.productType')" header-align="center" align="center" width="111.2px"></el-table-column>
  11. <el-table-column prop="currentColorCode" :label="$t('planTable.colorNo')" header-align="center" width="90px" align="center"></el-table-column>
  12. <el-table-column prop="currentSpecification" :label="$t('planTable.specification')" header-align="center" width="90px" align="center"></el-table-column>
  13. <el-table-column prop="currentLotNumber" :label="$t('planTable.batchNo')" header-align="center" width="90px" align="center"></el-table-column>
  14. <el-table-column prop="number" :label="$t('planTable.quantity')" header-align="center" width="90px" align="center"></el-table-column>
  15. <el-table-column prop="startTime" :label="$t('planTable.startTime')" header-align="center" width="90px" align="center"></el-table-column>
  16. <el-table-column prop="plannedEndTime" :label="$t('planTable.endTime')" header-align="center" width="90px" align="center"></el-table-column>
  17. </el-table-column>
  18. <el-table-column prop="plannedProduction" :label="$t('planTable.pendingProductList')" header-align="center" align="center" >
  19. <template v-slot:default="scope">
  20. <div v-if="scope.row.plannedProduction && scope.row.plannedProduction.length > 0">
  21. <div v-for="(chunk, chunkIndex) in splitList(scope.row.plannedProduction, 5)" :key="`chunk-${chunkIndex}`">
  22. <span v-for="(item, index) in chunk" :key="`item-${chunkIndex}-${index}`">
  23. {{ item }}, <!-- 替换为实际显示每个产品的代码 -->
  24. </span>
  25. </div>
  26. </div>
  27. <div v-else>
  28. </div>
  29. </template>
  30. </el-table-column>
  31. <el-table-column fixed="right" :label="$t('planTable.operation')" header-align="center" align="center" width="150px" >
  32. <template v-slot:default="scope">
  33. <el-dropdown>
  34. <el-button type="primary">
  35. {{ $t('planTable.operation') }}
  36. <i class="el-icon-arrow-down el-icon--right"></i>
  37. </el-button>
  38. <el-dropdown-menu slot="dropdown">
  39. <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">{{ $t('planTable.addPlan') }}</el-dropdown-item>
  40. <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">{{ $t('planTable.editPlan') }}</el-dropdown-item>
  41. </el-dropdown-menu>
  42. </el-dropdown>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. <!--新增计划弹窗-->
  47. <el-dialog :title="$t('planTable.addPlanTitle')" :visible.sync="nanInsertDialogTableVisible" width="1500px">
  48. <el-table :data="tableData2" @row-click.self="handleRowClick">
  49. <el-table-column prop="productId" :label="$t('planTable.product')" header-align="center" align="center" width="150px">
  50. <template v-slot:default="scope">
  51. <el-select v-model="scope.row.productId" :placeholder="$t('planTable.selectProduct')" @change="selectedChangeDate(scope.row,scope.row.productId)">
  52. <el-option v-for="product in productsInfo" :key="product.id" :label="product.productName" :value="product.id" ></el-option>
  53. </el-select>
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="currentColorCode" :label="$t('planTable.colorNo')" header-align="center" align="center">
  57. <template v-slot:default="scope">
  58. <el-select v-model="scope.row.currentColorCode" filterable :placeholder="$t('planTable.selectColorCode')" @change="selectedML(scope.row)">
  59. <el-option
  60. v-for="(item,index) in options"
  61. :key="index"
  62. :label="item.label"
  63. :value="item.value">
  64. </el-option>
  65. </el-select>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="productionDigit" :label="$t('planTable.productionDigit')" header-align="center" align="center">
  69. <template v-slot:default="scope">
  70. <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" :placeholder="$t('planTable.inputSpindleCount')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  71. <span v-else>{{ scope.row.productionDigit }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="currentSpecification" :label="$t('planTable.specification')" header-align="center" align="center">
  75. <template v-slot:default="scope">
  76. <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" :placeholder="$t('planTable.inputSpecification')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  77. <span v-else>{{ scope.row.currentSpecification }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column prop="currentLotNumber" :label="$t('planTable.batchNo')" header-align="center" align="center">
  81. <template v-slot:default="scope">
  82. <el-input v-if="scope.row.isEditing" :disabled="isDisabled" v-model="scope.row.currentLotNumber" :placeholder="$t('planTable.inputBatchNo')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  83. <span v-else>{{ scope.row.currentLotNumber }}</span>
  84. </template>
  85. </el-table-column>
  86. <!-- 新增筒重、箱重、管色字段 -->
  87. <el-table-column
  88. prop="tubeweight"
  89. label="筒重"
  90. header-align="center"
  91. align="center"
  92. >
  93. <template v-slot:default="scope">
  94. <el-select
  95. v-model="scope.row.tubeweight"
  96. clearable
  97. filterable
  98. allow-create
  99. default-first-option
  100. >
  101. <el-option
  102. v-for="item in dropDownData.drum_weight"
  103. :key="item.id"
  104. :label="item.codeName"
  105. :value="item.codeName"
  106. >
  107. </el-option>
  108. </el-select>
  109. </template>
  110. </el-table-column>
  111. <el-table-column
  112. prop="boxweight"
  113. label="箱重"
  114. header-align="center"
  115. align="center"
  116. >
  117. <template v-slot:default="scope">
  118. <el-select
  119. v-model="scope.row.boxweight"
  120. clearable
  121. filterable
  122. allow-create
  123. default-first-option
  124. >
  125. <el-option
  126. v-for="item in dropDownData.box_weight"
  127. :key="item.id"
  128. :label="item.codeName"
  129. :value="item.codeName"
  130. >
  131. </el-option>
  132. </el-select>
  133. </template>
  134. </el-table-column>
  135. <el-table-column
  136. prop="tubecolor"
  137. label="管色"
  138. header-align="center"
  139. align="center"
  140. >
  141. <template v-slot:default="scope">
  142. <el-select
  143. v-model="scope.row.tubecolor"
  144. clearable
  145. filterable
  146. allow-create
  147. default-first-option
  148. >
  149. <el-option
  150. v-for="item in dropDownData.tube_color"
  151. :key="item.id"
  152. :label="item.codeName"
  153. :value="item.codeName"
  154. >
  155. </el-option>
  156. </el-select>
  157. </template>
  158. </el-table-column>
  159. <!-- 新增筒重、箱重、管色字段 -->
  160. <el-table-column prop="number" :label="$t('planTable.quantity')" header-align="center" align="center">
  161. <template v-slot:default="scope">
  162. <el-input v-if="scope.row.isEditing" v-model="scope.row.number" :placeholder="$t('planTable.inputQuantity')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  163. <span v-else>{{ scope.row.number }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column prop="startTime" :label="$t('planTable.startTime')" header-align="center" align="center">
  167. <template v-slot:default="scope">
  168. <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" :placeholder="$t('planTable.inputStartTime')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  169. <span v-else>{{ scope.row.startTime }}</span>
  170. </template>
  171. </el-table-column>
  172. <el-table-column prop="plannedEndTime" :label="$t('planTable.endTime')" header-align="center" align="center">
  173. <template v-slot:default="scope">
  174. <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" :placeholder="$t('planTable.inputEndTime')" @blur="handleInputBlur(scope.row)">></el-input>
  175. <span v-else>{{ scope.row.plannedEndTime }}</span>
  176. </template>
  177. </el-table-column>
  178. <el-table-column prop="planStatus" :label="$t('planTable.planStatus')" header-align="center" align="center" width="100px">
  179. <template v-slot:default="scope">
  180. <el-select v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')" >
  181. <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
  182. </el-select>
  183. </template>
  184. </el-table-column>
  185. <el-table-column :label="$t('planTable.operation')" align="center">
  186. <template slot-scope="scope">
  187. <el-button
  188. size="mini"
  189. type="danger"
  190. @click.stop.prevent="handleDelete(scope.$index, scope.row)">{{ $t('planTable.delete') }}</el-button>
  191. </template>
  192. </el-table-column>
  193. </el-table>
  194. <el-button type="primary" style="width: 100%;margin-top: 30px" @click="addEditableRow">{{ $t('planTable.addPlanProduct') }}</el-button>
  195. <span slot="footer" class="dialog-footer">
  196. <el-button @click="nanInsertDialogTableVisible = false">{{ $t('planTable.cancel') }}</el-button>
  197. <el-button type="primary" @click="addPlanInfo">{{ $t('planTable.confirm') }}</el-button>
  198. </span>
  199. </el-dialog>
  200. <!--修改计划弹窗-->
  201. <el-dialog :title="$t('planTable.editPlanTitle')" :visible.sync="nanUpdateDialogTableVisible" width="1500px">
  202. <!--查询条件-->
  203. <el-form ref="form" :model="formData" label-width="80px" :inline="true">
  204. <el-form-item :label="$t('planTable.planStatusLabel')">
  205. <el-select v-model="formData.planStatus" :placeholder="$t('planTable.planStatus')">
  206. <el-option v-for="stateListItem in stateList2" :key="stateListItem.id" :label="stateListItem.name" :value="stateListItem.id" ></el-option>
  207. </el-select>
  208. </el-form-item>
  209. <el-form-item>
  210. <el-button type="primary" @click="onSubmit">{{ $t('planTable.search') }}</el-button>
  211. <el-button @click="reset">{{ $t('planTable.reset') }}</el-button>
  212. </el-form-item>
  213. </el-form>
  214. <!--表格-->
  215. <el-table :data="tableData2" @row-click.self="handleRowClick">
  216. <el-table-column prop="productId" :label="$t('planTable.product')" header-align="center" align="center" width="150px">
  217. <template slot-scope="scope">
  218. {{ getProductChineseName(scope.row.productId) }}
  219. </template>
  220. </el-table-column>
  221. <el-table-column prop="productionDigit" :label="$t('planTable.productionDigit')" header-align="center" align="center">
  222. <template v-slot:default="scope">
  223. <el-input v-if="scope.row.isEditing" v-model="scope.row.productionDigit" :placeholder="$t('planTable.inputSpindleCount')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  224. <span v-else>{{ scope.row.productionDigit }}</span>
  225. </template>
  226. </el-table-column>
  227. <el-table-column prop="currentColorCode" :label="$t('planTable.colorNo')" header-align="center" align="center">
  228. <template v-slot:default="scope">
  229. <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentColorCode" :placeholder="$t('planTable.inputColorCode')" @blur.stop.prevent="handleInputBlur(scope.row)"></el-input>
  230. <span v-else>{{ scope.row.currentColorCode }}</span>
  231. </template>
  232. </el-table-column>
  233. <el-table-column prop="currentSpecification" :label="$t('planTable.specification')" header-align="center" align="center">
  234. <template v-slot:default="scope">
  235. <el-input v-if="scope.row.isEditing" disabled="disabled" v-model="scope.row.currentSpecification" :placeholder="$t('planTable.inputSpecification')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  236. <span v-else>{{ scope.row.currentSpecification }}</span>
  237. </template>
  238. </el-table-column>
  239. <el-table-column prop="currentLotNumber" :label="$t('planTable.batchNo')" header-align="center" align="center">
  240. <template v-slot:default="scope">
  241. <el-input v-if="scope.row.isEditing" v-model="scope.row.currentLotNumber" :placeholder="$t('planTable.inputBatchNo')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  242. <span v-else>{{ scope.row.currentLotNumber }}</span>
  243. </template>
  244. </el-table-column>
  245. <el-table-column prop="number" :label="$t('planTable.quantity')" header-align="center" align="center"/>
  246. <!-- 新增筒重、箱重、管色字段 -->
  247. <el-table-column
  248. prop="tubeweight"
  249. label="筒重"
  250. header-align="center"
  251. align="center"
  252. >
  253. <template v-slot:default="scope">
  254. <el-select
  255. v-model="scope.row.tubeweight"
  256. clearable
  257. filterable
  258. allow-create
  259. default-first-option
  260. >
  261. <el-option
  262. v-for="item in dropDownData.drum_weight"
  263. :key="item.id"
  264. :label="item.codeName"
  265. :value="item.codeName"
  266. >
  267. </el-option>
  268. </el-select>
  269. </template>
  270. </el-table-column>
  271. <el-table-column
  272. prop="boxweight"
  273. label="箱重"
  274. header-align="center"
  275. align="center"
  276. >
  277. <template v-slot:default="scope">
  278. <el-select
  279. v-model="scope.row.boxweight"
  280. clearable
  281. filterable
  282. allow-create
  283. default-first-option
  284. >
  285. <el-option
  286. v-for="item in dropDownData.box_weight"
  287. :key="item.id"
  288. :label="item.codeName"
  289. :value="item.codeName"
  290. >
  291. </el-option>
  292. </el-select>
  293. </template>
  294. </el-table-column>
  295. <el-table-column
  296. prop="tubecolor"
  297. label="管色"
  298. header-align="center"
  299. align="center"
  300. >
  301. <template v-slot:default="scope">
  302. <el-select
  303. v-model="scope.row.tubecolor"
  304. clearable
  305. filterable
  306. allow-create
  307. default-first-option
  308. >
  309. <el-option
  310. v-for="item in dropDownData.tube_color"
  311. :key="item.id"
  312. :label="item.codeName"
  313. :value="item.codeName"
  314. >
  315. </el-option>
  316. </el-select>
  317. </template>
  318. </el-table-column>
  319. <!-- 新增筒重、箱重、管色字段 -->
  320. <el-table-column prop="number" label="数量" header-align="center" align="center">
  321. <template v-slot:default="scope">
  322. <el-input v-if="scope.row.isEditing" v-model="scope.row.number" :placeholder="$t('planTable.inputQuantity')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  323. <span v-else>{{ scope.row.number }}</span>
  324. </template>
  325. </el-table-column>
  326. <el-table-column prop="startTime" :label="$t('planTable.startTime')" header-align="center" align="center">
  327. <template v-slot:default="scope">
  328. <el-input v-if="scope.row.isEditing" v-model="scope.row.startTime" :placeholder="$t('planTable.inputStartTime')" @blur.stop.prevent="handleInputBlur(scope.row)">></el-input>
  329. <span v-else>{{ scope.row.startTime }}</span>
  330. </template>
  331. </el-table-column>
  332. <el-table-column prop="plannedEndTime" :label="$t('planTable.endTime')" header-align="center" align="center">
  333. <template v-slot:default="scope">
  334. <el-input v-if="scope.row.isEditing" :ref="'input'+scope.$index" v-model="scope.row.plannedEndTime" :placeholder="$t('planTable.inputEndTime')" @blur="handleInputBlur(scope.row)">></el-input>
  335. <span v-else>{{ scope.row.plannedEndTime }}</span>
  336. </template>
  337. </el-table-column>
  338. <el-table-column prop="planStatus" :label="$t('planTable.planStatus')" header-align="center" align="center" width="100px">
  339. <template v-slot:default="scope">
  340. <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')">
  341. <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id"></el-option>
  342. </el-select>
  343. <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')">
  344. <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id"></el-option>
  345. </el-select>
  346. <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" :placeholder="$t('planTable.planStatus')">
  347. <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id"></el-option>
  348. </el-select>
  349. </template>
  350. </el-table-column>
  351. <el-table-column :label="$t('planTable.operation')" align="center" width="200px">
  352. <template v-slot:default="scope">
  353. <el-button
  354. size="mini"
  355. type="danger"
  356. @click.stop.prevent="updateStatus(scope.$index, scope.row,scope.row.planStatus)">{{ $t('planTable.confirmModify') }}</el-button>
  357. <el-button
  358. size="mini"
  359. type="danger"
  360. @click.stop.prevent="deletePlan(scope.$index, scope.row)">{{ $t('planTable.delete') }}</el-button>
  361. </template>
  362. </el-table-column>
  363. </el-table>
  364. <!--按钮信息-->
  365. <span slot="footer" class="dialog-footer">
  366. <el-button @click="nanUpdateDialogTableVisible = false">{{ $t('planTable.cancel') }}</el-button>
  367. <el-button type="primary" @click="nanUpdateDialogTableVisible = false">{{ $t('planTable.confirm') }}</el-button>
  368. </span>
  369. </el-dialog>
  370. </div>
  371. </template>
  372. <script>
  373. import {
  374. getProductsInfo,
  375. getProductsAll,
  376. getMaterielInfo,
  377. spinningFrameWinding,
  378. getSpinningPlanList,
  379. addSpinningPlanList,
  380. getPlanSpinningInfo,
  381. updateSpinningInfoPlanOne,
  382. getCurrentProductionLineSuperior,
  383. getIsTheOrderProductProduced,
  384. getOptionLsit
  385. } from "@/api/plan/paln.js";
  386. export default {
  387. data() {
  388. return {
  389. options: [],
  390. //
  391. isDisabled:true,
  392. //选中的是那个车间
  393. tableData:[],
  394. form: {
  395. product:"",
  396. },
  397. formzdsj:{machineToolNo: "", //机台编号
  398. // 表单参数
  399. packaging: "", //包装
  400. machineTool: "", //机台
  401. workShifts: "", //班次
  402. productionDate: "", //生产日期
  403. levels: "", //等级
  404. foreignTradeNumber: "", //外贸号
  405. canisterWeight: "", //筒重
  406. boxWeight: "", //箱重-车重
  407. canisterNum: "", //筒数
  408. tubeColor: "", //管色
  409. comPort: "", //端口
  410. printFormat: "", //格式
  411. grossWeight: 0, //毛重
  412. remark: "", //备注
  413. },
  414. dropDownData: {},
  415. previousMachineId: undefined,
  416. currentRowspan: 1,
  417. prevRow: {},
  418. tableData2: [],
  419. tableDataStatus: [],
  420. nanInsertDialogTableVisible:false,
  421. nanUpdateDialogTableVisible:false,
  422. beiInsertDialogTableVisible:false,
  423. beiUpdateDialogTableVisible:false,
  424. editingRowIndex: -1,
  425. lastEditLine:0,
  426. isEditLine:false,
  427. productsInfo:[],
  428. salesmanInfo:[],
  429. product:{},
  430. materiel:{},
  431. //机台号
  432. machineId:"",
  433. macId:"",
  434. // 待机/上机/停产
  435. stateList0:[
  436. {"id":0,"name":this.$t('planTable.standby')},
  437. {"id":1,"name":this.$t('planTable.inProduction')},
  438. ],
  439. stateList1:[
  440. {"id":0,"name":this.$t('planTable.standby')},
  441. {"id":2,"name":this.$t('planTable.stopped')},
  442. {"id":1,"name":this.$t('planTable.inProduction')},
  443. ],
  444. stateList2:[
  445. {"id":0,"name":this.$t('planTable.standby')},
  446. {"id":2,"name":this.$t('planTable.stopped')},
  447. {"id":1,"name":this.$t('planTable.inProduction')},
  448. ],
  449. formData:{
  450. updateSelectedProductCategory:"",
  451. updateSelectedProductState:""
  452. },
  453. }
  454. },
  455. mounted() {
  456. // 得到排产计划信息
  457. this.getSpinningPlanList();
  458. this.getSelectOptions();
  459. },
  460. methods: {
  461. selectedML(row){
  462. console.log(row.currentColorCode)
  463. if(row.currentColorCode){
  464. let tarName=this.options.find(item=>item.value==row.currentColorCode).colourNumber
  465. console.log("aaaaa=============",tarName)
  466. row.colourNumber=tarName;
  467. console.log("aaaaa=============",row)
  468. }
  469. },
  470. getProductChineseName(productId) {
  471. return this.productsInfo.find(product => product.id == productId).productName;
  472. },
  473. //修改计划里的删除计划
  474. deletePlan($index,row){
  475. console.log(row)
  476. getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
  477. //if(resp.data.length>0){
  478. // this.$message({message: '当前计划订单产品在生产中已经不能删除', type: 'warning'});
  479. // return;//证明有在上级的产品--zhi能有一个上级产品
  480. // }else {
  481. //没有开始生产可以删除
  482. spinningFrameWinding(row.id).then(res=>{
  483. if(res.code==200){
  484. this.$message({
  485. message: this.$t('planTable.deleteSuccess'),
  486. type: 'success'
  487. });
  488. }
  489. this.onSubmit();
  490. this.getSpinningPlanList();
  491. })
  492. // }
  493. });
  494. },
  495. // 待机产品合并(五个显示为一排)
  496. splitList(list, chunkSize) {
  497. const chunks = [];
  498. for (let i = 0; i < list.length; i += chunkSize) {
  499. chunks.push(list.slice(i, i + chunkSize));
  500. }
  501. return chunks;
  502. },
  503. // 查询排产信息
  504. getSpinningPlanList() {
  505. getSpinningPlanList({"productionLineDepartment": this.$t('planTable.spinningDepartment')}).then((response) => {
  506. this.tableData = response.rows
  507. });
  508. },
  509. // 新增计划是得到产品信息
  510. getProductsInfo() {
  511. getProductsInfo("FK-").then((response) => {
  512. this.productsInfo = response.data;
  513. this.productsInfo.forEach(item => {
  514. // item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
  515. item.productName = item.productName+"—"+item.colours;
  516. });
  517. })
  518. },
  519. // 获取下拉数据
  520. async getSelectOptions() {
  521. try {
  522. let res = await getOptionLsit();
  523. if (res.code == 200) {
  524. this.dropDownData = res.data || {};
  525. // 初始化默认值
  526. if (
  527. this.dropDownData.work_shifts?.length > 0 &&
  528. this.excuteType == 1
  529. ) {
  530. this.formzdsj.workShifts = this.dropDownData.work_shifts[0].codeName;
  531. }
  532. if (this.dropDownData.level?.length > 0 && this.excuteType == 1) {
  533. this.formzdsj.levels = this.dropDownData.level[0].codeName;
  534. }
  535. if (
  536. this.dropDownData.drum_weight?.length > 0 &&
  537. this.excuteType == 1
  538. ) {
  539. this.formzdsj.canisterWeight =
  540. this.dropDownData.drum_weight[0].codeName;
  541. }
  542. if (
  543. this.dropDownData.box_weight?.length > 0 &&
  544. this.excuteType == 1
  545. ) {
  546. this.formzdsj.boxWeight = this.dropDownData.box_weight[0].codeName;
  547. }
  548. if (
  549. this.dropDownData.tube_color?.length > 0 &&
  550. this.excuteType == 1
  551. ) {
  552. this.formzdsj.tubeColor = this.dropDownData.tube_color[0].codeName;
  553. }
  554. } else {
  555. this.$message.error("网络异常!");
  556. }
  557. } catch (error) {}
  558. },
  559. // 下拉框数据改变查询色号批号信息
  560. selectedChangeDate(row,selectedProduct) {
  561. //选择的那个销售产品
  562. this.product = this.productsInfo.find(product => product.id === selectedProduct);
  563. //得到选择的商品
  564. this.form.product=selectedProduct;
  565. //通过母粒编码查询到对应的母粒信息
  566. // let queryParams = {
  567. // "materielCode": this.product.colourNumber
  568. // }
  569. // //得到对应的母粒信息
  570. // getMaterielInfo(queryParams).then((response) => {
  571. // if (response.data!=null) {
  572. // this.materiel = response.data;
  573. // console.log(response.data,"规格")
  574. // //色号 母粒编码+色号
  575. // row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
  576. // }
  577. // });
  578. //7月10号新需求修改
  579. //通过母粒编码查询到对应的母粒信息
  580. let queryParams = {
  581. // "materielCode": this.product.colourNumber,
  582. "materielSpecies":"1"
  583. }
  584. //得到对应的母粒信息
  585. getMaterielInfo(queryParams).then((response) => {
  586. if (response.data!=null) {
  587. let mls = response.data
  588. mls.forEach(dataKey => {
  589. this.options.push({
  590. "label":dataKey.materieEncoding+"("+dataKey.materieColorNumber+")",
  591. "value":dataKey.materieEncoding+"("+dataKey.materieColorNumber+")",
  592. "colourNumber":dataKey.materielCode
  593. })
  594. });
  595. //色号 母粒编码+色号
  596. // row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
  597. }
  598. });
  599. //isDisabled(有批号就用,没批号就自己输入)
  600. if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
  601. row.currentLotNumber=this.product.lotNumber;
  602. this.isDisabled=true;
  603. }else {
  604. this.isDisabled=false;
  605. row.currentLotNumber="";
  606. }
  607. //产品规格
  608. row.currentSpecification= this.product.productSpecifications;
  609. //合同号--销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
  610. row.salesmanId=this.product.saleOrderNo;
  611. //数量
  612. row.number=this.product.productNumber;
  613. },
  614. // 新增计划产品信息
  615. handleAddPlan(row) {
  616. this.getProductsInfo();
  617. this.nanInsertDialogTableVisible = true
  618. this.tableData2=[]
  619. //先清空
  620. this.machineId=""
  621. //当前操作机台号
  622. this.machineId=row.machineId;
  623. //机台id
  624. this.macId=row.macId;
  625. },
  626. // 新增删除行
  627. handleDelete(index, row) {
  628. // console.log(index,row)
  629. // this.tableData2[a];
  630. this.tableData2.splice(index, 1);
  631. // 把上一编辑行置回-1
  632. this.editingRowIndex = -1;
  633. },
  634. // 点击编辑行
  635. handleRowClick(row) {
  636. this.isEditLine = true;
  637. //找到当前行的编辑索引
  638. var rowIndex = this.tableData2.indexOf(row);
  639. console.log(rowIndex)
  640. if (this.lastEditLine != 0 &&
  641. this.editingRowIndex !== rowIndex &&
  642. this.editingRowIndex !== -1 &&
  643. !this.isRowFilled(this.tableData2[this.lastEditLine])) {
  644. this.$message({
  645. message: this.$t('planTable.completePreviousData'),
  646. type: 'warning'
  647. });
  648. return;
  649. }
  650. //编辑索引不等于当前编辑行索引
  651. if (this.editingRowIndex !== rowIndex) {
  652. // alert(this.editingRowIndex);
  653. if (this.editingRowIndex !== -1) {
  654. //把当前行变成不可编辑的
  655. this.tableData2[this.editingRowIndex].isEditing = false;
  656. }
  657. //把当前行变成可编辑的
  658. row.isEditing = true;
  659. this.editingRowIndex = rowIndex;
  660. }else {
  661. //把当前行变成可编辑的
  662. row.isEditing = true;
  663. this.editingRowIndex = rowIndex;
  664. }
  665. },
  666. // 光标失去焦点变成不可编辑
  667. handleInputBlur(row) {
  668. // let rowIndex = this.tableData2.indexOf(row);
  669. // //编辑索引不等于当前编辑行索引
  670. // if(row.isEditing="true"){
  671. // row.isEditing = false;
  672. // //对于整个表格来说
  673. // this.isEditLine = false;
  674. // //当前编辑行置为-1
  675. // this.editingRowIndex = -1;
  676. // }
  677. //编辑索引不等于当前编辑行索引
  678. // if (this.editingRowIndex !== rowIndex) {
  679. // if (this.isRowFilled(row)) {
  680. // row.isEditing = false;
  681. // //对于整个表格来说
  682. // this.isEditLine = false;
  683. // //当前编辑行置为-1
  684. // this.editingRowIndex = -1;
  685. // }
  686. // }
  687. },
  688. // 检查行是否填写完毕的示例方法
  689. isRowFilled(row) {
  690. return row.productionDigit &&
  691. row.currentColorCode &&
  692. row.currentSpecification &&
  693. row.currentLotNumber&&
  694. row.number&&
  695. row.tubecolor &&
  696. row.boxweight &&
  697. row.tubeweight;
  698. },
  699. // 新增一行标记为可编辑
  700. addEditableRow() {
  701. this.getProductsInfo();
  702. // 检查当前编辑行是否已填写完毕
  703. if(this.tableData2.length!=0){
  704. if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
  705. this.$message({
  706. message: this.$t('planTable.completePreviousData'),
  707. type: 'warning'
  708. });
  709. return;
  710. }
  711. //新增行之前先让以前的行不能编辑
  712. this.tableData2.forEach(item => {
  713. item.isEditing = false;
  714. })
  715. }
  716. this.tableData2.push({
  717. currentColorCode: '',
  718. currentSpecification: '',
  719. currentLotNumber: '',
  720. productionDigit: '',
  721. number:'',
  722. startTime: '',
  723. plannedEndTime:'',
  724. planStatus:0,
  725. productId:'',
  726. salesmanId:'',
  727. isEditing: true,
  728. planType: this.$t('planTable.spinningPlan'),
  729. colourNumber:""
  730. });
  731. this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
  732. this.lastEditLine = this.tableData2.length - 1
  733. },
  734. // 添加计划
  735. addPlanInfo(){
  736. if(this.tableData2.length<=0){
  737. this.$message({message: this.$t('planTable.addTableData'), type: 'warning'});
  738. }
  739. var flag=true;
  740. this.tableData2.forEach(item=>{
  741. if(!this.isRowFilled(item)){
  742. flag=false
  743. }
  744. })
  745. if(flag==false){
  746. this.$message({message: this.$t('planTable.completeTableData'), type: 'warning'});
  747. return ;
  748. }
  749. const datatime=Date.now()+this.machineId;
  750. let i=0
  751. //处理表格数据
  752. this.tableData2.forEach(item=>{
  753. item.timestampRandomCode=datatime;
  754. item.macId=this.macId;
  755. item.machineId=this.machineId;
  756. if(item.planStatus==1){
  757. i++
  758. }
  759. })
  760. if(i>=2){
  761. this.$message({
  762. message: this.$t('planTable.cannotAddTwoPlans'),
  763. type: 'warning'
  764. });
  765. return;
  766. }
  767. //先查询计划表中有没有正在上机的
  768. getPlanSpinningInfo({"machineId":this.machineId,"macId":this.macId,"planStatus":1}).then(response => {
  769. if(i>=1&&response.data.length>0){
  770. this.$message({
  771. message: this.$t('planTable.onlyOneInProduction'),
  772. type: 'warning'
  773. });
  774. return;
  775. }else {
  776. //添加计划信息
  777. addSpinningPlanList(this.tableData2).then(response => {
  778. if (response.code == 200) {
  779. this.$message({
  780. message: this.$t('planTable.addSuccess'),
  781. type: 'success'
  782. });
  783. this.getSpinningPlanList();
  784. //最后把弹窗关掉
  785. this.nanInsertDialogTableVisible=false
  786. } else {
  787. this.$message({
  788. message: this.$t('planTable.addFailed'),
  789. type: 'error'
  790. });
  791. //最后把弹窗关掉
  792. this.nanInsertDialogTableVisible=false
  793. }
  794. });
  795. }
  796. });
  797. },
  798. // 修改计划
  799. handleEditPlan(row) {
  800. //已经在待机列表了,isNull过滤掉了
  801. getProductsAll(row.macId).then((response) => {
  802. this.productsInfo = response.data;
  803. this.productsInfo.forEach(item => {
  804. item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
  805. });
  806. //当前操作机台号
  807. this.machineId=row.machineId;
  808. //机台id
  809. this.macId=row.macId;
  810. this.tableData2=[];
  811. //弹窗
  812. this.nanUpdateDialogTableVisible = true
  813. getPlanSpinningInfo({"macId":row.macId}).then((response) => {
  814. //得到生产中,停产的,待产的
  815. response.data.forEach(item => {
  816. item.isEditing=false;
  817. item.planStatus=parseInt(item.planStatus);
  818. item.productId=parseInt(item.productId)
  819. })
  820. this.tableData2=response.data;
  821. })
  822. })
  823. },
  824. // 弹窗里边的点击查询
  825. onSubmit(){
  826. this.formData.macId=this.macId;
  827. getPlanSpinningInfo(this.formData).then(response => {
  828. //得到生产中,停产的,待产的
  829. response.data.forEach(item => {
  830. item.isEditing=false;
  831. item.planStatus=parseInt(item.planStatus);
  832. })
  833. this.tableData2=response.data;
  834. });
  835. },
  836. // 重置
  837. reset(){
  838. this.formData.planStatus='';
  839. getPlanSpinningInfo({"macId":this.macId}).then(response => {
  840. //得到生产中,停产的,待产的
  841. response.data.forEach(item => {
  842. item.isEditing=false;
  843. item.planStatus=parseInt(item.planStatus);
  844. })
  845. this.tableData2=response.data;
  846. });
  847. },
  848. // 更新状态
  849. updateStatus(ind, row,planStatus){
  850. row.planType=this.$t('planTable.spinningPlan')
  851. if(!this.isRowFilled(row)){
  852. this.$message({message: this.$t('planTable.completeCurrentRow'), type: 'warning'});
  853. return;
  854. }
  855. if(row.planStatus=="2"){
  856. //如果说我要去停机一个产品我只需要去鉴别你这个产线上有没有停机或者上其他上机的产品
  857. getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
  858. if(response.data.length>0) {
  859. this.$message({message: this.$t('planTable.alreadyHasStopped'), type: 'warning'});
  860. return;//证明有在上级的产品--只能有一个上级或者停机的产品
  861. }else {
  862. getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
  863. if(response.data.length>0){
  864. this.$message({message: this.$t('planTable.otherProductInProduction'), type: 'warning'});
  865. return;//证明有在上级的产品--zhi能有一个上级产品
  866. }else {
  867. updateSpinningInfoPlanOne(row).then(response=>{
  868. if (response.code == 200) {
  869. this.$message({
  870. message: this.$t('planTable.modifySuccess'),
  871. type: 'success'
  872. });
  873. this.getSpinningPlanList();
  874. //最后把弹窗关掉
  875. this.nanInsertDialogTableVisible=false
  876. } else {
  877. this.$message({
  878. message: this.$t('planTable.modifyFailed'),
  879. type: 'error'
  880. });
  881. //最后把弹窗关掉
  882. this.nanInsertDialogTableVisible=false
  883. }
  884. })
  885. }
  886. })
  887. }
  888. });
  889. return;
  890. }
  891. //判断当前计划是否已经投产
  892. getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
  893. //if(resp.data.length>0){
  894. // this.$message({message: '当前计划订单产品在生产中已经不能修改', type: 'warning'});
  895. // return;//证明有在上级的产品--zhi能有一个上级产品
  896. // }
  897. //不等于0待机才去校验是否重复
  898. if(row.planStatus!=0){
  899. //先查询计划表中有没有正在上机的或者停机的
  900. getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
  901. if(response.data.length>0){
  902. if(row.planStatus==1){
  903. this.$message({message: this.$t('planTable.onlyOneInProduction'), type: 'warning'});
  904. return;//证明有在上级的产品--zhi能有一个上级产品
  905. }else {
  906. this.$message({message: this.$t('planTable.alreadyStopped'), type: 'warning'});
  907. return;//证明有在上级的产品--zhi能有一个上级产品
  908. }
  909. }else {
  910. if(row.planStatus==1){
  911. getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"2"}).then(response => {
  912. if(response.data.length>0){
  913. this.$message({message: this.$t('planTable.needHandleStopped'), type: 'warning'});
  914. return;//证明有在上级的产品--zhi能有一个上级产品
  915. }else {
  916. updateSpinningInfoPlanOne(row).then(response=>{
  917. if (response.code == 200) {
  918. this.$message({
  919. message: this.$t('planTable.modifySuccess'),
  920. type: 'success'
  921. });
  922. this.getSpinningPlanList();
  923. //最后把弹窗关掉
  924. this.nanInsertDialogTableVisible=false
  925. } else {
  926. this.$message({
  927. message: this.$t('planTable.modifyFailed'),
  928. type: 'error'
  929. });
  930. //最后把弹窗关掉
  931. this.nanInsertDialogTableVisible=false
  932. }
  933. })
  934. }
  935. })
  936. }
  937. if(row.planStatus==2){
  938. getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
  939. if(response.data.length>0){
  940. this.$message({message: this.$t('planTable.otherProductInProduction'), type: 'warning'});
  941. return;//证明有在上级的产品--zhi能有一个上级产品
  942. }else {
  943. updateSpinningInfoPlanOne(row).then(response=>{
  944. if (response.code == 200) {
  945. this.$message({
  946. message: this.$t('planTable.modifySuccess'),
  947. type: 'success'
  948. });
  949. this.getSpinningPlanList();
  950. //最后把弹窗关掉
  951. this.nanInsertDialogTableVisible=false
  952. } else {
  953. this.$message({
  954. message: this.$t('planTable.modifyFailed'),
  955. type: 'error'
  956. });
  957. //最后把弹窗关掉
  958. this.nanInsertDialogTableVisible=false
  959. }
  960. })
  961. }
  962. })
  963. }
  964. }
  965. });
  966. }else {
  967. //修改待机的话直接修改
  968. updateSpinningInfoPlanOne(row).then(response=>{
  969. if (response.code == 200) {
  970. this.$message({
  971. message: this.$t('planTable.modifySuccess'),
  972. type: 'success'
  973. });
  974. this.getSpinningPlanList();
  975. //最后把弹窗关掉
  976. this.nanInsertDialogTableVisible=false
  977. } else {
  978. this.$message({
  979. message: this.$t('planTable.modifyFailed'),
  980. type: 'error'
  981. });
  982. //最后把弹窗关掉
  983. this.nanInsertDialogTableVisible=false
  984. }
  985. })
  986. }
  987. })
  988. }
  989. }
  990. }
  991. </script>
  992. <style scoped>
  993. .el-tabs--border-card >>> .el-tabs__content {
  994. padding: 0 !important;
  995. }
  996. .el-table__body-wrapper {
  997. cursor: grab;
  998. }
  999. .el-table__body-wrapper.grabbing {
  1000. cursor: grabbing;
  1001. }
  1002. .container >>> .el-table .cell {
  1003. white-space: pre-line;
  1004. }
  1005. </style>