index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <template>
  2. <div class="shipping-bill-container">
  3. <!-- 查询区域 -->
  4. <div class="jeecg-basic-table-form-container">
  5. <a-spin :spinning="sandCarLoading">
  6. <a-form layout="inline" ref="form" :label-col="labelCol" :wrapper-col="wrapperCol">
  7. <a-row :gutter="24" class="form-row">
  8. <!-- <a-col :span="4">
  9. <a-form-item label="铸机">
  10. <segmented-select v-model:value="queryParam.ccmNo" dict="lg_zj" @change="changeType" defaultValue="5" />
  11. </a-form-item>
  12. </a-col> -->
  13. <!-- <a-col :span="6">
  14. <a-form-item label="钢种">
  15. <a-input v-model:value="queryParam.steel" placeholder="请输入" allowClear />
  16. </a-form-item>
  17. </a-col> -->
  18. <!-- <a-col :span="6">
  19. <a-form-item label="规格">
  20. <JSearchSelect placeholder="请选择" v-model:value="queryParam.spec" dict="billet_spec" allowClear />
  21. </a-form-item>
  22. </a-col> -->
  23. <!-- <a-col :xl="4">
  24. <a-form-item label="班组">
  25. <JSearchSelect placeholder="请选择" v-model:value="queryParam.shiftGroup" dict="lg_bz" @change="editQueryParam" allowClear />
  26. </a-form-item>
  27. </a-col>
  28. <a-col :xl="4">
  29. <a-form-item label="班别">
  30. <JSearchSelect placeholder="请选择" v-model:value="queryParam.shift" dict="lg_bb" @change="editQueryParam" allowClear />
  31. </a-form-item>
  32. </a-col> -->
  33. <a-col :span="4">
  34. <a-form-item label="车号">
  35. <JSearchSelect placeholder="请选择" v-model:value="queryParam.licensePlate" dict="lg_car" allowClear />
  36. </a-form-item>
  37. </a-col>
  38. <a-col :span="4">
  39. <a-form-item label="类型">
  40. <JSearchSelect placeholder="请选择" v-model:value="queryParam.btype" :defaultValue="0" dict="lg_btype" allowClear />
  41. </a-form-item>
  42. </a-col>
  43. <a-col :span="4">
  44. <a-form-item label="定尺">
  45. <JSearchSelect type="list" v-model:value="queryParam.size" dict="lg_dcgg" placeholder="请选择" allowClear />
  46. </a-form-item>
  47. </a-col>
  48. <a-col :span="4">
  49. <a-form-item label="目的地">
  50. <JSearchSelect
  51. v-model:value="queryParam.destination"
  52. :options="destinationOptions[queryParam.ccmNo]"
  53. placeholder="请选择"
  54. allowClear
  55. />
  56. </a-form-item>
  57. </a-col>
  58. <a-col :span="4" v-if="queryParam.ccmNo === '6'">
  59. <a-form-item label="车位号">
  60. <a-select style="width: 100%" v-model:value="queryParam.positionNum" placeholder="请选择" :options="carPosition6" />
  61. </a-form-item>
  62. </a-col>
  63. <a-col :span="4" v-else>
  64. <a-form-item label="车位号">
  65. <a-select style="width: 100%" v-model:value="queryParam.positionNum" placeholder="请选择" :options="carPosition5" />
  66. </a-form-item>
  67. </a-col>
  68. </a-row>
  69. <a-row :gutter="24">
  70. <a-col :span="24" style="text-align: center; margin-bottom: 20px">
  71. <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
  72. </a-col>
  73. </a-row>
  74. </a-form>
  75. </a-spin>
  76. </div>
  77. <!--引用表格-->
  78. <BasicTable @register="registerTable" class="shipping-bill-talbe" :rowSelection="rowSelection">
  79. <template #form-positionNum="{ model, field }">
  80. <a-radio-group v-model:value="model[field]" button-style="solid" @change="() => reload()">
  81. <a-radio-button value="1" v-if="Number(machine) === 5">1号车位</a-radio-button>
  82. <a-radio-button value="2">2号车位</a-radio-button>
  83. <a-radio-button value="3" v-if="Number(machine) === 6">3号车位</a-radio-button>
  84. <a-radio-button value="4" v-if="Number(machine) === 6">4号车位</a-radio-button>
  85. </a-radio-group>
  86. </template>
  87. <!--插槽:table标题-->
  88. <template #tableTitle>
  89. <a-button type="primary" @click="batchHandleDelete" :disabled="!selectedRowKeys.length" preIcon="ant-design:delete-outlined">
  90. 批量删除
  91. </a-button>
  92. </template>
  93. <!--操作栏-->
  94. <template #action="{ record }">
  95. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  96. </template>
  97. <template #billXuhao="{ record }">{{ record.uniqueCode || '' }}</template>
  98. <template #licensePlate="{ record }">
  99. <a-badge-ribbon style="top: -20px" v-if="record.licensePlateStatus === 1" color="red" text="错误">
  100. <div>{{ record.licensePlate }}</div>
  101. </a-badge-ribbon>
  102. <div v-else>{{ record.licensePlate }}</div>
  103. </template>
  104. </BasicTable>
  105. <!-- 表单区域 -->
  106. <!-- 编辑 -->
  107. <editModal ref="modelRef" @ok="formSubmitSuccess" />
  108. <!-- 日志 -->
  109. <logModel ref="logRef" @ok="handleSuccess"></logModel>
  110. <!-- 详情 -->
  111. <detailsModal @register="registerDetailModal" showActionColumn @success="handleSuccess" />
  112. <!-- 热装 -->
  113. <rod-line
  114. @register="registerRodLineModal"
  115. @success="handleSuccess"
  116. :machine="queryParam.ccmNo"
  117. :machineConfig="machineConfigs()[MachineConfigType.RODLINE]"
  118. />
  119. <!-- 堆垛装车 -->
  120. <stack @register="registerStackingEntruckingModal" :machine="queryParam.ccmNo" @success="handleSuccess" />
  121. <!-- 打印 -->
  122. <printModal @register="registerPrintModal" @success="handleSuccess" />
  123. </div>
  124. </template>
  125. <script lang="ts" name="shippingBill" setup>
  126. // import SegmentedSelect from '/@/components/SegmentedSelect/index.vue';
  127. import { BasicTable, TableAction } from '/@/components/Table';
  128. import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
  129. import { useListPage } from '/@/hooks/system/useListPage';
  130. import { columns, initDictConfig, queryParam, searchFormSchema, carPosition6, carPosition5 } from './shippingBill.data';
  131. import { deleteOne, batchDelete } from './shippingBill.api';
  132. import { defHttp } from '/@/utils/http/axios';
  133. import { onMounted, ref, reactive } from 'vue';
  134. // import hotDeliveryModal from './components/hotDeliveryModal.vue';
  135. import editModal from './components/editModal.vue';
  136. import logModel from './components/logModel.vue';
  137. import detailsModal from './components/detailsModal.vue';
  138. import printModal from './components/printModal.vue';
  139. import { useModal } from '/@/components/Modal';
  140. import { message } from 'ant-design-vue';
  141. import { destinationOptions, getMachineConfig, MachineConfigType, getMachineNum } from '../hotDelivery/common.data';
  142. import rodLine from './components/hotCharging/rodLine.vue';
  143. import stack from './components/hotCharging/stack.vue';
  144. const sandCarLoading = ref(false);
  145. const logRef = ref();
  146. const labelCol = reactive({
  147. xs: { span: 24 },
  148. sm: { span: 6 },
  149. });
  150. const modelRef = ref();
  151. const wrapperCol = reactive({
  152. xs: { span: 24 },
  153. sm: { span: 18 },
  154. });
  155. const machine = getMachineNum();
  156. queryParam.value.ccmNo = machine;
  157. queryParam.value.positionNum = Number(machine) === 5 ? '1' : '2';
  158. // 六号机配置信息
  159. const machineConfigs = () => getMachineConfig(queryParam.value.ccmNo);
  160. // 棒线堆垛明细
  161. const [registerDetailModal, { openModal: openDetailModal }] = useModal();
  162. // 注册添加棒线弹框
  163. const [registerRodLineModal, { openModal: openRodLineModal }] = useModal();
  164. // 注册打印modal
  165. const [registerPrintModal, { openModal: openPrintModal }] = useModal();
  166. // 堆垛发车modal
  167. const [registerStackingEntruckingModal, { openModal: openStackingEntruckingModal }] = useModal();
  168. // 发车
  169. const sendCar = async (record) => {
  170. try {
  171. setLoading(true);
  172. await defHttp.post({ url: '/storageBill/startCar', params: { ...record } }, { joinParamsToUrl: true });
  173. reload();
  174. } catch (error) {
  175. console.log(error);
  176. } finally {
  177. setLoading(false);
  178. }
  179. };
  180. /**
  181. * 操作栏
  182. */
  183. function getTableAction(record) {
  184. let actions: any[] = [];
  185. if (!!record.outTime || !!record.arrivalTime) {
  186. actions = [
  187. {
  188. label: '发车',
  189. disabled: !!record.outTime || !record.destination,
  190. icon: 'ant-design:car-outlined',
  191. popConfirm: {
  192. title: '是否确认发车?',
  193. description: record.amountTotal <= 0 ? `注意:当前车辆装运钢坯支数为${record.amountTotal}` : '',
  194. confirm: sendCar.bind(null, record),
  195. },
  196. },
  197. ];
  198. }
  199. return actions.concat([
  200. {
  201. label: '热装',
  202. color: 'error',
  203. // disabled: !!record.outTime,
  204. onClick: () => {
  205. openRodLineModal(true, {
  206. info: record,
  207. machineConfig: machineConfigs()[MachineConfigType.RODLINE],
  208. title: [[queryParam.value.ccmNo + '#机热装'], ['车牌号:', record.licensePlate], ['目的地:', record.destination]],
  209. isUpdate: true,
  210. });
  211. },
  212. },
  213. {
  214. label: '堆垛装车',
  215. // disabled: !!record.outTime,
  216. color: 'warning',
  217. onClick: () => {
  218. openStackingEntruckingModal(true, {
  219. info: record,
  220. machineConfig: machineConfigs()[MachineConfigType.STACKING],
  221. destinationList: machineConfigs()[MachineConfigType.RODLINE],
  222. title: [[queryParam.value.ccmNo + '#机堆垛装车'], ['车牌号:', record.licensePlate], ['目的地:', record.destination]],
  223. isUpdate: true,
  224. });
  225. },
  226. },
  227. {
  228. label: '打印',
  229. onClick: () => {
  230. openPrintModal(true, { record, isUpdate: true });
  231. },
  232. disabled: false,
  233. },
  234. {
  235. label: '编辑',
  236. onClick: handleEdit.bind(null, record),
  237. // disabled: record.isUpd,
  238. },
  239. ]);
  240. }
  241. /**
  242. * 下拉操作栏
  243. */
  244. function getDropDownAction(record) {
  245. return [
  246. {
  247. label: '装运明细',
  248. onClick: () => {
  249. openDetailModal(true, { record, isUpdate: true });
  250. },
  251. disabled: false,
  252. },
  253. {
  254. label: '日志',
  255. onClick: handleLog.bind(null, record),
  256. disabled: false,
  257. },
  258. {
  259. label: '删除',
  260. popConfirm: {
  261. title: '是否确认删除',
  262. confirm: handleDelete.bind(null, record),
  263. },
  264. disabled: false,
  265. },
  266. ];
  267. }
  268. /**
  269. * 批量删除事件
  270. */
  271. async function batchHandleDelete() {
  272. await batchDelete({ ids: selectedRowKeys.value }, formSubmitSuccess);
  273. }
  274. // 查看操作日志
  275. function handleLog(record: Recordable) {
  276. logRef.value.tableId = record.id;
  277. logRef.value.showLog(record.id);
  278. }
  279. // 删除
  280. async function handleDelete(record: Recordable) {
  281. await deleteOne({ id: record.id }, formSubmitSuccess);
  282. }
  283. /**
  284. * 编辑事件
  285. */
  286. function handleEdit(record: Recordable) {
  287. modelRef.value.edit(record);
  288. modelRef.value.rowData = record;
  289. }
  290. // 获取表格数据
  291. const getList = (params) => {
  292. return defHttp.get({
  293. url: '/storageBill/list',
  294. params: {
  295. ...params,
  296. ccmNo: queryParam.value.ccmNo || '5',
  297. },
  298. });
  299. };
  300. //注册table数据
  301. const { tableContext } = useListPage({
  302. tableProps: {
  303. title: '',
  304. api: getList,
  305. beforeFetch: (params) => {
  306. return Object.assign(params, {
  307. ccmNo: Number(queryParam.value.ccmNo),
  308. });
  309. },
  310. columns,
  311. canResize: false,
  312. showActionColumn: false,
  313. useSearchForm: true,
  314. showIndexColumn: true,
  315. indexColumnProps: {
  316. fixed: 'left',
  317. width: 220,
  318. slots: { customRender: 'billXuhao' },
  319. title: '序号',
  320. },
  321. rowClassName: (record: any) => {
  322. return record.licensePlateStatus === 1 ? 'licensePlate-error-500' : '';
  323. },
  324. formConfig: {
  325. //labelWidth: 120,
  326. schemas: searchFormSchema,
  327. autoSubmitOnEnter: true,
  328. showAdvancedButton: true,
  329. fieldMapToNumber: [],
  330. fieldMapToTime: [
  331. ['outTime', ['outTime_begin', 'outTime_end'], 'YYYY-MM-DD'],
  332. ['arrivalTime', ['arrivalTime_begin', 'arrivalTime_end'], 'YYYY-MM-DD'],
  333. ],
  334. },
  335. striped: true,
  336. actionColumn: {
  337. width: 340,
  338. title: '操作',
  339. fixed: 'right',
  340. },
  341. pagination: {
  342. pageSizeOptions: ['10', '20', '30'],
  343. },
  344. rowSelection: { type: 'checkbox' },
  345. },
  346. });
  347. const [registerTable, { reload, setLoading }, { rowSelection, selectedRowKeys }] = tableContext;
  348. /**
  349. * 成功回调
  350. */
  351. function handleSuccess() {
  352. (selectedRowKeys.value = []) && reload();
  353. }
  354. // 成功后同时刷新列表和模板
  355. function formSubmitSuccess() {
  356. (selectedRowKeys.value = []) && reload();
  357. }
  358. const changeType = (v) => {
  359. queryParam.value.positionNum = v == 5 ? '1' : '3';
  360. reload();
  361. };
  362. /**
  363. * 新增事件
  364. */
  365. function handleAdd() {
  366. if (!queryParam.value.ccmNo) {
  367. message.error('请选择铸机!');
  368. return;
  369. }
  370. if (!queryParam.value.licensePlate) {
  371. message.error('请选择车号!');
  372. return;
  373. }
  374. if (!queryParam.value.size) {
  375. message.error('请选择定尺!');
  376. return;
  377. }
  378. if (!queryParam.value.destination) {
  379. message.error('请选择目的地!');
  380. return;
  381. }
  382. const destinationInfo = destinationOptions[queryParam.value.ccmNo].find((item) => item.value === queryParam.value.destination);
  383. defHttp
  384. .post(
  385. {
  386. url: '/storageBill/add',
  387. params: { ...queryParam.value, destination: destinationInfo?.label, typeConfigId: destinationInfo?.value },
  388. },
  389. { joinParamsToUrl: true }
  390. )
  391. .then(() => {
  392. handleSuccess();
  393. queryParam.value = {
  394. ccmNo: machine,
  395. licensePlate: '',
  396. btype: '0',
  397. positionNum: Number(machine) === 5 ? '1' : '2',
  398. size: '',
  399. destination: '',
  400. };
  401. });
  402. }
  403. onMounted(() => {
  404. initDictConfig();
  405. // initWebSocket();
  406. });
  407. </script>
  408. <style scoped lang="less">
  409. .shipping-bill-container {
  410. padding: 0 10px;
  411. }
  412. .disabled {
  413. color: rgb(97, 98, 99);
  414. pointer-events: none;
  415. cursor: not-allowed;
  416. }
  417. .default {
  418. cursor: pointer;
  419. color: #1890ff;
  420. }
  421. .show-error {
  422. font-size: 12px;
  423. color: #f5222d;
  424. }
  425. .hidden-error {
  426. display: none;
  427. }
  428. :deep(.ant-table-thead) {
  429. .anticon-form {
  430. display: none;
  431. }
  432. }
  433. :deep(.ant-row) {
  434. margin: 3px 0 !important;
  435. width: 100%;
  436. }
  437. :deep(.jeecg-basic-table-form-container) {
  438. padding: 10px 0;
  439. }
  440. // 假禁点灰色按钮
  441. .disabled-btn {
  442. background: #f5f5f5 !important;
  443. border-color: #d9d9d9 !important;
  444. color: rgba(0, 0, 0, 0.25) !important;
  445. }
  446. // 根据炉号末尾数字判断颜色
  447. :deep(.ant-table-tbody) {
  448. .highlight-row-odd {
  449. background-color: #99beff;
  450. .ant-table-cell-fix-left,
  451. .ant-table-cell-fix-right {
  452. background-color: #99beff;
  453. }
  454. }
  455. .highlight-row-even {
  456. background-color: #99ddff;
  457. .ant-table-cell-fix-left,
  458. .ant-table-cell-fix-right {
  459. background-color: #99ddff;
  460. }
  461. }
  462. .jeecg-basic-table-action {
  463. justify-content: flex-end;
  464. }
  465. }
  466. .form-row {
  467. .ant-form-item {
  468. margin-bottom: 20px;
  469. }
  470. }
  471. .shipping-bill-talbe {
  472. :deep(.licensePlate-error-500) {
  473. position: relative;
  474. td:first-child {
  475. position: relative;
  476. z-index: 8;
  477. // border-bottom: 1px solid var(--vxe-danger-color, #f56c6c) !important;
  478. &::after {
  479. content: '';
  480. position: absolute;
  481. top: 0;
  482. inset-inline-start: 0;
  483. width: 100%;
  484. height: 100%;
  485. box-shadow: inset 5px 0 0 var(--vxe-danger-color, #f56c6c);
  486. }
  487. }
  488. td:last-child {
  489. z-index: 8;
  490. // border-bottom: 1px solid var(--vxe-danger-color, #f56c6c) !important;
  491. }
  492. &::after {
  493. position: absolute;
  494. top: 0;
  495. inset-inline-start: 0;
  496. width: 100%;
  497. height: 100%;
  498. // animation-name: errNoticeAnimation;
  499. // animation-duration: 1.2s;
  500. // animation-iteration-count: infinite;
  501. // animation-timing-function: ease-in-out;
  502. content: '';
  503. z-index: 3;
  504. // box-shadow: inset 5px -1px 0 var(--vxe-danger-color, #f56c6c);
  505. }
  506. }
  507. }
  508. @keyframes errNoticeAnimation {
  509. 0% {
  510. opacity: 1;
  511. }
  512. 100% {
  513. opacity: 0;
  514. }
  515. }
  516. </style>