戴艳蓉 3 年之前
父節點
當前提交
6ddb14bde1
共有 2 個文件被更改,包括 377 次插入453 次删除
  1. 1 1
      src/apis/service/serviceParam/Invoicing/index.js
  2. 376 452
      src/views/serviceParam/Invoicing/index.vue

+ 1 - 1
src/apis/service/serviceParam/Invoicing/index.js

@@ -7,7 +7,7 @@ export default {
   // 删除
   delete: (data, params) => http(api + "gooddel", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "customerlist", data, "post", params),
+  list: (data, params) => http(api + "titlelist", data, "post", params),
   // 详情
   detail: (data, params) => http(api + "customerinfo", data, "post", params),
   // 更改

+ 376 - 452
src/views/serviceParam/Invoicing/index.vue

@@ -3,384 +3,242 @@
     <div
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
-      <el-row :gutter="10">
-        <el-col :span="24" style="padding: 0 0 18px 0">
-          <el-col :span="3">
-            <el-select
-              v-model="parmValue.status"
-              filterable
-              clearable
-              :size="searchSize"
-              placeholder="账号状态"
-              style="width: 100%"
-            >
-              <el-option
-                v-for="item in statusList"
-                :key="'status' + item.code"
-                :label="item.name"
-                :value="item.code"
-              />
-            </el-select>
-          </el-col>
-
-          <el-col :span="8">
-            <ul class="el-list-select-input clearfix">
-              <li>
-                <el-select
-                  v-model="select"
-                  :size="searchSize"
-                  placeholder="查询类型"
-                >
-                  <el-option label="客户姓名" value="1"></el-option>
-                  <el-option label="公司名称" value="2"></el-option>
-                  <el-option label="业务员姓名" value="3"></el-option>
-                </el-select>
-              </li>
-              <li>
-                <el-input
-                  :size="searchSize"
-                  v-model="input"
-                  :maxlength="40"
-                  placeholder="关键字"
-                >
-                  <el-button
-                    slot="append"
-                    @click="searchList"
-                    icon="el-icon-search"
-                  ></el-button>
-                </el-input>
-              </li>
-            </ul>
-          </el-col>
-          <el-col :span="13" style="float: right">
-            <el-button
-              type="warning"
-              v-if="powers.some((item) => item == '024')"
-              :size="searchSize"
-              @click="restSearch"
-            >
-              重置
-            </el-button>
-            <el-button
-              type="primary"
-              v-if="powers.some((item) => item == '002')"
-              :size="searchSize"
-              style="float: right; margin-left: 5px"
-              @click="searchList"
-            >
-              刷新
-            </el-button>
-            <el-button
-              v-if="powers.some((item) => item == '003')"
-              :size="searchSize"
-              type="success"
-              style="float: right"
-              @click="openModal('add', false, false, true)"
-            >
-              添加
-            </el-button>
-          </el-col>
-        </el-col>
-      </el-row>
-
-      <el-table
-        :data="tableData"
-        style="width: 100%"
-        row-key="id"
-        border
+      <ex-table
         v-loading="loading"
+        v-if="
+          powers && powers.length > 0 && powers.some((item) => item == '001')
+        "
+        :table="table"
+        :data="tableData"
+        :columns="columns"
+        :page="pageInfo"
         :size="size"
+        @page-curr-change="handlePageChange"
+        @page-size-change="handleSizeChange"
+        @screen-reset="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+        @screen-submit="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
       >
-        <el-table-column
-          prop="company"
-          label="企业名称"
-          show-overflow-tooltip
-          align="center"
-        >
-        </el-table-column>
-        <el-table-column
-          prop="name"
-          label="真实姓名"
-          show-overflow-tooltip
-          align="center"
-        >
-        </el-table-column>
-        <!-- <el-table-column
-          prop="mobile"
-          label="手机号"
-          show-overflow-tooltip
-          align="center"
-        >
-        </el-table-column>
-        <el-table-column
-          prop="email"
-          label="邮箱"
-          show-overflow-tooltip
-          align="center"
-        >
-        </el-table-column> -->
-        <el-table-column
-          prop="admin_name"
-          label="业务员"
-          show-overflow-tooltip
-          align="center"
-        >
-        </el-table-column>
-        <el-table-column label="审核状态" show-overflow-tooltip align="center">
-          <template slot-scope="scope">
-            <el-tag
-              :size="tablebtnSize"
-              v-if="scope.row.ex_status === '0'"
-              :class="{
-                'hover-tag':
-                  scope.row.status === '0' &&
-                  powers.some((item) => item == '010'),
-              }"
-              :type="'warning'"
-              @click="
-                openModal(
-                  scope.row.id,
-                  false,
-                  true,
-                  scope.row.status === '0' &&
-                    powers.some((item) => item == '010')
-                )
-              "
-            >
-              <i
-                class="el-icon-thumb"
-                v-if="
-                  scope.row.status === '0' &&
-                  powers.some((item) => item == '010')
-                "
-                style="margin-right: 1px"
-              ></i>
-              {{ scope.row.ex_status_cn }}
-            </el-tag>
-            <el-tag
-              :size="tablebtnSize"
-              v-else-if="scope.row.ex_status === '1'"
-              :type="'success'"
-            >
-              {{ scope.row.ex_status_cn }}
-            </el-tag>
-            <el-tag
-              :size="tablebtnSize"
-              v-else-if="scope.row.ex_status === '2'"
-              :class="{
-                'hover-tag':
-                  scope.row.status === '0' &&
-                  powers.some((item) => item == '009'),
-              }"
-              :type="'danger'"
-              @click="
-                again(
-                  scope.row.id,
-                  scope.row.status === '0' &&
-                    powers.some((item) => item == '009')
-                )
-              "
-            >
-              <i
-                class="el-icon-thumb"
-                v-if="
-                  scope.row.status === '0' &&
-                  powers.some((item) => item == '009')
-                "
-                style="margin-right: 1px"
-              ></i>
-              {{ scope.row.ex_status_cn }}
-            </el-tag>
-            <el-tag
-              :size="tablebtnSize"
-              v-else-if="scope.row.ex_status === '3'"
-              :class="{
-                'hover-tag':
-                  scope.row.status === '0' &&
-                  powers.some((item) => item == '009'),
-              }"
-              :type="'info'"
-              @click="
-                again(
-                  scope.row.id,
-                  scope.row.status === '0' &&
-                    powers.some((item) => item == '009')
-                )
-              "
-            >
-              <i
-                class="el-icon-thumb"
-                v-if="
-                  scope.row.status === '0' &&
-                  powers.some((item) => item == '009')
-                "
-                style="margin-right: 1px"
-              ></i>
-              {{ scope.row.ex_status_cn }}
-            </el-tag>
-          </template>
-        </el-table-column>
-        <el-table-column label="状态" show-overflow-tooltip align="center">
-          <template slot-scope="scope">
-            <el-tag
-              v-if="scope.row.status === '1'"
-              type="success"
-              :class="{ 'hover-tag': powers.some((item) => item == '004') }"
-              :size="tablebtnSize"
-              @click="
-                statusConfirm(
-                  scope.row.id,
-                  scope.row.status,
-                  scope.row.ex_status,
-                  powers.some((item) => item == '004')
-                )
-              "
-            >
-              <i
-                class="el-icon-thumb"
-                v-if="powers.some((item) => item == '004')"
-                style="margin-right: 1px"
-              ></i>
-              启用</el-tag
-            >
-            <el-tag
-              v-else
-              :class="{ 'hover-tag': powers.some((item) => item == '004') }"
-              :size="tablebtnSize"
-              type="warning"
-              @click="
-                statusConfirm(
-                  scope.row.id,
-                  scope.row.status,
-                  scope.row.ex_status,
-                  powers.some((item) => item == '004')
-                )
-              "
-            >
-              <i
-                class="el-icon-thumb"
-                v-if="powers.some((item) => item == '004')"
-                style="margin-right: 1px"
-              ></i>
-              禁用</el-tag
-            >
-          </template>
-        </el-table-column>
-        <el-table-column
-          prop="addtime"
-          label="创建时间"
-          show-overflow-tooltip
-          align="center"
-        ></el-table-column>
-        <el-table-column fixed="right" label="操作" align="center">
-          <template slot-scope="scope">
-            <el-link
-              v-if="
-                (scope.row.status === '0' &&
-                  scope.row.ex_status === '3' &&
-                  powers.some((item) => item == '005')) ||
-                (scope.row.status === '0' &&
-                  scope.row.ex_status === '2' &&
-                  powers.some((item) => item == '005'))
-              "
-              type="primary"
-              style="margin: 0 4px"
-              :underline="false"
-              :size="tablebtnSize"
-              @click="openModal(scope.row.id, false, false, true)"
-            >
-              修改
-            </el-link>
-            <!-- <el-link
-          type="primary"
-              style="margin: 0 4px"
-              :underline="false"
-              :size="tablebtnSize"
-            @click="deleteById(scope.row.id)"
+        <template #table-header="{}">
+          <div style="width: 100%">
+            <el-row style="padding: 0 0 0 80px">
+              <el-col :span="24">
+                <el-col :span="4" style="width: 120px">
+                  <el-select
+                    :size="searchSize"
+                    v-model="parmValue.status"
+                    filterable
+                    clearable
+                    placeholder="账号状态"
+                    style="width: 100%"
+                    @change="
+                      pageInfo.curr = 1;
+                      parmValue.page = 1;
+                      searchList();
+                    "
+                  >
+                    <el-option
+                      v-for="item in statusList"
+                      :key="'status' + item.code"
+                      :label="item.name"
+                      :value="item.code"
+                    />
+                  </el-select>
+                </el-col>
+                <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
+                  <el-input
+                    :size="searchSize"
+                    v-model="parmValue.name"
+                    :maxlength="40"
+                    placeholder="业务员姓名"
+                  />
+                </el-col>
+                <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
+                  <el-input
+                    :size="searchSize"
+                    v-model="parmValue.username"
+                    :maxlength="40"
+                    placeholder="手机号"
+                  />
+                </el-col>
+                <el-col :span="4" style="width: 54px">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    class="fr"
+                    icon="el-icon-search"
+                    @click="searchList"
+                /></el-col>
+                <el-col :span="4" style="width: 66px">
+                  <el-button
+                    type="warning"
+                    class="fr"
+                    :size="searchSize"
+                    @click="restSearch"
+                  >
+                    重置
+                  </el-button>
+                </el-col>
+                <el-col :span="3" style="width: 66px; float: right">
+                  <el-button
+                    :size="searchSize"
+                    type="primary"
+                    style="float: right; margin-left: 5px"
+                    @click="searchList"
+                  >
+                    刷新
+                  </el-button>
+                </el-col>
+                <el-col
+                  :span="3"
+                  style="width: 66px; float: right"
+                  v-if="powers.some((item) => item == '003')"
+                >
+                  <el-button
+                    :size="searchSize"
+                    type="success"
+                    style="float: right"
+                    @click="openModal('add', false)"
+                  >
+                    添加
+                  </el-button>
+                </el-col>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+
+        <template #depart_info="{ scope }">
+          <el-tag
+            style="margin: 0 3px 0 0"
+            :size="tablebtnSize"
+            type="''"
+            v-for="(ditem, dindex) in scope.row.depart_info"
+            :key="ditem + dindex"
           >
-            删除
-          </el-link>  -->
-            <el-link
-              v-if="powers.some((item) => item == '007')"
-              type="primary"
-              style="margin: 0 4px"
-              :underline="false"
-              :size="tablebtnSize"
-              @click="openModal(scope.row.id, true, false, true)"
+            <span
+              v-for="(cItem, cindex) in ditem"
+              :key="cItem + dindex + cindex"
             >
-              详情
-            </el-link>
-          </template>
-        </el-table-column>
-      </el-table>
-      <div
-        class="Pagination"
-        style="text-align: right; margin-top: 10px"
-        v-show="count > 0"
-      >
-        <el-pagination
-          :size="searchSize"
-          @size-change="handleSizeChange"
-          @current-change="handlePageChange"
-          :current-page="parmValue.page"
-          :page-sizes="[10, 15, 20, 30, 40]"
-          :page-size="parmValue.size"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="count"
-        ></el-pagination>
-      </div>
+              <span v-show="cindex > 0">/</span><span>{{ cItem }}</span>
+            </span>
+            {{ ditem.name }}</el-tag
+          >
+        </template>
+        <template #status="{ scope }">
+          <el-tag
+            :size="tablebtnSize"
+            :type="scope.row.status == '0' ? 'warning' : ''"
+            v-text="
+              (statusOptions.find((item) => item.id == scope.row.status) || {})
+                .label || '--'
+            "
+          ></el-tag>
+        </template>
+        <template #operation="{ scope }">
+          <el-tooltip
+            v-if="powers.some((item) => item == '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((item) => item == '007')"
+            effect="dark"
+            content="详情"
+            placement="top"
+          >
+            <i
+              class="el-icon-view tb-icon"
+              @click="openModal(scope.row.id, true, scope.row)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="powers.some((item) => item == '005')"
+            effect="dark"
+            content="修改"
+            placement="top"
+          >
+            <i
+              class="el-icon-edit tb-icon"
+              @click="openModal(scope.row.id, false, scope.row)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="
+              powers.some((item) => item == '004') && scope.row.status === '1'
+            "
+            effect="dark"
+            content="禁用"
+            placement="top"
+          >
+            <i
+              class="el-icon-video-pause tb-icon"
+              @click="statusConfirm(scope.row.id, scope.row.status)"
+            ></i>
+          </el-tooltip>
+          <el-tooltip
+            v-if="
+              powers.some((item) => item == '004') && scope.row.status === '0'
+            "
+            effect="dark"
+            content="启用"
+            placement="top"
+          >
+            <i
+              class="el-icon-video-play tb-icon"
+              @click="statusConfirm(scope.row.id, scope.row.status)"
+            ></i>
+          </el-tooltip>
+        </template>
+      </ex-table>
       <add-edit
-        :showModel="showModel"
         :id="modelId"
-        :isApproval="approval"
-        :isDetail="isDetail"
+        :sitem="sitem"
+        :show-model="showModel"
+        :is-detail="isDetail"
         @refresh="searchList"
         @cancel="showModel = false"
-      ></add-edit>
+      />
+
+      <reset-password
+        :id="passwordModelId"
+        :show-model="passwordModel"
+        :is-detail="isPasswordDetail"
+        @refresh="searchList"
+        @cancel="passwordModel = false"
+      />
     </div>
     <div v-else>
       <no-auth></no-auth>
     </div>
   </div>
 </template>
-   <script>
+<script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import asyncRequest from "@/apis/service/serviceParam/Invoicing";
 import addEdit from "./addEdit";
-import statusList from "@/assets/js/statusList";
 import { mapGetters } from "vuex";
+import resToken from "@/mixins/resToken";
 export default {
   name: "Invoicing",
-  data() {
-    return {
-      statusList: statusList,
-      approval: false,
-      loading: true,
-      showModel: false,
-      isDetail: false,
-      modelId: 0,
-      select: "1",
-      input: "",
-      parmValue: {
-        status: "",
-        staff: "", //客户姓名
-        name: "", // 公司名称
-        admin: "", //业务员姓名
-        type: "2",
-        page: 1, // 页码
-        size: 10, // 每页显示条数
-      },
-      count: 0, // 总条数
-      tableData: [],
-    };
-  },
-  mixins: [mixinPage],
-  mounted() {
-    this.searchList();
-  },
   components: {
     addEdit,
   },
+  mixins: [mixinPage, resToken],
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
@@ -395,146 +253,213 @@ export default {
       }
     },
   },
+  data() {
+    return {
+      sitem: null,
+      // 状态
+      statusOptions: [
+        { id: "0", label: "启用" },
+        { id: "1", label: "禁用" },
+      ],
+      statusList: [],
+      loading: false,
+      showModel: false,
+      isDetail: false,
+      modelId: 0,
+      parmValue: {
+        name: "", // 业务员名字
+        username: "", // 账号
+        status: "", //
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      },
+      tableData: [],
+      passwordModel: false,
+      passwordModelId: 0,
+      isPasswordDetail: false,
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: [
+        {
+          prop: "companyNo",
+          label: "客户编码",
+          width: "110px",
+        },
+        {
+          prop: "companyName",
+          label: "客户名称",
+          width: "110px",
+        },
+        {
+          prop: "invoice_code",
+          label: "纳税人识别号",
+          width: "110px",
+        },
+        {
+          prop: "invoice_title",
+          label: "发票抬头",
+          width: "110px",
+        },
+
+        {
+          prop: "mobile",
+          label: "联系电话",
+          width: "110px",
+        },
+        {
+          prop: "mobile",
+          label: "联系电话",
+          width: "110px",
+        },
+        {
+          prop: "mobile",
+          label: "联系电话",
+          width: "110px",
+        },
+        {
+          prop: "mobile",
+          label: "联系电话",
+          width: "110px",
+        },
+        {
+          prop: "status",
+          label: "状态",
+          _slot_: "status",
+          width: "70px",
+        },
+        {
+          prop: "addtime",
+          label: "创建时间",
+          width: "140px",
+        },
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          _noset_: true,
+          width: "140px",
+          _slot_: "operation",
+        },
+      ],
+    };
+  },
+  mounted() {
+    // this.searchList();
+  },
   methods: {
     restSearch() {
-      this.input = "";
-      this.select = "1";
       this.parmValue = {
-        status: "",
-        type: "2",
-        staff: "", //客户姓名
-        name: "", // 公司名称
-        admin: "", //业务员姓名
+        name: "", // 业务员名字
+        username: "", // 账号
+        status: "", //
         page: 1, // 页码
-        size: 10, // 每页显示条数
+        size: 15, // 每页显示条数
+      };
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
       };
       this.searchList();
     },
-    openModal(id, isDetail, approval, type) {
-      if (!type) {
-        return;
-      }
+    openModal(id, isDetail, sitem) {
       this.showModel = true;
       this.modelId = id;
       this.isDetail = isDetail;
-      this.approval = approval;
+      this.sitem = sitem;
     },
-    async deleteById(id) {
+    openPasswordModal(id, isDetail) {
+      this.passwordModel = true;
+      this.passwordModelId = id;
+      this.isPasswordDetail = isDetail;
+    },
+
+    async deleteById(id, status) {
       await this.$confirm("确定要删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(async () => {
-          let res = await asyncRequest.delete({ id });
-          if (res.code === 0) {
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
             this.$notify.success({
               title: "删除成功",
               message: "",
             });
             this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
           }
         })
         .catch(() => {
           console.log("取消");
         });
     },
-
-    async again(id, type) {
-      if (!type) {
-        return;
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        this.tableData = res.data.list;
+        this.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
       }
-      await this.$confirm("确定要提交审核?", {
+      this.loading = false;
+    },
+    async statusConfirm(id, status) {
+      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(async () => {
-          let res = await asyncRequest.again({ id: id });
-          if (res.code === 0) {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.loading = false;
             this.$notify.success({
-              title: "提交成功",
+              title: "状态修改成功!",
               message: "",
             });
-            this.searchList();
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
           }
         })
         .catch(() => {
           console.log("取消");
         });
     },
-    async searchList() {
-      this.loading = true;
-      if (this.select === "1") {
-        this.parmValue.staff = this.input; //客户姓名
-        this.parmValue.name = ""; // 公司名称
-        this.parmValue.admin = ""; //业务员姓名
-      } else if (this.select === "2") {
-        this.parmValue.staff = ""; //客户姓名
-        this.parmValue.name = this.input; // 公司名称
-        this.parmValue.admin = ""; //业务员姓名
-      } else if (this.select === "3") {
-        this.parmValue.staff = ""; //客户姓名
-        this.parmValue.name = ""; // 公司名称
-        this.parmValue.admin = this.input; //业务员姓名
-      } else {
-        this.parmValue.staff = ""; //客户姓名
-        this.parmValue.name = ""; // 公司名称
-        this.parmValue.admin = ""; //业务员姓名
-      }
-      let res = await asyncRequest.list(this.parmValue);
-      if (res.code === 0 && res.data) {
-        this.tableData = res.data.list;
-        this.tableData.map((v1) => {
-          if (v1.addtime) {
-            v1.addtime = v1.addtime.replaceAll(".000", "");
-          }
-          return v1;
-        });
-        this.count = Number(res.data.count);
-      } else {
-        this.tableData = [];
-        this.count = 0;
-      }
-      this.loading = false;
-    },
-    async statusConfirm(id, status, ex_status, type) {
-      if (!type) {
-        return;
-      }
-      if (ex_status === "1") {
-        await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
-        })
-          .then(async () => {
-            this.loading = true;
-            const model = {
-              id: id,
-              status: status === "1" ? "0" : "1",
-            };
-            const res = await asyncRequest.status(model);
-            if (res.code === 0) {
-              this.loading = false;
-              this.$notify.success({
-                title: "状态修改成功!",
-                message: "",
-              });
-              await this.searchList();
-            } else {
-              this.loading = false;
-            }
-          })
-          .catch(() => {
-            console.log("取消");
-          });
-      } else {
-        if (status === "0") {
-          this.$message.warning("只有审核通过的规格,才能启用!");
-        }
-      }
-    },
   },
 };
 </script>
@@ -542,4 +467,3 @@ export default {
 .Invoicing {
 }
 </style>
-