diff --git a/package.json b/package.json index a8794e6..6e2c4b0 100644 --- a/package.json +++ b/package.json @@ -46,11 +46,13 @@ "parser": "babel-eslint" }, "rules": { - "no-unused-vars": "off" + "no-unused-vars": "off", + "no-debugger": "off", + "no-console": "off" } }, "browserslist": [ "> 1%", "last 2 versions" ] -} +} \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index b930926..78c061e 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -34,3 +34,4 @@ export function getEqpList() { method: 'post', }) } + diff --git a/src/assets/scss/tianyi.scss b/src/assets/scss/tianyi.scss index c8495bc..0f4e133 100644 --- a/src/assets/scss/tianyi.scss +++ b/src/assets/scss/tianyi.scss @@ -12,4 +12,24 @@ .typeFo { background-image: linear-gradient(red, darken(red, 20%)); +} + + +.type0 { + background-image: linear-gradient(#849384, darken(#849384, 20%)); +} +.type1 { + background-image: linear-gradient(#6acbf0, darken(#6acbf0, 20%)); +} +.type2 { + background-image: linear-gradient(#35ff39, darken(#35ff39, 20%)); +} +.type3 { + background-image: linear-gradient(#d3ff33, darken(#d3ff33, 20%)); +} +.type4 { + background-image: linear-gradient(#ff7db7, darken(#ff7db7, 20%)); +} +.type5 { + background-image: linear-gradient(red, darken(red, 20%)); } \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 8f78ac4..028a123 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -2,7 +2,7 @@ import axios from 'axios' const server = axios.create({ baseURL: "http://192.168.11.109", //配置请求的url // baseURL: "http://tnb.tuotong-tech.com", //配置请求的url - timeout: 6000, //配置超时时间 + timeout: 30000, //配置超时时间 headers:{}//配置请求头 }) // axios的拦截器 diff --git a/src/views/cpcView/index.vue b/src/views/cpcView/index.vue index 011bc60..5829067 100644 --- a/src/views/cpcView/index.vue +++ b/src/views/cpcView/index.vue @@ -1,33 +1,26 @@ @@ -38,8 +31,8 @@ export default { name: 'yclView', data() { return { - data: [] - + data: [], + region: ['A', 'B', 'C'] } }, created() { @@ -61,8 +54,147 @@ export default { getCpcList().then(res => { console.log(res); this.data = res.data.data || [] - // console.log(this.data, 999); + let arr1 = [] + let arr2 = [] + // let arr3 = [] + this.data.forEach(item => { + if (item[0].location_code.indexOf("A") !== -1) { + arr1.push(item) + } + if (item[0].location_code.indexOf("B") !== -1) { + arr2.push(item) + } + }) + arr1 = this.formatFn(arr1, 'A') + arr2 = this.formatFn(arr2, 'B') + // arr3 = this.formatFn(arr3) + // this.data = [arr1, arr2, arr3] + this.data = [arr1, arr2] + console.log(this.data, 999); }).finally(e => { loading.close(); }) + + }, + formatFn(arr1, fig) { + let arr3 = [] + arr1.forEach(item => { + item.forEach(it => { + if (!arr3.length) return arr3.push([it]) + let fig = arr3.findIndex(value => value[0].location_code.slice(-2) == it.location_code.slice(-2)) + if (fig < 0) { + arr3.push([it]) + } else { + arr3[fig].push(it) + } + }) + }) + if (fig == 'A') { + const arrone = [4, 7, 11, 15, 19, 23, 27] + const arrtwo = [4, 5, 13, 19, 20] + arr3.forEach((item, index) => { + if (arrtwo.some(it => { return it == index + 1 })) { + arrone.forEach(it => { + item.splice(it, 0, { type: 4, location_code: '' }) + }) + } + if (17 == index + 1 || 18 == index + 1) { + item.splice(4, 0, { type: 4, location_code: '' }) + } + if (21 == index + 1) { + item.splice(7, 0, { type: 4, location_code: '' }) + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(19, 0, { type: 4, location_code: '' }) + item.splice(23, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + if (22 == index + 1) { + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(19, 0, { type: 4, location_code: '' }) + item.splice(23, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + if (27 == index + 1) { + item.splice(4, 0, { type: 4, location_code: '' }) + item.splice(7, 0, { type: 4, location_code: '' }) + } + if (28 == index + 1) { + item.splice(4, 0, { type: 4, location_code: '' }) + item.splice(7, 0, { type: 4, location_code: '' }) + item.splice(11, 0, { type: 4, location_code: '' }) + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(19, 0, { type: 4, location_code: '' }) + item.splice(23, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + if (index + 1 > 33) { + item.splice(0, 0, { type: 4, location_code: '' }) + if (34 == index + 1) { + item.splice(7, 0, { type: 4, location_code: '' }) + item.splice(11, 0, { type: 4, location_code: '' }) + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + if (35 == index + 1) { + item.splice(7, 0, { type: 4, location_code: '' }) + item.splice(11, 0, { type: 4, location_code: '' }) + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(19, 0, { type: 4, location_code: '' }) + item.splice(23, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + if (36 == index + 1 || 37 == index + 1) { + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + if (43 == index + 1) { + item.splice(7, 0, { type: 4, location_code: '' }) + item.splice(11, 0, { type: 4, location_code: '' }) + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(19, 0, { type: 4, location_code: '' }) + item.splice(23, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + } + }) + } else if (fig == 'B') { + arr3.sort((a, b) => a[0].location_code.slice(-2) - b[0].location_code.slice(-2)) + const arrone = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] + const arrtwo = [6, 14, 21, 29, 30, 36, 44, 45] + const arrth = [4, 7, 11, 15, 19, 23, 27] + arr3.forEach((item, index) => { + if (arrone.some(it => { return it == index + 1 })) { + for (let i = 1; i < 5; i++) { + item.splice(0, 0, { type: 4, location_code: '' }) + } + } + if (arrtwo.some(it => { return it == index + 1 })) { + arrth.forEach(it => { + item.splice(it, 0, { type: 4, location_code: '' }) + }) + if (index + 1 == 6 || index + 1 == 14) { item.splice(4, 1) } + } + if (4 == index + 1) { + item.splice(4, 0, { type: 4, location_code: '' }) + } + if (12 == index + 1 || 13 == index + 1) { + item.splice(15, 0, { type: 4, location_code: '' }) + } + if (15 == index + 1) { + item.splice(15, 0, { type: 4, location_code: '' }) + item.splice(26, 0, { type: 4, location_code: '' }) + } + if (27 == index + 1 || 28 == index + 1) { + item.splice(4, 0, { type: 4, location_code: '' }) + item.splice(27, 0, { type: 4, location_code: '' }) + } + if (37 == index + 1) { + item.splice(15, 0, { type: 4, location_code: '' }) + } + if (46 == index + 1) { + item.splice(4, 0, { type: 4, location_code: '' }) + } + }) + } + return arr3 } } } @@ -76,9 +208,17 @@ export default { height: 860px; margin: 30px; overflow-y: scroll; + + .title { + text-align: center; + font-size: 30px; + margin: 15px; + } + .box-x { display: flex; margin-bottom: 30px; + .index { display: flex; align-items: center; @@ -86,6 +226,7 @@ export default { width: 10px; } } + .item-x { width: 50px; height: 60px; diff --git a/src/views/index.vue b/src/views/index.vue index d836ed3..05a7f56 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -57,6 +57,10 @@ {{ dateYear }} {{ dateWeek }} {{ dateDay }} + diff --git a/src/views/yclView/index copy.vue b/src/views/yclView/index copy.vue new file mode 100644 index 0000000..0680134 --- /dev/null +++ b/src/views/yclView/index copy.vue @@ -0,0 +1,241 @@ + + + + + \ No newline at end of file diff --git a/src/views/yclView/index.vue b/src/views/yclView/index.vue index f4357c1..62f3b0b 100644 --- a/src/views/yclView/index.vue +++ b/src/views/yclView/index.vue @@ -1,58 +1,81 @@