Explorar o código

wdly新需求

cz hai 1 ano
pai
achega
d9b8071986

+ 55 - 22
src/components/byTable/index copy.vue

@@ -23,7 +23,7 @@
       <div style="display: flex">
         <div
           class="by-dropdown"
-          v-for="(i,index) in selectConfigCopy"
+          v-for="(i, index) in selectConfigCopy"
           :key="i.prop"
           style="margin-right: 10px"
         >
@@ -36,15 +36,25 @@
           </div>
           <ul class="by-dropdown-lists">
             <li
-              @click="searchItemSelct('all', i,index)"
+              @click="searchItemSelct('all', i, index)"
               v-if="i.isShowAll === false ? i.isShowAll : true"
+              style="
+                display: flex;
+                align-items: center;
+                justify-content: center;
+              "
             >
-              全部
+              {{ $t("common.all") }}
             </li>
             <li
               v-for="j in i.data"
               :key="j.value"
               @click="searchItemSelct(j, i)"
+              style="
+                display: flex;
+                align-items: center;
+                justify-content: center;
+              "
             >
               {{ j.label }}
             </li>
@@ -54,10 +64,10 @@
 
       <div style="display: flex">
         <el-input
-          placeholder="请输入关键字"
+          :placeholder="$t('common.pleaseEnterKeywords')"
           suffix-icon="search"
           size="mini"
-          v-model="keywrod"
+          v-model="pagination.keyword"
           @keyup.enter="searchFn"
         >
         </el-input>
@@ -66,16 +76,13 @@
           style="margin-left: 10px"
           size="default"
           @click="searchFn"
-          >搜索</el-button
+          >{{ $t("common.search") }}</el-button
         >
-
-        <div class="more-icon"><i class="el-icon-wind-power"></i></div>
-        <div class="more-icon">
-          <i class="el-icon-notebook-2"></i>
+        <div class="more-icon" @click="retrievalModalFn">
+          <img src="@/assets/images/iconm_xiangyzk.png" alt="" />
         </div>
       </div>
     </div>
-
     <component :is="containerTag">
       <div class="filter-form-container">
         <slot />
@@ -91,6 +98,7 @@
         v-on="tableEvents"
         row-key="id"
         :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
+        :height="tableHeight"
       >
         <el-table-column
           v-for="(item, index) in config"
@@ -202,6 +210,10 @@ export default defineComponent({
         return [];
       },
     },
+    tableHeight: {
+      type: Number,
+      required: false,
+    },
     searchConfig: {
       type: Object,
       default() {
@@ -265,13 +277,13 @@ export default defineComponent({
   },
   setup(props) {
     const { proxy } = getCurrentInstance();
-    const keywrod = ref("");
     const selectConfigCopy = computed(() => {
       return props.selectConfig.map((item) => {
-        if(!item.labelCopy) item.labelCopy = {...item}.label;
+        if (!item.labelCopy) item.labelCopy = { ...item }.label;
         return item;
       });
     });
+    const retrievalModal = ref(false);
     console.log(selectConfigCopy);
     const getAttrsValue = (item) => {
       const { attrs } = item;
@@ -347,9 +359,14 @@ export default defineComponent({
       console.log(props);
       proxy.$emit(
         "getList",
-        Object.assign(props.filterParams, { [props.searchKey]: keywrod.value })
+        Object.assign(props.filterParams, {
+          [props.searchKey]: props.pagination.keyword,
+        })
       );
     };
+    const retrievalModalFn = () => {
+      proxy.$emit("moreSearch", "");
+    };
     const handlePageChange = (val) => {
       proxy.$emit(
         "getList",
@@ -383,10 +400,9 @@ export default defineComponent({
     };
     //下拉搜索相关
 
-    const searchItemSelct = (item, i,index) => {
+    const searchItemSelct = (item, i, index) => {
       if (item == "all") {
-        console.log(props.selectConfig)
-        i.label = {...props.selectConfig[index]}.labelCopy
+        i.label = { ...props.selectConfig[index] }.labelCopy;
         proxy.$emit(
           "getList",
           Object.assign(props.filterParams, { [i.prop]: "" })
@@ -394,7 +410,6 @@ export default defineComponent({
         return;
       }
       i.label = item.label;
-      console.log(item, i);
       proxy.$emit(
         "getList",
         Object.assign(props.filterParams, { [i.prop]: item.value })
@@ -428,11 +443,12 @@ export default defineComponent({
       getHeaderActions,
       stopBubbles,
       handleNativeClick,
-      keywrod,
       searchFn,
       searchItemSelct,
       selectConfigCopy,
       isSelectable,
+      retrievalModal,
+      retrievalModalFn,
     };
   },
 });
@@ -449,22 +465,34 @@ export default defineComponent({
   margin: 0 !important;
   padding: 8px 6px !important;
 }
+.el-checkbox__input.is-disabled .el-checkbox__inner {
+  background-color: #dee1e6;
+  border-color: #b2b4b9;
+}
+.el-table .cell {
+  line-height: 34px;
+}
 </style>
   <style lang="scss" scoped>
 .by-search {
   display: flex;
   justify-content: space-between;
   margin-bottom: 10px;
+  .more-icon {
+    float: right;
+    cursor: pointer;
+  }
 }
 .by-dropdown {
   position: relative;
   text-align: left;
   height: 32px;
-  z-index: 100;
+  z-index: 1010;
   padding: 0 10px;
   transition: all 0.5s ease;
   cursor: pointer;
   line-height: 32px;
+
   .by-dropdown-title {
     font-size: 14px;
     background-color: #fff;
@@ -472,7 +500,7 @@ export default defineComponent({
   ul {
     position: absolute;
     left: 0;
-    
+
     top: 32px;
     padding: 0;
     margin: 0;
@@ -501,7 +529,7 @@ export default defineComponent({
   top: 8px;
   background-color: #ddd;
   right: 0;
-  z-index: 101;
+  z-index: 1011;
 }
 
 .by-dropdown:hover {
@@ -549,4 +577,9 @@ export default defineComponent({
     }
   }
 }
+.by-dropdown-lists {
+  max-height: 50vh;
+  overflow-y: auto;
+  line-height: 1;
+}
 </style>

+ 75 - 23
src/components/byTable/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="header-actions" v-if="getActionList.length != 0 &&getActionList.length>1">
+  <div class="header-actions" v-if="getActionList.length != 0 &&getActionList.length>2">
     <div class="overflow-box">
       <el-button v-for="(item, index) in getActionList" :key="index" :type="item.type || 'primary'" :plain="item.plain || false"
                  v-bind="getHeaderActions(item)" @click="item.action" :disabled="item.disabled || false">
@@ -49,32 +49,42 @@
     </header>
     <div class="by-search" v-if="!hideSearch">
       <div style="display: flex">
-        <div v-if="getActionList.length != 0 &&getActionList.length==1" style="margin-right:10px">
+        <div v-if="getActionList.length != 0 &&getActionList.length <=2" style="margin-right:10px">
           <el-button v-for="(item, index) in getActionList" :key="index" :type="item.type || 'primary'" :plain="item.plain || false"
                      v-bind="getHeaderActions(item)" @click="item.action" :disabled="item.disabled || false">
             {{ item.text }}
           </el-button>
         </div>
         <div class="by-dropdown" v-for="(i, index) in selectConfigCopy" :key="i.prop" style="margin-right: 10px">
-          <div class="by-dropdown-title">
-            {{
+          <div v-if="i.type" class="selectTime" style="display:flex;align-items:center">
+            <span style="font-size:14px;height:32px;margin-right:15px">{{i.label || ''}}</span>
+            <el-date-picker v-model="pagination[i.prop]" type="date" size="small" :placeholder="i.placeholder" style="width:120px"
+                            value-format="YYYY-MM-DD" @change="searchItemSelctOne(i,pagination[i.prop],pagination[i.propOne])" />
+            <span style="margin-right:15px">-</span>
+            <el-date-picker v-model="pagination[i.propOne]" type="date" size="small" :placeholder="i.placeholderOne" style="width:120px"
+                            value-format="YYYY-MM-DD" @change="searchItemSelctOne(i,pagination[i.prop],pagination[i.propOne])" />
+          </div>
+          <div v-else>
+            <div class="by-dropdown-title">
+              <!-- {{i.label || i.labelCopy}} -->
+              {{
               pagination[i.prop]
                 ? i.data.find((j) => j.value === pagination[i.prop])
                   ? i.data.find((j) => j.value === pagination[i.prop]).label
                   : i.label
                 : i.labelCopy
             }}
-            <!-- {{ i.label || i.labelCopy }} -->
-            <i style="margin-left: 5px" class="iconfont icon-iconm_xialan1"></i>
+              <i style="margin-left: 5px" class="iconfont icon-iconm_xialan1"></i>
+            </div>
+            <ul class="by-dropdown-lists">
+              <li @click="searchItemSelct('all', i, index)" v-if="i.isShowAll === false ? i.isShowAll : true" style="">
+                {{ $t("common.all") }}
+              </li>
+              <li v-for="j in i.data" :key="j.value || j.dictKey" @click="searchItemSelct(j, i)" style="">
+                {{ j.label || j.dictValue }}
+              </li>
+            </ul>
           </div>
-          <ul class="by-dropdown-lists">
-            <li @click="searchItemSelct('all', i, index)" v-if="i.isShowAll === false ? i.isShowAll : true" style="">
-              {{ $t("common.all") }}
-            </li>
-            <li v-for="j in i.data" :key="j.value" @click="searchItemSelct(j, i)" style="">
-              {{ j.label }}
-            </li>
-          </ul>
         </div>
       </div>
 
@@ -83,8 +93,8 @@
                   @keyup.enter="searchFn">
         </el-input>
         <el-button type="primary" style="margin-left: 10px" size="default" @click="searchFn">{{ $t("common.search") }}</el-button>
-        <div class="more-icon" @click="retrievalModalFn" v-if="$attrs.onMoreSearch">
-          <i class="iconfont icon-iconx_saixuan"></i>
+        <div class="more-icon" @click="retrievalModalFn">
+          <img src="@/assets/images/iconm_xiangyzk.png" alt="" />
         </div>
       </div>
     </div>
@@ -153,6 +163,10 @@ export default defineComponent({
       type: Boolean,
       default: false,
     },
+    onMoreSearch: {
+      type: Boolean,
+      default: true,
+    },
     hideAll: {
       type: Boolean,
       default: false,
@@ -268,8 +282,10 @@ export default defineComponent({
   setup(props) {
     const { proxy } = getCurrentInstance();
     // 过滤出有属性的
-    const configData = ref([]);
-    configData.value = proxy.config.filter((x) => x && x.attrs);
+    // const configData = ref([]);
+    // configData.value = proxy.config.filter((x) => x && x.attrs);
+    const configData = computed(() => proxy.config.filter((x) => x && x.attrs));
+    // console.log(configData.value, "ssssssssss");
     const selectConfigCopy = computed(() => {
       return props.selectConfig.map((item) => {
         if (!item.labelCopy) item.labelCopy = { ...item }.label;
@@ -415,20 +431,44 @@ export default defineComponent({
 
     const searchItemSelct = (item, i, index) => {
       if (item == "all") {
-        i.label = { ...props.selectConfig[index] }.labelCopy;
+        // i.label = { ...props.selectConfig[index] }.labelCopy;
+        i.label = props.selectConfig[index].labelCopy;
         proxy.$emit(
           "getList",
           Object.assign(props.filterParams, { [i.prop]: "" })
         );
         return;
       }
-      i.label = item.label;
+      i.label = item.label || item.dictValue;
       proxy.$emit(
         "getList",
-        Object.assign(props.filterParams, { [i.prop]: item.value })
+        Object.assign(props.filterParams, {
+          [i.prop]: item.value || item.dictKey,
+        })
       );
     };
 
+    const searchItemSelctOne = (item, prop, propOne) => {
+      console.log(prop, propOne, "sssss");
+      if (prop && propOne) {
+        proxy.$emit(
+          "getList",
+          Object.assign(props.filterParams, {
+            [item.prop]: prop,
+            [item.propOne]: propOne,
+          })
+        );
+      } else if (prop == null && propOne == null) {
+        proxy.$emit(
+          "getList",
+          Object.assign(props.filterParams, {
+            [item.prop]: prop,
+            [item.propOne]: propOne,
+          })
+        );
+      }
+    };
+
     const isSelectable = (row, index, item) => {
       if (item.type === "selection") {
         if (item.attrs && item.attrs.checkAtt) {
@@ -460,6 +500,7 @@ export default defineComponent({
       handleNativeClick,
       searchFn,
       searchItemSelct,
+      searchItemSelctOne,
       selectConfigCopy,
       isSelectable,
       retrievalModal,
@@ -649,7 +690,7 @@ export default defineComponent({
   .more-icon {
     float: right;
     cursor: pointer;
-    line-height: 32px;
+    // line-height: 32px;
     text-align: center;
     margin-left: 5px;
   }
@@ -734,7 +775,7 @@ export default defineComponent({
 }
 .table-list-container {
   background: #fff;
-  padding: 13px 20px 20px;
+  padding: 15px;
   .table-pagination {
     padding-top: 20px;
   }
@@ -756,4 +797,15 @@ export default defineComponent({
   overflow-y: auto;
   line-height: 1;
 }
+:deep(.selectTime .el-input__wrapper) {
+  box-shadow: none;
+}
+:deep(.selectTime .el-input__inner) {
+  color: #000 !important;
+  font-size: 14px !important;
+}
+:deep(.selectTime .el-input .el-input__icon) {
+  color: #000 !important;
+  font-size: 14px !important;
+}
 </style>

+ 0 - 585
src/components/byTable/index1.vue

@@ -1,585 +0,0 @@
-<template>
-  <div class="header-actions" v-if="getActionList.length != 0">
-    <div class="overflow-box">
-      <el-button
-        v-for="(item, index) in getActionList"
-        :key="index"
-        :type="item.type || 'primary'"
-        :plain="item.plain || false"
-        v-bind="getHeaderActions(item)"
-        @click="item.action"
-        :disabled="item.disabled || false"
-      >
-        {{ item.text }}
-      </el-button>
-    </div>
-  </div>
-  <div class="table-list-container by-table">
-    <!-- v-if="!hideHeader" -->
-    <header v-if="false" class="header">
-      <h2>{{ title }}</h2>
-    </header>
-    <div class="by-search" v-if="!hideSearch">
-      <div style="display: flex">
-        <div
-          class="by-dropdown"
-          v-for="(i, index) in selectConfigCopy"
-          :key="i.prop"
-          style="margin-right: 10px"
-        >
-          <div class="by-dropdown-title">
-            {{ i.label || i.labelCopy
-            }}<i
-              style="margin-left: 5px"
-              class="iconfont icon-iconm_xialan1"
-            ></i>
-          </div>
-          <ul class="by-dropdown-lists">
-            <li
-              @click="searchItemSelct('all', i, index)"
-              v-if="i.isShowAll === false ? i.isShowAll : true"
-              style="
-                display: flex;
-                align-items: center;
-                justify-content: center;
-              "
-            >
-              {{ $t("common.all") }}
-            </li>
-            <li
-              v-for="j in i.data"
-              :key="j.value"
-              @click="searchItemSelct(j, i)"
-              style="
-                display: flex;
-                align-items: center;
-                justify-content: center;
-              "
-            >
-              {{ j.label }}
-            </li>
-          </ul>
-        </div>
-      </div>
-
-      <div style="display: flex">
-        <el-input
-          :placeholder="$t('common.pleaseEnterKeywords')"
-          suffix-icon="search"
-          size="mini"
-          v-model="pagination.keyword"
-          @keyup.enter="searchFn"
-        >
-        </el-input>
-        <el-button
-          type="primary"
-          style="margin-left: 10px"
-          size="default"
-          @click="searchFn"
-          >{{ $t("common.search") }}</el-button
-        >
-        <div class="more-icon" @click="retrievalModalFn">
-          <img src="@/assets/images/iconm_xiangyzk.png" alt="" />
-        </div>
-      </div>
-    </div>
-    <component :is="containerTag">
-      <div class="filter-form-container">
-        <slot />
-      </div>
-
-      <el-table
-        ref="hocElTable"
-        v-loading="loading"
-        :data="source"
-        v-if="!hideTable"
-        style="width: 100%"
-        v-bind="$attrs"
-        v-on="tableEvents"
-        row-key="id"
-        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
-        :height="tableHeight"
-      >
-        <el-table-column
-          v-for="(item, index) in config"
-          :key="index"
-          v-bind="getAttrsValue(item)"
-          :type="item.type || ''"
-          :selectable="
-            (rowData, rowIndex) => isSelectable(rowData, rowIndex, item)
-          "
-        >
-          <template #default="scope" v-if="!item.type">
-            <slot
-              :name="item.attrs.slot"
-              :item="scope.row"
-              v-if="item.attrs.slot"
-            >
-              插槽占位符
-            </slot>
-            <div v-else-if="isFunction(getValue(scope, item))">
-              <component
-                :is="renderTypeList[getMatchRenderFunction(item)].target"
-                :cell-list="getValue(scope, item)()"
-                :row="scope.row"
-                :parent="getParent"
-                @click="
-                  ($event) => {
-                    handleNativeClick(getAttrsValue(item), $event, item);
-                  }
-                "
-              />
-            </div>
-            <div v-else>
-              {{ getValue(scope, item) }}
-            </div>
-          </template>
-        </el-table-column>
-      </el-table>
-
-      <el-row
-        v-if="!hidePagination"
-        class="table-pagination"
-        justify="end"
-        type="flex"
-      >
-        <el-pagination
-          background
-          layout="total, sizes, prev, pager, next, jumper"
-          :current-page="getPagination.pageNum"
-          :page-size="getPagination.pageSize"
-          :total="getPagination.total"
-          @size-change="handleSizeChange"
-          @current-change="handlePageChange"
-        />
-      </el-row>
-    </component>
-  </div>
-</template>
-  
-  <script>
-import { isFunction as isFn, isBoolean } from "./type";
-import ElementsMapping from "./ElementsMapping";
-import ComponentsMapping from "./ComponentsMapping";
-import { computed, defineComponent, getCurrentInstance, ref } from "vue";
-import expand from "./expand";
-export default defineComponent({
-  name: "Table",
-  components: {
-    ElementsMapping,
-    ComponentsMapping,
-  },
-  props: {
-    hideSearch: {
-      type: Boolean,
-      default: false,
-    },
-    hideTable: {
-      type: Boolean,
-      default: false,
-    },
-    //顶部搜索下拉配置
-    selectConfig: {
-      type: Array,
-      default() {
-        return [];
-      },
-    },
-    // 获取表格元数据时携带的参数
-    filterParams: {
-      type: Object,
-      default() {
-        return {};
-      },
-    },
-    // 表格加载 loading
-    loading: {
-      type: Boolean,
-      default: false,
-    },
-    // 表格名称
-    title: {
-      type: String,
-      default: "",
-    },
-    // 表格元数据
-    source: {
-      type: Array,
-      required: true,
-      default() {
-        return [];
-      },
-    },
-    tableHeight: {
-      type: Number,
-      required: false,
-    },
-    searchConfig: {
-      type: Object,
-      default() {
-        return {
-          keyword: "",
-        };
-      },
-    },
-    // 指定外层容器的渲染组件
-    containerTag: {
-      type: String,
-      default: "div",
-    },
-    // 是否隐藏表头
-    hideHeader: {
-      type: Boolean,
-      default: false,
-    },
-    // 是否隐藏分页
-    hidePagination: {
-      type: Boolean,
-      default: false,
-    },
-    // 分页配置
-    pagination: {
-      type: Object,
-      default() {
-        return {};
-      },
-    },
-    // 表格配置文件
-    config: {
-      type: Array,
-      default() {
-        return [];
-      },
-    },
-    // 表头右上方的按钮组
-    actionList: {
-      type: Array,
-      default() {
-        return [{ text: "", action: () => {} }];
-      },
-    },
-    // element table 原生事件
-    tableEvents: {
-      type: Object,
-      default() {
-        return {};
-      },
-    },
-    searchKey: {
-      type: String,
-      default: "keyword",
-    },
-    // 是否显示过滤的全部选项
-    // isShowAll: {
-    //   type: Boolean,
-    //   default: true,
-    // },
-  },
-  setup(props) {
-    const { proxy } = getCurrentInstance();
-    const selectConfigCopy = computed(() => {
-      return props.selectConfig.map((item) => {
-        if (!item.labelCopy) item.labelCopy = { ...item }.label;
-        return item;
-      });
-    });
-    const retrievalModal = ref(false);
-    console.log(selectConfigCopy);
-    const getAttrsValue = (item) => {
-      const { attrs } = item;
-      const result = {
-        ...attrs,
-      };
-      delete result.prop;
-      return result;
-    };
-    const renderTypeList = ref({
-      render: {},
-      renderHTML: {
-        target: "elements-mapping",
-      },
-      renderComponent: {
-        target: "components-mapping",
-      },
-    });
-    const getParent = computed(() => {
-      return proxy.$parent;
-    });
-    const getPagination = computed(() => {
-      const params = {
-        pageNum: 1,
-        pageSize: 10,
-        total: 0,
-      };
-      return Object.assign({}, params, props.pagination);
-    });
-    const getActionList = computed(() => {
-      return props.actionList
-        .slice()
-        .reverse()
-        .filter((it) => it.text);
-    });
-    const getValue = (scope, configItem) => {
-      const prop = configItem.attrs.prop;
-      const renderName = getMatchRenderFunction(configItem);
-      const renderObj = renderTypeList.value[renderName];
-      if (renderObj && isFunction(configItem[renderName])) {
-        return renderObj.target
-          ? getRenderValue(scope, configItem, {
-              name: renderName,
-              type: "bind",
-            })
-          : getRenderValue(scope, configItem);
-      }
-      return scope.row[prop];
-    };
-    const getRenderValue = (
-      scope,
-      item,
-      fn = { name: "render", type: "call" }
-    ) => {
-      const prop = item.attrs.prop;
-      const propValue = prop && scope.row[prop];
-      scope.row.$index = scope.$index;
-      const args = propValue !== undefined ? propValue : scope.row;
-
-      return item[fn.name][fn.type](getParent.value, args);
-    };
-    // 匹配 render 开头的函数
-    const getMatchRenderFunction = (obj) => {
-      return Object.keys(obj).find((key) => {
-        const matchRender = key.match(/^render.*/);
-        return matchRender && matchRender[0];
-      });
-    };
-    const isFunction = (fn) => {
-      return isFn(fn);
-    };
-    const searchFn = (val) => {
-      console.log(props);
-      proxy.$emit(
-        "getList",
-        Object.assign(props.filterParams, {
-          [props.searchKey]: props.pagination.keyword,
-        })
-      );
-    };
-    const retrievalModalFn = () => {
-      proxy.$emit("moreSearch", "");
-    };
-    const handlePageChange = (val) => {
-      proxy.$emit(
-        "getList",
-        Object.assign(props.filterParams, { pageNum: val })
-      );
-    };
-    const handleSizeChange = (val) => {
-      proxy.$emit(
-        "getList",
-        Object.assign(props.filterParams, { pageSize: val })
-      );
-    };
-    const getHeaderActions = (item) => {
-      return {
-        ...item.attrs,
-      };
-    };
-    const stopBubbles = (e) => {
-      const event = e || window.event;
-      if (event && event.stopPropagation) {
-        event.stopPropagation();
-      } else {
-        event.cancelBubble = true;
-      }
-    };
-    const handleNativeClick = ({ isBubble }, e, item) => {
-      // 考虑到单元格内渲染了组件,并且组件自身可能含有点击事件,故添加了阻止冒泡机制
-      // 若指定 isBubble 为 false,则当前单元格恢复冒泡机制
-      if (isBoolean(isBubble) && !isBubble) return;
-      stopBubbles(e);
-    };
-    //下拉搜索相关
-
-    const searchItemSelct = (item, i, index) => {
-      if (item == "all") {
-        i.label = { ...props.selectConfig[index] }.labelCopy;
-        proxy.$emit(
-          "getList",
-          Object.assign(props.filterParams, { [i.prop]: "" })
-        );
-        return;
-      }
-      i.label = item.label;
-      proxy.$emit(
-        "getList",
-        Object.assign(props.filterParams, { [i.prop]: item.value })
-      );
-    };
-
-    const isSelectable = (row, index, item) => {
-      if (item.type === "selection") {
-        if (item.attrs && item.attrs.checkAtt) {
-          if (row[item.attrs.checkAtt]) {
-            return row[item.attrs.checkAtt];
-          }
-        } else {
-          return true;
-        }
-      }
-    };
-
-    return {
-      getParent,
-      getPagination,
-      renderTypeList,
-      getActionList,
-      getAttrsValue,
-      getValue,
-      getRenderValue,
-      getMatchRenderFunction,
-      isFunction,
-      handlePageChange,
-      handleSizeChange,
-      getHeaderActions,
-      stopBubbles,
-      handleNativeClick,
-      searchFn,
-      searchItemSelct,
-      selectConfigCopy,
-      isSelectable,
-      retrievalModal,
-      retrievalModalFn,
-    };
-  },
-});
-</script>
-  <style>
-.table-list-container th {
-  color: #333 !important;
-}
-.by-table td .el-button + .el-button {
-  margin-left: 0 !important;
-}
-.by-table td .el-button {
-  background: none !important;
-  margin: 0 !important;
-  padding: 8px 6px !important;
-}
-.el-checkbox__input.is-disabled .el-checkbox__inner {
-  background-color: #dee1e6;
-  border-color: #b2b4b9;
-}
-.el-table .cell {
-  line-height: 34px;
-}
-</style>
-  <style lang="scss" scoped>
-.by-search {
-  display: flex;
-  justify-content: space-between;
-  margin-bottom: 10px;
-  .more-icon {
-    float: right;
-    cursor: pointer;
-  }
-}
-.by-dropdown {
-  position: relative;
-  text-align: left;
-  height: 32px;
-  z-index: 1010;
-  padding: 0 10px;
-  transition: all 0.5s ease;
-  cursor: pointer;
-  line-height: 32px;
-
-  .by-dropdown-title {
-    font-size: 14px;
-    background-color: #fff;
-  }
-  ul {
-    position: absolute;
-    left: 0;
-
-    top: 32px;
-    padding: 0;
-    margin: 0;
-    z-index: 100;
-    display: none;
-    white-space: nowrap;
-    li {
-      list-style: none;
-      font-size: 12px;
-      height: 30px;
-      padding: 0 10px;
-    }
-    li:hover {
-      background-color: #eff6ff;
-      color: #0084ff;
-    }
-  }
-}
-
-.by-dropdown::before {
-  display: block;
-  width: 1px;
-  content: " ";
-  position: absolute;
-  height: 14px;
-  top: 8px;
-  background-color: #ddd;
-  right: 0;
-  z-index: 1011;
-}
-
-.by-dropdown:hover {
-  background: #ffffff;
-
-  border-radius: 2px 2px 2px 2px;
-  opacity: 1;
-  ul {
-    background: #ffffff;
-    box-shadow: 0px 2px 16px 1px rgba(0, 0, 0, 0.06);
-    border-radius: 2px 2px 2px 2px;
-    opacity: 1;
-    display: block;
-    text-align: left;
-  }
-}
-.header-actions {
-  flex: 1;
-  overflow-x: auto;
-  padding: 20px;
-  background: #fff;
-  margin-bottom: 20px;
-  .overflow-box {
-    :deep() .el-button:nth-child(1) {
-      margin-left: 10px;
-    }
-  }
-}
-.table-list-container {
-  background: #fff;
-  padding: 13px 20px 20px;
-  .table-pagination {
-    padding-top: 20px;
-  }
-  .header {
-    display: flex;
-    padding-bottom: 20px;
-  }
-  .el-table {
-    :deep() th {
-      font-size: 14px;
-    }
-    :deep() td {
-      font-size: 14px;
-    }
-  }
-}
-.by-dropdown-lists {
-  max-height: 50vh;
-  overflow-y: auto;
-  line-height: 1;
-}
-</style>

+ 70 - 4
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -6,9 +6,15 @@
           //element talbe事件都能传
         }" :action-list="[]" @get-list="getList" @moreSearch="() => (dialogVisibleThree = true)">
         <template #contractCode="{ item }">
-          <div style="cursor: pointer; color: #409eff" @click="handleClickContractCode(item)">
-            {{ item.contractCode }}
+          <div style="width:100%;display:flex;align-items:center">
+            <el-icon :size="20" style="cursor: pointer;" @click="updateCode(item)">
+              <Edit />
+            </el-icon>
+            <div style="cursor: pointer; color: #409eff;margin-left:10px" @click="handleClickContractCode(item)">
+              {{ item.contractCode }}
+            </div>
           </div>
+
         </template>
 
         <template #arrivalStatus="{ item }">
@@ -398,6 +404,17 @@
       </template>
     </el-dialog>
 
+    <el-dialog :title="'修改采购单号'" v-model="updateCodeDialog" width="600" destroy-on-close>
+      <byForm :formConfig="updateCodeFormConfig" :formOption="formOption" v-model="formData.updateCodeData" :rules="updateCodeRules"
+              ref="updateCodeDom" v-loading="loadingTwo">
+      </byForm>
+      <template #footer>
+        <el-button @click="updateCodeDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click="submitUpdateCode()" size="large" :loading="loadingTwo">
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
     <el-dialog :title="'付款明细'" v-model="payDialog" width="600" destroy-on-close>
       <div>
         <el-timeline :reverse="false">
@@ -608,6 +625,14 @@ const selectConfig = computed(() => [
     prop: "deptId",
     data: deptData.value,
   },
+  {
+    type: "time",
+    label: "采购日期",
+    placeholder: "开始日期",
+    prop: "beginTime",
+    placeholderOne: "结束日期",
+    propOne: "endTime",
+  },
 ]);
 
 const config = computed(() => {
@@ -617,12 +642,14 @@ const config = computed(() => {
         label: "采购单号",
         prop: "contractCode",
         slot: "contractCode",
+        "min-width": 200,
       },
     },
     {
       attrs: {
         label: "供应商",
         prop: "supplyName",
+        "min-width": 180,
       },
     },
     {
@@ -646,14 +673,14 @@ const config = computed(() => {
       attrs: {
         label: "采购人",
         prop: "purchaseName",
-        width: 130,
+        width: 110,
       },
     },
     {
       attrs: {
         label: "项目组",
         prop: "deptName",
-        width: 150,
+        width: 130,
       },
     },
 
@@ -1751,6 +1778,45 @@ const getSummariesTwo = (param) => {
   });
   return sums;
 };
+const updateCodeDom = ref(null);
+const updateCodeDialog = ref(false);
+const updateCodeFormConfig = computed(() => [
+  {
+    type: "input",
+    prop: "contractCode",
+    label: "采购单号",
+    disabled: false,
+    itemWidth: 100,
+  },
+]);
+const updateCodeRules = ref({
+  contractCode: [
+    { required: true, message: "请输入采购单号", trigger: "blur" },
+  ],
+});
+const updateCode = (row) => {
+  formData.updateCodeData = {
+    id: row.id,
+    contractCode: row.contractCode,
+  };
+  updateCodeDialog.value = true;
+};
+const submitUpdateCode = () => {
+  updateCodeDom.value.handleSubmit(() => {
+    loadingTwo.value = true;
+    proxy
+      .post("/purchase/editContractCode", formData.updateCodeData)
+      .then((res) => {
+        ElMessage({
+          message: `操作成功`,
+          type: "success",
+        });
+        updateCodeDialog.value = false;
+        loadingTwo.value = false;
+        getList();
+      });
+  });
+};
 </script>
   
 <style lang="scss" scoped>