廖井涛
2024-03-04 2cf22385d45af4427b354e383243155ef35b70a5
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
Vue.component('show-table', {
  // 声明 props
  props: ['tablehead','tabledata'],
  // 同样也可以在 vm 实例中像 "this.message" 这样使用
  template: `<el-table
              :data="tabledata"
              height="100%"
              style="width: 100%">
              <el-table-column 
                v-if='index!=4'
                v-for="(item,keys,index) in tablehead[0]" 
                :key="index"
                :label="item"
                :prop="keys.toString()"
              >        
                <template v-slot="scope"  v-if=" keys=='6_parts_change' ">
                  <el-button
                    :style="tabledata[scope.$index]['6_parts_change']==1?textColor:null"
                    type="text"
                    size="small"
                    @click='openParts(scope.$index,tabledata)'
                  >
                    更换
                  </el-button>
                </template>    
              </el-table-column>
              
            </el-table>`
  ,
  data() {
    return {
      textColor:{
        color:'orange'
      }
    }
  },
  
  methods:{
    openParts(index,machineData){
      this.$parent.$emit('dialogvisible', 
        {
          'show':true,
          'machineid':machineData[index]['10_id']
        }
      )
    }
  }
  
})
Vue.component('parts-change', {
  // 声明 props
  props: ['machine'],
  // 同样也可以在 vm 实例中像 "this.message" 这样使用
  template: `<el-dialog
              title="更换设备零部件列表"
              :visible.sync="centerDialogVisible"
              width="55%"
              center
              >
              <el-table :data="machineChange" width="100%" height='100%'>
                <el-table-column 
                  v-for="(item,keys,index) in machineChangeHead[0]" 
                  :prop="keys" 
                  :label="item" 
                  
                >
                  <template v-slot="scope"  v-if="keys=='5_surpass' && Object.keys(machineChange[0]).length!=0">
                    <el-button 
                      :style="machineChange[scope.$index]['5_surpass']==1?textColor:null"
                      type="text"
                      size="small"
                      v-preventreclick
                      @click="partsChange(scope.$index, machineChange,0)"
                    >
                      更换
                    </el-button>
                  </template>    
                </el-table-column>
              </el-table>
              <span slot="footer" class="dialog-footer">
                <el-button @click="centerDialogVisible = false">取 消</el-button>
                <el-button type="primary" v-if="Object.keys(machineChange[0]).length!=0" v-preventreclick @click="partsChange(0,0,1)">一键更换</el-button>
              </span>
            </el-dialog>`
  ,
  mixins: [mixin],
  data(){
    return{
      centerDialogVisible:false,
      machineChange:[{}],
      machineChangeHead:[{}],
      machineId:null,
      textColor:{
        color:'orange'
      }
    }
 
  },
  methods:{
    partsChange(index,data,type){//修改零部件更换周期,type: 0代表单个零部件,1代表此机器所有零部件
      
      let para
      if(type==0){
        para={
          id:data[index]['7_id'],
          machineId:data[index]['6_machine_id'],
          type:type
        }
      }else{
        para={
          id:0,
          machineId:this.machineId,
          type:type
        }
      }
      let sql="{call AXJ_a_largeScreen_machinePartsChange_update(?,?,?,?)}~"+JSON.stringify(para);
      this.connects("更新耗材:",sql,1,1);
      this.centerDialogVisible = false
    }
  },
  watch: {
    async machineId(){
      let machine={
        id:this.machineId
      }
      let canshu={
        gongneng:'大屏更换周期机器零部件查询,机器号:'+this.machineId,
        sql:"{call AXJ_a_largeScreen_machinePartsChange_select(?,?)}~"+JSON.stringify(machine),
        flag:2,
        vals:"machineChange"
      }
      this.machineChange=await this.returnloadAjxss(canshu)
    }
  },
  async mounted() {
    let parameter={
      gongneng:'大屏更换周期表头查询',
      sql:"{call AXJ_a_largeScreen_machinePartsChangeHead_select()}",
      flag:2,
      vals:"machineChangeHead"
    }
    this.machineChangeHead=await this.returnloadAjxss(parameter)
  
    this.$parent.$on("dialogvisible",val=>{
      //这是事件函数 一旦changeBgc事件被触发,就会执行这里的代码
      this.centerDialogVisible = val.show
      this.machineId=val.machineid
 
      
      })
  }
  
})
Vue.component('screen-order', {//钢化贴膜下片订单组件
  // 声明 props
  props: ['tablehead','tabledata'],
  // 同样也可以在 vm 实例中像 "this.message" 这样使用
  template: `<el-table
              :data="tabledata"
              height="100%"
              style="width: 100%">
              <el-table-column 
                
                v-for="(item,keys,index) in tablehead[0]" 
                :key="index"
                :label="item"
                :prop="keys.toString()"
              >        
                <template v-slot="scope"  v-if=" keys=='3_ratio' && Object.keys(tabledata[0]).length!=0">
                  <el-progress :text-inside="true" :stroke-width="26" 
                  :percentage="tabledata[scope.$index]['3_ratio']==null?0*1:tabledata[scope.$index]['3_ratio']*1"
                  >
                  </el-progress>
                </template>    
              </el-table-column>
              
            </el-table>`
    
  
})
 
Vue.component('screen-photo', {//现场作业图轮换
  // 声明 props
  props: ['id','intime'],
  // 同样也可以在 vm 实例中像 "this.message" 这样使用
  template: `<div  style='width:100%;height:100%;max-width=100%;max-height=100%;position: relative;'>
              <img class="imgCenter" :src="url"/>
            </div>`,
  mixins: [mixin],
  data(){
    return{
      photoList:[{}],
      indexs:-1,
      url:null
    }
  },
  watch:{
    photoList(newVal){
      if(Object.keys(this.photoList[0]).length==0){
        return
      }
      
      this.url=newVal[0]['0_route']
      setInterval(()=>{
        
        this.indexs>=newVal.length-1?this.indexs=0:this.indexs++
        this.url=newVal[this.indexs]['0_route']
      },parseInt(this.intime/newVal.length))
    }
  },
  async mounted() {
    let para={
      id:this.id
    }
    let canshu={
      gongneng:'组件图片查询:',
      sql:"{call AXJ_a_largeScreen_phtot_select(?,?)}~"+JSON.stringify(para),
      flag:2,
      vals:"photoList"
    }
    this.photoList=await this.returnloadAjxss(canshu)
    
  }
    
  
})
 
 
 
Vue.component('parts-change-all', {
  // 声明 props
  props: ['machinetype'],
  // 同样也可以在 vm 实例中像 "this.message" 这样使用
  template: `
              <el-table :data="machineChange" width="100%" height='100%'>
                <el-table-column 
                  v-for="(item,keys,index) in machineChangeHead[0]" 
                  :prop="keys" 
                  :label="item" 
                  
                >
                  <template v-slot="scope"  v-if="keys=='5_surpass' && Object.keys(machineChange[0]).length!=0">
                    <el-button 
                      :style="machineChange[scope.$index]['5_surpass']==1?textColor:null"
                      type="text"
                      size="small"
                      v-preventreclick
                      @click="partsChange(scope.$index, machineChange,0)"
                    >
                      更换
                    </el-button>
                  </template>    
                </el-table-column>
              </el-table>`
  ,
  mixins: [mixin],
  data(){
    return{
      centerDialogVisible:true,
      machineChange:[{}],
      machineChangeHead:[{}],
      machineId:null,
      textColor:{
        color:'orange'
      }
    }
 
  },
  methods:{
    partsChange(index,data,type){//修改零部件更换周期,type: 0代表单个零部件,1代表此机器所有零部件
      
      let para
      if(type==0){
        para={
          id:data[index]['7_id'],
          machineId:data[index]['6_machine_id'],
          type:type
        }
      }else{
        para={
          id:0,
          machineId:this.machineId,
          type:type
        }
      }
      let sql="{call AXJ_a_largeScreen_machinePartsChange_update(?,?,?,?)}~"+JSON.stringify(para);
      this.connects("更新耗材:",sql,1,1);
      this.centerDialogVisible = false
    }
  },
  watch: {
    async machineId(){
      
    }
  },
  async mounted() {
    let parameter={
      gongneng:'大屏更换周期表头查询',
      sql:"{call AXJ_a_largeScreen_machinePartsChangeHead_select()}",
      flag:2,
      vals:"machineChangeHead"
    }
    this.machineChangeHead=await this.returnloadAjxss(parameter)
 
    let machine={
      type:this.machinetype
    }
    let canshu={
      gongneng:'大屏更换周期机器零部件查询,机器类型:'+this.machinetype,
      sql:"{call AXJ_a_largeScreen_machinePartsChange_type_select(?,?)}~"+JSON.stringify(machine),
      flag:2,
      vals:"machineChange"
    }
    //this.machineChange=
    await setInterval(async () => {
      this.machineChange= await app.returnloadAjxss(canshu); 
    },5000)
    
  
  }
  
})