Browse Source

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!405
黄梓星 1 năm trước cách đây
mục cha
commit
0af43d72fa

+ 21 - 1
src/api/business/purchase/purchase-order.js

@@ -152,6 +152,8 @@ const toOA =(userName, fdId) => {
   })
 }
 
+
+
 // 采购订单修订导出
 const orderExport =(data) => {
   return request({
@@ -161,6 +163,23 @@ const orderExport =(data) => {
   })
 }
 
+// 行导入
+const orderImport = (data) =>{
+  return request({
+    url: "/pu/order/import",
+    method: "POST",
+    data: data,
+  });
+}
+// 模板下载
+const downloadFailData = (data) =>{
+  return request({
+    url: "/pu/order/downloadFailData",
+    method: "POST",
+    data: data,
+  });
+}
+
 export default {
   list,
   details,
@@ -180,5 +199,6 @@ export default {
   returnedGoods,
   toOA,
   orderExport,
-
+  orderImport,
+  downloadFailData,
 }

+ 65 - 13
src/components/BatchImport/index.vue

@@ -34,16 +34,13 @@ export default {
     },
   },
   computed:{
-    tips:{
-      get(){
-        // this.accept.
-      },
-      set(){},
-    },
      // 是否显示提示
      showTip() {
       return this.isShowTip && (this.fileType || this.fileSize);
     },
+    accept(){
+      return this.fileType.map(item =>(`.${item}`)).join(',');
+    }
   },
   data(){
     return {
@@ -51,21 +48,33 @@ export default {
       visible:false,
       loading:false,
       fileList:[],
+      number: 0,
 
     }
   },
   methods:{
     // 确认上传
     async submitUpload(){
+      if(this.fileList.length){
+        this.$emit('import',this.fileList);
+      }else{
+      this.$notify.warning({
+        title:'警告',
+        message: '请上传文件之后在确认!',
+      });
 
+      }
+      
     },
     // 模板下载
     async templateDownload(){
+      this.$emit('temDownload')
       // 放父组件
       // this.download('/system/material/download', {}, `物料基本信息模板.xlsx`);
     },
     // 
     beforeClose(done){
+      this.fileList = [];
       // 关闭前清空
       done();
     },
@@ -79,9 +88,44 @@ export default {
     onChange(file, fileList){
       this.fileList = fileList;
     },
+    setVisible(prop){
+      this.visible = prop;
+      if(!prop){
+        this.fileList = [];
+      }
+    },
+    open(){
+      this.setVisible(true);
+    },
     // 取消
     cancal(){
-      this.visible = false;
+      this.setVisible(false);
+    },
+     // 上传前校检格式和大小
+     handleBeforeUpload(file) {
+      // 校检文件类型
+      if (this.fileType) {
+        const fileName = file.name.split(".");
+        const fileExt = fileName[fileName.length - 1];
+        const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
+        if (!isTypeOk) {
+          this.$modal.msgError(
+            `文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
+          );
+          return false;
+        }
+      }
+      // 校检文件大小
+      if (this.fileSize) {
+        const isLt = file.size / 1024 / 1024 < this.fileSize;
+        if (!isLt) {
+          this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
+          return false;
+        }
+      }
+      this.$modal.loading("正在上传文件,请稍候...");
+      this.number++;
+      return true;
     },
     
   },
@@ -90,7 +134,12 @@ export default {
 </script>
 
 <template>
-  <el-button :disabled="disabled">
+  <el-button 
+    :disabled="disabled"
+    :size="size"
+    @click="open"
+    type="primary"
+  >
     {{ title }}
     <el-dialog 
       :title="title" 
@@ -99,25 +148,28 @@ export default {
       width="35%" 
       center
       :before-close="beforeClose"
+      append-to-body
     >
       <el-upload
         ref="upload"
-        :accept="accept"
         action="#"
         :on-preview="handlePreview"
+        :accept="accept"
+        :before-upload="handleBeforeUpload"
         :on-remove="handleRemove"
         :file-list="fileList"
         :auto-upload="false"
         :on-change="onChange" 
         :limit="limit"
-        append-to-body
+        :disabled="disabled"
+        style="text-align: center;"
       >
         <el-button 
           slot="trigger" 
           :size="size" 
           type="primary"
         >选取文件</el-button>
-        <el-button 
+        <el-button
           v-if="isTemplate"
           style="margin-left: 10px;" 
           :size="size" 
@@ -136,8 +188,8 @@ export default {
       </el-upload>
 
       <div slot="footer" class="dialog-footer">
-        <el-button @click="cancal">取 消</el-button>
-        <el-button type="primary" @click="submitUpload">确 定</el-button>
+        <el-button type="primary" @click="submitUpload" :size="size">确 定</el-button>
+        <el-button @click="cancal" :size="size">取 消</el-button>
       </div>
     </el-dialog>
   </el-button>

+ 15 - 7
src/views/material/basicFile/index.vue

@@ -111,7 +111,7 @@
         border 
         :data="taskList" 
         ref="materialTable" 
-        max-height="550"
+        max-height="525"
         @cell-dblclick="handledbClick" 
         :row-key="getRowKey"
         @selection-change="handleSelectionChange" 
@@ -153,15 +153,23 @@
         </el-table-column>
       </el-table>
 
-      <el-pagination 
+      <pagination
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="handleQuery"
+        style="height: 32px; padding: 0 !important; "
+      />
+
+      <!-- <el-pagination 
         @size-change="handleSizeChange" 
         @current-change="handleCurrentChange"
         :current-page="queryParams.pageNum" 
-        :page-sizes="[10, 20, 50, 100]"
+        :page-sizes="[10, 20, 50, 100,200,500]"
         layout="total, sizes, prev, pager, next, jumper" 
         :total="total"
       >
-      </el-pagination>
+      </el-pagination> -->
     </el-card>
 
     <!-- 操作提示 -->
@@ -234,7 +242,7 @@
         // 查询参数
         queryParams: {
           pageNum: 1,
-          pageSize: 10,
+          pageSize: 100,
           code: null,
           name: null
         },
@@ -335,7 +343,7 @@
 
         this.queryParams.pageNum = 1;
       
-        this.queryParams.pageSize = 10;
+        this.queryParams.pageSize = 100;
 
         this.params = this.$init.params(SearchColumns);
 
@@ -664,7 +672,7 @@
       padding: 10px;
 
       .el-table {
-        overflow: auto;
+        // overflow: auto;
 
         .el-table__body-wrapper {
           overflow-y: auto !important;

+ 2 - 1
src/views/material/changeApply/add/column.js

@@ -370,7 +370,8 @@ export default function useColumns(){
         {
           item:{
             key:'medicalDevices',
-            title:'医疗器械',
+            // title:'医疗器械',
+            title:'管理类别',
           },
           attr:{
             is: "el-select",

+ 1 - 1
src/views/material/changeApply/index.vue

@@ -99,7 +99,7 @@ export default {
       size:'mini',
       tableList: [],
       TableColumns:TableColumns,
-      page: { pageNum: 1, pageSize: 10, total: 0 },
+      page: { pageNum: 1, pageSize: 100, total: 0 },
       params:params,
       SearchColumns:SearchColumns,
       optionType:'add',

+ 1 - 1
src/views/material/requisition/add.vue

@@ -509,7 +509,7 @@
               </el-form-item>
             </el-col>
             <el-col :span="6">
-              <el-form-item label="医疗器械" prop="medicalInstruments">
+              <el-form-item label="管理类别" prop="medicalInstruments">
                 <el-select v-model="basicForm2.medicalInstruments" placeholder="请选择" clearable
                            :disabled="disable || isControl">
                   <el-option v-for="dict in dict.type.medical_instruments" :key="dict.value" :label="dict.label"

+ 1 - 1
src/views/material/requisition/index.vue

@@ -156,7 +156,7 @@
         params:params,
         SearchColumns:SearchColumns,
         TableColumns:TableColumns,
-        pageStatus: { pageNum: 1, pageSize: 10, total: 0 },
+        pageStatus: { pageNum: 1, pageSize: 100, total: 0 },
         queryParams: {
           billCode: '',
           name: '',

+ 1 - 0
src/views/purchase/purchase-order/add/column.js

@@ -50,6 +50,7 @@ export const Columns = [
     inputType: "DatePicker",
     valueFormat: "yyyy-MM-dd",
     width: 200, 
+    require: true,
     isShow:true,
   },
   {

+ 49 - 1
src/views/purchase/purchase-order/add/index.vue

@@ -24,6 +24,7 @@ export default {
   components: {
     FileUploadCenter: () => import("../components/FileUploadCenter/index.vue"),
     popDialog: () => import("@/components/PopDialog/index.vue"),
+    BatchImport: () => import("@/components/BatchImport/index.vue"),
   },
 
   data() {
@@ -388,7 +389,8 @@ export default {
               key != "buyerName" &&
               key != "puDept" &&
               key != "puDeptName" &&
-              key != "status"
+              key != "status" &&
+              key != "billDate" 
             ) {
               this.params[key] = "";
             } else {
@@ -499,6 +501,47 @@ export default {
     
     },
 
+    async handelImport(fileList){
+
+      try {
+
+        let formData = new FormData();
+
+        formData.append('file',fileList[0].raw);
+
+        this.$modal.loading("正在上传文件,请稍候...");
+
+        let {code,data} = await orderApi.orderImport(formData);
+
+        if(code == 200) {
+          // puOrderExecuteList puOrderItemList
+
+          for (const key in data) {
+          //  this.params[key] = data[key];
+          this.params[key].push(...data[key]);
+          }
+
+          let {setVisible} =  this.$refs.batchImport;
+
+          setVisible(false);
+
+          this.handleGetPrice();
+        }
+        
+      } catch (error) {
+        
+      }finally{
+        this.$modal.closeLoading();
+      }
+
+    },
+    
+    async handleTemDownload(){
+
+      this.download('/pu/order/downloadFailData',{}, `物料信息模板.xlsx`);
+    },
+
+
   },
   created() {
     console.log("ADD CREATED", this.params);
@@ -812,6 +855,11 @@ export default {
           <el-button size="mini" @click="addTableRow(params[tabName])"
             >增行</el-button
           >
+          <BatchImport
+            ref="batchImport"
+            @import="handelImport"
+            @temDownload="handleTemDownload"
+          ></BatchImport>
         </el-row>
       </el-card>
     </el-form>

+ 47 - 0
src/views/purchase/purchase-order/edit/index.vue

@@ -8,6 +8,7 @@ export default {
   dicts: initDicts(SelectColumns),
   components: {
     FileUploadCenter: () => import('../components/FileUploadCenter/index.vue'),
+    BatchImport: () => import("@/components/BatchImport/index.vue"),
   },
   data() {
     return {
@@ -478,6 +479,45 @@ export default {
 
       return Infinity;
     },
+
+    async handelImport(fileList){
+
+      try {
+
+        let formData = new FormData();
+
+        formData.append('file',fileList[0].raw);
+
+        this.$modal.loading("正在上传文件,请稍候...");
+
+        let {code,data} = await orderApi.orderImport(formData);
+
+        if(code == 200) {
+          // puOrderExecuteList puOrderItemList
+
+          for (const key in data) {
+            this.params[key].push(...data[key]);
+          }
+
+          let {setVisible} =  this.$refs.batchImport;
+
+          setVisible(false);
+
+          this.handleGetPrice();
+        }
+        
+      } catch (error) {
+        
+      }finally{
+        this.$modal.closeLoading();
+      }
+
+      },
+
+    async handleTemDownload(){
+
+      this.download('/pu/order/downloadFailData',{}, `物料信息模板.xlsx`);
+    },
   },
   created() {},
   mounted() { },
@@ -624,6 +664,7 @@ export default {
           </el-col>
         </el-row>
       </el-card>
+
       <el-card :body-style="{
         padding: '20px',
         display: 'flex',
@@ -758,6 +799,12 @@ export default {
         <el-row style="position: absolute; top: 20px; right: 20px">
           <el-button v-if="params.source == '3' && !handleIsRevise()" :size="size"
             @click="addTableRow(params[tabName])">增行</el-button>
+          <BatchImport
+            v-if="params.source == '3' && !handleIsRevise()"
+            ref="batchImport"
+            @import="handelImport"
+            @temDownload="handleTemDownload"
+          ></BatchImport>
         </el-row>
       </el-card>
     </el-form>

+ 1 - 1
src/views/purchase/purchase-order/index.vue

@@ -35,7 +35,7 @@ export default {
     return {
       loading: false,
       tabLoading:false,
-      page: { pageNum: 1, pageSize: 10, total: 0 },
+      page: { pageNum: 1, pageSize: 100, total: 0 },
       searchColumns: SearchColumns,
       params: initParams(SearchColumns),
       tableColumns: TableColumns,

+ 4 - 4
src/views/purchase/task/xie-yi-zhi-cai/column.js

@@ -29,10 +29,10 @@ export const TableColumns = [
     },
   },
   
-  // {
-  //   item: { key: "customerName", title: "客户" },
-  //   attr: {},
-  // },
+  {
+    item: { key: "customerName", title: "客户" },
+    attr: {},
+  },
   {
     item: { key: "priceType", title: "价格类型" ,width:145},
     attr: { is: "el-dict-tag", dictName: "sys_price_type" },