index.vue 16 KB

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