| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- <template>
- <div class="full-container-p24">
- <div class="df mb10 aic">
- <h5 class="mr20">请选择单据:</h5>
- <el-checkbox
- v-model="isCheckAll"
- @change="checkAll"
- :indeterminate="isIndeterminate"
- size="large"
- style="margin-right: 20px"
- >全选</el-checkbox
- >
- </div>
- <div v-show="fileList?.length" class="df aic fww">
- <div
- style="
- width: 100px;
- text-align: center;
- margin-right: 20px;
- margin-bottom: 20px;
- "
- v-for="item in fileList"
- :key="item.id"
- >
- <el-image
- style="height: 100px; width: 100px"
- fit="contain"
- :src="item.viewUrl"
- :preview-src-list="previewList"
- ></el-image>
- <div style="width: 100px; text-align: center; font-size: 12px">
- {{ item.createTime }}
- </div>
- <div class="tac">
- <el-checkbox
- @change="checkItem"
- v-model="item.checked"
- size="large"
- ></el-checkbox>
- </div>
- </div>
- </div>
- <div
- v-show="!fileList?.length"
- style="text-align: center; font-size: 24px; color: #ccc"
- >
- 暂无单据图片
- </div>
- <div v-if="recordIds.length" class="mb20">
- <h5 class="mb10">请选择单据类型:</h5>
- <div class="df aic distribute-group mb20">
- <el-button
- class="mr20"
- :type="distributeType == 1 ? 'primary' : ''"
- @click="distributeType = 1"
- size="small"
- >运单</el-button
- >
- <el-button
- class="mr20"
- :type="distributeType == 2 ? 'primary' : ''"
- @click="distributeType = 2"
- size="small"
- >磅单</el-button
- >
- <el-button
- class="mr20"
- :type="distributeType == 4 ? 'primary' : ''"
- @click="distributeType = 4"
- size="small"
- >汽运装货单</el-button
- >
- <el-button @click="fail" size="small" type="danger">不通过</el-button>
- </div>
- <div v-if="distributeType != -1" class="mb20">
- <h5 class="mb10">请选择卸货港:</h5>
- <div class="df aic distribute-group">
- <el-button
- v-for="(item, index) in discPorts"
- class="mr20"
- :type="distributePortId == item.portId ? 'primary' : ''"
- @click="distributePortId = item.portId"
- size="small"
- >{{ item.portName }}</el-button
- >
- </div>
- </div>
- <div v-show="distributeType == 2">
- <el-form inline :model="distributePoundForm">
- <el-form-item label="卸货时间">
- <el-date-picker
- class="info-line-text"
- v-model="distributePoundForm.dischargeTime"
- type="datetime"
- format="YYYY/MM/DD HH:mm:ss"
- value-format="YYYY/MM/DD HH:mm:ss"
- placeholder="卸货时间"
- ></el-date-picker>
- </el-form-item>
- <el-form-item label="卸货吨位">
- <el-input
- class="info-line-text"
- v-model="distributePoundForm.dischargeTons"
- placeholder="卸货吨位"
- ></el-input>
- </el-form-item>
- <el-form-item label="卸货件数">
- <el-input
- class="info-line-text"
- v-model="distributePoundForm.dischargePieces"
- placeholder="卸货件数"
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- <div v-show="distributeType == 4">
- <div class="tar">
- <el-button @click="ocr" :loading="ocrLoading" type="primary">{{
- ocrLoading ? "正在识别" : "开始识别"
- }}</el-button>
- </div>
- <el-table :data="ocrTruckRecordTableData" stripe max-height="500">
- <el-table-column label="港口名称" min-width="200" align="center">
- <template v-slot="scope">
- <el-input size="small" v-model="scope.row.portName"></el-input>
- </template>
- </el-table-column>
- <!-- <el-table-column label="称重时间" min-width="200" align="center">
- <template v-slot="scope">
- <el-date-picker
- size="small"
- class="info-line-text"
- v-model="scope.row.weighTime"
- type="datetime"
- format="YYYY/MM/DD HH:mm:ss"
- value-format="YYYY/MM/DD HH:mm:ss"
- placeholder="称重时间"
- ></el-date-picker>
- </template>
- </el-table-column> -->
- <el-table-column label="称重时间" min-width="120" align="center">
- <template v-slot="scope">
- <el-input
- :input-style="
- scope.row.weighTime ? {} : { border: '1px solid red' }
- "
- size="small"
- v-model="scope.row.weighTime"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column label="车号" min-width="120" align="center">
- <template v-slot="scope">
- <el-input
- :input-style="
- scope.row.carNum?.length == 7
- ? {}
- : { border: '1px solid red' }
- "
- size="small"
- v-model="scope.row.carNum"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column label="货物名称" min-width="120" align="center">
- <template v-slot="scope">
- <el-input size="small" v-model="scope.row.cargoName"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="发货单位" min-width="200" align="center">
- <template v-slot="scope">
- <el-input
- size="small"
- v-model="scope.row.shippingUnit"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column label="收货单位" min-width="200" align="center">
- <template v-slot="scope">
- <el-input
- :input-style="
- scope.row.receivingUnit ? {} : { border: '1px solid red' }
- "
- size="small"
- v-model="scope.row.receivingUnit"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column label="毛重" min-width="120" align="center">
- <template v-slot="scope">
- <el-input
- :input-style="
- scope.row.grossWeight ? {} : { border: '1px solid red' }
- "
- size="small"
- v-model="scope.row.grossWeight"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column label="皮重" min-width="120" align="center">
- <template v-slot="scope">
- <el-input
- :input-style="scope.row.tare ? {} : { border: '1px solid red' }"
- size="small"
- v-model="scope.row.tare"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column label="净重" min-width="120" align="center">
- <template v-slot="scope">
- <el-input
- :input-style="
- scope.row.netWeight ? {} : { border: '1px solid red' }
- "
- size="small"
- v-model="scope.row.netWeight"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column label="货船名称" min-width="120" align="center">
- <template v-slot="scope">
- <el-input size="small" v-model="scope.row.shipName"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="司磅员" min-width="120" align="center">
- <template v-slot="scope">
- <el-input size="small" v-model="scope.row.weigher"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="查看" min-width="120" align="center">
- <template v-slot="scope">
- <el-image
- style="height: 40px; width: 60px"
- fit="contain"
- :src="scope.row.viewUrl"
- :preview-src-list="ocrImageList"
- ></el-image
- ></template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="df jcfe" v-if="distributeType != -1 && distributeType != 5">
- <el-button size="large" type="primary" @click="submitDistribute"
- >提交</el-button
- >
- </div>
- </div>
- </template>
- <script setup>
- import { ref, h, reactive, toRefs, onMounted } from "vue";
- import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
- import store from "../../store";
- import router from "../../router";
- import md5 from "md5";
- import api from "../../apis/fetch";
- import { useRoute } from "vue-router";
- const route = useRoute();
- let fileList = ref([]);
- let discPorts = ref([]);
- let isCheckAll = ref(false);
- let isIndeterminate = ref(false);
- let previewList = ref([]);
- function checkAll(b) {
- isIndeterminate.value = false;
- fileList.value.forEach((e) => {
- e.checked = b;
- });
- setRecordIds();
- }
- function checkItem() {
- if (
- fileList.value.every((item) => {
- return item.checked;
- })
- ) {
- isCheckAll.value = true;
- isIndeterminate.value = false;
- } else if (
- fileList.value.every((item) => {
- return !item.checked;
- })
- ) {
- isCheckAll.value = false;
- isIndeterminate.value = false;
- } else {
- isIndeterminate.value = true;
- }
- setRecordIds();
- }
- function setRecordIds() {
- let arr0 = [];
- for (let i of fileList.value) {
- if (i.checked) {
- checkedPreviewList.value.push(i.viewUrl);
- arr0.push(i.id);
- }
- }
- recordIds.value = arr0.join(",");
- ocrTruckRecordTableData.value = [];
- }
- async function getBill() {
- let res = await api.getBill({
- voyageId: route.query.id,
- });
- fileList.value = res.data.result;
- for (let i of fileList.value || []) {
- previewList.value.push(i.viewUrl);
- }
- }
- let distributeType = ref(-1);
- let distributePortId = ref(-1);
- let distributePoundForm = ref({});
- let ocrLoading = ref(false);
- let ocrImageList = ref([]);
- let checkedPreviewList = ref([]);
- let recordIds = ref("");
- let ocrTruckRecordTableData = ref([]);
- async function ocr() {
- ocrLoading.value = true;
- ocrImageList.value = [];
- let res = await api.ocr({
- recordIds: recordIds.value,
- });
- ocrLoading.value = false;
- ocrTruckRecordTableData.value = res.data.result;
- for (let i of ocrTruckRecordTableData.value) {
- if (i.weighTime) i.weighTime = i.weighTime.substring(0, 10);
- ocrImageList.value.push(i.viewUrl);
- }
- }
- async function fail() {
- let res = await api.distribute({
- voyageId: route.query.id,
- recordIds: recordIds.value,
- type: 5,
- });
- console.log(res);
- distributeType.value = -1;
- recordIds.value = [];
- distributePortId.value = -1;
- ocrTruckRecordTableData.value = [];
- isCheckAll.value = false;
- isIndeterminate.value = false;
- getBill();
- }
- async function submitDistribute() {
- if (recordIds.value.length == 0) {
- ElMessage({
- type: "error",
- message: "请选择要分配的图片!",
- });
- return;
- }
- if (distributeType.value == -1) {
- ElMessage({
- type: "error",
- message: "请选择要分配类型!",
- });
- return;
- }
- if (distributePortId.value == -1) {
- ElMessage({
- type: "error",
- message: "请选择要分配的港口!",
- });
- return;
- }
- let postData = {};
- let type = distributeType.value;
- if (2 == type) {
- if (
- !distributePoundForm.value.dischargeTime ||
- !distributePoundForm.value.dischargeTons
- ) {
- ElMessage({
- type: "error",
- message: "卸货时间和吨位必填!",
- });
- return;
- }
- postData = {
- poundBillData: {
- ...distributePoundForm.value,
- portId: distributePortId.value,
- },
- };
- } else if (4 == type) {
- if (!ocrTruckRecordTableData.value.length) {
- ElMessage({
- type: "error",
- message: "请识别装货单!",
- });
- return;
- }
- for (let i of ocrTruckRecordTableData.value) {
- i.portId = distributePortId.value;
- }
- postData = { carLoadDatas: ocrTruckRecordTableData.value };
- }
- console.log(postData, route.query.id, recordIds.value, type);
- let res = await api.distribute({
- ...postData,
- voyageId: route.query.id,
- recordIds: recordIds.value,
- type,
- });
- if (res.data.status == 0) {
- ElMessage({
- type: "success",
- message: res.data.msg,
- });
- } else {
- ElMessage({
- type: "info",
- message: res.data.msg,
- });
- }
- distributeType.value = -1;
- recordIds.value = [];
- distributePortId.value = -1;
- ocrTruckRecordTableData.value = [];
- isCheckAll.value = false;
- isIndeterminate.value = false;
- getBill();
- }
- onMounted(() => {
- discPorts.value = JSON.parse(route.query.discPorts);
- getBill();
- });
- </script>
- <style scoped>
- </style>
|