details.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. <template>
  2. <ele-modal
  3. :width="modelWidth"
  4. :visible.sync="detailsVisible"
  5. :close-on-click-modal="false"
  6. custom-class="ele-dialog-form"
  7. :maxable="true"
  8. :title="'信息'"
  9. append-to-body
  10. :before-close="cancelDetails"
  11. >
  12. <div class="form-wrapper">
  13. <el-tabs
  14. v-model="dotLineActiveTab"
  15. type="border-card"
  16. class="dot-line-tabs"
  17. >
  18. <el-tab-pane label="详情" name="detail">
  19. <el-form
  20. ref="form"
  21. :model="form"
  22. label-position="right"
  23. label-width="107px"
  24. >
  25. <el-row
  26. :gutter="10"
  27. class="basic"
  28. type="flex"
  29. style="flex-wrap: wrap"
  30. v-for="(el, index) in fieldList"
  31. :key="index"
  32. >
  33. <el-col
  34. :xs="6"
  35. :sm="6"
  36. :md="6"
  37. :lg="6"
  38. :xl="6"
  39. v-for="item in el"
  40. :key="item.prop"
  41. >
  42. <el-form-item :label="item.label">
  43. <!-- <div class="item_label">{{ current[item.prop] }}</div> -->
  44. <el-input :value="fieldValue(item.prop)" readonly />
  45. </el-form-item>
  46. </el-col>
  47. </el-row>
  48. <el-row :gutter="10">
  49. <el-col :xs="6" :sm="6" :md="6" :lg="6" :xl="6">
  50. <el-form-item label="所属工厂:">
  51. <el-input v-model="form.factoryName" :readonly="true">
  52. </el-input>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :xs="6" :sm="6" :md="6" :lg="6" :xl="6">
  56. <el-form-item label="所属工作中心:">
  57. <el-select
  58. style="width: 100%"
  59. v-model="form.workCenterId"
  60. placeholder="请选择"
  61. @change="changeWork"
  62. disabled
  63. >
  64. <el-option
  65. v-for="item in workCenterList"
  66. :key="item.id"
  67. :label="item.name"
  68. :value="item.id"
  69. >
  70. </el-option>
  71. </el-select>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :xs="6" :sm="6" :md="6" :lg="6" :xl="6">
  75. <el-form-item label="所属班组:" required>
  76. <el-select
  77. style="width: 100%"
  78. v-model="form.teamId"
  79. placeholder="请选择"
  80. @change="changeGroups"
  81. disabled
  82. >
  83. <el-option
  84. v-for="item in teamList"
  85. :key="item.id"
  86. :label="item.name"
  87. :value="item.id"
  88. >
  89. </el-option>
  90. </el-select>
  91. </el-form-item>
  92. </el-col>
  93. </el-row>
  94. <el-row>
  95. <el-form-item label="报工类型:" required>
  96. <el-radio-group v-model="form.singleReport" disabled>
  97. <!-- v-if="clientEnvironmentId != 2" -->
  98. <el-radio :label="1">单件报工</el-radio>
  99. <el-radio :label="0">批量报工</el-radio>
  100. </el-radio-group>
  101. </el-form-item>
  102. </el-row>
  103. <el-row>
  104. <el-form-item label="派单方式:" prop="taskAss">
  105. <!-- @change="changeDispatch" -->
  106. <el-radio-group v-model="form.taskAss" disabled>
  107. <el-radio :label="1">生产订单派单</el-radio>
  108. <el-radio :label="0">工序任务派单</el-radio>
  109. </el-radio-group>
  110. </el-form-item>
  111. </el-row>
  112. <el-row v-if="form.taskAss == 1">
  113. <el-col :span="24">
  114. <el-form-item label="指派:" prop="assignType">
  115. <el-radio-group
  116. v-model="form.assignType"
  117. size="mini"
  118. @change="assignRadio"
  119. disabled
  120. >
  121. <el-radio-button :label="1">工位</el-radio-button>
  122. <!-- <el-radio-button :label="2">人员</el-radio-button> -->
  123. <el-radio-button :label="3">产线</el-radio-button>
  124. </el-radio-group>
  125. </el-form-item>
  126. </el-col>
  127. <!-- <el-form-item label="工位:" v-if="form.assignType == 1">
  128. <el-select
  129. class="ele-block"
  130. v-model="form.workstationIds"
  131. placeholder="请选择工位"
  132. size="mini"
  133. multiple
  134. disabled
  135. filterable
  136. >
  137. <el-option
  138. v-for="item in stationList"
  139. :key="item.id"
  140. :label="item.name + '(' + item.code + ')'"
  141. :value="item.id"
  142. >
  143. </el-option>
  144. </el-select>
  145. </el-form-item> -->
  146. <el-form-item label="工位:" v-if="form.assignType == 1">
  147. <el-input
  148. :value="
  149. stationList
  150. .filter((s) => form.workstationIds?.includes(s.id))
  151. .map((s) => s.name)
  152. .join('、')
  153. "
  154. disabled
  155. />
  156. </el-form-item>
  157. <el-form-item label="人员:" v-if="form.assignType == 2">
  158. <el-select
  159. class="ele-block"
  160. v-model="form.crewIds"
  161. placeholder="请选择人员"
  162. size="mini"
  163. filterable
  164. multiple
  165. disabled
  166. >
  167. <el-option
  168. v-for="item in crewList"
  169. :key="item.id"
  170. :label="item.name"
  171. :value="item.id"
  172. >
  173. </el-option>
  174. </el-select>
  175. </el-form-item>
  176. <!-- <el-form-item label="产线:" v-if="form.assignType == 3" required>
  177. <el-select
  178. class="ele-block"
  179. v-model="form.factoryLineIds"
  180. placeholder="请选择产线"
  181. size="mini"
  182. filterable
  183. multiple
  184. disabled
  185. >
  186. <el-option
  187. v-for="item in productionList"
  188. :key="item.id"
  189. :label="item.name"
  190. :value="item.id"
  191. >
  192. </el-option>
  193. </el-select>
  194. </el-form-item> -->
  195. <el-form-item label="工位:" v-if="form.assignType == 3">
  196. <el-input
  197. :value="
  198. productionList
  199. .filter((s) => form.factoryLineIds?.includes(s.id))
  200. .map((s) => s.name)
  201. .join('、')
  202. "
  203. disabled
  204. />
  205. </el-form-item>
  206. </el-row>
  207. <el-tabs
  208. class="process_list"
  209. v-model="processId"
  210. type="border-card"
  211. @tab-click="handleClick"
  212. v-show="form.taskAss == 0"
  213. v-loading="tabsLoading"
  214. >
  215. <el-tab-pane
  216. v-for="(item, index) in processList"
  217. :key="item.id"
  218. :label="item.name"
  219. :name="item.id"
  220. >
  221. <ele-pro-table
  222. class="table"
  223. :ref="`tableRef${index}`"
  224. :columns="columns"
  225. :datasource="item.list"
  226. cache-key="systemRoleTable"
  227. :pageSize="20"
  228. v-loading="tabLoading"
  229. :selection.sync="item.selection"
  230. row-key="id"
  231. >
  232. <template v-slot:toolbar>
  233. <!-- <el-button
  234. type="primary"
  235. @click="dispatch(item, 1)"
  236. :loading="toolbarLoading"
  237. >
  238. 派单
  239. </el-button>
  240. <el-button
  241. type="primary"
  242. @click="dispatch(item, 2)"
  243. :loading="toolbarLoading"
  244. >
  245. 撤回
  246. </el-button>
  247. <el-button
  248. type="primary"
  249. @click="dispatch(item, 3)"
  250. :loading="toolbarLoading"
  251. >
  252. 保存
  253. </el-button> -->
  254. <div style="display: inline-block">
  255. <span
  256. class="text"
  257. style="
  258. font-weight: bold;
  259. font-size: 14px;
  260. margin-right: 8px;
  261. "
  262. >指派:</span
  263. >
  264. <el-radio-group
  265. v-model="item.assignType"
  266. size="mini"
  267. @change="(e) => changeRadio(e, index)"
  268. >
  269. <el-radio-button
  270. :label="1"
  271. :disabled="radioBun(item, 'stationDis')"
  272. >工位</el-radio-button
  273. >
  274. <!-- <el-radio-button
  275. :label="2"
  276. :disabled="radioBun(item, 'staffDis')"
  277. >人员</el-radio-button
  278. > -->
  279. <el-radio-button
  280. :label="3"
  281. :disabled="radioBun(item, 'lineDis')"
  282. >产线</el-radio-button
  283. >
  284. </el-radio-group>
  285. </div>
  286. <div
  287. style="margin-left: 50px; display: inline-block"
  288. v-if="timeSlot(item)"
  289. >
  290. 时间段: {{ item.startDate }} ----- {{ item.endDate }}
  291. </div>
  292. </template>
  293. <template v-slot:quantity="{ row }">
  294. <el-input
  295. :readonly="permissions(row)"
  296. type="number"
  297. v-model="row.quantity"
  298. placeholder="请输入数量"
  299. @input="(e) => handleQuantityInput(e, row, item)"
  300. ></el-input>
  301. </template>
  302. <template v-slot:weight="{ row }">
  303. <el-input
  304. :readonly="permissions(row)"
  305. type="number"
  306. v-model="row.weight"
  307. placeholder="请输入重量"
  308. @input="(e) => handleWeightInput(e, row, item)"
  309. ></el-input>
  310. </template>
  311. <template v-slot:teamTimeIds="{ row }">
  312. <el-select
  313. :disabled="permissions(row)"
  314. multiple
  315. v-model="row.teamTimeIds"
  316. placeholder="班次"
  317. @change="(e) => shiftSelection(e, row, item)"
  318. >
  319. <el-option
  320. v-for="item in shiftList"
  321. :key="item.id"
  322. :label="item.dutyName"
  323. :value="item.id"
  324. >
  325. </el-option>
  326. </el-select>
  327. </template>
  328. <template v-slot:startTime="{ row }">
  329. <el-date-picker
  330. :readonly="permissions(row)"
  331. class="w100"
  332. v-model="row.startTime"
  333. type="datetime"
  334. value-format="yyyy-MM-dd HH:mm:ss"
  335. placeholder="开始时间"
  336. @change="handleStartTimeChange(row, item)"
  337. ></el-date-picker>
  338. </template>
  339. <template v-slot:endTime="{ row }">
  340. <el-date-picker
  341. :readonly="permissions(row)"
  342. class="w100"
  343. v-model="row.endTime"
  344. type="datetime"
  345. value-format="yyyy-MM-dd HH:mm:ss"
  346. @change="handleEndTimeChange(row, item)"
  347. placeholder="完成时间"
  348. ></el-date-picker>
  349. </template>
  350. <template v-slot:action="{ row }">
  351. <!-- :readonly="resetBtnDis(row)" -->
  352. <el-popconfirm
  353. title="确定要重置该条数据吗?"
  354. @confirm="resetData(row, item)"
  355. v-if="resetBtnDis(row)"
  356. >
  357. <template v-slot:reference>
  358. <el-link type="primary" :underline="false">
  359. 重置
  360. </el-link>
  361. </template>
  362. </el-popconfirm>
  363. </template>
  364. </ele-pro-table>
  365. </el-tab-pane>
  366. </el-tabs>
  367. </el-form>
  368. </el-tab-pane>
  369. <el-tab-pane
  370. label="计划布点详情"
  371. name="dotLine"
  372. v-if="hasDotLineDetail"
  373. >
  374. <div class="plan-dot-line">
  375. <div class="top-route">
  376. <div class="panel-title">工艺路线</div>
  377. <el-empty
  378. v-if="dotLineTaskList.length === 0"
  379. description="暂无工艺路线"
  380. ></el-empty>
  381. <el-steps
  382. v-else
  383. :active="dotLineRouteStepsActive"
  384. space="20px"
  385. align-center
  386. finish-status="success"
  387. class="route-steps"
  388. >
  389. <el-step
  390. v-for="(item, index) in dotLineTaskList"
  391. :key="`route-step-${item._taskKey}`"
  392. :title="dotLineRouteStepTitle(item, index)"
  393. :class="{ active: dotLineRouteDesIndex === index }"
  394. ></el-step>
  395. </el-steps>
  396. </div>
  397. <div class="config-panel">
  398. <div class="panel-title">工艺配置</div>
  399. <el-empty
  400. v-if="dotLineTaskList.length === 0"
  401. description="暂无工艺"
  402. ></el-empty>
  403. <div v-else class="task-config-table-wrap">
  404. <el-table
  405. :data="dotLineTaskList"
  406. border
  407. size="small"
  408. row-key="_taskKey"
  409. max-height="420"
  410. class="config-table"
  411. >
  412. <el-table-column
  413. type="index"
  414. label="序号"
  415. width="60"
  416. align="center"
  417. class-name="process-name-cell"
  418. label-class-name="config-execution-team-header"
  419. />
  420. <el-table-column
  421. label="工序名称"
  422. min-width="100"
  423. show-overflow-tooltip
  424. class-name="process-name-cell"
  425. label-class-name="config-execution-team-header"
  426. align="center"
  427. >
  428. <template slot-scope="{ row, $index }">
  429. <span class="task-name-text">{{
  430. getDotLineTaskName(row, $index)
  431. }}</span>
  432. </template>
  433. </el-table-column>
  434. <el-table-column
  435. label="执行模式"
  436. min-width="100"
  437. align="center"
  438. label-class-name="config-execution-team-header"
  439. class-name="config-meta-cell"
  440. >
  441. <template slot-scope="{ row }">
  442. {{ executionTypeLabel(row.executionType) }}
  443. </template>
  444. </el-table-column>
  445. <el-table-column
  446. label="执行对象"
  447. min-width="130"
  448. align="center"
  449. label-class-name="config-execution-team-header"
  450. class-name="config-meta-cell"
  451. >
  452. <template slot-scope="{ row }">
  453. {{ dotLineExecutionObjectDisplay(row) }}
  454. </template>
  455. </el-table-column>
  456. <el-table-column
  457. label="执行开始时间"
  458. min-width="168"
  459. align="center"
  460. prop="executionStartTime"
  461. label-class-name="config-execution-team-header"
  462. class-name="config-meta-cell"
  463. />
  464. <el-table-column
  465. label="执行结束时间"
  466. min-width="168"
  467. align="center"
  468. prop="executionEndTime"
  469. label-class-name="config-execution-team-header"
  470. class-name="config-meta-cell"
  471. />
  472. </el-table>
  473. </div>
  474. </div>
  475. </div>
  476. </el-tab-pane>
  477. </el-tabs>
  478. </div>
  479. <div slot="footer">
  480. <el-button plain @click="cancelDetails">取消</el-button>
  481. </div>
  482. </ele-modal>
  483. </template>
  484. <script>
  485. import releaseMixin from '../mixins/release';
  486. import { parameterGetByCode } from '@/api/mainData/index';
  487. import { getPlanDotLine } from '@/api/productionPlan/planDotLine';
  488. const EXEC_TYPE_MAP = { 0: '自制', 1: '请托', 2: '委外' };
  489. const EXEC_TYPE = Object.freeze({
  490. HOMEMADE: 0,
  491. ENTRUST: 1,
  492. OUTSOURCE: 2
  493. });
  494. export default {
  495. components: {},
  496. props: {
  497. current: {
  498. type: Object,
  499. default: () => {}
  500. },
  501. detailsVisible: {
  502. type: Boolean,
  503. default: false
  504. }
  505. },
  506. mixins: [releaseMixin],
  507. mixinOptions: { type: 'detail' },
  508. data() {
  509. return {
  510. processId: '',
  511. tabLoading: false,
  512. dynamicName: '工位名称',
  513. form: {
  514. assignType: 1,
  515. crewIds: '',
  516. workstationIds: '',
  517. teamId: '',
  518. singleReport: '',
  519. workCenterId: '',
  520. taskAss: 1,
  521. factoryName: '',
  522. factoryLineIds: ''
  523. },
  524. toolbarLoading: false,
  525. processList: [],
  526. workCenterList: [],
  527. teamList: [],
  528. tabsLoading: false,
  529. stationList: [], // 工位的数据
  530. productionList: [], // 产线的数据
  531. crewList: [], // 人员的数据
  532. procTaskDis: false, // 工序任务派单选择
  533. firstTaskindex: '', // 首工序id 对应的工序列表数据下标
  534. fieldList: [
  535. [
  536. { label: '生产订单号:', prop: 'code' },
  537. { label: '计划编号:', prop: 'productionPlanCode' },
  538. { label: '工艺路线:', prop: 'produceRoutingName' },
  539. { label: '名称:', prop: 'productName' }
  540. ],
  541. [
  542. { label: '生产编号:', prop: 'productionCodes' },
  543. { label: '牌号:', prop: 'brandNo' },
  544. { label: '批次号:', prop: 'batchNo' },
  545. { label: '型号:', prop: 'model' }
  546. ],
  547. [
  548. { label: '要求生产数量:', prop: 'formingNum' },
  549. { label: '要求生产重量:', prop: 'initialWeight' },
  550. { label: '计划开始时间:', prop: 'planStartTime' },
  551. { label: '计划结束时间:', prop: 'planCompleteTime' }
  552. ],
  553. [
  554. { label: 'BOM版本:', prop: 'bomCategoryName' },
  555. { label: 'BOM类型:', prop: 'produceType' },
  556. { label: '首工序:', prop: 'firstTaskName' },
  557. { label: '创建时间:', prop: 'createTime' }
  558. ],
  559. [
  560. { label: '机型:', prop: 'modelKey' },
  561. { label: '颜色:', prop: 'colorKey' },
  562. { label: '派单人:', prop: 'dispatcher' },
  563. { label: '派单时间:', prop: 'dispatcherTime' }
  564. ],
  565. [{ label: '生产要求:', prop: 'productionRequirements' }]
  566. ],
  567. shiftList: [],
  568. dateValue: '',
  569. orderDis: false, // 生产订单派单
  570. singleDis: false, // 单个报工
  571. batchDis: false, // 批量报工
  572. isDispatchRow: {}, // 查询是否派单数据
  573. time_calc_code: '0', // 是否进行时间赋值 0 否 1 是
  574. isTask: true,
  575. dotLineTaskList: [],
  576. hasDotLineDetail: false,
  577. dotLineActiveTab: 'detail'
  578. };
  579. },
  580. computed: {
  581. fieldValue() {
  582. return (field) => {
  583. let value = this.current[field];
  584. // if (field == 'modelKey' || field == 'colorKey') {
  585. // return value;
  586. // }
  587. if (field == 'produceType') {
  588. if (value == 1) {
  589. return 'PBOM';
  590. }
  591. if (value == 2) {
  592. return 'MBOM';
  593. }
  594. if (value == 3) {
  595. return 'ABOM';
  596. }
  597. }
  598. return value || '';
  599. };
  600. },
  601. clientEnvironmentId() {
  602. return this.$store.state.user.info.clientEnvironmentId;
  603. },
  604. userInfo() {
  605. return this.$store.state.user.info;
  606. },
  607. modelWidth() {
  608. // if(this.form.taskAss == 1){
  609. // return '1000px'
  610. // }
  611. return '85vw';
  612. },
  613. // 重置按钮 的置灰权限 没有进行操作跟派单的数据 置灰
  614. resetBtnDis() {
  615. return (row) => {
  616. if (!row.status) return false;
  617. let flag = row.status.code != 1;
  618. return flag;
  619. };
  620. },
  621. // 指派单选框操作 已派单的 其它两个按钮不能操作
  622. radioBun() {
  623. return (row, type) => {
  624. if (!row.radioBun) return false;
  625. let flag = row.radioBun[type];
  626. return flag;
  627. };
  628. },
  629. // 列表输入框操作 已派单的不能操作
  630. permissions() {
  631. return (row) => {
  632. // if (!row.status) return false;
  633. // if (row.status.code == 1) return true;
  634. return true;
  635. };
  636. },
  637. // 时间段显示
  638. timeSlot() {
  639. return (item) => {
  640. if (!item.startDate || !item.endDate) {
  641. return false;
  642. }
  643. return true;
  644. };
  645. },
  646. executionTypeLabel() {
  647. return (val) => EXEC_TYPE_MAP[val] ?? '';
  648. },
  649. /** 与计划布点弹窗一致:首个未配置执行模式的工序为当前步;全部已配置则全部 finish */
  650. dotLineRouteStepsActive() {
  651. const list = this.dotLineTaskList;
  652. if (!list.length) return 0;
  653. for (let i = 0; i < list.length; i++) {
  654. if (!this.isDotLineTaskDone(list[i])) return i;
  655. }
  656. return list.length;
  657. },
  658. dotLineRouteDesIndex() {
  659. const list = this.dotLineTaskList;
  660. if (!list.length) return -1;
  661. const a = this.dotLineRouteStepsActive;
  662. return a >= list.length ? list.length - 1 : a;
  663. },
  664. columns() {
  665. return [
  666. {
  667. columnKey: 'index',
  668. label: '序号',
  669. type: 'index',
  670. width: 55,
  671. align: 'center',
  672. fixed: 'left'
  673. },
  674. // {
  675. // width: 45,
  676. // type: 'selection',
  677. // columnKey: 'selection',
  678. // align: 'center',
  679. // fixed: 'left',
  680. // reserveSelection: true
  681. // },
  682. {
  683. prop: 'name',
  684. label: this.dynamicName,
  685. align: 'center',
  686. width: 200
  687. },
  688. {
  689. prop: 'code',
  690. label: '编码',
  691. align: 'center',
  692. width: 200
  693. },
  694. {
  695. prop: 'status',
  696. label: '状态',
  697. align: 'center',
  698. width: 150,
  699. formatter: (row) => {
  700. if (!row.status) return '';
  701. return row.status.desc || '';
  702. }
  703. },
  704. {
  705. slot: 'quantity',
  706. prop: 'quantity',
  707. label: '数量',
  708. align: 'center',
  709. width: 140
  710. },
  711. {
  712. slot: 'weight',
  713. prop: 'weight',
  714. label: `重量(${this.current.newWeightUnit})`,
  715. align: 'center',
  716. width: 140
  717. },
  718. {
  719. slot: 'teamTimeIds',
  720. prop: 'teamTimeIds',
  721. label: '班次',
  722. align: 'center',
  723. minWidth: 220
  724. },
  725. {
  726. slot: 'startTime',
  727. prop: 'startTime',
  728. label: '计划开始时间',
  729. align: 'center',
  730. minWidth: 240
  731. },
  732. {
  733. slot: 'endTime',
  734. prop: 'endTime',
  735. label: '计划完成时间',
  736. align: 'center',
  737. minWidth: 240
  738. },
  739. {
  740. columnKey: 'action',
  741. label: '操作',
  742. width: 120,
  743. align: 'center',
  744. resizable: false,
  745. fixed: 'right',
  746. slot: 'action'
  747. }
  748. ];
  749. }
  750. },
  751. watch: {},
  752. created() {
  753. // 时间计算规则code
  754. this.form = this.current;
  755. this.form.taskAss = this.current.dispatchingMethod;
  756. this.getCode();
  757. this.workCenterData(); // 查询工作中心
  758. this.getClassesData(); // 查询班次
  759. this.queryCheckExists(); // 查询是否派单
  760. // this.form.singleReport = this.clientEnvironmentId == 2 ? 0 : '';
  761. this.dateValue = this.getFormattedDate();
  762. this.loadDotLineData();
  763. },
  764. methods: {
  765. getCode() {
  766. parameterGetByCode({
  767. code: 'time_calculation_rules'
  768. }).then((res) => {
  769. if (res) {
  770. this.time_calc_code = res.value || '0';
  771. }
  772. });
  773. },
  774. async getDispatchMethod(code) {
  775. await parameterGetByCode({ code }).then((res) => {
  776. if (res) {
  777. this.form.taskAss = res.value == '0' ? 0 : 1;
  778. }
  779. });
  780. },
  781. async getAssignmentMethod(code) {
  782. await parameterGetByCode({ code }).then((res) => {
  783. if (res) {
  784. this.form.assignType =
  785. res.value == '0' ? 0 : res.value == '1' ? 1 : 2;
  786. }
  787. });
  788. },
  789. cancelDetails() {
  790. this.$emit('update:detailsVisible', false);
  791. },
  792. async loadDotLineData() {
  793. if (!this.form.productionPlanId) {
  794. this.resetDotLineState();
  795. return;
  796. }
  797. try {
  798. const planData = await getPlanDotLine({
  799. planId: this.form.productionPlanId
  800. });
  801. const details = planData?.detailList;
  802. if (!Array.isArray(details) || details.length === 0) {
  803. this.resetDotLineState();
  804. return;
  805. }
  806. this.hasDotLineDetail = true;
  807. this.dotLineTaskList = details
  808. .slice()
  809. .sort((a, b) => (a.taskSort ?? 0) - (b.taskSort ?? 0))
  810. .map((item, i) => this.normalizeDotLineItem(item, i));
  811. } catch {
  812. this.resetDotLineState();
  813. }
  814. },
  815. resetDotLineState() {
  816. this.hasDotLineDetail = false;
  817. this.dotLineTaskList = [];
  818. },
  819. normalizeDotLineItem(item, index) {
  820. return {
  821. ...item,
  822. _taskKey: item.id ?? `detail-${item.taskId ?? index}`,
  823. executionStartTime: this.formatDotLineTime(item.executionStartTime),
  824. executionEndTime: this.formatDotLineTime(item.executionEndTime),
  825. executionType:
  826. item.executionType != null ? Number(item.executionType) : undefined
  827. };
  828. },
  829. getDotLineTaskName(item, index) {
  830. return item.taskName || item.name || `工艺${index + 1}`;
  831. },
  832. dotLineExecutionObjectDisplay(row) {
  833. const t =
  834. row.executionType != null ? Number(row.executionType) : undefined;
  835. if (t === EXEC_TYPE.HOMEMADE) return row.executionTeamName ?? '';
  836. if (t === EXEC_TYPE.ENTRUST) return row.executionFactoryName ?? '';
  837. return '';
  838. },
  839. dotLineRouteStepTitle(item, index) {
  840. return (
  841. item.taskTypeName || item.taskName || item.name || `工艺${index + 1}`
  842. );
  843. },
  844. isDotLineTaskDone(item) {
  845. return item.executionType != null && item.executionType !== '';
  846. },
  847. formatDotLineTime(val) {
  848. if (val == null || val === '') return '';
  849. const str = String(val).trim();
  850. if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(str)) return str;
  851. const d = new Date(val);
  852. if (Number.isNaN(d.getTime())) return '';
  853. const p = (n) => String(n).padStart(2, '0');
  854. return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(
  855. d.getHours()
  856. )}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
  857. }
  858. }
  859. };
  860. </script>
  861. <style lang="scss" scoped>
  862. .top-box {
  863. display: flex;
  864. margin-bottom: 10px;
  865. .item-box {
  866. flex: 1;
  867. }
  868. }
  869. .radio-box {
  870. margin: 10px 0;
  871. }
  872. .table {
  873. margin-top: 20px;
  874. }
  875. ::v-deep .el-radio-button__orig-radio:checked + .el-radio-button__inner {
  876. box-shadow: none;
  877. }
  878. ::v-deep .el-input.is-disabled .el-input__inner {
  879. color: #ab7777;
  880. }
  881. .plan-dot-line,
  882. .top-route,
  883. .config-panel {
  884. width: 100%;
  885. max-width: 100%;
  886. min-width: 0;
  887. box-sizing: border-box;
  888. }
  889. .plan-dot-line {
  890. min-height: 360px;
  891. }
  892. .top-route,
  893. .config-panel {
  894. border: 1px solid #ebeef5;
  895. border-radius: 4px;
  896. padding: 12px;
  897. background: #fff;
  898. }
  899. .top-route {
  900. overflow: visible;
  901. }
  902. .config-panel {
  903. margin-top: 12px;
  904. }
  905. .panel-title {
  906. font-size: 14px;
  907. font-weight: 600;
  908. margin-bottom: 10px;
  909. }
  910. .route-steps {
  911. width: 100%;
  912. overflow-x: auto;
  913. overflow-y: hidden;
  914. padding-bottom: 8px;
  915. box-sizing: content-box;
  916. }
  917. .route-steps ::v-deep {
  918. .el-steps {
  919. display: flex;
  920. flex-wrap: nowrap;
  921. align-items: flex-start;
  922. }
  923. .el-step {
  924. flex-shrink: 0;
  925. }
  926. .el-step__title {
  927. font-size: clamp(16px, 2.2vw, 16px);
  928. line-height: 1.35;
  929. max-width: 8em;
  930. margin-left: auto;
  931. margin-right: auto;
  932. white-space: normal;
  933. word-break: break-all;
  934. }
  935. .el-step.active .el-step__title {
  936. color: #409eff;
  937. font-weight: 600;
  938. }
  939. .el-step__head.is-success {
  940. color: #0c7741;
  941. border-color: #0c7741;
  942. }
  943. .el-step__title.is-success,
  944. .el-step__description.is-success {
  945. color: #0c7741;
  946. }
  947. .el-step__line {
  948. top: 14px;
  949. }
  950. .el-step__icon {
  951. width: 30px;
  952. height: 30px;
  953. }
  954. .el-step__main {
  955. padding-top: 8px;
  956. margin-top: 0;
  957. }
  958. .el-step__description {
  959. margin-top: 0;
  960. padding-right: 0;
  961. }
  962. }
  963. @media (max-width: 576px) {
  964. .top-route,
  965. .config-panel {
  966. padding: 8px;
  967. }
  968. }
  969. .task-config-table-wrap {
  970. width: 100%;
  971. }
  972. .config-table ::v-deep {
  973. .el-table th > .cell,
  974. .el-table td > .cell {
  975. font-size: 14px;
  976. text-align: center;
  977. }
  978. th.config-execution-team-header > .cell,
  979. td.config-meta-cell > .cell {
  980. font-size: 14px;
  981. font-weight: 500;
  982. line-height: 1.4;
  983. }
  984. .el-table__body .cell {
  985. padding-left: 6px;
  986. padding-right: 6px;
  987. }
  988. th.process-name-header > .cell,
  989. td.process-name-cell .task-name-text {
  990. font-size: 14px;
  991. font-weight: 500;
  992. line-height: 1.4;
  993. }
  994. }
  995. </style>