Parcourir la source

Merge branch 'purchaseDev' of http://172.16.100.139/new-business/drp-web into purchaseDev

002390 il y a 1 an
Parent
commit
4382e41610

+ 3 - 4
src/components/FileUpload/index.vue

@@ -1,7 +1,6 @@
 <template>
   <div class="upload-file">
     <el-upload
-      drag
       multiple
       :action="uploadFileUrl"
       :before-upload="handleBeforeUpload"
@@ -16,12 +15,12 @@
       ref="fileUpload"
     >
       <!-- 上传按钮 -->
-      <!-- <el-button size="mini" type="primary">选取文件</el-button> -->
-      <i class="el-icon-upload"></i>
+      <el-button size="mini" type="primary">选取文件</el-button>
+      <!-- <i class="el-icon-upload"></i>
       <div class="el-upload__text">
         将文件拖到此处,或
         <em>点击上传</em>
-      </div>
+      </div> -->
       <!-- 上传提示 -->
       <div class="el-upload__tip" slot="tip" v-if="showTip">
         请上传

+ 0 - 1
src/components/popover-select-v2/index.vue

@@ -155,7 +155,6 @@ export default {
     // select
     useSelect(prop) {
       this.selectData = prop;
-      console.log(" this.selectData ", this.selectData);
     },
     // confirm
     useConfirm(prop) {

+ 8 - 0
src/utils/expression.js

@@ -0,0 +1,8 @@
+import CONFIG from "@/config";
+
+// 无税单价
+export function iunitprice(tax = 0, price = 0) {
+  return ((Number(price) / (Number(tax) / 100 + 1)) * 1).toFixed(
+    CONFIG.precision
+  );
+}

+ 4 - 1
src/utils/request.js

@@ -31,6 +31,8 @@ service.interceptors.request.use(
     // 是否存在列表查询
     const isQueryList =
       config.url.includes("/list") || config.url.includes("/query");
+    //是否存在其他登录方式
+    const isSSO = config.url.includes("/login/sso");
     if (getToken() && !isToken) {
       config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
     }
@@ -44,6 +46,7 @@ service.interceptors.request.use(
     if (
       !isRepeatSubmit &&
       !isQueryList &&
+      !isSSO &&
       (config.method === "post" || config.method === "put")
     ) {
       const requestObj = {
@@ -114,7 +117,7 @@ service.interceptors.response.use(
             url: res.config.url,
             data: res.config.data,
             method: res.config.method,
-            params: { ...res.config.params, DName: "蒙奇·D·伟涛" },
+            params: { ...res.config.params},
           });
         }
       } catch (err) {

+ 60 - 5
src/views/purchase/PurchaseDemandList/add.vue

@@ -43,8 +43,8 @@
         </el-col>
 
         <el-col :span="1.5">
-          <el-form-item label="需求计划">
-            <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px">
+          <el-form-item label="需求计划" prop="planType" :rules="{ required: true, message: '请选择需求计划', trigger: 'blur' }">
+            <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px" @change="changeplanType()">
               <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
               </el-option>
             </el-select>
@@ -55,7 +55,7 @@
           <el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
             <el-date-picker
               v-model="basicForm.demandDate"
-              :disabled="sonDisable"
+              disabled
               clearable
               type="date"
               value-format="yyyy-MM-dd"
@@ -571,9 +571,8 @@ export default {
         demandPersonalName: '',
         demandDept: '',
         demandDeptName: '',
-        planType: '1',
+        planType: 'ZJH',
         demandDate: '',
-        createTime: '',
         source: '4',
         billType: 'ZQBH',
         isCustomerSpecified: 'N',
@@ -753,6 +752,8 @@ export default {
     } else if(this.pageStu == 'edit') {
       this.getDetails(this.row)
     } else if (this.pageStu == 'add') {
+      // 新增时判断需求日期
+      this.dafaultDate()
       this.loading = false
       this.basicForm.demandPersonal = this.$store.state.user.name
       this.basicForm.demandPersonalName = this.$store.state.user.nickName
@@ -763,6 +764,58 @@ export default {
     }
   },
   methods: {
+    // 默认需求日期根据当天星期几判断
+    dafaultDate() {
+      // 获取当前时间
+      let date = new Date()
+      //获取当前时间的年份转为字符串
+      let year = date.getFullYear().toString()  
+      //获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
+      let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString()  //'04'
+      //获取天,判断是否小于10,如果是在字符串前面拼接'0'
+      let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString()  //'12'
+      let today = year + '-' + month + '-' + da
+      console.log('今天日期',today)
+      let weekDay = date.getDay()
+      console.log('今天星期几', weekDay)
+      // 改变需求计划的判断写这里面了
+      if (this.basicForm.planType == 'JJXQ') {
+        this.basicForm.demandDate = today
+      } else {
+        if (weekDay == 0) {this.basicForm.demandDate = this.getNextDate(today, 2)} 
+        else if (weekDay == 1) {this.basicForm.demandDate = this.getNextDate(today, 1)}
+        else if (weekDay == 2) {this.basicForm.demandDate = today}
+        else if (weekDay == 3) {this.basicForm.demandDate = this.getNextDate(today, 6)}
+        else if (weekDay == 4) {this.basicForm.demandDate = this.getNextDate(today, 5)}
+        else if (weekDay == 5) {this.basicForm.demandDate = this.getNextDate(today, 4)}
+        else if (weekDay == 6) {this.basicForm.demandDate = this.getNextDate(today, 3)}
+        // console.log(this.getNextDate(today, 2))
+      }
+    },
+    // 获取某天日期的下一天,默认为第二天 默认输出格式为yyyy-mm-dd
+    getNextDate(date, day = 1, format = '{y}-{m}-{d}') {
+      if (date) {
+        date = date.match(/\d+/g).join('-'); // 格式为2022年09月19日处理
+        const nDate = new Date(date);
+        nDate.setDate(nDate.getDate() + day);
+ 
+        const formatObj = {
+          y: nDate.getFullYear(),
+          m: nDate.getMonth() + 1,
+          d: nDate.getDate(),
+        };
+        return format.replace(/{([ymd])+}/g, (result, key) => {
+          const value = formatObj[key];
+          return value.toString().padStart(2, '0');
+        });
+      } else {
+        console.log('date格式不正确');
+      }
+    },
+    // 改变需求计划改变需求日期
+    changeplanType() {
+      this.dafaultDate()
+    },
     // 无限滚动加载配置
     load() {
       if (this.loadDisabled) return;
@@ -856,6 +909,8 @@ export default {
       this.basicForm.demandPersonalName = this.$store.state.user.nickName
       this.basicForm.demandDept = this.$store.state.user.deptId
       this.basicForm.demandDeptName = this.$store.state.user.deptName
+      // 复制时判断需求日期
+      this.dafaultDate()
       if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
       if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
       this.basicForm.puDemandItemList.forEach(item => {

+ 18 - 3
src/views/purchase/PurchaseDemandList/index.vue

@@ -252,6 +252,13 @@
     <!-- 模板下载新增参数 -->
     <el-dialog title="需求模板下载" :visible.sync="download.open" @close="clearDownload" width="400px">
       <el-row style="margin-bottom: 20px;">
+        <span style="margin-right: 10px;">需求计划</span>
+        <el-select size="mini" v-model="download.planType">
+          <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
+          </el-option>
+        </el-select>
+      </el-row>
+      <el-row style="margin-bottom: 20px;">
         <span style="margin-right: 10px;">需求客户</span>
         <el-select clearable size="mini" v-model="download.customer" @clear="download.customer = ''" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')">
           <el-option v-for="item in mBcustomer" :key="item.id" :label="item.name" :value="item.code" />
@@ -310,7 +317,7 @@ export default {
     Refers,
     TreeRefers
   },
-  dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
+  dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type', 'sys_plan_type'],
   data() {
     return {
       loading: true,
@@ -332,6 +339,7 @@ export default {
       // 模板下载参数
       download: {
         open: false,
+        planType: 'ZJH',
         customer: '',
         warehouse: '',
         warehouseId: '',
@@ -473,8 +481,9 @@ export default {
       console.log('选中数组', this.ids.join())
     },
     mbDownload() {
+      this.$modal.loading("正在下载模板,请稍后...");
       downLoadDemand(this.download).then(res => {
-        console.log('下载的文件流', res)
+        this.$modal.closeLoading();
         const blob = new Blob([res], {
           type: "application/vnd.ms-excel;charset=UTF-8",
         });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
@@ -484,12 +493,14 @@ export default {
         // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
         // var name = fileName.split(";")[0]; //切割成文件名
         downloadElement.href = href;  //下载地址
-        downloadElement.download = '模板'; // 下载后文件名
+        downloadElement.download = '采购需求单模板'+ this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
         document.body.appendChild(downloadElement);
         downloadElement.click(); // 点击下载
         document.body.removeChild(downloadElement); // 下载完成移除元素
         window.URL.revokeObjectURL(href); // 释放blob对象
         this.download.open = false
+      }).catch(err => {
+        this.$modal.closeLoading();
       })
     },
     // 关闭模板下载弹窗清空参数
@@ -497,6 +508,7 @@ export default {
       // 模板下载参数
       this.download =  {
         open: false,
+        planType: 'ZJH',
         customer: '',
         warehouse: '',
         warehouseId: '',
@@ -517,9 +529,11 @@ export default {
     // 文件上传中处理
     handleFileUploadProgress(event, file, fileList) {
       this.upload.isUploading = true;
+      this.$modal.loading("正在导入数据,请稍后...");
     },
     // 文件上传成功处理
     handleFileSuccess(response, file, fileList) {
+      this.$modal.closeLoading();
       this.upload.open = false;
       this.upload.isUploading = false;
       this.$refs.upload.clearFiles();
@@ -527,6 +541,7 @@ export default {
       this.getList(this.queryParams);
     },
     errorFile(err) {
+      this.$modal.closeLoading();
       this.$modal.notifyError("文件已变动,请重新上传");
     },
     // 提交上传文件

+ 18 - 12
src/views/purchase/apply/add/columns.js

@@ -1,4 +1,5 @@
 import CONFIG from "@/config";
+import { iunitprice } from "@/utils/expression";
 
 export default function useColumns() {
   const TableColumns = [
@@ -194,10 +195,7 @@ export default function useColumns() {
           attr: {
             formatter: (prop) => {
               const { tax = 0, taxPrice = 0 } = prop;
-              prop.price = ((taxPrice / (tax / 100 + 1)) * 1).toFixed(
-                CONFIG.precision
-              );
-              return prop.price;
+              return (prop.price = iunitprice(tax, taxPrice));
             },
           },
         },
@@ -312,19 +310,25 @@ export default function useColumns() {
         {
           item: { width: 100, key: "priceDiffer", title: "单价差" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 : (prop * 1).toFixed(CONFIG.precision);
+              const { taxPrice = 0, recentlyPrice = 0 } = prop;
+              return (prop.priceDiffer = (
+                Number(taxPrice) - Number(recentlyPrice)
+              ).toFixed(CONFIG.precision));
             },
           },
         },
 
         {
-          item: { width: 100, key: "increase", title: "涨幅" },
+          item: { width: 100, key: "increase", title: "涨幅(%)" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 : (prop * 1).toFixed(CONFIG.precision);
+              const { priceDiffer = 0, recentlyPrice = 0 } = prop;
+              return (prop.increase = recentlyPrice
+                ? ((Number(priceDiffer) / Number(recentlyPrice)) * 100).toFixed(
+                    2
+                  )
+                : "0.00");
             },
           },
         },
@@ -339,11 +343,13 @@ export default function useColumns() {
           },
         },
         {
-          item: { width: 100, key: "yAffectedAmount", title: "预计年影响" },
+          item: { width: 100, key: "yAffectedAmount", title: "预计年影响金额" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 : (prop * 1).toFixed(CONFIG.precision);
+              const { priceDiffer = 0, yPurchaseQuantity = 0 } = prop;
+              return (prop.yAffectedAmount = (
+                Number(priceDiffer) * Number(yPurchaseQuantity)
+              ).toFixed(CONFIG.precision));
             },
           },
         },

+ 8 - 7
src/views/purchase/apply/add/index.vue

@@ -67,10 +67,12 @@ export default {
         currencyCode,
         currencyName,
       } = this.params;
+      const { nickName: createByName } = this.$store.state.user;
       if (selectData.length) {
         this.params[this.tabName].splice(-1);
       }
       for (const item of selectData) {
+        this.loading = true;
         const { tax: taxName, unitName, code: materialCode } = item;
         // task 1
         const { ntaxrate } = await tax(taxName);
@@ -86,6 +88,7 @@ export default {
           isApprovalFirst = "N",
           isPriceAdjustment = "N",
         } = await fetchExist({ puOrg, customer, supplier, materialCode });
+        this.loading = false;
         await this.onRowAdd(this.tabName, {
           ...item,
           currency: currency,
@@ -101,6 +104,8 @@ export default {
           isApprovalFirst,
           isPriceAdjustment,
           tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate).toFixed(6),
+          createByName: createByName,
+          updateByName: createByName,
         });
       }
     },
@@ -220,10 +225,10 @@ export default {
         ref="superForm"
         label-width="auto"
         label-position="right"
-        style="padding: 20px"
+        style="padding: 18px"
       >
       </el-super-form>
-      <el-tabs v-model="tabName" style="padding: 0 20px 20px">
+      <el-tabs v-model="tabName" style="padding: 0 18px 18px">
         <el-tab-pane
           v-for="({ item, TableColumns: columns }, index) in TabColumns"
           :key="index"
@@ -272,8 +277,4 @@ export default {
   </el-button>
 </template>
 
-<style scoped>
-::v-deep .el-table__row.is-hidden {
-  display: none;
-}
-</style>
+<style scoped></style>

+ 18 - 20
src/views/purchase/apply/columns.js

@@ -2,34 +2,34 @@ import CONFIG from "@/config";
 
 export default function useColumns() {
   const TableColumns = [
-    { item: { key: "priceCode", title: "价格编码" ,  width:150 }, attr: {} },
+    { item: { key: "priceCode", title: "价格编码", width: 150 }, attr: {} },
     {
-      item: { key: "status", title: "状态" ,  width:100},
-      attr: { is: "el-dict-tag", dictName: "sys_status",  width:100 },
+      item: { key: "status", title: "状态", width: 100 },
+      attr: { is: "el-dict-tag", dictName: "sys_status", width: 100 },
     },
-    { item: { key: "supplierName", title: "供应商" ,  width:150}, attr: {} },
-    { item: { key: "currencyName", title: "币种" ,  width:100}, attr: {} },
+    { item: { key: "supplierName", title: "供应商", width: 150 }, attr: {} },
+    { item: { key: "currencyName", title: "币种", width: 100 }, attr: {} },
     {
-      item: { key: "explainStr", title: "价格合理性说明" ,  width:100},
+      item: { key: "explainStr", title: "价格合理性说明", width: 100 },
       attr: {},
     },
-    { item: { key: "buyerName", title: "采购员",  width:100 }, attr: {} },
-    { item: { key: "puDeptName", title: "采购部门" ,  width:100}, attr: {} },
+    { item: { key: "buyerName", title: "采购员", width: 100 }, attr: {} },
+    { item: { key: "puDeptName", title: "采购部门", width: 100 }, attr: {} },
     {
-      item: { key: "file", title: "附件", filter: false,  width:100 },
+      item: { key: "file", title: "附件", filter: false, width: 100 },
       attr: { is: "el-file-preview" },
     },
-    { item: { key: "createByName", title: "创建人",  width:100 }, attr: {} },
+    { item: { key: "createByName", title: "创建人", width: 100 }, attr: {} },
     {
-      item: { key: "isEffective", title: "是否已推价格" ,  width:100},
-      attr: { is: "el-dict-tag", dictName: "is_effective" ,  width:100},
+      item: { key: "isEffective", title: "是否已推价格", width: 100 },
+      attr: { is: "el-dict-tag", dictName: "is_effective", width: 100 },
     },
     {
-      item: { key: "effectiveDate", title: "生效日期" ,  width:100},
+      item: { key: "effectiveDate", title: "生效日期", width: 100 },
       attr: {},
     },
     {
-      item: { key: "sourceType", title: "来源单据类型" ,  width:100},
+      item: { key: "sourceType", title: "来源单据类型", width: 100 },
       attr: {},
     },
   ].map(({ item, attr }) => ({
@@ -43,19 +43,17 @@ export default function useColumns() {
     },
   }));
   const SearchColumns = [
-    
-    { 
-      item:{
+    {
+      item: {
         key: "priceCode",
-        title: "价格编码", 
+        title: "价格编码",
       },
       attr: {
-        clearable:true,
+        clearable: true,
         is: "el-input",
       },
     },
     {
-      
       item: { key: "supplierName", title: "供应商" },
       attr: {
         is: "el-popover-select-v2",

+ 75 - 45
src/views/purchase/apply/copy/columns.js

@@ -1,4 +1,5 @@
 import CONFIG from "@/config";
+import { iunitprice } from "@/utils/expression";
 
 export default function useColumns() {
   const TableColumns = [
@@ -117,6 +118,7 @@ export default function useColumns() {
           item: { key: "materialName", title: "物料名称", require: true },
           attr: {
             is: "el-popover-select-v2",
+            multiple: true,
             valueKey: "name",
             referName: "MATERIAL_PARAM",
             dataMapping: {
@@ -141,7 +143,7 @@ export default function useColumns() {
         { item: { key: "specification", title: "规格" }, attr: {} },
         { item: { key: "model", title: "型号" }, attr: {} },
         {
-          item: { key: "unitName", title: "单位" },
+          item: { key: "unitName", title: "单位", hidden: false },
           attr: {
             is: "el-popover-select-v2",
             valueKey: "name",
@@ -150,7 +152,7 @@ export default function useColumns() {
           },
         },
         {
-          item: { key: "puUnitName", title: "采购单位" },
+          item: { key: "puUnitName", title: "采购单位", hidden: false },
           attr: {
             is: "el-popover-select-v2",
             valueKey: "name",
@@ -167,6 +169,8 @@ export default function useColumns() {
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
+            value: 1,
+            disabled: true,
           },
         },
         {
@@ -176,6 +180,7 @@ export default function useColumns() {
             valueKey: "ntaxrate",
             referName: "TAX_RATE_PARAM",
             dataMapping: { tax: "ntaxrate" },
+            disabled: true,
           },
         },
         {
@@ -190,10 +195,7 @@ export default function useColumns() {
           attr: {
             formatter: (prop) => {
               const { tax = 0, taxPrice = 0 } = prop;
-              prop.price = ((taxPrice / (tax / 100 + 1)) * 1).toFixed(
-                CONFIG.precision
-              );
-              return prop.price;
+              return (prop.price = iunitprice(tax, taxPrice));
             },
           },
         },
@@ -248,12 +250,20 @@ export default function useColumns() {
             },
           },
         },
-        { item: { key: "recentlyPrice", title: "最近价格" }, attr: {} },
+        {
+          item: { key: "recentlyPrice", title: "最近价格" },
+          attr: {
+            is: "el-input-number",
+            precision: CONFIG.precision,
+            disabled: true,
+          },
+        },
         {
           item: { key: "isApprovalFirst", title: "首次报批" },
           attr: {
             is: "el-select",
             dictName: "is_effective",
+            disabled: true,
           },
         },
         {
@@ -261,6 +271,7 @@ export default function useColumns() {
           attr: {
             is: "el-select",
             dictName: "is_effective",
+            disabled: true,
           },
         },
         {
@@ -279,8 +290,9 @@ export default function useColumns() {
             value: "N",
           },
         },
+
         {
-          item: { width:100,key: "isChannel", title: "是否渠道变更" },
+          item: { width: 100, key: "isChannel", title: "是否渠道变更" },
           attr: {
             is: "el-select",
             dictName: "is_effective",
@@ -288,68 +300,80 @@ export default function useColumns() {
           },
         },
         {
-          item: { width:100,key: "brandReplacement", title: "是否品牌替换" },
+          item: { width: 100, key: "brandReplacement", title: "是否品牌替换" },
           attr: {
             is: "el-select",
             dictName: "is_effective",
             value: "N",
           },
-        },{
-          item: { width:100,key: "priceDiffer", title: "单价差" },
+        },
+        {
+          item: { width: 100, key: "priceDiffer", title: "单价差" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              const { taxPrice = 0, recentlyPrice = 0 } = prop;
+              return (prop.priceDiffer = (
+                Number(taxPrice) - Number(recentlyPrice)
+              ).toFixed(CONFIG.precision));
             },
           },
         },
 
         {
-          item: { width:100,key: "increase", title: "涨幅" },
+          item: { width: 100, key: "increase", title: "涨幅(%)" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              const { priceDiffer = 0, recentlyPrice = 0 } = prop;
+              return (prop.increase = recentlyPrice
+                ? ((Number(priceDiffer) / Number(recentlyPrice)) * 100).toFixed(
+                    2
+                  )
+                : "0.00");
             },
           },
         },
 
         {
-          item: { width:100,key: "yPurchaseQuantity", title: "预计年采购量" },
+          item: { width: 100, key: "yPurchaseQuantity", title: "预计年采购量" },
           attr: {
             is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              return prop == null ? 0 : (prop * 1).toFixed(CONFIG.precision);
             },
           },
         },
         {
-          item: { width:100,key: "yAffectedAmount", title: "预计年影响量" },
+          item: { width: 100, key: "yAffectedAmount", title: "预计年影响金额" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              const { priceDiffer = 0, yPurchaseQuantity = 0 } = prop;
+              return (prop.yAffectedAmount = (
+                Number(priceDiffer) * Number(yPurchaseQuantity)
+              ).toFixed(CONFIG.precision));
             },
           },
         },
 
         {
-          item: { width:150,key: "supplierName", title: "供应商名称" },
-          attr: {is: "el-input"},
-        },{
-          item: { width:150,key: "bidPrice", title: "中标价" },
+          item: { width: 150, key: "supplierName", title: "供应商名称" },
+          attr: { is: "el-input" },
+        },
+        {
+          item: { width: 150, key: "bidPrice", title: "中标价" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "unitPrice", title: "单价" },
+        },
+        {
+          item: { width: 150, key: "unitPrice", title: "单价" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "profit", title: "利润比" },
+        },
+        {
+          item: { width: 150, key: "profit", title: "利润比" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
@@ -357,22 +381,25 @@ export default function useColumns() {
         },
 
         {
-          item: { width:150,key: "supplierName1", title: "供应商名称1" },
-          attr: {is: "el-input"},
-        },{
-          item: { width:150,key: "bidPrice1", title: "中标价1" },
+          item: { width: 150, key: "supplierName1", title: "供应商名称1" },
+          attr: { is: "el-input" },
+        },
+        {
+          item: { width: 150, key: "bidPrice1", title: "中标价1" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "unitPrice1", title: "单价1" },
+        },
+        {
+          item: { width: 150, key: "unitPrice1", title: "单价1" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "profit1", title: "利润比1" },
+        },
+        {
+          item: { width: 150, key: "profit1", title: "利润比1" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
@@ -380,22 +407,25 @@ export default function useColumns() {
         },
 
         {
-          item: { width:150,key: "supplierName2", title: "供应商名称2" },
-          attr: {is: "el-input"},
-        },{
-          item: { width:150,key: "bidPrice2", title: "中标价2" },
+          item: { width: 150, key: "supplierName2", title: "供应商名称2" },
+          attr: { is: "el-input" },
+        },
+        {
+          item: { width: 150, key: "bidPrice2", title: "中标价2" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "unitPrice2", title: "单价2" },
+        },
+        {
+          item: { width: 150, key: "unitPrice2", title: "单价2" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "profit2", title: "利润比2" },
+        },
+        {
+          item: { width: 150, key: "profit2", title: "利润比2" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,

+ 89 - 86
src/views/purchase/apply/copy/index.vue

@@ -18,7 +18,7 @@ const fetchExist = async (prop) => {
 };
 
 export default {
-  name: "AddDrawer",
+  name: "CopyDrawer",
   props: {
     dict: {
       type: Object,
@@ -73,43 +73,57 @@ export default {
   watch: {},
   methods: {
     //
-    changeMaterialName(prop) {
-      const { row } = prop;
-      const { puOrg, customer, supplier } = this.params;
-      const { tax: taxName, unitName, code: materialCode } = row;
-      // task 1
-      tax(taxName).then((res) => {
-        const { ntaxrate } = res;
-        row.tax = ntaxrate === "0E-8" ? "0.000000" : (ntaxrate * 1).toFixed(6);
-      });
-      // task 2
-      unit(unitName).then((res) => {
-        const { id, code, name } = res;
-        row.unit = id;
-        row.unitCode = code;
-        row.unitName = name;
-        row.puUnit = id;
-        row.puUnitCode = code;
-        row.puUnitName = name;
-      });
-      // task 3
-      currency("人民币").then((res) => {
-        const { id, code, name } = res;
-        row.currency = id;
-        row.currencyCode = code;
-        row.currencyName = name;
-      });
-      // task 4
-      fetchExist({ puOrg, customer, supplier, materialCode }).then((res) => {
-        const { recentlyPrice, isApprovalFirst, isPriceAdjustment } = res;
-        row.recentlyPrice = recentlyPrice;
-        if (isApprovalFirst) {
-          row.isApprovalFirst = isApprovalFirst == 0 ? "Y" : "N";
-        }
-        if (isPriceAdjustment) {
-          row.isPriceAdjustment = isPriceAdjustment == 0 ? "Y" : "N";
-        }
-      });
+    async changeMaterialName(prop) {
+      const { selectData } = prop;
+      const {
+        puOrg,
+        customer,
+        supplier,
+        currency,
+        currencyCode,
+        currencyName,
+      } = this.params;
+      const { nickName: createByName } = this.$store.state.user;
+      if (selectData.length) {
+        this.params[this.tabName].splice(-1);
+      }
+      for (const item of selectData) {
+        this.loading = true;
+        const { tax: taxName, unitName, code: materialCode } = item;
+        // task 1
+        const { ntaxrate } = await tax(taxName);
+        // task 2
+        const {
+          id: puUnit,
+          code: puUnitCode,
+          name: puUnitName,
+        } = await unit(unitName);
+        // task 3
+        const {
+          recentlyPrice = "0",
+          isApprovalFirst = "N",
+          isPriceAdjustment = "N",
+        } = await fetchExist({ puOrg, customer, supplier, materialCode });
+        this.loading = false;
+        await this.onRowAdd(this.tabName, {
+          ...item,
+          currency: currency,
+          currencyCode: currencyCode,
+          currencyName: currencyName,
+          unit: puUnit,
+          unitCode: puUnitCode,
+          unitName: puUnitName,
+          puUnit: puUnit,
+          puUnitCode: puUnitCode,
+          puUnitName: puUnitName,
+          recentlyPrice,
+          isApprovalFirst,
+          isPriceAdjustment,
+          tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate).toFixed(6),
+          createByName: createByName,
+          updateByName: createByName,
+        });
+      }
     },
     //
     async fetchItem(prop) {
@@ -167,7 +181,7 @@ export default {
       this.params = this.$init.params([...TabColumns, ...TableColumns]);
     },
     //
-    async onRowAdd(prop) {
+    async onRowAdd(prop, pushParams = {}) {
       const {
         $notify,
         TabColumns,
@@ -185,6 +199,7 @@ export default {
       this.params[prop].push({
         delFlag: "0",
         ...this.$init.params(TableColumns),
+        ...pushParams,
       });
     },
     //
@@ -263,20 +278,10 @@ export default {
         ref="superForm"
         label-width="auto"
         label-position="right"
-        style="padding: 20px"
+        style="padding: 18px"
       >
-        <template slot="puOrgName" slot-scope="scope">
-          <component
-            v-bind="scope.attr"
-            v-model="scope.row[scope.item.key]"
-            :size="$attrs.size"
-            :source.sync="scope.row"
-            @change="changePuOrgName({ ...scope, select: $event })"
-          >
-          </component
-        ></template>
       </el-super-form>
-      <el-tabs v-model="tabName" style="padding: 0 20px 20px">
+      <el-tabs v-model="tabName" style="padding: 0 18px 18px">
         <el-tab-pane
           v-for="({ item, TableColumns: columns }, index) in TabColumns"
           :key="index"
@@ -284,47 +289,45 @@ export default {
           :name="item.key"
           lazy
         >
-          <el-super-table
-            v-model="params[item.key]"
-            :dict="dict"
-            :ref="tabName"
-            :columns="columns"
-            :size="$attrs.size"
-          >
-            <template slot="materialName" slot-scope="scope">
-              <component
-                v-bind="scope.attr"
-                v-model="scope.row[scope.item.key]"
-                :size="$attrs.size"
-                :source.sync="scope.row"
-                @change="changeMaterialName(scope)"
-              >
-              </component>
-            </template>
-            <el-table-column fixed="right" label="操作" width="100">
-              <template slot="header" slot-scope="scope">
-                <el-button :size="$attrs.size" @click="onRowAdd(tabName)">
-                  新增
-                </el-button>
-              </template>
-              <template slot-scope="scope">
-                <el-button
+          <div v-loading="loading" style="height: 600px; display: flex">
+            <el-super-table
+              v-model="params[item.key]"
+              :dict="dict"
+              :ref="tabName"
+              :columns="columns"
+              :size="$attrs.size"
+            >
+              <template slot="materialName" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
                   :size="$attrs.size"
-                  @click.native.prevent="onRowRemove(tabName, scope)"
+                  :source.sync="scope.row"
+                  @change="changeMaterialName({ ...scope, selectData: $event })"
                 >
-                  删除
-                </el-button>
+                </component>
               </template>
-            </el-table-column>
-          </el-super-table>
+              <el-table-column fixed="right" label="操作" width="100">
+                <template slot="header" slot-scope="scope">
+                  <el-button :size="$attrs.size" @click="onRowAdd(tabName)">
+                    新增
+                  </el-button>
+                </template>
+                <template slot-scope="scope">
+                  <el-button
+                    :size="$attrs.size"
+                    @click.native.prevent="onRowRemove(tabName, scope)"
+                  >
+                    删除
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-super-table>
+          </div>
         </el-tab-pane>
       </el-tabs>
     </el-drawer>
   </el-button>
 </template>
 
-<style scoped>
-::v-deep .el-table__row.is-hidden {
-  display: none;
-}
-</style>
+<style scoped></style>

+ 74 - 46
src/views/purchase/apply/edit/columns.js

@@ -1,4 +1,5 @@
 import CONFIG from "@/config";
+import { iunitprice } from "@/utils/expression";
 
 export default function useColumns() {
   const TableColumns = [
@@ -117,6 +118,7 @@ export default function useColumns() {
           item: { key: "materialName", title: "物料名称", require: true },
           attr: {
             is: "el-popover-select-v2",
+            multiple: true,
             valueKey: "name",
             referName: "MATERIAL_PARAM",
             dataMapping: {
@@ -141,7 +143,7 @@ export default function useColumns() {
         { item: { key: "specification", title: "规格" }, attr: {} },
         { item: { key: "model", title: "型号" }, attr: {} },
         {
-          item: { key: "unitName", title: "单位" },
+          item: { key: "unitName", title: "单位", hidden: false },
           attr: {
             is: "el-popover-select-v2",
             valueKey: "name",
@@ -150,7 +152,7 @@ export default function useColumns() {
           },
         },
         {
-          item: { key: "puUnitName", title: "采购单位" },
+          item: { key: "puUnitName", title: "采购单位", hidden: false },
           attr: {
             is: "el-popover-select-v2",
             valueKey: "name",
@@ -167,6 +169,8 @@ export default function useColumns() {
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
+            value: 1,
+            disabled: true,
           },
         },
         {
@@ -176,6 +180,7 @@ export default function useColumns() {
             valueKey: "ntaxrate",
             referName: "TAX_RATE_PARAM",
             dataMapping: { tax: "ntaxrate" },
+            disabled: true,
           },
         },
         {
@@ -190,10 +195,7 @@ export default function useColumns() {
           attr: {
             formatter: (prop) => {
               const { tax = 0, taxPrice = 0 } = prop;
-              prop.price = ((taxPrice / (tax / 100 + 1)) * 1).toFixed(
-                CONFIG.precision
-              );
-              return prop.price;
+              return (prop.price = iunitprice(tax, taxPrice));
             },
           },
         },
@@ -248,12 +250,20 @@ export default function useColumns() {
             },
           },
         },
-        { item: { key: "recentlyPrice", title: "最近价格" }, attr: {} },
+        {
+          item: { key: "recentlyPrice", title: "最近价格" },
+          attr: {
+            is: "el-input-number",
+            precision: CONFIG.precision,
+            disabled: true,
+          },
+        },
         {
           item: { key: "isApprovalFirst", title: "首次报批" },
           attr: {
             is: "el-select",
             dictName: "is_effective",
+            disabled: true,
           },
         },
         {
@@ -261,6 +271,7 @@ export default function useColumns() {
           attr: {
             is: "el-select",
             dictName: "is_effective",
+            disabled: true,
           },
         },
         {
@@ -281,7 +292,7 @@ export default function useColumns() {
         },
 
         {
-          item: { width:100,key: "isChannel", title: "是否渠道变更" },
+          item: { width: 100, key: "isChannel", title: "是否渠道变更" },
           attr: {
             is: "el-select",
             dictName: "is_effective",
@@ -289,68 +300,80 @@ export default function useColumns() {
           },
         },
         {
-          item: { width:100,key: "brandReplacement", title: "是否品牌替换" },
+          item: { width: 100, key: "brandReplacement", title: "是否品牌替换" },
           attr: {
             is: "el-select",
             dictName: "is_effective",
             value: "N",
           },
-        },{
-          item: { width:100,key: "priceDiffer", title: "单价差" },
+        },
+        {
+          item: { width: 100, key: "priceDiffer", title: "单价差" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              const { taxPrice = 0, recentlyPrice = 0 } = prop;
+              return (prop.priceDiffer = (
+                Number(taxPrice) - Number(recentlyPrice)
+              ).toFixed(CONFIG.precision));
             },
           },
         },
 
         {
-          item: { width:100,key: "increase", title: "涨幅" },
+          item: { width: 100, key: "increase", title: "涨幅(%)" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              const { priceDiffer = 0, recentlyPrice = 0 } = prop;
+              return (prop.increase = recentlyPrice
+                ? ((Number(priceDiffer) / Number(recentlyPrice)) * 100).toFixed(
+                    2
+                  )
+                : "0.00");
             },
           },
         },
 
         {
-          item: { width:100,key: "yPurchaseQuantity", title: "预计年采购量" },
+          item: { width: 100, key: "yPurchaseQuantity", title: "预计年采购量" },
           attr: {
             is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              return prop == null ? 0 : (prop * 1).toFixed(CONFIG.precision);
             },
           },
         },
         {
-          item: { width:100,key: "yAffectedAmount", title: "预计年影响量" },
+          item: { width: 100, key: "yAffectedAmount", title: "预计年影响金额" },
           attr: {
-            is: "el-computed-input-v2",
             formatter: (prop) => {
-              return prop == null ? 0 :(prop * 1).toFixed(CONFIG.precision);
+              const { priceDiffer = 0, yPurchaseQuantity = 0 } = prop;
+              return (prop.yAffectedAmount = (
+                Number(priceDiffer) * Number(yPurchaseQuantity)
+              ).toFixed(CONFIG.precision));
             },
           },
         },
 
         {
-          item: { width:150,key: "supplierName", title: "供应商名称" },
-          attr: {is: "el-input"},
-        },{
-          item: { width:150,key: "bidPrice", title: "中标价" },
+          item: { width: 150, key: "supplierName", title: "供应商名称" },
+          attr: { is: "el-input" },
+        },
+        {
+          item: { width: 150, key: "bidPrice", title: "中标价" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "unitPrice", title: "单价" },
+        },
+        {
+          item: { width: 150, key: "unitPrice", title: "单价" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "profit", title: "利润比" },
+        },
+        {
+          item: { width: 150, key: "profit", title: "利润比" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
@@ -358,22 +381,25 @@ export default function useColumns() {
         },
 
         {
-          item: { width:150,key: "supplierName1", title: "供应商名称1" },
-          attr: {is: "el-input"},
-        },{
-          item: { width:150,key: "bidPrice1", title: "中标价1" },
+          item: { width: 150, key: "supplierName1", title: "供应商名称1" },
+          attr: { is: "el-input" },
+        },
+        {
+          item: { width: 150, key: "bidPrice1", title: "中标价1" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "unitPrice1", title: "单价1" },
+        },
+        {
+          item: { width: 150, key: "unitPrice1", title: "单价1" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "profit1", title: "利润比1" },
+        },
+        {
+          item: { width: 150, key: "profit1", title: "利润比1" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
@@ -381,28 +407,30 @@ export default function useColumns() {
         },
 
         {
-          item: { width:150,key: "supplierName2", title: "供应商名称2" },
-          attr: {is: "el-input"},
-        },{
-          item: { width:150,key: "bidPrice2", title: "中标价2" },
+          item: { width: 150, key: "supplierName2", title: "供应商名称2" },
+          attr: { is: "el-input" },
+        },
+        {
+          item: { width: 150, key: "bidPrice2", title: "中标价2" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "unitPrice2", title: "单价2" },
+        },
+        {
+          item: { width: 150, key: "unitPrice2", title: "单价2" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
-        },{
-          item: { width:150,key: "profit2", title: "利润比2" },
+        },
+        {
+          item: { width: 150, key: "profit2", title: "利润比2" },
           attr: {
             is: "el-input-number",
             precision: CONFIG.precision,
           },
         },
-
         { item: { key: "createByName", title: "创建人名称" }, attr: {} },
         { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
       ],

+ 87 - 79
src/views/purchase/apply/edit/index.vue

@@ -96,40 +96,57 @@ export default {
   watch: {},
   methods: {
     //
-    changeMaterialName(prop) {
-      console.log(prop, "prop");
-      const { row } = prop;
-      const { puOrg, customer, supplier } = this.params;
-      const { tax: taxName, unitName, code: materialCode } = row;
-      // task 1
-      tax(taxName).then((res) => {
-        const { ntaxrate } = res;
-        row.tax = ntaxrate === "0E-8" ? "0.000000" : (ntaxrate * 1).toFixed(6);
-      });
-      // task 2
-      unit(unitName).then((res) => {
-        const { id, code, name } = res;
-        row.unit = id;
-        row.unitCode = code;
-        row.unitName = name;
-        row.puUnit = id;
-        row.puUnitCode = code;
-        row.puUnitName = name;
-      });
-      // task 3
-      currency("人民币").then((res) => {
-        const { id, code, name } = res;
-        row.currency = id;
-        row.currencyCode = code;
-        row.currencyName = name;
-      });
-      // task 4
-      fetchExist({ puOrg, customer, supplier, materialCode }).then((res) => {
-        const { recentlyPrice, isApprovalFirst, isPriceAdjustment } = res;
-        row.recentlyPrice = recentlyPrice;
-        row.isApprovalFirst = isApprovalFirst;
-        row.isPriceAdjustment = isPriceAdjustment;
-      });
+    async changeMaterialName(prop) {
+      const { selectData } = prop;
+      const {
+        puOrg,
+        customer,
+        supplier,
+        currency,
+        currencyCode,
+        currencyName,
+      } = this.params;
+      const { nickName: createByName } = this.$store.state.user;
+      if (selectData.length) {
+        this.params[this.tabName].splice(-1);
+      }
+      for (const item of selectData) {
+        this.loading = true;
+        const { tax: taxName, unitName, code: materialCode } = item;
+        // task 1
+        const { ntaxrate } = await tax(taxName);
+        // task 2
+        const {
+          id: puUnit,
+          code: puUnitCode,
+          name: puUnitName,
+        } = await unit(unitName);
+        // task 3
+        const {
+          recentlyPrice = "0",
+          isApprovalFirst = "N",
+          isPriceAdjustment = "N",
+        } = await fetchExist({ puOrg, customer, supplier, materialCode });
+        this.loading = false;
+        await this.onRowAdd(this.tabName, {
+          ...item,
+          currency: currency,
+          currencyCode: currencyCode,
+          currencyName: currencyName,
+          unit: puUnit,
+          unitCode: puUnitCode,
+          unitName: puUnitName,
+          puUnit: puUnit,
+          puUnitCode: puUnitCode,
+          puUnitName: puUnitName,
+          recentlyPrice,
+          isApprovalFirst,
+          isPriceAdjustment,
+          tax: Number(ntaxrate === "0E-8" ? 0 : ntaxrate).toFixed(6),
+          createByName: createByName,
+          updateByName: createByName,
+        });
+      }
     },
     //
     async fetchItem(prop) {
@@ -173,7 +190,7 @@ export default {
       this.params = this.$init.params([...TabColumns, ...TableColumns]);
     },
     //
-    async onRowAdd(prop) {
+    async onRowAdd(prop, pushParams = {}) {
       const {
         $notify,
         TabColumns,
@@ -191,6 +208,7 @@ export default {
       this.params[prop].push({
         delFlag: "0",
         ...this.$init.params(TableColumns),
+        ...pushParams,
       });
     },
     //
@@ -277,61 +295,51 @@ export default {
         ref="superForm"
         label-width="auto"
         label-position="right"
-        style="padding: 20px"
+        style="padding: 18px"
       >
-        <template slot="puOrgName" slot-scope="scope">
-          <component
-            v-bind="scope.attr"
-            v-model="scope.row[scope.item.key]"
-            :size="$attrs.size"
-            :source.sync="scope.row"
-            @change="changePuOrgName({ ...scope, select: $event })"
-          >
-          </component
-        ></template>
       </el-super-form>
-      <el-tabs v-model="tabName" style="padding: 0 20px 20px">
+      <el-tabs v-model="tabName" style="padding: 0 18px 18px">
         <el-tab-pane
           v-for="({ item, TableColumns: columns }, index) in TabColumns"
           :key="index"
           :label="item.title"
           :name="item.key"
           lazy
-        >
-          <el-super-table
-            v-model="priceApply[item.key]"
-            :dict="dict"
-            :ref="tabName"
-            :columns="columns"
-            :size="$attrs.size"
-            style="padding: 20px 10px;height: 400px;"
-          >
-            <template slot="materialName" slot-scope="scope">
-              <component
-                v-bind="scope.attr"
-                v-model="scope.row[scope.item.key]"
-                :size="$attrs.size"
-                :source.sync="scope.row"
-                @change="changeMaterialName(scope)"
-              >
-              </component>
-            </template>
-            <el-table-column fixed="right" label="操作" width="100">
-              <template slot="header" slot-scope="scope">
-                <el-button :size="$attrs.size" @click="onRowAdd(tabName)">
-                  新增
-                </el-button>
-              </template>
-              <template slot-scope="scope">
-                <el-button
+          ><div v-loading="loading" style="height: 600px; display: flex">
+            <el-super-table
+              v-model="priceApply[item.key]"
+              :dict="dict"
+              :ref="tabName"
+              :columns="columns"
+              :size="$attrs.size"
+            >
+              <template slot="materialName" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
                   :size="$attrs.size"
-                  @click.native.prevent="onRowRemove(tabName, scope)"
+                  :source.sync="scope.row"
+                  @change="changeMaterialName({ ...scope, selectData: $event })"
                 >
-                  删除
-                </el-button>
+                </component>
               </template>
-            </el-table-column>
-          </el-super-table>
+              <el-table-column fixed="right" label="操作" width="100">
+                <template slot="header" slot-scope="scope">
+                  <el-button :size="$attrs.size" @click="onRowAdd(tabName)">
+                    新增
+                  </el-button>
+                </template>
+                <template slot-scope="scope">
+                  <el-button
+                    :size="$attrs.size"
+                    @click.native.prevent="onRowRemove(tabName, scope)"
+                  >
+                    删除
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-super-table>
+          </div>
         </el-tab-pane>
       </el-tabs>
     </el-drawer>

+ 2 - 2
src/views/purchase/transferOrder/add.vue

@@ -1302,7 +1302,7 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <el-col :span="1.5">
             <el-form-item label="最后修改人">
               <el-input
                 v-model="basicForm.updateByName"
@@ -1323,7 +1323,7 @@
                 style="width: 200px"
               />
             </el-form-item>
-          </el-col>
+          </el-col> -->
         </el-row>
       </el-form>
 

+ 31 - 13
src/views/purchase/transferOrder/index.vue

@@ -14,13 +14,13 @@
             <el-col :span="1.5">
               <el-form-item label="单据日期">
                 <el-date-picker
-                style="width: 200px"
-                size="mini"
-                clearable
-                value-format="yyyy-MM-dd"
-                  v-model="queryParams.billDate"
-                  type="date">
-                </el-date-picker>
+                  size="mini"
+                  v-model="dateRange"
+                  style="width: 240px"
+                  value-format="yyyy-MM-dd"
+                  type="daterange"
+                  range-separator="-"
+                ></el-date-picker>
               </el-form-item>
             </el-col>
             <el-col :span="1.5">
@@ -57,6 +57,13 @@
                   />
                 </el-form-item>
               </el-col>
+              <el-col :span="1.5">
+              <el-form-item label="制单人">
+                <el-select clearable size="mini" v-model="queryParams.createBy"  @focus="chooseRefer('CONTACTS_PARAM', true, '制单人')" style="width: 200px">
+                  <el-option v-for="item in manOptions" :key="item.id" :label="item.name" :value="item.code"/>
+                </el-select>
+              </el-form-item>
+            </el-col>
             </el-row>
           </div>
           </CollapseTransition>
@@ -117,8 +124,8 @@
           <el-table-column show-overflow-tooltip label="制单日期" align="center" prop="createTime" width="150px"/>
           <!-- <el-table-column show-overflow-tooltip label="审批人" align="center" prop="code" width="150px"/> -->
           <!-- <el-table-column show-overflow-tooltip label="审批日期" align="center" prop="code" width="150px"/> -->
-          <el-table-column show-overflow-tooltip label="最后修改人" align="center" prop="updateByName" width="100px"/>
-          <el-table-column show-overflow-tooltip label="最后修改时间" align="center" prop="updateTime" width="150px"/>
+          <!-- <el-table-column show-overflow-tooltip label="最后修改人" align="center" prop="updateByName" width="100px"/>
+          <el-table-column show-overflow-tooltip label="最后修改时间" align="center" prop="updateTime" width="150px"/> -->
           <el-table-column
           fixed="right"
           label="操作"
@@ -346,13 +353,14 @@ export default {
       page: '',
       queryParams: {
         deliveryInventoryOrg: '',
-        billDate: '',
-        billType: '',
         storageInventoryOrg: '',
         code: '',
+        createBy:'',
         pageNum: 1,
         pageSize: 10
       },
+      //单据日期查询范围
+      dateRange:[],
       referCondition: {
         type: '',
         isPage: true,
@@ -365,6 +373,7 @@ export default {
       }],
       chuOrgOptions: [],
       ruOrgOptions: [],
+      manOptions: [],
       tableList: [],
       total: 0,
       materialInfo: [],
@@ -445,19 +454,20 @@ export default {
       this.getList(this.queryParams)
     },
     resetList() {
+      this.dateRange = [];
       this.queryParams = {
         deliveryInventoryOrg: '',
-        billDate: '',
         billType: '',
         storageInventoryOrg: '',
         code: '',
+        createBy:'',
         pageNum: 1,
         pageSize: 10
       }
       this.getList(this.queryParams)
     },
     getList(params){
-      getOrderList(params).then(res => {
+      getOrderList(this.addDateRange(params, this.dateRange)).then(res => {
         if (res.code === 200) {
           this.tableList = res.rows
           this.total = res.total
@@ -506,6 +516,10 @@ export default {
         this.$modal.closeLoading();
       })
     },
+    //查询条件单据日期改变后
+    billDateAfterChange(val){
+      console.log('val',val);
+    },
     // 选中某行
     select(row) {
       console.log('选中', row)
@@ -551,6 +565,10 @@ export default {
         this.ruOrgOptions = selection
         this.queryParams.storageInventoryOrg = selection[0].id
       }
+      if (this.referCondition.title == '制单人') {
+        this.manOptions = selection
+        this.queryParams.createBy = selection[0].code
+      }
     },
   }
 

+ 1 - 1
vue.config.js

@@ -47,7 +47,7 @@ module.exports = {
         // target: `http://172.16.13.113:8000/drp-admin`, //DWT本地
         // target: `http://172.16.13.21:8000/drp-admin`, //CKF本地
         // target: `http://172.16.13.43:8000/drp-admin`, //lz's localhost
-        // target: `http://172.16.63.52:8000/drp-admin`, //董卓
+      //  target: `http://172.16.63.126:8000/drp-admin`, //wjie
          // target: `http://127.0.0.1:8000/drp-admin`,
         changeOrigin: true,
         pathRewrite: {