永康嘉持电器有限公司前端
小小儁爺
2024-12-30 829af0ac8a4138ffed196d3d01c4c7d1c2c14020
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<template>
  <div>
    <div class="body" style="padding-top: 10px;" :style="{height:mainHeight+'px'}">
      <el-card class="box-card" :style="{height:(mainHeight-20)+'px'}">
        <div slot="header" style="display: flex;justify-content: flex-end">
          <!--          <span>流程设置</span>-->
          <el-button type="primary" @click="save">保存</el-button>
        </div>
        <div class="main">
          <div class="block">
            <div class="block-title">工艺管理</div>
            <div class="block-content">
              <div class="font">
                <div>工艺路线:</div>
                <el-tooltip class="item" effect="dark" content="工单是否启用工艺路线生产" placement="top">
                  <i class="el-icon-question" />
                </el-tooltip>
                <el-switch
                  v-model="route"
                  style="margin-left: 10px;"
                />
              </div>
 
              <div class="font">
                <div>按序生产:</div>
                <el-tooltip class="item" effect="dark" content="工序是否有序生产" placement="top">
                  <i class="el-icon-question" />
                </el-tooltip>
                <el-switch
                  v-model="isOrder"
                  style="margin-left: 10px;"
                />
              </div>
 
            </div>
          </div>
          <div class="block">
            <div class="block-title">SOP管理</div>
            <div class="block-content">
              <div class="font">
                <div>设备SOP:</div>
                <el-tooltip class="item" effect="dark" content="是否启用设备SOP管理" placement="top">
                  <i class="el-icon-question" />
                </el-tooltip>
                <el-switch
                  v-model="device"
                  style="margin-left: 10px;"
                />
              </div>
              <div class="font">
                <div>工艺SOP:</div>
                <el-tooltip class="item" effect="dark" content="是否启用工艺SOP管理" placement="top">
                  <i class="el-icon-question" />
                </el-tooltip>
                <el-switch
                  v-model="tech"
                  style="margin-left: 10px;"
                />
              </div>
              <div class="font">
                <div>单据SOP:</div>
                <el-tooltip class="item" effect="dark" content="是否启用单据SOP管理" placement="top">
                  <i class="el-icon-question" />
                </el-tooltip>
                <el-switch
                  v-model="workOrder"
                  style="margin-left: 10px;"
                />
              </div>
 
            </div>
          </div>
          <div class="block">
            <div class="block-title">流转标签打印</div>
            <div class="block-content">
              <div class="font">
                <div>逐道打印:</div>
                <el-tooltip class="item" effect="dark" content="是否逐道打印" placement="top">
                  <i class="el-icon-question" />
                </el-tooltip>
                <el-switch
                  v-model="every"
                  style="margin-left: 10px;"
                  @change="everyChange"
                />
              </div>
              <div class="font">
                <div>末道打印:</div>
                <el-tooltip class="item" effect="dark" content="是否末道打印" placement="top">
                  <i class="el-icon-question" />
                </el-tooltip>
                <el-switch
                  v-model="last"
                  style="margin-left: 10px;"
                  :disabled="every"
                />
              </div>
            </div>
          </div>
 
        </div>
      </el-card>
 
    </div>
  </div>
</template>
 
<script>
import { SaveSystemProcConfig } from '@/api/systemSetting'
import { logout } from '@/api/user'
 
export default {
  name: 'ProcessSetting',
  data() {
    return {
      mainHeight: 0,
      route: false, // 工艺路线
 
      isOrder: true, // 是否按序生产
      device: true, // 设备
      tech: true, // 工艺
      workOrder: true, // 工单
      every: false, // 是否逐道打印
      last: false // 是否末道打印
    }
  },
  activated() {   window.addEventListener('resize', this.getHeight)   this.getHeight() }, created() {
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
    this.init()
  },
  methods: {
    init() {
      const mesSetting = JSON.parse(localStorage.getItem('mesSetting'))
      if (mesSetting) {
        this.route = mesSetting.route
 
        this.isOrder = mesSetting.isOrder
        this.device = mesSetting.device
        this.tech = mesSetting.tech
        this.workOrder = mesSetting.workOrder
        this.every = mesSetting.every
        this.last = mesSetting.last
      }
    },
    save() {
      this.$confirm('是否确认保存?保存成功之后自动跳转登录页重新登录', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const data = {
          route: this.route, // 工艺路线
 
          isOrder: this.isOrder, // 是否按序生产
          device: this.device, // 设备
          tech: this.tech, // 工艺
          workOrder: this.workOrder, // 工单
          every: this.every, // 是否逐道打印
          last: this.last // 是否末道打印
        }
        SaveSystemProcConfig({ mesSetting: data }).then(res => {
          if (res.code === '200') {
            localStorage.setItem('mesSetting', JSON.stringify(data))
            this.$notify.success('保存成功!')
 
            setTimeout(() => {
              logout().then(res => {
                localStorage.removeItem('token')
                this.$router.push({ path: this.redirect || '/' })
              })
            }, 2000)
          }
        })
      }).catch(() => {
        this.$notify.info('已取消保存!')
      })
    },
    everyChange(val) {
      if (val) {
        this.last = true
      }
    },
 
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
      })
    }
  }
}
</script>
 
<style scoped>
.main {
  display: flex;
  flex-direction: column;
}
 
.block {
  height: 100px;
}
 
.block-title {
 
}
 
.block-content {
  padding: 20px;
  display: flex;
  align-items: center;
}
 
.font {
  color: #606266;
  font-size: 14px;
  display: flex;
  align-items: center;
  width: 200px;
}
 
.el-icon-question {
  cursor: pointer;
}
</style>