Browse Source

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

002390 1 year ago
parent
commit
2090cb35c2
41 changed files with 2009 additions and 607 deletions
  1. 7 0
      src/api/purchase/purchaseDemand.js
  2. 0 1
      src/components/popover-select-v2/index.vue
  3. 14 2
      src/components/super-form/index.vue
  4. 11 16
      src/components/super-search/index.vue
  5. 36 16
      src/components/super-table/index.vue
  6. 1 1
      src/components/super-table/once/filters.vue
  7. 1 1
      src/components/super-table/once/hide.vue
  8. 26 0
      src/main.js
  9. 51 45
      src/views/business/spd/bo/basic/index.vue
  10. 8 8
      src/views/business/spd/bo/behavior/index.vue
  11. 28 11
      src/views/business/spd/bo/contact/index.vue
  12. 24 6
      src/views/business/spd/bo/filetemplate/index.vue
  13. 3 3
      src/views/business/spd/bo/statement/index.vue
  14. 4 4
      src/views/business/spd/bo/statement/proportion/index.vue
  15. 33 7
      src/views/business/spd/bo/task/index.vue
  16. 18 8
      src/views/business/spd/target/targetMk/add.vue
  17. 3 0
      src/views/business/spd/target/targetMk/index.vue
  18. 75 42
      src/views/business/spd/target/targetMk/item.vue
  19. 2 2
      src/views/business/spd/target/targetTemplate/add/columns.js
  20. 172 69
      src/views/business/spd/target/targetTemplate/add/index.vue
  21. 16 36
      src/views/business/spd/target/targetTemplate/delete/index.vue
  22. 17 16
      src/views/business/spd/target/targetTemplate/index.vue
  23. 1 1
      src/views/purchase/DemandSummary/add.vue
  24. 22 23
      src/views/purchase/PurchaseDemandList/add.vue
  25. 1 0
      src/views/purchase/apply/add/columns.js
  26. 44 190
      src/views/purchase/apply/add/index.vue
  27. 7 1
      src/views/purchase/apply/columns.js
  28. 291 0
      src/views/purchase/apply/copy/columns.js
  29. 322 0
      src/views/purchase/apply/copy/index.vue
  30. 291 0
      src/views/purchase/apply/edit/columns.js
  31. 339 0
      src/views/purchase/apply/edit/index.vue
  32. 19 17
      src/views/purchase/apply/index.vue
  33. 9 3
      src/views/purchase/catalogue/columns.js
  34. 15 8
      src/views/purchase/catalogue/index.vue
  35. 29 29
      src/views/purchase/contract/add/index.vue
  36. 7 1
      src/views/purchase/contract/columns.js
  37. 22 24
      src/views/purchase/contract/edit/index.vue
  38. 21 11
      src/views/purchase/contract/index.vue
  39. 7 1
      src/views/purchase/task/columns.js
  40. 4 4
      src/views/purchase/task/index.vue
  41. 8 0
      src/views/purchase/task/xie-yi-zhi-cai/column.js

+ 7 - 0
src/api/purchase/purchaseDemand.js

@@ -78,4 +78,11 @@ export function queryMan(id) {
     url: `/material/division/queryBuyer?materialId=${id}`,
     method: 'get',
   })
+}
+// 跳转OA
+export function toOA(userName, fdId) {
+  return request({
+    url: `/oaflow/redirectToOa/${userName}/${fdId}`,
+    method: 'get',
+  })
 }

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

@@ -223,7 +223,6 @@ export default {
         <el-button :size="$attrs.size" :loading="loading" @click="hide"
           >取 消</el-button
         >
-        
       </div>
       <el-form
         v-loading="loading"

+ 14 - 2
src/components/super-form/index.vue

@@ -45,9 +45,21 @@ export default {
     },
   },
   watch: {},
-  methods: {},
+  methods: {
+    // 继承el-table的Method
+    extendMethod() {
+      const refMethod = Object.entries(this.$refs["superForm"]);
+      for (const [key, value] of refMethod) {
+        if (!(key.includes("$") || key.includes("_"))) {
+          this[key] = value;
+        }
+      }
+    },
+  },
   created() {},
-  mounted() {},
+  mounted() {
+    this.extendMethod();
+  },
   destroyed() {},
 };
 </script>

+ 11 - 16
src/components/super-search/index.vue

@@ -74,18 +74,7 @@ export default {
       this.visible = !this.visible;
     },
   },
-  created() {
-    console.log(
-      "span",
-      Math.ceil(
-        this.innerColumns
-          .map(({ item }) => item.span)
-          .reduce((prev, curr) => {
-            return prev + curr;
-          }) / 24
-      )
-    );
-  },
+  created() {},
   mounted() {},
   destroyed() {},
 };
@@ -190,15 +179,21 @@ export default {
         <el-button :size="$attrs.size" type="primary" @click="$emit('submit')">
           搜索
         </el-button>
-        <el-button :size="$attrs.size" type="danger" @click="$emit('reset')">
+        <el-button :size="$attrs.size" @click="$emit('reset')">
           重置
         </el-button>
-        <el-button :size="$attrs.size" @click="visible = !visible">
+        <!-- <el-button :size="$attrs.size" @click="visible = !visible">
           {{ visible ? "展开" : "收起" }}
-        </el-button>
+        </el-button> -->
       </el-row>
     </el-row>
-    <el-divider class="m-0"> </el-divider>
+    <el-divider class="m-0" style="cursor: pointer" @click="visible = !visible">
+      <i
+        class="el-icon-d-arrow-left"
+        style="transition: 250ms"
+        :style="{ transform: `rotate(${visible ? 90 : -90}deg)` }"
+      ></i>
+    </el-divider>
   </el-form>
 </template>
 

+ 36 - 16
src/components/super-table/index.vue

@@ -42,13 +42,8 @@ export default {
       type: Boolean,
       default: false,
     },
-    // 是否列显示
-    hiddenColumns: {
-      type: Boolean,
-      default: false,
-    },
-    // 是否列过滤
-    filterColumns: {
+    // 是否列操作
+    convenitentOperation: {
       type: Boolean,
       default: false,
     },
@@ -64,6 +59,8 @@ export default {
     ElFilePreview: () => import("@/components/file-preview/index.vue"),
     ElComputedInput: () => import("@/components/computed-input/index.vue"),
     ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    ElPopoverMultipleSelectV2: () =>
+      import("@/components/popover-select-v2/multiple.vue"),
     ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
     ElPopoverTreeSelect: () =>
       import("@/components/popover-tree-select/index.vue"),
@@ -71,8 +68,8 @@ export default {
     ButtonFreeze: () => import("./freeze.vue"),
     IconHide: () => import("./once/hide.vue"),
     IconSort: () => import("./once/sort.vue"),
-    IconFilter: () => import("./once/filter.vue"),
     IconFreeze: () => import("./once/freeze.vue"),
+    IconFilter: () => import("./once/filters.vue"),
   },
   data() {
     const { columns } = this.$props;
@@ -206,9 +203,20 @@ export default {
       }));
       return dataList;
     },
+    // 继承el-table的Method
+    extendMethod() {
+      const refMethod = Object.entries(this.$refs["superTable"]);
+      for (const [key, value] of refMethod) {
+        if (!(key.includes("$") || key.includes("_"))) {
+          this[key] = value;
+        }
+      }
+    },
   },
   created() {},
-  mounted() {},
+  mounted() {
+    this.extendMethod();
+  },
   destroyed() {},
 };
 </script>
@@ -218,6 +226,7 @@ export default {
     <el-table
       ref="superTable"
       border
+      height="auto"
       :row-key="rowKey"
       :data="innerValue"
       :highlight-current-row="radio"
@@ -225,6 +234,7 @@ export default {
       @selection-change="onSelectionChange"
       v-bind="$attrs"
       v-on="$listeners"
+      style="flex: 1"
     >
       <!-- 序号 -->
       <el-table-column
@@ -233,6 +243,7 @@ export default {
         fixed
         width="50"
         label="序号"
+        align="center"
         class="is-index"
       >
         <template slot-scope="scope">
@@ -275,20 +286,25 @@ export default {
               {{ item.title }}
             </span>
             <template>
-              <icon-sort v-model="item.sort" @sort="onSort(item)"></icon-sort>
+              <icon-sort
+                v-if="item.sortabled"
+                v-model="item.sort"
+                @sort="onSort(item)"
+              ></icon-sort>
               <icon-freeze
+                v-if="item.fixedabled"
                 v-model="item.fixed"
                 @freeze="onFreeze"
               ></icon-freeze>
               <icon-filter
+                v-if="item.filterabled"
                 v-model="item.filter"
                 :filters="onFilters({ item, attr })"
                 @filter="onFilter"
               ></icon-filter>
               <icon-hide
-                v-if="hiddenColumns"
+                v-if="item.hiddenabled"
                 v-model="item.hidden"
-                class="icon-hide"
                 @hide="onHide"
               ></icon-hide>
             </template>
@@ -313,7 +329,7 @@ export default {
               >
               </component>
               <component
-                v-else-if="attr.is === 'el-popover-tree-select'"
+                v-else-if="attr.is === 'el-popover-multiple-select-v2'"
                 v-bind="attr"
                 v-model="scope.row[item.key]"
                 :size="$attrs.size"
@@ -366,7 +382,7 @@ export default {
         align-items: center;
       "
     >
-      <div>
+      <div class="mr-4">
         <template v-if="checkbox">
           <el-button
             v-if="selectState"
@@ -385,7 +401,7 @@ export default {
             {{ selectData.length ? ` :${selectData.length}` : "" }}
           </el-button>
         </template>
-        <template v-if="hiddenColumns">
+        <template v-if="convenitentOperation">
           <button-hide v-model="innerColumns" @hide="onHide"></button-hide>
           <button-freeze
             v-model="showColumns"
@@ -400,7 +416,7 @@ export default {
         :page.sync="page.pageNum"
         :limit.sync="page.pageSize"
         @pagination="$emit('pagination', { ...$event })"
-        style="height: 32px; padding: 0 !important"
+        style="height: 32px; padding: 0 !important; flex: 1; overflow-x: auto"
       />
     </div>
   </div>
@@ -409,6 +425,10 @@ export default {
 <style lang="scss" scoped>
 .el-super-table {
   position: relative;
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  overflow: auto;
 }
 ::v-deep.el-super-table .el-table__header .cell {
   word-break: keep-all;

+ 1 - 1
src/components/super-table/once/filter.vue → src/components/super-table/once/filters.vue

@@ -68,7 +68,7 @@ export default {
   },
   props: {
     value: {
-      type: Array,
+      type: [Array, Boolean],
       require: true,
     },
     filters: {

+ 1 - 1
src/components/super-table/once/hide.vue

@@ -1,7 +1,7 @@
 <template>
   <i
     v-if="innerValue"
-    class="el-icon-circle-close pl-1"
+    class="el-icon-circle-close pl-1 icon-hide"
     style="cursor: pointer; font-weight: 600; transition: 500ms"
     @click="onHide"
   ></i>

+ 26 - 0
src/main.js

@@ -95,6 +95,32 @@ Vue.use(VueMeta);
 Vue.use(Print); //注册
 DictData.install();
 
+// el-table无限滚动解决页面渲染卡死
+Vue.directive("myscroll", {
+  bind(el, bind, vnode) {
+    const self = vnode.context;
+    let target = el.querySelector('.el-table__body-wrapper');
+    target.addEventListener("scroll", () => {
+      // 检测触底
+      if (target.scrollTop + target.clientHeight >= target.scrollHeight) {
+        if (self.over >= self.basicForm.puDemandItemList) {
+          return;
+        }
+        self.over +=15
+      }
+    })
+  }
+})
+Vue.mixin({
+  data() {
+    return {
+      // scrollTop: 0,
+      // tableHeight: 300
+      start: 0,
+      over: 15
+    }
+  }
+})
 /**
  * If you don't want to use mock-server
  * you want to use MockJs for mock api

+ 51 - 45
src/views/business/spd/bo/basic/index.vue

@@ -4,13 +4,14 @@
     <el-form
       :model="queryParams"
       ref="queryForm"
-      size="small"
+      size="mini"
       :inline="true"
       v-show="showSearch"
       label-width="68px"
     >
       <el-form-item label="商机名称" prop="boName">
         <el-input
+          size="mini"
           v-model="queryParams.boName"
           clearable
           @keyup.enter.native="handleQuery"
@@ -18,6 +19,7 @@
       </el-form-item>
       <el-form-item label="客户名称" prop="customerName">
         <el-input
+          size="mini"
           v-model="queryParams.customerName"
           clearable
           @keyup.enter.native="handleQuery"
@@ -25,6 +27,7 @@
       </el-form-item>
       <el-form-item label="商机负责人" prop="principalName">
         <el-input
+          size="mini"
           v-model="queryParams.principalName"
           clearable
           @keyup.enter.native="handleQuery"
@@ -32,6 +35,7 @@
       </el-form-item>
       <el-form-item label="商机类型" prop="boType">
         <el-select
+          size="mini"
           v-model="queryParams.boType"
           @change="boTypeChange"
           clearable
@@ -45,7 +49,7 @@
         </el-select>
       </el-form-item>
       <el-form-item label="商机阶段" prop="boStage">
-        <el-select v-model="queryParams.boStage" clearable>
+        <el-select size="mini" v-model="queryParams.boStage" clearable>
           <el-option
             v-for="item in mk_bo_stage"
             :key="item.code"
@@ -55,7 +59,7 @@
         </el-select>
       </el-form-item>
       <el-form-item label="商机状态" prop="boState" clearable>
-        <el-select v-model="queryParams.boState" clearable>
+        <el-select size="mini" v-model="queryParams.boState" clearable>
           <el-option
             v-for="dict in dict.type.mk_bo_state"
             :key="dict.value"
@@ -64,7 +68,7 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="商机来源" prop="boSource">
+      <el-form-item size="mini" label="商机来源" prop="boSource">
         <el-select v-model="queryParams.boSource" clearable>
           <el-option
             v-for="dict in dict.type.mk_bo_source"
@@ -86,6 +90,7 @@
       </el-form-item> -->
       <el-form-item label="创建时间">
         <el-date-picker
+          size="mini"
           v-model="dateRange"
           style="width: 240px"
           value-format="yyyy-MM-dd"
@@ -109,9 +114,8 @@
       </el-form-item>
     </el-form>
 
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
+    <div class="btn_grooup">
+      <el-button
           type="primary"
           plain
           icon="el-icon-plus"
@@ -119,52 +123,29 @@
           @click="handleAdd"
           >新增</el-button
         >
-      </el-col>
-      <!-- <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-        >删除</el-button>
-      </el-col> -->
-      <right-toolbar
-        :showSearch.sync="showSearch"
-        @queryTable="getList"
-      ></right-toolbar>
-    </el-row>
+    </div>
 
     <el-table
       v-loading="loading"
       :data="basicList"
       @selection-change="handleSelectionChange"
       @cell-dblclick="enterDetails"
+      height="700px"
     >
       <el-table-column type="selection" align="center" />
       <el-table-column
+        width="150"
         label="编号"
         align="center"
         prop="boCode"
       />
-      <el-table-column label="商机名称" align="center" prop="boName" />
-      <el-table-column label="商机类型" align="center" prop="boType">
+      <el-table-column label="商机名称" show-overflow-tooltip width="300" align="center" prop="boName" />
+      <el-table-column label="商机类型" width="150" align="center" prop="boType">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.mk_bo_type" :value="scope.row.boType" />
         </template>
       </el-table-column>
-      <el-table-column label="商机状态" align="center" prop="boState">
+      <el-table-column label="商机状态" width="150" align="center" prop="boState">
         <template slot-scope="scope">
           <dict-tag
             :options="dict.type.mk_bo_state"
@@ -172,7 +153,7 @@
           />
         </template>
       </el-table-column>
-      <el-table-column label="商机来源" align="center" prop="boSource">
+      <el-table-column label="商机来源" width="150" align="center" prop="boSource">
         <template slot-scope="scope">
           <dict-tag
             :options="dict.type.mk_bo_source"
@@ -180,15 +161,16 @@
           />
         </template>
       </el-table-column>
-      <el-table-column label="商机阶段" align="center" prop="boStageName" />
-      <el-table-column label="客户名称" align="center" prop="customerName" />
+      <el-table-column label="商机阶段" width="150" align="center" prop="boStageName" />
+      <el-table-column label="客户名称" show-overflow-tooltip width="150" align="center" prop="customerName" />
       <el-table-column
+        width="150"
         label="预估值(万元)"
         align="center"
         prop="hosDiscreetValue"
       />
-      <el-table-column label="赢单率" align="center" prop="winningRate" />
-      <el-table-column label="赢单率状态" align="center" prop="winningState">
+      <el-table-column label="赢单率" width="150" align="center" prop="winningRate" />
+      <el-table-column label="赢单率状态" width="150" align="center" prop="winningState">
         <template slot-scope="scope">
           <dict-tag
             :options="dict.type.mk_bo_winstate"
@@ -197,19 +179,22 @@
         </template>
       </el-table-column>
       <el-table-column
+        width="150"
         label="销售区域"
         align="center"
         prop="marketingAreaName"
       />
       <el-table-column
+        width="150"
+        show-overflow-tooltip
         label="销售组织"
         align="center"
         prop="marketingOrganizingName"
       />
-      <el-table-column label="部门" align="center" prop="deptName" />
-      <el-table-column label="商机负责人" align="center" prop="principalName" />
-      <el-table-column label="创建人" align="center" prop="createBy" />
-      <el-table-column label="创建时间" align="center" prop="createTime" />
+      <el-table-column label="部门" width="150" align="center" prop="deptName" />
+      <el-table-column label="商机负责人" width="150" align="center" prop="principalName" />
+      <el-table-column label="创建人" width="150" align="center" prop="createBy" />
+      <el-table-column label="创建时间" width="150" align="center" prop="createTime" />
       <el-table-column
         label="操作"
         fixed="right"
@@ -918,3 +903,24 @@ export default {
   },
 };
 </script>
+
+<style lang="scss" scoped>
+#deliveryAddressList {
+  height: calc(100vh - 84px);
+  padding: 12px;
+  box-sizing: border-box;
+  overflow-y: scroll;
+}
+.btn_grooup {
+  margin-bottom: 10px;
+  display: flex;
+  justify-content: flex-end;
+}
+.lines {
+  margin-top: 0;
+}
+.el-pagination {
+  margin-top: 10px;
+  text-align: right;
+}
+</style>

+ 8 - 8
src/views/business/spd/bo/behavior/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="任务" prop="taskCode">
         <el-input
           v-model="queryParams.taskCode"
@@ -14,7 +14,7 @@
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
-    <el-table v-loading="loading" :data="behaviorList">
+    <el-table v-loading="loading" :data="behaviorList" height="700px">
       <el-table-column label="负责人" align="center" prop="staffName" />
       <el-table-column label="行动日期" align="center" prop="time" />
       <el-form-item label="行动日期" prop="time">
@@ -36,22 +36,22 @@
           <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.assist"/>
         </template>
       </el-table-column>
-      <el-table-column label="协助内容" align="center" prop="assistContent" />
-      <el-table-column label="洽谈内容" align="center" prop="content" />
-      <el-table-column label="任务编码" align="center" prop="taskCode"/>
+      <el-table-column show-overflow-tooltip label="协助内容" align="center" prop="assistContent" />
+      <el-table-column show-overflow-tooltip label="洽谈内容" align="center" prop="content" />
+      <el-table-column width="150" label="任务编码" align="center" prop="taskCode"/>
       <el-table-column label="行动类型" align="center" prop="type">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.mk_bo_behavior_type" :value="scope.row.type"/>
         </template>
       </el-table-column>
-      <el-table-column label="客户" align="center" prop="customerName"/>
+      <el-table-column show-overflow-tooltip label="客户" align="center" prop="customerName"/>
       <el-table-column label="拜访目的" align="center" prop="purpose">
         <template slot-scope="scope">
             <dict-tag :options="dict.type.mk_bo_behavior_goal" :value="scope.row.purpose"/>
         </template>
       </el-table-column>
-      <el-table-column label="销售组织" align="center" prop="salesOrgName"/>
-      <el-table-column label="部门" align="center" prop="deptName"/>
+      <el-table-column show-overflow-tooltip label="销售组织" align="center" prop="salesOrgName"/>
+      <el-table-column show-overflow-tooltip label="部门" align="center" prop="deptName"/>
       <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
           <el-button

+ 28 - 11
src/views/business/spd/bo/contact/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="姓名" prop="name">
         <el-input
           v-model="queryParams.name"
@@ -30,7 +30,7 @@
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
-    <el-row :gutter="10" class="mb8">
+    <!-- <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
           type="primary"
@@ -41,18 +41,27 @@
         >新增</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
-    <el-table v-loading="loading" :data="contactList">
-      <el-table-column label="编号" align="center" prop="code" />
-      <el-table-column label="姓名" align="center" prop="name" />
+    </el-row> -->
+    <div class="btn_grooup">
+      <el-button
+        type="primary"
+        plain
+        icon="el-icon-plus"
+        size="mini"
+        @click="handleAdd"
+      >新增</el-button>
+    </div>
+    <el-table v-loading="loading" :data="contactList" height="700px">
+      <el-table-column width="200" label="编号" align="center" prop="code" />
+      <el-table-column show-overflow-tooltip label="姓名" align="center" prop="name" />
       <el-table-column label="性别" align="center" prop="gander" >
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.gander"/>
         </template>
       </el-table-column>
       <el-table-column label="联系电话" align="center" prop="telephone" />
-      <el-table-column label="所属客户" align="center" prop="customerName" />
-      <el-table-column label="部门名称" align="center" prop="departmentName" />
+      <el-table-column width="200" show-overflow-tooltip label="所属客户" align="center" prop="customerName" />
+      <el-table-column show-overflow-tooltip label="部门名称" align="center" prop="departmentName" />
       <el-table-column label="职务" align="center" prop="position" >
         <template slot-scope="scope">
           <dict-tag :options="dict.type.mk_bo_position" :value="scope.row.position"/>
@@ -63,14 +72,14 @@
           <dict-tag :options="dict.type.mk_bo_power" :value="scope.row.power"/>
         </template>
       </el-table-column>
-      <el-table-column label="兴趣爱好" align="center" prop="hobby" />
-      <el-table-column label="家庭地址" align="center" prop="address" />
+      <el-table-column show-overflow-tooltip label="兴趣爱好" align="center" prop="hobby" />
+      <el-table-column show-overflow-tooltip label="家庭地址" align="center" prop="address" />
       <el-table-column label="状态" align="center" prop="state" >
         <template slot-scope="scope">
           <dict-tag :options="dict.type.mk_bo_contact_state" :value="scope.row.state"/>
         </template>
       </el-table-column>
-      <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width" >
+      <el-table-column width="200" label="操作" fixed="right" align="center" >
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -591,3 +600,11 @@ export default {
   }
 };
 </script>
+
+<style lang="scss" scoped>
+.btn_grooup {
+  margin-bottom: 10px;
+  display: flex;
+  justify-content: flex-end;
+}
+</style>

+ 24 - 6
src/views/business/spd/bo/filetemplate/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="商机类型" prop="boType">
         <el-select
           v-model="queryParams.boType"
@@ -23,12 +23,12 @@
         />
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
 
-    <el-row :gutter="10" class="mb8">
+    <!-- <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
           type="primary"
@@ -39,9 +39,19 @@
         >上传</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
+    </el-row> -->
 
-    <el-table v-loading="loading" :data="filetemplateList" @selection-change="handleSelectionChange">
+    <div class="btn_grooup">
+      <el-button
+        type="primary"
+        plain
+        icon="el-icon-plus"
+        size="mini"
+        @click="uploadAccessory"
+      >上传</el-button>
+    </div>
+
+    <el-table v-loading="loading" :data="filetemplateList" @selection-change="handleSelectionChange"  height="700px">
       <el-table-column
         type="index"
         label="序号"
@@ -271,3 +281,11 @@ export default {
   }
 };
 </script>
+
+<style lang="scss" scoped>
+.btn_grooup {
+  margin-bottom: 10px;
+  display: flex;
+  justify-content: flex-end;
+}
+</style>

+ 3 - 3
src/views/business/spd/bo/statement/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="商机名称" prop="boName">
         <el-input
           v-model="queryParams.boName"
@@ -36,8 +36,8 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
     <el-tabs v-model="activeName" @tab-click="handleClick">

+ 4 - 4
src/views/business/spd/bo/statement/proportion/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="商机日期" prop="yearMonth">
         <el-date-picker
           type="month"
@@ -44,12 +44,12 @@
         />
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
 
-    <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
+    <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange" height="700px">
       <el-table-column label="中心部门" align="center" prop="deptName" />
       <el-table-column label="当月新增商机数(个)" align="center" prop="sumTotal" />
       <el-table-column label="当月审核通过数(个)" align="center" prop="passAudit" />

+ 33 - 7
src/views/business/spd/bo/task/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="任务编码" prop="code">
         <el-input
           v-model="queryParams.code"
@@ -47,8 +47,8 @@
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
-    <el-row :gutter="10" class="mb8">
-      <!-- <el-col :span="1.5">
+    <!-- <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
         <el-button
           type="primary"
           plain
@@ -77,28 +77,43 @@
           @click="handleDelete"
           >删除</el-button
         >
-      </el-col> -->
+      </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
       ></right-toolbar>
-    </el-row>
+    </el-row> -->
+
+    <div class="btn_grooup">
+      <el-button
+        type="primary"
+        plain
+        icon="el-icon-plus"
+        size="mini"
+        @click="handleAdd"
+        >新增</el-button
+      >
+    </div>
 
     <el-table
       v-loading="loading"
       :data="taskList"
       @selection-change="handleSelectionChange"
+      height="700px"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="任务编码" align="center" prop="code" />
-      <el-table-column label="任务名称" align="center" prop="name" />
+      <el-table-column width="150" label="任务编码" align="center" prop="code" />
+      <el-table-column width="200" show-overflow-tooltip label="任务名称" align="center" prop="name" />
       <el-table-column
+        width="200"
+        show-overflow-tooltip
         label="商机名称"
         align="center"
         prop="boName"
       />
       <el-table-column label="商机阶段" align="center" prop="boStageName"/>
       <el-table-column
+        show-overflow-tooltip
         label="客户名称"
         align="center"
         prop="customerName"
@@ -121,6 +136,7 @@
       </el-table-column>
       <el-table-column label="联系人" align="center" prop="linkmanName" />
       <el-table-column
+        show-overflow-tooltip
         label="销售组织名称"
         align="center"
         prop="salesOrgName"
@@ -139,6 +155,7 @@
       </el-table-column>
       <el-table-column label="任务内容" align="center" prop="content" />
       <el-table-column
+        show-overflow-tooltip
         label="操作"
         fixed="right"
         align="center"
@@ -607,6 +624,7 @@ export default {
       this.reset();
       this.open = true;
       this.title = "添加任务";
+      this.operatingState = "Insert";
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -746,3 +764,11 @@ export default {
   }
 };
 </script>
+
+<style lang="scss" scoped>
+.btn_grooup {
+  margin-bottom: 10px;
+  display: flex;
+  justify-content: flex-end;
+}
+</style>

+ 18 - 8
src/views/business/spd/target/targetMk/add.vue

@@ -36,7 +36,7 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <el-col :span="1.5">
             <el-form-item label="包含下级组织" >
               <el-select v-model="form.includeOrg" size="mini" style="width: 200px">
                 <el-option
@@ -47,7 +47,7 @@
                 ></el-option>
               </el-select>
             </el-form-item>
-          </el-col>
+          </el-col> -->
           <el-col :span="1.5">
             <el-form-item label="模板" prop="template">
               <dr-popover-select size="mini" v-model="form.templateName" title="模板" type="MK_TARGET_TEMPLATE_PARAM" :dataMapping="{
@@ -94,15 +94,17 @@
         </el-card>
       </el-form>
     </el-card>
-    <Item ref="child" v-if="isItem" :pageStu="pageStu" :template="template" :form="form" :columns="headers"></Item>
+    <el-card  style="height:500px">
+      <Item ref="child" v-if="isItem" :pageStu="pageStu" :template="template" :form="form" :columns="headers" :latestTemplate="latestTemplate"></Item>
+    </el-card>
     <el-card>
       <div class="btn_group">
+        <el-col :span="1.5">
+          <el-button size="mini" plain @click="useBack">取消</el-button>
+        </el-col>
         <el-col :span="1.5" style="margin: 0 10px;">
           <el-button type="primary" size="mini" plain @click="useSave" v-if="pageStu == 'add' || pageStu == 'edit'">保存</el-button>
         </el-col>
-        <el-col :span="1.5">
-          <el-button size="mini" plain @click="useBack">返回</el-button>
-        </el-col>
       </div>
     </el-card>
   </div>
@@ -143,24 +145,32 @@ export default {
       loading: false,
       //是否展示Item组件
       isItem:false,
+      //是否为最新模板
+      latestTemplate:false,
     }
   },
   async created() {
+    if(this.pageStu == 'add'){
+      this.form.date = new Date();
+    }
     if(this.pageStu == 'edit' || this.pageStu == 'see') {
       await this.fetchTarget(this.row);
       await this.fetchTemplate(this.row.template);
       await this.fetchHeaderData(this.row.template);
+      this.latestTemplate = true;
       this.isItem = true;
     }
   },
   watch: {
 	  'form.template': {
       async handler(newVal) {
+        console.log('111');
         this.isItem = false;
         await this.fetchTemplate(newVal);
         await this.fetchHeaderData(newVal);
         this.isItem = true;
       },
+      immediate:false,
     }
   },
   methods: {
@@ -239,7 +249,7 @@ export default {
           this.headers = res.rows
         }
       })
-    }
+    },
   }
 }
 </script>
@@ -249,6 +259,6 @@ export default {
   width: 100%;
   margin: 20px 0;
   display: flex;
-  justify-content: center;
+  justify-content: right;
 } 
 </style>

+ 3 - 0
src/views/business/spd/target/targetMk/index.vue

@@ -61,6 +61,8 @@
       
         <div class="btn_grooup">
           <el-button type="primary" size="mini" @click="useAdd">新增</el-button>
+          <el-button type="primary" size="mini" @click="useAdd">模板导出</el-button>
+          <el-button type="primary" size="mini" @click="useAdd">导入</el-button>
         </div>
 
         <el-table 
@@ -171,6 +173,7 @@ export default {
       //列表数据
       tableList:[],
       disable: false,
+      rowDetail:{},
     }
   },
   created() {

+ 75 - 42
src/views/business/spd/target/targetMk/item.vue

@@ -1,51 +1,66 @@
 <template>
   <div>
-    <el-card>
-      <el-row>
-        <div class="btn_add">
-          <el-button type="primary" size="mini" @click="useAdd" v-if="this.pageStu != 'see'">增行</el-button>
-        </div>
-      </el-row>
-      <!-- 渲染表头 -->
-      <el-table :data="items" style="width: 100%" height="500px">
-        <el-table-column label="序号" type="index" width="50" align="center" fixed>
-        </el-table-column>
-        <el-table-column v-for="head in headers" :prop="head.prop" :label="head.modelName" width="150" align="center">
-          <template slot-scope="scope">
-            <div v-if="pageStu == 'add' || pageStu == 'edit'">
-              <dr-popover-select size="mini" v-if="scope.row[head.prop].type == 'D'" v-model="scope.row[head.prop].valueName" title="参照选择" :type="scope.row[head.prop].model" :dataMapping="{
+    <el-row>
+      <div class="btn_add">
+        <el-button type="primary" size="mini" @click="useAdd" v-if="this.pageStu != 'see'">增行</el-button>
+      </div>
+    </el-row>
+    <!-- 渲染表头 -->
+    <el-table :data="items" style="width: 100%" height="500px">
+      <el-table-column label="序号" type="index" width="50" align="center" fixed>
+      </el-table-column>
+      <el-table-column show-overflow-tooltip v-for="head in headers" :prop="head.prop" :label="head.modelName" width="150" align="center">
+        <template slot-scope="scope">
+          <div v-if="pageStu == 'add' || pageStu == 'edit'">
+            <div v-if="scope.row[head.prop].type == 'D'">
+              <dr-popover-select 
+                size="mini" 
+                v-if="scope.row[head.prop].model == 'MK_TARGET_CYCLE_PARAM' || scope.row[head.prop].model == 'MK_TARGET_INDEX_PARAM'" 
+                v-model="scope.row[head.prop].valueName" 
+                title="参照选择" 
+                :type="scope.row[head.prop].model" 
+                :dataMapping="{
+                  value: 'id',
+                  valueName: 'name',
+                }" 
+                :source.sync="scope.row[head.prop]"
+                :queryParams="additionalCondition"
+              />
+              <dr-popover-select size="mini" v-else v-model="scope.row[head.prop].valueName" title="参照选择" :type="scope.row[head.prop].model" :dataMapping="{
                 value: 'id',
                 valueName: 'name',
               }" :source.sync="scope.row[head.prop]"></dr-popover-select>
-              <el-input size="mini" v-if="scope.row[head.prop].type == 'C' || scope.row[head.prop].type == 'I'" v-model="scope.row[head.prop].value"></el-input>
             </div>
-            <div v-else-if="pageStu == 'see'">
-              <div v-if="scope.row[head.prop].type == 'D'">
-                {{scope.row[head.prop].valueName}}
-              </div>
-              <div v-else>
-                {{scope.row[head.prop].value}}
-              </div>
+            <div v-if="scope.row[head.prop].type == 'C' || scope.row[head.prop].type == 'I'">
+              <el-input size="mini"  v-model="scope.row[head.prop].value"></el-input>
             </div>
-          </template>
-          <el-table-column v-if="head.children" v-for="headChi in head.children" :prop="headChi.prop" :label="headChi.modelName" width="150" align="center">
-            <template slot-scope="scope">
-              <div v-if="pageStu == 'add' || pageStu == 'edit'">
-                <el-input size="mini" v-model="scope.row[headChi.prop].value"></el-input>
-              </div>
-              <div v-else-if="pageStu == 'see'">
-                {{scope.row[headChi.prop].value}}
-              </div>
-            </template>
-          </el-table-column>
-        </el-table-column>
-        <el-table-column fixed="right" label="操作" align="center" width="100" v-if="this.pageStu != 'see'">
+          </div>
+          <div v-else-if="pageStu == 'see'">
+            <div v-if="scope.row[head.prop].type == 'D'">
+              {{scope.row[head.prop].valueName}}
+            </div>
+            <div v-else>
+              {{scope.row[head.prop].value}}
+            </div>
+          </div>
+        </template>
+        <el-table-column show-overflow-tooltip v-if="head.children" v-for="headChi in head.children" :prop="headChi.prop" :label="headChi.modelName" width="150" align="center">
           <template slot-scope="scope">
-            <el-button type="text" size="mini" @click="useDel(scope.$index, scope.row)">删除</el-button>
+            <div v-if="pageStu == 'add' || pageStu == 'edit'">
+              <el-input size="mini" v-model="scope.row[headChi.prop].value"></el-input>
+            </div>
+            <div v-else-if="pageStu == 'see'">
+              {{scope.row[headChi.prop].value}}
+            </div>
           </template>
         </el-table-column>
-      </el-table>
-    </el-card>
+      </el-table-column>
+      <el-table-column fixed="right" label="操作" align="center" width="100" v-if="this.pageStu != 'see'">
+        <template slot-scope="scope">
+          <el-button type="text" size="mini" @click="useDel(scope.$index, scope.row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
   </div>
 </template>
 
@@ -54,7 +69,7 @@ import { getTargetItem } from "@/api/business/spd/starget/target";
 
 export default {
   name: 'item',
-  props: ['pageStu','template','form','columns'],  
+  props: ['pageStu','template','form','columns','latestTemplate'],  
   dicts: ['sys_yes_no','mk_periodic_unit','mk_dimensionality','mk_index_type','mk_expansion_mode'],
   data() {
     return {
@@ -69,15 +84,15 @@ export default {
     this.itemTemplate = this.formatItem(this.columns);
     console.log('this.itemTemplate',this.itemTemplate);
     if(this.pageStu == 'edit' || this.pageStu == 'see'){
-      await this.fetchTargetItem(this.form.id);
-      console.log('this.items',this.items);
+      if(!this.latestTemplate){
+        await this.fetchTargetItem(this.form.id);
+      }
     }
   },
   methods: {
     //增行
     useAdd(){
       this.items.push(this.itemTemplate);
-      console.log('this.items',this.items);
     },
     //删行
     useDel(index){
@@ -119,18 +134,27 @@ export default {
       }else if("cycle" == unfold){
         for(let i in columns){
           columns[i].prop = columns[i].model
+          if(columns[i].model == 'MK_TARGET_CYCLE_PARAM' || columns[i].model == 'MK_TARGET_INDEX_PARAM'){
+            columns[i].templateId = this.template.id
+          }
           array.push(columns[i]);
         }
         this.headers = array;
       }else if("unfold" == unfold){
         for(let i in columns){
           columns[i].prop = columns[i].model
+          if(columns[i].model == 'MK_TARGET_CYCLE_PARAM' || columns[i].model == 'MK_TARGET_INDEX_PARAM'){
+            columns[i].templateId = this.template.id
+          }
           array.push(columns[i]);
         }
         this.headers = array;
       }else if("" == unfold){
         for(let i in columns){
           columns[i].prop = columns[i].model
+          if(columns[i].model == 'MK_TARGET_CYCLE_PARAM' || columns[i].model == 'MK_TARGET_INDEX_PARAM'){
+            columns[i].templateId = this.template.id
+          }
           array.push(columns[i]);
         }
         this.headers = array;
@@ -157,6 +181,15 @@ export default {
     merge(){
       this.items.push(...this.delItems);
       return this.items;
+    },
+    //附加查询条件
+    additionalCondition(prop){
+      console.log("prop",prop);
+      return {
+        parame:{
+          templateId: prop.templateId
+        }
+      }
     }
   }
 }

+ 2 - 2
src/views/business/spd/target/targetTemplate/add/columns.js

@@ -106,7 +106,7 @@ export default function useColumns() {
           },
           attr: {
             is: "el-date-picker",
-            valueFormat: "yyyy-MM-dd",
+            // valueFormat: "yyyy-MM-dd",
             // value: new Date(),
           },
         },
@@ -119,7 +119,7 @@ export default function useColumns() {
           },
           attr: {
             is: "el-date-picker",
-            valueFormat: "yyyy-MM-dd",
+            // valueFormat: "yyyy-MM-dd",
             // value: new Date(),
           },
         },

+ 172 - 69
src/views/business/spd/target/targetTemplate/add/index.vue

@@ -13,7 +13,7 @@ export default {
       type: Object,
     },
     selectData: {
-      type: [Array],
+      type: Object,
       require: true,
     },
     addType: {
@@ -62,30 +62,6 @@ export default {
       },
       set() {},
     },
-    disabled: {
-      get() {
-        const {
-          addType,
-          selectData,
-          selectData: [{ status } = {}],
-        } = this.$props;
-        if (addType === "add") {
-          return false;
-        }
-        if (addType === "edit") {
-          if (selectData.length !== 1) {
-            return true;
-          }
-          if (selectData.length === 1 && status === "1") {
-            return true;
-          }
-          if (selectData.length === 1 && status === "2") {
-            return true;
-          }
-        }
-      },
-      set() {},
-    },
   },
   watch: {},
   methods: {
@@ -121,28 +97,33 @@ export default {
       const { addType, selectData } = this.$props;
       if (addType === "add") {
         this.visible = true;
+        var date = new Date();
+        this.params.year = date.getFullYear() + '-' + '01' + '-' + '01';
+        this.params.startTime = date.getFullYear() + '-' + '01' + '-' + '01';
+        this.params.deadlineTime = date.getFullYear() + '-' + '12' + '-' + '31';
+        this.params.cycle = 'month';
       }
       if (addType === "edit") {
-        const [{ id }] = selectData;
         //校验目标模板是否存在引用
-        const { code, data } = await checkQuote(id);
-        if(code == '200'){
-          if(data){
+        const { code, data } = await checkQuote(selectData.id);
+        if (code == "200") {
+          if (data) {
             this.$modal.msgError("该目标模板存在引用,无法修改!");
             this.visible = false;
             return;
           }
-        }else{
+        } else {
           this.$modal.msgError("校验该目标模板是否存在引用异常,无法修改!");
           this.visible = false;
           return;
         }
-        this.visible = await this.fetchTemplate(id);
-        this.params.indexs = this.params.indexs.map((item) => ({ ...item }));
+        this.visible = await this.fetchTemplate(selectData.id);
+        this.params.indexs = this.params.indexs.map((item) => ({ ...item}));
         this.params.dimensionalitys = this.params.dimensionalitys.map(
-          (item) => ({ ...item })
+          (item) => ({ ...item})
         );
-        this.params.cycles = this.params.cycles.map((item) => ({ ...item }));
+        this.params.cycles = this.params.cycles.map((item) => ({ ...item}));
+        console.log("this.params",this.params);
       }
     },
     //关闭页面
@@ -166,29 +147,25 @@ export default {
       const { TableColumns } = TabColumns.find(
         ({ item: { key } }) => key === prop
       );
-      console.log(prop, this.$init.params(TableColumns));
       this.params[prop].push({
         delFlag: "0",
+        $index: new Date().getTime(),
         ...this.$init.params(TableColumns),
       });
-      console.log("this.params[prop]", this.params[prop]);
     },
     //删行
     async useRowRemove(prop, scope) {
-      const { addType } = this.$props;
-      const {
-        row: { $index },
-      } = scope;
-      if (addType === "add") {
-        this.params[prop].splice($index, 1);
-      }
-      if (addType === "edit") {
-        this.params[prop] = this.params[prop].map((item, index) => ({
-          ...item,
-          delFlag: index === $index ? "2" : item.delFlag,
-        }));
-        console.log(this.params[prop]);
+      // const { addType } = this.$props;
+      if (scope.row.id) {
+        this.params[prop].forEach(e => {
+          if(e.id == scope.row.id){
+            e.delFlag = '2'
+          }
+        });
+      }else{
+        this.params[prop] = this.params[prop].filter(item => item.$index != scope.row.$index);
       }
+      console.log("this.params[prop]",this.params[prop]);
     },
     //确认
     async useSubmit(prop) {
@@ -196,18 +173,6 @@ export default {
         if (valid) {
           try {
             this.loading = true;
-            // const {
-            //   params,
-            //   params: { paramsOrgs, paramsItems },
-            // } = this;
-            // if (this.addType === "edit") {
-            //   params.paramsOrgs = paramsOrgs.filter(
-            //     (item) => item.orgName
-            //   );
-            //   params.paramsItems = paramsItems.filter(
-            //     (item) => item.materialName
-            //   );
-            // }
             const { addType } = this.$props;
             let res = null;
             if (addType === "add") {
@@ -233,21 +198,149 @@ export default {
         }
       });
     },
+    //保存并新增
+    useSaveAndAdd(prop){
+      this.$refs[prop].$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            this.loading = true;
+            const { addType } = this.$props;
+            let res = null;
+            if (addType === "add") {
+              res = await addTargetTemplate(this.params);
+            }
+            if (addType === "edit") {
+              res = await updateTargetTemplate(this.params);
+            }
+            if (res.code === 200) {
+              this.$notify.success(res.msg);
+              this.params={};
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+            this.loading = false;
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+    //重置周期
+    useResetCycle(){
+      if(!this.params.startTime || !this.params.deadlineTime || !this.params.cycle){
+        this.$modal.msgError("开始日期、结束日期、周期不能存在空值!");
+        return;
+      }
+      if(this.params.startTime > this.params.deadlineTime){
+        this.$modal.msgError("开始日期不能大于结束日期!");
+        return;
+      }
+      this.params.cycles = [];
+      var cycles = [];
+      var start = new Date(this.params.startTime);
+      var deadline = new Date(this.params.deadlineTime);
+      start.setHours( 0, 0, 0);
+      deadline.setHours( 0, 0, 0);
+      if(this.params.cycle == 'period'){
+        cycles.push({
+          name:'目标期间',
+          startTime:start,
+          deadlineTime:deadline,
+        });
+      }else{
+        while(deadline >= start){
+          console.log(start);
+          if(this.params.cycle == 'day'){
+            var cy = {
+              name:this.formatDateTime(start, 'yyyy-MM-dd'),
+              startTime:start,
+              deadlineTime:start,
+            }
+            console.log(cy);
+            cycles.push(cy);
+            start = start.setDate(start.getDate()+1);
+            start = new Date(start);
+          }
+          if(this.params.cycle == 'week'){
+            var de = start;
+            var cy = {
+              name:this.formatDateTime(start, 'yyyy-MM-dd'),
+              startTime:start,
+              deadlineTime:de.setDate(de.getDate()+7),
+            }
+            console.log(cy);
+            cycles.push(cy);
+            start = start.setDate(start.getDate()+7);
+            start = new Date(start);
+          }
+          if(this.params.cycle == 'month'){
+            var de = start;
+            var cy = {
+              name:this.formatDateTime(start, 'yyyy-MM-dd'),
+              startTime:start,
+              deadlineTime:de.setDate(de.getDate()+30),
+            }
+            console.log(cy);
+            cycles.push(cy);
+            start = start.setDate(start.getDate()+30);
+            start = new Date(start);
+          }
+          if(this.params.cycle == 'season'){
+            var de = start;
+            var cy = {
+              name:this.formatDateTime(start, 'yyyy-MM-dd'),
+              startTime:start,
+              deadlineTime:de.setDate(de.getDate()+90),
+            }
+            console.log(cy);
+            cycles.push(cy);
+            start = start.setDate(start.getDate()+90);
+            start = new Date(start);
+          }
+        }
+      }
+      this.params.cycles = cycles;
+      console.log('this.params.cycles',this.params.cycles);
+    },
+    //日期名称格式化
+    formatDateTime(date, format) {
+      const o = {
+        'M+': date.getMonth() + 1, // 月份
+        'd+': date.getDate(), // 日
+        'h+': date.getHours() % 12 === 0 ? 12 : date.getHours() % 12, // 小时
+        'H+': date.getHours(), // 小时
+        'm+': date.getMinutes(), // 分
+        's+': date.getSeconds(), // 秒
+        'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
+        S: date.getMilliseconds(), // 毫秒
+        a: date.getHours() < 12 ? '上午' : '下午', // 上午/下午
+        A: date.getHours() < 12 ? 'AM' : 'PM', // AM/PM
+      };
+      if (/(y+)/.test(format)) {
+        format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
+      }
+      for (let k in o) {
+        if (new RegExp('(' + k + ')').test(format)) {
+          format = format.replace(
+            RegExp.$1,
+            RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
+          );
+        }
+      }
+      return format;
+    }
   },
   created() {
-    console.log("params", this.params);
   },
   mounted() {},
   destroyed() {},
 };
 </script>
 <template>
-  <el-button
-    v-bind="$attrs"
-    v-on="$listeners"
-    :disabled="disabled"
-    @click="open"
-  >
+  <el-button v-bind="$attrs" v-on="$listeners" @click="open">
     {{ title }}
     <el-drawer
       :size="width"
@@ -304,9 +397,11 @@ export default {
               >
               </component>
             </template> -->
-            <el-table-column fixed="right" label="操作" width="75">
+            <el-table-column fixed="right" label="操作" width="100">
               <template slot="header" slot-scope="scope">
+                <el-button v-if="tabName == 'cycles'" type="primary" size="mini" @click="useResetCycle">重算周期</el-button>
                 <el-button
+                  v-else
                   circle
                   icon="el-icon-plus"
                   :size="$attrs.size"
@@ -316,6 +411,7 @@ export default {
               </template>
               <template slot-scope="scope">
                 <el-button
+                  v-if="tabName == 'indexs' || tabName == 'dimensionalitys'"
                   circle
                   icon="el-icon-minus"
                   :size="$attrs.size"
@@ -331,6 +427,13 @@ export default {
         <el-button :size="$attrs.size" :loading="loading" @click="hide"
           >取 消</el-button
         >
+        <!-- <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useSaveAndAdd('superForm')"
+          >保存并新增</el-button
+        > -->
         <el-button
           type="primary"
           :size="$attrs.size"

+ 16 - 36
src/views/business/spd/target/targetTemplate/delete/index.vue

@@ -3,45 +3,28 @@ import { delTargetTemplate,checkQuote, } from "@/api/business/spd/starget/target
 
 export default {
   name: "DeleteDialog",
-  props: {
-    selectData: {
-      type: [Array],
-      require: true,
-    },
-  },
+  props: ['selectData'],
   data() {
     return {
       title: "删 除",
     };
   },
-  computed: {
-    disabled: {
-      get() {
-        const { selectData } = this;
-        if (selectData.length < 1) {
-          return true;
-        }
-        if (
-          selectData.length >= 1 &&
-          selectData.findIndex(({ status }) => status === "1") > -1
-        ) {
-          return true;
-        }
-        if (
-          selectData.length >= 1 &&
-          selectData.findIndex(({ status }) => status === "2") > -1
-        ) {
-          return true;
-        }
-      },
-      set() {},
-    },
-  },
   watch: {},
   methods: {
-    //
-    open() {
-
+    async open() {
+      const { selectData } = this.$props;
+      const { code, data } = await checkQuote(selectData.id);
+      if(code == '200'){
+        if(data){
+          this.$modal.msgError("该目标模板存在引用,无法删除!");
+          this.visible = false;
+          return;
+        }
+      }else{
+        this.$modal.msgError("校验该目标模板是否存在引用异常,无法删除!");
+        this.visible = false;
+        return;
+      }
       this.$confirm(`是否删除数据项?`, "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
@@ -52,9 +35,7 @@ export default {
             instance.confirmButtonText = "执行中...";
             try {
               // try
-              const { selectData } = this.$props;
-              const ids = selectData.map((item) => item.id).join(",");
-              const { msg, code } = await delTargetTemplate(ids);
+              const { msg, code } = await delTargetTemplate(selectData.id);
               if (code === 200) {
                 done();
                 this.$emit("success");
@@ -86,7 +67,6 @@ export default {
   <el-button
     v-bind="$attrs"
     v-on="$listeners"
-    :disabled="disabled"
     @click="open"
   >
     {{ title }}

+ 17 - 16
src/views/business/spd/target/targetTemplate/index.vue

@@ -106,18 +106,6 @@ export default {
           ref="SeeButton"
           @success="useQuery(params, page)"
         ></see-button>
-        <add-button
-          :size="size"
-          :dict="dict"
-          :select-data="selectData"
-          add-type="edit"
-          @success="useQuery(params, page)"
-        ></add-button>
-        <dele-button
-          :size="size"
-          :select-data="selectData"
-          @success="useQuery(params, page)"
-        ></dele-button>
       </el-button-group>
     </div>
     <el-super-table
@@ -130,11 +118,24 @@ export default {
       @row-dblclick="useSee"
       @selection-change="useSelect"
     >
-      <!-- <el-table-column fixed width="55" align="center" label="#" prop="$index">
-      </el-table-column> -->
-      
-      <el-table-column fixed width="55" align="center" type="selection">
+      <el-table-column fixed="right" label="操作" align="center" width="150">
+        <template slot-scope="scope">
+          <add-button
+          :size="size"
+          :dict="dict"
+          :select-data="scope.row"
+          add-type="edit"
+          @success="useQuery(params, page)"
+        ></add-button>
+        <dele-button
+          :size="size"
+          :select-data="scope.row"
+          @success="useQuery(params, page)"
+        ></dele-button>
+        </template>
       </el-table-column>
+      <!-- <el-table-column fixed width="55" align="center" type="selection">
+      </el-table-column> -->
     </el-super-table>
     <pagination
       :total="page.total"

+ 1 - 1
src/views/purchase/DemandSummary/add.vue

@@ -236,7 +236,6 @@ export default {
       console.log('数据', this.row)
       let param = JSON.parse(JSON.stringify(this.query))
       param.sumFlag = this.row.sumFlag
-      param.demandItemId = this.row.demandItemId
       this.getDetails(param)
     }
   },
@@ -256,6 +255,7 @@ export default {
     },
     // 如果需要回显则调用详情接口
     getDetails(row) {
+      row.demandItemId = this.row.demandItemId
       getSummaryDetail(row).then(res => {
         if (res.code === 200) {
           this.tableList = res.data

+ 22 - 23
src/views/purchase/PurchaseDemandList/add.vue

@@ -84,7 +84,7 @@
 
         <el-col :span="1.5">
           <el-form-item label="是否客户指定">
-            <el-select clearable v-model="basicForm.isSpeical" :disabled="sonDisable" size="mini" style="width: 200px">
+            <el-select clearable v-model="basicForm.isCustomerSpecified" :disabled="sonDisable" size="mini" style="width: 200px">
               <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
               </el-option>
             </el-select>
@@ -167,7 +167,8 @@
       </div>
 
       <el-table
-          :data="basicForm.puDemandItemList"
+          v-myscroll
+          :data="basicForm.puDemandItemList.slice(0, over)"
           fit
           border
           :cell-style="{ borderColor: '#c0c0c0' }"
@@ -179,8 +180,8 @@
           @selection-change="handleSelectionChange"
           :cell-class-name="cellClassName"
         >
-          <el-table-column show-overflow-tooltip type="selection" fixed="left"/>
-          <el-table-column show-overflow-tooltip label="序号" type="index" align="center" width="50px" fixed="left"/>
+          <el-table-column show-overflow-tooltip type="selection"/>
+          <el-table-column show-overflow-tooltip label="序号" type="index" align="center" width="50px"/>
           <el-table-column show-overflow-tooltip label="行号" align="center" prop="rowNo">
             <template slot-scope="scope">
               {{ scope.$index + 1 + '0' }}
@@ -374,11 +375,11 @@
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column show-overflow-tooltip label="是否客户指定" align="center"  prop="isSpeical" width="120px">
+          <el-table-column show-overflow-tooltip label="是否客户指定" align="center"  prop="isCustomerSpecified" width="120px">
             <template slot-scope="scope">
               <el-form-item class="hang">
                 <el-switch
-                  v-model="scope.row.isSpeical"
+                  v-model="scope.row.isCustomerSpecified"
                   disabled
                   active-value="Y"
                   inactive-value="N"
@@ -417,18 +418,11 @@
       </el-table>
     </el-form>
       <div class="btn_group">
-        <el-col :span="1.5">
-          <el-button type="primary" size="mini"  @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button type="primary" size="mini"  @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
-        </el-col>
-        <el-col :span="1.5" style="margin: 0 10px;">
-          <el-button type="primary" size="mini"  @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button size="mini" plain @click="back">返回</el-button>
-        </el-col>
+        <el-button type="primary" size="mini"  @click="jumpOA" v-if="sonPageStu == 'check' && (row.status == '1' || row.status == '2')">跳转OA</el-button>
+        <el-button type="primary" size="mini"  @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
+        <el-button type="primary" size="mini"  @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
+        <el-button type="primary" size="mini"  @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
+        <el-button size="mini" plain @click="back">返回</el-button>
       </div>
   </el-card>
 
@@ -523,7 +517,7 @@
 <script>
 import Reserved from './reserved.vue'
 import Refers from '@/components/Refers/refers.vue'
-import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan } from '@/api/purchase/purchaseDemand.js'
+import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan, toOA } from '@/api/purchase/purchaseDemand.js'
 // 用于回显参照框数据
 import {getRefer} from '@/api/purchase/basic.js'
 // 明细行选择物料参照
@@ -568,7 +562,7 @@ export default {
         createTime: '',
         source: '4',
         billType: 'ZQBH',
-        isSpeical: 'N',
+        isCustomerSpecified: 'N',
         isProcess: '',
         isMonthleyCalculate: '',
         createTime: this.parseTime(new Date().getTime()),
@@ -708,7 +702,7 @@ export default {
       this.basicForm.code = ''
       this.basicForm.createBy = ''
       this.basicForm.source = '4'
-      this.basicForm.isSpeical = 'N'
+      this.basicForm.isCustomerSpecified = 'N'
       this.basicForm.demandPersonal = this.$store.state.user.name
       this.basicForm.demandDept = this.$store.state.user.deptId
       if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
@@ -1002,7 +996,7 @@ export default {
     },
     // 单元格标红
     cellClassName({row, column, rowIndex, columnIndex}) {
-      if(this.basicForm.isSpeical == 'N' && column.label == '需求可用周期' && Number(row.demandPeriod) > 1.5 && Number(row.demandPeriod) > Number(row.minOrderQty)) {
+      if(this.basicForm.isCustomerSpecified == 'N' && column.label == '需求可用周期' && Number(row.demandPeriod) > 1.5 && Number(row.demandPeriod) > Number(row.minOrderQty)) {
         return 'success-row';
       }
     },
@@ -1739,6 +1733,11 @@ export default {
         ]; 
       }
     },
+    jumpOA() {
+      toOA(this.$store.state.user.name, this.basicForm.flowId).then(res => {
+
+      })
+    }
   }
 }
 </script>
@@ -1748,7 +1747,7 @@ export default {
   // width: 100%;
   // margin: 20px 0;
   display: flex;
-  // justify-content: center;
+  justify-content: space-between;
   position: absolute;
   top: 10px;right: 20px;
 

+ 1 - 0
src/views/purchase/apply/add/columns.js

@@ -132,6 +132,7 @@ export default function useColumns() {
               specification: "specification",
               manufacturer: "manufacturerId",
               manufacturerName: "manufacturerIdName",
+              tax: "materialRateName",
             },
           },
         },

+ 44 - 190
src/views/purchase/apply/add/index.vue

@@ -1,7 +1,7 @@
 <script>
 import useColumns from "./columns";
 import { EXIST } from "@/api/business/purchase/catalogue";
-import { ITEM, SAVE } from "@/api/business/purchase/apply";
+import { SAVE } from "@/api/business/purchase/apply";
 import { tax, unit, currency } from "@/components/popover-select-v2/fetch";
 
 const fetchExist = async (prop) => {
@@ -23,14 +23,6 @@ export default {
     dict: {
       type: Object,
     },
-    selectData: {
-      type: [Array],
-      require: true,
-    },
-    addType: {
-      type: String,
-      default: "add",
-    },
   },
   components: {
     ElSuperForm: () => import("@/components/super-form/index.vue"),
@@ -50,6 +42,7 @@ export default {
     const rules = this.$init.rules([...TabColumns, ...TableColumns]);
     const params = this.$init.params([...TabColumns, ...TableColumns]);
     return {
+      title: "新 增",
       width: "100%",
       visible: false,
       loading: false,
@@ -60,82 +53,21 @@ export default {
       TableColumns: TableColumns,
     };
   },
-  computed: {
-    title: {
-      get() {
-        const { addType } = this;
-        if (addType === "add") {
-          return "新 增";
-        }
-        if (addType === "copy") {
-          return "复 制";
-        }
-        if (addType === "edit") {
-          return "编 辑";
-        }
-      },
-      set() {},
-    },
-    disabled: {
-      get() {
-        const {
-          addType,
-          selectData,
-          selectData: [{ status } = {}],
-        } = this.$props;
-        if (addType === "add") {
-          return false;
-        }
-        if (addType === "copy") {
-          if (selectData.length !== 1) {
-            return true;
-          }
-        }
-        if (addType === "edit") {
-          if (selectData.length !== 1) {
-            return true;
-          }
-          if (selectData.length === 1 && status === "1") {
-            return true;
-          }
-          if (selectData.length === 1 && status === "2") {
-            return true;
-          }
-        }
-      },
-      set() {},
-    },
-    priceApply: {
-      get() {
-        this.params.priceApplyItems = this.params.priceApplyItems.map(
-          (item, index) => ({
-            ...item,
-            $index: index,
-          })
-        );
-        return {
-          priceApplyItems: this.params.priceApplyItems.filter(
-            ({ delFlag }) => delFlag !== "2"
-          ),
-        };
-      },
-      set() {},
-    },
-  },
+  computed: {},
   watch: {},
   methods: {
     //
     changeMaterialName(prop) {
       const { row } = prop;
       const { puOrg, customer, supplier } = this.params;
-      const { rateCode, unitIdName, code: materialCode } = row;
+      const { tax: taxName, unitName, code: materialCode } = row;
       // task 1
-      tax(rateCode).then((res) => {
+      tax(taxName).then((res) => {
         const { ntaxrate } = res;
         row.tax = ntaxrate === "0E-8" ? "0.000000" : (ntaxrate * 1).toFixed(6);
       });
       // task 2
-      unit(unitIdName).then((res) => {
+      unit(unitName).then((res) => {
         const { id, code, name } = res;
         row.unit = id;
         row.unitCode = code;
@@ -145,99 +77,50 @@ export default {
         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 fetchItem(prop) {
-      try {
-        // try
-        this.loading = true;
-        const { code, data } = await ITEM(prop);
-        if (code === 200) {
-          this.params = data;
-          return true;
-        } else {
-          return false;
+        if (isApprovalFirst) {
+          row.isApprovalFirst = isApprovalFirst == 0 ? "Y" : "N";
         }
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
+        if (isPriceAdjustment) {
+          row.isPriceAdjustment = isPriceAdjustment == 0 ? "Y" : "N";
+        }
+      });
     },
     //
     async onOpen() {
-      const { addType, selectData } = this.$props;
-      if (addType === "add") {
-        this.visible = true;
-        const {
-          deptId: puDept,
-          deptName: puDeptName,
-          name: buyer,
-          nickName: buyerName,
-          orgId: puOrg,
-          orgName: puOrgName,
-        } = this.$store.state.user;
-        const { id, code, name } = await currency("人民币");
-        this.params.currency = id;
-        this.params.currencyCode = code;
-        this.params.currencyName = name;
-        this.params.puOrg = puOrg;
-        this.params.puOrgName = puOrgName;
-        this.params.buyer = buyer;
-        this.params.buyerName = buyerName;
-        this.params.puDept = puDept;
-        this.params.puDeptName = puDeptName;
-      }
-      if (addType === "copy") {
-        const [{ id }] = selectData;
-        this.visible = await this.fetchItem(id);
-        this.params.id = null;
-        this.params.createBy = null;
-        this.params.priceCode = null;
-        this.params.createByName = null;
-        this.params.effectiveDate = null;
-        this.params.priceApplyItems = this.params.priceApplyItems.map(
-          (item) => ({
-            ...item,
-            id: null,
-            applyId: null,
-            createByName: null,
-            updateByName: null,
-          })
-        );
-      }
-      if (addType === "edit") {
-        const [{ id }] = selectData;
-        this.visible = await this.fetchItem(id);
-        this.params.priceApplyItems = this.params.priceApplyItems.map(
-          (item) => ({
-            ...item,
-          })
-        );
-      }
+      this.visible = true;
+      const {
+        deptId: puDept,
+        deptName: puDeptName,
+        name: buyer,
+        nickName: buyerName,
+        orgId: puOrg,
+        orgName: puOrgName,
+      } = this.$store.state.user;
+      const { id, code, name } = await currency("人民币");
+      this.params.currency = id;
+      this.params.currencyCode = code;
+      this.params.currencyName = name;
+      this.params.puOrg = puOrg;
+      this.params.puOrgName = puOrgName;
+      this.params.buyer = buyer;
+      this.params.buyerName = buyerName;
+      this.params.puDept = puDept;
+      this.params.puDeptName = puDeptName;
     },
     //
     async onHide() {
-      const {
-        TabColumns,
-        TableColumns,
-        TabColumns: [
-          {
-            item: { key: tabName },
-          },
-        ],
-      } = useColumns();
+      const { TabColumns, TableColumns } = useColumns();
       this.visible = false;
-      this.tabName = tabName;
       this.params = this.$init.params([...TabColumns, ...TableColumns]);
     },
     //
@@ -263,39 +146,15 @@ export default {
     },
     //
     async onRowRemove(prop, scope) {
-      const { addType } = this.$props;
-      const {
-        row: { $index },
-      } = scope;
-      if (addType === "add") {
-        this.params[prop].splice($index, 1);
-      }
-      if (addType === "copy") {
-        this.params[prop].splice($index, 1);
-      }
-      if (addType === "edit") {
-        this.params[prop] = this.params[prop].map((item, index) => ({
-          ...item,
-          delFlag: index === $index ? "2" : item.delFlag,
-        }));
-        console.log(this.params[prop]);
-      }
+      const { $index } = scope;
+      this.params[prop].splice($index, 1);
     },
     //
     async useSubmit(prop) {
-      this.$refs[prop].$refs[prop].validate(async (valid) => {
-        console.log(this.params);
+      this.$refs[prop].validate(async (valid) => {
         if (valid) {
           try {
             this.loading = true;
-            if (this.addType === "copy") {
-              this.params.priceApplyOrgs = [];
-            }
-            if (this.addType === "edit") {
-              this.params.priceApplyItems = this.params.priceApplyItems.filter(
-                (item) => item.materialName
-              );
-            }
             const { msg, code } = await SAVE(this.params);
             if (code === 200) {
               this.onHide();
@@ -321,12 +180,7 @@ export default {
 };
 </script>
 <template>
-  <el-button
-    v-bind="$attrs"
-    v-on="$listeners"
-    :disabled="disabled"
-    @click="onOpen"
-  >
+  <el-button v-bind="$attrs" v-on="$listeners" @click="onOpen">
     {{ title }}
     <el-drawer
       :show-close="false"
@@ -382,7 +236,7 @@ export default {
           lazy
         >
           <el-super-table
-            v-model="priceApply[item.key]"
+            v-model="params[item.key]"
             :dict="dict"
             :ref="tabName"
             :columns="columns"

+ 7 - 1
src/views/purchase/apply/columns.js

@@ -35,7 +35,13 @@ export default function useColumns() {
     },
   ].map(({ item, attr }) => ({
     attr,
-    item: { ...item, fixed: false },
+    item: {
+      ...item,
+      sortabled: true,
+      fixedabled: true,
+      filterabled: true,
+      hiddenabled: true,
+    },
   }));
   const SearchColumns = [
     {

+ 291 - 0
src/views/purchase/apply/copy/columns.js

@@ -0,0 +1,291 @@
+import CONFIG from "@/config";
+
+export default function useColumns() {
+  const TableColumns = [
+    {
+      item: { key: "priceCode", title: "价格编码" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "supplierName", title: "供应商", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "SUPPLIER_PARAM",
+        dataMapping: {
+          supplier: "id",
+          supplierCode: "code",
+          supplierName: "name",
+        },
+      },
+    },
+    {
+      item: { key: "puOrgName", title: "采购组织", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "ORG_PARAM",
+        dataMapping: { puOrg: "id", puOrgCode: "code", puOrgName: "name" },
+      },
+    },
+    {
+      item: { key: "currencyName", title: "币种", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CURRENCY_PARAM",
+        dataMapping: {
+          currency: "id",
+          currencyCode: "code",
+          currencyName: "name",
+        },
+      },
+    },
+    {
+      item: { key: "explainStr", title: "价格合理性说明", require: true },
+      attr: { is: "el-input" },
+    },
+    {
+      item: { key: "buyerName", title: "采购员", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CONTACTS_PARAM",
+        dataMapping: { buyer: "code", buyerName: "name" },
+      },
+    },
+    {
+      item: { key: "puDeptName", title: "采购部门", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "DEPT_PARAM",
+        dataMapping: { puDept: "id", puDeptCode: "code", puDeptName: "name" },
+      },
+    },
+    {
+      item: { key: "createByName", title: "创建人" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "source", title: "来源单据号" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "isEffective", title: "是否已推价格" },
+      attr: {
+        is: "el-select",
+        dictName: "is_effective",
+        value: "N",
+      },
+    },
+    {
+      item: { key: "effectiveDate", title: "生效日期" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "file", title: "附件", require: true, span: 24 },
+      attr: { is: "el-file-upload" },
+    },
+    {
+      item: { key: "sourceType", title: "来源单据类型" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "status", title: "单据状态" },
+      attr: {
+        is: "el-select",
+        dictName: "sys_status",
+        disabled: true,
+        readonly: true,
+        value: "0",
+      },
+    },
+  ].map(({ item, attr }) => ({
+    attr,
+    item: { ...item, hidden: true, span: item.span || 6 },
+  }));
+
+  const TabColumns = [
+    {
+      item: {
+        title: "物料信息表",
+        key: "priceApplyItems",
+      },
+      attr: {
+        value: [],
+      },
+      TableColumns: [
+        {
+          item: { key: "materialName", title: "物料名称", require: true },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "MATERIAL_PARAM",
+            dataMapping: {
+              model: "model",
+              material: "id",
+              materialCode: "code",
+              materialName: "name",
+              unitName: "unitIdName",
+              puUnitName: "unitIdName",
+              specification: "specification",
+              manufacturer: "manufacturerId",
+              manufacturerName: "manufacturerIdName",
+            },
+          },
+        },
+        {
+          item: { key: "materialCode", title: "物料编码", require: true },
+          attr: {},
+        },
+        { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
+        { item: { key: "specification", title: "规格" }, attr: {} },
+        { item: { key: "model", title: "型号" }, attr: {} },
+        {
+          item: { key: "unitName", title: "单位" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "UNIT_PARAM",
+            dataMapping: { unit: "id", unitCode: "code", unitName: "name" },
+          },
+        },
+        {
+          item: { key: "puUnitName", title: "采购单位" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "UNIT_PARAM",
+            dataMapping: {
+              puUnit: "id",
+              puUnitCode: "code",
+              puUnitName: "name",
+            },
+          },
+        },
+        {
+          item: { key: "conversionRate", title: "采购换算率", require: true },
+          attr: {
+            is: "el-input-number",
+            precision: CONFIG.precision,
+          },
+        },
+        {
+          item: { key: "tax", title: "税率%", require: true },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "ntaxrate",
+            referName: "TAX_RATE_PARAM",
+            dataMapping: { tax: "ntaxrate" },
+          },
+        },
+        {
+          item: { key: "taxPrice", title: "含税单价", require: true },
+          attr: {
+            is: "el-input-number",
+            precision: CONFIG.precision,
+          },
+        },
+        {
+          item: { key: "price", title: "无税单价", require: true },
+          attr: {
+            formatter: (prop) => {
+              const { tax = 0, taxPrice = 0 } = prop;
+              prop.price = ((taxPrice / (tax / 100 + 1)) * 1).toFixed(
+                CONFIG.precision
+              );
+              return prop.price;
+            },
+          },
+        },
+        {
+          item: { key: "currencyName", title: "币种" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "CURRENCY_PARAM",
+            dataMapping: {
+              currency: "id",
+              currencyCode: "code",
+              currencyName: "name",
+            },
+          },
+        },
+        {
+          item: {
+            key: "periodBegin",
+            title: "价格有效期(起)",
+            require: true,
+          },
+          attr: {
+            is: "el-date-picker",
+            valueFormat: "yyyy-MM-dd",
+            value: new Date(),
+          },
+        },
+        {
+          item: { key: "periodEnd", title: "价格有效期(止)", require: true },
+          attr: {
+            is: "el-date-picker",
+            valueFormat: "yyyy-MM-dd",
+            pickerOptions: {
+              disabledDate(time) {
+                return time.getTime() < Date.now() + 3600 * 1000 * 24 * 365;
+              },
+            },
+            value: new Date(new Date().getTime() + 3600 * 1000 * 24 * 366),
+          },
+        },
+        {
+          item: { key: "customerName", title: "客户" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "CUSTOMER_PARAM",
+            dataMapping: {
+              customer: "id",
+              customerCode: "code",
+              customerName: "name",
+            },
+          },
+        },
+        { item: { key: "recentlyPrice", title: "最近价格" }, attr: {} },
+        {
+          item: { key: "isApprovalFirst", title: "首次报批" },
+          attr: {
+            is: "el-select",
+            dictName: "is_effective",
+          },
+        },
+        {
+          item: { key: "isPriceAdjustment", title: "价格调整" },
+          attr: {
+            is: "el-select",
+            dictName: "is_effective",
+          },
+        },
+        {
+          item: { key: "priceType", title: "价格类型", require: true },
+          attr: {
+            is: "el-select",
+            dictName: "sys_price_type",
+            value: "order",
+          },
+        },
+        {
+          item: { key: "isDistributionPrice", title: "配送价", require: true },
+          attr: {
+            is: "el-select",
+            dictName: "is_effective",
+            value: "N",
+          },
+        },
+        { item: { key: "createByName", title: "创建人名称" }, attr: {} },
+        { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
+      ],
+    },
+  ];
+
+  return { TableColumns, TabColumns };
+}

+ 322 - 0
src/views/purchase/apply/copy/index.vue

@@ -0,0 +1,322 @@
+<script>
+import useColumns from "./columns";
+import { EXIST } from "@/api/business/purchase/catalogue";
+import { ITEM, SAVE } from "@/api/business/purchase/apply";
+import { tax, unit, currency } from "@/components/popover-select-v2/fetch";
+
+const fetchExist = async (prop) => {
+  try {
+    // try
+    const { code, data } = await EXIST(prop);
+    if (code === 200) return data;
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
+
+export default {
+  name: "AddDrawer",
+  props: {
+    dict: {
+      type: Object,
+    },
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+  },
+  data() {
+    const {
+      TabColumns,
+      TableColumns,
+      TabColumns: [
+        {
+          item: { key: tabName },
+        },
+      ],
+    } = useColumns();
+    const rules = this.$init.rules([...TabColumns, ...TableColumns]);
+    const params = this.$init.params([...TabColumns, ...TableColumns]);
+    return {
+      title: "复 制",
+      width: "100%",
+      visible: false,
+      loading: false,
+      rules: rules,
+      params: params,
+      tabName: tabName,
+      TabColumns: TabColumns,
+      TableColumns: TableColumns,
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        const {
+          selectData: { length },
+        } = this.$props;
+        if (length !== 1) {
+          return true;
+        }
+      },
+      set() {},
+    },
+  },
+  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 fetchItem(prop) {
+      try {
+        // try
+        this.loading = true;
+        const { code, data } = await ITEM(prop);
+        if (code === 200) {
+          this.params = data;
+          return true;
+        } else {
+          return false;
+        }
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // finally
+        this.loading = false;
+      }
+    },
+    //
+    async onOpen() {
+      const {
+        selectData: [{ id }],
+      } = this.$props;
+      this.visible = await this.fetchItem(id);
+      this.params.id = null;
+      this.params.createBy = null;
+      this.params.priceCode = null;
+      this.params.createByName = null;
+      this.params.effectiveDate = null;
+      this.params.priceApplyOrgs = [];
+      this.params.priceApplyItems = this.params.priceApplyItems.map((item) => ({
+        ...item,
+        id: null,
+        applyId: null,
+        createByName: null,
+        updateByName: null,
+        delFlag: 0,
+      }));
+    },
+    //
+    async onHide() {
+      const { TabColumns, TableColumns } = useColumns();
+      this.visible = false;
+      this.params = this.$init.params([...TabColumns, ...TableColumns]);
+    },
+    //
+    async onRowAdd(prop) {
+      const {
+        $notify,
+        TabColumns,
+        params: { puOrgName, supplierName },
+      } = this;
+      if (!supplierName) {
+        return $notify.info("请选择供应商");
+      }
+      if (!puOrgName) {
+        return $notify.info("请选择采购组织");
+      }
+      const { TableColumns } = TabColumns.find(
+        ({ item: { key } }) => key === prop
+      );
+      this.params[prop].push({
+        delFlag: "0",
+        ...this.$init.params(TableColumns),
+      });
+    },
+    //
+    async onRowRemove(prop, scope) {
+      const { $index } = scope;
+      this.params[prop].splice($index, 1);
+    },
+    //
+    async useSubmit(prop) {
+      this.$refs[prop].validate(async (valid) => {
+        console.log(this.params);
+        if (valid) {
+          try {
+            this.loading = true;
+            const { msg, code } = await SAVE(this.params);
+            if (code === 200) {
+              this.onHide();
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+            this.loading = false;
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="onOpen"
+  >
+    {{ title }}
+    <el-drawer
+      :show-close="false"
+      :size="width"
+      :title="title"
+      :visible.sync="visible"
+      append-to-body
+      destroy-on-close
+      @close="onHide"
+    >
+      <template slot="title">
+        <span>{{ title }}</span>
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useSubmit('superForm')"
+        >
+          确 认
+        </el-button>
+        <el-button :size="$attrs.size" :loading="loading" @click="onHide">
+          取 消
+        </el-button>
+      </template>
+      <el-super-form
+        v-model="params"
+        :dict="dict"
+        :rules="rules"
+        :size="$attrs.size"
+        :columns="TableColumns"
+        ref="superForm"
+        label-width="auto"
+        label-position="right"
+        style="padding: 20px"
+      >
+        <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-tab-pane
+          v-for="({ item, TableColumns: columns }, index) in TabColumns"
+          :key="index"
+          :label="item.title"
+          :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
+                  :size="$attrs.size"
+                  @click.native.prevent="onRowRemove(tabName, scope)"
+                >
+                  删除
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-super-table>
+        </el-tab-pane>
+      </el-tabs>
+    </el-drawer>
+  </el-button>
+</template>
+
+<style scoped>
+::v-deep .el-table__row.is-hidden {
+  display: none;
+}
+</style>

+ 291 - 0
src/views/purchase/apply/edit/columns.js

@@ -0,0 +1,291 @@
+import CONFIG from "@/config";
+
+export default function useColumns() {
+  const TableColumns = [
+    {
+      item: { key: "priceCode", title: "价格编码" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "supplierName", title: "供应商", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "SUPPLIER_PARAM",
+        dataMapping: {
+          supplier: "id",
+          supplierCode: "code",
+          supplierName: "name",
+        },
+      },
+    },
+    {
+      item: { key: "puOrgName", title: "采购组织", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "ORG_PARAM",
+        dataMapping: { puOrg: "id", puOrgCode: "code", puOrgName: "name" },
+      },
+    },
+    {
+      item: { key: "currencyName", title: "币种", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CURRENCY_PARAM",
+        dataMapping: {
+          currency: "id",
+          currencyCode: "code",
+          currencyName: "name",
+        },
+      },
+    },
+    {
+      item: { key: "explainStr", title: "价格合理性说明", require: true },
+      attr: { is: "el-input" },
+    },
+    {
+      item: { key: "buyerName", title: "采购员", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "CONTACTS_PARAM",
+        dataMapping: { buyer: "code", buyerName: "name" },
+      },
+    },
+    {
+      item: { key: "puDeptName", title: "采购部门", require: true },
+      attr: {
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "DEPT_PARAM",
+        dataMapping: { puDept: "id", puDeptCode: "code", puDeptName: "name" },
+      },
+    },
+    {
+      item: { key: "createByName", title: "创建人" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "source", title: "来源单据号" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "isEffective", title: "是否已推价格" },
+      attr: {
+        is: "el-select",
+        dictName: "is_effective",
+        value: "N",
+      },
+    },
+    {
+      item: { key: "effectiveDate", title: "生效日期" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "file", title: "附件", require: true, span: 24 },
+      attr: { is: "el-file-upload" },
+    },
+    {
+      item: { key: "sourceType", title: "来源单据类型" },
+      attr: { is: "el-input", disabled: true, readonly: true },
+    },
+    {
+      item: { key: "status", title: "单据状态" },
+      attr: {
+        is: "el-select",
+        dictName: "sys_status",
+        disabled: true,
+        readonly: true,
+        value: "0",
+      },
+    },
+  ].map(({ item, attr }) => ({
+    attr,
+    item: { ...item, hidden: true, span: item.span || 6 },
+  }));
+
+  const TabColumns = [
+    {
+      item: {
+        title: "物料信息表",
+        key: "priceApplyItems",
+      },
+      attr: {
+        value: [],
+      },
+      TableColumns: [
+        {
+          item: { key: "materialName", title: "物料名称", require: true },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "MATERIAL_PARAM",
+            dataMapping: {
+              model: "model",
+              material: "id",
+              materialCode: "code",
+              materialName: "name",
+              unitName: "unitIdName",
+              puUnitName: "unitIdName",
+              specification: "specification",
+              manufacturer: "manufacturerId",
+              manufacturerName: "manufacturerIdName",
+            },
+          },
+        },
+        {
+          item: { key: "materialCode", title: "物料编码", require: true },
+          attr: {},
+        },
+        { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
+        { item: { key: "specification", title: "规格" }, attr: {} },
+        { item: { key: "model", title: "型号" }, attr: {} },
+        {
+          item: { key: "unitName", title: "单位" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "UNIT_PARAM",
+            dataMapping: { unit: "id", unitCode: "code", unitName: "name" },
+          },
+        },
+        {
+          item: { key: "puUnitName", title: "采购单位" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "UNIT_PARAM",
+            dataMapping: {
+              puUnit: "id",
+              puUnitCode: "code",
+              puUnitName: "name",
+            },
+          },
+        },
+        {
+          item: { key: "conversionRate", title: "采购换算率", require: true },
+          attr: {
+            is: "el-input-number",
+            precision: CONFIG.precision,
+          },
+        },
+        {
+          item: { key: "tax", title: "税率%", require: true },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "ntaxrate",
+            referName: "TAX_RATE_PARAM",
+            dataMapping: { tax: "ntaxrate" },
+          },
+        },
+        {
+          item: { key: "taxPrice", title: "含税单价", require: true },
+          attr: {
+            is: "el-input-number",
+            precision: CONFIG.precision,
+          },
+        },
+        {
+          item: { key: "price", title: "无税单价", require: true },
+          attr: {
+            formatter: (prop) => {
+              const { tax = 0, taxPrice = 0 } = prop;
+              prop.price = ((taxPrice / (tax / 100 + 1)) * 1).toFixed(
+                CONFIG.precision
+              );
+              return prop.price;
+            },
+          },
+        },
+        {
+          item: { key: "currencyName", title: "币种" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "CURRENCY_PARAM",
+            dataMapping: {
+              currency: "id",
+              currencyCode: "code",
+              currencyName: "name",
+            },
+          },
+        },
+        {
+          item: {
+            key: "periodBegin",
+            title: "价格有效期(起)",
+            require: true,
+          },
+          attr: {
+            is: "el-date-picker",
+            valueFormat: "yyyy-MM-dd",
+            value: new Date(),
+          },
+        },
+        {
+          item: { key: "periodEnd", title: "价格有效期(止)", require: true },
+          attr: {
+            is: "el-date-picker",
+            valueFormat: "yyyy-MM-dd",
+            pickerOptions: {
+              disabledDate(time) {
+                return time.getTime() < Date.now() + 3600 * 1000 * 24 * 365;
+              },
+            },
+            value: new Date(new Date().getTime() + 3600 * 1000 * 24 * 366),
+          },
+        },
+        {
+          item: { key: "customerName", title: "客户" },
+          attr: {
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "CUSTOMER_PARAM",
+            dataMapping: {
+              customer: "id",
+              customerCode: "code",
+              customerName: "name",
+            },
+          },
+        },
+        { item: { key: "recentlyPrice", title: "最近价格" }, attr: {} },
+        {
+          item: { key: "isApprovalFirst", title: "首次报批" },
+          attr: {
+            is: "el-select",
+            dictName: "is_effective",
+          },
+        },
+        {
+          item: { key: "isPriceAdjustment", title: "价格调整" },
+          attr: {
+            is: "el-select",
+            dictName: "is_effective",
+          },
+        },
+        {
+          item: { key: "priceType", title: "价格类型", require: true },
+          attr: {
+            is: "el-select",
+            dictName: "sys_price_type",
+            value: "order",
+          },
+        },
+        {
+          item: { key: "isDistributionPrice", title: "配送价", require: true },
+          attr: {
+            is: "el-select",
+            dictName: "is_effective",
+            value: "N",
+          },
+        },
+        { item: { key: "createByName", title: "创建人名称" }, attr: {} },
+        { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
+      ],
+    },
+  ];
+
+  return { TableColumns, TabColumns };
+}

+ 339 - 0
src/views/purchase/apply/edit/index.vue

@@ -0,0 +1,339 @@
+<script>
+import useColumns from "./columns";
+import { EXIST } from "@/api/business/purchase/catalogue";
+import { ITEM, SAVE } from "@/api/business/purchase/apply";
+import { tax, unit, currency } from "@/components/popover-select-v2/fetch";
+
+const fetchExist = async (prop) => {
+  try {
+    // try
+    const { code, data } = await EXIST(prop);
+    if (code === 200) return data;
+  } catch (err) {
+    // catch
+    console.error(err);
+  } finally {
+    // finally
+  }
+};
+
+export default {
+  name: "EditDrawer",
+  props: {
+    dict: {
+      type: Object,
+    },
+    selectData: {
+      type: [Array],
+      require: true,
+    },
+  },
+  components: {
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+  },
+  data() {
+    const {
+      TabColumns,
+      TableColumns,
+      TabColumns: [
+        {
+          item: { key: tabName },
+        },
+      ],
+    } = useColumns();
+    const rules = this.$init.rules([...TabColumns, ...TableColumns]);
+    const params = this.$init.params([...TabColumns, ...TableColumns]);
+    return {
+      title: "编 辑",
+      width: "100%",
+      visible: false,
+      loading: false,
+      rules: rules,
+      params: params,
+      tabName: tabName,
+      TabColumns: TabColumns,
+      TableColumns: TableColumns,
+    };
+  },
+  computed: {
+    disabled: {
+      get() {
+        const {
+          selectData,
+          selectData: [{ status } = {}],
+        } = this.$props;
+        if (selectData.length !== 1) {
+          return true;
+        }
+        if (selectData.length === 1 && status === "1") {
+          return true;
+        }
+        if (selectData.length === 1 && status === "2") {
+          return true;
+        }
+      },
+      set() {},
+    },
+    priceApply: {
+      get() {
+        this.params.priceApplyItems = this.params.priceApplyItems.map(
+          (item, index) => ({
+            ...item,
+            $index: index,
+          })
+        );
+        return {
+          priceApplyItems: this.params.priceApplyItems.filter(
+            ({ delFlag }) => delFlag !== "2"
+          ),
+        };
+      },
+      set() {},
+    },
+  },
+  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 fetchItem(prop) {
+      try {
+        // try
+        this.loading = true;
+        const { code, data } = await ITEM(prop);
+        if (code === 200) {
+          this.params = data;
+          return true;
+        } else {
+          return false;
+        }
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // finally
+        this.loading = false;
+      }
+    },
+    //
+    async onOpen() {
+      const {
+        selectData: [{ id }],
+      } = this.$props;
+      this.visible = await this.fetchItem(id);
+    },
+    //
+    async onHide() {
+      const { TabColumns, TableColumns } = useColumns();
+      this.visible = false;
+      this.params = this.$init.params([...TabColumns, ...TableColumns]);
+    },
+    //
+    async onRowAdd(prop) {
+      const {
+        $notify,
+        TabColumns,
+        params: { puOrgName, supplierName },
+      } = this;
+      if (!supplierName) {
+        return $notify.info("请选择供应商");
+      }
+      if (!puOrgName) {
+        return $notify.info("请选择采购组织");
+      }
+      const { TableColumns } = TabColumns.find(
+        ({ item: { key } }) => key === prop
+      );
+      this.params[prop].push({
+        delFlag: "0",
+        ...this.$init.params(TableColumns),
+      });
+    },
+    //
+    async onRowRemove(prop, scope) {
+      const {
+        row: { $index },
+      } = scope;
+      this.params[prop] = this.params[prop].map((item, index) => ({
+        ...item,
+        delFlag: index === $index ? "2" : item.delFlag,
+      }));
+    },
+    //
+    async useSubmit(prop) {
+      this.$refs[prop].validate(async (valid) => {
+        console.log(this.params);
+        if (valid) {
+          try {
+            this.loading = true;
+            this.params.priceApplyItems = this.params.priceApplyItems.filter(
+              (item) => item.materialName
+            );
+            const { msg, code } = await SAVE(this.params);
+            if (code === 200) {
+              this.onHide();
+              this.$emit("success");
+              this.$notify.success(msg);
+            }
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+            this.loading = false;
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    :disabled="disabled"
+    @click="onOpen"
+  >
+    {{ title }}
+    <el-drawer
+      :show-close="false"
+      :size="width"
+      :title="title"
+      :visible.sync="visible"
+      append-to-body
+      destroy-on-close
+      @close="onHide"
+    >
+      <template slot="title">
+        <span>{{ title }}</span>
+        <el-button
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useSubmit('superForm')"
+        >
+          确 认
+        </el-button>
+        <el-button :size="$attrs.size" :loading="loading" @click="onHide">
+          取 消
+        </el-button>
+      </template>
+      <el-super-form
+        v-model="params"
+        :dict="dict"
+        :rules="rules"
+        :size="$attrs.size"
+        :columns="TableColumns"
+        ref="superForm"
+        label-width="auto"
+        label-position="right"
+        style="padding: 20px"
+      >
+        <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-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"
+          >
+            <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
+                  :size="$attrs.size"
+                  @click.native.prevent="onRowRemove(tabName, scope)"
+                >
+                  删除
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-super-table>
+        </el-tab-pane>
+      </el-tabs>
+    </el-drawer>
+  </el-button>
+</template>
+
+<style scoped>
+::v-deep .el-table__row.is-hidden {
+  display: none;
+}
+</style>

+ 19 - 17
src/views/purchase/apply/index.vue

@@ -9,6 +9,8 @@ export default {
   components: {
     SeeButton: () => import("./see/index.vue"),
     AddButton: () => import("./add/index.vue"),
+    CopyButton: () => import("./copy/index.vue"),
+    EditButton: () => import("./edit/index.vue"),
     DeleButton: () => import("./delete/index.vue"),
     SubmButton: () => import("./submit/index.vue"),
     ElSuperTable: () => import("@/components/super-table/index.vue"),
@@ -84,7 +86,15 @@ export default {
 </script>
 
 <template>
-  <el-card v-loading="loading" :body-style="{ padding: 0 }">
+  <el-card
+    v-loading="loading"
+    :body-style="{
+      height: '100%',
+      padding: 0,
+      display: 'flex',
+      'flex-direction': 'column',
+    }"
+  >
     <el-super-search
       v-model="params"
       :size="size"
@@ -95,21 +105,15 @@ export default {
     ></el-super-search>
     <el-row class="my-4" style="text-align: right">
       <el-button-group>
-        <add-button
-          :size="size"
-          :select-data="[]"
-          :dict="dict"
-          add-type="add"
-          @success="useQuery(params, page)"
-        ></add-button>
-        <add-button
+        <add-button :size="size" :dict="dict" @success="useQuery(params, page)">
+        </add-button>
+        <copy-button
           :size="size"
           :dict="dict"
           :select-data="selectData"
-          add-type="copy"
           @success="useQuery(params, page)"
         >
-        </add-button>
+        </copy-button>
       </el-button-group>
       <el-button-group>
         <see-button
@@ -121,13 +125,12 @@ export default {
           ref="SeeButton"
           @success="useQuery(params, page)"
         ></see-button>
-        <add-button
+        <edit-button
           :size="size"
           :dict="dict"
           :select-data="selectData"
-          add-type="edit"
           @success="useQuery(params, page)"
-        ></add-button>
+        ></edit-button>
         <dele-button
           :size="size"
           :select-data="selectData"
@@ -151,9 +154,7 @@ export default {
       index
       checkbox
       pagination
-      hiddenColumns
-      filterColumns
-      height="600"
+      convenitentOperation
       @row-dblclick="useSee"
       @row-select="useSelect"
       @pagination="useQuery(params, page)"
@@ -164,6 +165,7 @@ export default {
 <style scoped lang="scss">
 .el-card {
   width: calc(100% - 32px);
+  height: calc(100vh - 32px);
   margin: 16px;
   padding: 16px;
   border-radius: 8px;

+ 9 - 3
src/views/purchase/catalogue/columns.js

@@ -30,7 +30,7 @@ export default function useColumns() {
     { item: { key: "effectiveDate", title: "价格生效日期" }, attr: {} },
     { item: { key: "endDate", title: "价格失效日期" }, attr: {} },
     { item: { key: "buyerName", title: "采购员" }, attr: {} },
-    { item: { key: "source", title: "来源单据" }, attr: {} },
+    { item: { key: "applyCode", title: "来源单据" }, attr: {} },
     {
       item: { key: "convertRate", title: "换算率" },
       attr: {
@@ -66,7 +66,13 @@ export default function useColumns() {
     { item: { key: "updateByName", title: "更新人名称" }, attr: {} },
   ].map(({ item, attr }) => ({
     attr,
-    item: { ...item, hidden: true, fixed: false },
+    item: {
+      ...item,
+      sortabled: true,
+      fixedabled: true,
+      filterabled: true,
+      hiddenabled: true,
+    },
   }));
 
   const SearchColumns = [
@@ -99,7 +105,7 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "source", title: "来源单据" },
+      item: { key: "applyCode", title: "来源单据" },
       attr: { is: "el-input" },
     },
     {

+ 15 - 8
src/views/purchase/catalogue/index.vue

@@ -82,7 +82,15 @@ export default {
 </script>
 
 <template>
-  <el-card v-loading="loading" :body-style="{ padding: 0 }">
+  <el-card
+    v-loading="loading"
+    :body-style="{
+      height: '100%',
+      padding: 0,
+      display: 'flex',
+      'flex-direction': 'column',
+    }"
+  >
     <el-super-search
       v-model="params"
       :size="size"
@@ -140,9 +148,7 @@ export default {
       index
       checkbox
       pagination
-      hiddenColumns
-      filterColumns
-      height="600"
+      convenitentOperation
       @row-dblclick="useSee"
       @selection-change="useSelect"
       @pagination="useQuery(params, page)"
@@ -152,10 +158,11 @@ export default {
 </template>
 <style scoped lang="scss">
 .el-card {
-  width: calc(100% - 20px);
-  height: 100%;
-  margin: 10px;
-  padding: 20px;
+  width: calc(100% - 32px);
+  height: calc(100vh - 32px);
+  margin: 16px;
+  padding: 16px;
+  border-radius: 8px;
 }
 .el-button-group + .el-button-group {
   margin: 0 0 0 10px;

+ 29 - 29
src/views/purchase/contract/add/index.vue

@@ -126,25 +126,24 @@ 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 this.getCurrency("人民币");
       this.params.currency = id;
       this.params.currencyCode = code;
-      this .params.currencyName = name;
+      this.params.currencyName = name;
       this.visible = await this.fetchCode();
     },
-    async getCurrency(search){
-
-      let page = {pageNum: 1, pageSize:10,}
+    async getCurrency(search) {
+      let page = { pageNum: 1, pageSize: 10 };
 
       const { code, rows } = await REFER(
-          {
-            isPage:true,
-            search,
-            type: 'CURRENCY_PARAM',
-          },
-          page
+        {
+          isPage: true,
+          search,
+          type: "CURRENCY_PARAM",
+        },
+        page
       );
-      if(code == 200){
+      if (code == 200) {
         return rows[0];
       }
     },
@@ -177,7 +176,7 @@ export default {
     },
     //
     async useSubmit(prop) {
-      this.$refs[prop].$refs[prop].validate(async (valid) => {
+      this.$refs[prop].validate(async (valid) => {
         if (valid) {
           try {
             // try
@@ -202,8 +201,7 @@ export default {
       });
     },
   },
-  created() {
-  },
+  created() {},
   mounted() {},
   destroyed() {},
 };
@@ -220,24 +218,27 @@ export default {
       :show-close="false"
       @close="hide"
     >
-      <div slot="title" 
-          style="
-            display: flex;
-            justify-content: space-between;
-            align-items: center;
-          ">
-        <h3>{{title}}</h3>
+      <div
+        slot="title"
+        style="
+          display: flex;
+          justify-content: space-between;
+          align-items: center;
+        "
+      >
+        <h3>{{ title }}</h3>
         <div style="text-align: right">
           <el-button
             type="primary"
             :size="$attrs.size"
             :loading="loading"
             @click="useSubmit('superForm')"
-            >确 认</el-button>
+            >确 认</el-button
+          >
           <el-button :size="$attrs.size" :loading="loading" @click="hide"
-            >取 消</el-button>
+            >取 消</el-button
+          >
         </div>
-        
       </div>
 
       <el-super-form
@@ -265,8 +266,8 @@ export default {
             :dict="dict"
             :ref="tabName"
             :columns="columns"
-            :iconOperation="false"
             :size="$attrs.size"
+            index
           >
             <template slot="materialName" slot-scope="scope">
               <component
@@ -284,7 +285,7 @@ export default {
                   type="text"
                   :size="$attrs.size"
                   @click="useRowAdd(tabName)"
-                >增行
+                  >增行
                 </el-button>
               </template>
               <template slot-scope="scope">
@@ -292,14 +293,13 @@ export default {
                   type="text"
                   :size="$attrs.size"
                   @click.native.prevent="useRowRemove(tabName, scope)"
-                >删行
+                  >删行
                 </el-button>
               </template>
             </el-table-column>
           </el-super-table>
         </el-tab-pane>
       </el-tabs>
-      
     </el-drawer>
   </el-button>
 </template>

+ 7 - 1
src/views/purchase/contract/columns.js

@@ -223,7 +223,13 @@ export default function useColumns() {
     },
   ].map(({ item, attr }) => ({
     attr,
-    item: { ...item, hidden: true, fixed: false },
+    item: {
+      ...item,
+      sortabled: true,
+      fixedabled: true,
+      filterabled: true,
+      hiddenabled: true,
+    },
   }));
 
   const SearchColumns = [

+ 22 - 24
src/views/purchase/contract/edit/index.vue

@@ -187,7 +187,7 @@ export default {
     },
     //
     async useSubmit(prop) {
-      this.$refs[prop].$refs[prop].validate(async (valid) => {
+      this.$refs[prop].validate(async (valid) => {
         if (valid) {
           try {
             // try
@@ -238,27 +238,27 @@ export default {
       destroy-on-close
       @close="hide"
     >
-
-    <div slot="title" 
-          style="
-            display: flex;
-            justify-content: space-between;
-            align-items: center;
-          ">
-        <h3>{{title}}</h3>
+      <div
+        slot="title"
+        style="
+          display: flex;
+          justify-content: space-between;
+          align-items: center;
+        "
+      >
+        <h3>{{ title }}</h3>
         <div style="text-align: right">
           <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="useSubmit('superForm')"
-          >确 认</el-button
-        >
+            type="primary"
+            :size="$attrs.size"
+            :loading="loading"
+            @click="useSubmit('superForm')"
+            >确 认</el-button
+          >
           <el-button :size="$attrs.size" :loading="loading" @click="hide"
-          >取 消</el-button
-        >
+            >取 消</el-button
+          >
         </div>
-        
       </div>
       <el-super-form
         v-model="params"
@@ -272,7 +272,6 @@ export default {
         style="padding: 20px"
       ></el-super-form>
       <el-tabs v-model="tabName" style="margin: 0 20px">
-        
         <el-tab-pane
           v-for="{ item, TableColumns: columns } in TabColumns"
           :key="item.key"
@@ -286,7 +285,7 @@ export default {
             :ref="tabName"
             :columns="columns"
             :size="$attrs.size"
-            :iconOperation="false"
+            index
           >
             <template slot="materialName" slot-scope="scope">
               <component
@@ -304,7 +303,7 @@ export default {
                   type="text"
                   :size="$attrs.size"
                   @click="useRowAdd(tabName)"
-                >增行
+                  >增行
                 </el-button>
               </template>
               <template slot-scope="scope">
@@ -312,20 +311,19 @@ export default {
                   type="text"
                   :size="$attrs.size"
                   @click.native.prevent="useRowSubmit(tabName, scope)"
-                >更新
+                  >更新
                 </el-button>
                 <el-button
                   type="text"
                   :size="$attrs.size"
                   @click.native.prevent="useRowRemove(tabName, scope)"
-                >删行
+                  >删行
                 </el-button>
               </template>
             </el-table-column>
           </el-super-table>
         </el-tab-pane>
       </el-tabs>
-      
     </el-drawer>
   </el-button>
 </template>

+ 21 - 11
src/views/purchase/contract/index.vue

@@ -36,8 +36,8 @@ export default {
     this.useQuery(this.params, this.page);
   },
   methods: {
-    setSelectable(){
-      return true
+    setSelectable() {
+      return true;
     },
     //
     async fetchList(prop, page) {
@@ -92,7 +92,15 @@ export default {
 </script>
 
 <template>
-  <el-card v-loading="loading" :body-style="{ padding: 0 }">
+  <el-card
+    v-loading="loading"
+    :body-style="{
+      height: '100%',
+      padding: 0,
+      display: 'flex',
+      'flex-direction': 'column',
+    }"
+  >
     <el-super-search
       v-model="params"
       :size="size"
@@ -101,7 +109,7 @@ export default {
       @reset="useReset"
       @submit="useQuery(params, page)"
     ></el-super-search>
-    <div style="margin: 20px 0 ; text-align: right">
+    <div style="margin: 20px 0; text-align: right">
       <el-button-group>
         <add-button
           :size="size"
@@ -168,14 +176,15 @@ export default {
       v-model="tableData"
       :size="size"
       :dict="dict"
-      max-height="600"
+      :page="page"
       :columns="TableColumns"
       :selectable="setSelectable"
+      index
       checkbox
       pagination
+      convenitentOperation
       @row-dblclick="useSee"
       @selection-change="useSelect"
-      :page="page"
       @pagination="useQuery(params, page)"
     >
     </el-super-table>
@@ -183,12 +192,13 @@ export default {
 </template>
 <style scoped lang="scss">
 .el-card {
-  width: calc(100% - 20px);
-  height: 100%;
-  margin: 10px;
-  padding: 20px;
+  width: calc(100% - 32px);
+  height: calc(100vh - 32px);
+  margin: 16px;
+  padding: 16px;
+  border-radius: 8px;
 }
 .el-button-group + .el-button-group {
-  margin: 0 0 0 10px;
+  margin: 0 0 0 8px;
 }
 </style>

+ 7 - 1
src/views/purchase/task/columns.js

@@ -75,7 +75,13 @@ export default function useColumns() {
     { item: { key: "unitName", title: "单位" }, attr: {} },
   ].map(({ item, attr }) => ({
     attr,
-    item: { ...item, hidden: true, width: 200 },
+    item: {
+      ...item,
+      sortabled: true,
+      fixedabled: true,
+      filterabled: true,
+      hiddenabled: true,
+    },
   }));
 
   const SearchColumns = [

+ 4 - 4
src/views/purchase/task/index.vue

@@ -109,6 +109,8 @@ export default {
     :body-style="{
       height: '100%',
       padding: 0,
+      display: 'flex',
+      'flex-direction': 'column',
     }"
   >
     <el-super-search
@@ -167,10 +169,8 @@ export default {
       :columns="TableColumns"
       index
       checkbox
-      hiddenColumns
-      filterColumns
       pagination
-      height="600"
+      convenitentOperation
       @row-select="useSelect"
       @pagination="useQuery(params, page)"
     >
@@ -180,7 +180,7 @@ export default {
 <style scoped lang="scss">
 .el-card {
   width: calc(100% - 32px);
-  // height: calc(100vh - 32px);
+  height: calc(100vh - 32px);
   margin: 16px;
   padding: 16px;
   border-radius: 8px;

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

@@ -6,6 +6,14 @@ export const TableColumns = [
     attr: {},
   },
   {
+    item: { key: "manufacturerName", title: "生产厂商" },
+    attr: {},
+  },
+  {
+    item: { key: "materialName", title: "物料名称" },
+    attr: {},
+  },
+  {
     item: { key: "demandDate", title: "需求时间" },
     attr: {},
   },