| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="print-input-container"> |
| | | <!-- 页颿 é¢ --> |
| | | <div class="page-title">ç©ææ è¯å¡æå°åæ°è¾å
¥</div> |
| | | |
| | | <!-- 表ååºå --> |
| | | <el-card class="input-card"> |
| | | <el-form |
| | | ref="printFormRef" |
| | | :model="printForm" |
| | | :rules="formRules" |
| | | label-width="100px" |
| | | size="default" |
| | | > |
| | | <!-- ååå¸å± --> |
| | | <el-row :gutter="20"> |
| | | <!-- 第ä¸å --> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æå·" prop="materialCode"> |
| | | <el-input |
| | | v-model="printForm.materialCode" |
| | | placeholder="请è¾å
¥ç©æç¼ç " |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="åå" prop="materialName"> |
| | | <el-input |
| | | v-model="printForm.materialName" |
| | | placeholder="请è¾å
¥ç©æåç§°" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="è§æ ¼" prop="specification"> |
| | | <el-input |
| | | v-model="printForm.specification" |
| | | placeholder="请è¾å
¥ç©æè§æ ¼" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="æ¹å·" prop="batchNumber"> |
| | | <el-input |
| | | v-model="printForm.batchNumber" |
| | | placeholder="请è¾å
¥æ¹å·ï¼çæäºç»´ç ç¨ï¼" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="ååº" prop="factory"> |
| | | <el-input |
| | | v-model="printForm.factory" |
| | | placeholder="请è¾å
¥ååºåç§°" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | <!-- 第äºå --> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºåç¼ç " prop="supplierCode"> |
| | | <el-input |
| | | v-model="printForm.supplierCode" |
| | | placeholder="请è¾å
¥ä¾åºåç¼ç " |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="éè´åå·" prop="purchaseOrderNo"> |
| | | <el-input |
| | | v-model="printForm.purchaseOrderNo" |
| | | placeholder="请è¾å
¥éè´åå·" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="æ°é/æ»æ°" prop="quantityTotal"> |
| | | <el-input |
| | | v-model="printForm.quantityTotal" |
| | | placeholder="ä¾ï¼100/5000" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="æ¹æ¬¡" prop="batch"> |
| | | <el-input |
| | | v-model="printForm.batch" |
| | | placeholder="请è¾å
¥æ¹æ¬¡å·" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="æ¥æ" prop="date"> |
| | | <el-date-picker |
| | | v-model="printForm.date" |
| | | type="date" |
| | | placeholder="éæ©æ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- æ¹éæ·»å ï¼å¯éï¼ --> |
| | | <el-form-item label="æå°ä»½æ°"> |
| | | <el-input-number |
| | | v-model="printCopyCount" |
| | | :min="1" |
| | | :max="50" |
| | | label="份æ°" |
| | | placeholder="请è¾å
¥æå°ä»½æ°" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <!-- æä½æé® --> |
| | | <el-form-item class="form-actions"> |
| | | <el-button type="primary" @click="submitForm">确认并æå¼æå°å¼¹çª</el-button> |
| | | <el-button @click="resetForm">é置表å</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <!-- å¼å
¥æå°å¼¹çªç»ä»¶ --> |
| | | <print-view ref="printViewRef" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // å¼å
¥æå°å¼¹çªç»ä»¶ |
| | | import printView from "@/extension/outbound/extend/printView.vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | export default { |
| | | name: "PrintInputPage", |
| | | components: { printView }, |
| | | data() { |
| | | return { |
| | | // è¡¨åæ°æ®ï¼å¯¹åºprintViewæéçåæ°ï¼ |
| | | printForm: { |
| | | materialCode: "", // æå· |
| | | supplierCode: "", // ä¾åºåç¼ç |
| | | materialName: "", // åå |
| | | purchaseOrderNo: "", // éè´åå· |
| | | specification: "", // è§æ ¼ |
| | | quantityTotal: "", // æ°é/æ»æ° |
| | | batchNumber: "", // æ¹å·ï¼äºç»´ç å
å®¹ï¼ |
| | | batch: "", // æ¹æ¬¡ |
| | | factory: "", // ååº |
| | | date: "", // æ¥æï¼é»è®¤å½åæ¥æï¼ |
| | | }, |
| | | // æå°ä»½æ°ï¼æ¯ææ¹éçæå¤æ¡ç¸åæ°æ®ï¼ |
| | | printCopyCount: 1, |
| | | // 表åéªè¯è§å |
| | | formRules: { |
| | | materialCode: [{ required: true, message: "请è¾å
¥æå·", trigger: "blur" }], |
| | | materialName: [{ required: true, message: "请è¾å
¥åå", trigger: "blur" }], |
| | | batchNumber: [{ required: true, message: "请è¾å
¥æ¹å·", trigger: "blur" }], |
| | | date: [{ required: true, message: "è¯·éæ©æ¥æ", trigger: "change" }], |
| | | }, |
| | | }; |
| | | }, |
| | | mounted() { |
| | | // åå§åé»è®¤æ¥æä¸ºå½å¤© |
| | | const today = new Date(); |
| | | this.printForm.date = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`; |
| | | }, |
| | | methods: { |
| | | // æäº¤è¡¨åï¼æå¼æå°å¼¹çª |
| | | submitForm() { |
| | | this.$refs.printFormRef.validate((valid) => { |
| | | if (!valid) { |
| | | ElMessage.warning("请å®åå¿
填项åæäº¤"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | // æé æå°æ°æ®ï¼æ¯æå¤ä»½ï¼ |
| | | const printData = []; |
| | | for (let i = 0; i < this.printCopyCount; i++) { |
| | | printData.push({ ...this.printForm }); |
| | | } |
| | | |
| | | // è°ç¨printViewçopenæ¹æ³ï¼ä¼ éåæ°å¹¶æå¼å¼¹çª |
| | | this.$refs.printViewRef.open(printData); |
| | | ElMessage.success(`å·²çæ ${this.printCopyCount} 份æå°æ°æ®ï¼å³å°æå¼æå°å¼¹çª`); |
| | | } catch (error) { |
| | | console.error("æå¼æå°å¼¹çªå¤±è´¥ï¼", error); |
| | | ElMessage.error("æå¼æå°å¼¹çªå¤±è´¥ï¼è¯·éè¯"); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // é置表å |
| | | resetForm() { |
| | | this.$refs.printFormRef.resetFields(); |
| | | // éç½®åæ¢å¤é»è®¤æ¥æ |
| | | const today = new Date(); |
| | | this.printForm.date = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`; |
| | | this.printCopyCount = 1; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .print-input-container { |
| | | padding: 20px; |
| | | max-width: 1000px; |
| | | margin: 0 auto; |
| | | } |
| | | |
| | | .page-title { |
| | | font-size: 20px; |
| | | font-weight: bold; |
| | | color: #303133; |
| | | margin-bottom: 20px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .input-card { |
| | | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .form-actions { |
| | | text-align: center; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .form-actions .el-button { |
| | | margin: 0 10px; |
| | | padding: 10px 20px; |
| | | } |
| | | |
| | | /* éé
å°å±å¹ */ |
| | | @media (max-width: 768px) { |
| | | .print-input-container { |
| | | padding: 10px; |
| | | } |
| | | |
| | | .el-form-item { |
| | | margin-bottom: 15px; |
| | | } |
| | | } |
| | | </style> |