-
-
+
+
+
+
-
-
+
+
+
+
+
+
-
- {{ $t(key('search')) }}
-
-
- {{ $t(key('reset')) }}
-
+ {{ $t(key('search')) }}
+ {{ $t(key('reset')) }}
@@ -41,6 +42,8 @@
:toolbar-buttons="toolbarButtons"
:row-buttons="rowButtons"
:pagination="pagination"
+ :table-attrs="{ highlightCurrentRow: true }"
+ :table-listeners="{ 'sort-change': handleSort }"
help-url="/help/quality-management/first-article-inspection-configuration"
:help-text="$t(ckey('help'))"
auto-height
@@ -52,7 +55,7 @@
ref="dialogForm"
:visible.sync="dialogVisible"
:title="dialogTitle"
- width="520px"
+ width="560px"
:form-cols="formCols"
:form-data="formData"
:rules="rules"
@@ -62,7 +65,22 @@
:cancel-text="key('cancel')"
@submit="onDialogSubmit"
@close="onDialogClose"
- />
+ >
+
+
+ {{ $t(key('is_required')) }}
+
+
+
+
+
+ {{ $t(key('yes')) }}
+ {{ $t(key('no')) }}
+
+
+
+
+
@@ -75,10 +93,13 @@ import {
fetchFirstArticleInspectionConfigurationList,
createFirstArticleInspectionConfiguration,
editFirstArticleInspectionConfiguration,
- deleteFirstArticleInspectionConfiguration
+ deleteFirstArticleInspectionConfiguration,
+ getQualityCategoryAll,
+ getWorkingsubclassAll
} from '@/api/quality-management/first-article-inspection-configuration'
import PageTable from '@/components/page-table'
import PageDialogForm from '@/components/page-dialog-form'
+import SettingItemsDialog from './components/SettingItemsDialog'
function readList (res) {
if (Array.isArray(res)) return { list: res, total: res.length }
@@ -91,7 +112,7 @@ function readList (res) {
export default {
name: 'quality-management-first-article-inspection-configuration',
- components: { PageTable, PageDialogForm },
+ components: { PageTable, PageDialogForm, SettingItemsDialog },
mixins: [i18nMixin('page.quality_management.first_article_inspection_configuration'), confirmMixin],
data () {
return {
@@ -101,120 +122,87 @@ export default {
selectedRows: [],
dialogVisible: false,
dialogTitle: '',
+ itemsDialogVisible: false,
+ currentSetting: null,
editId: '',
handleType: 'create',
- search: {"code":"","name":""},
+ search: { workingsubclass_id: undefined, type: undefined, create_time: undefined },
+ order: { order_type: undefined, order_field: undefined },
pagination: { current: 1, size: 10, total: 0 },
- formData: {"code":"","name":"","category_id":"","note":""},
+ workingsubclassOptions: [],
+ categoryOptions: [],
+ formData: { workingsubclass_id: undefined, quality_category_id: undefined, note: '', is_need: 0 },
rules: {
- code: [
- { required: true, message: this.key('required'), trigger: 'blur' }
- ],
- name: [
- { required: true, message: this.key('required'), trigger: 'blur' }
- ]
+ workingsubclass_id: [{ required: true, message: this.key('process_unit_required'), trigger: 'change' }],
+ quality_category_id: [{ required: true, message: this.key('inspection_type_required'), trigger: 'change' }]
},
columns: [],
toolbarButtons: [],
- rowButtons: [],
- formCols: [
+ rowButtons: []
+ }
+ },
+ computed: {
+ formCols () {
+ return [
[
- {
- type: 'input',
- prop: 'code',
- label: this.key('code'),
- placeholder: this.key('please_enter'),
- clearable: true,
- style: { width: '90%' }
- }
+ { type: 'select', prop: 'workingsubclass_id', label: this.key('process_unit'), placeholder: this.key('please_select'), options: this.workingsubclassOptions.map(item => ({ label: item.name, value: item.id })), clearable: true, style: { width: '90%' } }
],
[
- {
- type: 'input',
- prop: 'name',
- label: this.key('name'),
- placeholder: this.key('please_enter'),
- clearable: true,
- style: { width: '90%' }
- }
+ { type: 'select', prop: 'quality_category_id', label: this.key('inspection_type'), placeholder: this.key('please_select'), options: this.categoryOptions.map(item => ({ label: item.name, value: item.id })), clearable: true, style: { width: '90%' } }
],
[
- {
- type: 'input',
- prop: 'category_id',
- label: this.key('category_id'),
- placeholder: this.key('please_enter'),
- clearable: true,
- style: { width: '90%' }
- }
- ],
- [
- {
- type: 'input',
- prop: 'note',
- label: this.key('remark'),
- placeholder: this.key('please_enter'),
- clearable: true,
- style: { width: '90%' }
- }
+ { type: 'input', prop: 'note', label: this.key('remark'), placeholder: this.key('please_enter'), clearable: true, style: { width: '90%' } }
]
]
}
},
created () {
this.columns = useTableColumns([
- { prop: 'code', label: this.key('code'), minWidth: 130 },
- { prop: 'name', label: this.key('name'), minWidth: 130 },
- { prop: 'category_name', label: this.key('category_name'), minWidth: 170 },
- { prop: 'note', label: this.key('remark'), minWidth: 130 },
- { prop: 'create_date', label: this.key('create_date'), minWidth: 130 },
- { prop: '_actions', label: this.key('operation'), width: 160, fixed: 'right' }
+ { prop: 'workingsubclass_name', label: this.key('process_unit'), minWidth: 150, sortable: 'custom', showOverflowTooltip: true },
+ { prop: 'quality_category_name', label: this.key('inspection_type'), minWidth: 150, sortable: 'custom', showOverflowTooltip: true },
+ { prop: 'nickname', label: this.key('creator'), minWidth: 130, sortable: 'custom', showOverflowTooltip: true },
+ { prop: 'create_date', label: this.key('create_time'), minWidth: 160, sortable: 'custom', showOverflowTooltip: true },
+ { prop: 'note', label: this.key('remark'), minWidth: 150, sortable: 'custom', showOverflowTooltip: true },
+ { prop: '_actions', label: this.key('operation'), width: 220, fixed: 'right' }
])
const btns = useTableButtons({
toolbar: [
- {
- key: 'add',
- label: this.key('add'),
- icon: 'el-icon-plus',
- type: 'primary',
- auth: '/quality_control/first_inspection/setting/create',
- onClick: this.openAdd
- }
+ { key: 'add', label: this.key('add'), icon: 'el-icon-plus', type: 'primary', auth: '/quality_control/first_inspection/setting/add', onClick: this.openAdd },
+ { key: 'batch_delete', label: this.key('delete'), icon: 'el-icon-delete', type: 'danger', auth: '/quality_control/first_inspection/setting/delete', onClick: this.handleBatchDelete }
],
row: [
- {
- key: 'edit',
- label: this.key('edit'),
- icon: 'el-icon-edit',
- auth: '/quality_control/first_inspection/setting/edit',
- onClick: this.openEdit
- },
- {
- key: 'delete',
- label: this.key('delete'),
- icon: 'el-icon-delete',
- color: 'danger',
- auth: '/quality_control/first_inspection/setting/delete',
- onClick: this.handleDelete
- }
+ { key: 'edit', label: this.key('edit'), icon: 'el-icon-edit', auth: '/quality_control/first_inspection/setting/update', onClick: this.openEdit },
+ { key: 'configure_item', label: this.key('configure_item'), icon: 'el-icon-setting', auth: '/quality_control/first_inspection/setting/update', onClick: this.openItemsDialog },
+ { key: 'delete', label: this.key('delete'), icon: 'el-icon-delete', color: 'danger', auth: '/quality_control/first_inspection/setting/delete', onClick: this.handleDelete }
]
}, this.$permission)
this.toolbarButtons = btns.toolbarButtons
this.rowButtons = btns.rowButtons
+ this.fetchOptions()
this.fetchData()
},
methods: {
+ async fetchOptions () {
+ const [workingsubclassRes, categoryRes] = await Promise.all([getWorkingsubclassAll(), getQualityCategoryAll()])
+ this.workingsubclassOptions = this.normalizeList(workingsubclassRes)
+ this.categoryOptions = this.normalizeList(categoryRes)
+ },
+ normalizeList (res) {
+ if (Array.isArray(res)) return res
+ if (res && Array.isArray(res.data)) return res.data
+ if (res && res.data && Array.isArray(res.data.data)) return res.data.data
+ if (res && Array.isArray(res.list)) return res.list
+ return []
+ },
async fetchData () {
this.loading = true
try {
- const params = {
+ const res = await fetchFirstArticleInspectionConfigurationList({
...this.search,
+ ...this.order,
page_no: this.pagination.current,
- page_size: this.pagination.size,
- page: this.pagination.current,
- size: this.pagination.size
- }
- const res = await fetchFirstArticleInspectionConfigurationList(params)
+ page_size: this.pagination.size
+ })
const { list, total } = readList(res)
this.tableData = list
this.pagination.total = total
@@ -227,7 +215,7 @@ export default {
this.fetchData()
},
onReset () {
- this.search = {"code":"","name":""}
+ this.search = { workingsubclass_id: undefined, type: undefined, create_time: undefined }
this.pagination.current = 1
this.fetchData()
},
@@ -239,21 +227,36 @@ export default {
onSelect (rows) {
this.selectedRows = rows
},
+ handleSort ({ column, prop, order }) {
+ this.order = {
+ order_type: column && order ? (order === 'ascending' ? 'asc' : 'desc') : undefined,
+ order_field: column && order ? prop : undefined
+ }
+ this.fetchData()
+ },
resetForm () {
- this.formData = {"code":"","name":"","category_id":"","note":""}
+ this.formData = { workingsubclass_id: undefined, quality_category_id: undefined, note: '', is_need: 0 }
this.editId = ''
},
openAdd () {
this.handleType = 'create'
this.dialogTitle = this.key('add_title')
- this.resetForm()
- this.dialogVisible = true
+ this.$nextTick(() => {
+ this.$refs.dialogForm && this.$refs.dialogForm.reset()
+ this.resetForm()
+ this.dialogVisible = true
+ })
},
openEdit (row) {
this.handleType = 'edit'
this.dialogTitle = this.key('edit_title')
this.editId = row.id
- this.formData = { ...{"code":"","name":"","category_id":"","note":""}, ...row }
+ this.formData = {
+ workingsubclass_id: row.workingsubclass_id,
+ quality_category_id: row.quality_category_id,
+ note: row.note || '',
+ is_need: Number(row.is_need || 0)
+ }
this.dialogVisible = true
},
async onDialogSubmit () {
@@ -274,11 +277,34 @@ export default {
onDialogClose () {
this.resetForm()
},
+ openItemsDialog (row) {
+ this.currentSetting = row
+ this.itemsDialogVisible = true
+ },
async handleDelete (row) {
const cancelled = await this.$confirmAction({
message: this.key('confirm_delete'),
- title: this.key('tip')
- }, () => deleteFirstArticleInspectionConfiguration({ id: [row.id], ids: [row.id], inspection_order_no: row.inspection_order_no }))
+ title: this.key('tip'),
+ confirmButtonText: this.key('confirm'),
+ cancelButtonText: this.key('cancel'),
+ closeOnClickModal: false
+ }, () => deleteFirstArticleInspectionConfiguration({ id: [row.id] }))
+ if (cancelled) return
+ this.$message.success(this.$t(this.key('operation_success')))
+ this.fetchData()
+ },
+ async handleBatchDelete () {
+ if (!this.selectedRows.length) {
+ this.$message.error(this.$t(this.key('select_operate_data')))
+ return
+ }
+ const cancelled = await this.$confirmAction({
+ message: this.key('confirm_delete'),
+ title: this.key('tip'),
+ confirmButtonText: this.key('confirm'),
+ cancelButtonText: this.key('cancel'),
+ closeOnClickModal: false
+ }, () => deleteFirstArticleInspectionConfiguration({ id: this.selectedRows.map(item => item.id) }))
if (cancelled) return
this.$message.success(this.$t(this.key('operation_success')))
this.fetchData()
@@ -291,11 +317,6 @@ export default {
.search-bar {
padding: 10px 0;
}
-.spc-chart-panel {
- height: 320px;
- margin-bottom: 12px;
- border: 1px solid #ebeef5;
-}
/deep/ .el-form-item--mini.el-form-item {
margin-bottom: 4px;
}