jiaosong
2023-08-11 c2e4ed1a6e3a14406db471304360cd45ac8177d1
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
<template>
  <GlobalWindow
    :title="title"
    :visible.sync="visible"
    width="80%"
    :confirm-working="isWorking"
  >
    <div style="min-width:530px;width:100%">
      <div class="form-data">
        <div>基本信息</div>
        <el-form :model="form" ref="form" inline label-width="100px" label-suffix=":">
          <el-form-item label="工艺名称" prop="name">
          {{ form.name }}
          </el-form-item>
          <el-form-item label="工艺编码" prop="code">
            {{ form.code }}
          </el-form-item>
          <el-form-item label="所属工厂" prop="departId">
            {{ factoryToStr(form.departId) }}
          </el-form-item>
        </el-form>
      </div>
      <!-- 列表 -->
      <el-tabs v-model="activeName">
        <el-tab-pane label="工序列表" name="first"></el-tab-pane>
      </el-tabs>
      <el-table
        :data="form.rpList"
        border
        stripe
      >
        <el-table-column prop="name" label="工序名称" min-width="100px"></el-table-column>
        <el-table-column prop="code" label="工序编码" fixed="left" min-width="100px"></el-table-column>
        <!-- <el-table-column prop="sortNum" label="加工顺序" min-width="100px"></el-table-column> -->
        <el-table-column label="工序类型" prop="type" min-width="100px">
          <template slot-scope="{row}">
            {{ row.level == 1 ? '委外' : '自有' }}
          </template>
        </el-table-column>
          <!-- <el-table-column prop="userId" label="负责人" min-width="100px"></el-table-column> -->
        <el-table-column label="设备收集层次" min-width="100px">
          <template slot-scope="{row}">
            {{ row.level == 0 ? '设备' : '设备组'  }}
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div slot="footer" class="window__header">
      <el-button type="primary" @click="cancel">返回</el-button>
    </div>
  </GlobalWindow>
</template>
 
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
 
export default {
  name: 'OperaRouteDetail',
  extends: BaseOpera,
  components: { GlobalWindow },
  data () {
    return {
      // 表单数据
      searchForm: {
        name: '',
        code: ''
      },
      form: {
        id: null,
        name: '',
        code: '',
        departId: '',
        rpList: [
        ]
      },
      
      activeName: 'first'
    }
  },
  inject: ['factoreis'],
  created () {
    this.config({
      api: '/ext/routeProcedureExt',
      'field.id': 'id'
    })
   
  },
  methods: {
    open (title, target) {
      this.title = title
      this.visible = true
      // 新建
      if (target == null) {
        this.$nextTick(() => {
          this.$refs.form.resetFields()
          this.form[this.configData['field.id']] = null
        })
        return
      }
      // 编辑
      this.$nextTick(() => {
        for (const key in this.form) {
          this.form[key] = target[key]
        }
        this.form.rpList = target.proceList
        // console.log(this.form, target)
      })
    },
    factoryToStr (factory) {
      for (const item of this.factoreis()) {
        if (item.id === factory) {
          return item.name
        }
      }
    },
    cancel () {
      this.$refs.form.resetFields()
      this.visible = false
      // let that = this
    }
  }
}
</script>
 
<style lang="scss" scoped>
.form-data {
  ::v-deep .el-form-item{
    width: 30%;
    margin-right: 3%;
  }
}
</style>
 
<style lang="scss" scoped>
.toolbar {
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  li {
    display: inline-block;
    margin-right: 6px;
  }
}
::v-deep .el-dialog {
  // height: calc(100% - 190px);
  height: 70%;
  min-height: 400px;
}
::v-deep .el-dialog__footer {
  padding: 0px;
}
::v-deep .el-dialog__body {
  height: calc(100% - 114px);
}
</style>