From df220d8a73a149ee83908120a649f630dc6794f7 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期一, 01 四月 2024 21:51:03 +0800
Subject: [PATCH] 主数据-机器-工位采集模板

---
 src/views/console/basic-data/working-condition/index.vue |  187 ++++++++++++++++++++++++++++++++++++++++++++++
 src/views/console/workstation/Dialog.vue                 |    2 
 src/api/model/workingCondition.js                        |   47 +++++++++++
 3 files changed, 234 insertions(+), 2 deletions(-)

diff --git a/src/api/model/workingCondition.js b/src/api/model/workingCondition.js
new file mode 100644
index 0000000..3a34dfe
--- /dev/null
+++ b/src/api/model/workingCondition.js
@@ -0,0 +1,47 @@
+/*
+ * @Date: 2024-03-24 11:37:47
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2024-04-01 21:44:49
+ * @FilePath: /cps-web/src/api/model/workingCondition.js
+ */
+import config from "@/config"
+import http from "@/utils/request"
+
+export default {
+	getList: {
+		url: `${config.API_URL}/blade-cps/workstation-wcs/listWcsSetting`,
+		name: "鑾峰彇宸ヤ綅閲囬泦鍒楄〃",
+		get: async function(params){
+			return await http.get(this.url, params);
+		},
+	},
+    getwcsUsageList: {
+		url: `${config.API_URL}/blade-cps/workstation-wcs-usage/list`,
+		name: "鑾峰彇鏁版嵁鏍囩",
+		get: async function(params){
+			return await http.get(this.url, params);
+		},
+	},
+    save: {
+        url: `${config.API_URL}/blade-cps/workstation-wcs/save/setting`,
+		name: "淇濆瓨",
+		post: async function(params){
+			return await http.post(this.url, params);
+		},
+    },
+    update: {
+        url: `${config.API_URL}/blade-cps/workstation-wcs/update`,
+		name: "鏇存柊",
+		post: async function(params){
+			return await http.put(this.url, params);
+		},
+    },
+    del: {
+        
+        url: `${config.API_URL}/blade-cps/workstation-wcs`,
+		name: "鍒犻櫎",
+		post: async function(params,data){
+			return await http.delete(this.url, params,{data});
+		},
+    }
+}
\ No newline at end of file
diff --git a/src/views/console/basic-data/working-condition/index.vue b/src/views/console/basic-data/working-condition/index.vue
new file mode 100644
index 0000000..a78ff33
--- /dev/null
+++ b/src/views/console/basic-data/working-condition/index.vue
@@ -0,0 +1,187 @@
+<!--
+ * @Date: 2024-04-01 20:28:18
+ * @LastEditors: gaoshp
+ * @LastEditTime: 2024-04-01 21:50:06
+ * @FilePath: /cps-web/src/views/console/basic-data/working-condition/index.vue
+-->
+<template>
+    <el-container>
+        <el-header style="justify-content:flex-start">
+            <el-button @click="table_add" type="primary" icon="el-icon-plus"></el-button>
+            <el-button type="danger" plain icon="el-icon-delete" @click="batchDel"></el-button>
+        </el-header>
+        <el-main>
+            <el-table v-bind="$attrs" :data="tableData" :row-key="rowKey" :border="true" :stripe="true"
+                @selection-change="selectionChange">
+                <el-table-column type="selection" />
+                <el-table-column prop="dataItem" label="宸ヤ綅鍙橀噺鍚嶇О" />
+                <el-table-column prop="dataTypeDesc" label="鏁版嵁鏍囩" />
+                <el-table-column prop="usageName" label="璁$畻鏂规硶" />
+                <el-table-column prop="collectSettingItem" label="閲囬泦鍙橀噺鍚嶇О" />
+                <el-table-column label="鎿嶄綔" fixed="right" align="right" width="160">
+                    <template #default="scope">
+                        <el-button-group>
+                            <el-button text type="primary" size="small"
+                                @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
+                            <el-popconfirm title="纭畾鍒犻櫎鍚楋紵" @confirm="table_del(scope.row, scope.$index, '0')">
+                                <template #reference>
+                                    <el-button text type="primary" size="small">鍒犻櫎</el-button>
+                                </template>
+                            </el-popconfirm>
+                        </el-button-group>
+                    </template>
+                </el-table-column>
+            </el-table>
+        </el-main>
+        <el-drawer v-model="drawer" title="鏂板缓" :before-close="handleClose">
+            <el-form :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" label-width="120px"
+                label-position="center">
+                <el-row>
+                    <el-col :span="24">
+                        <el-form-item label="宸ヤ綅鍙橀噺鍚嶇О" prop="dataItem">
+                            <el-input style="width: 240px" v-model="form.dataItem" placeholder="宸ヤ綅鍙橀噺鍚嶇О"
+                                clearable></el-input>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="24">
+                        <el-form-item label="鏁版嵁鏍囩" prop="usageId">
+                            <el-select v-model="form.usageId" clearable placeholder="鏁版嵁鏍囩" style="width: 240px">
+                                <el-option v-for="item in workstation_param_type" :key="item.id" :label="item.usageName"
+                                    :value="item.id" />
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="24">
+                        <el-form-item label="閲囬泦鍙橀噺鍚嶇О" prop="collectSettingItem">
+                            <el-input style="width: 240px" v-model="form.collectSettingItem" placeholder="閲囬泦鍙橀噺鍚嶇О"
+                                clearable></el-input>
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+            </el-form>
+            <template #footer>
+                <div style="flex: auto">
+                    <el-button @click="cancelClick">cancel</el-button>
+                    <el-button type="primary" @click="confirmClick">confirm</el-button>
+                </div>
+            </template>
+        </el-drawer>
+
+    </el-container>
+</template>
+
+<script>
+import config from "@/config/table";
+export default {
+    data() {
+        return {
+            config,
+            tableData: [],
+            workstation_param_type: [],
+            drawer: false,
+            form: {
+                dataItem: '',
+                usageId: '',
+                collectSettingItem: ''
+            },
+            rules: {
+                dataItem: [
+                    { required: true, message: '璇疯緭鍏ュ伐浣嶅彉閲忓悕绉�' }
+                ],
+                usageId: [
+                    { required: true, message: '璇烽�夋嫨鏁版嵁鏍囩' }
+                ],
+                collectSettingItem: [
+                    { required: true, message: '璇疯緭鍏ラ噰闆嗗彉閲忓悕绉�' }
+                ],
+            },
+            selection: []
+        }
+    },
+    created() {
+        this.init()
+    },
+    methods: {
+        init() {
+
+            this.$API.workingCondition.getwcsUsageList.get().then(res => {
+                this.workstation_param_type = res.data
+            })
+            this.$API.workingCondition.getList.get().then(res => {
+                if (res.code == 200) {
+                    this.tableData = res.data
+                }
+            })
+        },
+        batchDel() {
+            console.log(this.selection)
+            this.$API.workingCondition.del.post(
+                {}, this.selection.map(v => v.id)
+            ).then(res => {
+                this.drawer = false
+                this.init()
+            })
+        },
+        selectionChange(selection) {
+            this.selection = selection
+        },
+        table_add() {
+            this.row = {}
+            this.drawer = true
+            this.$nextTick(() => {
+                this.$refs.dialogForm.resetFields()
+            })
+        },
+        table_edit(row) {
+            this.row = row
+            this.form.dataItem = row.dataItem
+            this.form.usageId = row.usageId
+            this.form.collectSettingItem = row.collectSettingItem
+            this.drawer = true
+        },
+        table_del(row) {
+            this.$API.workingCondition.del.post(
+                {}, [row.id]
+            ).then(res => {
+                this.drawer = false
+                this.init()
+            })
+        },
+        cancelClick() {
+            this.drawer = false
+        },
+        confirmClick() {
+            let { collectType: dataType } = this.workstation_param_type.find(v => v.id === this.form.usageId)
+            this.$refs.dialogForm.validate().then(res => {
+                if (res) {
+                    if (!this.row.id) {
+                        this.$API.workingCondition.save.post([
+                            {
+                                ...this.form,
+                                dataType
+                            }
+                        ]).then(res => {
+                            this.drawer = false
+                            this.init()
+                        })
+                    } else {
+                        this.$API.workingCondition.update.post(
+                            {
+                                ...this.row,
+                                ...this.form,
+                                dataType
+                            }
+                        ).then(res => {
+                            this.drawer = false
+                            this.init()
+                        })
+                    }
+
+                }
+            })
+        },
+    }
+}
+</script>
+
+<style lang="scss" scoped></style>
\ No newline at end of file
diff --git a/src/views/console/workstation/Dialog.vue b/src/views/console/workstation/Dialog.vue
index 86700f0..effd650 100644
--- a/src/views/console/workstation/Dialog.vue
+++ b/src/views/console/workstation/Dialog.vue
@@ -254,8 +254,6 @@
             this.params = params
             return this
         },
-
-
         //琛ㄥ崟鎻愪氦鏂规硶
         submit() {
             this.$refs.dialogForm.validate(async (valid) => {

--
Gitblit v1.9.3