002201 há 1 ano atrás
pai
commit
b40bb205b4

+ 19 - 5
src/components/popover-select-v2/index.vue

@@ -166,12 +166,26 @@ export default {
     >
       <i class="el-icon-search" slot="suffix" @click="open"> </i>
       <template slot-scope="{ item }">
-        <div
-          style="text-overflow: ellipsis; overflow: hidden; line-height: 16px"
+        <p
+          style="
+            text-overflow: ellipsis;
+            overflow: hidden;
+            line-height: 16px;
+            margin: 5px 0;
+          "
         >
           {{ item.name }}
-        </div>
-        <span style="font-size: 12px; color: #b4b4b4">{{ item.code }}</span>
+        </p>
+        <p
+          style="
+            font-size: 12px;
+            color: #b4b4b4;
+            line-height: 16px;
+            margin: 5px 0;
+          "
+        >
+          {{ item.code }}
+        </p>
       </template>
     </el-autocomplete>
     <el-dialog
@@ -240,7 +254,7 @@ export default {
             :key="index"
             :prop="column.key"
             :label="column.title"
-            :width="column.width || 200"
+            :width="column.width || 'auto'"
             show-overflow-tooltip
           >
             <template slot-scope="scope">

+ 1 - 1
src/components/popover-select-v2/multiple.vue

@@ -169,7 +169,7 @@ export default {
 </script>
 <template>
   <div class="popover-select-v2 popover-select-v2--multiple">
-    <el-input v-bind="$attrs" style="width: 100%">
+    <el-input v-bind="$attrs" style="width: 100%" @focus="open">
       <i class="el-icon-search" slot="suffix" @click="open"> </i>
     </el-input>
     <el-dialog

+ 6 - 13
src/components/popover-select/components/CUSTOMERDEPT_PARAM.js

@@ -1,22 +1,15 @@
 // 客户部门
 export default [
-  // {
-  //   key: "id",
-  //   title: "客户部门ID",
-  //   type: "Input",
-  //   search: true,
-  // },
+  {
+    key: "id",
+    title: "客户ID",
+  },
   {
     key: "code",
-    title: "客户部门编码",
-    type: "Input",
-    search: true,
+    title: "客户编码",
   },
   {
     key: "name",
-    title: "客户部门名称",
-    type: "Input",
-    search: true,
+    title: "客户名称",
   },
 ];
-

+ 2 - 2
src/views/purchase/apply/add/column.js

@@ -1,4 +1,4 @@
-export const FormColumns = [
+export const TableColumns = [
   {
     key: "priceName",
     title: "价格名称",
@@ -431,4 +431,4 @@ export const TabColumns = [
   },
 ];
 
-export default { FormColumns, TabColumns };
+export default { TableColumns, TabColumns };

+ 1 - 1
src/views/purchase/apply/add/index.vue

@@ -205,7 +205,7 @@ export default {
     >
       <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
         <el-col
-          v-for="(column, index) in formColumns"
+          v-for="(column, index) in TableColumns"
           :key="index"
           :span="column.span || 8"
         >

+ 110 - 0
src/views/purchase/apply/column copy.js

@@ -0,0 +1,110 @@
+export const TableColumns = [
+  { item: { key: "priceName", title: "价格名称" }, attr: {} },
+  { item: { key: "priceCode", title: "价格编码" }, attr: {} },
+  {
+    item: { key: "status", title: "状态" },
+    attr: { dictName: "sys_status" },
+  },
+  { item: { key: "supplierName", title: "供应商" }, attr: {} },
+  { item: { key: "currencyName", title: "币种" }, attr: {} },
+  { item: { key: "explainStr", title: "价格合理性说明" }, attr: {} },
+  { item: { key: "buyerName", title: "采购员" }, attr: {} },
+  { item: { key: "puDeptName", title: "采购部门" }, attr: {} },
+  {
+    item: { key: "file", title: "附件" },
+    attr: { component: "dr-file-preview" },
+  },
+  { item: { key: "createByName", title: "创建人" }, attr: {} },
+  { item: { key: "source", title: "来源单据号" }, attr: {} },
+  { item: { key: "id", title: "来源单据id" }, attr: {} },
+  {
+    item: { key: "isEffective", title: "是否已推价格" },
+    attr: { dictName: "is_effective" },
+  },
+  { item: { key: "effectiveDate", title: "生效日期" }, attr: {} },
+  { item: { key: "sourceType", title: "来源单据类型" }, attr: {} },
+];
+console.log(
+  JSON.stringify(
+    TableColumns.map((item) => ({
+      item: { key: item.key, title: item.title },
+      attr: {
+        component: item.inputType,
+        dictName: item.referName,
+      },
+    }))
+  )
+);
+export const SearchColumns = [
+  {
+    item: { key: "supplierName", title: "供应商" },
+    attr: {
+      component: "el-popover-select-v2",
+      referName: "SUPPLIER_PARAM",
+      dataMapping: { supplier: "code", supplierName: "name" },
+    },
+  },
+  {
+    item: { key: "puOrgName", title: "采购组织" },
+    attr: {
+      component: "el-popover-select-v2",
+      referName: "ORG_PARAM",
+      dataMapping: { puOrg: "code", puOrgName: "name" },
+    },
+  },
+  {
+    item: { key: "buyerName", title: "采购员" },
+    attr: {
+      component: "el-popover-select-v2",
+      referName: "CONTACTS_PARAM",
+      dataMapping: { buyer: "code", buyerName: "name" },
+    },
+  },
+  {
+    item: { key: "currencyName", title: "币种" },
+    attr: {
+      component: "el-popover-select-v2",
+      referName: "CURRENCY_PARAM",
+      dataMapping: { currency: "code", currencyName: "name" },
+    },
+  },
+  {
+    item: { key: "puDeptName", title: "采购部门" },
+    attr: {
+      component: "el-popover-select-v2",
+      referName: "DEPT_PARAM",
+      dataMapping: { puDept: "code", puDeptName: "name" },
+    },
+  },
+  {
+    item: { key: "isEffective", title: "是否推价" },
+    attr: {
+      component: "Select",
+      dictName: "is_effective",
+      clearable: true,
+    },
+  },
+  {
+    item: { key: "status", title: "状态" },
+    attr: {
+      component: "Select",
+      dictName: "sys_status",
+      clearable: true,
+    },
+  },
+];
+
+console.log(
+  JSON.stringify(
+    SearchColumns.map((item) => ({
+      item: { key: item.key, title: item.title },
+      attr: {
+        component: item.inputType,
+        dictName: item.referName,
+        referName: item.referName,
+        clearable: item.clearable,
+        dataMapping: item.dataMapping,
+      },
+    }))
+  )
+);

+ 4 - 1
src/views/purchase/apply/edit/index.vue

@@ -62,6 +62,9 @@ export default {
           }
         );
       }
+      if (type === "ORG_PARAM") {
+        console.log(prop, type, source);
+      }
     },
     //
     async fetchItem(prop) {
@@ -189,7 +192,7 @@ export default {
     >
       <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
         <el-col
-          v-for="(column, index) in formColumns"
+          v-for="(column, index) in TableColumns"
           :key="index"
           :span="column.span || 8"
         >

+ 6 - 6
src/views/purchase/apply/hooks/data.js

@@ -1,22 +1,22 @@
 import { initRules, initParams } from "@/utils/init";
 
 export default function useData(prop) {
-  const { FormColumns, TabColumns } = prop;
+  const { TableColumns, TabColumns } = prop;
   const size = "mini";
   const width = "100%";
   const visible = false;
   const loading = false;
-  const formColumns = FormColumns;
-  const rules = initRules(FormColumns);
+  const TableColumns = TableColumns;
+  const rules = initRules(TableColumns);
   const params = {
     priceApplyOrgs: [],
     priceApplyItems: [],
-    ...initParams(FormColumns),
+    ...initParams(TableColumns),
   };
   const resetParams = () => ({
     priceApplyOrgs: [],
     priceApplyItems: [],
-    ...initParams(FormColumns),
+    ...initParams(TableColumns),
   });
   const tabColumns = TabColumns;
   const tabName = "priceApplyItems";
@@ -25,7 +25,7 @@ export default function useData(prop) {
     width,
     visible,
     loading,
-    formColumns,
+    TableColumns,
     rules,
     params,
     tabColumns,

+ 2 - 2
src/views/purchase/apply/hooks/dicts.js

@@ -1,10 +1,10 @@
 import { initDicts } from "@/utils/init";
 
 export default function useDicts(prop) {
-  const { FormColumns = [], TabColumns = [] } = prop;
+  const { TableColumns = [], TabColumns = [] } = prop;
   const dicts = Array.from(
     new Set([
-      ...initDicts(FormColumns),
+      ...initDicts(TableColumns),
       ...initDicts(
         TabColumns.map((item) => item.tableColumns)
           .flat()

+ 30 - 12
src/views/purchase/apply/hooks/watch.js

@@ -1,18 +1,36 @@
+import { REFER } from "@/components/popover-select/api";
+
+const fetchOrg = async (prop) => {
+  try {
+    // try
+    const { code, rows } = await REFER({
+      search: prop,
+      type: "ORG_PARAM",
+    });
+    if (code === 200) {
+      return rows[0] || {};
+    }
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
+
 export default function useWatch() {
   const watchPuOrgName = () => ({
-    handler: function (newProp, oldProp) {
-      if (oldProp) {
-        this.params.priceApplyOrgs = this.params.priceApplyOrgs.filter(
-          (item) => item.orgName !== oldProp
-        );
-      }
-      if (newProp) {
+    handler: async function (newProp) {
+      const index = this.params.priceApplyOrgs.findIndex(
+        (item) => item.orgName === newProp
+      );
+      if (index === -1) {
         const {
-          puOrg: org,
-          puOrgCode: orgCode,
-          puOrgName: orgName,
-        } = this.params;
-        this.params.priceApplyOrgs.push({
+          id: org,
+          code: orgCode,
+          name: orgName,
+        } = await fetchOrg(this.params.puOrgName);
+        await this.params.priceApplyOrgs.push({
           org,
           orgCode,
           orgName,

+ 1 - 1
src/views/purchase/apply/see/index.vue

@@ -174,7 +174,7 @@ export default {
     <el-descriptions :size="size" :column="column" border style="margin: 10px">
       <el-descriptions-item
         v-if="params[column.key]"
-        v-for="(column, index) in formColumns"
+        v-for="(column, index) in TableColumns"
         :key="index"
         :label="column.title"
       >

+ 40 - 68
src/views/purchase/task/column.js

@@ -1,71 +1,41 @@
 export const TableColumns = [
-  { key: "code", title: "订单生成单号" },
-  {
-    key: "status",
-    title: "状态",
-    dictName: "purchase_task_status",
-  },
-  { key: "demandCode", title: "需求单号" },
-  { key: "materialName", title: "物料" },
-  { key: "materialCode", title: "物料编码" },
-  // { key: "material", title: "物料" },
-  { key: "materialDesc", title: "物料描述" },
-  { key: "manufacturerName", title: "生产厂家" },
-  { key: "puQty", title: "采购数量" },
-  { key: "executeQty", title: "已执行数量" },
-  { key: "residueQty", title: "未执行数量" },
-  {
-    key: "priceType",
-    title: "价格类型",
-    dictName: "sys_price_type",
-  },
-  { key: "puUnitName", title: "采购单位" },
-  // { key: "id", title: "主键" },
-
-  // { key: "manufacturer", title: "生产厂家" },
-  // { key: "buyer", title: "采购员" },
-  { key: "buyerName", title: "采购员" },
-  // { key: "supplier", title: "建议供应商" },
-  { key: "supplierName", title: "建议供应商" },
-  // { key: "puOrg", title: "采购组织" },
-  {
-    key: "puOrgName",
-    title: "采购组织",
-  },
-  // { key: "currency", title: "币种" },
-  { key: "currencyName", title: "币种" },
-  // { key: "billYpe", title: "交易类型" },
-  { key: "source", title: "需求来源" },
-  // { key: "customer", title: "收货客户" },
-  { key: "customerName", title: "收货客户" },
-  { key: "assignSupplierName", title: "指定供应商" },
-  // { key: "puUnit", title: "采购单位" },
-
-  { key: "demandDate", title: "需求时间" },
-  { key: "projectName", title: "项目名称" },
-  // { key: "demandPersonal", title: "需求人" },
-  {
-    key: "demandPersonalName",
-    title: "需求人",
-  },
-  // { key: "demandOrg", title: "需求组织" },
-  { key: "demandOrgName", title: "需求组织" },
-  // { key: "demandDept", title: "需求部门" },
-  { key: "demandDeptName", title: "需求部门" },
-  {
-    key: "isBack",
-    title: "是否退回",
-    dictName: "sys_yes_no",
-  },
-  { key: "baskCause", title: "退回原因" },
-  { key: "backDate", title: "退回日期" },
-  // { key: "assignSupplier", title: "指定供应商" },
-  // { key: "unit", title: "单位" },
-  { key: "unitName", title: "单位" },
-  // { key: "file", title: "附件" },
-  // { key: "tenantId", title: "租户号" },
-  // { key: "revision", title: "乐观锁" },
-  // { key: "delFlag", title: "删除标记" },
+  { item: { key: "code", title: "订单生成单号" }, attr: {} },
+  {
+    item: { key: "status", title: "状态" },
+    attr: { dictName: "purchase_task_status" },
+  },
+  { item: { key: "demandCode", title: "需求单号" }, attr: {} },
+  { item: { key: "materialName", title: "物料" }, attr: {} },
+  { item: { key: "materialCode", title: "物料编码" }, attr: {} },
+  { item: { key: "materialDesc", title: "物料描述" }, attr: {} },
+  { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
+  { item: { key: "puQty", title: "采购数量" }, attr: {} },
+  { item: { key: "executeQty", title: "已执行数量" }, attr: {} },
+  { item: { key: "residueQty", title: "未执行数量" }, attr: {} },
+  {
+    item: { key: "priceType", title: "价格类型" },
+    attr: { dictName: "sys_price_type" },
+  },
+  { item: { key: "puUnitName", title: "采购单位" }, attr: {} },
+  { item: { key: "buyerName", title: "采购员" }, attr: {} },
+  { item: { key: "supplierName", title: "建议供应商" }, attr: {} },
+  { item: { key: "puOrgName", title: "采购组织" }, attr: {} },
+  { item: { key: "currencyName", title: "币种" }, attr: {} },
+  { item: { key: "source", title: "需求来源" }, attr: {} },
+  { item: { key: "customerName", title: "收货客户" }, attr: {} },
+  { item: { key: "assignSupplierName", title: "指定供应商" }, attr: {} },
+  { item: { key: "demandDate", title: "需求时间" }, attr: {} },
+  { item: { key: "projectName", title: "项目名称" }, attr: {} },
+  { item: { key: "demandPersonalName", title: "需求人" }, attr: {} },
+  { item: { key: "demandOrgName", title: "需求组织" }, attr: {} },
+  { item: { key: "demandDeptName", title: "需求部门" }, attr: {} },
+  {
+    item: { key: "isBack", title: "是否退回" },
+    attr: { dictName: "sys_yes_no" },
+  },
+  { item: { key: "baskCause", title: "退回原因" }, attr: {} },
+  { item: { key: "backDate", title: "退回日期" }, attr: {} },
+  { item: { key: "unitName", title: "单位" }, attr: {} },
 ];
 
 export const SearchColumns = [
@@ -175,7 +145,9 @@ export const SearchColumns = [
       title: "收货客户",
     },
     attr: {
-      component: "el-input",
+      component: "el-popover-select-v2",
+      referName: "CUSTOMERDEPT_PARAM",
+      valueKey: "name",
     },
   },
   {

+ 4 - 0
src/views/purchase/task/first-direct/index.vue

@@ -111,6 +111,10 @@ export default {
         <template #title>
           <span style="margin-right: 10px">{{ item.materialName }}</span>
           <span style="color: tomato">{{ item.puQty }}</span>
+          (<span style="color: tomato">{{
+            item.puQty - (item.executeQty || 0)
+          }}</span
+          >)
           <span> {{ item.puUnitName }}</span>
         </template>
         <el-descriptions-item label="需求组织">

+ 37 - 31
src/views/purchase/task/index.vue

@@ -20,12 +20,12 @@ const initParams = (prop, key = "key", value = "value") => {
 };
 
 // 初始化字典
-export const initDicts = (prop) =>
+const initDicts = (prop) =>
   Array.from(
     new Set(
       prop
-        .filter((item) => (item.attr ? item.attr.dictName : item.dictName))
-        .map((item) => (item.attr ? item.attr.dictName : item.dictName))
+        .filter((item) => item.attr.dictName)
+        .map((item) => item.attr.dictName)
     )
   );
 
@@ -56,12 +56,12 @@ export default {
     };
   },
   computed: {},
-  watch: {
-    "params.materialCodes": {
-      handler: function (newProp, oldProp) {
-        console.log(newProp, oldProp);
-      },
-    },
+  watch: {},
+  provide() {
+    return {
+      initParams,
+      $dicts: () => this.dict.type,
+    };
   },
   created() {
     this.params.status = "0";
@@ -246,7 +246,7 @@ export default {
         </el-col>
       </el-row>
     </el-form>
-    <el-row style="padding: 0 20px">
+    <el-row>
       <el-button :size="size" @click="useQuery(params, page)">
         查 询
       </el-button>
@@ -290,7 +290,6 @@ export default {
       @row-dblclick="useSee"
       @selection-change="useSelect"
       @row-click="useSelect([$event])"
-      style="width: 100%; margin: 20px 0 0 0"
     >
       <el-table-column
         fixed
@@ -303,19 +302,21 @@ export default {
       <el-table-column
         v-for="(column, index) in tableColumns"
         :key="index"
-        :prop="column.key"
-        :label="column.title"
-        :width="column.width || 200"
-        :show-overflow-tooltip="column.showOverflowTooltip || true"
+        :prop="column.item.key"
+        :label="column.item.title"
+        :width="column.item.width || 200"
+        show-overflow-tooltip
       >
         <template slot-scope="scope">
           <dict-tag
-            v-if="column.dictName"
+            v-if="column.attr.dictName"
             :size="size"
-            :value="scope.row[column.key]"
-            :options="dict.type[column.dictName]"
+            :value="scope.row[column.item.key]"
+            :options="dict.type[column.attr.dictName]"
           />
-          <component is="span" v-else>{{ scope.row[column.key] }}</component>
+          <component is="span" v-else>{{
+            scope.row[column.item.key]
+          }}</component>
         </template>
       </el-table-column>
     </el-table>
@@ -328,21 +329,26 @@ export default {
   </el-card>
 </template>
 
-<style scoped>
+<style scoped lang="scss">
 .el-card {
   width: calc(100% - 20px);
   height: 100%;
   margin: 10px;
-  padding: 0 20px 20px 0;
-}
-::v-deep .el-form {
-  padding: 20px 20px 0;
-}
-::v-deep .el-row {
-  display: flex;
-  flex-wrap: wrap;
-}
-::v-deep .el-table--mini .el-table__cell {
-  height: 50px;
+  padding: 0 0 20px 0;
+  .el-form {
+    padding: 20px 0 0;
+  }
+  .el-row {
+    display: flex;
+    flex-wrap: wrap;
+    padding: 0 20px;
+  }
+  ::v-deep .el-table--mini {
+    width: 100%;
+    margin: 20px 0 0 0;
+    .el-table__cell {
+      height: 50px;
+    }
+  }
 }
 </style>

+ 8 - 5
src/views/purchase/task/modify-buyer/index.vue

@@ -2,7 +2,9 @@
 import { MODEIFYBUYER } from "@/api/business/purchase/task";
 export default {
   name: "ModifyBuyerDialog",
-  components: {},
+  components: {
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+  },
   data() {
     return {
       size: "mini",
@@ -104,16 +106,17 @@ export default {
       :model="params"
       label-width="0px"
       label-position="right"
+      style="padding: 0"
     >
       <el-form-item prop="" label="">
-        <dr-popover-select
+        <el-popover-select-v2
           v-model="params.buyerName"
           :source.sync="params"
           :data-mapping="{ buyer: 'code', buyerName: 'name' }"
-          title="转派人员"
-          type="CONTACTS_PARAM"
+          valueKey="name"
+          referName="CONTACTS_PARAM"
         >
-        </dr-popover-select>
+        </el-popover-select-v2>
       </el-form-item>
     </el-form>
   </el-dialog>

+ 8 - 9
src/views/purchase/task/see/index.vue

@@ -1,11 +1,10 @@
 <script>
 import { TableColumns as Columns } from "../column";
 import { ITEM } from "@/api/business/purchase/task";
-import { initDicts, initParams } from "@/utils/init";
 export default {
   name: "SeeDialog",
-  dicts: initDicts(Columns),
   components: {},
+  inject: ["$dicts", "initParams"],
   data() {
     return {
       size: "mini",
@@ -15,7 +14,7 @@ export default {
       visible: false,
       loading: false,
       columns: Columns,
-      params: initParams(Columns),
+      params: {},
     };
   },
   computed: {},
@@ -70,18 +69,18 @@ export default {
     </template>
     <el-descriptions :size="size" :column="column" border style="margin: 10px">
       <el-descriptions-item
-        v-if="params[column.key]"
+        v-if="params[column.item.key]"
         v-for="(column, index) in columns"
         :key="index"
-        :label="column.title"
+        :label="column.item.title"
       >
         <dict-tag
-          v-if="column.referName"
+          v-if="column.attr.dictName"
           :size="size"
-          :value="params[column.key]"
-          :options="dict.type[column.referName]"
+          :value="params[column.item.key]"
+          :options="$dicts()[column.attr.dictName]"
         />
-        <span v-else>{{ params[column.key] }}</span>
+        <span v-else>{{ params[column.item.key] }}</span>
       </el-descriptions-item>
     </el-descriptions>
   </el-drawer>