Explorar o código

u颇大特、

002201 hai 1 ano
pai
achega
7fa17ebafc

+ 55 - 70
src/components/popover-select-v2/multiple.vue

@@ -7,7 +7,7 @@ export default {
   props: {
     // v-model
     value: {
-      type: [Array, String],
+      type: [Array, String, Number],
       require: true,
     },
     // 参照类型 ,对应后端
@@ -35,7 +35,9 @@ export default {
       default: () => ({}),
     },
   },
-  components: {},
+  components: {
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+  },
   data() {
     return {
       size: "mini",
@@ -62,13 +64,10 @@ export default {
         this.$emit("input", value);
       },
     },
-    tableColumns: {
+    TableColumns: {
       get() {
         const { referName } = this.$props;
-        const {
-          default: d,
-        } = require(`../popover-select/components/${referName}`);
-        return d.filter(({ key }) => key);
+        return require(`../popover-select/components/${referName}`).default;
       },
     },
   },
@@ -174,79 +173,65 @@ export default {
     <el-dialog
       :width="width"
       :visible.sync="visible"
+      :show-close="false"
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       append-to-body
     >
-      <div slot="footer">
-        <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="useConfirm(selectData)"
-          >确 认</el-button
-        >
-        <el-button :size="$attrs.size" :loading="loading" @click="hide"
-          >取 消</el-button
+      <div slot="title" style="display: flex; justify-content: space-between">
+        <el-form
+          :size="size"
+          :inline="true"
+          :model="model"
+          @submit.native.prevent
+          style="display: flex; flex-direction: column"
         >
-        
+          <div>
+            <el-form-item prop="search">
+              <el-input
+                v-model="model.search"
+                @change="useQuery"
+                @keydown.enter="useQuery"
+              >
+              </el-input>
+            </el-form-item>
+            <el-form-item>
+              <el-button icon="el-icon-refresh" @click="useReset"></el-button>
+            </el-form-item>
+          </div>
+        </el-form>
+        <div>
+          <el-button
+            type="primary"
+            :size="$attrs.size"
+            :loading="loading"
+            @click="useConfirm(selectData)"
+          >
+            确认
+          </el-button>
+          <el-button :size="$attrs.size" :loading="loading" @click="hide">
+            取消
+          </el-button>
+        </div>
       </div>
-      <el-form
+      <div
         v-loading="loading"
-        :inline="true"
-        :model="model"
-        :size="size"
-        @submit.native.prevent
+        style="height: 40vh; display: flex; margin-top: -30px"
       >
-        <el-form-item prop="search">
-          <el-input
-            v-model="model.search"
-            @change="useQuery"
-            @keydown.enter="useQuery"
-          >
-          </el-input>
-        </el-form-item>
-        <el-form-item>
-          <el-button icon="el-icon-refresh" @click="useReset"></el-button>
-        </el-form-item>
-        <el-table
-          ref="multipleTable"
-          :data="data"
+        <el-super-table
+          v-model="data"
           :size="size"
-          height="45vh"
-          @selection-change="useSelect"
-        >
-          <el-table-column width="55" type="selection" align="center">
-          </el-table-column>
-          <el-table-column
-            v-for="(column, index) in tableColumns"
-            :key="index"
-            :prop="column.key"
-            :label="column.title"
-            :width="column.width || 'auto'"
-            show-overflow-tooltip
-          >
-            <template slot-scope="scope">
-              <dr-computed-input
-                v-if="column.type === 'ComputedInput'"
-                v-model="scope.row[column.key]"
-                :source="scope.row"
-                :computed="column.computed"
-                :placeholder="column.placeholder"
-                style="width: 100%"
-              ></dr-computed-input>
-              <span v-else> {{ scope.row[column.key] }}</span>
-            </template>
-          </el-table-column>
-        </el-table>
-        <pagination
-          v-show="!loading"
-          :total="page.total"
-          :page.sync="page.pageNum"
-          :limit.sync="page.pageSize"
+          :page="page"
+          :columns="TableColumns"
+          checkbox
+          pagination
+          highlight-current-row
           @pagination="useQuery"
-        />
-      </el-form>
+          @row-select="useSelect"
+          @row-dblclick="useConfirm([$event])"
+        >
+        </el-super-table>
+      </div>
     </el-dialog>
     <el-scrollbar
       v-if="lastSelectData.length"

+ 152 - 53
src/views/purchase/contract/add/columns.js

@@ -3,7 +3,7 @@ import CONFIG from "@/config";
 export default function useColumns() {
   const TableColumns = [
     {
-      item: { key: "puOrgName", title: "采购组织", require: true,width:150 },
+      item: { key: "puOrgName", title: "采购组织", require: true, width: 150 },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "name",
@@ -14,7 +14,10 @@ export default function useColumns() {
         },
       },
     },
-    { item: { key: "code", title: "合同编码",width:150 }, attr: { is: "el-input" } },
+    {
+      item: { key: "code", title: "合同编码", width: 150 },
+      attr: { is: "el-input" },
+    },
     {
       item: { key: "status", title: "状态" },
       attr: {
@@ -25,14 +28,14 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "lastPuMoney", title: "上年度采购额",width:100 },
+      item: { key: "lastPuMoney", title: "上年度采购额", width: 100 },
       attr: {
         is: "el-input-number",
         precision: CONFIG.precision,
       },
     },
     {
-      item: { key: "buyerName", title: "采购员", require: true,width:100 },
+      item: { key: "buyerName", title: "采购员", require: true, width: 100 },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "name",
@@ -46,7 +49,7 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "supplierName", title: "供应商", require: true,width:100 },
+      item: { key: "supplierName", title: "供应商", require: true, width: 100 },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "name",
@@ -58,18 +61,23 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "contractType", title: "合同类型", require: true ,width:100},
+      item: {
+        key: "contractType",
+        title: "合同类型",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-select", dictName: "puarchase_contract_contract_type" },
     },
     {
-      item: { key: "puMoneyYear", title: "本年度采购额",width:100 },
+      item: { key: "puMoneyYear", title: "本年度采购额", width: 100 },
       attr: {
         is: "el-input-number",
         precision: CONFIG.precision,
       },
     },
     {
-      item: { key: "puDeptName", title: "采购部门", require: true ,width:100},
+      item: { key: "puDeptName", title: "采购部门", require: true, width: 100 },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "name",
@@ -81,33 +89,63 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "supplierTier", title: "供应商层级", require: true ,width:100},
+      item: {
+        key: "supplierTier",
+        title: "供应商层级",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-select", dictName: "puarchase_contract_supplier_tier" },
     },
     {
-      item: { key: "contractName", title: "合同名称", require: true ,width:100},
+      item: {
+        key: "contractName",
+        title: "合同名称",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-input" },
     },
     {
-      item: { key: "grossRateAverage", title: "平均毛利率 (%)", require: true,width:100 },
+      item: {
+        key: "grossRateAverage",
+        title: "平均毛利率 (%)",
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-input-number",
         precision: 2,
       },
     },
     {
-      item: { key: "approveFlow", title: "审批流程", require: true,width:100 },
+      item: {
+        key: "approveFlow",
+        title: "审批流程",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-select", dictName: "puarchase_contract_approve_flow" },
     },
     {
-      item: { key: "consumableClass", title: "耗材类别", require: true,width:100 },
+      item: {
+        key: "consumableClass",
+        title: "耗材类别",
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-select",
         dictName: "puarchase_contract_consumable_class",
       },
     },
     {
-      item: { key: "effectiveDate", title: "合同生效日期", require: true,width:100 },
+      item: {
+        key: "effectiveDate",
+        title: "合同生效日期",
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-date-picker",
         valueFormat: "yyyy-MM-dd",
@@ -125,22 +163,42 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "contractFormat", title: "合同格式", require: true,width:100 },
+      item: {
+        key: "contractFormat",
+        title: "合同格式",
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-select",
         dictName: "puarchase_contract_contract_format",
       },
     },
     {
-      item: { key: "productName", title: "产品类别&名称", require: true,width:100 },
+      item: {
+        key: "productName",
+        title: "产品类别&名称",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-input" },
     },
     {
-      item: { key: "endDate", title: "合同终止日期", require: true ,width:100},
+      item: {
+        key: "endDate",
+        title: "合同终止日期",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-date-picker", valueFormat: "yyyy-MM-dd" },
     },
     {
-      item: { key: "invoiceTax", title: "发票税率 (%)", require: true ,width:100},
+      item: {
+        key: "invoiceTax",
+        title: "发票税率 (%)",
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "ntaxrate",
@@ -151,26 +209,36 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "emergencyDegree", title: "紧急程度", require: true,width:100 },
+      item: {
+        key: "emergencyDegree",
+        title: "紧急程度",
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-select",
         dictName: "puarchase_contract_emergency_degree",
       },
     },
     {
-      item: { key: "project", title: "项目医院", require: true,width:100 },
+      item: { key: "project", title: "项目医院", require: true, width: 100 },
       attr: { is: "el-input" },
     },
     {
-      item: { key: "deliveryType", title: "交货方式", require: true,width:100 },
+      item: {
+        key: "deliveryType",
+        title: "交货方式",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-select", dictName: "puarchase_contract_delivery_type" },
     },
     {
-      item: { key: "source", title: "合同来源",width:100 },
+      item: { key: "source", title: "合同来源", width: 100 },
       attr: { is: "el-input", value: "自制", disabled: true },
     },
     {
-      item: { key: "contractPartycName", title: "合同丙方",width:100 },
+      item: { key: "contractPartycName", title: "合同丙方", width: 100 },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "name",
@@ -182,30 +250,40 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "guaranteePeriodEnd", title: "质保期限", require: true,width:100 },
+      item: {
+        key: "guaranteePeriodEnd",
+        title: "质保期限",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-input-number", precision: 2 },
     },
     {
-      item: { key: "freightMethods", title: "运费承担方式",width:100 },
+      item: { key: "freightMethods", title: "运费承担方式", width: 100 },
       attr: {
         is: "el-select",
         dictName: "puarchase_contract_freight_methods",
       },
     },
     {
-      item: { key: "signDate", title: "合同签订日期",width:100 },
+      item: { key: "signDate", title: "合同签订日期", width: 100 },
       attr: { is: "el-date-picker", valueFormat: "yyyy-MM-dd" },
     },
     {
-      item: { key: "isTarget", title: "是否有指标", require: true,width:100 },
+      item: { key: "isTarget", title: "是否有指标", require: true, width: 100 },
       attr: { is: "el-select", dictName: "sys_yes_no" },
     },
     {
-      item: { key: "contractTarget", title: "合同指标" ,width:100},
+      item: { key: "contractTarget", title: "合同指标", width: 100 },
       attr: { is: "el-input", placeholder: '当【是否有指标】="有"时,必填' },
     },
     {
-      item: { key: "exemptionPostageCondtion", title: "包邮条件", span: 12 ,width:100},
+      item: {
+        key: "exemptionPostageCondtion",
+        title: "包邮条件",
+        span: 12,
+        width: 100,
+      },
       attr: {
         is: "el-input",
         placeholder:
@@ -213,26 +291,37 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "isRebate", title: "是否有返利", require: true,width:100 },
+      item: { key: "isRebate", title: "是否有返利", require: true, width: 100 },
       attr: { is: "el-select", dictName: "sys_yes_no" },
     },
     {
-      item: { key: "rebatePolicy", title: "返利政策", span: 18, require: true ,width:100},
+      item: {
+        key: "rebatePolicy",
+        title: "返利政策",
+        span: 18,
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-input",
         placeholder: '当【是否有返利】="有"时,必填',
       },
     },
     {
-      item: { key: "externalContract", title: "外部合同号",width:100 },
+      item: { key: "externalContract", title: "外部合同号", width: 100 },
       attr: { is: "el-input" },
     },
     {
-      item: { key: "rollbackPolicy", title: "退换货政策", require: true,width:100 },
+      item: {
+        key: "rollbackPolicy",
+        title: "退换货政策",
+        require: true,
+        width: 100,
+      },
       attr: { is: "el-input" },
     },
     {
-      item: { key: "enquiryCode", title: "询价单号",width:100 },
+      item: { key: "enquiryCode", title: "询价单号", width: 100 },
       attr: { is: "el-input" },
     },
     {
@@ -241,13 +330,12 @@ export default function useColumns() {
         title: "合同主要内容",
         require: true,
         span: 24,
-        width:100
-        
+        width: 100,
       },
       attr: { is: "el-input", type: "textarea" },
     },
     {
-      item: { key: "refusalReasons", title: "拒绝理由", span: 24,width:100 },
+      item: { key: "refusalReasons", title: "拒绝理由", span: 24, width: 100 },
       attr: { is: "el-input" },
     },
     // {
@@ -259,32 +347,47 @@ export default function useColumns() {
     //   attr: { is: "el-file-upload", fileType: ["pdf"], disabled: true },
     // },
     {
-      item: { key: "externalFile", title: "对外附件", span: 24,width:100 },
+      item: { key: "externalFile", title: "对外附件", span: 24, width: 100 },
       attr: { is: "el-file-upload", fileType: ["pdf"] },
     },
     {
-      item: { key: "puFile", title: "采购商盖章合同附件", span: 24,width:100 },
+      item: {
+        key: "puFile",
+        title: "采购商盖章合同附件",
+        span: 24,
+        width: 100,
+      },
       attr: { is: "el-file-upload", fileType: ["pdf"] },
     },
     {
-      item: { key: "supplierFile", title: "供应商盖章合同附件", span: 24,width:100},
+      item: {
+        key: "supplierFile",
+        title: "供应商盖章合同附件",
+        span: 24,
+        width: 100,
+      },
       attr: { is: "el-file-upload", fileType: ["pdf"] },
     },
     {
-      item: { key: "projectCode", title: "项目编号" ,width:100},
+      item: { key: "projectCode", title: "项目编号", width: 100 },
       attr: { is: "el-input" },
     },
     {
-      item: { key: "projectName", title: "项目名称",width:100 },
+      item: { key: "projectName", title: "项目名称", width: 100 },
       attr: { is: "el-input" },
     },
     { item: { key: "area", title: "区域" }, attr: { is: "el-input" } },
     {
-      item: { key: "consigneePhone", title: "收货人联系方式",width:100 },
+      item: { key: "consigneePhone", title: "收货人联系方式", width: 100 },
       attr: { is: "el-input" },
     },
     {
-      item: { key: "paymentAgreement", title: "付款协议", require: true,width:100 },
+      item: {
+        key: "paymentAgreement",
+        title: "付款协议",
+        require: true,
+        width: 100,
+      },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "name",
@@ -296,14 +399,14 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "taxPrice", title: "价税合计",width:100 },
+      item: { key: "taxPrice", title: "价税合计", width: 100 },
       attr: {
         is: "el-input-number",
         precision: CONFIG.precision,
       },
     },
     {
-      item: { key: "currencyName", title: "币种", require: true,width:100 },
+      item: { key: "currencyName", title: "币种", require: true, width: 100 },
       attr: {
         is: "el-popover-select-v2",
         valueKey: "name",
@@ -315,7 +418,7 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "guaranteePeriod", title: "质保期",width:100 },
+      item: { key: "guaranteePeriod", title: "质保期", width: 100 },
       attr: {
         is: "el-input-number",
         precision: CONFIG.precision,
@@ -414,7 +517,7 @@ export default function useColumns() {
           attr: {
             formatter: (prop) => {
               const { qty = 0, taxPrice = 0 } = prop;
-              prop.taxMoney = (qty * taxPrice * 1);
+              prop.taxMoney = qty * taxPrice * 1;
               return prop.taxMoney;
             },
           },
@@ -436,11 +539,7 @@ export default function useColumns() {
           attr: {
             formatter: (prop) => {
               const { qty = 0, tax = 0, taxPrice = 0 } = prop;
-              prop.taxFreeMoney = (
-                qty *
-                (taxPrice / (tax / 100 + 1)) *
-                1
-              );
+              prop.taxFreeMoney = qty * (taxPrice / (tax / 100 + 1)) * 1;
               return prop.taxFreeMoney;
             },
           },

+ 28 - 30
src/views/purchase/contract/add/index.vue

@@ -1,7 +1,7 @@
 <script>
 import useColumns from "./columns";
-import { REFER } from "@/components/popover-select/api";
-import { ADD, CODE } from "@/api/business/purchase/contract";
+import { ADD, CODE, LINKAGREEMENT } from "@/api/business/purchase/contract";
+import { tax, currency } from "@/components/popover-select-v2/fetch";
 
 export default {
   name: "AddDrawer",
@@ -73,9 +73,7 @@ export default {
         const data = await CODE();
         if (data) {
           this.params.code = data;
-          return true;
         } else {
-          return false;
         }
       } catch (err) {
         // catch
@@ -86,20 +84,23 @@ export default {
       }
     },
     //
+    async changePaymentAgreement(prop) {
+      console.log(prop);
+      const {
+        selectData: { code },
+      } = prop;
+      const res = await LINKAGREEMENT(code);
+      console.log("res", res);
+    },
+    //
     async changeMaterialName(prop) {
       const { row } = prop;
       const { rateCode } = row;
       try {
         // try
         this.loading = true;
-        const { code, rows } = await REFER({
-          search: rateCode,
-          type: "TAX_RATE_PARAM",
-        });
-        if (code === 200) {
-          const [{ ntaxrate }] = rows;
-          row.tax = ntaxrate === "0E-8" ? "0.00000000" : ntaxrate;
-        }
+        const { ntaxrate } = await tax(rateCode);
+        row.tax = Number(ntaxrate === "0E-8" ? 0 : ntaxrate);
       } catch (err) {
         // catch
         console.error(err);
@@ -110,6 +111,8 @@ export default {
     },
     //
     async open() {
+      this.visible = true;
+      this.fetchCode();
       const {
         user: {
           deptId: puDept,
@@ -126,26 +129,10 @@ export default {
       this.params.buyerName = buyerName;
       this.params.puDept = puDept;
       this.params.puDeptName = puDeptName;
-      const { id, code, name } = await this.getCurrency("人民币");
+      const { id, code, name } = await currency("人民币");
       this.params.currency = id;
       this.params.currencyCode = code;
       this.params.currencyName = name;
-      this.visible = await this.fetchCode();
-    },
-    async getCurrency(search) {
-      let page = { pageNum: 1, pageSize: 10 };
-
-      const { code, rows } = await REFER(
-        {
-          isPage: true,
-          search,
-          type: "CURRENCY_PARAM",
-        },
-        page
-      );
-      if (code == 200) {
-        return rows[0];
-      }
     },
     //
     async hide() {
@@ -251,7 +238,18 @@ export default {
         label-width="auto"
         label-position="right"
         style="padding: 20px"
-      ></el-super-form>
+      >
+        <template slot="paymentAgreement" slot-scope="scope">
+          <component
+            v-bind="scope.attr"
+            v-model="scope.row[scope.item.key]"
+            :size="$attrs.size"
+            :source.sync="scope.row"
+            @change="changePaymentAgreement({ ...scope, selectData: $event })"
+          >
+          </component>
+        </template>
+      </el-super-form>
 
       <el-tabs v-model="tabName" style="margin: 0 20px">
         <el-tab-pane