From 2eee4a28e92748c181c92c21f3dbf64f10c8df61 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 27 Aug 2021 16:21:13 +0800
Subject: [PATCH] 禁用按钮逻辑 (会随网速而改变)
---
src/views/home/index.vue | 110 ++++++++++++---------------
src/views/home/column.js | 10 --
src/components/cardPopup/cardPopup.vue | 87 +++++++++++++++++----
3 files changed, 119 insertions(+), 88 deletions(-)
diff --git a/src/components/cardPopup/cardPopup.vue b/src/components/cardPopup/cardPopup.vue
index 694a0cb..867e21c 100644
--- a/src/components/cardPopup/cardPopup.vue
+++ b/src/components/cardPopup/cardPopup.vue
@@ -24,7 +24,7 @@
</div>
</div>
<div v-show="forms == 2" class="first-box-outer">
- <div class="f-b-o-in">
+ <div class="f-b-o-in" v-if="active">
<el-collapse v-model="activeNames" @change="handleChange">
<el-collapse-item title="公司基本信息" name="1">
<avue-form
@@ -59,6 +59,13 @@
import { mapGetters } from "vuex";
import { add, adds, selectIn } from "@/api/recordOur/outCardPopup";
import attach from "@/components/attach/attach";
+import {
+ // getDetail,
+ getList,
+ getListre,
+ getListrek,
+ getListrev,
+} from "@/api/permit/permit";
export default {
components: {
attach: attach,
@@ -75,6 +82,11 @@
forms: 1,
data0: {},
obj0: {},
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
option: {
emptyBtn: false,
submitBtn: false,
@@ -83,14 +95,14 @@
},
activeNames: ["1", "2"],
opens: true,
+ active: false,
};
},
computed: {
- ...mapGetters(["useWhere", "canDoIt", "yanzhen"]),
+ ...mapGetters(["userInfo", "useWhere", "canDoIt", "yanzhen"]),
},
watch: {
useWhere() {
- // console.log(this.canDoIt, "canDoIt");
for (var k in this.data) {
if (this.useWhere == this.data[k].type) {
this.see = true;
@@ -100,19 +112,19 @@
this.apiName = this.data[k].datas.apiName;
this.name = this.data[k].menuName;
var d = this.data[k].datas.column;
-
- //判断是否禁用按钮
- for (var k in this.canDoIt) {
- if (this.canDoIt[k].type == this.type) {
- console.log(this.type + "-------" + this.canDoIt[k].opens);
- this.opens = this.canDoIt[k].opens;
- }
- }
- //是否禁用按钮
- for (var k in d) {
- d[k]["disabled"] = !this.opens;
- }
- this.option.column = d;
+ // this.option.column = d;
+ this.onLoad(this.page, {}, this.useWhere, d);
+ // //判断是否禁用按钮
+ // for (var k in this.canDoIt) {
+ // if (this.canDoIt[k].type == this.type) {
+ // console.log(this.type + "-------" + this.canDoIt[k].opens);
+ // this.opens = this.canDoIt[k].opens;
+ // }
+ // }
+ // //是否禁用按钮
+ // for (var k in d) {
+ // d[k]["disabled"] = !this.opens;
+ // }
console.log("已选择type:" + this.useWhere + "--" + this.name);
this.convert();
@@ -124,6 +136,48 @@
},
},
methods: {
+ onLoad(page, params = {}, val, d) {
+ params["cardid"] = this.userInfo.Id;
+ getList(page.currentPage, page.pageSize, params).then((res) => {
+ const data = res.data.data;
+ this.data = data.records;
+ getListre(page.currentPage, page.pageSize, params).then((ress) => {
+ this.data = this.data.concat(ress.data.data.records);
+ getListrek(page.currentPage, page.pageSize, params).then((resk) => {
+ this.data = this.data.concat(resk.data.data.records);
+ getListrev(page.currentPage, page.pageSize, params).then((resv) => {
+ this.data = this.data.concat(resv.data.data.records);
+ console.log("已有申请数量:", this.data.length);
+ console.log(val);
+ this.changeBut(true, d);
+ if (this.data.length == 0) {
+ console.log("一条数据都没有");
+ } else {
+ this.data.forEach((item) => {
+ if (item.ptype == val) {
+ if (item.type == 0 || item.type == 2) {
+ this.changeBut(false, d);
+ console.log(item, "有数据未审核或者审核不通过");
+ } else {
+ this.changeBut(true, d);
+ console.log(item, "审核通过");
+ }
+ }
+ });
+ }
+ });
+ });
+ });
+ });
+ },
+ changeBut(val, d) {
+ this.opens = val;
+ for (var k in d) {
+ d[k]["disabled"] = !this.opens;
+ }
+ this.option.column = d;
+ this.active = true;
+ },
convert: function () {
var caridid = this.$store.getters.userInfo.Id;
selectIn(this.apiName[2], caridid, this.type).then((res) => {
@@ -222,6 +276,7 @@
};
var d = {};
this.data0 = d;
+ this.active = false;
},
},
};
diff --git a/src/views/home/column.js b/src/views/home/column.js
index 07e2917..3c4fcd3 100644
--- a/src/views/home/column.js
+++ b/src/views/home/column.js
@@ -27,16 +27,6 @@
},
],
},
- // {
- // label: "",
- // labelWidth: 20,
- // type: "title",
- // prop: "title0",
- // span: 24,
- // styles: {
- // fontSize: "24px",
- // },
- // },
{
label: "统一社会信用代码",
prop: "creditcode",
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index b40d041..803c696 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -26,8 +26,8 @@
:data="item"
:ind="item.type"
@open="openMain"
- v-show="showCard"
></examineCard>
+ <!-- v-show="showCard" -->
<!-- :background="" -->
</div>
</div>
@@ -54,13 +54,6 @@
import examineCard from "@/components/examineCard/examineCard.vue"; //卡片
import Approval from "@/components/Approval/Approval.vue"; //审批进度查询
import cardPopup from "@/components/cardPopup/cardPopup.vue"; // 卡片弹窗
-import {
- // getDetail,
- getList,
- getListre,
- getListrek,
- getListrev,
-} from "@/api/permit/permit";
import { mapGetters } from "vuex";
import { resetRouter } from "@/router/router";
@@ -73,17 +66,10 @@
data() {
return {
userName: "",
- showCard: false,
- zhezao: false,
data: [],
dataCard: [],
out: true,
d: [],
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
};
},
computed: {
@@ -91,7 +77,6 @@
},
created() {
this.cc();
- this.onLoad(this.page);
this.dataCard = ourDatas;
var cando = [];
for (var k in ourDatas) {
@@ -102,53 +87,53 @@
}
this.$store.commit("setcanDoIt", cando);
},
- watch: {
- useWhere() {
- this.onLoad(this.page);
- },
- },
methods: {
- onLoad(page, params = {}) {
- params["cardid"] = this.userInfo.Id;
- getList(page.currentPage, page.pageSize, params).then((res) => {
- const data = res.data.data;
- this.data = data.records;
- getListre(page.currentPage, page.pageSize, params).then((ress) => {
- this.data = this.data.concat(ress.data.data.records);
- getListrek(page.currentPage, page.pageSize, params).then((resk) => {
- this.data = this.data.concat(resk.data.data.records);
- getListrev(page.currentPage, page.pageSize, params).then((resv) => {
- this.data = this.data.concat(resv.data.data.records);
- console.log("已有申请数量:", this.data.length);
- this.showCard = true;
- this.data.forEach((item) => {
- for (const key in this.dataCard) {
- if (this.dataCard[key].type == item.ptype) {
- // console.log("已申请名称:", item.enterprisename);
- // console.log("已申请序号:", item.ptype);
- // console.log("申请状态:", item.type);
- for (var k in this.canDoIt) {
- if (this.canDoIt[k].type == item.ptype) {
- this.$store.commit("changecanDoIt", {
- o: true,
- ptype: item.ptype,
- });
- if (item.type == 0 || item.type == 2) {
- this.$store.commit("changecanDoIt", {
- o: false,
- ptype: item.ptype,
- });
- }
- }
- }
- }
- }
- });
- });
- });
- });
- });
- },
+ // onLoad(page, params = {}, val) {
+ // params["cardid"] = this.userInfo.Id;
+ // getList(page.currentPage, page.pageSize, params).then((res) => {
+ // const data = res.data.data;
+ // this.data = data.records;
+ // getListre(page.currentPage, page.pageSize, params).then((ress) => {
+ // this.data = this.data.concat(ress.data.data.records);
+ // getListrek(page.currentPage, page.pageSize, params).then((resk) => {
+ // this.data = this.data.concat(resk.data.data.records);
+ // getListrev(page.currentPage, page.pageSize, params).then((resv) => {
+ // this.data = this.data.concat(resv.data.data.records);
+ // console.log("已有申请数量:", this.data.length);
+ // console.log(val);
+ // if (this.data.length == 0) {
+ // this.$store.commit("changecanDoIt", {
+ // o: true,
+ // ptype: val,
+ // });
+ // console.log("一条数据都没有");
+ // this.$store.commit("changeuseWhere", val);
+ // return;
+ // }
+ // this.data.forEach((item) => {
+ // if (item.ptype == val) {
+ // if (item.type == 0 || item.type == 2) {
+ // this.$store.commit("changecanDoIt", {
+ // o: false,
+ // ptype: val,
+ // });
+ // console.log("有数据");
+ // this.$store.commit("changeuseWhere", val);
+ // } else {
+ // this.$store.commit("changecanDoIt", {
+ // o: true,
+ // ptype: val,
+ // });
+ // console.log("无数据");
+ // this.$store.commit("changeuseWhere", val);
+ // }
+ // }
+ // });
+ // });
+ // });
+ // });
+ // });
+ // },
cc: function () {
this.userName = this.userInfo.user_name;
},
@@ -179,6 +164,7 @@
this.$store.commit("doitApprovalShow", true);
return;
}
+ // this.onLoad(this.page, {}, val);
this.$store.commit("changeuseWhere", val);
},
},
--
Gitblit v1.9.3