ソースを参照

增删改查云打印

liuyanpeng 2 年 前
コミット
e142968cb2
4 ファイル変更69 行追加68 行削除
  1. 1 1
      package.json
  2. 20 18
      src/customer/printTemp/step2.vue
  3. 6 1
      src/print/CommonTable.vue
  4. 42 48
      src/print/PrintCard.vue

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
-  "version": "3.0.31",
+  "version": "3.0.33",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 20 - 18
src/customer/printTemp/step2.vue

@@ -25,7 +25,6 @@
           :wrapper-col="{ span: 14 }"
         >
           <a-form-item
-            v-show="formState.x != null"
             label="X坐标"
             class="m-ant-form-item"
           >
@@ -38,7 +37,6 @@
             />
           </a-form-item>
           <a-form-item
-            v-show="formState.y != null"
             label="Y坐标"
             class="m-ant-form-item"
           >
@@ -72,7 +70,6 @@
             </a-select>
           </a-form-item>
           <a-form-item
-            v-show="formState.height != null"
             label="高度"
             class="m-ant-form-item"
           >
@@ -84,7 +81,6 @@
             />
           </a-form-item>
           <a-form-item
-            v-show="formState.width != null"
             label="宽度"
             class="m-ant-form-item"
           >
@@ -167,7 +163,6 @@
           <a-form-item
             v-show="
               formState != null &&
-                formState.x != null &&
                 formState.type !== 'tagBackground'
             "
             label="操作"
@@ -196,7 +191,7 @@
     cancel-text="取消"
     @ok="handleOk"
   >
-    <a-input v-model:value="TempName" placeholder="请输入模版名称" />
+    <a-input v-model:value="TemText" placeholder="请输入模版名称" />
   </a-modal>
   <a-modal
     v-model:visible="imgVisible"
@@ -232,7 +227,6 @@ import { useStore } from 'vuex';
 import { message, Modal } from 'ant-design-vue';
 import Common from '../../common/Common.js';
 import { UploadOutlined } from '@ant-design/icons-vue';
-import TraceUpdateVue from '../../../../client-trace-v3/src/trace/TraceUpdate.vue';
 import { template } from '../../common/template';
 
 const store = useStore();
@@ -433,10 +427,16 @@ const imgUrlChange = () => {
 const typeChange = (value, option) => {
   cellTem.data.type = value;
 };
-const widthChange = () => {
+const widthChange = value => {
+  if(value === null){
+    formState.value.width = 0;
+  }
   resetSize();
 };
-const heightChange = () => {
+const heightChange = value => {
+  if(value === null){
+    formState.value.height = 0;
+  }
   resetSize();
 };
 
@@ -446,9 +446,7 @@ const resetSize = () => {
   }
   if (
     formState.value.width != null &&
-    formState.value.width != '' &&
-    formState.value.height != null &&
-    formState.value.height != ''
+    formState.value.height != null
   ) {
     cellTem.size(
       parseInt(formState.value.width),
@@ -457,11 +455,17 @@ const resetSize = () => {
   }
 };
 
-const xChange = () => {
+const xChange = value => {
+  if(value === null){
+    formState.value.x = 0;
+  }
   resetPosition();
 };
 
-const yChange = () => {
+const yChange = value => {
+  if(value === null){
+    formState.value.y = 0;
+  }
   resetPosition();
 };
 
@@ -475,9 +479,7 @@ const resetPosition = () => {
   }
   if (
     formState.value.x != null &&
-    formState.value.x != '' &&
-    formState.value.y != null &&
-    formState.value.y != ''
+    formState.value.y != null
   ) {
     cellTem.position(parseInt(formState.value.x), parseInt(formState.value.y));
   }
@@ -666,7 +668,7 @@ const setGraph = () => {
 
 const setStencil = () => {
   const stencil = new Stencil({
-    // title: '节点',
+    title: '',
     target: graph,
     stencilGraphWidth: 280,
     layoutOptions: {

+ 6 - 1
src/print/CommonTable.vue

@@ -152,7 +152,12 @@ const clear = () => {
   state.selectedRows = [];
   emit('selectColumn', state.selectedRows);
 };
-defineExpose({ clear });
+// 回到第一页
+const backFirstPage = () => {
+  pagination.current = 1;
+  emit('pageParams', pagination.current,pagination.pageSize);
+};
+defineExpose({ clear,backFirstPage });
 
 // 监听total变化
 watch(

+ 42 - 48
src/print/PrintCard.vue

@@ -11,7 +11,7 @@
             show-search
             class="commonStyle"
             :options="batchNos.map((item) => ({ value: item.label }))"
-            @change="searchPrintInfo"
+            @change="batchNoChange"
           />
           <label>保管人员:</label>
           <a-select
@@ -19,20 +19,20 @@
             show-search
             class="commonStyle"
             :options="depositoryUsers.map((item) => ({ value: item.label }))"
-            @change="searchPrintInfo"
+            @change="searchDatas"
           />
           <label>打印状态:</label>
           <a-select
-            v-model:value="status"
+            v-model:value="queryParams.labelPrintType"
             show-search
             class="commonStyle"
             :options="
               statusOptions.map((item) => ({
-                value: `${item.value}-${item.label}`,
+                value: item.value,
                 label: item.label,
               }))
             "
-            @change="searchPrintInfo"
+            @change="searchDatas"
           />
         </div>
         <div style="margin: 8px 0 0 9px">
@@ -42,7 +42,7 @@
             show-search
             class="commonStyle"
             :options="clientNames.map((item) => ({ value: item.label }))"
-            @change="searchPrintInfo"
+            @change="searchDatas"
           />
           <label>所属部门:</label>
           <a-select
@@ -50,7 +50,7 @@
             show-search
             class="commonStyle"
             :options="organizationNames.map((item) => ({ value: item.label }))"
-            @change="searchPrintInfo"
+            @change="searchDatas"
           />
           <label>成本中心:</label>
           <a-select
@@ -58,9 +58,9 @@
             show-search
             class="commonStyle"
             :options="costCenterNames.map((item) => ({ value: item.label }))"
-            @change="searchPrintInfo"
+            @change="searchDatas"
           />
-          <a-button type="primary" @click="searchPrintInfo">查询</a-button>
+          <a-button type="primary" @click="searchDatas">查询</a-button>
         </div>
         <div style="margin-top: 8px">
           <span style="color: red"> * </span>
@@ -100,7 +100,7 @@
         </div>
         <a-divider />
         <CommonTable
-          ref="tables"
+          ref="table"
           :total="total"
           :columns="columns"
           :is-loading="isLoading"
@@ -137,11 +137,7 @@
             :disabled="true"
           />
           <label>上次的批号:</label>
-          <a-input
-            id="displayName"
-            v-model:value="lastPackageBatchNo"
-            :disabled="true"
-          />
+          <a-input v-model:value="lastPackageBatchNo" :disabled="true" />
           <label>包装名称:</label>
           <a-input
             id="displayName"
@@ -149,11 +145,7 @@
             :disabled="true"
           />
           <label>上次的名称:</label>
-          <a-input
-            id="displayName"
-            v-model:value="lastPackageName"
-            :disabled="true"
-          />
+          <a-input v-model:value="lastPackageName" :disabled="true" />
           <div class="operationBtn">
             <a-button type="dashed" style="width: 240px" @click="lastTime">
               同上一次
@@ -176,7 +168,7 @@
           <a-image :src="imageUrls[0]" />
           <template #footer />
         </a-modal>
-        <Loading v-if="globalLoading" />
+        <Loading v-if="globalLoading" :text="propText" />
       </div>
     </div>
     <div ref="hua" style="float: left; z-index: -999" />
@@ -201,7 +193,7 @@ import {
 } from './config';
 
 const className = ref('com.leanwo.prodog.print.model.LabelPrintLine');
-const tables = ref(null);
+const table = ref(null);
 const imageUrls = reactive([]);
 const printing = ref(true);
 const total = ref(0);
@@ -214,11 +206,11 @@ const imageVisible = ref(false);
 const visible = ref(false);
 const globalLoading = ref(false);
 const all = ref(false);
+const propText = ref('');
 const bodyStyle = {
   display: 'flex',
   justifyContent: 'center',
 };
-const status = ref('');
 const batchNos = ref([]);
 const clientNames = ref([]);
 const depositoryUsers = ref([]);
@@ -227,7 +219,7 @@ const organizationNames = ref([]);
 const statusOptions = ref([
   {
     value: '',
-    label: ' ',
+    label: '',
   },
   {
     value: 'To_Be_Printed',
@@ -274,15 +266,27 @@ const getPageParams = (start, length) => {
   pager.length = length;
   searchPrintInfo();
 };
+// 批次号切换
+const batchNoChange = () => {
+  queryParams.clientName = '';
+  queryParams.depositoryUser = '';
+  queryParams.costCenterName = '';
+  queryParams.organizationName = '';
+  queryParams.labelPrintType = '';
+  commonSqlApi('20230613_192444', depositoryUsers); // 查询保管人
+  commonSqlApi('20230613_193808', clientNames); // 查询公司
+  commonSqlApi('20230613_194108', organizationNames); // 查询部门
+  commonSqlApi('20230613_194557', costCenterNames); // 查询成本中心
+  table.value.clear(); // 清空选择
+  table.value.backFirstPage(); // 回到第一页
+};
+// 查询回到第一页
+const searchDatas = () => {
+  table.value.backFirstPage();
+};
 // 查询信息
 const searchPrintInfo = () => {
   isLoading.value = true;
-  if (status.value !== undefined) {
-    queryParams.labelPrintType = status.value.slice(
-      0,
-      status.value.indexOf('-'),
-    );
-  }
   clientId.value = JSON.parse(localStorage.getItem('#LoginInfo')).loginClientId;
   let params = { ...queryParams, ...pager, clientId: clientId.value };
   if (queryParams.batchNo !== '') {
@@ -388,12 +392,14 @@ const printCard = async data => {
 
     let tempStr = JSON.stringify(templateData.value);
     const rows = JSON.parse(JSON.stringify(data));
+    let amount = 0;
     for (let key in rows) {
+      amount = amount + 1;
       let base64 = await getBase64(rows[key], tempStr, rows[key].assetNo);
       let file = base64toFile(base64, rows[key].id);
       formData.append('file', file);
+      propText.value = `打印中,已打印${amount}张`;
     }
-
     multipleImageUpload(formData).then(
       successData => {
         if (successData.success === true) {
@@ -449,24 +455,9 @@ const downloadImageZip = () => {
 
 // 打印后清除所有选择
 const clearSelect = () => {
-  tables.value.clear();
+  table.value.clear();
 };
 
-// 监听当批次切换后清空选择
-watch(
-  () => queryParams.batchNo,
-  (newVal, oldVal) => {
-    if (newVal !== oldVal) {
-      tables.value.clear();
-    }
-    if (newVal !== '') {
-      commonSqlApi('20230613_192444', depositoryUsers); // 查询保管人
-      commonSqlApi('20230613_193808', clientNames); // 查询公司
-      commonSqlApi('20230613_194108', organizationNames); // 查询部门
-      commonSqlApi('20230613_194557', costCenterNames); // 查询成本中心
-    }
-  },
-);
 onMounted(() => {
   init();
   getBase64 = CreateJPEG(hua.value);
@@ -485,6 +476,8 @@ const commonSqlApi = (url, data) => {
             return (item = { label: item });
           });
           data.value.unshift({ label: '' });
+        } else {
+          data.value = [];
         }
       } else {
         Notify.error('查询信息异常', successData.errorMessage, true);
@@ -508,9 +501,10 @@ const init = () => {
     successData => {
       if (successData.errorCode == 0) {
         if (successData.lines !== null) {
-          batchNos.value = successData.lines.map(item => {
+          let datas = successData.lines.map(item => {
             return (item = { label: item });
           });
+          batchNos.value = datas.reverse();
         }
       } else {
         Notify.error('查询导入批次异常', successData.errorMessage, true);