| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // å·¥åºç»å®ç产记å½å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/productProcessParameter/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢å·¥åºç产记å½å
³èï¼æ¯ææ¹éï¼ |
| | | // processId æ¾å¨è·¯å¾éï¼body ç´æ¥ä¼ éä¸ççäº§è®°å½æ°ç» |
| | | export function addProductProcessParameter(processId, data) { |
| | | return request({ |
| | | url: `/productProcessParameter/addProductProcessParameter/${processId}`, |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤ï¼æ¯ææ¹é ids æ°ç»ï¼ |
| | | export function del(ids) { |
| | | const idStr = Array.isArray(ids) ? ids.join(",") : ids; |
| | | return request({ |
| | | url: `/productProcessParameter/${idStr}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | | |
| | |
| | | method: "post", |
| | | responseType: "blob", |
| | | }); |
| | | } |
| | | |
| | | // è·åç»å®ç设å¤å表 |
| | | export function getBindDevices(processId) { |
| | | return request({ |
| | | url: "/productProcess/getBindDevices", |
| | | method: "get", |
| | | params: { processId }, |
| | | }); |
| | | } |
| | | |
| | | // ç»å®è®¾å¤ |
| | | export function bindDevices(processId, deviceIds) { |
| | | return request({ |
| | | url: "/productProcess/bindDevices", |
| | | method: "post", |
| | | params: { processId }, |
| | | data: deviceIds, |
| | | }); |
| | | } |
| | | |
| | | // è§£é¤è®¾å¤ç»å® |
| | | export function unbindDevice(processId, deviceId) { |
| | | return request({ |
| | | url: "/productProcess/unbindDevice", |
| | | method: "delete", |
| | | params: { processId, deviceId }, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ç产记å½ï¼åæ°ï¼æ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/productParameter/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/productParameter/addProductParameter", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // ä¿®æ¹ |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/productParameter/updProductParameter", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤ ids 为æ°ç»æ¶ä¼æ¼æ productParameter/1,2,3 |
| | | export function del(ids) { |
| | | const idStr = Array.isArray(ids) ? ids.join(",") : ids; |
| | | return request({ |
| | | url: `/productParameter/${idStr}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | |
| | | type="selection" |
| | | width="55" |
| | | v-if="isSelection" |
| | | :selectable="rowSelectable" |
| | | /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | |
| | |
| | | }, |
| | | }); |
| | | |
| | | // éæ©æ¡ç¦ç¨æ§å¶ï¼è¡å¯¹è±¡ä¸å¦ææ disabled === trueï¼åä¸å
许éä¸ |
| | | const rowSelectable = (row, index) => { |
| | | return !row.disabled; |
| | | }; |
| | | |
| | | |
| | | // Data |
| | | const uploadRefs = ref([]); |
| | | const currentFiles = ref({}); |
| | |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="æ¹å·" |
| | | prop="batchNo" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | } |
| | | ]" |
| | | > |
| | | <el-input v-model="formState.batchNo"/> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="è§æ ¼" |
| | | prop="productModelName" |
| | | > |
| | | <el-input v-model="formState.productModelName" disabled /> |
| | | <el-input v-model="formState.productModelName" disabled/> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="åä½" |
| | | prop="unit" |
| | | > |
| | | <el-input v-model="formState.unit" disabled /> |
| | | <el-input v-model="formState.unit" disabled/> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="å·¥èºè·¯çº¿"> |
| | |
| | | <el-option v-for="item in routeOptions" |
| | | :key="item.id" |
| | | :label="`${item.processRouteCode || ''}`" |
| | | :value="item.id" /> |
| | | :value="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | |
| | | label="é¢è®¡ç产æ°é" |
| | | prop="quantity" |
| | | > |
| | | <el-input-number v-model="formState.quantity" :step="1" :min="1" style="width: 100%" /> |
| | | <el-input-number v-model="formState.quantity" :step="1" :min="1" style="width: 100%"/> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="é¢è®¡æ¥ç¨ï¼å¤©ï¼" |
| | | prop="expectedSchedule" |
| | | > |
| | | <el-input-number v-model="formState.expectedSchedule" :step="0.01" :min="0" style="width: 100%" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="å¶é çç»" |
| | | prop="manufacturingTeam" |
| | | > |
| | | <el-input v-model="formState.manufacturingTeam" disabled /> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | |
| | | productName: "", |
| | | productModelName: "", |
| | | unit: "", |
| | | batchNo: "", |
| | | quantity: 0, |
| | | expectedSchedule: undefined, |
| | | manufacturingTeam: undefined, |
| | | }); |
| | | |
| | | const isShow = computed({ |
| | |
| | | |
| | | const showProductSelectDialog = ref(false); |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | let {proxy} = getCurrentInstance() |
| | | |
| | | const closeModal = () => { |
| | | // éç½®è¡¨åæ°æ® |
| | |
| | | productName: "", |
| | | productModelName: "", |
| | | quantity: '', |
| | | batchNo: "", |
| | | }; |
| | | isShow.value = false; |
| | | }; |
| | |
| | | const product = products[0]; |
| | | formState.value.productId = product.productId; |
| | | formState.value.productName = product.productName; |
| | | const productNameArr = product.productName.split('-'); |
| | | if (productNameArr.length === 3 && productNameArr[0] && productNameArr[1] !== '') { |
| | | formState.value.manufacturingTeam = productNameArr[1].charAt(0) + '类车é´'; |
| | | } |
| | | |
| | | formState.value.productModelName = product.model; |
| | | formState.value.productModelId = product.id; |
| | | formState.value.unit = product.unit; |
| | | showProductSelectDialog.value = false; |
| | | fetchRouteOptions( product.id); |
| | | fetchRouteOptions(product.id); |
| | | // 触å表åéªè¯æ´æ° |
| | | proxy.$refs["formRef"]?.validateField('productModelId'); |
| | | } |
| | |
| | | formState.value.routeId = undefined; |
| | | routeOptions.value = [] |
| | | bindRouteLoading.value = true; |
| | | listProcessRoute({ productModelId: productModelId }).then(res => { |
| | | listProcessRoute({productModelId: productModelId}).then(res => { |
| | | routeOptions.value = res.data || []; |
| | | }).finally(() => { |
| | | bindRouteLoading.value = false; |
| | |
| | | width: '120px', |
| | | }, |
| | | { |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | width: '150px', |
| | | }, |
| | | { |
| | | label: "客æ·åç§°", |
| | | prop: "customerName", |
| | | width: '200px', |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productCategory", |
| | | width: '120px', |
| | |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "é¢è®¡æ¥ç¨ï¼å¤©ï¼", |
| | | prop: "expectedSchedule", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å¶é çç»", |
| | | prop: "manufacturingTeam", |
| | | width: 120, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | |
| | | @pagination="pagination" |
| | | :total="page.total"></PIMTable> |
| | | </div> |
| | | |
| | | <!-- å·¥åºç产记å½åè¡¨å¼¹æ¡ --> |
| | | <el-dialog v-model="isShowProcessParamModal" |
| | | title="ç产记å½" |
| | | width="800px"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <el-button type="primary" |
| | | @click="showSelectProductParamModal">æ°å¢</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDeleteProcessParam" |
| | | :disabled="processParamSelectedRows.length === 0">æ¹éå é¤</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="processParamColumns" |
| | | :tableData="processParamTableData" |
| | | :page="processParamPage" |
| | | :isSelection="true" |
| | | @selection-change="handleProcessParamSelectionChange" |
| | | @pagination="processParamPagination" |
| | | :total="processParamPage.total"></PIMTable> |
| | | </el-dialog> |
| | | |
| | | <!-- éæ©ç产记å½å¼¹æ¡ --> |
| | | <el-dialog v-model="isShowSelectParamModal" |
| | | title="éæ©ç产记å½" |
| | | width="800px"> |
| | | <PIMTable rowKey="id" |
| | | :column="productParamColumns" |
| | | :tableData="productParamTableData" |
| | | :page="productParamPage" |
| | | :isSelection="true" |
| | | @selection-change="handleProductParamSelectionChange" |
| | | @pagination="productParamPagination" |
| | | :total="productParamPage.total"></PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleAddProcessParam">ç¡®å®</el-button> |
| | | <el-button @click="isShowSelectParamModal = false">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ¥ç设å¤å¼¹æ¡ --> |
| | | <el-dialog v-model="isShowDeviceModal" |
| | | title="设å¤å表" |
| | | width="900px"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <el-button type="primary" |
| | | @click="showAddDeviceModal">æ·»å 设å¤</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="deviceColumns" |
| | | :tableData="deviceTableData" |
| | | :page="devicePage" |
| | | :isSelection="false" |
| | | @pagination="devicePagination" |
| | | :total="devicePage.total"></PIMTable> |
| | | </el-dialog> |
| | | |
| | | <!-- æ·»å 设å¤å¼¹æ¡ --> |
| | | <el-dialog v-model="isShowSelectDeviceModal" |
| | | title="éæ©è®¾å¤" |
| | | width="900px"> |
| | | <PIMTable rowKey="id" |
| | | :column="selectDeviceColumns" |
| | | :tableData="selectDeviceTableData" |
| | | :page="selectDevicePage" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectDeviceChange" |
| | | @pagination="selectDevicePagination" |
| | | :total="selectDevicePage.total"></PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleBindDevices">ç¡®å®</el-button> |
| | | <el-button @click="isShowSelectDeviceModal = false">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <new-process v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | @completed="getList" /> |
| | |
| | | del, |
| | | importData, |
| | | downloadTemplate, |
| | | getBindDevices, |
| | | bindDevices, |
| | | unbindDevice, |
| | | } from "@/api/productionManagement/productionProcess.js"; |
| | | import { |
| | | listPage as listProcessParamPage, |
| | | del as delProcessParam, |
| | | addProductProcessParameter, |
| | | } from "@/api/productionManagement/productProcessParameter.js"; |
| | | import { listPage as listProductParamPage } from "@/api/productionManagement/productionRecords.js"; |
| | | import { getLedgerPage } from "@/api/equipmentManagement/ledger.js"; |
| | | import { getToken } from "@/utils/auth"; |
| | | |
| | | const data = reactive({ |
| | |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 280, |
| | | width: 350, |
| | | operation: [ |
| | | { |
| | | name: "æ¥ç", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showProcessParamModal(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "æ¥ç设å¤", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showDeviceModal(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | |
| | | ], |
| | | }, |
| | | ]); |
| | | // å·¥åºå·²ç»å®çç产记å½å表åé
ç½® |
| | | const processParamColumns = ref([ |
| | | { label: "åæ°ç¼ç ", prop: "code" }, |
| | | { label: "忰项", prop: "parameterItem" }, |
| | | { |
| | | label: "åæ°ç±»å", |
| | | prop: "type", |
| | | formatData: val => { |
| | | const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || []; |
| | | const list = dictList.value || dictList; |
| | | const hit = (list || []).find(d => d.value === val); |
| | | return hit ? hit.label : val; |
| | | }, |
| | | }, |
| | | { label: "åä½", prop: "unit" }, |
| | | { label: "åæ°æ ¼å¼", prop: "parameterFormat" }, |
| | | { |
| | | label: "æ¯å¦å¿
å¡«", |
| | | prop: "isRequired", |
| | | formatData: v => (v === "1" || v === 1 ? "æ¯" : "å¦"), |
| | | }, |
| | | ]); |
| | | // å¯éæ©çç产记å½å表åé
ç½® |
| | | const productParamColumns = ref([ |
| | | { label: "åæ°ç¼ç ", prop: "code" }, |
| | | { label: "忰项", prop: "parameterItem" }, |
| | | { |
| | | label: "åæ°ç±»å", |
| | | prop: "type", |
| | | formatData: val => { |
| | | const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || []; |
| | | const list = dictList.value || dictList; |
| | | const hit = (list || []).find(d => d.value === val); |
| | | return hit ? hit.label : val; |
| | | }, |
| | | }, |
| | | { label: "åä½", prop: "unit" }, |
| | | { label: "åæ°æ ¼å¼", prop: "parameterFormat" }, |
| | | { |
| | | label: "æ¯å¦å¿
å¡«", |
| | | prop: "isRequired", |
| | | formatData: v => (v === "1" || v === 1 ? "æ¯" : "å¦"), |
| | | }, |
| | | ]); |
| | | |
| | | // 设å¤å表åé
ç½® |
| | | const deviceColumns = ref([ |
| | | { label: "设å¤åç§°", prop: "deviceName" }, |
| | | { label: "è§æ ¼åå·", prop: "deviceModel" }, |
| | | { label: "设å¤åç", prop: "deviceBrand" }, |
| | | { label: "设å¤ç±»å", prop: "type" }, |
| | | { label: "ä¾åºå", prop: "supplierName" }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | width: 100, |
| | | operation: [ |
| | | { |
| | | name: "å é¤", |
| | | type: "text", |
| | | typeAttrs: { danger: true }, |
| | | clickFun: row => { |
| | | handleUnbindDevice(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | |
| | | // å¯é设å¤å表åé
ç½® |
| | | const selectDeviceColumns = ref([ |
| | | { label: "设å¤åç§°", prop: "deviceName" }, |
| | | { label: "è§æ ¼åå·", prop: "deviceModel" }, |
| | | { label: "设å¤åç", prop: "deviceBrand" }, |
| | | { label: "设å¤ç±»å", prop: "type" }, |
| | | { label: "ä¾åºå", prop: "supplierName" }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const isShowNewModal = ref(false); |
| | | const isShowEditModal = ref(false); |
| | | const isShowProcessParamModal = ref(false); |
| | | const isShowSelectParamModal = ref(false); |
| | | const record = ref({}); |
| | | const currentProcess = ref(null); |
| | | const importDialogVisible = ref(false); |
| | | const importDialogRef = ref(null); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const processParamPage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const productParamPage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const processParamTableData = ref([]); |
| | | const productParamTableData = ref([]); |
| | | const processParamSelectedRows = ref([]); |
| | | const productParamSelectedRows = ref([]); |
| | | |
| | | // 设å¤ç¸å
³åé |
| | | const isShowDeviceModal = ref(false); |
| | | const isShowSelectDeviceModal = ref(false); |
| | | const deviceTableData = ref([]); |
| | | const selectDeviceTableData = ref([]); |
| | | const selectedDeviceRows = ref([]); |
| | | const devicePage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const selectDevicePage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const processParamPagination = obj => { |
| | | processParamPage.current = obj.page; |
| | | processParamPage.size = obj.limit; |
| | | getProcessParamList(); |
| | | }; |
| | | const productParamPagination = obj => { |
| | | productParamPage.current = obj.page; |
| | | productParamPage.size = obj.limit; |
| | | getProductParamList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | const handleProcessParamSelectionChange = selection => { |
| | | processParamSelectedRows.value = selection; |
| | | }; |
| | | |
| | | const handleProductParamSelectionChange = selection => { |
| | | productParamSelectedRows.value = selection; |
| | | }; |
| | | |
| | | // æå¼æ°å¢å¼¹æ¡ |
| | | const showNewModal = () => { |
| | | isShowNewModal.value = true; |
| | |
| | | record.value = row; |
| | | }; |
| | | |
| | | // æ¥çå½åå·¥åºççäº§è®°å½ |
| | | const showProcessParamModal = row => { |
| | | currentProcess.value = row; |
| | | isShowProcessParamModal.value = true; |
| | | processParamPage.current = 1; |
| | | getProcessParamList(); |
| | | }; |
| | | |
| | | const getProcessParamList = () => { |
| | | if (!currentProcess.value) return; |
| | | const params = { |
| | | processId: currentProcess.value.id, |
| | | ...processParamPage, |
| | | }; |
| | | listProcessParamPage(params).then(res => { |
| | | processParamTableData.value = res.data.records || []; |
| | | processParamPage.total = res.data.total || 0; |
| | | }); |
| | | }; |
| | | |
| | | // å é¤å½åå·¥åºç»å®ççäº§è®°å½ |
| | | const handleDeleteProcessParam = () => { |
| | | const ids = processParamSelectedRows.value.map(item => item.id); |
| | | if (!ids.length) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦å é¤çè®°å½"); |
| | | return; |
| | | } |
| | | proxy.$modal |
| | | .confirm("æ¯å¦ç¡®è®¤å é¤éä¸çç产记å½ï¼") |
| | | .then(() => delProcessParam(ids)) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getProcessParamList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // æå¼éæ©ç产记å½å¼¹æ¡ |
| | | const showSelectProductParamModal = () => { |
| | | isShowSelectParamModal.value = true; |
| | | productParamPage.current = 1; |
| | | getProductParamList(); |
| | | }; |
| | | |
| | | const getProductParamList = () => { |
| | | const params = { |
| | | ...productParamPage, |
| | | }; |
| | | listProductParamPage(params).then(res => { |
| | | const records = res.data.records || []; |
| | | // å·²ç»å®å°å½åå·¥åºçç产记å½ï¼ä¸å
è®¸åæ¬¡éæ© -> æ ¹æ®åæ°ç¼ç æä¸ disabled æ è®° |
| | | const boundCodeSet = new Set( |
| | | (processParamTableData.value || []) |
| | | .map(item => item.code ?? item.parameterCode) |
| | | .filter(code => !!code) |
| | | ); |
| | | productParamTableData.value = records.map(item => ({ |
| | | ...item, |
| | | disabled: item.code ? boundCodeSet.has(item.code) : false, |
| | | })); |
| | | productParamPage.total = res.data.total || 0; |
| | | }); |
| | | }; |
| | | |
| | | // 确认ç»å½åå·¥åºæ°å¢çäº§è®°å½ |
| | | const handleAddProcessParam = () => { |
| | | if (!currentProcess.value) return; |
| | | const selectedList = productParamSelectedRows.value || []; |
| | | if (!selectedList.length) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦ç»å®çç产记å½"); |
| | | return; |
| | | } |
| | | // processId æ¾å¨è·¯å¾éï¼body ç´æ¥ä¼ éä¸ççäº§è®°å½æ°ç» |
| | | addProductProcessParameter(currentProcess.value.id, selectedList) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | isShowSelectParamModal.value = false; |
| | | getProcessParamList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // æ¥ç设å¤å¼¹æ¡ |
| | | const showDeviceModal = row => { |
| | | currentProcess.value = row; |
| | | isShowDeviceModal.value = true; |
| | | devicePage.current = 1; |
| | | getDeviceList(); |
| | | }; |
| | | |
| | | // è·åå·²ç»å®ç设å¤å表 |
| | | const getDeviceList = () => { |
| | | if (!currentProcess.value) return; |
| | | getBindDevices(currentProcess.value.id) |
| | | .then(res => { |
| | | deviceTableData.value = res.data || []; |
| | | devicePage.total = res.data?.length || 0; |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // 设å¤å表å页 |
| | | const devicePagination = obj => { |
| | | devicePage.current = obj.page; |
| | | devicePage.size = obj.limit; |
| | | getDeviceList(); |
| | | }; |
| | | |
| | | // è§£ç»è®¾å¤ |
| | | const handleUnbindDevice = row => { |
| | | if (!currentProcess.value) return; |
| | | proxy.$modal.confirm("æ¯å¦ç¡®è®¤è§£ç»è¯¥è®¾å¤ï¼") |
| | | .then(() => { |
| | | return unbindDevice(currentProcess.value.id, row.id); |
| | | }) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("è§£ç»æå"); |
| | | getDeviceList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // æå¼æ·»å 设å¤å¼¹æ¡ |
| | | const showAddDeviceModal = () => { |
| | | isShowSelectDeviceModal.value = true; |
| | | selectDevicePage.current = 1; |
| | | selectedDeviceRows.value = []; |
| | | getSelectDeviceList(); |
| | | }; |
| | | |
| | | // è·åå¯é设å¤å表 |
| | | const getSelectDeviceList = () => { |
| | | if (!currentProcess.value) return; |
| | | // å
è·åå·²ç»å®ç设å¤ID |
| | | getBindDevices(currentProcess.value.id) |
| | | .then(res => { |
| | | const boundDeviceIds = new Set( |
| | | (res.data || []).map(item => item.id).filter(id => !!id) |
| | | ); |
| | | // è·å设å¤å°è´¦å页å表 |
| | | return getLedgerPage(selectDevicePage).then(deviceRes => { |
| | | const allDevices = deviceRes.data?.records || []; |
| | | // è¿æ»¤æå·²ç»å®ç设å¤ï¼å¹¶æ 记为disabled |
| | | selectDeviceTableData.value = allDevices.map(item => ({ |
| | | ...item, |
| | | disabled: boundDeviceIds.has(item.id), |
| | | })); |
| | | selectDevicePage.total = deviceRes.data?.total || 0; |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // éæ©è®¾å¤åå |
| | | const handleSelectDeviceChange = selection => { |
| | | selectedDeviceRows.value = selection; |
| | | }; |
| | | |
| | | // éæ©è®¾å¤å页 |
| | | const selectDevicePagination = obj => { |
| | | selectDevicePage.current = obj.page; |
| | | selectDevicePage.size = obj.limit; |
| | | getSelectDeviceList(); |
| | | }; |
| | | |
| | | // ç»å®è®¾å¤ |
| | | const handleBindDevices = () => { |
| | | if (!currentProcess.value) return; |
| | | const selectedList = selectedDeviceRows.value || []; |
| | | if (!selectedList.length) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦ç»å®ç设å¤"); |
| | | return; |
| | | } |
| | | const deviceIds = selectedList.map(item => item.id); |
| | | bindDevices(currentProcess.value.id, deviceIds) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("ç»å®æå"); |
| | | isShowSelectDeviceModal.value = false; |
| | | getDeviceList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // å é¤ |
| | | function handleDelete() { |
| | | const no = selectedRows.value.map(item => item.no); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="ç¼è¾ç产记å½" |
| | | width="520px" |
| | | @close="closeModal" |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | label-width="120px" |
| | | :model="formState" |
| | | label-position="top" |
| | | > |
| | | <el-form-item |
| | | label="忰项" |
| | | prop="parameterItem" |
| | | :rules="[{ required: true, message: '请è¾å
¥åæ°é¡¹' }]" |
| | | > |
| | | <el-input v-model="formState.parameterItem" placeholder="请è¾å
¥åæ°é¡¹" /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="åæ°ç±»å" |
| | | prop="type" |
| | | :rules="[{ required: true, message: 'è¯·éæ©åæ°ç±»å' }]" |
| | | > |
| | | <el-select v-model="formState.type" placeholder="è¯·éæ©åæ°ç±»å" style="width: 100%;"> |
| | | <el-option |
| | | v-for="dict in parameter_tyep" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="åä½" |
| | | prop="unit" |
| | | :rules="[{ required: true, message: '请è¾å
¥åä½' }]" |
| | | > |
| | | <el-input v-model="formState.unit" placeholder="请è¾å
¥åä½" /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°æ ¼å¼" prop="parameterFormat"> |
| | | <el-input v-model="formState.parameterFormat" placeholder="请è¾å
¥åæ°æ ¼å¼ï¼éå¡«ï¼" /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="æ¯å¦å¿
å¡«" |
| | | prop="isRequired" |
| | | :rules="[{ required: true, message: 'è¯·éæ©æ¯å¦å¿
å¡«' }]" |
| | | > |
| | | <el-select v-model="formState.isRequired" placeholder="è¯·éæ©" style="width: 100%;"> |
| | | <el-option label="æ¯" value="1" /> |
| | | <el-option label="å¦" value="0" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, getCurrentInstance, watch } from "vue"; |
| | | import { update } from "@/api/productionManagement/productionRecords.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | record: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(["update:visible", "completed"]); |
| | | |
| | | const formRef = ref(null); |
| | | const formState = ref({ |
| | | id: undefined, |
| | | code: "", |
| | | parameterItem: "", |
| | | type: "", |
| | | unit: "", |
| | | parameterFormat: "", |
| | | isRequired: undefined, |
| | | }); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit("update:visible", val); |
| | | }, |
| | | }); |
| | | |
| | | // åæ¾ï¼çå¬ record åå |
| | | watch( |
| | | () => props.record, |
| | | (newRecord) => { |
| | | if (newRecord && Object.keys(newRecord).length) { |
| | | formState.value = { |
| | | id: newRecord.id, |
| | | code: newRecord.code ?? "", |
| | | parameterItem: newRecord.parameterItem ?? "", |
| | | type: newRecord.type ?? "", |
| | | unit: newRecord.unit ?? "", |
| | | parameterFormat: newRecord.parameterFormat ?? "", |
| | | isRequired: newRecord.isRequired, |
| | | }; |
| | | } |
| | | }, |
| | | { immediate: true, deep: true } |
| | | ); |
| | | |
| | | // å¼¹çªæå¼æ¶éæ°åæ¾ |
| | | watch( |
| | | () => props.visible, |
| | | (visible) => { |
| | | if (visible && props.record && Object.keys(props.record).length) { |
| | | formState.value = { |
| | | id: props.record.id, |
| | | code: props.record.code ?? "", |
| | | parameterItem: props.record.parameterItem ?? "", |
| | | type: props.record.type ?? "", |
| | | unit: props.record.unit ?? "", |
| | | parameterFormat: props.record.parameterFormat ?? "", |
| | | isRequired: props.record.isRequired, |
| | | }; |
| | | } |
| | | } |
| | | ); |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const { parameter_tyep } = proxy.useDict("parameter_tyep"); |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | | update(formState.value).then(() => { |
| | | isShow.value = false; |
| | | emit("completed"); |
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="æ°å¢ç产记å½" |
| | | width="520px" |
| | | @close="closeModal" |
| | | > |
| | | <el-form |
| | | ref="formRef" |
| | | label-width="120px" |
| | | :model="formState" |
| | | label-position="top" |
| | | > |
| | | <el-form-item |
| | | label="忰项" |
| | | prop="parameterItem" |
| | | :rules="[{ required: true, message: '请è¾å
¥åæ°é¡¹' }]" |
| | | > |
| | | <el-input v-model="formState.parameterItem" placeholder="请è¾å
¥åæ°é¡¹" /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="åæ°ç±»å" |
| | | prop="type" |
| | | :rules="[{ required: true, message: 'è¯·éæ©åæ°ç±»å' }]" |
| | | > |
| | | <el-select v-model="formState.type" placeholder="è¯·éæ©åæ°ç±»å" style="width: 100%;"> |
| | | <el-option |
| | | v-for="dict in parameter_tyep" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="åä½" |
| | | prop="unit" |
| | | :rules="[{ required: true, message: '请è¾å
¥åä½' }]" |
| | | > |
| | | <el-input v-model="formState.unit" placeholder="请è¾å
¥åä½" /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°æ ¼å¼" prop="parameterFormat"> |
| | | <el-input v-model="formState.parameterFormat" placeholder="请è¾å
¥åæ°æ ¼å¼ï¼éå¡«ï¼" /> |
| | | </el-form-item> |
| | | <el-form-item |
| | | label="æ¯å¦å¿
å¡«" |
| | | prop="isRequired" |
| | | :rules="[{ required: true, message: 'è¯·éæ©æ¯å¦å¿
å¡«' }]" |
| | | > |
| | | <el-select v-model="formState.isRequired" placeholder="è¯·éæ©" style="width: 100%;"> |
| | | <el-option label="æ¯" value="1" /> |
| | | <el-option label="å¦" value="0" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, getCurrentInstance } from "vue"; |
| | | import { add } from "@/api/productionManagement/productionRecords.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(["update:visible", "completed"]); |
| | | |
| | | const formRef = ref(null); |
| | | const formState = ref({ |
| | | parameterItem: "", |
| | | type: "", |
| | | unit: "", |
| | | parameterFormat: "", |
| | | isRequired: undefined, |
| | | }); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit("update:visible", val); |
| | | }, |
| | | }); |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const { parameter_tyep } = proxy.useDict("parameter_tyep"); |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate((valid) => { |
| | | if (valid) { |
| | | add(formState.value).then(() => { |
| | | isShow.value = false; |
| | | emit("completed"); |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- çäº§è®°å½ --> |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="åæ°ç¼ç :"> |
| | | <el-input |
| | | v-model="searchForm.code" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | style="width: 200px;" |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="忰项:"> |
| | | <el-input |
| | | v-model="searchForm.parameterItem" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | style="width: 200px;" |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°ç±»å:"> |
| | | <el-select |
| | | v-model="searchForm.type" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 200px;" |
| | | @change="handleQuery" |
| | | > |
| | | <el-option |
| | | v-for="dict in parameter_tyep" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" class="mb10"> |
| | | <el-button type="primary" @click="showNewModal">æ°å¢</el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total" |
| | | /> |
| | | </div> |
| | | <NewRecord v-if="isShowNewModal" v-model:visible="isShowNewModal" @completed="getList" /> |
| | | <EditRecord |
| | | v-if="isShowEditModal" |
| | | v-model:visible="isShowEditModal" |
| | | :record="record" |
| | | @completed="getList" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import NewRecord from "./New.vue"; |
| | | import EditRecord from "./Edit.vue"; |
| | | import { listPage, del } from "@/api/productionManagement/productionRecords.js"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | code: "", |
| | | parameterItem: "", |
| | | type: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const { proxy } = getCurrentInstance(); |
| | | const { parameter_tyep } = proxy.useDict("parameter_tyep"); |
| | | |
| | | const tableColumn = ref([ |
| | | { label: "åæ°ç¼ç ", prop: "code" }, |
| | | { label: "忰项", prop: "parameterItem" }, |
| | | { |
| | | label: "åæ°ç±»å", |
| | | prop: "type", |
| | | formatData: (params) => |
| | | (parameter_tyep?.value ?? parameter_tyep ?? []).find((d) => String(d.value) === String(params))?.label ?? params, |
| | | }, |
| | | { label: "åä½", prop: "unit" }, |
| | | { label: "åæ°æ ¼å¼", prop: "parameterFormat" }, |
| | | { |
| | | label: "æ¯å¦å¿
å¡«", |
| | | prop: "isRequired", |
| | | formatData: (params) => (params === '1' ? "æ¯" : "å¦"), |
| | | }, |
| | | // { label: "å建人", prop: "createUser" }, |
| | | { label: "åå»ºæ¥æ", prop: "createTime" }, |
| | | // { label: "æ´æ°äºº", prop: "updateUser" }, |
| | | { label: "æ´æ°æ¥æ", prop: "updateTime" }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 160, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => showEditModal(row), |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | type: "text", |
| | | clickFun: (row) => handleDeleteRow(row), |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const isShowNewModal = ref(false); |
| | | const isShowEditModal = ref(false); |
| | | const record = ref({}); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | listPage(params) |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | const data = res.data; |
| | | tableData.value = data?.records ?? (Array.isArray(data) ? data : []); |
| | | page.total = data?.total ?? 0; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const showNewModal = () => { |
| | | isShowNewModal.value = true; |
| | | }; |
| | | |
| | | const showEditModal = (row) => { |
| | | record.value = { ...row }; |
| | | isShowEditModal.value = true; |
| | | }; |
| | | |
| | | const handleDeleteRow = (row) => { |
| | | proxy.$modal |
| | | .confirm(`æ¯å¦ç¡®è®¤å é¤åæ°ç¼ç 为"${row.code}"çæ°æ®ï¼`) |
| | | .then(() => del([row.id])) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| | |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "éå®ååå·", |
| | | prop: "salesContractNo", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | width: 120, |
| | |
| | | readonly |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item label="æå
¥æ»é(kg)" |
| | | prop="totalInvestment"> |
| | | <el-input v-model.number="reportForm.totalInvestment" |
| | | type="number" |
| | | min="1" |
| | | step="1" |
| | | style="width: 300px" |
| | | placeholder="请è¾å
¥æå
¥æ»é" |
| | | @input="handleTotalInvestmentInput" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ¬æ¬¡ç产æ°é" |
| | | prop="quantity"> |
| | | <el-input v-model.number="reportForm.quantity" |
| | |
| | | style="width: 300px" |
| | | placeholder="请è¾å
¥æ¥åºæ°é" |
| | | @input="handleScrapQtyInput" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ£åæ°é" |
| | | prop="inspectedQuantity"> |
| | | <el-input v-model.number="reportForm.inspectedQuantity" |
| | | type="number" |
| | | min="0" |
| | | step="1" |
| | | style="width: 300px" |
| | | placeholder="请è¾å
¥æ£åæ°é" |
| | | @input="handleInspectedQuantity"/> |
| | | </el-form-item> |
| | | <el-form-item label="çç»ä¿¡æ¯"> |
| | | <el-select v-model="reportForm.userId" |
| | |
| | | { |
| | | label: "å·¥åºåç§°", |
| | | prop: "processName", |
| | | }, |
| | | { |
| | | label: "æå
¥æ»é(kg)", |
| | | prop: "totalInvestment", |
| | | }, |
| | | { |
| | | label: "é¢è®¡ç产æ°é", |
| | |
| | | const userOptions = ref([]); |
| | | const reportForm = reactive({ |
| | | planQuantity: 0, |
| | | totalInvestment: 0, |
| | | quantity: null, |
| | | scrapQty: null, |
| | | inspectedQuantity: null, |
| | | userName: "", |
| | | workOrderId: "", |
| | | reportWork: "", |
| | |
| | | productMainId: null, |
| | | }); |
| | | |
| | | // æå
¥æ»ééªè¯è§å |
| | | const validateTotalInvestment = (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === "") { |
| | | callback(new Error("请è¾å
¥æå
¥æ»é")); |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 1) { |
| | | callback(new Error("æå
¥æ»éå¿
须大äºçäº1")); |
| | | return; |
| | | } |
| | | if (reportForm.quantity !== null && reportForm.quantity !== undefined && reportForm.quantity !== "") { |
| | | if (num < Number(reportForm.quantity)) { |
| | | callback(new Error("æå
¥æ»éå¿
é¡»å¤§äºæ¬æ¬¡ç产æ°é")); |
| | | return; |
| | | } |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | // æ¬æ¬¡ç产æ°ééªè¯è§å |
| | | const validateQuantity = (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === "") { |
| | |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // æ´æ°ä¸å¤§äºçäº1 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 1) { |
| | | callback(new Error("æ¬æ¬¡ç产æ°éå¿
须大äºçäº1")); |
| | | return; |
| | | } |
| | | if (reportForm.totalInvestment !== null && reportForm.totalInvestment !== undefined && reportForm.totalInvestment !== "") { |
| | | if (num > Number(reportForm.totalInvestment)) { |
| | | callback(new Error("æ¬æ¬¡ç产æ°éå¿
é¡»å°äºæå
¥æ»é")); |
| | | return; |
| | | } |
| | | } |
| | | callback(); |
| | | }; |
| | |
| | | |
| | | // éªè¯è§å |
| | | const reportFormRules = { |
| | | totalInvestment: [{ required: true, validator: validateTotalInvestment, trigger: "blur" }], |
| | | quantity: [{ required: true, validator: validateQuantity, trigger: "blur" }], |
| | | scrapQty: [{ validator: validateScrapQty, trigger: "blur" }], |
| | | }; |
| | | |
| | | // å¤çæ¬æ¬¡ç产æ°éè¾å
¥ï¼éå¶å¿
须大äºçäº1 |
| | | const handleQuantityInput = value => { |
| | | // å¤çæå
¥æ»éè¾å
¥ |
| | | const handleTotalInvestmentInput = value => { |
| | | if (value === "" || value === null || value === undefined) { |
| | | reportForm.quantity = null; |
| | | reportForm.totalInvestment = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 妿å°äº1ï¼æ¸
é¤ |
| | | if (num < 1) { |
| | | reportForm.quantity = null; |
| | | reportForm.totalInvestment = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | // 妿æ¯å°æ°åæ´æ°é¨å |
| | | if (!Number.isInteger(num)) { |
| | | const intValue = Math.floor(num); |
| | | // 妿忴åå°äº1ï¼æ¸
é¤ |
| | | if (intValue < 1) { |
| | | reportForm.totalInvestment = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | reportForm.totalInvestment = intValue; |
| | | } else { |
| | | reportForm.totalInvestment = num; |
| | | } |
| | | // 妿 quantity æå¼ï¼èªå¨è®¡ç® scrapQty = totalInvestment - quantity |
| | | if (reportForm.quantity !== null && reportForm.quantity !== undefined && reportForm.quantity !== "") { |
| | | const total = Number(reportForm.totalInvestment); |
| | | const qty = Number(reportForm.quantity); |
| | | if (total > qty) { |
| | | reportForm.scrapQty = total - qty; |
| | | } else { |
| | | reportForm.scrapQty = null; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // å¤çæ¬æ¬¡ç产æ°éè¾å
¥ï¼éå¶å¿
须大äºçäº1 |
| | | const handleQuantityInput = value => { |
| | | if (value === "" || value === null || value === undefined) { |
| | | reportForm.quantity = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | if (num < 1) { |
| | | reportForm.quantity = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | if (!Number.isInteger(num)) { |
| | | const intValue = Math.floor(num); |
| | | if (intValue < 1) { |
| | | reportForm.quantity = null; |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | reportForm.quantity = intValue; |
| | | return; |
| | | } else { |
| | | reportForm.quantity = num; |
| | | } |
| | | reportForm.quantity = num; |
| | | // 妿 totalInvestment æå¼ï¼èªå¨è®¡ç® scrapQty = totalInvestment - quantity |
| | | if (reportForm.totalInvestment !== null && reportForm.totalInvestment !== undefined && reportForm.totalInvestment !== "") { |
| | | const total = Number(reportForm.totalInvestment); |
| | | const qty = Number(reportForm.quantity); |
| | | if (total > qty) { |
| | | reportForm.scrapQty = total - qty; |
| | | } else { |
| | | reportForm.scrapQty = null; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // å¤çæ¥åºæ°é |
| | |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // 妿æ¯NaNï¼ä¿æåå¼ |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 妿æ¯è´æ°ï¼æ¸
é¤è¾å
¥ |
| | | if (num < 0) { |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | // 妿æ¯å°æ°ï¼åæ´æ°é¨å |
| | | if (!Number.isInteger(num)) { |
| | | reportForm.scrapQty = Math.floor(num); |
| | | return; |
| | | } |
| | | // ææçéè´æ´æ°ï¼å
æ¬0ï¼ |
| | | reportForm.scrapQty = num; |
| | | }; |
| | | |
| | | const handleInspectedQuantity = value => { |
| | | if (value === "" || value === null || value === undefined) { |
| | | reportForm.inspectedQuantity = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | if (num < 0) { |
| | | reportForm.inspectedQuantity = null; |
| | | return; |
| | | } |
| | | if (!Number.isInteger(num)) { |
| | | reportForm.inspectedQuantity = Math.floor(num); |
| | | return; |
| | | } |
| | | reportForm.inspectedQuantity = num; |
| | | }; |
| | | const currentReportRowData = ref(null); |
| | | const page = reactive({ |
| | |
| | | const showReportDialog = row => { |
| | | currentReportRowData.value = row; |
| | | reportForm.planQuantity = row.planQuantity; |
| | | reportForm.totalInvestment = row.totalInvestment; |
| | | reportForm.quantity = |
| | | row.quantity !== undefined && row.quantity !== null ? row.quantity : null; |
| | | reportForm.productProcessRouteItemId = row.productProcessRouteItemId; |
| | | reportForm.workOrderId = row.id; |
| | | reportForm.reportWork = row.reportWork; |
| | | reportForm.productMainId = row.productMainId; |
| | | reportForm.inspectedQuantity = row.inspectedQuantity; |
| | | reportForm.scrapQty = |
| | | row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null; |
| | | nextTick(() => { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (quantity > reportForm.planQuantity) { |
| | | ElMessageBox.alert("æ¬æ¬¡ç产æ°éä¸è½è¶
è¿å¾
ç产æ°é", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | // if (quantity > reportForm.planQuantity) { |
| | | // ElMessageBox.alert("æ¬æ¬¡ç产æ°éä¸è½è¶
è¿å¾
ç产æ°é", "æç¤º", { |
| | | // confirmButtonText: "ç¡®å®", |
| | | // }); |
| | | // return; |
| | | // } |
| | | |
| | | const submitData = { |
| | | ...reportForm, |
| | |
| | | prop: "productName", |
| | | }, |
| | | { |
| | | label: "æ¹å·", |
| | | prop: "batchNo", |
| | | }, |
| | | { |
| | | label: "æ£åæ°é", |
| | | prop: "inspectedQuantity", |
| | | }, |
| | | { |
| | | label: "请æ£é¨é¨", |
| | | prop: "manufacturingTeam", |
| | | }, |
| | | { |
| | | label: "è§æ ¼åå·", |
| | | prop: "model", |
| | | }, |