|
|
|
@ -1,9 +1,24 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<avue-crud :height="460" :option="option" v-model:search="search" :table-loading="loading" :data="data" v-model:page="page" :before-open="beforeOpen" |
|
|
|
<avue-crud |
|
|
|
v-model="form" ref="crud" @row-update="rowUpdate" |
|
|
|
:height="460" |
|
|
|
@search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
|
|
|
:option="option" |
|
|
|
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
|
|
|
v-model:search="search" |
|
|
|
|
|
|
|
:table-loading="loading" |
|
|
|
|
|
|
|
:data="data" |
|
|
|
|
|
|
|
v-model:page="page" |
|
|
|
|
|
|
|
:before-open="beforeOpen" |
|
|
|
|
|
|
|
v-model="form" |
|
|
|
|
|
|
|
ref="crud" |
|
|
|
|
|
|
|
@row-update="rowUpdate" |
|
|
|
|
|
|
|
@search-change="searchChange" |
|
|
|
|
|
|
|
@search-reset="searchReset" |
|
|
|
|
|
|
|
@selection-change="selectionChange" |
|
|
|
|
|
|
|
@current-change="currentChange" |
|
|
|
|
|
|
|
@size-change="sizeChange" |
|
|
|
|
|
|
|
@refresh-change="refreshChange" |
|
|
|
|
|
|
|
@on-load="onLoad" |
|
|
|
|
|
|
|
> |
|
|
|
<template #menu-left> |
|
|
|
<template #menu-left> |
|
|
|
<el-button type="primary" @click="handleAdd">新 增</el-button> |
|
|
|
<el-button type="primary" @click="handleAdd">新 增</el-button> |
|
|
|
<!-- <el-button type="primary" @click="handleSet">批量设置分类</el-button> --> |
|
|
|
<!-- <el-button type="primary" @click="handleSet">批量设置分类</el-button> --> |
|
|
|
@ -19,7 +34,7 @@ |
|
|
|
<el-button plain type="danger" @click="remove">删除选择行</el-button> |
|
|
|
<el-button plain type="danger" @click="remove">删除选择行</el-button> |
|
|
|
<!-- <el-button type="primary" @click="handleSave">保存</el-button> --> |
|
|
|
<!-- <el-button type="primary" @click="handleSave">保存</el-button> --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div style="margin-top: 20px;"> |
|
|
|
<div style="margin-top: 20px"> |
|
|
|
<el-table :data="tidList" @selection-change="selectionChangeProject" @select="selectChange"> |
|
|
|
<el-table :data="tidList" @selection-change="selectionChangeProject" @select="selectChange"> |
|
|
|
<el-table-column type="selection" width="55px"></el-table-column> |
|
|
|
<el-table-column type="selection" width="55px"></el-table-column> |
|
|
|
<el-table-column label="编码" prop="code"> |
|
|
|
<el-table-column label="编码" prop="code"> |
|
|
|
@ -32,6 +47,11 @@ |
|
|
|
<el-input v-model="scope.row.name"></el-input> |
|
|
|
<el-input v-model="scope.row.name"></el-input> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="定额工时" prop="standardWorkMinute"> |
|
|
|
|
|
|
|
<template #default="scope"> |
|
|
|
|
|
|
|
<el-input v-model="scope.row.standardWorkMinute"></el-input> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="类型" prop="itemType"> |
|
|
|
<el-table-column label="类型" prop="itemType"> |
|
|
|
<template #default="scope"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-select v-model="scope.row.itemType" placeholder="请选择" style="width: 240px"> |
|
|
|
<el-select v-model="scope.row.itemType" placeholder="请选择" style="width: 240px"> |
|
|
|
@ -57,7 +77,14 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import {getList,getType,addItem,getDetail,deleteItem,editItem} from '@/api/productionInspection/trialItem' |
|
|
|
import { |
|
|
|
|
|
|
|
getList, |
|
|
|
|
|
|
|
getType, |
|
|
|
|
|
|
|
addItem, |
|
|
|
|
|
|
|
getDetail, |
|
|
|
|
|
|
|
deleteItem, |
|
|
|
|
|
|
|
editItem, |
|
|
|
|
|
|
|
} from '@/api/productionInspection/trialItem'; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
@ -155,7 +182,7 @@ export default { |
|
|
|
span: 24, |
|
|
|
span: 24, |
|
|
|
search: true, |
|
|
|
search: true, |
|
|
|
searchLabelWidth: 50, |
|
|
|
searchLabelWidth: 50, |
|
|
|
type:"select", |
|
|
|
type: 'select', |
|
|
|
dicUrl: '/blade-system/dict/dictionary?code=InspectionItem-ItemType', |
|
|
|
dicUrl: '/blade-system/dict/dictionary?code=InspectionItem-ItemType', |
|
|
|
props: { label: 'dictValue', value: 'dictKey' }, |
|
|
|
props: { label: 'dictValue', value: 'dictKey' }, |
|
|
|
// dicData:[ |
|
|
|
// dicData:[ |
|
|
|
@ -176,27 +203,43 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
] |
|
|
|
{ |
|
|
|
|
|
|
|
label: '额定工时', |
|
|
|
|
|
|
|
prop: 'standardWorkMinute', |
|
|
|
|
|
|
|
addDisplay: false, |
|
|
|
|
|
|
|
// editDisplay: false, |
|
|
|
|
|
|
|
span: 24, |
|
|
|
|
|
|
|
search: true, |
|
|
|
|
|
|
|
searchLabelWidth: 50, |
|
|
|
|
|
|
|
rules: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
required: true, |
|
|
|
|
|
|
|
message: '请输入名称', |
|
|
|
|
|
|
|
trigger: 'click', |
|
|
|
}, |
|
|
|
}, |
|
|
|
typeList:[] |
|
|
|
], |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
typeList: [], |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.getTypeList() |
|
|
|
this.getTypeList(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getTypeList() { |
|
|
|
getTypeList() { |
|
|
|
getType().then(res => { |
|
|
|
getType().then(res => { |
|
|
|
this.typeList = res.data.data |
|
|
|
this.typeList = res.data.data; |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleAdd() { |
|
|
|
handleAdd() { |
|
|
|
this.showDialog = true |
|
|
|
this.showDialog = true; |
|
|
|
this.tidList = [] |
|
|
|
this.tidList = []; |
|
|
|
}, |
|
|
|
}, |
|
|
|
insertEvent() { |
|
|
|
insertEvent() { |
|
|
|
const record = { _select: false }; |
|
|
|
const record = { _select: false }; |
|
|
|
this.tidList.push(record) |
|
|
|
this.tidList.push(record); |
|
|
|
}, |
|
|
|
}, |
|
|
|
searchChange(params, done) { |
|
|
|
searchChange(params, done) { |
|
|
|
this.page.currentPage = 1; |
|
|
|
this.page.currentPage = 1; |
|
|
|
@ -204,9 +247,9 @@ export default { |
|
|
|
done(); |
|
|
|
done(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
searchReset() { |
|
|
|
searchReset() { |
|
|
|
this.page.currentPage = 1 |
|
|
|
this.page.currentPage = 1; |
|
|
|
this.search = {} |
|
|
|
this.search = {}; |
|
|
|
this.onLoad() |
|
|
|
this.onLoad(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
currentChange(currentPage) { |
|
|
|
currentChange(currentPage) { |
|
|
|
this.page.currentPage = currentPage; |
|
|
|
this.page.currentPage = currentPage; |
|
|
|
@ -218,7 +261,7 @@ export default { |
|
|
|
this.onLoad(); |
|
|
|
this.onLoad(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
remove() { |
|
|
|
remove() { |
|
|
|
let arr = this.tidList.filter(item => item._select) |
|
|
|
let arr = this.tidList.filter(item => item._select); |
|
|
|
if (arr.length != 0) { |
|
|
|
if (arr.length != 0) { |
|
|
|
this.$confirm('确定将选择数据删除?', { |
|
|
|
this.$confirm('确定将选择数据删除?', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
confirmButtonText: '确定', |
|
|
|
@ -226,49 +269,49 @@ export default { |
|
|
|
type: 'warning', |
|
|
|
type: 'warning', |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
if (this.rowId) { |
|
|
|
if (this.rowId) { |
|
|
|
let deleteData = this.tidList.filter(item => item._select) |
|
|
|
let deleteData = this.tidList.filter(item => item._select); |
|
|
|
this.deleteTidArr = deleteData.filter(item => item.tidId) |
|
|
|
this.deleteTidArr = deleteData.filter(item => item.tidId); |
|
|
|
} |
|
|
|
} |
|
|
|
let deleteArr = this.tidList.filter(item => !item._select) |
|
|
|
let deleteArr = this.tidList.filter(item => !item._select); |
|
|
|
this.tidList = deleteArr |
|
|
|
this.tidList = deleteArr; |
|
|
|
}) |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$message.error('请至少选择一条数据进行操作!') |
|
|
|
this.$message.error('请至少选择一条数据进行操作!'); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
selectChange(list, row) { |
|
|
|
selectChange(list, row) { |
|
|
|
row._select = !row._select |
|
|
|
row._select = !row._select; |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleEdit(row, index) { |
|
|
|
handleEdit(row, index) { |
|
|
|
getDetail({ id: row.id }).then(res => { |
|
|
|
getDetail({ id: row.id }).then(res => { |
|
|
|
res.data.data.itemType = res.data.data.itemType + '' |
|
|
|
res.data.data.itemType = res.data.data.itemType + ''; |
|
|
|
this.$refs.crud.rowEdit(res.data.data, index) |
|
|
|
this.$refs.crud.rowEdit(res.data.data, index); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
rowUpdate(form, index, done, loading) { |
|
|
|
rowUpdate(form, index, done, loading) { |
|
|
|
editItem(form).then(res => { |
|
|
|
editItem(form).then(res => { |
|
|
|
if (res.data.code == 200) { |
|
|
|
if (res.data.code == 200) { |
|
|
|
this.$message.success('修改成功') |
|
|
|
this.$message.success('修改成功'); |
|
|
|
this.onLoad() |
|
|
|
this.onLoad(); |
|
|
|
done() |
|
|
|
done(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleSave() { |
|
|
|
handleSave() { |
|
|
|
if (this.tidList.length == 0) { |
|
|
|
if (this.tidList.length == 0) { |
|
|
|
this.$message.error('请至少填写一条数据') |
|
|
|
this.$message.error('请至少填写一条数据'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
let tmp = this.tidList.find(item => !item.code || !item.name || !item.itemType) |
|
|
|
let tmp = this.tidList.find(item => !item.code || !item.name || !item.itemType); |
|
|
|
if (tmp) { |
|
|
|
if (tmp) { |
|
|
|
this.$message.error('数据请填写完整!') |
|
|
|
this.$message.error('数据请填写完整!'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
addItem(this.tidList).then(res => { |
|
|
|
addItem(this.tidList).then(res => { |
|
|
|
if (res.data.code == 200) { |
|
|
|
if (res.data.code == 200) { |
|
|
|
this.$message.success('新增成功') |
|
|
|
this.$message.success('新增成功'); |
|
|
|
this.showDialog = false |
|
|
|
this.showDialog = false; |
|
|
|
this.onLoad() |
|
|
|
this.onLoad(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -280,20 +323,21 @@ export default { |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
deleteItem({ ids: row.id }).then(res => { |
|
|
|
deleteItem({ ids: row.id }).then(res => { |
|
|
|
if (res.data.code == 200) { |
|
|
|
if (res.data.code == 200) { |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.$message.success('删除成功'); |
|
|
|
this.onLoad() |
|
|
|
this.onLoad(); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
onLoad() { |
|
|
|
this.loading = true |
|
|
|
this.loading = true; |
|
|
|
getList({current:this.page.currentPage,size:this.page.pageSize,...this.search}).then(res =>{ |
|
|
|
getList({ current: this.page.currentPage, size: this.page.pageSize, ...this.search }).then( |
|
|
|
this.data = res.data.data.records |
|
|
|
res => { |
|
|
|
this.page.total = res.data.data.total |
|
|
|
this.data = res.data.data.records; |
|
|
|
this.loading = false |
|
|
|
this.page.total = res.data.data.total; |
|
|
|
}) |
|
|
|
this.loading = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
// this.data = [ |
|
|
|
// this.data = [ |
|
|
|
// { amId: 3, code: '003', name: '泄漏率检测' }, |
|
|
|
// { amId: 3, code: '003', name: '泄漏率检测' }, |
|
|
|
// { amId: 4, code: '002', name: '外观检测' }, |
|
|
|
// { amId: 4, code: '002', name: '外观检测' }, |
|
|
|
@ -301,8 +345,8 @@ export default { |
|
|
|
// ] |
|
|
|
// ] |
|
|
|
// this.loading = false |
|
|
|
// this.loading = false |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style></style> |
|
|
|
<style></style> |