| | |
| | | method: "DELETE", |
| | | }); |
| | | }, |
| | | |
| | | // å é¤ç»çº¿æ¥å·¥ |
| | | deleteWireOutput(params: { id: number }) { |
| | | // å°åæ°æ¼æ¥å° URL ä½ä¸º query åæ° |
| | | const queryString = `?id=${params.id}`; |
| | | return request<BaseResult<any>>({ |
| | | url: `/strandedWire/deleteWireOutput${queryString}`, |
| | | method: "DELETE", |
| | | }); |
| | | }, |
| | | }; |
| | | |
| | | export default TwistApi; |
| | |
| | | </wd-tag> |
| | | </view> |
| | | </template> |
| | | <wd-row class="my-2" v-if="data[map.systemNo]"> |
| | | <wd-col :span="24"> |
| | | <view class="flex"> |
| | | <view class="icon_box"> |
| | | <wd-icon name="folder" color="#0D867F"></wd-icon> |
| | | </view> |
| | | <text class="text-[#646874] mx-2"> |
| | | è´¨é追溯å·: |
| | | <text class="text-[#252525]">{{ data[map.systemNo] }}</text> |
| | | </text> |
| | | </view> |
| | | </wd-col> |
| | | </wd-row> |
| | | <wd-row class="my-2"> |
| | | <wd-col :span="12"> |
| | | <view class="flex"> |
| | |
| | | <template> |
| | | <view class="statistics_box"> |
| | | <wd-row> |
| | | <!-- <wd-row> |
| | | <wd-col :span="12"> |
| | | <view class="h_48 px-4 flex items-center"> |
| | | <view class="icon_box"> |
| | |
| | | <text class="text-lg text-[#339599] ml-2 font-semibold">87%</text> |
| | | </view> |
| | | </wd-col> |
| | | </wd-row> |
| | | </wd-row> --> |
| | | </view> |
| | | </template> |
| | | <style scoped lang="scss"> |
| | |
| | | :map="{ |
| | | deviceModel: 'deviceModel', |
| | | model: 'model', |
| | | systemNo: 'systemNo', |
| | | totalAmount: 'totalAmount', |
| | | amount: 'amount', |
| | | unAmount: 'unAmount', |
| | |
| | | const cardData = reactive({ |
| | | deviceModel: undefined, |
| | | model: undefined, |
| | | systemNo: undefined, |
| | | totalAmount: undefined, |
| | | amount: undefined, |
| | | unAmount: undefined, |
| | |
| | | }); |
| | | cardData.deviceModel = data.deviceModel; |
| | | cardData.model = data.model; |
| | | cardData.systemNo = data.systemNo; |
| | | cardData.totalAmount = data.totalLength; |
| | | cardData.amount = data.length; |
| | | cardData.unAmount = data.unLength; |
| | |
| | | :map="{ |
| | | deviceModel: 'deviceModel', |
| | | model: 'model', |
| | | systemNo: 'systemNo', |
| | | totalAmount: 'totalAmount', |
| | | amount: 'amount', |
| | | unAmount: 'unAmount', |
| | |
| | | const cardData = reactive({ |
| | | deviceModel: undefined, |
| | | model: undefined, |
| | | systemNo: undefined, |
| | | totalAmount: undefined, |
| | | amount: undefined, |
| | | unAmount: undefined, |
| | |
| | | }); |
| | | cardData.deviceModel = data.deviceModel; |
| | | cardData.model = data.model; |
| | | cardData.systemNo = data.systemNo; |
| | | cardData.totalAmount = data.totalAmount; |
| | | cardData.amount = data.amount; |
| | | cardData.unAmount = data.unAmount; |
| | |
| | | <view> |
| | | <wd-row> |
| | | <wd-col :span="21"> |
| | | <wd-search placeholder-left hide-cancel></wd-search> |
| | | <wd-search |
| | | v-model="searchKeyword" |
| | | placeholder="请è¾å
¥è§æ ¼åå·" |
| | | placeholder-left |
| | | hide-cancel |
| | | @search="handleSearch" |
| | | @clear="handleClear" |
| | | ></wd-search> |
| | | </wd-col> |
| | | <wd-col :span="3"> |
| | | <view class="scan_box" @click="openScan"> |
| | |
| | | <wd-tab :title="`å¾
ç产(${total.wait})`" class="tab_bg"> |
| | | <ProductList |
| | | ref="waitRef" |
| | | :key="`wait-${searchKey}`" |
| | | :api="ManageApi.getProductList" |
| | | state="å¾
宿" |
| | | :model="searchKeyword" |
| | | @ok="changeWait" |
| | | /> |
| | | </wd-tab> |
| | | <wd-tab :title="`é¨å宿(${total.partial})`" class="tab_bg"> |
| | | <ProductList |
| | | ref="partialRef" |
| | | :key="`partial-${searchKey}`" |
| | | :api="ManageApi.getProductList" |
| | | state="é¨å宿" |
| | | :model="searchKeyword" |
| | | @ok="changePartial" |
| | | /> |
| | | </wd-tab> |
| | | <wd-tab :title="`å·²ç产(${total.already})`" class="tab_bg"> |
| | | <ProductList |
| | | ref="alreadyRef" |
| | | :key="`already-${searchKey}`" |
| | | :api="ManageApi.getProductList" |
| | | state="已宿" |
| | | :model="searchKeyword" |
| | | @ok="changeAlready" |
| | | /> |
| | | </wd-tab> |
| | |
| | | const toast = useToast(); |
| | | |
| | | const waitRef = ref(); |
| | | const partialRef = ref(); |
| | | const alreadyRef = ref(); |
| | | const tab = ref<number>(0); |
| | | const searchKeyword = ref(""); |
| | | const searchKey = ref(0); |
| | | const total = reactive({ |
| | | wait: 0, |
| | | partial: 0, |
| | | already: 0, |
| | | }); |
| | | |
| | |
| | | total.wait = num; |
| | | }; |
| | | |
| | | const changePartial = (num: number) => { |
| | | total.partial = num; |
| | | }; |
| | | |
| | | const changeAlready = (num: number) => { |
| | | total.already = num; |
| | | }; |
| | | |
| | | const handleSearch = () => { |
| | | searchKey.value++; |
| | | }; |
| | | |
| | | const handleClear = () => { |
| | | searchKeyword.value = ""; |
| | | handleSearch(); |
| | | }; |
| | | |
| | | const openScan = () => { |
| | | scanRef.value.triggerScan(); |
| | | }; |
| | |
| | | const map = reactive({ |
| | | deviceModel: "deviceModel", |
| | | model: "model", |
| | | systemNo: "systemNo", |
| | | totalAmount: "totalAmount", |
| | | amount: "amount", |
| | | unAmount: "unAmount", |
| | |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | model: { |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | }); |
| | | |
| | | const emits = defineEmits(["ok"]); |
| | | const list = ref<any[]>([]); |
| | | |
| | | const toDetail = (id: number, type: string) => { |
| | | toast.show("ç¹å»å¡ç"); |
| | | // toast.show("ç¹å»å¡ç"); |
| | | if (type == "æä¸") { |
| | | uni.navigateTo({ |
| | | url: `/pages/production/detail/wireDetail?id=${id}`, |
| | |
| | | }; |
| | | |
| | | const getList = async (pageNo: number, pageSize: number) => { |
| | | const { code, data } = await props.api({ |
| | | const params: any = { |
| | | userName: userInfo.value.userName, |
| | | state: props.state, |
| | | current: pageNo, |
| | | size: pageSize, |
| | | }); |
| | | }; |
| | | if (props.model) { |
| | | params.model = props.model; |
| | | } |
| | | const { code, data } = await props.api(params); |
| | | if (code == 200) { |
| | | if (data.type == "ç»çº¿") { |
| | | map.deviceModel = "deviceModel"; |
| | | map.model = "model"; |
| | | map.systemNo = "systemNo"; |
| | | map.totalAmount = "totalLength"; |
| | | map.amount = "length"; |
| | | map.unAmount = "unLength"; |
| | | } else if (data.type == "æä¸") { |
| | | map.deviceModel = "deviceModel"; |
| | | map.model = "model"; |
| | | map.systemNo = "systemNo"; |
| | | map.totalAmount = "totalAmount"; |
| | | map.amount = "amount"; |
| | | map.unAmount = "unAmount"; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <wd-row> |
| | | <wd-col v-for="(item, index) in data" :key="index" :span="item.span || 24" class="my-1"> |
| | | <view class="flex w-full h-[20px]"> |
| | | <view class="text-[#646874] pl-1 mr-3">{{ item.label }}</view> |
| | | <view class="font-medium pr-1" :style="{ color: item.color ?? color }"> |
| | | {{ value[item.prop] }} {{ value[item.unitProp] }} {{ item.unit }} |
| | | </view> |
| | | </view> |
| | | </wd-col> |
| | | </wd-row> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | defineProps({ |
| | | data: { |
| | | type: Array as any, |
| | | default: () => { |
| | | return []; |
| | | }, |
| | | }, |
| | | value: { |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | }, |
| | | }, |
| | | color: { |
| | | type: String, |
| | | default: "#333333", |
| | | }, |
| | | unit: { |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | }); |
| | | </script> |
| | |
| | | <wd-form ref="form" :model="model" class="relative form_box"> |
| | | <wd-cell-group :border="true"> |
| | | <wd-input |
| | | v-model="model.contractNo" |
| | | label="é¢ç¨æå·" |
| | | label-width="100px" |
| | | prop="contractNo" |
| | | clearable |
| | | placeholder="请è¾å
¥é¢ç¨æå·" |
| | | /> |
| | | <wd-input |
| | | v-model="model.status" |
| | | label="æé(kg)" |
| | | label-width="100px" |
| | | prop="status" |
| | | clearable |
| | | placeholder="请è¾å
¥æé" |
| | | /> |
| | | <wd-input |
| | | v-model="model.clientName" |
| | | label="åä¸çå·" |
| | | label-width="100px" |
| | | prop="clientName" |
| | | clearable |
| | | placeholder="请è¾å
¥åä¸çå·" |
| | | /> |
| | | <wd-input |
| | | v-model="model.workbench" |
| | | label="å®é
éé(kg)" |
| | | label-width="100px" |
| | | prop="workbench" |
| | | clearable |
| | | placeholder="请è¾å
¥å®é
éé" |
| | | /> |
| | | <wd-input |
| | | v-model="model.quality" |
| | | label="çé¿(m)" |
| | | label-width="100px" |
| | | prop="quality" |
| | | clearable |
| | | placeholder="请è¾å
¥çé¿" |
| | | /> |
| | | <wd-input |
| | | v-model="model.specification" |
| | | label="ç论éé(kg)" |
| | | label-width="100px" |
| | | prop="specification" |
| | | clearable |
| | | placeholder="请è¾å
¥ç论éé" |
| | | /> |
| | | <wd-input |
| | | v-model="model.disc" |
| | | label="è§æ ¼åå·" |
| | | label-width="100px" |
| | | prop="disc" |
| | | clearable |
| | | placeholder="请è¾å
¥è§æ ¼åå·" |
| | | /> |
| | | <wd-input |
| | | v-model="model.actuallyLength" |
| | | label="å®é
çé¿(m)" |
| | | label="ç产é¿åº¦(m)" |
| | | label-width="100px" |
| | | prop="actuallyLength" |
| | | clearable |
| | | placeholder="请è¾å
¥å®é
çé¿" |
| | | /> |
| | | placeholder="请è¾å
¥ç产é¿åº¦" |
| | | type="digit" |
| | | > |
| | | <template #label> |
| | | <span style="color: #f56c6c">ç产é¿åº¦(m)</span> |
| | | </template> |
| | | </wd-input> |
| | | <wd-input |
| | | v-model="model.tare" |
| | | label="çå
·ç®é(kg)" |
| | | label-width="100px" |
| | | prop="tare" |
| | | :disabled="!isFirstReport" |
| | | :clearable="isFirstReport" |
| | | :placeholder="isFirstReport ? '请è¾å
¥çå
·ç®é' : 'çå
·ç®éèªå¨å¸¦åº'" |
| | | type="digit" |
| | | > |
| | | <template #label> |
| | | <span style="color: #f56c6c">çå
·ç®é(kg)</span> |
| | | </template> |
| | | </wd-input> |
| | | </wd-cell-group> |
| | | </wd-form> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { computed, watch } from "vue"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import { useToast } from "wot-design-uni"; |
| | | import { useToast, dayjs } from "wot-design-uni"; |
| | | import TwistApi from "@/api/product/twist"; |
| | | |
| | | // å®ä¹ props |
| | | const props = defineProps<{ |
| | | firstTareValue?: number; |
| | | teamId?: string | number | null; |
| | | isFirstReport?: boolean; // æ¯å¦æ¯ç¬¬ä¸æ¡æ¥å·¥ |
| | | }>(); |
| | | |
| | | // è®¡ç®æ¯å¦æ¯ç¬¬ä¸æ¡æ¥å·¥ |
| | | const isFirstReport = computed(() => props.isFirstReport ?? true); |
| | | |
| | | const paramsId = ref(); |
| | | const toast = useToast(); |
| | | const { form: model } = useFormData({ |
| | | poleNumber: undefined, // é¢ç¨æå· |
| | | poleWeight: undefined, // æé(kg) |
| | | monofilamentNumber: undefined, // åä¸çå· |
| | | actuallyWeight: undefined, // å®é
éé(kg) |
| | | oneLength: undefined, // çé¿(m) |
| | | theoryWeight: undefined, // ç论éé(kg) |
| | | model: undefined, // è§æ ¼åå· |
| | | actuallyLength: undefined, // å®é
çé¿(m) |
| | | const { form: model, resetForm } = useFormData({ |
| | | actuallyLength: undefined, // ç产é¿åº¦(m) |
| | | tare: undefined, // çå
·ç®é(kg) |
| | | }); |
| | | |
| | | // ä¸»è¡¨æ°æ®ï¼ä»ç¶ç»ä»¶ä¼ å
¥ï¼ |
| | | const mainTableData = ref<any>({}); |
| | | |
| | | // è®¾ç½®ä¸»è¡¨æ°æ® |
| | | const setMainTableData = (data: any) => { |
| | | mainTableData.value = data; |
| | | }; |
| | | |
| | | // çå¬ firstTareValue ååï¼å¦æä¸æ¯ç¬¬ä¸æ¡ï¼èªå¨å¡«å
|
| | | watch( |
| | | () => props.firstTareValue, |
| | | (newVal) => { |
| | | if (!isFirstReport.value && newVal !== undefined) { |
| | | model.tare = newVal; |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | |
| | | const submit = async () => { |
| | | const { code } = await TwistApi.addTwistOutput({ |
| | | // è·åç¬¬ä¸æ¡æ°æ®çç®éå¼ï¼ç¨äºåç»æ°å¢çæ¥å·¥ |
| | | const firstTareValue = props.firstTareValue; |
| | | |
| | | // å¦æä¸»è¡¨æ°æ®æªè·åï¼å°è¯éæ°è·å |
| | | if (!mainTableData.value.model) { |
| | | try { |
| | | const { data } = await TwistApi.getTwistDetailById({ |
| | | id: paramsId.value, |
| | | }); |
| | | mainTableData.value = { |
| | | model: data.model, |
| | | totalLength: data.totalLength, |
| | | systemNo: data.systemNo, |
| | | }; |
| | | } catch (error) { |
| | | console.error("è·åä¸»è¡¨æ°æ®å¤±è´¥:", error); |
| | | toast.error("è·åè§æ ¼åå·æ°æ®å¤±è´¥ï¼è¯·éè¯"); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // 忬¡æ£æ¥ä¸»è¡¨æ°æ® |
| | | if (!mainTableData.value.model) { |
| | | toast.error("è§æ ¼åå·æ°æ®æªè·åï¼è¯·éè¯"); |
| | | return false; |
| | | } |
| | | |
| | | const submitData = { |
| | | teamId: props.teamId || null, |
| | | wireId: paramsId.value, |
| | | ...model, |
| | | }); |
| | | type: "ç»çº¿", |
| | | actuallyLength: model.actuallyLength, |
| | | tare: model.tare || firstTareValue, |
| | | // ä»ä¸»è¡¨è·åçåæ®µ |
| | | model: mainTableData.value.model, // è§æ ¼åå· |
| | | oneLength: mainTableData.value.totalLength, |
| | | systemNo: mainTableData.value.systemNo, |
| | | monofilamentNumber: undefined, // æ¹æ¬¡å·ï¼å端èªå¨çæï¼ |
| | | // çäº§æ¥æèªå¨è®¾ç½®ä¸ºå½åæ¶é´ |
| | | productTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), |
| | | }; |
| | | |
| | | // è°è¯æ¥å¿ |
| | | console.log("æäº¤æ°æ®:", submitData); |
| | | console.log("ä¸»è¡¨æ°æ®:", mainTableData.value); |
| | | |
| | | const { code } = await TwistApi.addTwistOutput(submitData); |
| | | if (code == 200) { |
| | | toast.success("æäº¤æå"); |
| | | resetForm(); |
| | | return true; |
| | | } else { |
| | | toast.error("æäº¤å¤±è´¥"); |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | | // è·åè¡¨åæ°æ® |
| | | const getFormData = () => { |
| | | return { ...model }; |
| | | }; |
| | | |
| | | onLoad((options: any) => { |
| | |
| | | |
| | | defineExpose({ |
| | | submit, |
| | | getFormData, |
| | | setMainTableData, |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .form_box { |
| | | } |
| | | .submit_btn { |
| | | position: absolute; |
| | | bottom: 0; |
| | |
| | | <text class="text-[#0D867F] ml-2 font-medium">ç产人</text> |
| | | <text class="text-[#333333] ml-2">{{ item.productUser }}</text> |
| | | </view> |
| | | <view class="text-[#A8A8A8]" @click="toEdit">ç¼è¾</view> |
| | | <!-- <view class="text-[#A8A8A8]" @click="toEdit">ç¼è¾</view> --> |
| | | </view> |
| | | </template> |
| | | <ProductionCard :data="cardAttr" :value="item" /> |
| | | <TwistReportCard :data="cardAttr" :value="item" /> |
| | | <template #footer> |
| | | <wd-button size="small" plain style="margin-right: 10px" @click="toAttachment(item)"> |
| | | éä»¶ |
| | | </wd-button> |
| | | <wd-button size="small" plain @click="handleSelfCheck(item.id)">èªæ£</wd-button> |
| | | <wd-button |
| | | size="small" |
| | | plain |
| | | style="margin-right: 10px" |
| | | @click="handleSelfCheck(item.id)" |
| | | > |
| | | èªæ£ |
| | | </wd-button> |
| | | <wd-button size="small" plain type="error" @click="handleDelete(item)">å é¤</wd-button> |
| | | </template> |
| | | </wd-card> |
| | | </z-paging> |
| | |
| | | <wd-button type="text" @click="cancel">åæ¶</wd-button> |
| | | <wd-button type="text" @click="submit">ç¡®å®</wd-button> |
| | | </view> |
| | | <TwistForm ref="twistFormRef" /> |
| | | <TwistForm |
| | | ref="twistFormRef" |
| | | :first-tare-value="twistReportList.length > 0 ? twistReportList[0].tare : undefined" |
| | | :team-id="teamId" |
| | | :is-first-report="twistReportList.length === 0" |
| | | /> |
| | | </wd-popup> |
| | | <wd-popup v-model="drawFormRef.visible" position="bottom" custom-class="yl-popup"> |
| | | <Draw |
| | |
| | | <script setup lang="ts"> |
| | | import CardTitle from "@/components/card-title/index.vue"; |
| | | import TwistForm from "./form.vue"; |
| | | import { useToast } from "wot-design-uni"; |
| | | import ProductionCard from "../../components/ProductionCard.vue"; |
| | | import { useToast, dayjs } from "wot-design-uni"; |
| | | import TwistReportCard from "../components/TwistReportCard.vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import { ref, reactive } from "vue"; |
| | | import { ref, reactive, nextTick } from "vue"; |
| | | import ManageApi from "@/api/product/manage"; |
| | | import TwistApi from "@/api/product/twist"; |
| | | import Draw from "./draw.vue"; |
| | | import HomeApi from "@/api/home"; |
| | | import { setTeamId, getTeamId } from "@/utils/cache"; |
| | | |
| | | const drawFormRef = reactive({ |
| | | visible: false, |
| | |
| | | |
| | | const cardAttr = ref<any[]>([ |
| | | { |
| | | label: "é¢ç¨æå·", |
| | | prop: "poleNumber", |
| | | }, |
| | | { |
| | | label: "æé(kg)", |
| | | prop: "poleWeight", |
| | | }, |
| | | { |
| | | label: "åä¸çå·", |
| | | label: "æ¹æ¬¡å·", |
| | | prop: "monofilamentNumber", |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "å®é
éé(kg)", |
| | | prop: "actuallyWeight", |
| | | label: "è´¨é追溯å·", |
| | | prop: "systemNo", |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "çé¿(m)", |
| | | prop: "oneLength", |
| | | }, |
| | | { |
| | | label: "ç论éé(kg)", |
| | | prop: "theoryWeight", |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "ç产é¿åº¦(m)", |
| | | prop: "actuallyLength", |
| | | }, |
| | | { |
| | | label: "çå
·ç®é(kg)", |
| | | prop: "tare", |
| | | }, |
| | | { |
| | | label: "çäº§æ¥æ", |
| | | prop: "productTime", |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: "å å·¥æ¶é´(h)", |
| | | prop: "processHour", |
| | | }, |
| | | ]); |
| | | |
| | | const twistReportList = ref<any[]>([]); |
| | | const teamId = ref<string | number | null>(null); |
| | | |
| | | // è·åå¹¶ç¼åçç»ID |
| | | const initTeamId = async () => { |
| | | // å
å°è¯ä»ç¼åè·å |
| | | const cachedTeamId = getTeamId(); |
| | | if (cachedTeamId) { |
| | | teamId.value = cachedTeamId; |
| | | return; |
| | | } |
| | | |
| | | // 妿ç¼å䏿²¡æï¼åè°ç¨æ¥å£è·å |
| | | try { |
| | | const { data } = await HomeApi.getIndex(); |
| | | if (data && data.team) { |
| | | teamId.value = data.team; |
| | | setTeamId(data.team); |
| | | } |
| | | } catch (error) { |
| | | console.error("è·åçç»ID失败:", error); |
| | | } |
| | | }; |
| | | |
| | | const toEdit = () => { |
| | | uni.navigateTo({ |
| | |
| | | }); |
| | | }; |
| | | |
| | | // ä¸»è¡¨æ°æ® |
| | | const mainTableData = ref<any>({}); |
| | | |
| | | // è·åä¸»è¡¨æ°æ® |
| | | const getMainTableData = async () => { |
| | | try { |
| | | const { data } = await TwistApi.getTwistDetailById({ |
| | | id: paramsId.value, |
| | | }); |
| | | mainTableData.value = { |
| | | model: data.model, |
| | | totalLength: data.totalLength, |
| | | systemNo: data.systemNo, |
| | | }; |
| | | // è®¾ç½®ä¸»è¡¨æ°æ®å°è¡¨åç»ä»¶ |
| | | if (twistFormRef.value) { |
| | | twistFormRef.value.setMainTableData(mainTableData.value); |
| | | } |
| | | } catch (error) { |
| | | console.error("è·åä¸»è¡¨æ°æ®å¤±è´¥:", error); |
| | | } |
| | | }; |
| | | |
| | | const addReport = async () => { |
| | | dialog.visible = true; |
| | | // æå¼æ°å¢å¼¹çªæ¶èªå¨æ§è¡ |
| | | // await showDrawPopup(); |
| | | // æ£æ¥æ¯å¦æææ°æ®é½å·²ä¿åï¼é½æidï¼ |
| | | if (twistReportList.value.length > 0 && twistReportList.value.every((item) => item.id)) { |
| | | // ç¡®ä¿ä¸»è¡¨æ°æ®å·²è·å |
| | | if (!mainTableData.value.model) { |
| | | await getMainTableData(); |
| | | } |
| | | dialog.visible = true; |
| | | // çå¾
å¼¹çªæå¼åè®¾ç½®æ°æ® |
| | | await nextTick(); |
| | | if (twistFormRef.value) { |
| | | twistFormRef.value.setMainTableData(mainTableData.value); |
| | | } |
| | | } else if (twistReportList.value.length === 0) { |
| | | // ç¡®ä¿ä¸»è¡¨æ°æ®å·²è·å |
| | | if (!mainTableData.value.model) { |
| | | await getMainTableData(); |
| | | } |
| | | dialog.visible = true; |
| | | // çå¾
å¼¹çªæå¼åè®¾ç½®æ°æ® |
| | | await nextTick(); |
| | | if (twistFormRef.value) { |
| | | twistFormRef.value.setMainTableData(mainTableData.value); |
| | | } |
| | | } else { |
| | | toast.warning("请å
ä¿åæ¬æ¡æ°æ®ï¼åæ°å¢"); |
| | | } |
| | | }; |
| | | |
| | | const submit = async () => { |
| | | // éªè¯å¿
å¡«åæ®µ - æ ¹æ®åè代ç ï¼éè¦æ£æ¥ç产é¿åº¦åçå
·ç®é |
| | | const formData = twistFormRef.value?.getFormData?.() || {}; |
| | | const firstTareValue = |
| | | twistReportList.value.length > 0 ? twistReportList.value[0].tare : undefined; |
| | | |
| | | if (!formData.actuallyLength) { |
| | | toast.warning("请è¾å
¥ç产é¿åº¦ååæäº¤"); |
| | | return; |
| | | } |
| | | |
| | | if (!formData.tare && !firstTareValue) { |
| | | toast.warning("请è¾å
¥çå
·ç®éååæäº¤"); |
| | | return; |
| | | } |
| | | |
| | | const isSuccess = await twistFormRef.value.submit(); |
| | | dialog.visible = !isSuccess; // 妿æäº¤æåï¼å
³éå¼¹çª |
| | | if (isSuccess) { |
| | | // æäº¤æååæ§è¡ |
| | | // showDrawPopup(); |
| | | dialog.visible = false; |
| | | // æäº¤æååå·æ°å表 |
| | | pagingRef.value?.reload(); |
| | | } |
| | | }; |
| | | |
| | | const cancel = () => { |
| | | toast.show("åæ¶"); |
| | | dialog.visible = false; |
| | | }; |
| | | |
| | |
| | | }); |
| | | }; |
| | | |
| | | // å 餿¥å·¥è®°å½ |
| | | const handleDelete = (item: any) => { |
| | | uni.showModal({ |
| | | title: "æç¤º", |
| | | content: "ç¡®å®å é¤åï¼", |
| | | success: async (res) => { |
| | | if (res.confirm) { |
| | | try { |
| | | if (item.id) { |
| | | const { code } = await TwistApi.deleteWireOutput({ id: item.id }); |
| | | if (code == 200) { |
| | | toast.success("å 餿å"); |
| | | // å·æ°å表 |
| | | pagingRef.value?.reload(); |
| | | } else { |
| | | toast.error("å é¤å¤±è´¥"); |
| | | } |
| | | } else { |
| | | toast.warning("该记å½å°æªä¿åï¼æ æ³å é¤"); |
| | | } |
| | | } catch (error) { |
| | | console.error("å é¤å¤±è´¥:", error); |
| | | toast.error("å é¤å¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | } |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | // ä¿çåæçconfirm彿°ï¼ç¨äºå
¶ä»å°æ¹è°ç¨ |
| | | // const confirm = async () => { |
| | | // await showDrawPopup(); |
| | |
| | | wireId: paramsId.value, |
| | | type: "ç»çº¿", |
| | | }); |
| | | // æ ¼å¼åçäº§æ¥æ |
| | | if (Array.isArray(data)) { |
| | | data.forEach((item: any) => { |
| | | if (item.productTime) { |
| | | item.productTime = dayjs(item.productTime).format("YYYY-MM-DD HH:mm:ss"); |
| | | } |
| | | }); |
| | | } |
| | | pagingRef.value.complete(data); |
| | | }; |
| | | |
| | | onLoad((options: any) => { |
| | | onLoad(async (options: any) => { |
| | | paramsId.value = options.id; |
| | | // è·åå¹¶ç¼åçç»ID |
| | | await initTeamId(); |
| | | // è·åä¸»è¡¨æ°æ® |
| | | await getMainTableData(); |
| | | showDrawPopup(); |
| | | }); |
| | | </script> |
| | |
| | | const TOKEN_KEY = "app-token"; |
| | | const USER_INFO_KEY = "user-info"; |
| | | const DICT_KEY = "dict"; |
| | | const TEAM_ID_KEY = "team-id"; |
| | | import { type DictData } from "@/api/system/dict"; |
| | | |
| | | // 设置 token |
| | |
| | | uni.removeStorageSync(DICT_KEY); |
| | | } |
| | | |
| | | // 设置çç»ID |
| | | export function setTeamId(teamId: string | number) { |
| | | uni.setStorageSync(TEAM_ID_KEY, teamId); |
| | | } |
| | | |
| | | // è·åçç»ID |
| | | export function getTeamId(): string | number | null { |
| | | return uni.getStorageSync(TEAM_ID_KEY) || null; |
| | | } |
| | | |
| | | // æ¸
é¤çç»ID |
| | | export function clearTeamId() { |
| | | uni.removeStorageSync(TEAM_ID_KEY); |
| | | } |
| | | |
| | | // æ¸
餿æç¼åä¿¡æ¯ |
| | | export function clearAll() { |
| | | clearToken(); |
| | | clearUserInfo(); |
| | | clearDictCache(); |
| | | clearTeamId(); |
| | | } |