From fa37d06890dabf79562128d22f7b043025732802 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期六, 05 十月 2024 17:29:10 +0800
Subject: [PATCH] update

---
 src/utils/request.js                         |   23 ++++
 src/views/console/workstation/index.vue      |   27 ++--
 vue.config.js                                |   35 ++++++-
 src/views/console/workstation/CollDialog.vue |  158 +++++++++++++++++++++++++++++++
 src/views/console/workstation/Dialog.vue     |   24 ++++
 src/views/console/system/collection.vue      |    9 -
 src/views/console/workstation/Coll.vue       |   21 ++++
 7 files changed, 272 insertions(+), 25 deletions(-)

diff --git a/src/utils/request.js b/src/utils/request.js
index 80e3f65..712cbfe 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -129,7 +129,27 @@
 			})
 		})
 	},
-
+	/** post 璇锋眰 query string parameters
+	 * @param  {string} url 鎺ュ彛鍦板潃
+	 * @param  {object} data 璇锋眰鍙傛暟
+	 * @param  {object} config 鍙傛暟
+	 */
+	getJ: function (url, params = {}, config = {}) {
+		return new Promise((resolve, reject) => {
+			axios({
+				method: 'post',
+				url: url,
+				headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' },
+				params: params,
+				...config
+			}).then((response) => {
+				resolve(response.data);
+			}).catch((error) => {
+				resolve(error.data);
+				reject(error);
+			})
+		})
+	},
 	/** post 璇锋眰 request payload
 	 * @param  {string} url 鎺ュ彛鍦板潃
 	 * @param  {object} data 璇锋眰鍙傛暟
@@ -177,6 +197,7 @@
 			})
 		})
 	},
+
 	/** put 璇锋眰
 	 * @param  {string} url 鎺ュ彛鍦板潃
 	 * @param  {object} data 璇锋眰鍙傛暟
diff --git a/src/views/console/system/collection.vue b/src/views/console/system/collection.vue
index f25afc8..ccdfa90 100644
--- a/src/views/console/system/collection.vue
+++ b/src/views/console/system/collection.vue
@@ -1,7 +1,7 @@
 <!--
  * @Date: 2024-10-02 20:34:08
  * @LastEditors: gaoshp
- * @LastEditTime: 2024-10-03 10:08:26
+ * @LastEditTime: 2024-10-05 10:07:12
  * @FilePath: /cps-web/src/views/console/system/collection.vue
 -->
 <template>
@@ -13,9 +13,8 @@
                     <el-button type="primary">鏂板妯$増</el-button>
                 </el-header>
                 <el-main>
-                    <scTable style="width: 100%;" ref="table" row-key="id" border :params="params" :apiObj="apiObj"
-                        stripe paginationLayout="total, prev, pager, next" @dataChange="dataChange"
-                        @row-click="rowClick" highlight-current-row>
+                    <scTable highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table"
+                        :params="params" :apiObj="apiObj" @selection-change="selectionChange" stripe>
                         <el-table-column prop="" label="妯$増鍚嶇О" width="100px" />
                         <el-table-column prop="" label="绫诲瀷" />
                         <el-table-column prop="" label="榛樿杞" />
@@ -54,7 +53,7 @@
                     let params = {
 
                     }
-                    return await this.$HTTP.get(`/api/blade-cps/check-project/page`, {}, { params }).then(res => {
+                    return await this.$HTTP.get(`/api/smart-collect/tpl/page`, {}, { params }).then(res => {
                         res.data.records = res?.data?.records.map(v => {
                             return {
                                 ...v,
diff --git a/src/views/console/workstation/Coll.vue b/src/views/console/workstation/Coll.vue
new file mode 100644
index 0000000..1e94570
--- /dev/null
+++ b/src/views/console/workstation/Coll.vue
@@ -0,0 +1,21 @@
+<!--
+ * @Date: 2024-10-05 09:51:45
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2024-10-05 09:53:47
+ * @FilePath: /cps-web/src/views/console/workstation/Coll.vue
+-->
+<template>
+    <div>
+
+    </div>
+</template>
+
+<script>
+    export default {
+        
+    }
+</script>
+
+<style lang="scss" scoped>
+
+</style>
\ No newline at end of file
diff --git a/src/views/console/workstation/CollDialog.vue b/src/views/console/workstation/CollDialog.vue
new file mode 100644
index 0000000..59ef9d0
--- /dev/null
+++ b/src/views/console/workstation/CollDialog.vue
@@ -0,0 +1,158 @@
+<template>
+    <el-dialog title="鏁版嵁鐐�" v-model="visible" :width="'100%'" destroy-on-close @closed="$emit('closed')">
+        <el-select v-model="type" placeholder="Select" size="small" style="width: 240px" @change="changeType">
+            <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id" />
+        </el-select>
+        <scFormTable v-show="type" ref="table1" v-model="tabledata" stripe hideDelete :hideAdd="!type"
+            :addTemplate="addTemplate">
+            <el-table-column v-for="item in cols" :key="item.prop" :prop="item.prop" :label="item.label">
+                <template #default="scope">
+                    <el-select v-model="scope.row[item.prop]" placeholder="Select" size="small"
+                        v-if="scope.row.status && item.type === 'option'">
+                        <el-option v-for="item in item.options" :key="item" :label="item" :value="item" />
+                    </el-select>
+                    <el-switch size="small" v-model="scope.row[item.prop]"
+                        v-else-if="scope.row.status && item.type === 'boolean'" />
+                    <el-input size="small" v-model="scope.row[item.prop]" placeholder=""
+                        v-else-if="scope.row.status"></el-input>
+                    <span v-else>{{ scope.row[item.prop] }}</span>
+                </template>
+            </el-table-column>
+
+            <el-table-column label="鎿嶄綔" prop="state" width="120">
+                <template #default="scope">
+                    <el-button-group>
+                        <el-button text type="primary" size="small">缂栬緫</el-button>
+                        <el-button text type="primary">澶嶅埗</el-button>
+                        <el-popconfirm width="220" title="纭畾灏嗛�夋嫨鐨勬暟鎹垹闄�" @confirm="del(scope.row)">
+                            <template #reference>
+                                <el-button text type="primary" size="small">鍒犻櫎</el-button>
+                            </template>
+                        </el-popconfirm>
+                    </el-button-group>
+
+                </template>
+            </el-table-column>
+        </scFormTable>
+        <template #footer>
+            <el-button @click="visible = false">鍙� 娑�</el-button>
+            <el-button v-if="mode != 'show'" type="primary" :loading="isSaveing" @click="submit()">淇� 瀛�</el-button>
+        </template>
+    </el-dialog>
+</template>
+
+<script>
+import deepmerge from 'deepmerge'
+import http from "@/utils/request"
+export default {
+    emits: ['success', 'closed'],
+    props: {
+        option: {
+            type: Object
+        }
+    },
+    computed: {
+
+    },
+    data() {
+        return {
+            mode: "add",
+            visible: false,
+            isSaveing: false,
+            params: {},
+            tabledata: [],
+            apiObj: null,
+            addTemplate: {
+                name: '',
+                describe: '',
+                deviceAddress: '',
+                status: '2' // 涓嶅瓨鍦ㄥ凡淇濆瓨 1: 姝e湪缂栬緫 2: 鏂板
+            },
+            type: '',
+            typeList: []
+
+        }
+    },
+    created() {
+
+    },
+    methods: {
+        changeType(val) {
+            console.log(val)
+            console.log(JSON.parse(this.typeList.find(v => v.id === val).dpHeadFull))
+            try {
+                this.cols = JSON.parse(this.typeList.find(v => v.id === val).dpHeadFull)
+            } catch (error) {
+
+            }
+        },
+        //鏄剧ず
+        open(mode = 'add', params) {
+            this.isSaveing = false;
+            this.mode = mode;
+            this.visible = true;
+            this.params = params
+            this.getDetailList({
+                workstationId: this.params.id,
+            })
+            return this
+        },
+        getDetailList(params) {
+
+
+            this.$HTTP.get(`/api/smart-collect/tpl/typelist`, {}, { params }).then(res => {
+
+                this.typeList = res.data || [];
+                // return res
+            }).finally(() => {
+                this.$HTTP.get(`/api/blade-cps/workstation/listDatapointsByWorkstationId`, {}, { params }).then(res => {
+                    // res.data.records = res?.data?.records.map(v => {
+                    //     return {
+                    //         ...v,
+                    //         statusName: v.status ? '鍚敤' : '绂佺敤'
+                    //     }
+                    // })
+                    this.type = res.data.type
+                    this.tabledata = res.data.dpConfig || [];
+                    // return res
+                })
+            })
+
+        },
+        //琛ㄥ崟鎻愪氦鏂规硶
+        submit() {
+            console.log(this.tabledata)
+            this.$HTTP.put('/api/blade-cps/workstation/saveDatapoints', {
+                dpConfig: JSON.stringify(this.tabledata),
+                workstationId: this.params.id,
+                type: this.type
+            })
+        },
+
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.workbranch {
+    list-style: none;
+    padding-left: 50px;
+
+    li {
+        margin-top: 8px;
+
+        span {
+            display: inline-block;
+            width: 25px;
+            height: 25px;
+            line-height: 25px;
+            text-align: center;
+            border-radius: 50%;
+            background: #ccc;
+            margin-right: 8px;
+        }
+
+
+    }
+}
+</style>
diff --git a/src/views/console/workstation/Dialog.vue b/src/views/console/workstation/Dialog.vue
index 895569e..3520765 100644
--- a/src/views/console/workstation/Dialog.vue
+++ b/src/views/console/workstation/Dialog.vue
@@ -41,13 +41,33 @@
                         <scUpload v-model="form.avatar" title="宸ヤ綅鍥剧墖"></scUpload>
                     </el-form-item>
                 </el-col>
-                <el-col :span="12">
+                <el-col :span="12" v-show="!form.id">
                     <el-form-item label="鐢熶骇鏃ュ巻" prop="calendarCode">
                         <el-select v-model="form.calendarCode" style="width: 240px">
                             <el-option v-for="item in options.calendarList" :key="item.id" :label="item.name"
                                 :value="item.code" />
                         </el-select>
                     </el-form-item>
+                </el-col>
+                <!-- 淇敼鐨勬鏃ョ敓鏁� -->
+                <el-col :span="11" v-show="form.id">
+                    <el-form-item label="鐢熶骇鏃ュ巻" prop="calendarCode">
+                        <el-select v-model="form.calendarCodeWaiting" style="width: 240px">
+                            <el-option v-for="item in options.calendarList" :key="item.id" :label="item.name"
+                                :value="item.code" />
+                        </el-select>
+                    </el-form-item>
+
+                </el-col>
+                <el-col :span="1" v-show="form.id">
+                    <div style="display: flex;align-items: center;height: 32px;margin-bottom: 18px;">
+                        <el-tooltip class="box-item" effect="dark" content="淇敼鍚庣殑鏃ュ巻娆℃棩鐢熸晥" placement="top-start">
+                            <el-icon>
+                                <el-icon-warning-filled style="vertical-align: middle" />
+                            </el-icon>
+                        </el-tooltip>
+                    </div>
+
                 </el-col>
                 <el-col :span="24" style="padding:12px 0;" v-if="form.type == 0">
                     鏈哄櫒淇℃伅
@@ -199,6 +219,7 @@
                 status: '',
                 avatar: '',
                 calendarCode: '',
+                calendarCodeWaiting: '',
                 linkWay: '',
                 machineId: '',
                 machineCode: '',
@@ -302,6 +323,7 @@
                 Object.keys(this.form).forEach(key => {
                     this.form[key] = params[key]
                 })
+                if (this.form.calendarCode) this.form.calendarCodeWaiting = this.form.calendarCodeWaiting || this.form.calendarCode
                 this.$HTTP.get(`/api/blade-cps/workstation/get?workstationId=${params.id}`).then(res => {
                     this.form = res?.data
                     this.$HTTP.get(`/api/blade-cps/workstation-workbench/listWorkbench?workstationId=${params.id}`).then(res => {
diff --git a/src/views/console/workstation/index.vue b/src/views/console/workstation/index.vue
index 964c685..724afd8 100644
--- a/src/views/console/workstation/index.vue
+++ b/src/views/console/workstation/index.vue
@@ -140,15 +140,17 @@
 													<el-container>
 														<el-header>
 															<h2>閲囬泦淇℃伅</h2>
-															<el-button v-show="list.length > 0"
+															<!-- <el-button v-show="list.length > 0"
 																@click="() => { editFlag = !editFlag; showTable = !editFlag }"
 																style="margin-left: auto;" text type="primary"
 																size="small">{{ editFlag ? '鍙栨秷' : '閰嶇疆宸ヤ綅閲囬泦'
 																}}</el-button>
 															<el-button v-show="editFlag" @click="saveInfo" text
-																type="primary" size="small">淇濆瓨</el-button>
+																type="primary" size="small">淇濆瓨</el-button> -->
 															<!-- <el-button text type="primary" size="small"
 																@click="editDMP">淇敼DMP閰嶇疆</el-button> -->
+															<el-button @click="editCollection" text type="primary"
+																size="small">鏁版嵁鐐圭紪杈�</el-button>
 														</el-header>
 														<el-main>
 															<el-table :data="list" height="200px"
@@ -392,17 +394,20 @@
 			</el-tabs>
 		</el-card>
 		<Dialog ref="dialog" @success="success" :option="{ types, status, group }"></Dialog>
+		<CollDialog ref="CollDialog" @success="success" :option="{ previewData }"></CollDialog>
 	</el-main>
 </template>
 
 <script>
 import pmsPng from '@/assets/pms.png'
 import Dialog from './Dialog.vue'
+import CollDialog from './CollDialog.vue'
 import machinePng from '@/assets/machine.png'
 export default {
 	name: 'system',
 	components: {
-		Dialog
+		Dialog,
+		CollDialog
 	},
 	data() {
 		return {
@@ -482,7 +487,6 @@
 			handler(val) {
 				this.queryList().then(() => {
 					if (val == 1) {
-						console.log('>>>>>>>>>>>>>>', this.treeCheckedNode)
 						this.apiObj = this.$API.workstation.getList
 						this.params = {
 							groupId: this.treeCheckedNode.id,
@@ -511,8 +515,11 @@
 		this.queryList()
 	},
 	methods: {
+		// 鏁版嵁鐐圭紪杈�
+		editCollection() {
+			this.$refs.CollDialog.open('edit', this.previewData)
+		},
 		handleSelectionChange(val) {
-			console.log(val)
 			val.forEach(v => {
 				v.bigScreen = true
 				v.realTimeData = true
@@ -520,7 +527,6 @@
 			})
 			this.list.forEach(v => {
 				if (val.filter(item => v.id === item.id).length == 0) {
-					console.log(v)
 					v.bigScreen = false
 					v.realTimeData = false
 					v.processParameter = false
@@ -573,7 +579,6 @@
 					let data = this.formatData(res.data)
 					this.group = data
 					this.showGrouploading = false
-					console.log('>>>>>>>>>>>>>>>>>>>>>')
 					// this.$nextTick(() => {
 					if (!flag) {
 						debugger
@@ -626,13 +631,11 @@
 					groupCategory: this.treeCheckedNode.groupCategory
 				}, this.form)
 				return this.$API.workstation.saveWorkstationGroup.post(data).then(res => {
-					console.log(res)
 					this.queryList(true)
 				})
 			}
 			let data = Object.assign({}, this.treeCheckedNode, this.form)
 			this.$API.workstation.saveWorkstationGroup.put(data).then(res => {
-				console.log(res)
 				this.queryList(true)
 			})
 		},
@@ -655,7 +658,6 @@
 		},
 		rowClick(data) {
 			this.previewData = data
-			console.log(data, '>>>>>>>>>>>')
 			if (!data.id) {
 				Object.keys(this.basic).forEach(key => {
 					this.basic[key] = '-'
@@ -667,7 +669,8 @@
 				this.workbenchVOList = []
 				return
 			}
-			this.$HTTP.get(`/api/blade-cps/workstation/listDmpVariablesByWorkstationId?workstationId=${data.id}`).then(res => {
+			console.log(data, '>>>>>>>>>>>')
+			this.$HTTP.get(`/api/blade-cps/workstation/listDmpVariablesByMachineId?machineId=${data.machineId}`).then(res => {
 				this.list = res?.data?.dmpVariablesVOList
 				Object.keys(this.basic).forEach(key => {
 					this.basic[key] = res?.data?.[key] || '-'
@@ -681,7 +684,6 @@
 			})
 		},
 		groupClick1(data) {
-			console.log('-------', data)
 			var params = {
 				groupId: data.id,
 				keyWord: this.keyWord,
@@ -694,7 +696,6 @@
 		dataChange(res, data) {
 
 			if (data.length > 0) {
-				console.log(data[0], '>>>>>>>>')
 				this.$refs.table.setCurrentRow(data[0])
 				this.previewData = data[0]
 				this.rowClick(data[0])
diff --git a/vue.config.js b/vue.config.js
index cb2ce67..8d8506e 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,15 +1,15 @@
 /*
  * @Date: 2024-03-23 09:49:06
- * @LastEditors: Sneed
- * @LastEditTime: 2024-04-10 22:11:52
- * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/vue.config.js
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2024-10-05 17:23:49
+ * @FilePath: /cps-web/vue.config.js
  */
 const { defineConfig } = require('@vue/cli-service')
 
 module.exports = defineConfig({
 	lintOnSave: false,
 	//璁剧疆涓虹┖鎵撳寘鍚庝笉鍒嗘洿鐩綍杩樻槸澶氱骇鐩綍
-	publicPath:'',
+	publicPath: '',
 	//build缂栬瘧鍚庡瓨鏀鹃潤鎬佹枃浠剁殑鐩綍
 	//assetsDir: "static",
 
@@ -18,10 +18,34 @@
 
 	//寮�鍙戞湇鍔�,build鍚庣殑鐢熶骇妯″紡杩橀渶nginx浠g悊
 	devServer: {
-        allowedHosts: 'all',
+		allowedHosts: 'all',
 		open: false, //杩愯鍚庤嚜鍔ㄦ墦寮�娴忚鍣�
 		port: process.env.VUE_APP_PORT, //鎸傝浇绔彛
 		proxy: {
+			'/api/smart-collect': {
+				target: 'http://120.46.212.231:4102',
+				// ws: true,
+				changeOrigin: true,
+				pathRewrite: {
+					'^/api': '/'
+				}
+			},
+			'/api/blade-cps/workstation/listDatapointsByWorkstationId': {
+				target: 'http://120.46.212.231:4102',
+				// ws: true,
+				changeOrigin: true,
+				pathRewrite: {
+					'^/api': '/'
+				}
+			},
+			'/api/blade-cps/workstation/saveDatapoints': {
+				target: 'http://120.46.212.231:4102',
+				// ws: true,
+				changeOrigin: true,
+				pathRewrite: {
+					'^/api': '/'
+				}
+			},
 			'/api': {
 				target: process.env.VUE_APP_API_BASEURL,
 				ws: true,
@@ -29,6 +53,7 @@
 					// '^/api': '/'
 				}
 			},
+
 		}
 	},
 

--
Gitblit v1.9.3