廖井涛
2024-07-31 6b54d0fedb83cf9ee5830255121dff3d3a5e8cbe
Merge branch 'master' of http://bore.pub:10439/r/ERP_override
3个文件已添加
6个文件已修改
11294 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/index.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/package-lock.json 10695 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/public/print-lock.css 349 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/pp/TagStyleDesigner.vue 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/hook/tagStyleSet.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/main.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/processCard/SelectPrintFlowCard.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/index.html
@@ -3,6 +3,7 @@
  <head>
    <meta charset="UTF-8">
    <link rel="icon" href="/favicon.ico">
      <link rel="stylesheet" type="text/css" media="print" href="/print-lock.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>北玻</title>
  </head>
north-glass-erp/northglass-erp/package-lock.json
Diff too large
north-glass-erp/northglass-erp/package.json
@@ -21,6 +21,7 @@
    "vue": "^3.3.4",
    "vue-draggable-plus": "^0.5.0",
    "vue-i18n": "^9.10.1",
    "vue-plugin-hiprint": "^0.0.56",
    "vue-router": "^4.2.4",
    "vue3-print-nb": "^0.1.4",
    "vxe-pc-ui": "^4.0.78",
north-glass-erp/northglass-erp/public/print-lock.css
New file
@@ -0,0 +1,349 @@
@media print {
  body {
    margin: 0px;
    padding: 0px;
  }
}
@page {
  margin: 0;
}
.hiprint-printPaper * {
  box-sizing: border-box;
  -moz-box-sizing: border-box; /* Firefox */
  -webkit-box-sizing: border-box; /* Safari */
}
.hiprint-printPaper *:focus {
  outline: -webkit-focus-ring-color auto 0px;
}
.hiprint-printPaper {
  position: relative;
  padding: 0 0 0 0;
  page-break-after: always;
  -webkit-user-select: none; /* Chrome/Safari/Opera */
  -moz-user-select: none; /* Firefox */
  user-select: none;
  overflow-x: hidden;
  overflow: hidden;
}
.hiprint-printPaper .hiprint-printPaper-content {
  position: relative;
}
/* 火狐浏览器打印 第一页过后 重叠问题 */
@-moz-document url-prefix() {
  .hiprint-printPaper .hiprint-printPaper-content {
    position: relative;
    margin-top: 20px;
    top: -20px
  }
}
.hiprint-printPaper.design {
  overflow: visible;
}
.hiprint-printTemplate .hiprint-printPanel {
  page-break-after: always;
}
.hiprint-printPaper, hiprint-printPanel {
  box-sizing: border-box;
  border: 0px;
}
.hiprint-printPanel .hiprint-printPaper:last-child {
  page-break-after: avoid;
}
.hiprint-printTemplate .hiprint-printPanel:last-child {
  page-break-after: avoid;
}
.hiprint-printPaper .hideheaderLinetarget {
  border-top: 0px dashed rgb(201, 190, 190) !important;
}
.hiprint-printPaper .hidefooterLinetarget {
  border-top: 0px dashed rgb(201, 190, 190) !important;
}
.hiprint-printPaper.design {
  border: 1px dashed rgba(170, 170, 170, 0.7);
}
.design .hiprint-printElement-table-content, .design .hiprint-printElement-longText-content {
  overflow: hidden;
  box-sizing: border-box;
}
.design .resize-panel {
  box-sizing: border-box;
  border: 1px dotted;
}
.hiprint-printElement-text {
  background-color: transparent;
  background-repeat: repeat;
  padding: 0 0 0 0;
  border: 0.75pt none rgb(0, 0, 0);
  direction: ltr;
  font-family: 'SimSun';
  font-size: 9pt;
  font-style: normal;
  font-weight: normal;
  padding-bottom: 0pt;
  padding-left: 0pt;
  padding-right: 0pt;
  padding-top: 0pt;
  text-align: left;
  text-decoration: none;
  line-height: 9.75pt;
  box-sizing: border-box;
  word-wrap: break-word;
  word-break: break-all;
}
.design .hiprint-printElement-text-content {
  border: 1px dashed rgb(206, 188, 188);
  box-sizing: border-box;
}
.hiprint-printElement-longText {
  background-color: transparent;
  background-repeat: repeat;
  border: 0.75pt none rgb(0, 0, 0);
  direction: ltr;
  font-family: 'SimSun';
  font-size: 9pt;
  font-style: normal;
  font-weight: normal;
  padding-bottom: 0pt;
  padding-left: 0pt;
  padding-right: 0pt;
  padding-top: 0pt;
  text-align: left;
  text-decoration: none;
  line-height: 9.75pt;
  box-sizing: border-box;
  word-wrap: break-word;
  word-break: break-all;
  /*white-space: pre-wrap*/
}
.hiprint-printElement-table {
  background-color: transparent;
  background-repeat: repeat;
  color: rgb(0, 0, 0);
  border-color: rgb(0, 0, 0);
  border-style: none;
  direction: ltr;
  font-family: 'SimSun';
  font-size: 9pt;
  font-style: normal;
  font-weight: normal;
  padding-bottom: 0pt;
  padding-left: 0pt;
  padding-right: 0pt;
  padding-top: 0pt;
  text-align: left;
  text-decoration: none;
  padding: 0 0 0 0;
  box-sizing: border-box;
  line-height: 9.75pt;
}
.hiprint-printElement-table thead {
  background: #e8e8e8;
  font-weight: 700;
}
table.hiprint-printElement-tableTarget {
  width: 100%;
}
.hiprint-printElement-tableTarget, .hiprint-printElement-tableTarget tr, .hiprint-printElement-tableTarget td {
  border-color: rgb(0, 0, 0);
  /*border-style: none;*/
  /*border: 1px solid rgb(0, 0, 0);*/
  font-weight: normal;
  direction: ltr;
  padding-bottom: 0pt;
  padding-left: 4pt;
  padding-right: 4pt;
  padding-top: 0pt;
  text-decoration: none;
  vertical-align: middle;
  box-sizing: border-box;
  word-wrap: break-word;
  word-break: break-all;
  /*line-height: 9.75pt;
  font-size: 9pt;*/
}
.hiprint-printElement-tableTarget-border-all {
  border: 1px solid;
}
.hiprint-printElement-tableTarget-border-none {
  border: 0px solid;
}
.hiprint-printElement-tableTarget-border-lr {
  border-left: 1px solid;
  border-right: 1px solid;
}
.hiprint-printElement-tableTarget-border-left {
  border-left: 1px solid;
}
.hiprint-printElement-tableTarget-border-right {
  border-right: 1px solid;
}
.hiprint-printElement-tableTarget-border-tb {
  border-top: 1px solid;
  border-bottom: 1px solid;
}
.hiprint-printElement-tableTarget-border-top {
  border-top: 1px solid;
}
.hiprint-printElement-tableTarget-border-bottom {
  border-bottom: 1px solid;
}
.hiprint-printElement-tableTarget-border-td-none td {
  border: 0px solid;
}
.hiprint-printElement-tableTarget-border-td-all td:not(:nth-last-child(-n+2)) {
  border-right: 1px solid;
}
.hiprint-printElement-tableTarget-border-td-all td:last-child {
  border-left: 1px solid;
}
.hiprint-printElement-tableTarget-border-td-all td:last-child:first-child {
  border-left: none;
}
/*.hiprint-printElement-tableTarget tr,*/
.hiprint-printElement-tableTarget td {
  height: 18pt;
}
.hiprint-printPaper .hiprint-paperNumber {
  font-size: 9pt;
}
.design .hiprint-printElement-table-handle {
  position: absolute;
  height: 21pt;
  width: 21pt;
  background: red;
  z-index: 1;
}
.hiprint-printPaper .hiprint-paperNumber-disabled {
  float: right !important;
  right: 0 !important;
  color: gainsboro !important;
}
.hiprint-printElement-vline, .hiprint-printElement-hline {
  border: 0px none rgb(0, 0, 0);
}
.hiprint-printElement-vline {
  border-left: 0.75pt solid #000;
  border-right: 0px none rgb(0, 0, 0) !important;
  border-bottom: 0px none rgb(0, 0, 0) !important;
  border-top: 0px none rgb(0, 0, 0) !important;
}
.hiprint-printElement-hline {
  border-top: 0.75pt solid #000;
  border-right: 0px none rgb(0, 0, 0) !important;
  border-bottom: 0px none rgb(0, 0, 0) !important;
  border-left: 0px none rgb(0, 0, 0) !important;
}
.hiprint-printElement-oval, .hiprint-printElement-rect {
  border: 0.75pt solid #000;
}
.hiprint-text-content-middle {
}
.hiprint-text-content-middle > div {
  display: grid;
  align-items: center;
}
.hiprint-text-content-bottom {
}
.hiprint-text-content-bottom > div {
  display: grid;
  align-items: flex-end;
}
.hiprint-text-content-wrap {
}
.hiprint-text-content-wrap .hiprint-text-content-wrap-nowrap {
  white-space: nowrap;
}
.hiprint-text-content-wrap .hiprint-text-content-wrap-clip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.hiprint-text-content-wrap .hiprint-text-content-wrap-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/*hi-grid-row */
.hi-grid-row {
  position: relative;
  height: auto;
  margin-right: 0;
  margin-left: 0;
  zoom: 1;
  display: block;
  box-sizing: border-box;
}
.hi-grid-row::after, .hi-grid-row::before {
  display: table;
  content: '';
  box-sizing: border-box;
}
.hi-grid-col {
  display: block;
  box-sizing: border-box;
  position: relative;
  float: left;
  flex: 0 0 auto;
}
.table-grid-row {
  margin-left: -0pt;
  margin-right: -0pt;
}
.tableGridColumnsGutterRow {
  padding-left: 0pt;
  padding-right: 0pt;
}
.hiprint-gridColumnsFooter {
  text-align: left;
  clear: both;
}
north-glass-erp/northglass-erp/src/components/pp/TagStyleDesigner.vue
New file
@@ -0,0 +1,210 @@
<script setup>
import { hiprint } from "vue-plugin-hiprint"
import {onMounted, ref} from "vue"
import TagStyleSet from "@/hook/tagStyleSet"
import {ElMessage, ElMessageBox} from "element-plus";
import request from "@/utils/request"
import {useI18n} from "vue-i18n"
const { t } = useI18n()
// 纸张类型
const paperTypes = {
  'A3': {
    width: 420,
        height: 296.6
  },
  'A4': {
    width: 210,
        height: 296.6
  },
  'A5': {
    width: 210,
        height: 147.6
  },
  'B3': {
    width: 500,
        height: 352.6
  },
  'B4': {
    width: 250,
        height: 352.6
  },
  'B5': {
    width: 250,
        height: 175.6
  }
}
const autoPaper = ref({
  width:null,
  height:null
})
const tag = ref({
  id:null,
  name:null,
  type:1,
  tagWidth:null,
  tagHeight:null,
  value:null,
  size:null
})
const tags = ref([])
const activeName = ref(null)
// 注册默认面板
hiprint.init({
  providers: [new TagStyleSet()],
});
// 必须在 dom 加载完成之后给刚刚绑定上的元素添加上拖拽事件
onMounted(() => {
  getTags()
  buildDesigner()
})
let hiprintTemplate = ref()
const buildDesigner = () => {
  // 绑定拖拽事件
  hiprint.PrintElementTypeManager.build('.hiprintEpContainer', 'defaultModule')
  // new hiprint.PrintTemplate 的返回值是一个模板的实例
  // 传入的参数各种的配置项
  // settingContainer:属性栏面板
  hiprintTemplate.value = new hiprint.PrintTemplate({
    settingContainer: "#PrintElementOptionSetting",
  });
  // 构建一个设计模板,指定容器,是否开启网格展示
  hiprintTemplate.value.design("#hiprint-printTemplate",{grid:true});
};
const changePaperSize = (size,type) => {
  try{
    if(type==='list'){
      hiprintTemplate.value.setPaper(size.width, size.height)
    }else{
      hiprintTemplate.value.setPaper(autoPaper.value.width, autoPaper.value.height)
    }
  }catch (e){
  }
}
const save = () => {
  ElMessageBox.prompt( t('components.addNewSignature')+':', {
    confirmButtonText: t('basicData.save'),
    cancelButtonText: t('basicData.cancelButtonText'),
    inputPattern:/^.{1,20}$/,
    inputErrorMessage: t('components.message'),
    inputValue:tag.value.name
  }).then(({ value }) => {
    tag.value.name = value
    tag.value.value = JSON.stringify(hiprintTemplate.value.getJson())
    request.post('tagStyle/saveTag',tag.value).then(res => {
      if(res.code === '200' && res.data===true){
        ElMessage.success(t('basicData.msg.saveSuccess'))
        getTags()
      }
    })
  })
}
const getTags = () => {
  request.get('tagStyle/getTagList').then(res => {
    tags.value = res.data
  })
}
const changeTag = () => {
  const json = JSON.parse(tag.value.value)
  hiprintTemplate.value.setPaper(json.panels[0].width, json.panels[0].height)
  hiprintTemplate.value.update(json)
}
const clear = () => {
  hiprintTemplate.value.clear()
}
const deleteTag = () => {
  request.post(`tagStyle/deleteTag/${tag.value.id}`).then(res => {
    if(res.code === '200' && res.data===true){
      ElMessage.success(t('basicData.msg.deleteSuccess'))
      getTags()
      close()
    }
  })
}
const htmlPrint = () => {
  hiprintTemplate.value.print( [{orderId:'名称1'},{orderId:'名称12'}])
}
</script>
<template>
  <div style="height: 100%;width: 100%">
    <div style="height: 10%;width: 100%;float: left" @change="changePaperSize">
      <el-row>
        <el-col :span="6" >
          <el-button-group  >
            <el-button  v-for="(item,key) in paperTypes"  @click="changePaperSize(item,'list')"  >{{key}}</el-button>
            <el-popover placement="right" :width="250" trigger="click">
              <template #reference>
                <el-button >自定义尺寸</el-button>
              </template>
              <el-input v-model="autoPaper.width" type="number" >
                <template #prepend>宽</template>
                <template #append>mm</template>
              </el-input>
              <el-input v-model="autoPaper.height" type="number"  >
                <template #prepend>高</template>
                <template #append>mm</template>
              </el-input>
              <el-button
                  @click="changePaperSize(null,'other')"
                  style="float: right;margin-top: 0.5rem"
                  type="primary"
              >确定</el-button>
            </el-popover>
          </el-button-group>
        </el-col>
        <el-col :span="4">
            <el-select v-model="tag" @change="changeTag" placeholder="标签列表"  >
              <el-option
                  v-for="(tag,index) in tags"
                  :key="index"
                  :label="tag.name"
                  :value="tag"
              />
            </el-select>
        </el-col>
        <el-col :span="1">
          <el-button type="primary" @click="save">保存</el-button>
        </el-col>
        <el-col :span="1">
          <el-button type="warning" @click="clear">清空</el-button>
        </el-col>
        <el-col :span="1">
<!--          <el-button type="danger" @click="htmlPrint">打印</el-button>-->
          <el-button :disabled="!tag.id" type="danger" @click="deleteTag">删除</el-button>
        </el-col>
      </el-row>
    </div>
    <div style="height: 90%;width: 10%;float: left" class="hiprintEpContainer"/>
    <div style="height: 90%;width: 60%;overflow: auto;float: left">
      <div id="hiprint-printTemplate" class="hiprint-printTemplate" style="margin-left: 20px;margin-top: 20px"></div>
    </div>
    <div style="height: 90%;width: 30%;float: left;overflow: auto;">
      <div id="PrintElementOptionSetting" class="PrintElementOptionSetting"></div>
    </div>
  </div>
</template>
<style scoped>
</style>
north-glass-erp/northglass-erp/src/hook/tagStyleSet.js
New file
@@ -0,0 +1,30 @@
import { hiprint } from'vue-plugin-hiprint'
export default function (options) {
    var addElementTypes = function (context) {
        // 移除 旧的 defaultModule "元素"类型, 以避免重复
        context.removePrintElementTypes("defaultModule");
        // 添加 defaultModule "元素"类型
        context.addPrintElementTypes("defaultModule", [
            // PrintElementTypeGroup 分组
            // 如果使用 hiprint.PrintElementTypeManager.build('.hiprintEpContainer2', "defaultModule") 这里会渲染这个 "常规" 分组名称
            new hiprint.PrintElementTypeGroup('', [
                {
                    tid: 'panelsProvider1.order', title: '订单编号', data: '', type: 'text',
                    options: {
                        field: 'orderId',
                        testData: 'NG24070101',
                        height: 16,
                        fontSize: 6.75,
                        fontWeight: "700",
                        textAlign: "left",
                        textContentVerticalAlign: "middle"
                    }
                },
            ]),
        ]);
    };
    return {
        addElementTypes: addElementTypes,
    }
}
north-glass-erp/northglass-erp/src/main.js
@@ -17,6 +17,8 @@
import 'vxe-pc-ui/lib/style.css'
import i18n from "@/lang"
import print from 'vue3-print-nb'
import { hiPrintPlugin } from "vue-plugin-hiprint"
hiPrintPlugin.disAutoConnect()
@@ -32,5 +34,6 @@
})
app.use(i18n)
app.use(print)
app.use(hiPrintPlugin)
app.mount('#app')
north-glass-erp/northglass-erp/src/views/pp/processCard/SelectPrintFlowCard.vue
@@ -9,6 +9,7 @@
import {changeFilterEvent, filterChanged} from "@/hook"
import footSum from "@/hook/footSum"
import TagStyle from "@/components/pp/TagStyle.vue"
import TagStyleDesigner from "@/components/pp/TagStyleDesigner.vue"
import OrderSortDetail from '@/components/pp/OrderSortDetail.vue'
import companyInfo from "@/stores/sd/companyInfo"
//语言获取
@@ -335,11 +336,12 @@
    <el-dialog
        id="titleStyle"
        :title="$t('processCard.labelStyle')"
        style="width: 70%;height:70% "
        style="width: 90%;height:90%;margin-top: 3vh "
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        v-model="titleStyleVisible">
      <tag-style style="width: 100%;height: 100%"/>
<!--      <tag-style-designer style="width: 100%;height: 100%"/>-->
    </el-dialog>
    <el-dialog
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -1212,6 +1212,7 @@
  fullData.forEach((item,index) => {
    let trueArea = item.width*item.height/1000000
    if( !isNaN(item.computeArea*1) && item.computeArea != null && trueArea < errorArea.value){
      item.computeArea = errorArea.value
      item.computeGrossArea = parseFloat((item.computeArea*item.quantity).toFixed(2))
      item.grossAmount=parseFloat((item.price * item.computeGrossArea).toFixed(2))