Commit 0d45e4dd by 无尘

fix: 修改已选数据判断

parent ad230a2e
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>GIC-会员标签</title><link href=./static/css/app.875a8e273d557818ef92802e165ee46c.css rel=stylesheet></head><body style="background-color: #f0f2f5;min-width: 1400px;"><div id=app></div><script type=text/javascript src=./static/js/manifest.45e4aa858af481911340.js></script><script type=text/javascript src=./static/js/vendor.4ac54fd03099c45beefc.js></script><script type=text/javascript src=./static/js/app.14fef913b281f0291303.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>GIC-会员标签</title><link href=./static/css/app.e46df6148fb1cd30bc1c06d7b93a6e6c.css rel=stylesheet></head><body style="background-color: #f0f2f5;min-width: 1400px;"><div id=app></div><script type=text/javascript src=./static/js/manifest.dd4cde93d434289db331.js></script><script type=text/javascript src=./static/js/vendor.4ac54fd03099c45beefc.js></script><script type=text/javascript src=./static/js/app.14fef913b281f0291303.js></script></body></html>
\ No newline at end of file
......@@ -1166,7 +1166,7 @@ input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill {
bottom: 70px;
left: 0;
right: 0;
height: 404px;
height: 352px;
padding: 24px 22px;
background: #fff;
-webkit-box-shadow: -3px -3px 10px 0px rgba(198,198,198,0.50);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,f,o){for(var a,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(a in f)Object.prototype.hasOwnProperty.call(f,a)&&(e[a]=f[a]);for(n&&n(r,f,o);b.length;)b.shift()();if(o)for(u=0;u<o.length;u++)i=c(c.s=o[u]);return i};var r={},t={26:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var f=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.timeout=12e4,c.nc&&o.setAttribute("nonce",c.nc),o.src=c.p+"static/js/"+e+"."+{0:"54e2fcd34d9735921821",1:"d1b66d4bf3d45b2621dd",2:"344d5c61c44868322e7e",3:"88a303fc10feb8b51091",4:"f6a8f25f4e8cc458879d",5:"f9ba00b62234e5507544",6:"0e39cb4d1c98468ff156",7:"6df68771b9da55fafefe",8:"e19b3ce2ffcde52958e6",9:"2779fa348bf9cd5ae6e1",10:"c71c26ffe9e929740644",11:"e85b90356083e5b3e250",12:"cd5795695183c2acddb4",13:"e29aa5893a93a16c34bc",14:"9e2a6743137628654ca9",15:"9f61f06d1572f1265cc0",16:"2f5942e91ee9b162d882",17:"1995a96876cc6fe1f34f",18:"6ed416399616407ccde9",19:"d3796f1f0fe89f2d7bfa",20:"37b3cf0d9a6daea9fe30",21:"3176d131bd779122af0b",22:"e91d8f3111c8c501ab9d",25:"9ceafa4ee79176c87d81"}[e]+".js";var a=setTimeout(d,12e4);function d(){o.onerror=o.onload=null,clearTimeout(a);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return o.onerror=o.onload=d,f.appendChild(o),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="./",c.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.45e4aa858af481911340.js.map
\ No newline at end of file
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,f,o){for(var a,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(a in f)Object.prototype.hasOwnProperty.call(f,a)&&(e[a]=f[a]);for(n&&n(r,f,o);b.length;)b.shift()();if(o)for(u=0;u<o.length;u++)i=c(c.s=o[u]);return i};var r={},t={26:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var f=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.timeout=12e4,c.nc&&o.setAttribute("nonce",c.nc),o.src=c.p+"static/js/"+e+"."+{0:"54e2fcd34d9735921821",1:"d1b66d4bf3d45b2621dd",2:"344d5c61c44868322e7e",3:"88a303fc10feb8b51091",4:"f6a8f25f4e8cc458879d",5:"f9ba00b62234e5507544",6:"d98c2fae3ac9d532ff52",7:"af58f9e65444c2d58bfd",8:"e19b3ce2ffcde52958e6",9:"0dd41bbf0bd4998eb8bf",10:"c71c26ffe9e929740644",11:"e85b90356083e5b3e250",12:"cd5795695183c2acddb4",13:"e29aa5893a93a16c34bc",14:"9e2a6743137628654ca9",15:"9f61f06d1572f1265cc0",16:"2f5942e91ee9b162d882",17:"1995a96876cc6fe1f34f",18:"6ed416399616407ccde9",19:"d3796f1f0fe89f2d7bfa",20:"37b3cf0d9a6daea9fe30",21:"3176d131bd779122af0b",22:"e91d8f3111c8c501ab9d",25:"9ceafa4ee79176c87d81"}[e]+".js";var a=setTimeout(d,12e4);function d(){o.onerror=o.onload=null,clearTimeout(a);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return o.onerror=o.onload=d,f.appendChild(o),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="./",c.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.dd4cde93d434289db331.js.map
\ No newline at end of file
......@@ -1424,7 +1424,7 @@
}else {
item.checkeditems = []
}
console.log("全选:",item.checkeditems)
item.isIndeterminate = false;
},
......@@ -1433,7 +1433,18 @@
*/
handleCheckedChange(value,item) {
const that = this
// console.log("单选:",value)
let vBackUp = JSON.parse(JSON.stringify(value))
let checkedCount = value.length;
// 判断有删除,添加新值的情况
if (checkedCount>= item.options.length) {
item.checkeditems = [];
item.checkeditems = item.options.map(el=>el.key)
checkedCount = item.checkeditems.length;
}
// console.log("单选:",item.checkeditems)
item.checkAll = checkedCount === item.options.length;
item.isIndeterminate = checkedCount > 0 && checkedCount < item.options.length;
},
......@@ -2076,9 +2087,11 @@
// 获取已存数据
that.getExistData(that.tagData.tagId).then(item=>{
// console.log("获取已存数据:",item)
console.log("获取已存数据:",item)
that.templateData = item
});
}).catch(function (error) {
console.log(error);
})
// console.log("获取已存数据:",tempExist)
if (resData.result.templateCode === 'tag009' || resData.result.templateCode === 'tag010') {
......@@ -2101,6 +2114,20 @@
},
/**
* 判断是否包含一个数组包含另一个数组
*/
isContained(a, b) {
if(!(a instanceof Array) || !(b instanceof Array)) return false;
if(a.length < b.length) return false;
var aStr = a.toString();
for(var i = 0, len = b.length; i < len; i++){
if(aStr.indexOf(b[i]) == -1) return false;
}
return true;
},
/**
* 获取当前标签数据 --- api
*/
getAsyncList(url,data) {
......@@ -2120,6 +2147,39 @@
items.forEach(function(ele,index){
if (ele.templateCode == 'tag013') {
ele.options = data.options;
let idOptions = data.options.map(el=>el.key)
// console.log("idOptions:",idOptions,ele.checkeditems)
let checkFlag = true;
data.options.forEach(function(el,index){
if (ele.checkeditems.indexOf(el.key) != -1) {
checkFlag = false; // 如果已选值中存在 options中
}
})
// console.log(checkFlag)
let checkedCount = ele.checkeditems.length;
if (that.isContained(ele.checkeditems,idOptions)) {
ele.checkAll = true;
ele.isIndeterminate = false;
return false;
}
if (checkFlag && data.options.length < checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = false;
return false;
}
if (!checkFlag && data.options.length >= checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = true;
return false;
}
if (checkFlag && data.options.length > checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = false;
return false;
}
ele.checkAll = checkedCount === data.options.length;
ele.isIndeterminate = checkedCount > 0 && checkedCount < data.options.length;
}
})
......@@ -2132,12 +2192,47 @@
data.options = resData.result;
that.templateData.push(data)
that.getExistData(that.tagData.tagId).then(items=>{
console.log("items:",items)
items.forEach(function(ele,index){
if (ele.templateCode == 'tag013') {
console.log(ele)
ele.options = data.options;
let idOptions = data.options.map(el=>el.key)
// console.log("idOptions:",idOptions,ele.checkeditems)
let checkFlag = true;
data.options.forEach(function(el,index){
if (ele.checkeditems.indexOf(el.key) != -1) {
checkFlag = false; // 如果已选值中存在 options中
}
})
// console.log(checkFlag)
let checkedCount = ele.checkeditems.length;
if (that.isContained(ele.checkeditems,idOptions)) {
ele.checkAll = true;
ele.isIndeterminate = false;
return false;
}
if (checkFlag && data.options.length < checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = false;
return false;
}
if (!checkFlag && data.options.length >= checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = true;
return false;
}
if (checkFlag && data.options.length > checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = false;
return false;
}
ele.checkAll = checkedCount === data.options.length;
ele.isIndeterminate = checkedCount > 0 && checkedCount < data.options.length;
}
})
console.log(items)
that.templateData = items
})
return;
......
......@@ -2031,6 +2031,19 @@ import qs from 'qs';
},
/**
* 判断是否包含一个数组包含另一个数组
*/
isContained(a, b) {
if(!(a instanceof Array) || !(b instanceof Array)) return false;
if(a.length < b.length) return false;
var aStr = a.toString();
for(var i = 0, len = b.length; i < len; i++){
if(aStr.indexOf(b[i]) == -1) return false;
}
return true;
},
/**
* 获取当前标签数据 --- api
*/
getAsyncList(url,data) {
......@@ -2099,6 +2112,39 @@ import qs from 'qs';
items.forEach(function(ele,index){
if (ele.templateCode == 'tag013') {
ele.options = newOptions;
let idOptions = newOptions.map(el=>el.key)
// console.log("idOptions:",idOptions,ele.checkeditems)
let checkFlag = true;
newOptions.forEach(function(el,index){
if (ele.checkeditems.indexOf(el.key) != -1) {
checkFlag = false; // 如果已选值中存在 options中
}
})
// console.log(checkFlag)
let checkedCount = ele.checkeditems.length;
if (that.isContained(ele.checkeditems,idOptions)) {
ele.checkAll = true;
ele.isIndeterminate = false;
return false;
}
if (checkFlag && newOptions.length < checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = false;
return false;
}
if (!checkFlag && newOptions.length >= checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = true;
return false;
}
if (checkFlag && newOptions.length > checkedCount) {
ele.checkAll = false;
ele.isIndeterminate = false;
return false;
}
ele.checkAll = checkedCount === newOptions.length;
ele.isIndeterminate = checkedCount > 0 && checkedCount < newOptions.length;
}
})
}
......
......@@ -1166,7 +1166,7 @@ input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill {
bottom: 70px;
left: 0;
right: 0;
height: 404px;
height: 352px;
padding: 24px 22px;
background: #fff;
-webkit-box-shadow: -3px -3px 10px 0px rgba(198,198,198,0.50);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment