xiaodai2022 2 năm trước cách đây
mục cha
commit
279fcbaf92
1 tập tin đã thay đổi với 50 bổ sung41 xóa
  1. 50 41
      src/views/serviceParam/supplierAccount/index.vue

+ 50 - 41
src/views/serviceParam/supplierAccount/index.vue

@@ -24,7 +24,7 @@
         <template #table-header="{}">
           <div style="width: 100%">
             <el-row style="padding: 0 0 0 80px">
-              <el-col :span="4" style="width: 160px">
+              <el-col :span="4" style="width: 120px">
                 <el-select
                   v-model="parmValue.status"
                   filterable
@@ -46,6 +46,17 @@
                   />
                 </el-select>
               </el-col>
+              <el-col :span="12" style="width: 380px; padding: 0 0 0 10px">
+                <search-supplier
+                  :size="'mini'"
+                  :value="parmValue.supplierNo"
+                  :disabled="false"
+                  :placeholder="'供应商名称'"
+                  :names="''"
+                  :isDetail="false"
+                  @searchChange="supplierChange"
+                />
+              </el-col>
               <el-col :span="4" style="width: 200px; padding: 0 0 0 10px">
                 <el-input
                   :size="searchSize"
@@ -118,6 +129,17 @@
         </template>
 
         <template #operation="{ scope }">
+          <el-tooltip
+            v-if="powers.some((i) => i == '002')"
+            effect="dark"
+            content="重置密码"
+            placement="top"
+          >
+            <i
+              class="el-icon-refresh-left tb-icon"
+              @click="openPasswordModal(scope.row.id, false)"
+            ></i>
+          </el-tooltip>
           <el-tooltip
             v-if="powers.some((i) => i == '007')"
             effect="dark"
@@ -219,12 +241,11 @@ export default {
     return {
       statusList: statusList,
       loading: false,
-
       stype: {},
       parmValue: {
         page: 1, // 页码
         size: 15, // 每页显示条数
-        supplierNo: "",
+        supplierNo: [],
         keyword: "",
         status: "",
       },
@@ -266,12 +287,6 @@ export default {
     this.searchList();
   },
   methods: {
-    async supplierChange(e) {
-      this.parmValue.page = 1;
-      this.parmValue.supplierNo = e;
-      await this.searchList();
-    },
-
     restSearch() {
       // 表格 - 分页
       this.pageInfo = {
@@ -279,10 +294,13 @@ export default {
         curr: 1,
         total: 0,
       };
-      this.parmValue.page = 1;
-      this.parmValue.size = 15;
-      this.parmValue.keyword = "";
-      this.parmValue.status = "";
+      this.parmValue = {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        supplierNo: [],
+        keyword: "",
+        status: "",
+      };
       this.searchList();
     },
     openModal(id, isDetail) {
@@ -295,23 +313,19 @@ export default {
       this.sitem = this.parmValue.supplierNo;
       this.showModel = true;
     },
+    async supplierChange(e) {
+      const { code } = e;
+      this.parmValue.supplierNo = code ? [code] : [];
+      this.pageInfo.curr = 1;
+      this.parmValue.page = 1;
+      await this.searchList();
+    },
     openPasswordModal(id, isDetail) {
       this.passwordModel = true;
       this.passwordModelId = id;
       this.isPasswordDetail = isDetail;
     },
 
-    gotoEdit(row, type) {
-      const { status } = row;
-      if (type === "005" && status === "1") {
-        this.$message.warning("禁用后,才可以修改!");
-        return;
-      }
-      this.routeGoto("supplierAccountDetail", {
-        id: row.code,
-        type: "edit",
-      });
-    },
     /**
      * 启用/禁用
      * @param {String} id id
@@ -329,19 +343,19 @@ export default {
             id: id,
             status: status === "1" ? "0" : "1",
           };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
+          const { code, data, message } = await asyncRequest.status(model);
+          if (code === 0) {
             this.loading = false;
             this.$notify.success({
               title: "状态修改成功!",
               message: "",
             });
             await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
+          } else if (code >= 100 && code <= 104) {
             await this.logout();
           } else {
             this.loading = false;
-            this.$message.warning(res.message);
+            this.$message.warning(message);
           }
         })
         .catch(() => {
@@ -358,17 +372,17 @@ export default {
           const model = {
             id: id,
           };
-          const res = await asyncRequest.delete(model);
-          if (res && res.code === 0) {
+          const { code, message } = await asyncRequest.delete(model);
+          if (code === 0) {
             this.$notify.success({
               title: "删除成功",
               message: "",
             });
             this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
+          } else if (code >= 100 && code <= 104) {
             await this.logout();
           } else {
-            this.$message.warning(res.message);
+            this.$message.warning(message);
           }
         })
         .catch(() => {
@@ -377,16 +391,11 @@ export default {
     },
     // 刷新表格
     async searchList() {
-      if (
-        (this.parmValue.start !== "" && this.parmValue.end === "") ||
-        (this.parmValue.start == "" && this.parmValue.end != "")
-      ) {
-        this.$message.warning("开始时间和结束时间不能为空");
-        return;
-      }
       this.loading = true;
-      const { code, data, message } = await asyncRequest.list(this.parmValue);
-      let scode = parseInt(code + "");
+      let model = JSON.parse(JSON.stringify(this.parmValue));
+      model.supplierNo = model.supplierNo.toString();
+      const { code, data, message } = await asyncRequest.list(model);
+      let scode = Number(code + "");
       if (scode === 0) {
         const { list, count } = data;
         this.tableData = list;