This commit is contained in:
lb
2023-11-23 17:07:57 +08:00
parent e318aa4f59
commit 0225be1c94
18 changed files with 575 additions and 380 deletions

View File

@@ -72,10 +72,10 @@ const remainBox = {
},
computed: {
value() {
const temp = this.injectData[this.injectData.prop] || null
const temp = this.injectData[this.injectData.prop] || null;
if (temp) {
console.log('12', temp)
return temp === 'Green' ? 'green' : 'red'
console.log('12', temp);
return temp === 'Green' ? 'green' : 'red';
}
return this.injectData[this.injectData.prop] || null;
},
@@ -83,7 +83,7 @@ const remainBox = {
if (this.value) {
// const v = +this.value;
// return v < 0 ? 'red' : v >= 0 && v < 2 ? 'yellow' : 'green';
return this.value
return this.value;
}
return 'unset';
},
@@ -95,8 +95,7 @@ const remainBox = {
this.color
// this.color == 'Green' ? 'green' : this.color == 'Red' ? 'red' : 'yellow'
}; position:absolute; inset: 0; padding: 0 10px; display: flex; align-items: center; color: ${
'unset'
// this.color == 'red' ? '#fff' : 'unset'
this.color == 'red' || this.color == 'green' ? '#fff' : 'unset'
}`}>
{this.injectData[this.injectData.prop] || ''}
</div>
@@ -112,7 +111,10 @@ const btn = {
},
methods: {
handleClick() {
this.$emit('emitData', { action: this.injectData.name, value: this.injectData });
this.$emit('emitData', {
action: this.injectData.name,
value: this.injectData,
});
},
},
render: function (h) {
@@ -124,8 +126,6 @@ const btn = {
},
};
export default {
name: 'EquipmentSparePartsMonitor',
components: { addSparts },
@@ -162,7 +162,12 @@ export default {
{ prop: 'responsible', label: '负责人' },
{ prop: 'color', label: '是否超期', subcomponent: remainBox },
{ prop: 'opt1', label: '备件更换', name: '操作', subcomponent: btn },
{ prop: 'opt2', label: '更换记录', name: '更新记录', subcomponent: btn }, // TODO: 是否换成按钮, 群里问
{
prop: 'opt2',
label: '更换记录',
name: '更新记录',
subcomponent: btn,
}, // TODO: 是否换成按钮, 群里问
// { prop: 'remark', label: '备注' },
],
searchBarFormConfig: [
@@ -171,12 +176,14 @@ export default {
label: '产线',
placeholder: '请选择产线',
param: 'lineId',
filterable: true,
},
{
type: 'select',
label: '设备',
placeholder: '请选择设备',
param: 'equipmentId',
filterable: true,
},
{
type: 'button',
@@ -211,7 +218,9 @@ export default {
input: true,
label: '配置名称',
prop: 'name',
rules: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
],
},
],
[
@@ -224,7 +233,9 @@ export default {
filterable: true,
clearable: true,
},
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '设备名称不能为空', trigger: 'blur' },
],
},
],
[
@@ -281,29 +292,29 @@ export default {
}
},
eqOperation({ id }) {
this.addOrUpdateVisible = true
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
updateLog({ id }) {
this.addOrUpdateVisible = true
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true);
});
},
initSearchBar() {
// 产线列表
getCorePLList().then(res => {
getCorePLList().then((res) => {
this.$set(
this.searchBarFormConfig[0],
'selectOptions',
res.data.map((item) => ({
name: item.name,
id: item.id
id: item.id,
}))
);
})
});
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.$set(
this.searchBarFormConfig[1],
@@ -319,7 +330,11 @@ export default {
getList() {
this.loading = true;
// 执行查询
this.http('/base/equipment-spare-part-config/monitor', 'get', this.queryParams).then((response) => {
this.http(
'/base/equipment-spare-part-config/monitor',
'get',
this.queryParams
).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
@@ -338,7 +353,7 @@ export default {
name: null,
equipmentId: null,
description: null,
responsible: null
responsible: null,
};
this.resetForm('form');
},
@@ -397,7 +412,7 @@ export default {
this.$modal
.confirm('是否确认删除记录"' + row.name + '"?')
.then(function () {
return this.delete({ id });
return this.del({ id });
})
.then(() => {
this.getList();