forked from mt-fe-group/mt-yd-ui
Compare commits
6 Commits
0ddba21e1c
...
b3aba50b09
Author | SHA1 | Date | |
---|---|---|---|
b3aba50b09 | |||
3f2e8e8b9e | |||
db5b5091e1 | |||
0ef30e1985 | |||
cd9beb120a | |||
a1056abe80 |
@ -122,6 +122,7 @@ export default {
|
||||
name: '名称',
|
||||
code: '编码',
|
||||
remark: '备注',
|
||||
description: '描述',
|
||||
specifications: '规格'
|
||||
// add more...
|
||||
}
|
||||
@ -140,6 +141,7 @@ export default {
|
||||
name: '名称',
|
||||
code: '编码',
|
||||
remark: '备注',
|
||||
description: '描述',
|
||||
specifications: '规格'
|
||||
// add more...
|
||||
},
|
||||
@ -148,9 +150,10 @@ export default {
|
||||
visible: false,
|
||||
isEdit: false,
|
||||
isDetail: false,
|
||||
isUpdated: false,
|
||||
dataForm: {},
|
||||
dataFormRules: {},
|
||||
tempForm: [], // 临时保存自动生成的code,或其他数据
|
||||
shouldWait: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -180,12 +183,14 @@ export default {
|
||||
this.$set(this.dataForm, [item.name], '')
|
||||
if (item.api) {
|
||||
/** 自动请求并填充 */
|
||||
this.$http({
|
||||
// or this.shouldWaitPool = []
|
||||
this.shouldWait = this.$http({
|
||||
url: this.$http.adornUrl(item.api),
|
||||
method: 'POST' // 也可以改成动态决定
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.dataForm[item.name] = res.data // <=== 此处需要对接口
|
||||
// this.dataForm[item.name] = res.data // <=== 此处需要对接口
|
||||
this.tempForm.push({ name: item.name, data: res.data })
|
||||
}
|
||||
})
|
||||
} // end if (item.api)
|
||||
@ -234,9 +239,6 @@ export default {
|
||||
this.$set(this.dataForm, 'id', null)
|
||||
})
|
||||
},
|
||||
updated() {
|
||||
this.isUpdated = true // 此时如果点击保存就会 emit(refreshDataList)
|
||||
},
|
||||
|
||||
methods: {
|
||||
getLabel(n, c) {
|
||||
@ -251,7 +253,17 @@ export default {
|
||||
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
|
||||
if (opt) {
|
||||
// if opt is valid
|
||||
return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name]
|
||||
return opt.placeholder
|
||||
? opt.placeholder
|
||||
: this.defaultPlaceholders[opt.name]
|
||||
? this.defaultPlaceholders[opt.name]
|
||||
: opt.label
|
||||
? (opt.type === 'select' ? '请选择' : '请输入') + opt.label
|
||||
: null
|
||||
|
||||
// : opt.type === 'select'
|
||||
// ? '请选择'
|
||||
// : '请输入'
|
||||
}
|
||||
},
|
||||
|
||||
@ -284,6 +296,16 @@ export default {
|
||||
this.dataForm = pick(res.data, dataFormKeys)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
/** 如果不是编辑,就填充自动生成的数据 */
|
||||
if (this.shouldWait)
|
||||
this.shouldWait.then(() => {
|
||||
if (this.tempForm.length) {
|
||||
this.tempForm.forEach(item => {
|
||||
this.dataForm[item.name] = item.data
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -305,19 +327,29 @@ export default {
|
||||
url: this.$http.adornUrl(urls[btn.name]),
|
||||
method: btn.name === 'save' ? 'POST' : 'PUT',
|
||||
data: this.dataForm
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message({
|
||||
message: btn.name === 'save' ? '添加成功!' : '更新成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message({
|
||||
message: btn.name === 'save' ? '添加成功!' : '更新成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message({
|
||||
message: err,
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
@ -339,7 +371,7 @@ export default {
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
if (this.isAdd || this.isUpdated) this.$emit('refreshDataList')
|
||||
this.$emit('destory-dialog')
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,9 @@ http.interceptors.response.use(response => {
|
||||
router.replace({ name: 'login' })
|
||||
return Promise.reject(response.data.msg)
|
||||
}
|
||||
// else if (response.data.code === 500) {
|
||||
// return Promise.reject(response.data.msg)
|
||||
// }
|
||||
return response
|
||||
}, error => {
|
||||
console.error(error)
|
||||
|
@ -137,7 +137,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipment'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -153,7 +153,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentAlarmLog'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -162,7 +162,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentFile'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -6,8 +6,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmengroup:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentgroup:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
@ -33,7 +32,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -45,12 +44,13 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentGroup-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './equipmentGroup-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
@ -61,22 +61,15 @@ const tableConfigs = [
|
||||
{ prop: 'code', name: '分组编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'alarm', name: '报警', buttonContent: '查看报警', subcomponent: TableTextComponent },
|
||||
// { "prop": "typeId", "name": "设备类型id" },
|
||||
// { "prop": "id", "name": "ID" },
|
||||
// { "prop": "description", "name": "描述" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "updateTime", "name": "更新时间" },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -100,6 +93,7 @@ export default {
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroup/page'),
|
||||
@ -135,6 +129,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -157,7 +159,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroup'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -175,7 +175,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentGroupAlarm'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -171,7 +171,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlc'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -151,7 +151,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlcConnect'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -183,7 +183,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentPlcParam'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -165,7 +165,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentQuantity'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -159,7 +159,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentStatusLog'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -6,8 +6,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentype:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
<el-button v-if="$hasPermission('monitoring:equipmenttype:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
@ -35,7 +34,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -47,12 +46,13 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentType-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './equipmentType-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
@ -62,24 +62,15 @@ const tableConfigs = [
|
||||
{ prop: 'name', name: '类型名称' },
|
||||
{ prop: 'code', name: '类型编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { "prop": "id", "name": "ID" },
|
||||
// { "prop": "parentId", "name": "父类ID" },
|
||||
// { "prop": "parentName", "name": "父类名称" },
|
||||
// { "prop": "description", "name": "描述" },
|
||||
// { "prop": "enabled", "name": "启用状态:0 、停用,1、启用" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "updateTime", "name": "更新时间" },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -103,6 +94,7 @@ export default {
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentType/page'),
|
||||
@ -138,6 +130,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -160,7 +160,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentType'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -160,7 +160,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentTypeFile'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -154,7 +154,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentAttr'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -7,7 +7,6 @@
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:factory:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
@ -35,7 +34,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -47,12 +46,13 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './factory-add-or-update'
|
||||
// import AddOrUpdate from './factory-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
@ -63,23 +63,37 @@ const tableConfigs = [
|
||||
{ prop: 'code', name: '工厂编码' },
|
||||
{ prop: 'address', name: '地址' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { prop: 'id', name: 'id' },
|
||||
// { prop: 'description', name: '描述' },
|
||||
// { prop: 'enabled', name: '启用状态:0 、停用,1、启用' },
|
||||
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
// { prop: 'creatorId', name: '创建人' },
|
||||
// { prop: 'creatorName', name: '创建人姓名' },
|
||||
// { prop: 'updaterId', name: '更新人' },
|
||||
// { prop: 'updaterName', name: '更新人姓名' },
|
||||
// { prop: 'updateTime', name: '更新时间' },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
// { prop: 'externalCode', name: '外部系统编码' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/factory',
|
||||
fields: [
|
||||
'name',
|
||||
{
|
||||
name: 'code',
|
||||
api: '/monitoring/factory/getCode'
|
||||
},
|
||||
{
|
||||
name: 'address',
|
||||
label: '地址',
|
||||
placeholder: '请输入地址'
|
||||
},
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'reset', url: true, showAlways: true },
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/factory', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/factory', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -103,6 +117,7 @@ export default {
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/factory/page'),
|
||||
@ -138,6 +153,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -160,7 +183,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/factory'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -6,8 +6,9 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button @click="addOrEdit()">测试</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<!-- <el-button @click="addOrEdit()">测试</el-button> -->
|
||||
<!-- <el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> -->
|
||||
<el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrEdit()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
@ -52,17 +53,17 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> -->
|
||||
|
||||
<base-dialog v-if="showbasedialog" ref="basedialog" :configs="addOrUpdateConfigs" @refreshDataList="getDataList"></base-dialog>
|
||||
<base-dialog v-if="showbasedialog" ref="basedialog" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="showbasedialog = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './product-add-or-update'
|
||||
// import AddOrUpdate from './product-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
import BaseDialog from '@/components/base-dialog/addOrUpdate'
|
||||
import moment from 'moment'
|
||||
import dictListMixin from '@/mixins/dictlist-module'
|
||||
@ -77,27 +78,7 @@ const tableConfigs = [
|
||||
{ prop: 'code', name: '产品编码' },
|
||||
{ prop: 'specifications', name: '规格' },
|
||||
{ prop: 'unitDictValue', name: '单位', filter: dictFilter(UnitDictTypeId) },
|
||||
// { prop: 'unitDictValue', name: '单位value,对应到数据字典label_value' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['viewAttr', 'delete'] }
|
||||
|
||||
// { "prop": "id", "name": "ID" },
|
||||
// { "prop": "description", "name": "描述" },
|
||||
// { "prop": "externalCode", "name": "外部编码,用于对照外部系统的编码" },
|
||||
// { "prop": "area", "name": "一单位的面积(平方米)" },
|
||||
// { "prop": "processTime", "name": "加工一单位产品需要的时间" },
|
||||
// {
|
||||
// "prop": "typeDictValue",
|
||||
// "name": "产品类型value,对应到数据字典label_value"
|
||||
// },
|
||||
// { "prop": "enabled", "name": "启用状态:0 、停用,1、启用" },
|
||||
// { "prop": "remark", "name": "备注" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "createTime", "name": "添加时间" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "version", "name": "版本号" }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
@ -113,10 +94,9 @@ const addOrUpdateConfigs = {
|
||||
name: 'processTime',
|
||||
label: '加工时间',
|
||||
placeholder: '请输入加工时间',
|
||||
type: 'number', // type: number(input+number) | default(input) | textarea | select(options在父组件里获取) | datetime
|
||||
type: 'number',
|
||||
required: true,
|
||||
rules: [
|
||||
// 除了required之外的验证规则
|
||||
{
|
||||
type: 'number',
|
||||
trigger: 'blur',
|
||||
@ -129,9 +109,6 @@ const addOrUpdateConfigs = {
|
||||
'specifications',
|
||||
{
|
||||
name: 'typeDictValue',
|
||||
// rules: [
|
||||
// {required: true, trigger: 'blur'}
|
||||
// ],
|
||||
label: '产品类型', // 对于非常见属性,最好自己指定label
|
||||
type: 'select',
|
||||
options: [
|
||||
@ -149,7 +126,6 @@ const addOrUpdateConfigs = {
|
||||
}
|
||||
],
|
||||
operations: [
|
||||
// { name: 'reset', url: true },
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/product', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/product', permission: '', showOnEdit: true }
|
||||
@ -166,13 +142,6 @@ const addOrUpdateConfigs = {
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
}
|
||||
// extraComponents: [
|
||||
// {
|
||||
// name: 'CompName',
|
||||
// label: 'markdown编辑器',
|
||||
// component: () => import('xx.vue')
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
|
||||
export default {
|
||||
@ -195,7 +164,7 @@ export default {
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
// AddOrUpdate,
|
||||
BaseTable,
|
||||
BaseDialog
|
||||
},
|
||||
@ -204,7 +173,6 @@ export default {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name) {
|
||||
if (item.name === 'typeDictValue') {
|
||||
console.log('dict : ', this.dictList)
|
||||
item.options = this.dictList[ProductTypeDictTypeId]
|
||||
} else if (item.name === 'unitDictValue') {
|
||||
item.options = this.dictList[UnitDictTypeId]
|
||||
|
@ -6,8 +6,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:producarrt:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
<el-button v-if="$hasPermission('monitoring:productarrt:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
@ -36,7 +35,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -48,40 +47,69 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" :configs="addOrUpdateConfigs" ref="addOrUpdate" @refreshDataList="getDataList" @destroy-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './productArrt-add-or-update'
|
||||
// import AddOrUpdate from './productArrt-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '属性名称' },
|
||||
{ prop: 'code', name: '属性编码' },
|
||||
{ prop: 'productId', name: '产品id,关联产品表' },
|
||||
{ prop: 'productId', name: '产品id' },
|
||||
{ prop: 'value', name: '属性值' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
// { prop: 'id', name: 'ID' },
|
||||
// { prop: 'externalCode', name: '外部编码,用于对照外部系统的编码' },
|
||||
// { prop: 'enabled', name: '启用状态:0 、停用,1、启用' },
|
||||
// { prop: 'remark', name: '备注' },
|
||||
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
// { prop: 'creatorId', name: '创建人' },
|
||||
// { prop: 'creatorName', name: '创建人姓名' },
|
||||
// { prop: 'updaterId', name: '更新人' },
|
||||
// { prop: 'updaterName', name: '更新人姓名' },
|
||||
// { prop: 'updateTime', name: '更新时间' },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/productArrt',
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
label: '属性名称',
|
||||
placeholder: '请输入属性名称'
|
||||
},
|
||||
{
|
||||
name: 'code',
|
||||
label: '属性编码',
|
||||
placeholder: '请输入属性编码'
|
||||
},
|
||||
{
|
||||
name: 'productId',
|
||||
label: '关联产品',
|
||||
type: 'select',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
name: 'value',
|
||||
label: '属性值',
|
||||
placeholder: '请输入属性值'
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
label: '描述',
|
||||
placeholder: '请输入描述'
|
||||
}
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/productArrt', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/productArrt', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -100,9 +128,32 @@ export default {
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getProductList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取产品列表
|
||||
getProductList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/product/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
limit: 999,
|
||||
page: 1
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productId') item.options = res.data.list.map(item => ({ label: item.name, value: item.id }))
|
||||
})
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productId') item.options.splice(0)
|
||||
})
|
||||
// this.plList.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
@ -140,6 +191,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -162,7 +221,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productArrt'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -7,7 +7,6 @@
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:productionline:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
@ -37,7 +36,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -49,15 +48,15 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './productionLine-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
@ -67,28 +66,50 @@ const tableConfigs = [
|
||||
{ prop: 'status', name: '产线状态' },
|
||||
{ prop: 'description', name: '描述' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { "prop": "tvalue", "name": "每小时下片数量" },
|
||||
// { "prop": "externalCode", "name": "外部系统编码" },
|
||||
// { "prop": "enabled", "name": "启用状态:0 、停用,1、启用" },
|
||||
// { "prop": "id", "name": "id" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "updateTime", "name": "更新时间" },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/productionLine',
|
||||
fields: [
|
||||
'name',
|
||||
{ name: 'code', api: '/monitoring/productionLine/getCode' },
|
||||
{
|
||||
name: 'factoryId',
|
||||
label: '工厂',
|
||||
type: 'select',
|
||||
placeholder: '请选择所属工厂',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
name: 'tvalue',
|
||||
label: '产线TT值(每小时下片数量)',
|
||||
placeholder: '请输入合理数值',
|
||||
type: 'number', // TODO: 可改进为自动应用 number 验证,此时还必须添加下述规则:
|
||||
required: true,
|
||||
rules: [{ type: 'number', transform: val => Number(val), trigger: 'blur', message: '请输入数字类型' }]
|
||||
},
|
||||
'description',
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/productionLine', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/productionLine', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
factoryList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
@ -102,11 +123,29 @@ export default {
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getFactoryList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取工厂列表
|
||||
getFactoryList() {
|
||||
this.$http.get(this.$http.adornUrl('/monitoring/factory/list')).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.factoryList = res.data
|
||||
} else {
|
||||
this.factoryList.splice(0)
|
||||
}
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'factoryId') {
|
||||
console.log('res', item)
|
||||
item.options = this.factoryList.map(f => ({ value: f.id, label: f.name }))
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLine/page'),
|
||||
@ -142,6 +181,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -164,7 +211,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLine'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -143,7 +143,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionLineRecSch'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -31,7 +31,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -43,36 +43,46 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './qualityInspectionDet-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './qualityInspectionDet-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'typeId', name: '检测类型id' },
|
||||
{ prop: 'typeName', name: '检测类型' },
|
||||
{ prop: 'content', name: '检测内容' },
|
||||
{ prop: 'code', name: '检测编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { prop: 'id', name: 'ID' },
|
||||
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
// { prop: 'creatorId', name: '创建人' },
|
||||
// { prop: 'creatorName', name: '创建人姓名' },
|
||||
// { prop: 'updaterId', name: '更新人' },
|
||||
// { prop: 'updaterName', name: '更新人姓名' },
|
||||
// { prop: 'updateTime', name: '更新时间' },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/qualityInspectionDet',
|
||||
fields: [
|
||||
{ name: 'typeId', label: '检测类型', type: 'select', options: [] },
|
||||
{ name: 'content', label: '检测内容' },
|
||||
{ name: 'code', label: '内容编码', api: '/monitoring/qualityInspectionDet/getCode' },
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/qualityInspectionDet', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/qualityInspectionDet', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -91,11 +101,34 @@ export default {
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getInspectionTypeList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取产检测类型列表
|
||||
getInspectionTypeList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionType/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
limit: 999,
|
||||
page: 1
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'typeId') item.options = res.data.list.map(item => ({ label: item.name, value: item.id }))
|
||||
})
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'typeId') item.options.splice(0)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionDet/page'),
|
||||
@ -131,6 +164,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -153,7 +194,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionDet'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -36,7 +36,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -48,12 +48,13 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './qualityInspectionRecord-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './qualityInspectionRecord-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
@ -74,21 +75,15 @@ const tableConfigs = [
|
||||
// { prop: 'source', name: '来源 1,手动(默认) 2,自动' },
|
||||
{ prop: 'explainText', name: '描述' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { prop: 'inspectionDetId', name: '检测内容id' },
|
||||
// { prop: 'id', name: 'ID' },
|
||||
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
// { prop: 'creatorId', name: '创建人' },
|
||||
// { prop: 'creatorName', name: '创建人姓名' },
|
||||
// { prop: 'updaterId', name: '更新人' },
|
||||
// { prop: 'updaterName', name: '更新人姓名' },
|
||||
// { prop: 'updateTime', name: '更新时间' },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -112,6 +107,7 @@ export default {
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord/page'),
|
||||
@ -147,6 +143,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -169,7 +173,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -30,7 +30,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -42,35 +42,44 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './qualityInspectionType-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './qualityInspectionType-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '检测类型名称' },
|
||||
{ prop: 'code', name: '检测类型编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { prop: 'id', name: 'ID' },
|
||||
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
|
||||
// { prop: 'creatorId', name: '创建人' },
|
||||
// { prop: 'creatorName', name: '创建人姓名' },
|
||||
// { prop: 'updaterId', name: '更新人' },
|
||||
// { prop: 'updaterName', name: '更新人姓名' },
|
||||
// { prop: 'updateTime', name: '更新时间' },
|
||||
// { prop: 'version', name: '版本号' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/qualityInspectionType',
|
||||
fields: [
|
||||
{ name: 'name', label: '检测类型' },
|
||||
{ name: 'code', label: '检测类型编码', api: '/monitoring/qualityInspectionType/getCode' },
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/qualityInspectionType', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/qualityInspectionType', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -94,6 +103,7 @@ export default {
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionType/page'),
|
||||
@ -129,6 +139,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -151,7 +169,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionType'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -165,7 +165,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheet'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -157,7 +157,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reportSheetCategory'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -152,7 +152,7 @@ export default {
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysFile'),
|
||||
method: 'delete',
|
||||
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
|
@ -150,7 +150,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysFileType'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -7,7 +7,6 @@
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:workshopsection:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
@ -36,7 +35,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -48,12 +47,13 @@
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './workshopSection-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './workshopSection-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
@ -62,31 +62,40 @@ const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
{ prop: 'name', name: '工段名称' },
|
||||
{ prop: 'code', name: '工段编码' },
|
||||
{ prop: 'productionLineId', name: '产线ID' },
|
||||
// { prop: 'productionLineId', name: '产线ID' },
|
||||
{ prop: 'productionLineName', name: '产线' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
// { "prop": "id", "name": "id" },
|
||||
// { "prop": "description", "name": "描述" },
|
||||
// { "prop": "enabled", "name": "启用状态:0 、停用,1、启用" },
|
||||
// { "prop": "sort", "name": "排序" },
|
||||
// { "prop": "valid", "name": "删除标志,是否有效:1 可用 0不可用" },
|
||||
// { "prop": "creatorId", "name": "创建人" },
|
||||
// { "prop": "creatorName", "name": "创建人姓名" },
|
||||
// { "prop": "updaterId", "name": "更新人" },
|
||||
// { "prop": "updaterName", "name": "更新人姓名" },
|
||||
// { "prop": "updateTime", "name": "更新时间" },
|
||||
// { "prop": "version", "name": "版本号" },
|
||||
// { prop: 'externalCode', name: '外部系统编码' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/workshopSection',
|
||||
fields: [
|
||||
{ name: 'name', label: '工段名称' },
|
||||
{ name: 'code', label: '工段编码', api: '/monitoring/workshopSection/getCode' },
|
||||
{ name: 'productionLineId', label: '所属产线', type: 'select', options: [] },
|
||||
'description',
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'reset', url: true, showAlways: true },
|
||||
{ name: 'cancel', url: true, showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/workshopSection', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/workshopSection', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
plList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
@ -100,11 +109,30 @@ export default {
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getProductLine()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取产线列表
|
||||
getProductLine() {
|
||||
this.$http.get(this.$http.adornUrl('/monitoring/productionLine/list')).then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
// this.plList = res.data
|
||||
console.log('res', res)
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productionLineId') item.options = res.data.map(item => ({ label: item.name, value: item.id }))
|
||||
})
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.name === 'productionLineId') item.options.splice(0)
|
||||
})
|
||||
// this.plList.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection/page'),
|
||||
@ -140,6 +168,14 @@ export default {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
return this.deleteHandle(id)
|
||||
}
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
@ -162,7 +198,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
@ -153,7 +153,7 @@ export default {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSectionEquipment'),
|
||||
method: 'delete',
|
||||
data: this.$http.adornData(ids, false)
|
||||
data: this.$http.adornData(ids, false, 'raw')
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
|
Loading…
Reference in New Issue
Block a user