From 6815d4a6a0c69cb6879e957404dfeb500cf7c4b5 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期二, 14 五月 2024 18:46:30 +0800
Subject: [PATCH] 1

---
 src/views/mdc/status-record.vue                     |    4 
 src/views/mdc/components/recordChartsByDate.vue     |   11 +
 src/views/console/system/meta-object-type/index.vue |  157 +++++++++++++++++++++---------
 src/views/mdc/time-analysis.vue                     |   76 +++++++++++---
 4 files changed, 175 insertions(+), 73 deletions(-)

diff --git a/src/views/console/system/meta-object-type/index.vue b/src/views/console/system/meta-object-type/index.vue
index 94c556e..bc33e05 100644
--- a/src/views/console/system/meta-object-type/index.vue
+++ b/src/views/console/system/meta-object-type/index.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-05-13 16:28:30
+ * @LastEditTime: 2024-05-14 16:22:28
  * @FilePath: /smart-web/src/views/master/person/main/index.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -33,8 +33,8 @@
 			</div>
 			<div class="right-content">
 				<div class="content-title">缂栫爜瀛楁</div>
-				<el-select v-model="metaForm.test">
-					<el-option v-for="item in refCodeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
+				<el-select v-model="metaForm.code">
+					<el-option v-for="item in refCodeList" :key="item.columnName" :label="item.columnName" :value="item.columnName"/>
 				</el-select>
 			</div>
 			<div class="right-content">
@@ -43,39 +43,51 @@
 			</div>
 			<el-table ref="searchDataListRef" :data="searchDataList" border style="width: 100%;margin-top: 20px;" class="multipleTableRef">
 				<el-table-column prop="fcode" label="瀛楁缂栫爜">
-					<template #default="scope">  
-						<el-select v-if="scope.row.isEdit" v-model="tableForm.fcode">
-							<el-option v-for="item in refCodeList" :key="item.columnName" :label="item.columnName" :value="item.columnName"/>
-						</el-select>
+					<template #default="scope">
+						<div v-if="scope.row.isEdit">
+							<span class="important-star">*</span>
+							<el-select v-model="tableForm.fcode" style="width: 90%;">
+								<el-option v-for="item in refCodeList" :key="item.columnName" :label="item.columnName" :value="item.columnName"/>
+							</el-select>
+						</div>
 						<div v-else>{{scope.row.fcode}}</div>
 					</template>
 				</el-table-column>
 				<el-table-column prop="fname" label="瀛楁鏍囬">
 					<template #default="scope">
-						<el-input v-if="scope.row.isEdit" v-model="tableForm.fname"></el-input>  
+						<div v-if="scope.row.isEdit">
+							<span class="important-star">*</span>
+							<el-input v-model="tableForm.fname" style="width: 90%;"></el-input>
+						</div>
 						<div v-else>{{scope.row.fname}}</div>
 					</template>
 				</el-table-column>
 				<el-table-column prop="field" label="瀹炰綋灞炴��">
 					<template #default="scope">
-						<el-input v-if="scope.row.isEdit" v-model="tableForm.field"></el-input>  
+						<div v-if="scope.row.isEdit">
+							<span class="important-star">*</span>
+							<el-input v-model="tableForm.field" style="width: 90%;"></el-input>
+						</div>
 						<div v-else>{{scope.row.field}}</div>
 					</template>
 				</el-table-column>
-				<el-table-column prop="elementTypeName" label="鍏冪礌绫诲瀷">
-					<template #default="scope"> 
-						<el-select v-if="scope.row.isEdit" v-model="tableForm.elementTypeName">
-							<el-option v-for="item in dictionaryType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
-						</el-select> 
+				<el-table-column prop="elementType" label="鍏冪礌绫诲瀷">
+					<template #default="scope">
+						<div v-if="scope.row.isEdit">
+							<span class="important-star">*</span>
+							<el-select v-model="tableForm.elementType" @change="elementTypeNameChange" style="width: 90%;">
+								<el-option v-for="item in dictionaryType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
+							</el-select>
+						</div>
 						<div v-else>{{scope.row.elementTypeName}}</div>
 					</template>
 				</el-table-column>
 				<el-table-column prop="enumType" label="鏋氫妇绫诲瀷">
 					<template #default="scope">
-						<el-select v-if="scope.row.isEdit" v-model="tableForm.enumType" disabled>
-							<el-option v-for="item in testList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
+						<el-select v-if="scope.row.isEdit" v-model="tableForm.enumType" :disabled="tableForm.elementType!='4'" @change = enumTypeChange>
+							<el-option v-for="item in dictList" :key="item.id" :label="item.code" :value="item.id"/>
 						</el-select> 
-						<div v-else>{{scope.row.enumType}}</div>
+						<div v-else>{{scope.row.enumTypeZn}}</div>
 					</template>
 				</el-table-column>
 				<el-table-column prop="seq" label="瀛楁椤哄簭">
@@ -86,10 +98,8 @@
 				</el-table-column>
 				<el-table-column prop="refObjectTypeId" label="寮曠敤鍏崇郴">
 					<template #default="scope">
-						<el-select v-if="scope.row.isEdit" v-model="tableForm.refObjectTypeId" disabled>
-							<el-option v-for="item in testList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
-						</el-select>   
-						<div v-else>{{scope.row.refObjectTypeId}}</div>
+						<el-tree-select v-if="scope.row.isEdit" node-key="id" :props="defalutProps" v-model="tableForm.refObjectTypeId" :data="tableData" :render-after-expand="false" :disabled="tableForm.elementType!='5'" @node-click="handleNodeClick1"/>
+						<div v-else>{{scope.row.refObjectTypeIdZn}}</div>
 					</template>
 				</el-table-column>
 				<el-table-column label="鎿嶄綔">
@@ -99,14 +109,14 @@
 							<el-button size="small" @click="cancelTable">鍙栨秷</el-button>
 						</div>
 						<div v-else>
-							<el-icon class="operationIcon"><Edit /></el-icon>
-							<el-icon class="operationIcon"><Delete /></el-icon>
+							<!-- <el-icon class="operationIcon" @click="editTable(scope.$index)"><Edit /></el-icon> -->
+							<el-icon class="operationIcon" @click="deleteTable(scope.$index)"><Delete /></el-icon>
 						</div>
 					</template>
 				</el-table-column>
 			</el-table>
 			<div class="saveBtn">
-				<el-button type="primary" @click="saveBtn">淇濆瓨</el-button>
+				<el-button type="primary" @click="saveBtn" :disabled="isAdd">淇濆瓨</el-button>
 			</div>
 		</div>
 	</div>
@@ -121,12 +131,15 @@
 		name: "metaObject",
 		data(){
 			return {
+				dictList: [],  //鏋氫妇绫诲瀷
+				elementTypeValue: "",
+				detailobj: {},
 				testList: [],
 				tableForm: {
 					fcode: "",
 					fname: "",
 					field: "",
-					elementTypeName: "",
+					elementType: "",
 					enumType: "",
 					seq: 0,
 					refObjectTypeId: ""
@@ -139,7 +152,8 @@
 				metaForm: {
 					tableName: "",
 					refCode: "",
-					refName: ""
+					refName: "",
+					code: ""
 				},
 				classificationRules: {
 					classify: [
@@ -168,16 +182,53 @@
 		},
 		mounted(){
 			this.getDictionary();  //瀛楀吀绫诲瀷
+			this.getDict(); //鏋氫妇绫诲瀷
 		},
 		components: {
 			...ElementPlusIconsVue
 		},
 		methods: {
+			getDict() {  //鏋氫妇绫诲瀷
+				this.$HTTP.get("/api/blade-system/dict/list").then(res=> {  //鐗╃悊琛�
+					if(res.code == 200) {
+						this.dictList = res.data;
+					}
+				})
+			},
+			editTable(index) {
+				this.isAdd = true;
+				var obj = Object.assign({},this.searchDataList[index],{isEdit: true});
+				this.searchDataList.splice(index,1,obj);
+				console.log(obj,this.searchDataList[index])
+			},
+			deleteTable(index) {
+				this.searchDataList.splice(index,1);
+			},
+			enumTypeChange(val) {  //鏋氫妇绫诲瀷
+				this.dictList.forEach(item=> {
+					if(item.id == val) {
+						this.tableForm.enumTypeZn = item.code;
+					}	
+				})
+			},
+			elementTypeNameChange(val) {  //鍏冪礌绫诲瀷	
+				this.dictionaryType.forEach(item=> {
+					if(item.dictKey == val) {
+						this.elementTypeValue = item.dictValue;
+					}
+				})
+				this.tableForm.enumType = "";
+				this.tableForm.refObjectTypeId = "";
+			},
 			saveBtn() {
-
+				var obj = Object.assign(this.detailobj,this.metaForm);
+				console.log(this.searchDataList,'okla');
 			},
 			comfirmTable() {
-				this.cancelTable();  //杩樺師
+				this.cancelTable();
+				this.tableForm.elementTypeName = this.elementTypeValue;
+				this.tableForm.id = null;
+				this.tableForm.objectId = this.detailobj.objectId;
 				this.searchDataList.unshift(this.tableForm);
 			},
 			cancelTable() {
@@ -185,8 +236,19 @@
 				this.isAdd = false;
 			},
 			addParameter() {
+				this.tableForm = {
+					fcode: "",
+					fname: "",
+					field: "",
+					elementType: "",
+					enumType: "",
+					seq: 0,
+					refObjectTypeId: ""
+				}
 				this.isAdd = true;
-				this.searchDataList.unshift({isEdit: true});
+				var obj = Object.assign({},this.tableForm,{isEdit: true})
+				obj.id = null;
+				this.searchDataList.unshift(obj);
 			},
 			getDictionary() {  //瀛楀吀绫诲瀷
 				this.$HTTP.get("/api/blade-system/dict/dictionary?code=element_type").then(res=> {  //鐗╃悊琛�
@@ -217,15 +279,19 @@
 			gettableName() {
 				this.$HTTP.get(`/api/blade-system/meta-object-type/detail?fId=${this.dictKey}`).then(res=> {  //鐗╃悊琛ㄦ暟鎹�
 					if(res.code == 200) {
+						console.log(this.tableNameList,res.data.tableName,'gi')
 						this.tableNameList.forEach(item=> {
 							if(res.data.tableName == item.tableName) {
 								this.refCodeList = item.tableColumns;
 							}
 						})
-						console.log(this.refCodeList,111)
 						this.metaForm.tableName = res.data.tableName;
 						this.metaForm.refCode = res.data.refCode;
 						this.metaForm.refName = res.data.refName;
+						this.metaForm.code = res.data.code;
+						this.detailobj = res.data;
+						this.detailobj.objectId = res.data.fid;
+						console.log(this.detailobj,888)
 					}
 				})
 			},
@@ -233,7 +299,11 @@
 				this.$HTTP.get(`/api/blade-system/meta-object-type-field/list?objectId=${this.dictKey}`).then(res=> {  //琛ㄦ牸鏁版嵁
 					if(res.code == 200) {
 						this.searchDataList = res.data;
-						this.dictionaryType.forEach(item=> {
+						res.data.forEach(item=> {
+							item.enumTypeZn = item.enumType;  //鏋氫妇绫诲瀷
+							item.refObjectTypeIdZn = item.refObjectTypeId;  //寮曠敤鍏崇郴
+						})
+						this.dictionaryType.forEach(item=> {  //鍏冪礌绫诲瀷
 							this.searchDataList.forEach(item1=> {
 								if(item1.elementType == item.dictKey) {
 									item1.elementTypeName = item.dictValue;
@@ -252,24 +322,9 @@
 					this.$refs.dialogForm.resetFields();
 				};
 			},
-			classificationSubmit() {
-				this.$refs.dialogForm.validate(async (valid) => {
-					if (valid) {
-						this.isSaveing = false;
-						// this.$HTTP.post("/api/blade-system/data-scope/submit",obj).then(res=> {
-						// 	this.isSaveing = false;
-						// 	if(res.code == 200) {
-						// 		this.$emit('success', this.addDictForm, this.mode);
-						// 		this.visible = false;
-						// 		this.$message.success("鎿嶄綔鎴愬姛");
-						// 	}else {
-						// 		this.$alert(res.message, "鎻愮ず", {type: 'error'});
-						// 	}
-						// })
-					}else{
-						return false;
-					}
-				})
+			handleNodeClick1(data) {
+				if(this.firstChild.includes(data.id)) return;  //涓�绾ц彍鍗曡繑鍥�
+				this.tableForm.refObjectTypeIdZn = data.dictValue;
 			},
 			handleNodeClick(data) {
 				if(!this.firstChild.includes(data.id)) {
@@ -369,4 +424,8 @@
 	margin-top: 20px;
 	text-align: right;
 }
+.important-star {
+	margin-right: 4px;
+	color: red;
+}
 </style>
diff --git a/src/views/mdc/components/recordChartsByDate.vue b/src/views/mdc/components/recordChartsByDate.vue
index 90f7f05..5a9d9a2 100644
--- a/src/views/mdc/components/recordChartsByDate.vue
+++ b/src/views/mdc/components/recordChartsByDate.vue
@@ -14,7 +14,7 @@
 import * as echarts from 'echarts';
 export default {
     components: {saveDialog},
-    props: ['collectionstatus','date','workstationInfoList'],
+    props: ['achievements','date','workstationInfoList'],
     watch: {
         date(val) {
             this.current = "1";
@@ -75,8 +75,9 @@
         },
         getColor(name) {
             var color = '';
-            this.collectionstatus.forEach(item=> {
-                if(item.name == name) {
+            console.log(this.achievements,name);
+            this.achievements.forEach(item=> {
+                if(item.code == name) {
                     color = item.color;
                 }
             })
@@ -103,7 +104,8 @@
                             var startTime = moment(item1.startTime).diff(moment(initstart + " 00:00:00"), 'minutes');
                             var endTime = moment(item1.endTime).diff(moment(initstart + " 00:00:00"), 'minutes');
                             var diff = moment(item1.endTime).diff(moment(item1.startTime), 'minutes') //寮�濮嬩簡澶氫箙
-                            var color = this.getColor(item1.wcsDesc);
+                            var color = this.getColor(item1.wcs);
+                            console.log(color,222)
                             item1.value = [index,startTime,endTime,diff];
                             item1.itemStyle = {"normal": {"color": color}};
                             item1.code = item.workstationInfo.code;
@@ -114,6 +116,7 @@
                     })
                     this.total = res.data.total;
                     //娓叉煋鍥捐〃
+                    console.log(yAxisData,newData,111)
                     this.setCharts(yAxisData,newData);
                     // 妫�鏌ユ槸鍚﹀瓨鍦╥d涓�'parentNodeDom'鐨凞OM鍏冪礌,鏈夊氨鍏堝垹闄�
                     var parentNodeDom = document.getElementById('parentNodeDom');  
diff --git a/src/views/mdc/status-record.vue b/src/views/mdc/status-record.vue
index 147fe77..f1b7877 100644
--- a/src/views/mdc/status-record.vue
+++ b/src/views/mdc/status-record.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-04-26 09:36:18
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-04-26 18:07:52
+ * @LastEditTime: 2024-05-14 18:41:53
  * @FilePath: /smart-web/src/views/mdc/status-record.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -42,7 +42,7 @@
                     <!-- collectionstatus 鍙嶉鐘舵��
                     date 鏃ユ湡
                     workstationInfoList 宸ヤ綅list -->
-                    <record-charts-by-date :collectionstatus="collectionstatus" :date="date" :workstationInfoList="workstationInfoList" v-if="collectionstatus.length != 0"></record-charts-by-date>
+                    <record-charts-by-date :achievements="achievements" :date="date" :workstationInfoList="workstationInfoList" v-if="achievements.length != 0"></record-charts-by-date>
                 </el-tab-pane>
                 <el-tab-pane label="鎸夊伐浣嶆煡鐪�" name="time">
                     <div class="fact-analysis-realtim">
diff --git a/src/views/mdc/time-analysis.vue b/src/views/mdc/time-analysis.vue
index 0c08f99..5af9166 100644
--- a/src/views/mdc/time-analysis.vue
+++ b/src/views/mdc/time-analysis.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-04-26 09:36:18
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-05-02 20:46:36
+ * @LastEditTime: 2024-05-14 18:30:07
  * @FilePath: /smart-web/src/views/mdc/status-record.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -48,7 +48,7 @@
                             <el-collapse v-model="activeNames" accordion>
                             <el-collapse-item v-for="(item,index) in setTitle" :name="index + 1">
                                 <template #title>
-                                    <el-icon size="16" color="#409eff"><Memo /></el-icon>
+                                    <el-icon size="16" color="#3b8e8e"><Memo /></el-icon>
                                     <span class="collr-title">鐝{{index + 1}}</span>
                                     <el-button size="small">{{item.indexName}}</el-button>
                                 </template>
@@ -81,7 +81,7 @@
                             <el-collapse v-model="activeNames1" accordion>
                                 <el-collapse-item v-for="(item,index) in setTitle1" :name="index + 1">
                                     <template #title>
-                                        <el-icon size="16" color="#409eff"><Memo /></el-icon>
+                                        <el-icon size="16" color="#3b8e8e"><Memo /></el-icon>
                                         <span class="collr-title">{{item.name}}</span>
                                         <el-button size="small" v-if="index != 0">{{item.indexName}}</el-button>
                                     </template>
@@ -136,6 +136,7 @@
         	btnLeftList: [{title: "鎸夊伐浣嶇粺璁�",id:"1"},{title: "鎸夊伐浣嶇粍缁熻",id:"2"}],
         	btnLeftctive: "1",
             isshowempty: true,
+            getGlobalColorList: [],
             shortcuts: [
                 {
                     text: '鏈�杩�3澶�',
@@ -180,6 +181,7 @@
                         params.forEach(item=> {
                             dom += `<div>${item.marker}${item.seriesName}锛�${item.data}%</div>`
                         })
+                        console.log(params)
                         return dom;
                     }
                 },
@@ -198,7 +200,7 @@
                     show: true,
                     axisLabel: {
                         formatter: function (value) {
-                            return value * 100 + "%";
+                            return value + "%";
                         }
                     },
                     data: [2,20,40,60,80,100]
@@ -322,8 +324,16 @@
         this.init();
         this.getTree2List();  //鎸夊伐浣嶇粺璁℃爲
         this.getDataA();
+        this.getGlobal(); //鑾峰彇棰滆壊
     },
     methods: {
+        getGlobal() {
+            this.$HTTP.get(`/api/blade-cps/global_wcs/list`).then(res=> {
+                if(res.code == 200) {
+                    this.getGlobalColorList = res.data;
+                }
+            })
+        },
     	getDataA() {
             if(this.btnLeftctive == 1) {  //鎸夊伐浣嶇粺璁�
                 var obj = {
@@ -369,17 +379,43 @@
             
             // 鎺掗櫎杩愯鏃堕棿涓�0鐨勬儏鍐�  
             var totalRunTime = timeSums[0] || 1;  
-            
             // 璁$畻姣忎釜鐘舵�佺殑鐧惧垎姣旀暟鎹�  
-            var lastData = Object.keys(resultObject).map(key => {  
-                var data = resultObject[key].map((item, index) => {  
-                    if (index === 0) { // 鍙绠楁椂闂寸殑鐧惧垎姣�  
-                        return item == 0?0:Number((item / totalRunTime * 100).toFixed(2));
-                    } else {  
-                        return item; // 璁℃暟淇濇寔涓嶅彉  
-                    }  
-                });  
-                return {
+            // var lastData = Object.keys(resultObject).map(key => {  
+            //     var data = resultObject[key].map((item, index) => {  
+            //         if (index === 0) { // 鍙绠楁椂闂寸殑鐧惧垎姣�  
+            //             return item == 0?0:Number((item / totalRunTime * 100).toFixed(2));
+            //         } else {  
+            //             return item; // 璁℃暟淇濇寔涓嶅彉  
+            //         }  
+            //     });  
+            //     return {
+            //         name: key,
+            //         type: 'bar',
+            //         stack: 'total',
+            //         label: {
+            //             show: false
+            //         },
+            //         emphasis: {
+            //             focus: 'series'
+            //         },
+            //         barWidth: 60,
+            //         data
+            //     }
+            // }); 
+            var lastData = [];
+            var colorObj = {};  //璁剧疆棰滆壊
+            this.getGlobalColorList.forEach(item=> {
+                colorObj[item.name] = item.color;
+            })
+            Object.keys(resultObject).map(key => {
+                resultObject[key].forEach((item,index)=> {
+                    if(item != 0) {
+                        var num = item/timeSums[index]* 100;
+                        item = num.toFixed(2);
+                    }
+                    resultObject[key][index] = item;
+                })
+                lastData.push({
                     name: key,
                     type: 'bar',
                     stack: 'total',
@@ -389,11 +425,14 @@
                     emphasis: {
                         focus: 'series'
                     },
+                    itemStyle: {
+                        "color": colorObj[key]
+                    },
                     barWidth: 60,
-                    data
-                }
-            }); 
-            return lastData;
+                    data: resultObject[key]
+                })
+            })
+            return lastData.reverse();
         },
         getDataChartsA(index) {
             var obj = {
@@ -424,6 +463,7 @@
                     this.chartOptionA.series = this.formatChartData(res.data.countStatus);
                     var myChart = echarts.init(recordDom);
                     myChart.setOption(this.chartOptionA);
+                    console.log(JSON.stringify(this.chartOptionA))
                 }
             })
         },

--
Gitblit v1.9.3