Просмотр исходного кода

1. 物流管理添加收货数据编辑
2. 物流管理添加导出功能

cc12458 1 год назад
Родитель
Сommit
1854cd4d3b

+ 2 - 1
src/api/inventory/inventory.js

@@ -194,10 +194,11 @@ export function getTransportReport(query) {
 }
 // 运输明细报表导出
 export function exportTransportReport(query) {
+  const {pageNum, pageSize, ...data} = query;
   return request({
     url: '/yfc-admin/prescriptionManage/exportTransport',
     method: 'post',
-    data: query,
+    data,
     responseType: 'blob',
     fileType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8',
   })

+ 13 - 2
src/api/pda/index.js

@@ -12,8 +12,7 @@ export function packTwiceList(query) {
 }
 
 export function dispatchList(query) {
-  const {pageNum, pageSize, date, ...data} = query;
-  if (Array.isArray(date)) [data.startTime, data.endTime = data.startTime] = date;
+  const {pageNum, pageSize, ...data} = query;
   return request({
     url: '/yfc-admin/prescriptionManage/resFlowPage',
     method: 'post',
@@ -21,3 +20,15 @@ export function dispatchList(query) {
     params: {pageNum, pageSize},
   })
 }
+
+// 物流管理报表导出
+export function exportDispatchReport(query) {
+  const {pageNum, pageSize, ...data} = query;
+  return request({
+    url: '/yfc-admin/prescriptionManage/exportResFlow',
+    method: 'post',
+    data,
+    responseType: 'blob',
+    fileType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8',
+  })
+}

+ 8 - 0
src/api/prescription/prescriptionCore.js

@@ -192,6 +192,14 @@ export function getPrescriptionCore2(id) {
   });
 }
 
+export function editPrescriptionCore2(model) {
+  return request({
+    url: '/yfc-admin/prescription/prescriptionCore/updateLogistics',
+    method: 'post',
+    data: model,
+  });
+}
+
 export function getPrescriptionRS(id, medicines, {hidePregnant = false} = {}) {
   const hack = request({
     url: 'http://121.43.162.141/yf/knowlib/getYfMatInfo',

+ 104 - 10
src/components/print/express_75.vue

@@ -1,6 +1,8 @@
 <script>
 import {sf_express_print} from '@/tools/print.tool';
 import {getExpressRecordParams} from '@/api/prescription/prescriptionAudit';
+import {editPrescriptionCore2, getPrescriptionCore2} from '@/api/prescription/prescriptionCore';
+import regionOptions from '@/utils/options';
 
 export default {
   name: 'print_express_75',
@@ -8,6 +10,12 @@ export default {
     id: {type: [String, Number], required: true},
   },
   data() {
+    const locationValidator = (message) => (rule, value, callback) => {
+      if (this.dataset.expressExecutor === '顺丰') {
+        if (!value.length || (typeof value === 'string' && !value.trim())) { return callback(new Error(message)); }
+      }
+      callback();
+    };
     return {
       loaded: false,
       preview: true,
@@ -19,6 +27,20 @@ export default {
       model: null,
       device: null,
       printing: false,
+
+      submitting: false,
+      editable: false,
+      expressPayTypeOptions: [],
+      expressDechOptions: [],
+      regionOptions,
+      dataset: {},
+      rules: {
+        expressExecutor: [{required: true, message: '请选择配送方式'}],
+        consignee: [{validator: locationValidator('请输入收件人')}],
+        contactNumber: [{validator: locationValidator('请输入收件电话')}],
+        // location: [{validator: locationValidator('请选择所属地域')}],
+        address: [{validator: locationValidator('请输入详细地址')}],
+      },
     };
   },
   computed: {
@@ -32,10 +54,22 @@ export default {
   methods: {
     async print(preview = false) {
       try {
-        await this.getModel();
         if (preview) {
-
+          this.getDicts('express_dech').then((response) => {this.expressDechOptions = response.data;});
+          this.getDicts('express_pay_type').then((response) => {this.expressPayTypeOptions = response.data;});
+          const {id, ...model} = await getPrescriptionCore2(this.$props.id);
+          this.dataset = {
+            id,
+            location: model.location,
+            consignee: model.consignee,
+            contactNumber: model.contactNumber,
+            address: model.address,
+            expressDech: model.expressDech,
+            expressPayType: model.expressPayType,
+            expressExecutor: model.expressExecutor,
+          };
         } else {
+          await this.getModel();
           this.printing = true;
           await sf_express_print(this.model);
         }
@@ -51,24 +85,84 @@ export default {
     async getModel() {
       if (this.model) return this.model;
       return getExpressRecordParams({prescriptionCoreId: this.id}).then((res) => {
-        console.log(res);
         this.model = res.data;
         return this.model;
       });
     },
+
+    async save() {
+      try {
+        await this.$refs.form.validate()
+        this.submitting = true;
+        const {location = [], ...model} = this.dataset;
+        [model.province = '', model.city = '', model.region = ''] = location;
+        await editPrescriptionCore2(model);
+        this.$message.success(`修改成功`);
+      } catch (e) {
+        if (e === false) this.$message.warning('请补全表单');
+      }
+      this.submitting = false;
+    },
   },
 };
 </script>
 
 <template>
   <div class="print-preview" v-loading="loading">
-    <!--    <div class="top" :style="{backgroundColor: preview ? '#f0f0f0' : 'transparent'}"></div>-->
-    <!--    <iframe :id="tag" @load="delay"></iframe>-->
-    <div style="display: flex; align-items: center; justify-content: space-evenly;">
-      <el-button style="width: 100%;" type="primary" :loading="printing" @click="printing = true;print()">
-        打印
-      </el-button>
-    </div>
+    <el-form ref="form" :model="dataset" :rules="rules" label-position="right" label-width="auto" style="margin: 24px 0;" @submit.native.prevent="save()">
+      <el-row :gutter="20">
+        <el-col :span="24">
+          <el-form-item label="收件人" prop="consignee">
+            <el-input v-model="dataset.consignee" placeholder="请输入收件人" :disabled="!editable || submitting"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="收件电话" prop="contactNumber">
+            <el-input type="tel" v-model="dataset.contactNumber" placeholder="请输入收件电话" minlength="11"
+                      maxlength="11" :disabled="!editable || submitting"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24" style="display: flex;">
+          <el-form-item label="收件地址" prop="location">
+            <el-cascader v-model="dataset.location" :options="regionOptions" :props="{ value: 'label' }"
+                         placeholder="请选择省/市/区" clearable :disabled="!editable || submitting"></el-cascader>
+          </el-form-item>
+          <el-form-item label-width="4px" prop="address" style="flex: auto;">
+            <el-input v-model="dataset.address" placeholder="请输入详细地址" :disabled="!editable || submitting"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24" style="display: flex;">
+          <el-form-item style="flex-basis: 30%;" label="结算方式" prop="expressDech">
+            <el-select v-model="dataset.expressDech" placeholder="顺丰标快" clearable
+                       :disabled="!editable || submitting">
+              <el-option v-for="item in expressDechOptions" :key="item.dictValue"
+                         :label="item.dictLabel" :value="item.dictValue"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item style="flex-basis: 30%;" label-width="4px" label="" prop="expressPayType">
+            <el-select v-model="dataset.expressPayType" placeholder="月结" clearable
+                       :disabled="!editable || submitting">
+              <el-option v-for="item in expressPayTypeOptions" :key="item.dictValue"
+                         :label="item.dictLabel" :value="item.dictValue"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <div style="display: flex; align-items: center; justify-content: space-evenly;">
+        <template v-if="editable">
+          <el-button style="flex: 1;" :disabled="submitting" @click="editable = false;">取消</el-button>
+          <el-button style="flex: 1;" type="primary" :loading="submitting" native-type="submit">保存</el-button>
+        </template>
+        <template v-else>
+          <el-button style="flex: 1;" @click="editable = true;">编辑</el-button>
+          <el-button style="flex: 3;" type="primary" :loading="printing" @click="printing = true;print()">
+            打印
+          </el-button>
+        </template>
+      </div>
+    </el-form>
   </div>
 </template>
 

+ 24 - 3
src/views/pda/dispatch/index.vue

@@ -1,8 +1,9 @@
 <script>
-import {dispatchList} from '@/api/pda';
+import {dispatchList, exportDispatchReport} from '@/api/pda';
 import dayjs from 'dayjs';
 import PrintContainer from './printContainer.vue';
 import ScanPanel from '@/views/pda/dispatch/scanPanel.vue';
+import {downloadBlob} from '@/utils/zipdownload';
 
 export default {
   name: 'pda-dispatch',
@@ -71,9 +72,17 @@ export default {
       ];
       this.handleQuery();
     },
+    getQueryModel() {
+      const {date, ...form} = this.queryParams;
+      if (Array.isArray(date) && date.length) {
+        form.startTime = date[0];
+        form.endTime = date[1];
+      }
+      return form;
+    },
     getList() {
       this.loading = true;
-      const model = Object.assign({}, this.queryParams);
+      const model = this.getQueryModel();
       dispatchList(model).then((response) => {
         this.dataset = response.rows;
         this.total = response.total;
@@ -104,6 +113,17 @@ export default {
       });
       done();
     },
+
+    async exportData() {
+      const form = this.getQueryModel();
+      this.exporting = true;
+      try {
+        const data = await exportDispatchReport(form);
+        await downloadBlob(data);
+        this.$message.success(`导出 ${data.name} 成功`);
+      } catch (error) {}
+      this.exporting = false;
+    },
   },
 };
 </script>
@@ -171,7 +191,8 @@ export default {
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-            <el-button icon="el-icon-printer" size="mini" @click="openScanPanel">扫码枪</el-button>
+            <el-button type="primary"size="mini" v-hasPermi="['inventory:dispatch:export']" @click="exportData">导出</el-button>
+            <el-button icon="el-icon-printer" size="mini" v-hasPermi="['inventory:dispatch:scan']"  @click="openScanPanel">扫码枪</el-button>
           </el-form-item>
         </div>
       </div>

+ 1 - 1
src/views/pda/dispatch/printContainer.vue

@@ -19,7 +19,7 @@ export default {
   },
   watch: {},
   mounted() {
-    this.select(0);
+    this.select(this.loadExpress ? 0 : 1);
   },
   methods: {
     async print() {

+ 3 - 3
src/views/rescription/prescriptionCore/edit.vue

@@ -39,7 +39,7 @@ export default {
         age: [{required: true, message: '请输入年龄'}],
         // recipientTel: [{required: true, message: '请输入联系电话'}],
         expressExecutor: [{required: true, message: '请选择配送方式'}],
-        consignee: [{validator: locationValidator('请输入收件电话')}],
+        consignee: [{validator: locationValidator('请输入收件')}],
         contactNumber: [{validator: locationValidator('请输入收件电话')}],
         // location: [{validator: locationValidator('请选择所属地域')}],
         address: [{validator: locationValidator('请输入详细地址')}],
@@ -149,8 +149,8 @@ export default {
     this.getDicts('prescription.concentration').then((response) => {this.concentrationOptions = response.data;});
     this.getDicts('drug_frequency').then((response) => {this.frequencyOptions = response.data;});
     this.getDicts('medication_time').then((response) => {this.medicationTimeOptions = response.data;});
-    this.getDicts('expressDech').then((response) => {this.expressDechOptions = response.data;});
-    this.getDicts('expressPayType').then((response) => {this.expressPayTypeOptions = response.data;});
+    this.getDicts('express_dech').then((response) => {this.expressDechOptions = response.data;});
+    this.getDicts('express_pay_type').then((response) => {this.expressPayTypeOptions = response.data;});
     this.getDicts('usage_method').then((response) => {this.usageMethodOptions = response.data;});
     this.getDicts('drug_mark').then((response) => {this.drugMarkOptions = response.data;});
     getSchemeList().then((response) => {this.schemeOptions = response.rows;});

+ 2 - 2
src/views/rescription/prescriptionReception/edit.vue

@@ -147,8 +147,8 @@ export default {
     this.getDicts('prescription.concentration').then((response) => {this.concentrationOptions = response.data;});
     this.getDicts('drug_frequency').then((response) => {this.frequencyOptions = response.data;});
     this.getDicts('medication_time').then((response) => {this.medicationTimeOptions = response.data;});
-    this.getDicts('expressDech').then((response) => {this.expressDechOptions = response.data;});
-    this.getDicts('expressPayType').then((response) => {this.expressPayTypeOptions = response.data;});
+    this.getDicts('express_dech').then((response) => {this.expressDechOptions = response.data;});
+    this.getDicts('express_pay_type').then((response) => {this.expressPayTypeOptions = response.data;});
     this.getDicts('usage_method').then((response) => {this.usageMethodOptions = response.data;});
     this.getDicts('drug_mark').then((response) => {this.drugMarkOptions = response.data;});
     getSchemeList().then((response) => {this.schemeOptions = response.rows;});