Browse Source

roll label

dev
qiezi 1 year ago
parent
commit
79be192b75
  1. 6
      src/api/basics/basePicture.js
  2. 3
      src/api/part/externalPartPicture.js
  3. 56
      src/printFormat/roll_label.js
  4. 10
      src/views/modules/label/printer.vue
  5. 15
      src/views/modules/part/external.vue
  6. 152
      src/views/modules/part/picture/picture.vue

6
src/api/basics/basePicture.js

@ -0,0 +1,6 @@
import {createAPI} from '../../utils/httpRequest'
export const basePictureList = (data) => createAPI('/base/picture', 'post', data)
export const saveBasePicture = (data) => createAPI('/base/picture/save', 'post', data)
export const removeBasePicture = (data) => createAPI('/base/picture/remove', 'post', data)

3
src/api/part/externalPartPicture.js

@ -5,6 +5,9 @@ export const getExternalPartPicturePartList = (data)=>createAPI(`/part/picture/p
export const saveExternalPartPicture = (data)=>createAPI(`/part/picture/save`,'post',data)
export const saveBatchExternalPartPicture = (data)=>createAPI(`/part/picture/save/batch`,'post',data)
export const updateExternalPartPicture = (data)=>createAPI(`/part/picture/update`,'post',data)
export const removeExternalPartPicture = (data)=>createAPI(`/part/picture/remove`,'post',data)
export const removeBatchExternalPartPicture = (data)=>createAPI(`/part/picture/remove/batch`,'post',data)

56
src/printFormat/roll_label.js

@ -22,79 +22,83 @@ export const print_roll_label = (printList,printerName)=>{
LODOP.ADD_PRINT_IMAGE(4,100,62,12,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>");
LODOP.SET_PRINT_STYLEA(0,"Stretch",2);
LODOP.ADD_PRINT_TEXT(17,73,25,20,"REF");
LODOP.ADD_PRINT_TEXT(15,73,25,20,"REF");
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(27,73,25,20,"QTY");
LODOP.ADD_PRINT_TEXT(25,73,25,20,"QTY");
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(27,122,25,20,"UOM");
LODOP.ADD_PRINT_TEXT(25,122,25,20,"UOM");
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(37,73,30,20,"DESC");
LODOP.ADD_PRINT_TEXT(35,73,30,20,"DESC");
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(17,93,60,20,row.ref);
LODOP.ADD_PRINT_TEXT(15,93,60,20,row.ref);
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(27,93,35,20,row.qty);
LODOP.ADD_PRINT_TEXT(25,93,35,20,row.qty);
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(27,140,35,20,row.uom);
LODOP.ADD_PRINT_TEXT(25,140,35,20,row.uom);
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(37,96,83,35,row.desc);
LODOP.ADD_PRINT_TEXT(35,96,80,35,row.desc);
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
if (row.rollLabelRequired === 'Y'){
LODOP.ADD_PRINT_TEXT(52,73,30,20,"ROLL");
LODOP.ADD_PRINT_TEXT(55,73,30,20,"ROLL");
}else if (row.serialNumberRequired === 'Y'){
LODOP.ADD_PRINT_TEXT(52,73,50,20,"SERIAL");
LODOP.ADD_PRINT_TEXT(55,73,50,20,"SERIAL");
}
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
}
LODOP.ADD_PRINT_TEXT(60,73,29,15,"DATE");
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(60,95,85,16,row.date);
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
LODOP.ADD_PRINT_TEXT(55,95,80,20,row.rollNo);
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
if (row.rollLabelRequired === 'Y'){
LODOP.ADD_PRINT_TEXT(52,95,80,20,row.rollNo);
LODOP.ADD_PRINT_TEXT(55,95,80,20,row.rollNo);
}else if (row.serialNumberRequired === 'Y'){
LODOP.ADD_PRINT_TEXT(52,100,80,20,row.serialNumber);
LODOP.ADD_PRINT_TEXT(55,100,80,20,row.serialNumber);
}
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
LODOP.SET_PRINT_STYLEA(0,"FontSize",5);
LODOP.SET_PRINT_STYLEA(0,"FontSize",4);
LODOP.SET_PRINT_STYLEA(0,"Bold",1);
}
// LODOP.PRINT();
LODOP.PRINT_DESIGN()
LODOP.PRINT();
// LODOP.PRINT_DESIGN()
}
}

10
src/views/modules/label/printer.vue

@ -274,7 +274,7 @@ export default {
columnProp: "pictureNo",
headerAlign: "center",
align: "left",
columnLabel: "Document No",
columnLabel: "Certification No",
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -291,7 +291,7 @@ export default {
columnProp: "pictureDesc",
headerAlign: "center",
align: "left",
columnLabel: "Document Desc",
columnLabel: "Certification Desc",
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -905,6 +905,10 @@ export default {
}
print_roll_label(prints,label.defaultPrinterName)
}
if (notFound.length > 0){
this.$message.warning(`The printer ${notFound.join(',')} is not found`)
return
}
this.$message.success(data.msg)
}else {
this.$message.warning(data.msg)
@ -1057,7 +1061,7 @@ export default {
:total="total">
</el-pagination>
<el-tabs v-model="activeName">
<el-tab-pane label="Part Picture" name="picture">
<el-tab-pane label="Part Certification" name="picture">
<picture-module :column-list="pictureColumnList" :height="330" :part="currentPart" @refresh="getExternalPartPictureList" :of-components="true" :data-list="pictureList"></picture-module>
</el-tab-pane>
<el-tab-pane label="Linked Format" name="format">

15
src/views/modules/part/external.vue

@ -383,7 +383,7 @@ export default {
columnProp: "pictureNo",
headerAlign: "center",
align: "left",
columnLabel: "Document No",
columnLabel: "Certification No",
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -400,7 +400,7 @@ export default {
columnProp: "pictureDesc",
headerAlign: "center",
align: "left",
columnLabel: "Document Desc",
columnLabel: "Certification Desc",
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -742,7 +742,7 @@ export default {
},
},
methods:{
getExternalPartPictureList(){
getExternalPartPictureList(val){
let params = {
partNo: this.currentPart.partNo,
site: this.currentPart.site,
@ -750,6 +750,11 @@ export default {
getExternalPartPictureList(params).then(({data})=>{
if (data && data.code === 0){
this.pictureList = data.rows;
if (val === true){
this.$nextTick(()=>{
this.$refs.picture.handleBasePictureList();
})
}
}else {
this.$message.warning(data.msg)
}
@ -1187,8 +1192,8 @@ export default {
:total="total">
</el-pagination>
<el-tabs v-model="activeName" v-if="!ofComponents">
<el-tab-pane label="Part Picture" name="partPicture">
<picture-module :column-list="pictureColumnList" :part="currentPart" :data-list="pictureList" @refresh="getExternalPartPictureList"></picture-module>
<el-tab-pane label="Part Certification" name="partPicture">
<picture-module ref="picture" :column-list="pictureColumnList" :part="currentPart" :data-list="pictureList" @refresh="getExternalPartPictureList"></picture-module>
</el-tab-pane>
<el-tab-pane label="Linked Customer" name="linkedCustomer">
<linked-customer :column-list="customerColumnList" :part="currentPart" :data-list="externalPartCustomerList" @refresh="getExternalPartCustomerList"></linked-customer>

152
src/views/modules/part/picture/picture.vue

@ -2,11 +2,21 @@
import VueCookie from 'vue-cookie'
import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
import dayjs from 'dayjs'
import {removeExternalPartPicture, updateExternalPartPicture} from '../../../../api/part/externalPartPicture'
import {
removeBatchExternalPartPicture,
removeExternalPartPicture,
saveBatchExternalPartPicture,
updateExternalPartPicture
} from '../../../../api/part/externalPartPicture'
import {basePictureList} from '../../../../api/basics/basePicture'
let picture = {
pictureNo: '',
pictureDesc: '',
}
let basePicture = {
pictureDesc: '',
pictureFileName: '',
}
let baseUrl = process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi' : window.SITE_CONFIG['baseUrl']
@ -52,6 +62,14 @@ export default {
pictureDesc: [{ required: true, message: 'Picture Description is required', trigger: ['blur', 'change']}],
},
previewVisible:false,
basePictureLoading:false,
basePictureList:[],
basePictureVisible:false,
basePicture:{
...basePicture
},
selectBasePictureList:[],
selectPictureList:[],
}
},
methods:{
@ -81,6 +99,28 @@ export default {
}
});
},
saveBatchPicture(){
if (this.selectBasePictureList.length === 0){
this.$message.warning('Please select Picture')
return
}
let pictureList = this.selectBasePictureList.map(item=>{
item.partNo = this.part.partNo
item.site = this.part.site
item.createBy = this.$store.state.user.name
return item
})
saveBatchExternalPartPicture(pictureList).then(({data})=>{
if (data && data.code === 0){
this.$emit('refresh',true)
this.$message.success(data.msg)
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
closePartPicture(){
this.picture = {
...picture
@ -111,6 +151,22 @@ export default {
this.$message.error(error)
})
},
handleRemoveBatchExternalPartPicture(){
if (this.selectPictureList.length === 0){
this.$message.warning('Please select Picture')
return
}
removeBatchExternalPartPicture(this.selectPictureList).then(({data})=>{
if (data && data.code === 0){
this.$emit('refresh',true)
this.$message.success(data.msg)
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
handleUpdate(row){
this.picture = {
...row,
@ -155,6 +211,38 @@ export default {
this.urlList.push(row.pictureUrl);
this.previewVisible = true;
},
saveBaseHandler(){
this.basePicture = {
...basePicture,
}
this.handleBasePictureList();
this.basePictureVisible = true;
},
handleBasePictureList(){
let filter = this.dataList.map(item=>item.basePictureNo).filter(item=>item>0)
let params = {
...this.basePicture,
pictureNos:filter
}
this.basePictureLoading = true
basePictureList(params).then(({data})=>{
if (data && data.code === 0){
this.basePictureList = data.rows
}else {
this.$message.warning(data.msg)
}
this.basePictureLoading = false
}).catch((error)=>{
this.basePictureLoading = false
this.$message.error(error)
})
},
handleBaseSelectionChange(val){
this.selectBasePictureList = val;
},
handleSelectionChange(val){
this.selectPictureList = val;
},
},
created () {
@ -165,7 +253,8 @@ export default {
<template>
<div>
<div v-if="!ofComponents">
<el-button type="primary" @click="saveHandler">New Picture</el-button>
<el-button type="primary" v-if="false" @click="saveHandler">New Certification</el-button>
<el-button type="primary" @click="saveBaseHandler">New Certification</el-button>
</div>
<el-table :data="dataList" border :height="height" :style="`width: 100%;${ofComponents?'':'margin-top: 5px'}`">
<el-table-column header-align="center"
@ -176,7 +265,7 @@ export default {
<template slot-scope="scope">
<el-link style="cursor:pointer;" @click="handleUpdate(scope.row)" v-if="!ofComponents">Edit</el-link>
<el-link style="cursor:pointer;" @click="removeExternalPartPicture(scope.row)" v-if="!ofComponents">Delete</el-link>
<el-link style="cursor:pointer;" v-if="ofComponents" @click="handlePreviewImg(scope.row)">View</el-link>
<el-link style="cursor:pointer;" @click="handlePreviewImg(scope.row)">View</el-link>
</template>
</el-table-column>
<el-table-column
@ -196,8 +285,8 @@ export default {
</template>
</el-table-column>
</el-table>
<el-image-viewer v-if="ofComponents && previewVisible" :on-close="()=>{this.previewVisible = false}" :url-list="urlList"></el-image-viewer>
<el-dialog v-drag :title="`Part Picture`" @close="closePartPicture" :close-on-click-modal="false" :visible.sync="saveVisible" width="500px">
<el-image-viewer v-if=" previewVisible" :z-index="9999" :on-close="()=>{this.previewVisible = false}" :url-list="urlList"></el-image-viewer>
<el-dialog v-drag :title="`Part Certification`" @close="closePartPicture" :close-on-click-modal="false" :visible.sync="saveVisible" width="500px">
<el-form label-position="top" :model="picture" :rules="pictureRules" ref="pictureForm">
<el-row :gutter="20">
<el-col :span="6">
@ -211,7 +300,7 @@ export default {
</el-form-item>
</el-col>
</el-row>
<el-form-item label="Picture Description" prop="pictureDesc" :show-message="false">
<el-form-item label="Certification Description" prop="pictureDesc" :show-message="false">
<el-input v-model="picture.pictureDesc"></el-input>
</el-form-item>
<el-form-item label=" " class="uploadFormItem">
@ -229,6 +318,57 @@ export default {
<el-button @click="saveVisible=false">Cancel</el-button>
</div>
</el-dialog>
<el-dialog v-drag :title="`Part Certification`" :visible.sync="basePictureVisible" :close-on-click-modal="false" width="1000px">
<el-form :model="basePicture" label-position="top">
<el-row :gutter="20">
<el-col :span="4">
<el-form-item label="Picture Description">
<el-input v-model="basePicture.pictureDesc"></el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="4">-->
<!-- <el-form-item label="Picture File Name">-->
<!-- <el-input v-model="basePicture.pictureFileName"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="4">
<el-form-item label=" ">
<el-button type="primary" @click="handleBasePictureList">Query</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="display: flex" v-loading="basePictureLoading">
<el-table :data="basePictureList" border :height="400" @selection-change="handleBaseSelectionChange" :style="`width: 100%;margin-top: 5px`">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column prop="certificationNo" label="Certification No" min-width="80"/>
<el-table-column prop="pictureDesc" label="Certification Description" min-width="120"/>
<el-table-column label="Actions" width="60" align="center">
<template slot-scope="scope">
<el-link @click="handlePreviewImg(scope.row)">View</el-link>
</template>
</el-table-column>
</el-table>
<div style="width: 100px;display: flex;flex-direction: column;align-items: center;justify-content: center">
<div><el-button type="primary" style="width: 80px" @click="saveBatchPicture">Save<i class="el-icon-right el-icon--right"></i></el-button></div>
<div><el-button type="primary" style="width: 80px" @click="handleRemoveBatchExternalPartPicture" icon="el-icon-back">Delete</el-button></div>
</div>
<el-table :data="dataList" border :height="400" @selection-change="handleSelectionChange" :style="`width: 100%;margin-top: 5px`">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column prop="certificationNo" label="Certification No" min-width="80"/>
<el-table-column prop="pictureDesc" label="Certification Description" min-width="120"/>
<el-table-column label="Actions" width="60" align="center">
<template slot-scope="scope">
<el-link @click="handlePreviewImg(scope.row)">View</el-link>
</template>
</el-table-column>
</el-table>
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button @click="basePictureVisible=false">Cancel</el-button>-->
</div>
</el-dialog>
</div>
</template>

Loading…
Cancel
Save