Browse Source

标签打印

liqianyi 1 year ago
parent
commit
6d4d232300

+ 21 - 58
src/views/modules/production/components/print-label.vue

@@ -2,44 +2,25 @@
   <div>
   <div>
     <el-dialog
     <el-dialog
       title="标签打印"
       title="标签打印"
-      width="70%"
+      width="50%"
       :close-on-click-modal="false"
       :close-on-click-modal="false"
       :visible.sync="visible">
       :visible.sync="visible">
       <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
       <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
-        <el-row class="my-row">
-          <el-col :span="8">
-            <el-form-item label="物料名称" prop="productName">
-              <el-input v-model="dataForm.productName" placeholder="物料名称"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8" style="padding-left: 10px">
-            <el-form-item label="税率" prop="rate">
-              <el-input-number style="width: 160px" v-model="dataForm.rate" :step="1" :precision="1"/>&nbsp;%
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row class="my-row">
-          <el-col :span="8">
-            <el-form-item label="含税单价" prop="price">
-              <el-input-number v-model="dataForm.price" :precision="1" :step="1" :min="1"></el-input-number>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8" style="padding-left: 10px">
-            <el-form-item label="数量" prop="cnt">
-              <el-input-number v-model="dataForm.cnt" :min="1" :step="1"></el-input-number>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8" style="padding-left: 10px">
-            <el-form-item label="含税总价" prop="amount">
-              <span>{{ (dataForm.cnt * dataForm.price).toFixed(1) }}</span>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-form-item label="备注" prop="notes">
-            <el-input type="textarea" v-model="dataForm.notes"></el-input>
-          </el-form-item>
-        </el-row>
+        <el-form-item label="名称" prop="materialName">
+          <el-input v-model="dataForm.materialName" placeholder="名称"></el-input>
+        </el-form-item>
+        <el-form-item label="图号" prop="mapNumber">
+          <el-input v-model="dataForm.mapNumber" placeholder="图号"></el-input>
+        </el-form-item>
+        <el-form-item label="规格" prop="productSpec">
+          <el-input v-model="dataForm.productSpec" placeholder="规格"></el-input>
+        </el-form-item>
+        <el-form-item label="批次" prop="materialName">
+          <el-input v-model="dataForm.materialName" placeholder="批次"></el-input>
+        </el-form-item>
+        <el-form-item label="数量" prop="cnt">
+          <el-input-number v-model="dataForm.cnt" :min="1" label="数量"></el-input-number>
+        </el-form-item>
       </el-form>
       </el-form>
       <span slot="footer">
       <span slot="footer">
         <el-button @click="onChose">取消</el-button>
         <el-button @click="onChose">取消</el-button>
@@ -55,27 +36,14 @@ export default {
   data () {
   data () {
     return {
     return {
       visible: false,
       visible: false,
-      isAdd: false,
-      dataForm: {
-        cnt: 1,
-        price: 1,
-        rate: 1
-      },
-      dataRule: {
-        productName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
-        cnt: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
-        price: [{ required: true, message: '含税单价不能为空', trigger: 'blur' }],
-        rate: [{ required: true, message: '税率不能为空', trigger: 'blur' }]
-      }
+      dataForm: { },
+      dataRule: { }
     }
     }
   },
   },
   methods: {
   methods: {
     async init (row) {
     async init (row) {
+      console.log(JSON.stringify(row))
       this.visible = true
       this.visible = true
-      if (!row) {
-        this.isAdd = true
-        return
-      }
       this.dataForm = row
       this.dataForm = row
     },
     },
     validateField (type) {
     validateField (type) {
@@ -88,14 +56,9 @@ export default {
     dataFormSubmit () {
     dataFormSubmit () {
       this.$refs['dataForm'].validate((valid) => {
       this.$refs['dataForm'].validate((valid) => {
         if (valid) {
         if (valid) {
-          if (this.isAdd === true) {
-            // console.log('1')
-            this.dataForm.productId = Math.round(Math.random() * 1000000)
-          }
-          // 计算含税总价
-          this.dataForm.amount = (this.dataForm.cnt * this.dataForm.price).toFixed(1)
+          // 打印
+          // todo
           this.onChose()
           this.onChose()
-          this.$emit('changeItem', this.dataForm)
         }
         }
       })
       })
     }
     }

+ 16 - 2
src/views/modules/production/monitoring.vue

@@ -119,10 +119,11 @@
           fixed="right"
           fixed="right"
           header-align="center"
           header-align="center"
           align="center"
           align="center"
-          width="80"
+          width="120"
           label="操作">
           label="操作">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <el-button v-if="isAuth('prod:monitoring:info')" type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
             <el-button v-if="isAuth('prod:monitoring:info')" type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
+            <el-button type="text" size="small" @click="printLabel(scope.row)">打印标签</el-button>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
       </el-table>
       </el-table>
@@ -140,6 +141,8 @@
     <prod-management-details v-if="detailsVisible" ref="details" @onChose="onChose" @refreshDataList="getDataList"/>
     <prod-management-details v-if="detailsVisible" ref="details" @onChose="onChose" @refreshDataList="getDataList"/>
     <purchase-detail v-if="purchaseVisible" ref="purchase" @refreshDataList="getDataList" @onChose="onChose"/>
     <purchase-detail v-if="purchaseVisible" ref="purchase" @refreshDataList="getDataList" @onChose="onChose"/>
     <outsource-detail  v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
     <outsource-detail  v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
+    <!-- 打印标签 -->
+    <print-label v-if="printLabelVisible" ref="printLabel" @onChose="onChose"/>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -149,14 +152,17 @@
   import PurchaseDetail from '@/views/modules/sale/purchase-detail'
   import PurchaseDetail from '@/views/modules/sale/purchase-detail'
   import OutsourceDetail from '@/views/modules/sale/outsource-detail'
   import OutsourceDetail from '@/views/modules/sale/outsource-detail'
   import ProdManagementDetails from '@/views/modules/production/prod-management-details'
   import ProdManagementDetails from '@/views/modules/production/prod-management-details'
+  import PrintLabel from '@/views/modules/production/components/print-label.vue'
+import CraftsDetail from '@/views/modules/tech/crafts-detail-dialog.vue'
 export default {
 export default {
     name: 'monitoring',
     name: 'monitoring',
-    components: {ProdManagementDetails, OutsourceDetail, PurchaseDetail, Detail},
+    components: {CraftsDetail, PrintLabel, ProdManagementDetails, OutsourceDetail, PurchaseDetail, Detail},
     data () {
     data () {
       return {
       return {
         detailsVisible: false,
         detailsVisible: false,
         purchaseVisible: false,
         purchaseVisible: false,
         outsourceVisible: false,
         outsourceVisible: false,
+        printLabelVisible: false,
         dataForm: {},
         dataForm: {},
         dataList: [],
         dataList: [],
         pageIndex: 1,
         pageIndex: 1,
@@ -185,6 +191,7 @@ export default {
         this.detailsVisible = false
         this.detailsVisible = false
         this.outsourceVisible = false
         this.outsourceVisible = false
         this.purchaseVisible = false
         this.purchaseVisible = false
+        this.printLabelVisible = false
       },
       },
       // 查询
       // 查询
       queryPage () {
       queryPage () {
@@ -246,6 +253,13 @@ export default {
           this.$refs.purchase.init(row.tableId)
           this.$refs.purchase.init(row.tableId)
         })
         })
       },
       },
+      // 标签打印
+      printLabel (row) {
+        this.printLabelVisible = true
+        this.$nextTick(() => {
+          this.$refs.printLabel.init(row)
+        })
+      },
       // 创建新物料
       // 创建新物料
       createNewProduct () {
       createNewProduct () {
         this.$message.warning('功能暂未开放')
         this.$message.warning('功能暂未开放')

+ 16 - 2
src/views/modules/production/recording.vue

@@ -95,10 +95,11 @@
           fixed="right"
           fixed="right"
           header-align="center"
           header-align="center"
           align="center"
           align="center"
-          width="80"
+          width="120"
           label="操作">
           label="操作">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <el-button v-if="isAuth('prod:record:info')" type="text" size="small" @click="details(scope.row.id)">查看</el-button>
             <el-button v-if="isAuth('prod:record:info')" type="text" size="small" @click="details(scope.row.id)">查看</el-button>
+            <el-button type="text" size="small" @click="printLabel(scope.row)">打印标签</el-button>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
       </el-table>
       </el-table>
@@ -114,6 +115,8 @@
     </template>
     </template>
     <!-- 弹窗, 查看 -->
     <!-- 弹窗, 查看 -->
     <prod-management-details v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList" @onChose="onChose"/>
     <prod-management-details v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList" @onChose="onChose"/>
+    <!-- 打印标签 -->
+    <print-label v-if="printLabelVisible" ref="printLabel" @onChose="onChose"/>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -121,12 +124,15 @@
   import Detail from './recording-details'
   import Detail from './recording-details'
   import { getRecordingList } from '@/api/production'
   import { getRecordingList } from '@/api/production'
   import ProdManagementDetails from '@/views/modules/production/prod-management-details'
   import ProdManagementDetails from '@/views/modules/production/prod-management-details'
+  import OutsourceDetail from '@/views/modules/sale/outsource-detail.vue'
+import PrintLabel from '@/views/modules/production/components/print-label.vue'
 export default {
 export default {
     name: 'recording',
     name: 'recording',
-    components: {ProdManagementDetails, Detail},
+    components: {PrintLabel, OutsourceDetail, ProdManagementDetails, Detail},
     data () {
     data () {
       return {
       return {
         detailsVisible: false,
         detailsVisible: false,
+        printLabelVisible: false,
         dataForm: {},
         dataForm: {},
         dataList: [],
         dataList: [],
         pageIndex: 1,
         pageIndex: 1,
@@ -156,6 +162,7 @@ export default {
     methods: {
     methods: {
       onChose () {
       onChose () {
         this.detailsVisible = false
         this.detailsVisible = false
+        this.printLabelVisible = false
       },
       },
       // 查询
       // 查询
       queryPage () {
       queryPage () {
@@ -205,6 +212,13 @@ export default {
           this.$refs.details.init(id, 2)
           this.$refs.details.init(id, 2)
         })
         })
       },
       },
+      // 标签打印
+      printLabel (row) {
+        this.printLabelVisible = true
+        this.$nextTick(() => {
+          this.$refs.printLabel.init(row)
+        })
+      },
       closeDialogEvent () {
       closeDialogEvent () {
         this.detailsVisible = false
         this.detailsVisible = false
       },
       },

+ 15 - 1
src/views/modules/production/scheduling.vue

@@ -162,7 +162,7 @@
           fixed="right"
           fixed="right"
           header-align="center"
           header-align="center"
           align="center"
           align="center"
-          width="160"
+          width="220"
           label="操作">
           label="操作">
           <template slot-scope="scope">
           <template slot-scope="scope">
             <el-button v-if="isAuth('prod:production:updateCheck') && Number(scope.row.prodState) === 0" type="text" size="small" @click="check(scope.row)">核料</el-button>
             <el-button v-if="isAuth('prod:production:updateCheck') && Number(scope.row.prodState) === 0" type="text" size="small" @click="check(scope.row)">核料</el-button>
@@ -171,6 +171,7 @@
 <!--            <el-button v-if="isAuth('prod:production:examine') && Number(scope.row.prodState) === 1" type="text" size="small" @click="preCheck(scope.row.id)">试制前检查</el-button>-->
 <!--            <el-button v-if="isAuth('prod:production:examine') && Number(scope.row.prodState) === 1" type="text" size="small" @click="preCheck(scope.row.id)">试制前检查</el-button>-->
             <el-button v-if="isAuth('prod:production:plan') && Number(scope.row.prodState) === 2" type="text" size="small" @click="detail(scope.row.id, true)">排产</el-button>
             <el-button v-if="isAuth('prod:production:plan') && Number(scope.row.prodState) === 2" type="text" size="small" @click="detail(scope.row.id, true)">排产</el-button>
 <!--            <el-button v-if="isAuth('pur:commDetail:save') && Number(scope.row.outsourcing) === 0" type="text" size="small" @click="outsourceHandle(scope.row.id)">委外生产</el-button>-->
 <!--            <el-button v-if="isAuth('pur:commDetail:save') && Number(scope.row.outsourcing) === 0" type="text" size="small" @click="outsourceHandle(scope.row.id)">委外生产</el-button>-->
+            <el-button type="text" size="small" @click="printLabel(scope.row)">打印标签</el-button>
           </template>
           </template>
         </el-table-column>
         </el-table-column>
       </el-table>
       </el-table>
@@ -196,6 +197,8 @@
     <scheduling-pre-check v-if="preCheckVisible" ref="preCheck" @refreshDataList="getDataList" @onChose="onChose"/>
     <scheduling-pre-check v-if="preCheckVisible" ref="preCheck" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 对应工艺 -->
     <!-- 对应工艺 -->
     <crafts-detail v-if="craftsVisible" ref="craftsDetail"/>
     <crafts-detail v-if="craftsVisible" ref="craftsDetail"/>
+    <!-- 打印标签 -->
+    <print-label v-if="printLabelVisible" ref="printLabel" @onChose="onChose"/>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -210,9 +213,11 @@
   import SchedulingCommission from '@/views/modules/production/scheduling-commission'
   import SchedulingCommission from '@/views/modules/production/scheduling-commission'
   import CraftsDetail from '@/views/modules/tech/crafts-detail-dialog'
   import CraftsDetail from '@/views/modules/tech/crafts-detail-dialog'
 import {downloadUrl} from '@/api/file'
 import {downloadUrl} from '@/api/file'
+  import PrintLabel from '@/views/modules/production/components/print-label.vue'
 export default {
 export default {
     name: 'scheduling',
     name: 'scheduling',
     components: {
     components: {
+      PrintLabel,
       CraftsDetail,
       CraftsDetail,
       SchedulingCommission,
       SchedulingCommission,
       SchedulingPurchase,
       SchedulingPurchase,
@@ -230,6 +235,7 @@ export default {
         preCheckVisible: false,
         preCheckVisible: false,
         purchaseVisible: false,
         purchaseVisible: false,
         craftsVisible: false,
         craftsVisible: false,
+        printLabelVisible: false,
         dataForm: {},
         dataForm: {},
         dataList: [],
         dataList: [],
         pageIndex: 1,
         pageIndex: 1,
@@ -297,6 +303,7 @@ export default {
         this.preCheckVisible = false
         this.preCheckVisible = false
         this.purchaseVisible = false
         this.purchaseVisible = false
         this.craftsVisible = false
         this.craftsVisible = false
+        this.printLabelVisible = false
       },
       },
       // 查询
       // 查询
       queryPage () {
       queryPage () {
@@ -398,6 +405,13 @@ export default {
           this.$refs.preCheck.init(id)
           this.$refs.preCheck.init(id)
         })
         })
       },
       },
+      // 标签打印
+      printLabel (row) {
+        this.printLabelVisible = true
+        this.$nextTick(() => {
+          this.$refs.printLabel.init(row)
+        })
+      },
       // 对应工艺
       // 对应工艺
       techDetails (id) {
       techDetails (id) {
         this.craftsVisible = true
         this.craftsVisible = true