From b07c42031c6ba14d759ebbcc7e110750687074e6 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 27 三月 2024 14:55:21 +0800
Subject: [PATCH] 采购管理页面入库信息状态管理

---
 src/views/supplierManage/outsourceSupplier/components/VersionType.vue   |  168 ++++++++++
 src/views/supplierManage/outsourceSupplier/index.vue                    |  355 ++++++++++++++++++++++
 src/api/supplierManage/outsourceSupplier.js                             |   54 +++
 src/views/supplierManage/outsourceSupplier/components/addEnterprise.vue |  358 ++++++++++++++++++++++
 4 files changed, 935 insertions(+), 0 deletions(-)

diff --git a/src/api/supplierManage/outsourceSupplier.js b/src/api/supplierManage/outsourceSupplier.js
new file mode 100644
index 0000000..4b6a478
--- /dev/null
+++ b/src/api/supplierManage/outsourceSupplier.js
@@ -0,0 +1,54 @@
+import request from "@/common/untils/request.js"
+
+// 濮斿浼佷笟鏂板
+export const addEnterprise = (data) => {
+  return request({
+    url: "/api-s/v1/outsourcing/enterprise/add",
+    method: "post",
+    data
+  })
+}
+
+// 濮斿浼佷笟淇敼
+export const updateEnterprise = (data) => {
+  return request({
+    url: "/api-s/v1/outsourcing/enterprise/update",
+    method: "post",
+    data
+  })
+}
+
+// 濮斿浼佷笟鍒楄〃
+export const enterpriseList = (data) => {
+  return request({
+    url: "/api-s/v1/outsourcing/enterprise/list",
+    method: "get",
+    params: data
+  })
+}
+
+// 濮斿浼佷笟缁熻
+export const enterpriseOverview = () => {
+  return request({
+    url: "/api-s/v1/outsourcing/enterprise/overview",
+    method: "get"
+  })
+}
+
+// 娣诲姞澶栭儴鐢ㄦ埛璐﹀彿
+export const addOutsideUser = (data) => {
+  return request({
+    url: "/api/outsideUser/addUser",
+    method: "post",
+    data
+  })
+}
+
+// 鍚敤/绂佺敤澶栭儴鐢ㄦ埛
+export const editOutsideUser = (data) => {
+  return request({
+    url: "/api/outsideUser/editUser",
+    method: "post",
+    data
+  })
+}
diff --git a/src/views/supplierManage/outsourceSupplier/components/VersionType.vue b/src/views/supplierManage/outsourceSupplier/components/VersionType.vue
new file mode 100644
index 0000000..6ab8c5f
--- /dev/null
+++ b/src/views/supplierManage/outsourceSupplier/components/VersionType.vue
@@ -0,0 +1,168 @@
+<template>
+  <div class="versionType">
+    <!-- title + '缁勪欢' -->
+    <el-dialog
+      :title="'缂栬緫涓嬫媺妗�>' + title"
+      :visible.sync="isvisible"
+      :width="dialogWidth"
+      :before-close="handleClose"
+      append-to-body
+      custom-class="iframe-dialog"
+    >
+      <div class="drawerContent">
+        <el-table
+          v-if="isTableShow"
+          :header-cell-style="{ background: '#f1f3f8', color: '#000009' }"
+          ref="multipleTable"
+          :data="BomTableData"
+          tooltip-effect="dark"
+          height="460"
+        >
+          <el-table-column prop="unit" label="绫诲埆">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.name"></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="createdAt" label="璁句负榛樿">
+            <template slot-scope="scope">
+              <el-switch @change="switchChange(scope, scope.row.isDefault)" v-model="scope.row.isDefault"></el-switch>
+            </template>
+          </el-table-column>
+          <el-table-column label="鎿嶄綔" width="100">
+            <template slot-scope="scope">
+              <!-- <i class="el-icon-top" id="iconStyle"></i>
+           <i class="el-icon-bottom"  id="iconStyle"></i> -->
+              <i class="el-icon-delete" id="iconStyle" @click="handleDelete(scope.row.id)"></i>
+            </template>
+          </el-table-column>
+        </el-table>
+        <el-button @click="handleAdd()" type="text" class="margin_top_15px margin_left_20px">鏂板涓嬫媺妗�</el-button>
+      </div>
+      <div slot="footer">
+        <!-- <el-button
+          @click="handleAdd()"
+          style="margin-left: 16px; color: #fff; background-color: #ee790c"
+          >鏂板</el-button
+        > -->
+        <el-button @click="handleClose">鍙栨秷</el-button
+        ><el-button
+          type="primary"
+          @click="handleConfirmSave()"
+          style="margin-left: 16px; color: #fff; background-color: #2a78fb"
+          >纭畾</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "VersionType",
+  mixins: [],
+  components: {},
+  props: {
+    title: {
+      type: String,
+      default: "鐗堟湰绫诲瀷"
+    },
+    editRow: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    workList: {
+      type: Array
+    }
+  },
+  computed: {},
+  data() {
+    return {
+      dialogWidth: "30%",
+      isvisible: false,
+      isTableShow: true,
+      BomTableData: [1]
+    }
+  },
+  created() {},
+  watch: {
+    editDialogVisible(newVal) {
+      if (newVal) {
+        this.BomTableData = this.workList
+      }
+    },
+    workList(newVal) {
+      console.log(newVal)
+      this.BomTableData = this.workList
+    }
+  },
+  mounted() {},
+  methods: {
+    handleAdd() {
+      this.BomTableData.push({ name: "", isDefault: false })
+    },
+    handleDelete(id) {
+      this.BomTableData = this.BomTableData.filter((i) => {
+        return i.id != id
+      })
+    },
+
+    switchChange(scope, val) {
+      let arr = []
+      for (let i in this.BomTableData) {
+        if (this.BomTableData[i].isDefault) {
+          arr.push(i)
+        }
+      }
+      if (arr.length > 1) {
+        this.$message({
+          message: "鍙兘璁句竴涓负榛樿",
+          type: "warning"
+        })
+        scope.row.isDefault = !val
+      }
+    },
+    handleConfirmSave() {
+      let arr = []
+      for (let i in this.BomTableData) {
+        if (this.BomTableData[i].isDefault) {
+          arr.push(i)
+        }
+      }
+      if (arr.length > 1) {
+        this.$message({
+          message: "鍙兘璁句竴涓负榛樿",
+          type: "warning"
+        })
+      } else {
+        this.$emit("handleConfirmSave", this.BomTableData)
+        this.isvisible = false
+      }
+    },
+    handleClose() {
+      this.isvisible = false
+    }
+  }
+}
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style lang="scss" scoped>
+::v-deep {
+  .iframe-dialog .el-dialog__body {
+  }
+  .el-dialog__footer {
+    height: 55px;
+    line-height: 55px;
+    background-color: #f5f5f5;
+    padding: 0px 20px 0;
+    text-align: right;
+    box-sizing: border-box;
+    border-top: 1px solid #dadee5;
+  }
+}
+::v-deep .el-dialog__body {
+  padding-bottom: 10px !important;
+}
+</style>
diff --git a/src/views/supplierManage/outsourceSupplier/components/addEnterprise.vue b/src/views/supplierManage/outsourceSupplier/components/addEnterprise.vue
new file mode 100644
index 0000000..95e9958
--- /dev/null
+++ b/src/views/supplierManage/outsourceSupplier/components/addEnterprise.vue
@@ -0,0 +1,358 @@
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :visible.sync="islook"
+    width="35rem"
+    class="add-event-dialog"
+    @close="shutdown"
+  >
+    <div slot="title" class="tac drawerHeader">
+      <span>{{ titleName }}浼佷笟</span>
+    </div>
+    <div class="dialog-content-box">
+      <el-form ref="form" :rules="rules" :model="form" label-width="100px" label-position="left">
+        <el-form-item label="浼佷笟缂栫爜" prop="number">
+          <span v-if="editRow.look == 'look'">{{ form.number }}</span>
+          <el-input v-else v-model="form.number" clearable placeholder="璇疯緭鍏�"></el-input>
+        </el-form-item>
+        <el-form-item label="浼佷笟鍚嶇О" prop="name">
+          <span v-if="editRow.look == 'look'">{{ form.name }}</span>
+          <el-input v-else v-model="form.name" clearable placeholder="璇疯緭鍏�"></el-input>
+        </el-form-item>
+        <el-form-item label="浼佷笟绫诲瀷" prop="enterpriseType">
+          <span v-if="editRow.look == 'look'">{{ form.enterpriseType }}</span>
+          <el-select v-model="form.enterpriseType" placeholder="浼佷笟绫诲瀷" filterable style="width: calc(100% - 30px)">
+            <el-option v-for="ele in enterpriseTypeList" :key="ele.id" :label="ele.name" :value="ele.name"></el-option>
+          </el-select>
+          <i
+            class="el-icon-setting margin_left_10px cursor_pointer"
+            style="font-size: 20px; color: gray"
+            @click="handleCommonShow(5)"
+          ></i>
+        </el-form-item>
+        <el-form-item label="鑱旂郴浜�" prop="contact">
+          <span v-if="editRow.look == 'look'">{{ form.contact }}</span>
+          <el-input v-else v-model="form.contact" clearable placeholder="璇疯緭鍏�"></el-input>
+        </el-form-item>
+        <el-form-item label="鑱旂郴鏂瑰紡" prop="tel">
+          <span v-if="editRow.look == 'look'">{{ form.tel }}</span>
+          <el-input
+            v-else
+            v-model="form.tel"
+            clearable
+            placeholder="璇疯緭鍏�"
+            :disabled="titleName == '缂栬緫' ? true : false"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="鐧诲綍瀵嗙爜" prop="password">
+          <span v-if="editRow.look == 'look'">{{ form.password }}</span>
+          <div v-else class="login-password-box">
+            <el-input
+              v-model="form.password"
+              placeholder="璇疯緭鍏ョ櫥褰曞瘑鐮�"
+              :auto-complete="'new-password'"
+              type="password"
+              :disabled="titleName == '缂栬緫' ? true : false"
+              show-password
+            ></el-input>
+            <el-button v-if="titleName !== '缂栬緫'" type="text" style="margin-left: 5px" @click="generateRandomNumber"
+              >鐢熸垚闅忔満瀵嗙爜</el-button
+            >
+          </div>
+        </el-form-item>
+        <el-form-item label="淇$敤绛夌骇" prop="creditGrade">
+          <span v-if="editRow.look == 'look'">{{ form.creditGrade }}</span>
+          <el-select
+            v-else
+            v-model="form.creditGrade"
+            clearable
+            placeholder="璇烽�夋嫨"
+            filterable
+            style="width: calc(100% - 30px)"
+          >
+            <el-option v-for="item in creditGradeList" :key="item.id" :label="item.name" :value="item.name">
+            </el-option>
+          </el-select>
+          <i
+            class="el-icon-setting margin_left_10px cursor_pointer"
+            style="font-size: 20px; color: gray"
+            @click="handleCommonShow(6)"
+          ></i>
+        </el-form-item>
+        <el-form-item label="璇︾粏鍦板潃" prop="address">
+          <span v-if="editRow.look == 'look'">{{ form.address }}</span>
+          <el-input v-else v-model="form.address" clearable placeholder="璇疯緭鍏�"></el-input>
+        </el-form-item>
+        <el-form-item label="渚涜揣鑳藉姏" prop="supplyCapacity">
+          <span v-if="editRow.look == 'look'">{{ form.supplyCapacity }}</span>
+          <el-input v-else v-model="form.supplyCapacity" clearable placeholder="璇疯緭鍏�"></el-input>
+        </el-form-item>
+        <el-form-item label="缁勭粐鏈烘瀯浠g爜" prop="organizationCode">
+          <span v-if="editRow.look == 'look'">{{ form.organizationCode }}</span>
+          <el-input v-else v-model="form.organizationCode" clearable placeholder="璇疯緭鍏�"></el-input>
+        </el-form-item>
+        <el-form-item label="渚涜揣鑼冨洿" prop="supplyRange">
+          <span v-if="editRow.look == 'look'">{{ form.supplyRange }}</span>
+          <el-select
+            v-else
+            v-model="form.supplyRange"
+            clearable
+            placeholder="璇烽�夋嫨"
+            filterable
+            style="width: calc(100% - 30px)"
+          >
+            <el-option v-for="item in supplyRangeList" :key="item.id" :label="item.name" :value="item.name">
+            </el-option>
+          </el-select>
+          <i
+            class="el-icon-setting margin_left_10px cursor_pointer"
+            style="font-size: 20px; color: gray"
+            @click="handleCommonShow(7)"
+          ></i>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div slot="footer" class="dialog-footer tac">
+      <el-button @click="shutdown">鍙栨秷</el-button>
+      <el-button type="primary" @click="onSubmit(form)">纭畾</el-button>
+    </div>
+    <!-- 浼佷笟绫诲瀷 -->
+    <VersionType
+      ref="editDialog"
+      @sucessSet="handleGetList"
+      @handleConfirmSave="handleConfirmSave"
+      :workList="editDropdownList"
+      :title="editDropdownTitle"
+    ></VersionType>
+  </el-dialog>
+</template>
+
+<script>
+import { addEnterprise, updateEnterprise, addOutsideUser } from "@/api/supplierManage/outsourceSupplier"
+import { getMiniDictList, saveMiniDict } from "@/api/common/other" // 璐ㄦ鏂瑰紡
+import VersionType from "@/views/supplierManage/outsourceSupplier/components/VersionType"
+export default {
+  components: {
+    VersionType
+  },
+  props: {
+    titleName: {
+      type: String,
+      default: "鏂板"
+    },
+    editRow: {
+      type: [Object],
+      default: () => {
+        return {}
+      }
+    },
+    showList: {
+      type: [Array]
+    }
+  },
+  data() {
+    return {
+      islook: false,
+      form: {
+        number: "",
+        name: "",
+        enterpriseType: "",
+        contact: "",
+        tel: "",
+        creditGrade: "",
+        address: "",
+        supplyCapacity: "",
+        organizationCode: "",
+        supplyRange: "",
+        status: 0,
+        password: "123456"
+      },
+      rules: {
+        number: [
+          { required: true, message: "璇峰~鍐欎紒涓氱紪鐮�", trigger: "blur" } // 浼佷笟缂栫爜
+        ],
+        name: [
+          { required: true, message: "璇峰~鍐欎紒涓氬悕绉�", trigger: "blur" } // 浼佷笟鍚嶇О
+        ],
+        enterpriseType: [
+          { required: true, message: "璇烽�夋嫨浼佷笟绫诲瀷", trigger: "change" } // 浼佷笟绫诲瀷
+        ],
+        tel: [
+          { required: true, message: "璇峰~鍐欒仈绯绘柟寮�", trigger: "blur" } // 鑱旂郴鏂瑰紡
+        ],
+        password: [
+          { required: true, message: "璇峰~鍐欑櫥褰曞瘑鐮�", trigger: "blur" } // 鐧诲綍瀵嗙爜
+        ]
+      },
+      editDropdownList: [],
+      enterpriseTypeList: [], // 浼佷笟绫诲瀷鍒楄〃
+      creditGradeList: [], // 淇$敤绛夌骇
+      supplyRangeList: [], // 渚涜揣鑼冨洿
+      currentType: 0,
+      editDropdownTitle: ""
+    }
+  },
+  mounted() {
+    this.handleGetList(5)
+    this.handleGetList(6)
+    this.handleGetList(7)
+  },
+  watch: {
+    editRow(val) {
+      if (val.id && this.islook) {
+        this.initFormData(val)
+      } else {
+        this.$nextTick(() => {
+          this.$refs.form.resetFields()
+        })
+      }
+    },
+    islook(val) {
+      if (val) {
+        this.form = {
+          number: "",
+          name: "",
+          enterpriseType: "",
+          contact: "",
+          tel: "",
+          password: "123456",
+          creditGrade: "",
+          address: "",
+          supplyCapacity: "",
+          organizationCode: "",
+          supplyRange: "",
+          status: 0
+        }
+        if (this.editRow && this.editRow.id) {
+          this.initFormData(this.editRow)
+        } else {
+          this.$nextTick(() => {
+            this.$refs.form.resetFields()
+          })
+        }
+      }
+    }
+  },
+  methods: {
+    addPreProduction() {
+      this.$refs.add.materialVisible = true
+    },
+    initFormData(row) {
+      if (row.id) {
+        this.form = JSON.parse(JSON.stringify(row))
+        // if (this.form.takerId && this.form.takerName) {
+        //   this.form.takerObj = this.form.takerId + "&" + this.form.takerName;
+        // }
+      }
+    },
+    onSubmit() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          let params = JSON.parse(JSON.stringify(this.form))
+          // params.takerId = params.takerObj.split("&")[0];
+          // params.takerName = params.takerObj.split("&")[1];
+          if (this.editRow && this.editRow.id) {
+            params.id = this.editRow.id
+            updateEnterprise(params).then((res) => {
+              if (res.code == 200) {
+                this.$message.success("缂栬緫鎴愬姛锛�")
+                this.$emit("shutdown", this.form)
+                this.shutdown()
+              }
+            })
+          } else {
+            addEnterprise(params).then((res) => {
+              if (res.code == 200) {
+                console.log(res, "5555")
+                this.addOutsideUser(res.data)
+              }
+            })
+          }
+        }
+      })
+    },
+    // 娣诲姞澶栭儴鐢ㄦ埛
+    addOutsideUser(data) {
+      addOutsideUser({
+        companyId: data.id,
+        companyName: data.name,
+        companyNumber: data.number,
+        passWord: this.form.password,
+        userName: data.tel
+      }).then((res) => {
+        console.log(res)
+        if (res.code == 200) {
+          this.$message.success("娣诲姞鎴愬姛锛�")
+          this.$emit("shutdown", this.form)
+          this.shutdown()
+        }
+      })
+    },
+    // 浼佷笟绫诲瀷?淇$敤绛夌骇/渚涜揣鑼冨洿鐐瑰嚮
+    handleCommonShow(type) {
+      this.currentType = type
+      this.editDropdownTitle = type == 5 ? "浼佷笟绫诲瀷" : type == 6 ? "淇$敤绛夌骇" : type == 7 ? "渚涜揣鑼冨洿" : ""
+      this.editDropdownList = []
+      this.handleGetList(type)
+      this.$refs.editDialog.isvisible = true
+    },
+    // 鑾峰彇浼佷笟绫诲瀷?淇$敤绛夌骇/渚涜揣鑼冨洿
+    handleGetList(type) {
+      this.currentType = type
+      getMiniDictList({ type: type }).then((res) => {
+        this.editDropdownList = res.data
+        if (type == 5) {
+          this.enterpriseTypeList = res.data
+        } else if (type == 6) {
+          this.creditGradeList = res.data
+        } else if (type == 7) {
+          this.supplyRangeList = res.data
+        }
+      })
+    },
+    // 淇濆瓨浼佷笟绫诲瀷?淇$敤绛夌骇/渚涜揣鑼冨洿
+    handleConfirmSave(data) {
+      saveMiniDict({ list: data, type: this.currentType }).then((res) => {
+        if (res.code == 200) {
+          this.$message({
+            message: "鎿嶄綔鎴愬姛锛�",
+            type: "success"
+          })
+          this.$refs.editDialog.isvisible = false
+          this.handleGetList(this.currentType)
+        }
+      })
+    },
+    shutdown() {
+      this.$refs.form.resetFields()
+      this.islook = false
+    },
+    // 闅忔満鐢熸垚鍏綅鏁板瘑鐮�
+    generateRandomNumber() {
+      let passwordStr = Math.floor(100000 + Math.random() * 900000)
+      console.log(passwordStr)
+      this.$set(this.form, "password", passwordStr)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.dialog-content-box {
+  padding: 0px 30px;
+  //   overflow-y: auto;
+  //   .el-form {
+  //     overflow: hidden;
+  //   }
+  .login-password-box {
+    display: flex;
+  }
+}
+
+::v-deep {
+  .el-tabs__content {
+    height: calc(100% - 55px);
+    overflow-y: auto;
+  }
+}
+</style>
diff --git a/src/views/supplierManage/outsourceSupplier/index.vue b/src/views/supplierManage/outsourceSupplier/index.vue
new file mode 100644
index 0000000..bb006b4
--- /dev/null
+++ b/src/views/supplierManage/outsourceSupplier/index.vue
@@ -0,0 +1,355 @@
+<template>
+  <d2-container>
+    <template slot="header">
+      <div class="top">
+        <SearchCommonView
+          :add-title="'鏂板浼佷笟'"
+          :total-object="totalObject"
+          :other-options="otherOptions"
+          :placeholder="'璇疯緭鍏ュ悕绉�'"
+          @addCommonClick="addEnterpriseClick"
+          @searchClick="getEnterpriseList"
+        />
+      </div>
+    </template>
+    <div class="content">
+      <div class="content-top">
+        <TableCommonView ref="tableListRef" :table-list="tableList" @selTableCol="selTableCol">
+          <template slot="tableButton">
+            <el-table-column label="鎿嶄綔" width="160" fixed="right">
+              <template slot-scope="scope">
+                <el-button v-if="scope.row.status == 1" type="text" size="small" @click="statusModifyClick(scope.row)"
+                  >鍋滅敤</el-button
+                >
+                <el-button v-else type="text" size="small" @click="statusModifyClick(scope.row)">鍚敤</el-button>
+                <el-button @click="editClick(scope.row)" type="text" size="small">缂栬緫</el-button>
+              </template>
+            </el-table-column>
+          </template>
+        </TableCommonView>
+      </div>
+      <div class="btn-pager">
+        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
+      </div>
+    </div>
+    <!-- <div class="overSpread" v-show="isopen || isCreateShop"></div> -->
+    <!-- 娣诲姞/缂栬緫澶囦欢 -->
+    <AddEnterprise ref="add" :showList="showList" :titleName="titleName" :editRow="editRow" @shutdown="shutdown" />
+  </d2-container>
+</template>
+
+<script>
+import {
+  enterpriseList,
+  updateEnterprise,
+  enterpriseOverview,
+  editOutsideUser
+} from "@/api/supplierManage/outsourceSupplier"
+import AddEnterprise from "@/views/supplierManage/outsourceSupplier/components/addEnterprise"
+import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+export default {
+  name: "outsourceManage",
+  mixins: [pageMixin],
+  components: {
+    AddEnterprise
+  },
+  beforeMount() {
+    this.getData()
+  },
+  computed: {},
+  data() {
+    return {
+      deviceDataList: [],
+      searchParam: {
+        keyword: "",
+        page: 1,
+        pageSize: 15
+      },
+      total: 0,
+      isopen: false,
+      titleName: "鏂板",
+      editRow: {},
+      selectRow: {},
+      isCreateShop: false,
+      more: false,
+      totalObject: {
+        value: 0,
+        label: "浼佷笟鎬婚噺"
+      },
+      otherOptions: [
+        {
+          value: 0,
+          label: "鍋滅敤",
+          status: "error"
+        },
+        {
+          value: 0,
+          label: "鍚敤",
+          status: "success"
+        }
+      ],
+      tableList: {},
+      showcol: [
+        "浼佷笟缂栧彿",
+        "鍚嶇О",
+        "绫诲瀷",
+        "鑱旂郴浜�",
+        "鑱旂郴鐢佃瘽",
+        "淇$敤绛夌骇",
+        "璇︾粏鍦板潃",
+        "渚涜揣鑳藉姏",
+        "缁勭粐鏈烘瀯浠g爜",
+        "渚涜揣鑼冨洿",
+        "娣诲姞鏃堕棿",
+        "鐘舵��"
+      ],
+      showList: []
+    }
+  },
+  mounted() {
+    this.setTable()
+  },
+
+  methods: {
+    setTable() {
+      this.tableList = {
+        tableInfomation: [],
+        selectIndex: true,
+        showcol: this.showcol,
+        allcol: [],
+        tableColumn: this.setTableColumn(this.showcol)
+      }
+      let allcol = []
+      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
+        if (!this.tableList.tableColumn[i].default) {
+          const label = this.tableList.tableColumn[i].label
+          allcol.push(label)
+        }
+      }
+      this.tableList.allcol = allcol
+    },
+    setTableColumn(showcol) {
+      let tableColumn = [
+        {
+          label: "浼佷笟缂栧彿",
+          prop: "number",
+          isShowColumn: true,
+          default: true
+        },
+        {
+          label: "鍚嶇О",
+          prop: "name",
+          isShowColumn: showcol.includes("鍚嶇О"),
+          default: false
+        },
+        {
+          label: "绫诲瀷",
+          prop: "enterpriseType",
+          isShowColumn: showcol.includes("绫诲瀷"),
+          default: false
+        },
+        {
+          label: "鑱旂郴浜�",
+          prop: "contact",
+          isShowColumn: showcol.includes("鑱旂郴浜�"),
+          default: false
+        },
+        {
+          label: "鑱旂郴鐢佃瘽",
+          prop: "tel",
+          isShowColumn: showcol.includes("鑱旂郴鐢佃瘽"),
+          default: false
+        },
+        {
+          label: "淇$敤绛夌骇",
+          prop: "creditGrade",
+          isShowColumn: showcol.includes("淇$敤绛夌骇"),
+          default: false
+        },
+        {
+          label: "璇︾粏鍦板潃",
+          prop: "address",
+          isShowColumn: showcol.includes("璇︾粏鍦板潃"),
+          default: false
+        },
+        {
+          label: "渚涜揣鑳藉姏",
+          prop: "supplyCapacity",
+          isShowColumn: showcol.includes("渚涜揣鑳藉姏"),
+          default: false
+        },
+        {
+          label: "缁勭粐鏈烘瀯浠g爜",
+          prop: "organizationCode",
+          isShowColumn: showcol.includes("缁勭粐鏈烘瀯浠g爜"),
+          default: false
+        },
+        {
+          label: "渚涜揣鑼冨洿",
+          prop: "supplyRange",
+          isShowColumn: showcol.includes("渚涜揣鑼冨洿"),
+          default: false
+        },
+        {
+          label: "娣诲姞鏃堕棿",
+          prop: "createdAt",
+          width: "160",
+          isShowColumn: showcol.includes("娣诲姞鏃堕棿"),
+          default: false
+        },
+        {
+          label: "鐘舵��",
+          prop: "status",
+          isShowColumn: showcol.includes("鐘舵��"),
+          default: false,
+          isCallMethod: true,
+          getCallMethod: this.getStatus
+        }
+      ]
+      return tableColumn
+    },
+    selTableCol(val) {
+      this.showcol = val
+      this.tableList.tableColumn = this.setTableColumn(val)
+    },
+    overview() {
+      enterpriseOverview().then((reply) => {
+        this.totalObject.value = reply.data.total || 0
+        this.otherOptions.map((item) => {
+          if (item.label === "鍋滅敤") {
+            item.value = reply.data.close
+          } else if (item.label === "鍚敤") {
+            item.value = reply.data.open
+          }
+        })
+      })
+    },
+    //鏌ヨ澶囦欢鍒楄〃
+    async getData() {
+      this.searchParam.page = this.pagerOptions.currPage
+      this.searchParam.pageSize = this.pagerOptions.pageSize
+      let rsp = await enterpriseList(this.searchParam)
+      let list = rsp
+      console.log(list)
+      if (list && list.code == 200) {
+        // this.deviceDataList = list.data.data;
+        // this.total = list.data.total;
+        this.tableList.tableInfomation = list.data
+        this.pagerOptions.totalCount = list.total
+        this.overview()
+      }
+    },
+    // 鎼滅储瑙﹀彂
+    async getEnterpriseList(val) {
+      this.searchParam.keyword = val
+      this.pagerOptions.currPage = 1
+      this.getData()
+    },
+    // 鏂板浼佷笟
+    addEnterpriseClick() {
+      this.titleName = "鏂板"
+      this.editRow = {}
+      this.$refs.add.islook = true
+    },
+    // 缂栬緫
+    editClick(val) {
+      let params = JSON.parse(JSON.stringify(val))
+      this.titleName = "缂栬緫"
+      this.editRow = { ...params, password: "000000" }
+      this.$refs.add.islook = true
+    },
+    // 鍚敤/鍋滅敤
+    statusModifyClick(row) {
+      let tipStr = row.status == 1 ? "鏄惁鍋滅敤璇ヤ紒涓氾紵" : "鏄惁鍚敤璇ヤ紒涓�"
+      this.$confirm(tipStr, "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      }).then(() => {
+        let params = JSON.parse(JSON.stringify(row))
+        params.status = row.status == 1 ? 2 : 1
+        updateEnterprise(params)
+          .then((reply) => {
+            if (reply && reply.code == 200) {
+              this.editOutsideUser(row)
+              // this.getData();
+              // this.$message.success(row.status == 1 ? "鍋滅敤鎴愬姛" : "鍚敤鎴愬姛");
+            } else {
+              this.$message.error(row.status == 1 ? "鍋滅敤澶辫触" : "鍚敤澶辫触")
+            }
+          })
+          .catch(() => {})
+      })
+    },
+    // 鍚敤鍋滅敤澶栭儴鐢ㄦ埛
+    editOutsideUser(row) {
+      editOutsideUser({
+        enable: row.status == 1 ? false : true,
+        username: row.tel
+      }).then((res) => {
+        if (res && res.code == 200) {
+          this.getData()
+          this.$message.success(row.status == 1 ? "鍋滅敤鎴愬姛" : "鍚敤鎴愬姛")
+        }
+      })
+    },
+    //瀛愮粍浠朵紶閫掑弬鏁版帶鍒跺脊绐�
+    shutdown(val) {
+      this.$refs.add.islook = val
+      this.getData()
+    },
+    // 鑾峰彇鐘舵��
+    getStatus(val) {
+      return val == 0 ? "鏂板缓" : val == 1 ? "鍚敤" : val == 2 ? "鍋滅敤" : "--"
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.top {
+  width: 100%;
+  height: 61px;
+  display: flex;
+  align-items: center;
+  .fon_weight {
+    font-size: 28px;
+    height: 32px;
+  }
+  .top_right_bottom {
+    font-size: 14px;
+    line-height: 20px;
+    color: #000;
+    opacity: 0.6;
+    margin-top: 9px;
+    font-family: "PingFangSC-Medium," sans-serif;
+  }
+}
+.el-button {
+  font-family: "PingFangSC";
+}
+.content {
+  width: 100%;
+  height: calc(100% - 30px);
+  background: #fff;
+  border-radius: 12px;
+  box-sizing: border-box;
+  .content-top {
+    height: calc(100% - 60px);
+  }
+}
+::v-deep {
+  .el-table {
+    height: auto !important;
+    .el-table--fit {
+      height: 90%;
+    }
+    .onSelect {
+      background: #ebf2ff;
+    }
+  }
+  .el-table {
+    height: 100% !important;
+  }
+}
+</style>

--
Gitblit v1.8.0