This commit is contained in:
2021-09-13 14:56:28 +08:00
commit ac0d6e9083
777 changed files with 90286 additions and 0 deletions

View File

@@ -0,0 +1,242 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-09 14:44:54
* @Description:
-->
<template>
<div class="app-container">
<el-form :inline="true" :model="listQuery" @keyup.enter.native="getList()">
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmCode')" prop="code">
<el-input v-model="listQuery.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmType')" prop="alarmType">
<el-select v-model="listQuery.alarmType" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmType')])" clearable>
<el-option
v-for="item in TypeArr"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmLevel')" prop="alarmGrade">
<el-select v-model="listQuery.alarmGrade" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmLevel')])" clearable>
<el-option
v-for="item in GradeArr"
:key="item.id"
:label="item.alarmGrade"
:value="item.alarmGrade"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</el-form-item>
</el-form>
<base-table
:table-config="tableProps"
:table-data="list"
:page="listQuery.current"
:limit="listQuery.size"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<alarmInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { alarmInfoList, alarmInfoDelete } from '@/api/basicData/AlarmManagement/alarmInfo'
import { alarmLevelList } from '@/api/basicData/AlarmManagement/alarmLevel'
import { alarmTypeList } from '@/api/basicData/AlarmManagement/alarmType'
import alarmInfoAdd from './components/alarmInfo-add.vue'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
// , handleLimit
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.alarmManagement.AlarmCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.alarmManagement.AlarmName'),
align: 'center'
},
{
prop: 'alarmGrade',
label: i18n.t('module.basicData.alarmManagement.AlarmLevel'),
align: 'center'
},
{
prop: 'alarmType',
label: i18n.t('module.basicData.alarmManagement.AlarmType'),
align: 'center'
},
// {
// prop: 'alarmContent',
// label: i18n.t('module.basicData.alarmManagement.AlarmContent'),
// align: 'center',
// filter: handleLimit
// },
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'AlarmInfo',
components: { Pagination, BaseTable, MethodBtn, alarmInfoAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
GradeArr: [],
TypeArr: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10,
alarmType: '',
code: '',
alarmGrade: ''
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
alarmInfoDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList() {
const lQuery = {
current: 1,
size: 999
}
alarmTypeList(lQuery).then(response => {
this.TypeArr = response.data.records
})
alarmLevelList(lQuery).then(response => {
this.GradeArr = response.data.records
})
this.listLoading = true
alarmInfoList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,190 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:41:26
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:table-config="tableProps"
:table-data="list"
:page="listQuery.current"
:limit="listQuery.size"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<alarmLevel-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { alarmLevelList, alarmLevelDelete } from '@/api/basicData/AlarmManagement/alarmLevel'
import alarmLevelAdd from './components/alarmLevel-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'alarmGradeCode',
label: i18n.t('module.basicData.alarmManagement.LevelCode'),
align: 'center'
},
{
prop: 'alarmGrade',
label: i18n.t('module.basicData.alarmManagement.AlarmLevel'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'AlarmLevel',
components: { Pagination, BaseTable, MethodBtn, HeadForm, alarmLevelAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.alarmManagement.AlarmLevel') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.alarmManagement.LevelCode'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.alarmGrade}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
alarmLevelDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.alarmGrade = key
this.listQuery.alarmGradeCode = key
alarmLevelList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,190 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:41:43
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:table-config="tableProps"
:table-data="list"
:page="listQuery.current"
:limit="listQuery.size"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<alarmType-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { alarmTypeList, alarmTypeDelete } from '@/api/basicData/AlarmManagement/alarmType'
import alarmTypeAdd from './components/alarmType-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.alarmManagement.AlarmTypeCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.alarmManagement.AlarmType'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'AlarmType',
components: { Pagination, BaseTable, MethodBtn, HeadForm, alarmTypeAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.alarmManagement.AlarmType') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.alarmManagement.AlarmTypeCode'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
alarmTypeDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
alarmTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,165 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-26 14:27:46
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="105px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmType')" prop="alarmType">
<el-select v-model="dataForm.alarmType" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmType')])" clearable>
<el-option
v-for="item in TypeArr"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmLevel')" prop="alarmGrade">
<el-select v-model="dataForm.alarmGrade" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmLevel')])" clearable>
<el-option
v-for="item in GradeArr"
:key="item.id"
:label="item.alarmGrade"
:value="item.alarmGrade"
/>
</el-select>
</el-form-item>
<!-- <el-form-item :label="$t('module.basicData.alarmManagement.AlarmContent')" prop="alarmContent">
<el-input v-model="dataForm.alarmContent" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmContent')])" clearable />
</el-form-item> -->
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { alarmInfoDetail, alarmInfoUpdate, alarmInfoAdd, alarmInfoCode } from '@/api/basicData/AlarmManagement/alarmInfo'
import { alarmLevelList } from '@/api/basicData/AlarmManagement/alarmLevel'
import { alarmTypeList } from '@/api/basicData/AlarmManagement/alarmType'
export default {
data() {
return {
visible: false,
GradeArr: [],
TypeArr: [],
dataForm: {
id: 0,
name: '',
code: '',
alarmGrade: '',
alarmType: '',
alarmContent: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmCode')]), trigger: 'blur' }
],
alarmGrade: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmLevel')]), trigger: 'blur' }
],
alarmType: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmType')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
const listQuery = {
current: 1,
size: 999
}
alarmTypeList(listQuery).then(response => {
this.TypeArr = response.data.records
})
alarmLevelList(listQuery).then(response => {
this.GradeArr = response.data.records
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
alarmInfoDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.alarmType = res.data.alarmType
this.dataForm.alarmGrade = res.data.alarmGrade
this.dataForm.alarmContent = res.data.alarmContent
this.dataForm.remark = res.data.remark
})
} else {
alarmInfoCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'alarmGrade': this.dataForm.alarmGrade,
'alarmType': this.dataForm.alarmType,
'alarmContent': this.dataForm.alarmContent,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
alarmInfoUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
alarmInfoAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,113 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-26 14:28:33
* @remark:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="110px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmLevel')" prop="alarmGrade">
<el-input v-model="dataForm.alarmGrade" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmLevel')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.LevelCode')" prop="alarmGradeCode">
<el-input v-model="dataForm.alarmGradeCode" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.LevelCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { alarmLevelDetail, alarmLevelUpdate, alarmLevelAdd, alarmLevelCode } from '@/api/basicData/AlarmManagement/alarmLevel'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
alarmGradeCode: '',
alarmGrade: '',
remark: ''
},
dataRule: {
alarmGrade: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmLevel')]), trigger: 'blur' }
],
alarmGradeCode: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.LevelCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
alarmLevelDetail(this.dataForm.id).then(res => {
this.dataForm.alarmGradeCode = res.data.alarmGradeCode
this.dataForm.alarmGrade = res.data.alarmGrade
this.dataForm.remark = res.data.remark
})
} else {
alarmLevelCode().then(res => {
this.dataForm.alarmGradeCode = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'alarmGradeCode': this.dataForm.alarmGradeCode,
'alarmGrade': this.dataForm.alarmGrade,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
alarmLevelUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
alarmLevelAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,113 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-26 14:28:11
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmType')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmType')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmTypeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmTypeCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { alarmTypeDetail, alarmTypeUpdate, alarmTypeAdd, alarmTypeCode } from '@/api/basicData/AlarmManagement/alarmType'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmType')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmTypeCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
alarmTypeDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.remark = res.data.remark
})
} else {
alarmTypeCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
alarmTypeUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
alarmTypeAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,219 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:13:05
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<cacheArea-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { areaList, areaDelete } from '@/api/basicData/Cache/area'
import { cacheList } from '@/api/basicData/Cache/cache'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import shelfBtn from './components/shelfBtn.vue'
import cacheAreaAdd from './components/cacheArea-add.vue'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.AreaName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.AreaCode'),
align: 'center'
},
{
prop: 'cacheName',
label: i18n.t('module.basicData.cache.CacheName'),
align: 'center'
},
{
prop: 'areaNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'shelf',
label: i18n.t('module.basicData.cache.Shelf'),
subcomponent: shelfBtn,
align: 'center'
}
]
export default {
name: 'Area',
components: { Pagination, BaseTable, MethodBtn, HeadForm, cacheAreaAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.cache.AreaName'),
tableBtn,
trueWidth: 200,
tableProps,
list: [],
cacheList: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
const params = {
current: 1,
size: 500
}
cacheList(params).then(response => {
if (response.data.records) {
this.cacheList = response.data.records
this.getList()
}
})
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
areaDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
areaList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
this.list.forEach(item => {
const name = this.cacheList.find(citem => { if (citem.id === item.cacheId) return citem })
if (name) {
item.cacheName = name.name
}
})
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,195 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:09:59
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { cacheList, cacheDelete } from '@/api/basicData/Cache/cache'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.CacheName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.CacheCode'),
align: 'center'
},
{
prop: 'enName',
label: i18n.t('module.basicData.visual.EnglishName'),
align: 'center'
}
]
export default {
name: 'Cache',
components: { Pagination, BaseTable, MethodBtn, HeadForm },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.cache.CacheName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.cache.CacheCode'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
cacheDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
cacheList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.$router.push({
name: 'cacheAdd',
query: {
id: id,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,36 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:18:59
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.storageBox.PositionDetail') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
this.$router.push({
name: 'PositionDetailInfo',
query: {
id: this.injectData.id,
name: this.injectData.name,
code: this.injectData.code,
quantity: this.injectData.quantity
}
})
}
}
}
</script>

View File

@@ -0,0 +1,84 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:39:23
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.storageBox.PositionCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.PositionCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.PositionCodeAlias')" prop="aliasName">
<el-input v-model="dataForm.aliasName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.PositionCodeAlias')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.PositionNo')" prop="serial">
<el-input v-model="dataForm.serial" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.PositionNo')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { PositionDetailInfoAdd } from '@/api/basicData/Cache/storageBox'
export default {
data() {
return {
visible: false,
dataForm: {
storageTankId: 0,
code: '',
aliasName: '',
serial: ''
},
dataRule: {
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.storageBox.PositionCode')]),
trigger: 'blur' }
]
}
}
},
methods: {
init(id, code) {
this.dataForm.storageTankId = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.dataForm.code = code
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
PositionDetailInfoAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,110 @@
<!--
* @Author: zwq
* @Date: 2021-07-21 14:05:30
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:41:24
* @Description:
-->
<template>
<div style="margin:50px">
<span>{{ $t('module.basicData.storageBox.code') }}:{{ injectData.code }}</span>
<span>{{ $t('module.basicData.storageBox.name') }}:{{ injectData.name }}</span>
<span>{{ $t('module.basicData.storageBox.StorageQuantity') }}:{{ injectData.quantity }}</span>
<span>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
</span>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
/>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<PositionDetailInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>
import i18n from '@/lang'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import PositionDetailInfoAdd from './PositionDetailInfo-add'
import { PositionDetailInfoList } from '@/api/basicData/Cache/storageBox'
const tableProps = [
{
prop: 'serial',
label: i18n.t('module.basicData.storageBox.PositionNo'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.storageBox.PositionCode'),
align: 'center'
},
{
prop: 'aliasName',
label: i18n.t('module.basicData.storageBox.PositionCodeAlias'),
align: 'center'
}
]
export default {
components: { Pagination, BaseTable, PositionDetailInfoAdd },
data() {
return {
injectData: {},
addOrUpdateVisible: false,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.injectData = this.$route.query
this.getList()
},
methods: {
getList() {
this.listLoading = true
PositionDetailInfoList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew() {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(this.injectData.id, this.injectData.code)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
span{
margin-left: 30px;
}
</style>

View File

@@ -0,0 +1,383 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-28 10:07:44
* @enName:
-->
<template>
<div style="margin:20px">
<el-row :gutter="15">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="140px"
>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.CacheName')" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.CacheName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.CacheCode')" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" :label="$t('module.basicData.cache.CacheCode')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
<el-input v-model="dataForm.enName" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbr">
<el-input v-model="dataForm.abbr" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Manufacturer')" prop="manufacturer">
<el-input
v-model="dataForm.manufacturer"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Manufacturer')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="description">
<el-input v-model="dataForm.description" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.productionTime')" prop="productionTime">
<el-date-picker
v-model="dataForm.productionTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.productionTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.enterTime')" prop="enterTime">
<el-date-picker
v-model="dataForm.enterTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.enterTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.debugTime')" prop="debugTime">
<el-date-picker
v-model="dataForm.debugTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.debugTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.CurrentState')" prop="currentStatus">
<el-select
v-model="dataForm.currentStatus"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.CurrentState')])"
clearable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in currentStatusOptions"
:key="index"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.StockNumber')" prop="stockNumber">
<el-input-number v-model="dataForm.stockNumber" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.StockNumber')])" :step="1" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.AreaNumber')" prop="areaNumber">
<el-input-number v-model="dataForm.areaNumber" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaNumber')])" :step="1" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-form>
</el-row>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="listQuery.cacheId" type="primary" @click="addNew()">{{ $t('module.basicData.cache.addCacheArea') }}</el-button>
</span>
</div>
<div style="height:380px;overflow:auto">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
<cacheArea-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { cacheDetail, cacheUpdate, cacheAdd, cacheCode } from '@/api/basicData/Cache/cache'
import { areaList, areaDelete } from '@/api/basicData/Cache/area'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import cacheAreaAdd from './cacheArea-add.vue'
import shelfBtn from './shelfBtn.vue'
import { timeFormatter } from '@/filters'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.AreaName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.AreaCode'),
align: 'center'
},
{
prop: 'areaNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'shelf',
label: i18n.t('module.basicData.cache.Shelf'),
subcomponent: shelfBtn,
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, cacheAreaAdd },
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
dataForm: {
name: '',
code: '',
enName: '',
abbr: '',
manufacturer: '',
description: '',
productionTime: '',
enterTime: '',
debugTime: '',
currentStatus: '',
stockNumber: '',
areaNumber: '',
remark: ''
},
listQuery: {
current: 1,
size: 990,
cacheId: ''
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.CacheName')]),
trigger: 'blur'
}],
code: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.CacheCode')]),
trigger: 'blur'
}]
},
currentStatusOptions: [{
'label': '正常',
'value': '0'
}, {
'label': '暂停',
'value': '1'
}, {
'label': '维修',
'value': '2'
}],
cacheId: '',
isdetail: false
}
},
created() {
this.cacheId = this.$route.query.id
this.init()
},
methods: {
init() {
this.isdetail = false
this.isdetail = Boolean(this.$route.query.isdetail)
this.listQuery.cacheId = ''
this.list.splice(0, this.list.length)
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.cacheId) {
cacheDetail(this.cacheId).then(res => {
this.dataForm = res.data
})
this.listQuery.cacheId = this.cacheId
areaList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
} else {
cacheCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
getList() {
areaList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
areaDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'abbr': this.dataForm.abbr,
'code': this.dataForm.code,
'currentStatus': this.dataForm.currentStatus,
'debugTime': this.dataForm.debugTime,
'enName': this.dataForm.enName,
'enterTime': this.dataForm.enterTime,
'manufacturer': this.dataForm.manufacturer,
'name': this.dataForm.name,
'productionTime': this.dataForm.productionTime,
'remark': this.dataForm.remark,
'description': this.dataForm.description,
'stockNumber': this.dataForm.stockNumber,
'areaNumber': this.dataForm.areaNumber,
'id': this.cacheId
}
if (this.cacheId) {
cacheUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
cacheAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.listQuery.cacheId = res.data.id
})
}
}
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,145 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:00:18
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.cacheId ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.cache.AreaName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.AreaCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaCode')])" clearable />
</el-form-item>
<el-form-item v-if="isPage" :label="$t('module.basicData.cache.CacheName')" prop="cacheId">
<el-select v-model="dataForm.cacheId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.CacheName')])" clearable>
<el-option
v-for="item in cacheArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.StorageQuantity')" prop="areaNumber">
<el-input-number v-model="dataForm.areaNumber" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.StorageQuantity')])" :step="1" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { areaDetail, areaUpdate, areaAdd, areaCode } from '@/api/basicData/Cache/area'
import { cacheList } from '@/api/basicData/Cache/cache'
export default {
props: {
cacheId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
isPage: false,
dataForm: {
id: 0,
cacheId: '',
name: '',
code: '',
areaNumber: ''
},
cacheArr: [],
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.AreaName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.AreaCode')]), trigger: 'blur' }
],
cacheId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.CacheName')]), trigger: 'change' }
]
}
}
},
methods: {
init(id, isPage) {
this.isPage = isPage || false
this.dataForm.id = id || ''
if (!this.isPage) {
this.dataForm.cacheId = this.cacheId
}
this.cacheArr.splice(0, this.cacheArr.length)
const params = {
current: 1,
size: 500
}
cacheList(params).then(response => {
if (response.data.records) {
this.cacheArr = response.data.records
}
})
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
areaDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
areaCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
if (this.dataForm.id) {
areaUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
areaAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,188 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:44:10
* @Description:
-->
<template>
<div class="app-container">
<div style="margin:10px 50px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</div>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<locationAttr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :shelf-id="listQuery.shelfId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { locationList, locationDelete } from '@/api/basicData/Cache/location'
import locationAttrAdd from './locationAttr-add.vue'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.LocationCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.LocationName'),
align: 'center'
},
{
prop: 'anotherName',
label: i18n.t('module.basicData.cache.anotherName'),
align: 'center'
},
{
prop: 'place',
label: i18n.t('module.basicData.cache.place'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Location',
components: { BaseTable, MethodBtn, locationAttrAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
listLoading: true,
listQuery: {
current: 1,
size: 990,
shelfId: ''
}
}
},
created() {
this.listQuery.shelfId = this.$route.query.id
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
locationDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
locationList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.listLoading = false
})
},
// 新增 / 修改
addNew(shelfId) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(shelfId)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,130 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:23:03
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.shelfId ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.cache.LocationName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.LocationName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.LocationCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.LocationCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.anotherName')" prop="anotherName">
<el-input v-model="dataForm.anotherName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.anotherName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.place')" prop="place">
<el-input v-model="dataForm.place" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.place')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { locationDetail, locationUpdate, locationAdd, locationCode } from '@/api/basicData/Cache/location'
export default {
props: {
shelfId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
anotherName: '',
place: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.LocationName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.LocationCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
locationDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
locationCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'anotherName': this.dataForm.anotherName,
'place': this.dataForm.place,
'remark': this.dataForm.remark,
'shelfId': this.shelfId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
locationUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
locationAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,33 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-03-06 13:12:47
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.cache.ManageLocation') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
this.$router.push({
name: 'locationAdd',
query: {
id: this.injectData.id
}
})
}
}
}
</script>

View File

@@ -0,0 +1,185 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 09:22:52
* @Description:
-->
<template>
<div class="app-container">
<div style="margin:10px 50px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</div>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<shelfAttr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :area-id="listQuery.areaId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { shelfList, shelfDelete } from '@/api/basicData/Cache/shelf'
import shelfAttrAdd from './shelfAttr-add.vue'
import locationBtn from './locationBtn.vue'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.ShelfCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.ShelfName'),
align: 'center'
},
{
prop: 'shelfNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'location',
label: i18n.t('module.basicData.cache.Location'),
subcomponent: locationBtn,
align: 'center'
}
]
export default {
name: 'Shelf',
components: { BaseTable, MethodBtn, shelfAttrAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
listLoading: true,
listQuery: {
current: 1,
size: 990,
areaId: ''
}
}
},
created() {
this.listQuery.areaId = this.$route.query.id
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
shelfDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
shelfList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,145 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:01:45
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.areaId ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.cache.ShelfName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.ShelfName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.ShelfCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.ShelfCode')])" clearable />
</el-form-item>
<el-form-item v-if="isPage" :label="$t('module.basicData.cache.AreaName')" prop="areaId">
<el-select v-model="dataForm.areaId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaName')])" clearable>
<el-option
v-for="item in areaArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.StorageQuantity')" prop="shelfNumber">
<el-input-number v-model="dataForm.shelfNumber" :step="1" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.StorageQuantity')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { shelfDetail, shelfUpdate, shelfAdd, shelfCode } from '@/api/basicData/Cache/shelf'
import { areaList } from '@/api/basicData/Cache/area'
export default {
props: {
areaId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
isPage: false,
dataForm: {
id: 0,
areaId: '',
name: '',
code: '',
shelfNumber: ''
},
areaArr: [],
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.ShelfName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.ShelfCode')]), trigger: 'blur' }
],
areaId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.AreaName')]), trigger: 'change' }
]
}
}
},
methods: {
init(id, isPage) {
this.isPage = isPage || false
this.dataForm.id = id || ''
if (!this.isPage) {
this.dataForm.areaId = this.areaId
}
this.areaArr.splice(0, this.areaArr.length)
const params = {
current: 1,
size: 500
}
areaList(params).then(response => {
if (response.data.records) {
this.areaArr = response.data.records
}
})
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
shelfDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
shelfCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
if (this.dataForm.id) {
shelfUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
shelfAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,33 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-03-06 13:03:40
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.cache.ManageShelves') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
this.$router.push({
name: 'shelfAdd',
query: {
id: this.injectData.id
}
})
}
}
}
</script>

View File

@@ -0,0 +1,146 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 13:59:43
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.storageBox.name')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.name')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.code')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.code')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.StorageQuantity')" prop="quantity">
<el-input-number v-model="dataForm.quantity" :min="0" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.StorageQuantity')])" />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.alias')" prop="aliasName">
<el-input v-model="dataForm.aliasName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.alias')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.status')" prop="status">
<el-select v-model="dataForm.status" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.status')])" clearable>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { storageBoxDetail, storageBoxUpdate, storageBoxAdd, storageBoxCode } from '@/api/basicData/Cache/storageBox'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
status: 0,
aliasName: '',
quantity: 0,
remark: ''
},
options: [
{
value: 0,
label: '正常'
},
{
value: 1,
label: '维修中'
},
{
value: 2,
label: '报废'
}
],
dataRule: {
name: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.storageBox.name')]),
trigger: 'blur' }
],
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.storageBox.code')]),
trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
storageBoxDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
storageBoxCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
data.id = this.dataForm.id
if (this.dataForm.id) {
storageBoxUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
storageBoxAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,219 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:13:19
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<shelfAttr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { shelfList, shelfDelete } from '@/api/basicData/Cache/shelf'
import { areaList } from '@/api/basicData/Cache/area'
import shelfAttrAdd from './components/shelfAttr-add.vue'
import locationBtn from './components/locationBtn.vue'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.ShelfName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.ShelfCode'),
align: 'center'
},
{
prop: 'areaName',
label: i18n.t('module.basicData.cache.AreaName'),
align: 'center'
},
{
prop: 'shelfNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'location',
label: i18n.t('module.basicData.cache.Location'),
subcomponent: locationBtn,
align: 'center'
}
]
export default {
name: 'Area',
components: { Pagination, BaseTable, MethodBtn, HeadForm, shelfAttrAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.cache.ShelfName'),
tableBtn,
trueWidth: 200,
tableProps,
list: [],
areaList: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
const params = {
current: 1,
size: 500
}
areaList(params).then(response => {
if (response.data.records) {
this.areaList = response.data.records
}
this.getList()
})
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
shelfDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
shelfList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
this.list.forEach(item => {
const name = this.areaList.find(aitem => { if (aitem.id === item.areaId) return aitem })
if (name) {
item.areaName = name.name
}
})
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,216 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:00:56
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<storageBox-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import PositionDetail from './components/PositionDetail'
import storageBoxAdd from './components/storageBox-add'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { storageBoxList, storageBoxDelete } from '@/api/basicData/Cache/storageBox'
import { timeFormatter } from '@/filters'
import basicData from '@/filters/basicData'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.storageBox.name'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.storageBox.code'),
align: 'center'
},
{
prop: 'aliasName',
label: i18n.t('module.basicData.storageBox.alias'),
align: 'center'
},
{
prop: 'quantity',
label: i18n.t('module.basicData.storageBox.StorageQuantity'),
align: 'center'
},
{
prop: 'status',
label: i18n.t('module.basicData.storageBox.status'),
filter: basicData('storage'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.storageBox.remark'),
align: 'center'
},
{
prop: 'location',
label: i18n.t('module.basicData.cache.Location'),
subcomponent: PositionDetail,
align: 'center'
}
]
export default {
name: 'Area',
components: { Pagination, BaseTable, MethodBtn, HeadForm, storageBoxAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.storageBox.name') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.storageBox.code'),
tableBtn,
trueWidth: 200,
tableProps,
list: [],
areaList: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
storageBoxDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
storageBoxList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,201 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:42:48
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<CodeRules-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { CodeRulesList, CodeRulesDelete } from '@/api/basicData/CodeRules'
import CodeRulesAdd from './components/CodeRules-add'
import attrBtn from './components/attrBtn'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.CodeRules.RuleName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.CodeRules.RuleCode'),
align: 'center'
},
{
prop: 'abbreviation',
label: i18n.t('module.basicData.visual.Abbreviation'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
},
{
prop: 'attribute',
label: i18n.t('module.basicData.CodeRules.Property'),
subcomponent: attrBtn,
align: 'center'
}
]
export default {
name: 'CodeRules',
components: { Pagination, BaseTable, MethodBtn, HeadForm, CodeRulesAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.CodeRules.RuleName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
CodeRulesDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
CodeRulesList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,145 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:24:15
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.customer.CustomerName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.customer.CustomerName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.customer.CustomerCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.customer.CustomerCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.customer.ContactPerson')" prop="contact">
<el-input v-model="dataForm.contact" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.customer.ContactPerson')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.customer.Telephone')" prop="telephone">
<el-input
v-model="dataForm.telephone"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.customer.Telephone')])"
clearable
prefix-icon="el-icon-phone"
:style="{width: '100%'}"
/>
</el-form-item>
<el-form-item :label="$t('module.basicData.customer.Address')" prop="address">
<el-input v-model="dataForm.address" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.customer.Address')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { customerDetail, customerUpdate, customerAdd, customerCode } from '@/api/basicData/CustomerSupplier/customer'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
contact: '',
telephone: '',
address: '',
description: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.customer.CustomerName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.customer.CustomerCode')]), trigger: 'blur' }
],
contact: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.customer.ContactPerson')]), trigger: 'blur' }
],
telephone: [{
required: true,
pattern: /(^1\d{10}$)|(^[0-9]\d{7}$)/,
message: this.$t('module.basicData.customer.Telephone') + this.$t('module.basicData.customer.format'),
trigger: 'blur'
}]
}
}
},
methods: {
init(id) {
customerCode().then(res => {
this.dataForm.code = res.data
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
customerDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.description = res.data.description
this.dataForm.contact = res.data.contact
this.dataForm.address = res.data.address
this.dataForm.telephone = res.data.telephone
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'description': this.dataForm.description,
'contact': this.dataForm.contact,
'telephone': this.dataForm.telephone,
'address': this.dataForm.address,
'id': this.dataForm.id
}
if (this.dataForm.id) {
customerUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
customerAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,140 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-10 11:06:50
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.supplier.SupplierName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.supplier.SupplierName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.supplier.SupplierCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.supplier.SupplierCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.supplier.ContactPerson')" prop="contact">
<el-input v-model="dataForm.contact" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.supplier.ContactPerson')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.supplier.Telephone')" prop="telephone">
<el-input
v-model="dataForm.telephone"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.supplier.Telephone')])"
clearable
prefix-icon="el-icon-phone"
:style="{width: '100%'}"
/>
</el-form-item>
<el-form-item :label="$t('module.basicData.supplier.Address')" prop="address">
<el-input v-model="dataForm.address" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.supplier.Address')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { supplierDetail, supplierUpdate, supplierAdd, supplierCode } from '@/api/basicData/CustomerSupplier/supplier'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
contact: '',
telephone: '',
description: '',
address: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.supplier.SupplierName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.supplier.SupplierCode')]), trigger: 'blur' }
],
contact: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.supplier.ContactPerson')]), trigger: 'blur' }
],
telephone: [{
required: true,
pattern: /(^1\d{10}$)|(^[0-9]\d{7}$)/,
message: this.$t('module.basicData.supplier.Telephone') + this.$t('module.basicData.customer.format'),
trigger: 'blur'
}]
}
}
},
methods: {
init(id) {
supplierCode().then(res => {
this.dataForm.code = res.data
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
supplierDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'description': this.dataForm.description,
'contact': this.dataForm.contact,
'telephone': this.dataForm.telephone,
'address': this.dataForm.address,
'id': this.dataForm.id
}
if (this.dataForm.id) {
supplierUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
supplierAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,204 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:44:58
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<customer-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { customerList, customerDelete } from '@/api/basicData/CustomerSupplier/customer'
import customerAdd from './components/customer-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.customer.CustomerName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.customer.CustomerCode'),
align: 'center'
},
{
prop: 'contact',
label: i18n.t('module.basicData.customer.ContactPerson'),
align: 'center'
},
{
prop: 'telephone',
label: i18n.t('module.basicData.customer.Telephone'),
align: 'center'
},
{
prop: 'address',
label: i18n.t('module.basicData.customer.Address'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Customer',
components: { Pagination, BaseTable, MethodBtn, HeadForm, customerAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.customer.CustomerName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
customerDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
customerList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,205 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:45:09
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<supplier-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { supplierList, supplierDelete } from '@/api/basicData/CustomerSupplier/supplier'
import supplierAdd from './components/supplier-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.supplier.SupplierName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.supplier.SupplierCode'),
align: 'center'
},
{
prop: 'contact',
label: i18n.t('module.basicData.supplier.ContactPerson'),
align: 'center'
},
{
prop: 'telephone',
label: i18n.t('module.basicData.supplier.Telephone'),
align: 'center'
},
{
prop: 'address',
label: i18n.t('module.basicData.supplier.Address'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Supplier',
components: { Pagination, BaseTable, MethodBtn, HeadForm, supplierAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.supplier.SupplierName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.supplier.SupplierCode'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
supplierDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
supplierList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,183 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-18 14:22:53
* @Description:
-->
<template>
<div class="app-container">
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<equipmentGroup-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import { equipmentGroupList, equipmentGroupDelete } from '@/api/basicData/Equipment/equipmentGroup'
import equipmentGroupAdd from './components/equipmentGroup-add.vue'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'groupName',
label: i18n.t('module.basicData.equipment.groupName'),
align: 'center'
},
{
prop: 'groupCode',
label: i18n.t('module.basicData.equipment.groupCode'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'EquipmentGroup',
components: { Pagination, BaseTable, MethodBtn, equipmentGroupAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.factory.placeholderName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.groupName}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentGroupDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
equipmentGroupList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,259 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-05-31 08:45:53
* @enName:
-->
<template>
<div style="margin:20px">
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<div style="margin:0 15px">
<el-form ref="dataForm" :inline="true" :model="dataForm" :rules="dataRule" label-width="160px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.DetectionArea')" prop="detectDistributionAreaId">
<el-select v-model="dataForm.detectDistributionAreaId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.DetectionArea')])" clearable>
<el-option
v-for="item in detectAreaArr"
:key="item.id"
:label="item.detectArea"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')" prop="detectSystemId">
<el-select v-model="dataForm.detectSystemId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')])" clearable>
<el-option
v-for="item in SystemArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="dataForm.id" type="primary" @click="addNew()">{{ $t('module.basicData.equipmentDetectInfo.AddEquipment') }}</el-button>
</span>
</div>
<div style="height:380px;overflow:auto">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
</div>
<detectSystemSettings-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :detect-area-system-id="dataForm.id" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentDetectAreaList } from '@/api/basicData/Equipment/equipmentDetectArea'
import { equipmentDetectSystemList } from '@/api/basicData/Equipment/equipmentDetectSystem'
import { equipmentDetectAreaSystemDetail, equipmentDetectAreaSystemUpdate, equipmentDetectAreaSystemAdd } from '@/api/basicData/Equipment/equipmentDetectAreaSystem'
import { DetectAreaSystemAttrList, DetectAreaSystemAttrDelete } from '@/api/basicData/Equipment/equipmentDetectAreaSystemAttr'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import detectSystemSettingsAttrAdd from './detectSystemSettingsAttr-add'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'name',
label: i18n.t('module.basicData.equipment.EquipmentName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.EquipmentCode'),
align: 'center'
},
{
prop: 'function',
label: i18n.t('module.basicData.equipmentDetectInfo.EquipmentFunction'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, detectSystemSettingsAttrAdd },
data() {
return {
addOrUpdateVisible: false,
categoryArr: [],
tableBtn,
trueWidth: 200,
tableProps,
list: [],
dataForm: {
id: '',
detectDistributionAreaId: '',
detectSystemId: ''
},
dataRule: {
detectDistributionAreaId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.DetectionArea')]), trigger: 'change' }
],
detectSystemId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')]), trigger: 'change' }
]
},
listQuery: {
current: 1,
size: 990,
detectAreaSystemId: ''
},
detectAreaArr: [],
SystemArr: [],
isdetail: false
}
},
created() {
this.dataForm.id = this.$route.query.id
this.listQuery.detectAreaSystemId = this.$route.query.id
this.init()
},
methods: {
init() {
this.isdetail = false
this.isdetail = Boolean(this.$route.query.isdetail)
this.list.splice(0, this.list.length)
const data = {
current: 1,
size: 500
}
equipmentDetectAreaList(data).then(response => {
if (response.data.records) {
this.detectAreaArr = response.data.records
} else {
this.detectAreaArr.splice(0, this.detectAreaArr.length)
}
})
equipmentDetectSystemList(data).then(response => {
if (response.data.records) {
this.SystemArr = response.data.records
} else {
this.SystemArr.splice(0, this.SystemArr.length)
}
})
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentDetectAreaSystemDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
DetectAreaSystemAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
}
})
},
getList() {
DetectAreaSystemAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
DetectAreaSystemAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
if (this.dataForm.id) {
equipmentDetectAreaSystemUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
equipmentDetectAreaSystemAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.dataForm.id = res.data.id
})
}
}
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goEdit() {
this.isdetail = false
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,130 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-05-28 10:48:46
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')" prop="equipmentId">
<el-select v-model="dataForm.equipmentId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentName')])" clearable>
<el-option
v-for="item in equipmentArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { DetectAreaSystemAttrDetail, DetectAreaSystemAttrUpdate, DetectAreaSystemAttrAdd } from '@/api/basicData/Equipment/equipmentDetectAreaSystemAttr'
import { equipmentInfoList } from '@/api/basicData/Equipment/equipmentInfo'
export default {
props: {
detectAreaSystemId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
dataForm: {
id: 0,
equipmentId: ''
},
equipmentArr: [],
dataRule: {
equipmentId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
equipmentInfoList({
current: 1,
size: 999,
name: ''
}).then(response => {
this.equipmentArr = response.data.records
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
DetectAreaSystemAttrDetail(this.dataForm.id).then(res => {
this.dataForm.equipmentId = res.data.equipmentId
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'equipmentId': this.dataForm.equipmentId,
'detectAreaSystemId': this.detectAreaSystemId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
DetectAreaSystemAttrUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
DetectAreaSystemAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,272 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-07-23 09:03:46
* @enName:
-->
<template>
<div style="margin:20px">
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<div style="margin:0 15px">
<el-form ref="dataForm" :inline="true" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.WiredCode')" prop="code">
<el-input v-model="dataForm.code" style="width:300px" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.WiredCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.DetectionArea')" prop="detectArea">
<el-select v-model="dataForm.detectArea" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.DetectionArea')])" clearable>
<el-option
v-for="item in detectAreaArr"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.IssueArea')" prop="distributionArea">
<el-select v-model="dataForm.distributionArea" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.IssueArea')])" clearable>
<el-option
v-for="item in distributionAreaArr"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="false" type="primary" @click="addNew()">{{ $t('module.basicData.equipmentDetectInfo.AddEquipment') }}</el-button>
<!-- //listQuery.detectDistributionAreaId -->
</span>
</div>
<div v-if="false" style="height:380px;overflow:auto">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
</div>
<equipmentDetectArea-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :detect-distribution-area-id="listQuery.detectDistributionAreaId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentDetectAreaDetail, equipmentDetectAreaUpdate, equipmentDetectAreaAdd, equipmentDetectAreaCode } from '@/api/basicData/Equipment/equipmentDetectArea'
import { equipmentDetectAreaAttrList, equipmentDetectAreaAttrDelete } from '@/api/basicData/Equipment/equipmentDetectAreaAttr'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import equipmentDetectAreaAttrAdd from './equipmentDetectAreaAttr-add'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'name',
label: i18n.t('module.basicData.equipment.EquipmentName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.EquipmentCode'),
align: 'center'
},
{
prop: 'function',
label: i18n.t('module.basicData.equipmentDetectInfo.EquipmentFunction'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, equipmentDetectAreaAttrAdd },
data() {
return {
addOrUpdateVisible: false,
categoryArr: [],
tableBtn,
trueWidth: 200,
tableProps,
list: [],
dataForm: {
code: '',
distributionArea: '',
detectArea: ''
},
detectAreaArr: [{
value: 'Backend',
label: 'Backend'
}, {
value: 'Frontend',
label: 'Frontend'
}, {
value: 'Midend',
label: 'Midend'
}],
distributionAreaArr: [{
value: '00A',
label: '00A'
}, {
value: '00C',
label: '00C'
}, {
value: 'PID24',
label: 'PID24'
}],
dataRule: {
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.WiredCode')]), trigger: 'blur' }
],
distributionArea: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.IssueArea')]), trigger: 'change' }
],
detectArea: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.DetectionArea')]), trigger: 'change' }
]
},
listQuery: {
current: 1,
size: 990,
detectDistributionAreaId: ''
},
isdetail: false
}
},
created() {
this.listQuery.detectDistributionAreaId = this.$route.query.id
this.init()
},
methods: {
init() {
this.isdetail = false
this.isdetail = Boolean(this.$route.query.isdetail)
this.list.splice(0, this.list.length)
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.listQuery.detectDistributionAreaId) {
equipmentDetectAreaDetail(this.listQuery.detectDistributionAreaId).then(res => {
this.dataForm = res.data
})
equipmentDetectAreaAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
} else {
equipmentDetectAreaCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
getList() {
equipmentDetectAreaAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentDetectAreaAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'code': this.dataForm.code,
'detectArea': this.dataForm.detectArea,
'distributionArea': this.dataForm.distributionArea,
'id': this.listQuery.detectDistributionAreaId
}
if (this.listQuery.detectDistributionAreaId) {
equipmentDetectAreaUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
equipmentDetectAreaAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.listQuery.detectDistributionAreaId = res.data.id
})
}
}
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goEdit() {
this.isdetail = false
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,130 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-05-28 10:12:01
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')" prop="equipmentId">
<el-select v-model="dataForm.equipmentId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentName')])" clearable>
<el-option
v-for="item in equipmentArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { equipmentDetectAreaAttrDetail, equipmentDetectAreaAttrUpdate, equipmentDetectAreaAttrAdd } from '@/api/basicData/Equipment/equipmentDetectAreaAttr'
import { equipmentInfoList } from '@/api/basicData/Equipment/equipmentInfo'
export default {
props: {
detectDistributionAreaId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
dataForm: {
id: 0,
equipmentId: ''
},
equipmentArr: [],
dataRule: {
equipmentId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
equipmentInfoList({
current: 1,
size: 999,
name: ''
}).then(response => {
this.equipmentArr = response.data.records
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentDetectAreaAttrDetail(this.dataForm.id).then(res => {
this.dataForm.equipmentId = res.data.equipmentId
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'equipmentId': this.dataForm.equipmentId,
'detectDistributionAreaId': this.detectDistributionAreaId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
equipmentDetectAreaAttrUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentDetectAreaAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,234 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-26 14:02:11
* @enName:
-->
<template>
<el-container style="margin:30px">
<el-aside style="width:250px">
<el-tree :data="menuList" :props="defaultProps" @node-click="getOrganization" />
</el-aside>
<el-main style="border:2px solid #E4E4E4;border-radius:10px;margin-left:10px">
<el-form
ref="dataForm"
:model="listQuery"
:inline="true"
size="medium"
label-position="left"
>
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')+''">
<span style="color:#1890FF">{{ listQuery.detectEquipmentAreaName }}</span>
</el-form-item>
<el-form-item :label="keyName +''" prop="name">
<el-input v-model="listQuery.name" :placeholder="placeholderName" clearable :style="{width: '100%'}" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
<el-button v-if="listQuery.detectEquipmentAreaId" type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</el-main>
<equipmentDetectParam-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :detect-equipment-area-id="listQuery.detectEquipmentAreaId" @refreshDataList="getList" />
</el-container>
</template>
<script>import i18n from '@/lang'
import { equipmentDetectParamList, equipmentDetectParamDelete } from '@/api/basicData/Equipment/equipmentDetectParam'
import { equipmentDetectTreeList } from '@/api/basicData/Equipment/equipmentDetectArea'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import equipmentDetectParamAttrAdd from './equipmentDetectParamAttr-add'
import basicData from '@/filters/basicData'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'name',
label: i18n.t('module.basicData.equipmentDetectInfo.TestParameterName'),
align: 'center',
width: '200px'
},
{
prop: 'value',
label: i18n.t('module.basicData.equipmentDetectInfo.ReferenceValue'),
align: 'center'
},
{
prop: 'distribution',
label: i18n.t('module.basicData.equipmentDetectInfo.IssueOrNot'),
filter: basicData('onDuty'),
align: 'center'
},
{
prop: 'testFrequency',
label: i18n.t('module.basicData.equipmentDetectInfo.TestFrequency'),
align: 'center'
},
{
prop: 'testSystem',
label: i18n.t('module.basicData.equipmentDetectInfo.TestSystem'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Description'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, equipmentDetectParamAttrAdd },
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipmentDetectInfo.TestParameterName'),
addOrUpdateVisible: false,
menuList: [],
tableBtn,
trueWidth: 200,
tableProps,
list: [],
listQuery: {
detectEquipmentAreaId: '',
detectEquipmentAreaName: '',
name: '',
current: 1,
size: 10
},
defaultProps: {
children: 'children',
label: 'name'
}
}
},
created() {
this.init()
},
methods: {
async init() {
const TreeListQuery = {
current: 1,
size: 500
}
this.menuList.splice(0, this.menuList.length)
this.menuList = [
{
'name': '全部',
'children': []
}
]
const res = await equipmentDetectTreeList(TreeListQuery)
if (res.code === 0) {
this.menuList[0].children = res.data
if (this.menuList[0].children) {
this.menuList[0].children.forEach(item => {
item.name = item.detectArea
if (item.detectSystemVoList) {
item.children = item.detectSystemVoList
item.detectSystemVoList.forEach(item1 => {
if (item1.equipmentVoList) { item1.children = item1.equipmentVoList }
})
}
})
}
}
this.getList()
},
getList() {
equipmentDetectParamList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
},
getOrganization(data) {
if (data.detectEquipmentAreaId) {
this.listQuery.detectEquipmentAreaId = data.detectEquipmentAreaId
this.listQuery.detectEquipmentAreaName = data.name
this.getList()
} else {
this.listQuery.detectEquipmentAreaId = ''
this.listQuery.detectEquipmentAreaName = ''
}
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentDetectParamDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
.el-container >>> .el-aside{
border:2px solid #E4E4E4;
border-radius:10px;
background-color: white;
min-height:550px;
padding-top:20px
}
</style>

View File

@@ -0,0 +1,180 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-26 14:03:06
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
><el-row :gutter="10">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="180px"
label-position="left"
>
<el-col :span="10">
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.TestParameterName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$t('module.basicData.equipmentDetectInfo.TestParameterName')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.ReferenceValue')" prop="value">
<el-input v-model="dataForm.value" :placeholder="$t('module.basicData.equipmentDetectInfo.ReferenceValue')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.TestFrequency')" prop="testFrequency">
<el-input v-model="dataForm.testFrequency" :placeholder="$t('module.basicData.equipmentDetectInfo.TestFrequency')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.TestSystem')" prop="testSystem">
<el-select v-model="dataForm.testSystem" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.TestSystem')])" clearable>
<el-option
v-for="item in DetectSystemList"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.IssueOrNot')" prop="distribution">
<el-switch v-model="dataForm.distribution" active-value="1" inactive-value="0" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$t('module.basicData.visual.Description')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$t('module.basicData.visual.Remarks')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-dialog>
</template>
<script>
import { equipmentDetectSystemList } from '@/api/basicData/Equipment/equipmentDetectSystem'
import { equipmentDetectParamDetail, equipmentDetectParamUpdate, equipmentDetectParamAdd } from '@/api/basicData/Equipment/equipmentDetectParam'
export default {
props: {
detectEquipmentAreaId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
dataForm: {
id: 0,
name: undefined,
value: undefined,
testFrequency: undefined,
testSystem: undefined,
distribution: false,
description: undefined,
remark: undefined
},
DetectSystemList: [],
rules: {
name: [],
value: [],
testFrequency: [],
testSystem: [],
description: [],
remark: []
}
}
},
methods: {
init(id) {
const params = {
current: 1,
size: 500
}
equipmentDetectSystemList(params).then(response => {
if (response.data.records) {
this.DetectSystemList = response.data.records
} else {
this.DetectSystemList.splice(0, this.DetectSystemList.length)
}
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentDetectParamDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
data.detectEquipmentAreaId = this.detectEquipmentAreaId
if (this.dataForm.id) {
equipmentDetectParamUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentDetectParamAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,122 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-05-21 10:44:13
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="200px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.code')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.code')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemAbbr')" prop="abbr">
<el-input v-model="dataForm.abbr" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipmentDetectInfo.equipmentDetectSystemAbbr')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.FunctionDescription')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.FunctionDescription')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { equipmentDetectSystemDetail, equipmentDetectSystemUpdate, equipmentDetectSystemAdd, equipmentDetectSystemCode } from '@/api/basicData/Equipment/equipmentDetectSystem'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
abbr: '',
description: ''
},
dataRule: {
name: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName')]),
trigger: 'blur' }
],
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipmentDetectInfo.code')]),
trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentDetectSystemDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
equipmentDetectSystemCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'abbr': this.dataForm.abbr,
'description': this.dataForm.description,
'id': this.dataForm.id
}
if (this.dataForm.id) {
equipmentDetectSystemUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentDetectSystemAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,113 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-13 14:33:42
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="110px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.groupName')" prop="groupName">
<el-input v-model="dataForm.groupName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.groupName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.groupCode')" prop="groupCode">
<el-input v-model="dataForm.groupCode" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.groupCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { equipmentGroupUpdate, equipmentGroupAdd, equipmentGroupDetail, equipmentGroupGetCode } from '@/api/basicData/Equipment/equipmentGroup'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
groupName: '',
groupCode: '',
remark: ''
},
dataRule: {
groupName: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryName')]),
trigger: 'blur' }
]
}
}
},
mounted() {
this.getCode()
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentGroupDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
getCode() {
equipmentGroupGetCode().then(res => {
if (res.code === 0) {
this.dataForm.groupCode = res.data
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
if (this.dataForm.id) {
equipmentGroupUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentGroupAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,664 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
-->
<template>
<div style="margin:20px">
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">{{ isdetail? 'btn.detail' : !listQuery.equipmentId ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<div style="margin:0 15px">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="220px"
>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')" prop="name">
<el-input v-model="dataForm.name" autofocus :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.EquipmentCode')" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentCode')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
<el-input v-model="dataForm.enName" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbr">
<el-input v-model="dataForm.abbr" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.EquipmentType')" prop="equipmentType">
<el-select
v-model="dataForm.equipmentType"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentType')])"
clearable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in equipmentTypeOption"
:key="index"
:label="item.name"
:value="item.id"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.EquipmentGrouping')" prop="groupId">
<el-select
v-model="dataForm.groupId"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentGrouping')])"
clearable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in equipmentGroupOption"
:key="index"
:label="item.groupName"
:value="item.id"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="spec">
<el-input v-model="dataForm.spec" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.productionTime')" prop="productionTime">
<el-date-picker
v-model="dataForm.productionTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.productionTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.enterTime')" prop="enterTime">
<el-date-picker
v-model="dataForm.enterTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.enterTime')])"
clearable
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.debugTime')" prop="debugTime">
<el-date-picker
v-model="dataForm.debugTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.debugTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.DebugPeriod')" prop="debugPeriod">
<el-input v-model="dataForm.debugPeriod" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.DebugPeriod')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Manufacturer')" prop="manufacturer">
<el-input
v-model="dataForm.manufacturer"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Manufacturer')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.intellectualProperty')" prop="intellectualProperty">
<el-input
v-model="dataForm.intellectualProperty"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.intellectualProperty')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.rangeNumber')" prop="rangeNumber">
<el-input-number
v-model="dataForm.rangeNumber"
:disabled="isdetail"
:step="1"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.rangeNumber')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
<el-input v-model="dataForm.description" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Description')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.plcVersion')" prop="plcVersion">
<el-input v-model="dataForm.plcVersion" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.plcVersion')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.eapVersion')" prop="eapVersion">
<el-input v-model="dataForm.eapVersion" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.eapVersion')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.maintenanceCycle')" prop="maintenanceCycle">
<el-input v-model="dataForm.maintenanceCycle" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.maintenanceCycle')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.maintenanceTime')" prop="maintenanceTime">
<el-input v-model="dataForm.maintenanceTime" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.maintenanceTime')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item :label="$t('module.basicData.equipment.E10Status')" prop="estatus">
<el-switch
v-model="dataForm.estatus"
:disabled="isdetail"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('module.basicData.equipment.activiation')" prop="activiation">
<el-switch
v-model="dataForm.activiation"
:disabled="isdetail"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('module.basicData.equipment.communication')" prop="communication">
<el-switch
v-model="dataForm.communication"
:disabled="isdetail"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="$t('module.basicData.equipment.controlStatus')" prop="controlStatus">
<el-switch
v-model="dataForm.controlStatus"
:disabled="isdetail"
:active-value="1"
:inactive-value="0"
active-text="远程"
inactive-text="本地"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="9">
<el-form-item v-if="listQuery.equipmentId && !isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="eImg">
<el-upload
ref="eImg"
name="files"
:data="typeCode"
:file-list="eImgfileList"
:action="eImgAction"
:before-upload="eImgBeforeUpload"
accept="image/*"
:on-success="saveUpload"
>
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
</el-upload>
</el-form-item>
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="upInfo">
<div v-for="item in imgList" :key="item.id">
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item v-if="listQuery.equipmentId && !isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="eInfo">
<el-upload
ref="eInfo"
:on-success="saveUpload"
name="files"
:data="typeCode"
:file-list="eInfofileList"
:action="eInfoAction"
multiple
:before-upload="eInfoBeforeUpload"
>
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
</el-upload>
</el-form-item>
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
<div v-for="item in fileList" :key="item.id">
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="listQuery.equipmentId" type="primary" @click="addNew()">{{ 'btn.addattr' | i18nFilter }}</el-button>
</span>
</div>
<div style="overflow:auto;height:380px">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
</div>
<equipment-info-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :equipment-id="listQuery.equipmentId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import {
equipmentInfoDetail,
equipmentInfoUpdate,
equipmentInfoAdd,
equipmentInfoCode,
equipmentInfoFileAdd,
getEquipmentInfoFile
} from '@/api/basicData/Equipment/equipmentInfo'
import { equipmentGroupList } from '@/api/basicData/Equipment/equipmentGroup'
import { equipmentInfoAttrList, equipmentInfoAttrDelete } from '@/api/basicData/Equipment/equipmentInfoAttr'
import { equipmentTypeList } from '@/api/basicData/Equipment/equipmentType'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import equipmentInfoAttrAdd from './equipmentInfoAttr-add'
import { uploadPath } from '@/api/basic'
import { timeFormatter } from '@/filters'
import { getUrl } from '@/api/file'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'attrName',
label: i18n.t('module.basicData.visual.AttributeName'),
align: 'center'
},
{
prop: 'attrValue',
label: i18n.t('module.basicData.visual.AttributeValue'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, equipmentInfoAttrAdd },
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
listLoading: false,
dataForm: {
name: '',
code: '',
enName: '',
abbr: '',
equipmentType: '',
spec: '',
productionTime: '',
enterTime: '',
debugTime: '',
debugPeriod: '',
manufacturer: '',
intellectualProperty: '',
rangeNumber: '',
remark: '',
description: '',
groupId: '',
eImg: null,
eInfo: null,
communication: 0,
controlStatus: 0,
plcVersion: '',
eapVersion: '',
activiation: 0,
estatus: 0,
maintenanceTime: '',
maintenanceCycle: ''
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentName')]),
trigger: 'blur'
}],
code: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentCode')]),
trigger: 'blur'
}],
equipmentType: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentType')]),
trigger: 'change'
}],
maintenanceCycle: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.maintenanceCycle')]),
trigger: 'blur'
}],
maintenanceTime: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.maintenanceTime')]),
trigger: 'blur'
}]
},
typeCode: {},
eImgAction: uploadPath,
eImgfileList: [],
eInfoAction: uploadPath,
eInfofileList: [],
equipmentTypeOption: [],
equipmentGroupOption: [],
listQuery: {
current: 1,
size: 990,
equipmentId: ''
},
isdetail: false,
downloadList: [],
fileList: [],
imgList: []
}
},
created() {
this.listQuery.equipmentId = this.$route.query.id
this.init()
},
methods: {
init() {
this.isdetail = false
this.isdetail = Boolean(this.$route.query.isdetail)
if (this.isdetail) {
const data =
{
'equipmentId': this.listQuery.equipmentId
}
getEquipmentInfoFile(data).then(res => {
this.downloadList = res.data
this.downloadList.forEach(item => {
if (item.typeCode === 'equipmentInfoImage') {
this.imgList.push(item)
} else {
this.fileList.push(item)
}
})
})
}
this.list.splice(0, this.list.length)
equipmentTypeList(this.listQuery).then(response => {
this.equipmentTypeOption = response.data.records
})
equipmentGroupList(this.listQuery).then(response => {
this.equipmentGroupOption = response.data.records
})
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.listQuery.equipmentId) {
this.listLoading = true
equipmentInfoDetail(this.listQuery.equipmentId).then(res => {
this.dataForm = res.data
})
equipmentInfoAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.listLoading = false
})
} else {
equipmentInfoCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
getList() {
this.listLoading = true
equipmentInfoAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.listLoading = false
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.attrName}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentInfoAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 表单提交
dataFormSubmit() {
console.log(this.dataForm)
console.log(this.dataForm.eInfo)
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
data.id = this.listQuery.equipmentId
if (this.listQuery.equipmentId) {
equipmentInfoUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
equipmentInfoAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.listQuery.equipmentId = res.data.id
})
}
}
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$router.go(-1)
},
goEdit() {
this.isdetail = false
},
eImgBeforeUpload(file) {
this.typeCode.typeCode = 'equipmentInfoImage'
const isRightSize = file.size / 1024 / 1024 < 10
if (!isRightSize) {
this.$message.error(this.$t('upload.picSizeAlarm'))
}
const isAccept = new RegExp('image/*').test(file.type)
if (!isAccept) {
this.$message.error(this.$t('upload.picAlarm'))
}
return isRightSize && isAccept
},
eInfoBeforeUpload(file) {
this.typeCode.typeCode = 'equipmentInfoFile'
const isRightSize = file.size / 1024 / 1024 < 10
if (!isRightSize) {
this.$message.error(this.$t('upload.picSizeAlarm'))
}
return isRightSize
},
submitUpload() {
this.$refs['eInfo'].submit()
},
saveUpload(res) {
const data =
{
'equipmentId': this.listQuery.equipmentId,
'fileId': res.data[0].id,
'fileName': res.data[0].fileName,
'fileUrl': res.data[0].fileUrl,
'typeCode': this.typeCode.typeCode
}
console.log(data)
equipmentInfoFileAdd(data).then(res => {
console.log(res)
})
},
downloadFile(id) {
getUrl({
attachmentId: id,
type: 1
}).then(response => {
let fileName = ''
const contentDisposition = response.headers['content-disposition']
if (contentDisposition) {
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
}
const blob = new Blob([response.data])
const reader = new FileReader()
reader.readAsDataURL(blob)
reader.onload = (e) => {
const a = document.createElement('a')
a.download = fileName
a.href = e.target.result
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,135 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:31:46
* @Description:
-->
<template>
<el-drawer
:append-to-body="true"
:show-close="false"
:visible.sync="visible"
size="40%"
>
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">
{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
</div>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.visual.AttributeName')" prop="attrName">
<el-input v-model="dataForm.attrName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.AttributeValue')" prop="attrValue">
<el-input v-model="dataForm.attrValue" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeValue')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-drawer>
</template>
<script>
import { equipmentInfoAttrDetail, equipmentInfoAttrUpdate, equipmentInfoAttrAdd } from '@/api/basicData/Equipment/equipmentInfoAttr'
export default {
props: {
equipmentId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
btnLoading: false,
dataForm: {
id: 0,
attrName: '',
attrValue: '',
remark: ''
},
dataRule: {
attrName: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
],
attrValue: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeValue')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.btnLoading = false
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentInfoAttrDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.btnLoading = true
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'attrName': this.dataForm.attrName,
'attrValue': this.dataForm.attrValue,
'remark': this.dataForm.remark,
'equipmentId': this.equipmentId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
equipmentInfoAttrUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentInfoAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,542 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-22 15:32:41
* @enName:
-->
<template>
<div style="margin:20px">
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">
{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
</div>
<div style="margin:0 15px">
<el-row :gutter="15">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="120px"
label-position="right"
>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.WiredEquipment')" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.WiredEquipment')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.WiredCode')" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.WiredCode')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
<el-input v-model="dataForm.enName" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbr">
<el-input v-model="dataForm.abbr" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Manufacturer')" prop="manufacturer">
<el-input
v-model="dataForm.manufacturer"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Manufacturer')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="spec">
<el-input v-model="dataForm.spec" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.productionTime')" prop="productionTime">
<el-date-picker
v-model="dataForm.productionTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.productionTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.enterTime')" prop="enterTime">
<el-date-picker
v-model="dataForm.enterTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.enterTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.debugTime')" prop="debugTime">
<el-date-picker
v-model="dataForm.debugTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.debugTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.DebugPeriod')" prop="debugPeriod">
<el-input v-model="dataForm.debugPeriod" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.DebugPeriod')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.connectUpperDevice')" prop="connectUpperDevice">
<el-input
v-model="dataForm.connectUpperDevice"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.connectUpperDevice')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.equipment.connectLowerDevice')" prop="connectLowerDevice">
<el-input
v-model="dataForm.connectLowerDevice"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.connectLowerDevice')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.CurrentState')" prop="currentStatus">
<el-select
v-model="dataForm.currentStatus"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.CurrentState')])"
clearable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in currentStatusOptions"
:key="index"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item v-if="listQuery.connectingDeviceId && !isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="eImg">
<el-upload
ref="eImg"
name="files"
:data="typeCode"
:file-list="eImgfileList"
:action="eImgAction"
:before-upload="eImgBeforeUpload"
accept="image/*"
:on-success="saveUpload"
>
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
</el-upload>
</el-form-item>
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentImg')" prop="upInfo">
<div v-for="item in imgList" :key="item.id">
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item v-if="listQuery.connectingDeviceId && !isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
<el-upload
ref="upInfo"
name="files"
:data="typeCode"
:file-list="upInfofileList"
:action="upInfoAction"
multiple
:before-upload="upInfoBeforeUpload"
:on-success="saveUpload"
>
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
</el-upload>
</el-form-item>
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
<div v-for="item in fileList" :key="item.id">
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
</div>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="listQuery.connectingDeviceId" type="primary" @click="addNew()">{{ 'btn.addattr' | i18nFilter }}</el-button>
</span>
</div>
<div style="height:380px;overflow:auto">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
</div>
<equipment-link-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :connecting-device-id="listQuery.connectingDeviceId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import {
equipmentLinkDetail,
equipmentLinkUpdate,
equipmentLinkAdd,
equipmentLinkCode,
equipmentLinkFileAdd,
getEquipmentLinkFile
} from '@/api/basicData/Equipment/equipmentLink'
import { equipmentLinkAttrList, equipmentLinkAttrDelete } from '@/api/basicData/Equipment/equipmentLinkAttr'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import equipmentLinkAttrAdd from './equipmentLinkAttr-add'
import { uploadPath } from '@/api/basic'
import { timeFormatter } from '@/filters'
import { getUrl } from '@/api/file'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.visual.AttributeName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.visual.AttributeCode'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, equipmentLinkAttrAdd },
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
dataForm: {
id: 0,
name: '',
code: '',
enName: '',
abbr: '',
manufacturer: '',
spec: '',
productionTime: '',
enterTime: '',
debugTime: '',
debugPeriod: '',
connectUpperDevice: '',
connectLowerDevice: '',
currentStatus: '',
remark: '',
eImg: null,
upInfo: null
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.WiredEquipment')]),
trigger: 'blur'
}],
code: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.WiredCode')]),
trigger: 'blur'
}]
},
typeCode: {},
eImgAction: uploadPath,
eImgfileList: [],
upInfoAction: uploadPath,
upInfofileList: [],
currentStatusOptions: [{
'label': '正常',
'value': 0
}, {
'label': '暂停',
'value': 1
}, {
'label': '维修',
'value': 2
}],
listQuery: {
current: 1,
size: 990,
connectingDeviceId: ''
},
isdetail: false,
downloadList: [],
fileList: [],
imgList: []
}
},
created() {
this.listQuery.connectingDeviceId = this.$route.query.id
this.init()
},
methods: {
init() {
this.isdetail = false
this.isdetail = Boolean(this.$route.query.isdetail)
if (this.isdetail) {
const data =
{
'connectingDeviceId': this.listQuery.connectingDeviceId
}
getEquipmentLinkFile(data).then(res => {
this.downloadList = res.data
this.downloadList.forEach(item => {
if (item.typeCode === 'equipmentLinkImage') {
this.imgList.push(item)
} else {
this.fileList.push(item)
}
})
})
}
this.list.splice(0, this.list.length)
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.listQuery.connectingDeviceId) {
equipmentLinkDetail(this.listQuery.connectingDeviceId).then(res => {
this.dataForm = res.data
})
equipmentLinkAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
} else {
equipmentLinkCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
getList() {
equipmentLinkAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
},
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentLinkAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'abbr': this.dataForm.abbr,
'code': this.dataForm.code,
'connectLowerDevice': this.dataForm.connectLowerDevice,
'connectUpperDevice': this.dataForm.connectUpperDevice,
'currentStatus': this.dataForm.currentStatus,
'debugTime': this.dataForm.debugTime,
'enName': this.dataForm.enName,
'enterTime': this.dataForm.enterTime,
'manufacturer': this.dataForm.manufacturer,
'name': this.dataForm.name,
'productionTime': this.dataForm.productionTime,
'remark': this.dataForm.remark,
'spec': this.dataForm.spec,
'debugPeriod': this.dataForm.debugPeriod,
'id': this.listQuery.connectingDeviceId
}
if (this.listQuery.connectingDeviceId) {
equipmentLinkUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
equipmentLinkAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.listQuery.connectingDeviceId = res.data.id
})
}
}
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$router.go(-1)
},
goEdit() {
this.isdetail = false
},
eImgBeforeUpload(file) {
this.typeCode.typeCode = 'equipmentLinkImage'
const isRightSize = file.size / 1024 / 1024 < 10
if (!isRightSize) {
this.$message.error(this.$t('upload.picSizeAlarm'))
}
const isAccept = new RegExp('image/*').test(file.type)
if (!isAccept) {
this.$message.error(this.$t('upload.picAlarm'))
}
return isRightSize && isAccept
},
upInfoBeforeUpload(file) {
this.typeCode.typeCode = 'equipmentLinkFile'
const isRightSize = file.size / 1024 / 1024 < 10
if (!isRightSize) {
this.$message.error(this.$t('upload.picSizeAlarm'))
}
return isRightSize
},
submitUpload() {
this.$refs['upInfo'].submit()
},
saveUpload(res) {
const data =
{
'connectingDeviceId': this.listQuery.connectingDeviceId,
'fileId': res.data[0].id,
'fileName': res.data[0].fileName,
'fileUrl': res.data[0].fileUrl,
'typeCode': this.typeCode.typeCode
}
equipmentLinkFileAdd(data).then(res => {
console.log(res)
})
},
downloadFile(id) {
getUrl({
attachmentId: id,
type: 1
}).then(response => {
let fileName = ''
const contentDisposition = response.headers['content-disposition']
if (contentDisposition) {
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
}
const blob = new Blob([response.data])
const reader = new FileReader()
reader.readAsDataURL(blob)
reader.onload = (e) => {
const a = document.createElement('a')
a.download = fileName
a.href = e.target.result
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,141 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:31:54
* @Description:
-->
<template>
<el-drawer
:append-to-body="true"
:show-close="false"
:visible.sync="visible"
size="40%"
>
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">
{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
</div>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.visual.AttributeName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.AttributeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-drawer>
</template>
<script>
import { equipmentLinkAttrDetail, equipmentLinkAttrUpdate, equipmentLinkAttrAdd, equipmentLinkAttrCode } from '@/api/basicData/Equipment/equipmentLinkAttr'
export default {
props: {
connectingDeviceId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
btnLoading: false,
dataForm: {
id: 0,
name: '',
code: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.btnLoading = false
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentLinkAttrDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.remark = res.data.remark
})
} else {
equipmentLinkAttrCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.btnLoading = true
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'remark': this.dataForm.remark,
'connectingDeviceId': this.connectingDeviceId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
equipmentLinkAttrUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentLinkAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,248 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:24:50
* @Description:
-->
<template>
<el-dialog
:title="isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="180px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeName')" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeCode')" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.parentName')" prop="parentA">
<el-cascader
v-model="dataForm.parentA"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.parentName')])"
:props="{ checkStrictly: true }"
:options="parentArr"
filterable
clearable
@change="setParent"
/>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
<el-form-item v-if="dataForm.id && !isdetail" :label="$t('module.basicData.visual.uploadInfo')" prop="upInfo">
<el-upload
ref="upInfo"
name="files"
:data="typeCode"
:file-list="upInfofileList"
:action="upInfoAction"
multiple
:before-upload="upInfoBeforeUpload"
:on-success="saveUpload"
>
<el-button size="small" type="primary" icon="el-icon-upload">{{ 'btn.upload' | i18nFilter }}</el-button>
</el-upload>
</el-form-item>
<el-form-item v-if="isdetail" :label="$t('module.basicData.equipment.equipmentInfo')" prop="upInfo">
<div v-for="item in fileList" :key="item.id">
{{ item.fileName }} <el-button size="small" type="primary" icon="el-icon-upload" @click="downloadFile(item.fileId)">{{ 'btn.download' | i18nFilter }}</el-button>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import {
equipmentTypeDetail,
equipmentTypeUpdate,
equipmentTypeAdd,
equipmentTypeCode,
equipmentTypeListAll,
equipmentTypeFileAdd,
getEquipmentTypeFile
} from '@/api/basicData/Equipment/equipmentType'
import { uploadPath } from '@/api/basic'
import { getUrl } from '@/api/file'
export default {
data() {
return {
visible: false,
parentArr: [],
dataForm: {
id: 0,
name: '',
code: '',
parentA: '',
parentName: '',
parentId: '',
remark: ''
},
typeCode: {},
upInfoAction: uploadPath,
upInfofileList: [],
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentTypeName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentTypeCode')]), trigger: 'blur' }
]
},
isdetail: false,
fileList: []
}
},
methods: {
init(id, isdetail) {
this.isdetail = false
this.isdetail = isdetail
if (this.isdetail) {
const data =
{
'equipmentTypeId': id
}
getEquipmentTypeFile(data).then(res => {
this.fileList = res.data
this.fileList.forEach(item => {
item.fileType = item.fileUrl.split('.')[1]
})
})
}
equipmentTypeCode().then(res => {
this.dataForm.code = res.data
})
this.parentArr.splice(0, this.parentArr.length)
equipmentTypeListAll().then(res => {
res.data.forEach(item => {
this.setArr(item)
})
this.parentArr = res.data
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentTypeDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
this.dataForm.parentA = res.data.parentId + ',' + res.data.parentName
})
}
})
},
setArr(obj) {
obj.value = obj.id + ',' + obj.name
obj.label = obj.name
if (obj.children) {
obj.children.forEach(item => {
this.setArr(item)
})
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'remark': this.dataForm.remark,
'id': this.dataForm.id,
'parentId': this.dataForm.parentId,
'parentName': this.dataForm.parentName
}
if (this.dataForm.id) {
equipmentTypeUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentTypeAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
},
setParent(key) {
const str = key[key.length - 1]
if (str) {
this.dataForm.parentId = str.substring(0, str.indexOf(','))
this.dataForm.parentName = str.substring(str.indexOf(',') + 1)
}
},
upInfoBeforeUpload(file) {
this.typeCode.typeCode = 'equipmentTypeFile'
const isRightSize = file.size / 1024 / 1024 < 10
if (!isRightSize) {
this.$message.error(this.$t('upload.picSizeAlarm'))
}
return isRightSize
},
submitUpload() {
this.$refs['upInfo'].submit()
},
saveUpload(res) {
const data =
{
'equipmentTypeId': this.dataForm.id,
'fileId': res.data[0].id,
'fileName': res.data[0].fileName,
'fileUrl': res.data[0].fileUrl,
'typeCode': this.typeCode.typeCode
}
equipmentTypeFileAdd(data).then(res => {
console.log(res)
})
},
downloadFile(id) {
getUrl({
attachmentId: id,
type: 1
}).then(response => {
let fileName = ''
const contentDisposition = response.headers['content-disposition']
if (contentDisposition) {
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
}
const blob = new Blob([response.data])
const reader = new FileReader()
reader.readAsDataURL(blob)
reader.onload = (e) => {
const a = document.createElement('a')
a.download = fileName
a.href = e.target.result
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}
})
}
}
}
</script>

View File

@@ -0,0 +1,201 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-12 16:29:08
* @enName:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
size="60%"
>
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<div style="margin:0 15px">
<el-form ref="dataForm" :model="dataForm" label-width="100px">
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeName')])" readonly />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.EquipmentTypeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentTypeCode')])" readonly />
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button v-if="listQuery.equipmentTypeId && !isDetail" type="primary" @click="addNew()">{{ 'btn.adddetail' | i18nFilter }}</el-button>
</div>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isDetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
<equipmentAlarm-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :equipment-type-id="listQuery.equipmentTypeId" @refreshDataList="getList" />
</el-drawer>
</template>
<script>import i18n from '@/lang'
import { equipmentAlarmAttrList, equipmentAlarmAttrDelete } from '@/api/basicData/Equipment/equipmentAlarmAttr'
import {
equipmentTypeDetail
} from '@/api/basicData/Equipment/equipmentType'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import equipmentAlarmAttrAdd from './equipmentTypeAlarmAttr-add'
import { timeFormatter } from '@/filters'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.alarmManagement.AlarmCode'),
align: 'center'
},
{
prop: 'alarmType',
label: i18n.t('module.basicData.alarmManagement.AlarmType'),
align: 'center'
},
{
prop: 'alarmGrade',
label: i18n.t('module.basicData.alarmManagement.AlarmLevel'),
align: 'center'
},
{
prop: 'alarmContent',
label: i18n.t('module.basicData.alarmManagement.AlarmContent'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, equipmentAlarmAttrAdd },
data() {
return {
visible: false,
addOrUpdateVisible: false,
categoryArr: [],
tableBtn,
trueWidth: 200,
tableProps,
list: [],
dataForm: {
id: 0,
name: '',
code: ''
},
listQuery: {
current: 1,
size: 990,
equipmentTypeId: ''
},
isDetail: false
}
},
methods: {
init(id, isDetail) {
this.isDetail = false
this.isDetail = isDetail
this.dataForm.id = id || ''
this.listQuery.equipmentTypeId = ''
this.list.splice(0, this.list.length)
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentTypeDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
this.listQuery.equipmentTypeId = this.dataForm.id
equipmentAlarmAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
}
})
},
getList() {
equipmentAlarmAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
},
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentAlarmAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$emit('refreshDataList')
this.visible = false
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,138 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:32:09
* @Description:
-->
<template>
<el-drawer
:append-to-body="true"
:show-close="false"
:visible.sync="visible"
size="40%"
>
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmType')" prop="alarmType">
<el-input v-model="dataForm.alarmType" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmType')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmLevel')" prop="alarmGrade">
<el-input v-model="dataForm.alarmGrade" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmLevel')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.alarmManagement.AlarmContent')" prop="alarmContent">
<el-input v-model="dataForm.alarmContent" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.alarmManagement.AlarmContent')])" clearable />
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-drawer>
</template>
<script>
import { equipmentAlarmAttrDetail, equipmentAlarmAttrUpdate, equipmentAlarmAttrAdd } from '@/api/basicData/Equipment/equipmentAlarmAttr'
export default {
props: {
equipmentTypeId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
btnLoading: false,
dataForm: {
id: 0,
alarmType: '',
code: '',
alarmGrade: '',
alarmContent: ''
},
dataRule: {
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.AlarmCode')]), trigger: 'blur' }
],
alarmContent: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.alarmManagement.alarmContent')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.btnLoading = false
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
equipmentAlarmAttrDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.btnLoading = true
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'alarmType': this.dataForm.alarmType,
'code': this.dataForm.code,
'alarmGrade': this.dataForm.alarmGrade,
'alarmContent': this.dataForm.alarmContent,
'equipmentTypeId': this.equipmentTypeId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
equipmentAlarmAttrUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
equipmentAlarmAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,110 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:25:01
* @enName:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="160px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.maintenancePeriod')" prop="maintenancePeriod">
<el-input v-model="dataForm.maintenancePeriod" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.maintenancePeriod')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.PeriodCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.PeriodCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { maintenanceCycleDetail, maintenanceCycleUpdate, maintenanceCycleAdd, maintenanceCycleCode } from '@/api/basicData/Equipment/maintenanceCycle'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
maintenancePeriod: '',
code: '',
remark: ''
},
dataRule: {
maintenancePeriod: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.maintenancePeriod')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.PeriodCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
maintenanceCycleCode().then(res => {
this.dataForm.code = res.data
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
maintenanceCycleDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'maintenancePeriod': this.dataForm.maintenancePeriod,
'code': this.dataForm.code,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
maintenanceCycleUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
maintenanceCycleAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,118 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-06 13:57:57
* @enName:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="150px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.RepairTypeName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.RepairTypeName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.RepairTypeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.RepairTypeCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
<el-input v-model="dataForm.enName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { maintenanceTypeDetail, maintenanceTypeUpdate, maintenanceTypeAdd, maintenanceTypeCode } from '@/api/basicData/Equipment/maintenanceType'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
enName: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.RepairTypeName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.RepairTypeCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
maintenanceTypeCode().then(res => {
this.dataForm.code = res.data
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
maintenanceTypeDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.enName = res.data.enName
this.dataForm.remark = res.data.remark
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'enName': this.dataForm.enName,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
maintenanceTypeUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
maintenanceTypeAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,149 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:25:17
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.SparepartName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.SparepartName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.SparepartCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.SparepartCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.equipment.SparepartModel')" prop="model">
<el-input v-model="dataForm.model" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.SparepartModel')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="specifications">
<el-input v-model="dataForm.specifications" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.unit')" prop="dictDataId">
<el-select v-model="dataForm.dictDataId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.unit')])" clearable>
<el-option
v-for="item in unitArr"
:key="item.id"
:label="item.dataName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { sparePartsDetail, sparePartsUpdate, sparePartsAdd, sparePartsCode } from '@/api/basicData/Equipment/spareParts'
import { ProductPoolUnit } from '@/api/basicData/ProductPool'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
description: '',
model: '',
specifications: '',
dictDataId: ''
},
unitArr: [],
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.SparepartName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.SparepartCode')]), trigger: 'blur' }
],
model: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.SparepartModel')]), trigger: 'blur' }
],
dictDataId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.unit')]), trigger: 'change' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
ProductPoolUnit().then(res => {
this.unitArr = res.data
})
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
sparePartsDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.description = res.data.description
this.dataForm.model = res.data.model
this.dataForm.specifications = res.data.specifications
this.dataForm.dictDataId = res.data.dictDataId
})
} else {
sparePartsCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'description': this.dataForm.description,
'model': this.dataForm.model,
'specifications': this.dataForm.specifications,
'dictDataId': this.dataForm.dictDataId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
sparePartsUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
sparePartsAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,206 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-05-28 10:38:22
* @Description:
-->
<template>
<div class="app-container">
<el-form :inline="true" @keyup.enter.native="getDataList()">
<el-form-item :label="keyName">
<el-select v-model="detectAreaId" :placeholder="placeholderName" clearable>
<el-option
v-for="item in detectAreaArr"
:key="item.id"
:label="item.detectArea"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentDetectAreaSystemList, equipmentDetectAreaSystemDelete } from '@/api/basicData/Equipment/equipmentDetectAreaSystem'
import { equipmentDetectAreaList } from '@/api/basicData/Equipment/equipmentDetectArea'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'detectArea',
label: i18n.t('module.basicData.equipmentDetectInfo.DetectionArea'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName'),
align: 'center'
}
]
export default {
name: 'DetectSystemSettings',
components: { Pagination, BaseTable, MethodBtn },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipmentDetectInfo.DetectionArea'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
},
detectAreaId: '',
detectAreaArr: []
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentDetectAreaSystemDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList() {
const data = {
current: 1,
size: 500
}
equipmentDetectAreaList(data).then(response => {
if (response.data.records) {
this.detectAreaArr = response.data.records
} else {
this.detectAreaArr.splice(0, this.detectAreaArr.length)
}
})
this.listLoading = true
this.listQuery.detectDistributionAreaId = this.detectAreaId
equipmentDetectAreaSystemList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.$router.push({
name: 'detectSystemSettingsAdd',
query: {
id: id,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,208 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-07-23 09:04:12
* @Description:
-->
<template>
<div class="app-container">
<el-form :inline="true" @keyup.enter.native="getDataList()">
<el-form-item :label="keyName">
<el-select v-model="detectArea" :placeholder="placeholderName" clearable>
<el-option
v-for="item in detectAreaArr"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentDetectAreaList, equipmentDetectAreaDelete } from '@/api/basicData/Equipment/equipmentDetectArea'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
// {
// type: 'detail',
// btnName: 'btn.detail'
// }
]
const tableProps = [
{
prop: 'code',
label: i18n.t('module.basicData.equipment.WiredCode'),
align: 'center'
},
{
prop: 'detectArea',
label: i18n.t('module.basicData.equipmentDetectInfo.DetectionArea'),
align: 'center'
},
{
prop: 'distributionArea',
label: i18n.t('module.basicData.equipmentDetectInfo.IssueArea'),
align: 'center'
}
]
export default {
name: 'Material',
components: { Pagination, BaseTable, MethodBtn },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipmentDetectInfo.DetectionArea'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
},
detectArea: '',
detectAreaArr: [{
value: 'Backend',
label: 'Backend'
}, {
value: 'Frontend',
label: 'Frontend'
}, {
value: 'Midend',
label: 'Midend'
}]
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.detectArea}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentDetectAreaDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList() {
this.listLoading = true
this.listQuery.detectArea = this.detectArea
equipmentDetectAreaList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.$router.push({
name: 'equipmentDetectAreaAdd',
query: {
id: id,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,220 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:01:20
* @Description:
-->
<template>
<div class="app-container">
<el-form :inline="true" @keyup.enter.native="getDataList()">
<el-form-item :label="keyName">
<el-select v-model="detectDistributionAreaId" :placeholder="placeholderName" clearable>
<el-option
v-for="item in distributionAreaArr"
:key="item.id"
:label="item.distributionArea"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentDetectAreaAttrList, equipmentDetectAreaAttrDelete } from '@/api/basicData/Equipment/equipmentDetectAreaAttr'
import { equipmentDetectAreaList } from '@/api/basicData/Equipment/equipmentDetectArea'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'distributionArea',
label: i18n.t('module.basicData.equipmentDetectInfo.IssueArea'),
align: 'center'
},
{
prop: 'detectArea',
label: i18n.t('module.basicData.equipmentDetectInfo.DetectionArea'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipment.EquipmentName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.EquipmentCode'),
align: 'center'
},
{
prop: 'function',
label: i18n.t('module.basicData.equipmentDetectInfo.EquipmentFunction'),
align: 'center'
}
]
export default {
name: 'Material',
components: { Pagination, BaseTable, MethodBtn },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipmentDetectInfo.IssueArea'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
},
detectDistributionAreaId: '',
distributionAreaArr: []
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.code}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentDetectAreaAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data)
} else {
this.addNew(raw.data, true)
}
},
getList() {
const params = {
current: 1,
size: 550
}
equipmentDetectAreaList(params).then(response => {
if (response.data.records) {
this.distributionAreaArr = response.data.records
} else {
this.distributionAreaArr.splice(0, this.distributionAreaArr.length)
}
})
this.listLoading = true
this.listQuery.detectDistributionAreaId = this.detectDistributionAreaId
equipmentDetectAreaAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(data, isdetail) {
this.$router.push({
name: 'equipmentDetectParamAdd',
query: {
data: data,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,191 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-05-21 10:11:11
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<equipmentDetectSystem-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import { equipmentDetectSystemList, equipmentDetectSystemDelete } from '@/api/basicData/Equipment/equipmentDetectSystem'
import equipmentDetectSystemAdd from './components/equipmentDetectSystem-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'code',
label: i18n.t('module.basicData.equipmentDetectInfo.code'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName'),
align: 'center'
},
{
prop: 'abbr',
label: i18n.t('module.basicData.equipmentDetectInfo.equipmentDetectSystemAbbr'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.equipment.FunctionDescription'),
align: 'center'
}
]
export default {
name: 'EquipmentDetectSystem',
components: { Pagination, BaseTable, MethodBtn, HeadForm, equipmentDetectSystemAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipmentDetectInfo.equipmentDetectSystemName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10,
name: '',
code: ''
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentDetectSystemDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
equipmentDetectSystemList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,232 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-07-08 09:46:10
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentInfoList, equipmentInfoDelete } from '@/api/basicData/Equipment/equipmentInfo'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
// import { timeFormatter } from '@/filters'
// import dataDict from '@/filters/DataDict'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
// {
// prop: 'createTime',
// label: i18n.t('module.basicData.factory.createTime'),
// filter: timeFormatter,
// align: 'center'
// },
{
prop: 'name',
label: i18n.t('module.basicData.equipment.EquipmentName'),
align: 'center'
},
{
prop: 'equipmentTypeName',
label: i18n.t('module.basicData.equipment.EquipmentType'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.EquipmentCode'),
align: 'center'
},
{
prop: 'equipmentGroupName',
label: i18n.t('module.basicData.equipment.EquipmentGrouping'),
align: 'center'
},
{
prop: 'enName',
label: i18n.t('module.basicData.visual.EnglishName'),
align: 'center'
},
{
prop: 'maintenanceCycle',
label: i18n.t('module.basicData.equipment.maintenanceCycle'),
align: 'center'
},
{
prop: 'maintenanceTime',
label: i18n.t('module.basicData.equipment.maintenanceTime'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.equipment.FunctionDescription'),
align: 'center'
}
// {
// prop: 'abbr',
// label: i18n.t('module.basicData.visual.Abbreviation'),
// align: 'center'
// }
// {
// prop: 'estatus',
// label: i18n.t('module.basicData.visual.CurrentState'),
// filter: dataDict('enableState'),
// align: 'center'
// }
]
export default {
name: 'EquipmentInfo',
components: { Pagination, BaseTable, MethodBtn, HeadForm },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipment.EquipmentName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.EquipmentCode'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentInfoDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
equipmentInfoList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.$router.push({
name: 'equipmentInfoAdd',
query: {
id: id,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,196 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:45:38
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentLinkList, equipmentLinkDelete } from '@/api/basicData/Equipment/equipmentLink'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.WiredCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipment.WiredEquipment'),
align: 'center'
},
{
prop: 'enName',
label: i18n.t('module.basicData.visual.EnglishName'),
align: 'center'
}
]
export default {
name: 'EquipmentLink',
components: { Pagination, BaseTable, MethodBtn, HeadForm },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipment.WiredEquipment') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.WiredCode'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentLinkDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
equipmentLinkList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.$router.push({
name: 'equipmentLinkAdd',
query: {
id: id,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,201 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:59:29
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<equipmentType-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentTypeList, equipmentTypeDelete } from '@/api/basicData/Equipment/equipmentType'
import equipmentTypeAdd from './components/equipmentType-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipment.EquipmentTypeName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.EquipmentTypeCode'),
align: 'center'
},
{
prop: 'parentName',
label: i18n.t('module.basicData.equipment.parentName'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'EquipmentType',
components: { Pagination, BaseTable, MethodBtn, HeadForm, equipmentTypeAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipment.EquipmentTypeName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.EquipmentTypeCode'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
equipmentTypeDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
equipmentTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, isdetail)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,176 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-12 16:27:21
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
:show-add="showAdd"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<equipmentAlarm-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { equipmentTypeList } from '@/api/basicData/Equipment/equipmentType'
import equipmentAlarmAdd from './components/equipmentTypeAlarm-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: i18n.t('module.basicData.equipment.SetAlarm')
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipment.EquipmentTypeName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.EquipmentTypeCode'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'EquipmentAlarm',
components: { Pagination, BaseTable, MethodBtn, HeadForm, equipmentAlarmAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipment.EquipmentTypeName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.EquipmentTypeCode'),
addOrUpdateVisible: false,
tableBtn,
showAdd: false,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'detail') {
this.addNew(raw.data.id, true)
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.category = key
this.listQuery.code = key
equipmentTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, detail) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, detail)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,181 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:45:55
* @Description:
-->
<template>
<div class="app-container">
<div style="margin:10px 50px"><el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button></div>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<maintenanceCycle-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { maintenanceCycleList, maintenanceCycleDelete } from '@/api/basicData/Equipment/maintenanceCycle'
import maintenanceCycleAdd from './components/maintenanceCycle-add.vue'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.PeriodCode'),
align: 'center'
},
{
prop: 'maintenancePeriod',
label: i18n.t('module.basicData.equipment.maintenancePeriod'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'MaintenanceCycle',
components: { Pagination, BaseTable, MethodBtn, maintenanceCycleAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.maintenancePeriod}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
maintenanceCycleDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
maintenanceCycleList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,194 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:46:03
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<maintenanceType-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { maintenanceTypeList, maintenanceTypeDelete } from '@/api/basicData/Equipment/maintenanceType'
import maintenanceTypeAdd from './components/maintenanceType-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipment.RepairTypeName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.equipment.RepairTypeCode'),
align: 'center'
},
{
prop: 'enName',
label: i18n.t('module.basicData.visual.EnglishName'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'MaintenanceType',
components: { Pagination, BaseTable, MethodBtn, HeadForm, maintenanceTypeAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipment.RepairTypeName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.RepairTypeCode'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
maintenanceTypeDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
maintenanceTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,197 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-18 10:38:35
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<spareParts-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { sparePartsList, sparePartsDelete } from '@/api/basicData/Equipment/spareParts'
import sparePartsAdd from './components/spareParts-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'code',
label: i18n.t('module.basicData.equipment.SparepartCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipment.SparepartName'),
align: 'center'
},
{
prop: 'model',
label: i18n.t('module.basicData.equipment.SparepartModel'),
align: 'center'
},
{
prop: 'unit',
label: i18n.t('module.basicData.visual.unit'),
align: 'center'
},
{
prop: 'specifications',
label: i18n.t('module.basicData.visual.Specs'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'SpareParts',
components: { Pagination, BaseTable, MethodBtn, HeadForm, sparePartsAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.equipment.SparepartName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.equipment.SparepartCode'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
sparePartsDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.key = key
sparePartsList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,185 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-07-06 11:26:37
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<Equipment-scrap-grade-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { EquipmentScrapGradeList, EquipmentScrapGradeDelete } from '@/api/basicData/EquipmentScrapGrade'
import EquipmentScrapGradeAdd from './components/EquipmentScrapGrade-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.equipment.EquipmentName'),
align: 'center'
},
{
prop: 'dataName',
label: i18n.t('module.basicData.EquipmentScrapGrade.ScrapGrade'),
align: 'center'
}
]
export default {
name: 'EquipmentScrapGrade',
components: { Pagination, BaseTable, MethodBtn, HeadForm, EquipmentScrapGradeAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.EquipmentScrapGrade.keyword'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10,
name: ''
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
EquipmentScrapGradeDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
EquipmentScrapGradeList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,198 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:46:50
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<Factory-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import { factoryList, factoryDelete } from '@/api/basicData/FactoryManagement/factory'
import FactoryAdd from './components/Factory-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.factory.FactoryName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.factory.FactoryCode'),
align: 'center'
},
{
prop: 'address',
label: i18n.t('module.basicData.factory.Address'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Factory',
components: { Pagination, BaseTable, MethodBtn, HeadForm, FactoryAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.factory.placeholderName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10,
name: '',
code: ''
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
factoryDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
factoryList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,125 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-12 16:24:32
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="120px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.factory.FactoryName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.FactoryName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.factory.FactoryCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.FactoryCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.factory.Address')" prop="address">
<el-input v-model="dataForm.address" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.Address')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { factoryDetail, factoryUpdate, factoryAdd, factoryCode } from '@/api/basicData/FactoryManagement/factory'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
address: '',
description: ''
},
dataRule: {
name: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryName')]),
trigger: 'blur' }
],
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryCode')]),
trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
factoryDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.address = res.data.address
this.dataForm.description = res.data.description
})
} else {
factoryCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'address': this.dataForm.address,
'description': this.dataForm.description,
'id': this.dataForm.id
}
if (this.dataForm.id) {
factoryUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
factoryAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,149 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:25:31
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="170px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.productLine.placeholderName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.productLine.placeholderName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.productLine.ProductionLineCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.productLine.ProductionLineCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.factory.FactoryName')" prop="factoryId">
<el-select v-model="dataForm.factoryId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.FactoryName')])" clearable>
<el-option
v-for="item in factoryArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item v-if="dataForm.id" :label="$t('module.basicData.visual.CurrentState')" prop="enabled">
<el-switch
v-model="dataForm.enabled"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Description')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { lineDetail, lineUpdate, lineAdd, lineCode } from '@/api/basicData/FactoryManagement/line'
import { factoryList } from '@/api/basicData/FactoryManagement/factory'
export default {
data() {
return {
visible: false,
factoryArr: [],
dataForm: {
id: 0,
name: '',
code: '',
factoryId: '',
description: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.productLine.placeholderName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.productLine.ProductionLineCode')]), trigger: 'blur' }
],
factoryId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryName')]), trigger: 'change' }
]
}
}
},
methods: {
init(id) {
lineCode().then(res => {
this.dataForm.code = res.data
})
factoryList({
current: 1,
size: 999,
name: ''
}).then(response => {
this.factoryArr = response.data.records
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
lineDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'factoryId': this.dataForm.factoryId,
'description': this.dataForm.description,
'remark': this.dataForm.remark,
'enabled': this.dataForm.enabled,
'id': this.dataForm.id
}
if (this.dataForm.id) {
lineUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
lineAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,145 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:25:44
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="160px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.workSection.SectionName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.workSection.SectionName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.workSection.WorkSectionCoding')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.workSection.WorkSectionCoding')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.productLine.placeholderName')" prop="productionLineId">
<el-select v-model="dataForm.productionLineId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.productLine.placeholderName')])" clearable>
<el-option
v-for="item in factoryArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Description')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { sectionDetail, sectionUpdate, sectionAdd, sectionCode } from '@/api/basicData/FactoryManagement/section'
import { lineList } from '@/api/basicData/FactoryManagement/line'
export default {
data() {
return {
visible: false,
factoryArr: [],
dataForm: {
id: 0,
name: '',
code: '',
productionLineId: '',
description: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.workSection.SectionName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.workSection.WorkSectionCoding')]), trigger: 'blur' }
],
productionLineId: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.productLine.placeholderName')]),
trigger: 'change'
}]
}
}
},
methods: {
init(id) {
sectionCode().then(res => {
this.dataForm.code = res.data
})
lineList({
current: 1,
size: 999,
name: ''
}).then(response => {
this.factoryArr = response.data.records
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
sectionDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.productionLineId = res.data.productionLineId
this.dataForm.description = res.data.description
this.dataForm.remark = res.data.remark
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'productionLineId': this.dataForm.productionLineId,
'description': this.dataForm.description,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
sectionUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
sectionAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,207 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:47:00
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<product-line-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { lineList, lineDelete } from '@/api/basicData/FactoryManagement/line'
import productLineAdd from './components/product-line-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import dataDict from '@/filters/DataDict'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.productLine.placeholderName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.productLine.ProductionLineCode'),
align: 'center'
},
{
prop: 'factoryName',
label: i18n.t('module.basicData.factory.FactoryName'),
align: 'center'
},
{
prop: 'enabled',
label: i18n.t('module.basicData.visual.CurrentState'),
filter: dataDict('enableState'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Description'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'ProductLine',
components: { Pagination, BaseTable, MethodBtn, HeadForm, productLineAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.productLine.placeholderName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10,
name: ''
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
lineDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
lineList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,199 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:47:09
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<work-section-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { sectionList, sectionDelete } from '@/api/basicData/FactoryManagement/section'
import workSectionAdd from './components/work-section-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.workSection.SectionName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.workSection.WorkSectionCoding'),
align: 'center'
},
{
prop: 'productionLine',
label: i18n.t('module.basicData.productLine.placeholderName'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Description'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'WorkSection',
components: { Pagination, BaseTable, MethodBtn, HeadForm, workSectionAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.workSection.SectionName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
sectionDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
sectionList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,282 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-07 14:53:04
* @Description:
-->
<template>
<el-dialog
:title="isdetail? 'btn.detail' : !groupData.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:close-on-click-modal="false"
:before-close="handleClose"
width="70%"
:visible.sync="visible"
>
<el-form
ref="groupForm"
:model="groupData"
:rules="rules"
size="medium"
label-width="120px"
>
<el-row>
<el-col :span="6">
<el-form-item :label="$t('module.basicData.group.TeamName')" prop="name">
<el-input v-model="groupData.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.group.TeamName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('module.basicData.group.GroupLeader')" prop="teamLeaderId">
<el-select
v-model="groupData.teamLeaderId"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.group.GroupLeader')])"
filterable
clearable
:style="{width: '100%'}"
>
<el-option
v-for="(item) in groupArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="100px" :label="$t('module.basicData.group.TeamStatus')" prop="workStatus">
<el-switch
v-model="groupData.workStatus"
:disabled="isdetail"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="50px">
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
<div v-if="!isdetail">
<el-button type="primary" @click="handelConfirm">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-form-item>
</el-col>
</el-row>
<div v-if="!isdetail">
<el-button v-if="listQuery.teamId" type="primary" icon="el-icon-user" size="medium" @click="addNew()"> {{ 'btn.addgroup' | i18nFilter }} </el-button>
</div>
</el-form>
<base-table
v-if="listQuery.teamId"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<group-member v-if="addOrUpdateVisible" ref="addOrUpdate" :team-id="listQuery.teamId" @refreshDataList="getList" />
</el-dialog>
</template>
<script>import i18n from '@/lang'
import { groupDetail, groupUpdate, groupAdd, groupCode } from '@/api/basicData/GroupModule/group'
import { groupAttrList, groupAttrDelete } from '@/api/basicData/GroupModule/groupAttr'
import { staffList } from '@/api/basicData/GroupModule/staff'
import BaseTable from '@/components/BaseTable'
import groupMember from './group-member.vue'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
const tableBtn = [
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'name',
label: i18n.t('module.basicData.staff.Name'),
align: 'center'
},
{
prop: 'majorArr',
label: i18n.t('module.basicData.staff.Profession'),
align: 'center'
},
{
prop: 'telephone',
label: i18n.t('module.basicData.staff.Telephone'),
align: 'center'
},
{
prop: 'workshop',
label: i18n.t('module.basicData.staff.Workshop'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, groupMember },
data() {
return {
visible: false,
addOrUpdateVisible: false,
tableBtn,
trueWidth: 100,
isdetail: false,
tableProps,
listLoading: false,
list: [],
groupArr: [],
groupData: {
id: 0,
name: '',
teamLeaderId: '',
workStatus: 1,
code: ''
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.group.TeamName')]),
trigger: 'blur'
}],
teamLeaderId: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.group.GroupLeader')]),
trigger: 'change'
}]
},
listQuery: {
current: 1,
size: 999,
teamId: '',
key: ''
}
}
},
methods: {
init(id, isdetail) {
this.isdetail = false
this.isdetail = isdetail
staffList(this.listQuery).then(response => {
if (response.data.records) {
this.groupArr = response.data.records
} else {
this.groupArr.splice(0, this.list.length)
}
})
this.groupData.id = id || ''
this.listQuery.teamId = ''
this.list.splice(0, this.list.length)
this.visible = true
this.$nextTick(() => {
this.$refs['groupForm'].resetFields()
if (this.groupData.id) {
this.listQuery.teamId = this.groupData.id
groupDetail(this.groupData.id).then(res => {
this.groupData = res.data
this.getList()
})
} else {
groupCode().then(res => {
this.groupData.code = res.data
})
}
})
},
getList() {
groupAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
this.list.forEach(item => {
if (item.major) { item.majorArr = item.major.toString() }
})
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
const data = {
teamId: this.listQuery.teamId,
workerId: raw.data.id
}
groupAttrDelete(data).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
}
},
// 表单提交
handelConfirm() {
this.$refs['groupForm'].validate((valid) => {
if (valid) {
const data = this.groupData
if (this.groupData.id) {
groupUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
groupAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.groupData.id = res.data.id
this.listQuery.teamId = res.data.id
})
}
}
})
},
handleClose() {
this.visible = false
this.$emit('refreshDataList')
},
goEdit() {
this.isdetail = false
},
// 新增
addNew() {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(this.groupData.teamLeaderId)
})
}
}
}
</script>

View File

@@ -0,0 +1,227 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-31 16:21:04
* @Description:
-->
<template>
<el-dialog
:title="'btn.add' | i18nFilter"
:visible.sync="visible"
:before-close="goback"
:append-to-body="true"
width="80%"
><el-form
:model="listQuery"
:inline="true"
size="medium"
label-width="80px"
>
<el-form-item :label="$t('module.basicData.staff.Name')" prop="key">
<el-input v-model="listQuery.key" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Name')])" style="width:200px" clearable />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</el-dialog>
</template>
<script>import i18n from '@/lang'
import { workerList } from '@/api/basicData/GroupModule/staff'
import { groupAttrAdd } from '@/api/basicData/GroupModule/groupAttr'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import BaseTable from '@/components/BaseTable'
import basicData from '@/filters/basicData'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'add',
btnName: 'btn.addgroup'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.staff.Name'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.staff.EmployeeID'),
align: 'center'
},
{
prop: 'sex',
label: i18n.t('module.basicData.staff.Gender'),
filter: basicData('sex'),
align: 'center'
},
{
prop: 'entryTime',
label: i18n.t('module.basicData.staff.EntryTime'),
align: 'center'
},
{
prop: 'telephone',
label: i18n.t('module.basicData.staff.Telephone'),
align: 'center'
},
{
prop: 'wechatCode',
label: i18n.t('module.basicData.staff.Wechat'),
align: 'center'
},
{
prop: 'majorArr',
label: i18n.t('module.basicData.staff.Profession'),
align: 'center'
},
{
prop: 'workshop',
label: i18n.t('module.basicData.staff.Workshop'),
align: 'center'
},
{
prop: 'onDuty',
label: i18n.t('module.basicData.staff.onDuty'),
filter: basicData('onDuty'),
align: 'center'
}
]
export default {
name: '',
components: { Pagination, BaseTable, MethodBtn },
props: {
teamId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
tableProps,
tableBtn,
trueWidth: 200,
list: [],
total: 0,
teamLeaderId: '',
listLoading: true,
listQuery: {
current: 1,
size: 10,
teamId: '',
key: ''
}
}
},
methods: {
init(id) {
this.visible = true
this.teamLeaderId = id
this.listQuery.teamId = this.teamId
this.getList()
},
getList() {
this.listLoading = true
workerList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
this.list.forEach(item => {
if (item.major) { item.majorArr = item.major.toString() }
})
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
handleClick(raw) {
if (raw.type === 'add') {
const data = {
'workerId': raw.data.id,
'name': raw.data.name,
'teamId': this.teamId,
'current': this.listQuery.current,
'size': this.listQuery.size
}
groupAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}
},
goback() {
this.visible = false
this.$emit('refreshDataList')
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,118 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:26:22
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="160px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.major.ProfessionalName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.major.ProfessionalName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.major.ProfessionalCoding')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.major.ProfessionalCoding')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbreviation">
<el-input v-model="dataForm.abbreviation" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { majorDetail, majorUpdate, majorAdd, majorCode } from '@/api/basicData/GroupModule/major'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
description: '',
abbreviation: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.major.ProfessionalName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.major.ProfessionalCoding')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
majorCode().then(res => {
this.dataForm.code = res.data
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
majorDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.description = res.data.description
this.dataForm.abbreviation = res.data.abbreviation
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'description': this.dataForm.description,
'abbreviation': this.dataForm.abbreviation,
'id': this.dataForm.id
}
if (this.dataForm.id) {
majorUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
majorAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,281 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-04-17 16:33:37
* @Description:
-->
<template>
<el-dialog
:title="!staffData.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-row :gutter="15">
<el-form
ref="staffForm"
:model="staffData"
:rules="rules"
size="medium"
label-width="110px"
>
<el-col :span="10">
<el-row>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.Name')" prop="name">
<el-input v-model="staffData.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Name')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.role')" prop="roleId">
<el-select v-model="staffData.roleId">
<el-option v-for="item in roleList" :key="item.id" :value="item.id" :label="item.dataName" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.Gender')" prop="sex">
<el-select v-model="staffData.sex" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Gender')])" clearable :style="{width: '100%'}">
<el-option
v-for="(item, index) in sexOptions"
:key="index"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.Telephone')" prop="telephone">
<el-input
v-model="staffData.telephone"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Telephone')])"
clearable
prefix-icon="el-icon-phone"
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.Email')" prop="email">
<el-input v-model="staffData.email" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Email')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.Profession')" prop="majorId">
<el-select
v-model="staffData.majorId"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Profession')])"
multiple
filterable
clearable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in majorArr"
:key="index"
:label="item.name"
:value="item.id"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="10">
<el-row>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.EmployeeID')" prop="code">
<el-input v-model="staffData.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.EmployeeID')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.Wechat')" prop="wechatCode">
<el-input v-model="staffData.wechatCode" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Wechat')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.EntryTime')" prop="entryTime">
<el-date-picker
v-model="staffData.entryTime"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.EntryTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.Workshop')" prop="workshop">
<el-input v-model="staffData.workshop" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.staff.Workshop')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.staff.onDuty')" prop="onDuty">
<el-radio-group v-model="staffData.onDuty" size="medium">
<el-radio
v-for="(item, index) in onDutyOptions"
:key="index"
:label="item.value"
:disabled="item.disabled"
>{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="20">
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="staffData.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-row>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" size="medium" @click="staffDataSubmit()"> {{ 'btn.save' | i18nFilter }} </el-button>
</span>
</el-dialog>
</template>
<script>
import { staffDetail, staffUpdate, staffAdd, staffCode } from '@/api/basicData/GroupModule/staff'
import { majorList } from '@/api/basicData/GroupModule/major'
export default {
props: {
roleList: {
type: Array,
default: () => []
}
},
data() {
return {
visible: false,
majorArr: [],
staffData: {
name: undefined,
sex: '',
telephone: '',
email: '',
majorId: [],
description: undefined,
code: undefined,
wechatCode: undefined,
entryTime: null,
workshop: undefined,
onDuty: 1,
roleId: null
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.staff.Name')]),
trigger: 'blur'
}],
telephone: [{
pattern: /(^1\d{10}$)|(^[0-9]\d{7}$)/,
message: this.$t('module.basicData.staff.Telephone') + this.$t('module.basicData.customer.format'),
trigger: 'blur'
}],
email: [{
pattern: /^\w+@[a-z0-9]+\.[a-z]{2,4}$/,
message: this.$t('module.basicData.staff.Email') + this.$t('module.basicData.customer.format'),
trigger: 'blur'
}],
description: [],
code: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.staff.EmployeeID')]),
trigger: 'blur'
}]
},
sexOptions: [{
'label': '男',
'value': 1
}, {
'label': '女',
'value': 0
}],
onDutyOptions: [{
'label': this.$t('module.basicData.visual.Yes'),
'value': 1
}, {
'label': this.$t('module.basicData.visual.No'),
'value': 0
}]
}
},
methods: {
init(id) {
staffCode().then(res => {
this.staffData.code = res.data
})
majorList({
current: 1,
size: 999,
name: ''
}).then(response => {
this.majorArr = response.data.records
})
this.staffData.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['staffForm'].resetFields()
if (this.staffData.id) {
staffDetail(this.staffData.id).then(res => {
this.staffData = res.data
})
}
})
},
// 表单提交
staffDataSubmit() {
this.$refs['staffForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.staffData.name,
'sex': this.staffData.sex,
'telephone': this.staffData.telephone,
'description': this.staffData.description,
'code': this.staffData.code,
'email': this.staffData.email,
'entryTime': this.staffData.entryTime,
'majorId': this.staffData.majorId,
'onDuty': this.staffData.onDuty,
'wechatCode': this.staffData.wechatCode,
'workshop': this.staffData.workshop,
'roleId': this.staffData.roleId,
'id': this.staffData.id
}
if (this.staffData.id) {
staffUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
staffAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,201 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:47:17
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<group-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { groupList, groupDelete } from '@/api/basicData/GroupModule/group'
import dataDict from '@/filters/DataDict'
import groupAdd from './components/group-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.group.TeamName'),
align: 'center'
},
{
prop: 'teamNumber',
label: i18n.t('module.basicData.group.NumberOfTeams'),
align: 'center'
},
{
prop: 'teamLeader',
label: i18n.t('module.basicData.group.GroupLeader'),
align: 'center'
},
{
prop: 'workStatus',
label: i18n.t('module.basicData.group.TeamStatus'),
filter: dataDict('enableState'),
align: 'center'
}
]
export default {
name: 'Group',
components: { Pagination, BaseTable, MethodBtn, HeadForm, groupAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.group.TeamName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.group.GroupLeader'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
groupDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.key = key
groupList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, isdetail)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,194 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:47:25
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<major-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { majorList, majorDelete } from '@/api/basicData/GroupModule/major'
import majorAdd from './components/major-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.major.ProfessionalName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.major.ProfessionalCoding'),
align: 'center'
},
{
prop: 'abbreviation',
label: i18n.t('module.basicData.visual.Abbreviation'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Major',
components: { Pagination, BaseTable, MethodBtn, HeadForm, majorAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.major.ProfessionalName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
majorDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
majorList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,252 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-05-21 14:41:36
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<staff-add v-if="addOrUpdateVisible" ref="addOrUpdate" :role-list="roleList" @refreshDataList="getList" />
</div>
</template>
<script>
import i18n from '@/lang'
import { staffList, staffDelete, getRoleList } from '@/api/basicData/GroupModule/staff'
import staffAdd from './components/staff-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import basicData from '@/filters/basicData'
// import DictFilter from '@/components/BaseTable/subcomponents/DataDictFilter'
// import { workerRoleList } from '@/api/dict'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.staff.Name'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.staff.EmployeeID'),
align: 'center'
},
{
prop: 'roleName',
label: i18n.t('module.basicData.staff.role'),
align: 'center'
// subcomponent: DictFilter,
// filter: workerRoleList
},
{
prop: 'sex',
label: i18n.t('module.basicData.staff.Gender'),
filter: basicData('sex'),
align: 'center'
},
{
prop: 'entryTime',
label: i18n.t('module.basicData.staff.EntryTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'telephone',
label: i18n.t('module.basicData.staff.Telephone'),
align: 'center'
},
{
prop: 'email',
label: i18n.t('module.basicData.staff.Email'),
align: 'center'
},
{
prop: 'wechatCode',
label: i18n.t('module.basicData.staff.Wechat'),
align: 'center'
},
{
prop: 'majorArr',
label: i18n.t('module.basicData.staff.Profession'),
align: 'center'
},
{
prop: 'workshop',
label: i18n.t('module.basicData.staff.Workshop'),
align: 'center'
},
{
prop: 'onDuty',
label: i18n.t('module.basicData.staff.onDuty'),
filter: basicData('onDuty'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Staff',
components: { Pagination, BaseTable, MethodBtn, HeadForm, staffAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.staff.Name'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
roleList: [],
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getRole()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
staffDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.key = key
staffList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
this.list.forEach(item => {
if (item.major) { item.majorArr = item.major.toString() }
})
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
async getRole() {
const res = await getRoleList()
this.roleList = res.data.records
this.getList()
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,267 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-22 15:34:46
* @enName:
-->
<template>
<div style="margin:20px">
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px;margin:20px">{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<div style="margin:0 15px">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.material.MaterialName')" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.material.MaterialName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.material.MaterialCoding')" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.material.MaterialCoding')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
<el-input v-model="dataForm.enName" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbr">
<el-input v-model="dataForm.abbr" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.material.MaterialType')" prop="category">
<el-select v-model="dataForm.category" :disabled="isdetail" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.material.MaterialType')])" clearable>
<el-option
v-for="item in categoryArr"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
<el-input v-model="dataForm.description" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Description')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="listQuery.materialId" type="primary" @click="addNew()">{{ 'btn.addattr' | i18nFilter }}</el-button>
</span>
</div>
<div style="height:380px;overflow:auto">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
</div>
<material-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :material-id="listQuery.materialId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { materialDetail, materialUpdate, materialAdd, materialCode } from '@/api/basicData/Materials/material'
import { materialAttrList, materialAttrDelete } from '@/api/basicData/Materials/materialAttr'
import { materialsTypeList } from '@/api/basicData/Materials/materialsType'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import materialAttrAdd from './materialAttr-add'
import { timeFormatter } from '@/filters'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'attrName',
label: i18n.t('module.basicData.visual.AttributeName'),
align: 'center'
},
{
prop: 'attrValue',
label: i18n.t('module.basicData.visual.AttributeValue'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, materialAttrAdd },
data() {
return {
addOrUpdateVisible: false,
categoryArr: [],
tableBtn,
trueWidth: 200,
tableProps,
list: [],
dataForm: {
name: '',
code: '',
enName: '',
abbr: '',
category: '',
description: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.material.MaterialName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.material.MaterialCoding')]), trigger: 'blur' }
]
},
listQuery: {
current: 1,
size: 990,
materialId: ''
},
isdetail: false
}
},
created() {
this.listQuery.materialId = this.$route.query.id
this.init()
},
methods: {
init() {
this.isdetail = false
this.isdetail = Boolean(this.$route.query.isdetail)
this.list.splice(0, this.list.length)
materialsTypeList(this.listQuery).then(response => {
this.categoryArr = response.data.records
})
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.listQuery.materialId) {
materialDetail(this.listQuery.materialId).then(res => {
this.dataForm = res.data
})
materialAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
} else {
materialCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
getList() {
materialAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.attrName}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
materialAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'enName': this.dataForm.enName,
'description': this.dataForm.description,
'remark': this.dataForm.remark,
'abbr': this.dataForm.abbr,
'category': this.dataForm.category,
'id': this.listQuery.materialId
}
if (this.listQuery.materialId) {
materialUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
materialAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.listQuery.materialId = res.data.id
})
}
}
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goEdit() {
this.isdetail = false
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,131 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:31:03
* @Description:
-->
<template>
<el-drawer
:append-to-body="true"
:show-close="false"
:visible.sync="visible"
size="40%"
>
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">
{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
</div>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.visual.AttributeName')" prop="attrName">
<el-input v-model="dataForm.attrName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.AttributeValue')" prop="attrValue">
<el-input v-model="dataForm.attrValue" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeValue')])" clearable />
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-drawer>
</template>
<script>
import { materialAttrDetail, materialAttrUpdate, materialAttrAdd } from '@/api/basicData/Materials/materialAttr'
export default {
props: {
materialId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
btnLoading: false,
dataForm: {
id: 0,
attrName: '',
attrValue: ''
},
dataRule: {
attrName: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
],
attrValue: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeValue')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.btnLoading = false
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
materialAttrDetail(this.dataForm.id).then(res => {
this.dataForm.attrName = res.data.attrName
this.dataForm.attrValue = res.data.attrValue
})
}
})
},
// 表单提交
dataFormSubmit() {
this.btnLoading = true
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'attrName': this.dataForm.attrName,
'attrValue': this.dataForm.attrValue,
'materialId': this.materialId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
materialAttrUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
materialAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,112 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:26:33
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.materialsType.TypeName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.materialsType.TypeName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.materialsType.TypeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.materialsType.TypeCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { materialsTypeDetail, materialsTypeUpdate, materialsTypeAdd, materialsTypeCode } from '@/api/basicData/Materials/materialsType'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.materialsType.TypeName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.materialsType.TypeCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
materialsTypeCode().then(res => {
this.dataForm.code = res.data
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
materialsTypeDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.remark = res.data.remark
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
materialsTypeUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
materialsTypeAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,216 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:48:22
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { materialList, materialDelete } from '@/api/basicData/Materials/material'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.material.MaterialName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.material.MaterialCoding'),
align: 'center'
},
{
prop: 'enName',
label: i18n.t('module.basicData.visual.EnglishName'),
align: 'center'
},
{
prop: 'abbr',
label: i18n.t('module.basicData.visual.Abbreviation'),
align: 'center'
},
{
prop: 'category',
label: i18n.t('module.basicData.material.MaterialType'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Description'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Material',
components: { Pagination, BaseTable, MethodBtn, HeadForm },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.material.MaterialName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.material.MaterialCoding'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
materialDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
materialList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.$router.push({
name: 'MaterialAdd',
query: {
id: id,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,189 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-05 16:23:27
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<materialsType-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { materialsTypeList, materialsTypeDelete } from '@/api/basicData/Materials/materialsType'
import materialsTypeAdd from './components/materialsType-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.materialsType.TypeName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.materialsType.TypeCode'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'MaterialsType',
components: { Pagination, BaseTable, MethodBtn, materialsTypeAdd, HeadForm },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.materialsType.TypeName'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
materialsTypeDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
materialsTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,200 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:43:12
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<product-pool-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { ProductPoolList, ProductPoolDelete } from '@/api/basicData/ProductPool'
import ProductPoolAdd from './components/ProductPool-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.productPool.productName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.productPool.productCode'),
align: 'center'
},
{
prop: 'specifications',
label: i18n.t('module.basicData.visual.Specs'),
align: 'center'
},
{
prop: 'unit',
label: i18n.t('module.basicData.visual.unit'),
align: 'center'
}
]
export default {
name: 'ProductPool',
components: { Pagination, BaseTable, MethodBtn, HeadForm, ProductPoolAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.productPool.productName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.productPool.productCode'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
ProductPoolDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.key = key
ProductPoolList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, isdetail)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,220 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-12 10:05:33
* @Description:
-->
<template>
<div class="app-container">
<el-form
:model="listQuery"
:inline="true"
size="medium"
label-width="100px"
>
<el-form-item :label="$t('module.basicData.ScrapInfo.cause')" prop="scrap">
<el-input v-model="listQuery.scrap" :placeholder="$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.cause')])" style="width:200px" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.ScrapInfo.scrapType')" prop="scrapId">
<el-select v-model="listQuery.scrapId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.scrapType')])" clearable>
<el-option
v-for="item in scrapTypeArr"
:key="item.id"
:label="item.scrapType"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
<el-button type="primary" @click="addNew()"> {{ 'btn.add' | i18nFilter }} </el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<ScrapInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import { scrapInfoList, scrapInfoDelete } from '@/api/basicData/Scrap/ScrapInfo'
import { scrapTypeList } from '@/api/basicData/Scrap/ScrapType'
import ScrapInfoAdd from './components/ScrapInfo-add.vue'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
align: 'center',
filter: timeFormatter
},
{
prop: 'scrap',
label: i18n.t('module.basicData.ScrapInfo.cause'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.ScrapInfo.causeCode'),
align: 'center'
},
{
prop: 'scrapType',
label: i18n.t('module.basicData.ScrapInfo.scrapType'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'ScrapInfo',
components: { Pagination, BaseTable, MethodBtn, ScrapInfoAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
scrapTypeArr: [],
listQuery: {
current: 1,
size: 10,
scrap: '',
scrapId: ''
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.scrap}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
scrapInfoDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList() {
scrapTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.scrapTypeArr = response.data.records
} else {
this.scrapTypeArr.splice(0, this.list.length)
}
})
this.listLoading = true
scrapInfoList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,198 @@
<!--
* @Author: zwq
* @Date: 2021-03-10 10:02:18
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:48:54
* @Description:
!-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<ScrapType-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import { scrapTypeList, scrapTypeDelete } from '@/api/basicData/Scrap/ScrapType'
import ScrapTypeAdd from './components/ScrapType-add.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'scrapType',
label: i18n.t('module.basicData.ScrapInfo.scrapType'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.ScrapInfo.scrapTypeCode'),
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Description'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'ScrapType',
components: { Pagination, BaseTable, MethodBtn, HeadForm, ScrapTypeAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.ScrapInfo.scrapType'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10,
scrapType: ''
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.scrapType}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
scrapTypeDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.scrapType = key
scrapTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>
-->

View File

@@ -0,0 +1,163 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:26:43
* @remark:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="110px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.ScrapInfo.cause')" prop="scrap">
<el-input v-model="dataForm.scrap" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.cause')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.ScrapInfo.causeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.causeCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.ScrapInfo.scrapType')" prop="scrapTypeInfo">
<el-select v-model="dataForm.scrapTypeInfo" value-key="id" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.scrapType')])" clearable @change="$forceUpdate()">
<el-option
v-for="item in scrapTypeArr"
:key="item.id"
:label="item.scrapType"
:value="{id:item.id,name:item.scrapType}"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { scrapInfoDetail, scrapInfoUpdate, scrapInfoAdd, scrapInfoCode } from '@/api/basicData/Scrap/ScrapInfo'
import { scrapTypeList } from '@/api/basicData/Scrap/ScrapType'
export default {
data() {
return {
visible: false,
scrapTypeArr: [],
dataForm: {
id: 0,
scrap: '',
code: '',
scrapTypeInfo: '',
scrapId: '',
scrapType: '',
remark: ''
},
listQuery: {
current: 1,
size: 999
},
dataRule: {
scrap: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.cause')]),
trigger: 'blur'
}
],
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.causeCode')]),
trigger: 'blur'
}
],
scrapTypeInfo: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.scrapType')]),
trigger: 'change'
}
]
}
}
},
methods: {
init(id) {
scrapTypeList(this.listQuery).then(response => {
if (response.data.records) {
this.scrapTypeArr = response.data.records
} else {
this.scrapTypeArr.splice(0, this.list.length)
}
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
scrapInfoDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
this.dataForm.scrapTypeInfo = {
id: this.dataForm.scrapId,
name: this.dataForm.scrapType
}
})
} else {
scrapInfoCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.dataForm.scrapId = this.dataForm.scrapTypeInfo.id
this.dataForm.scrapType = this.dataForm.scrapTypeInfo.name
const data = {
'scrap': this.dataForm.scrap,
'code': this.dataForm.code,
'scrapId': this.dataForm.scrapId,
'scrapType': this.dataForm.scrapType,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
scrapInfoUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
scrapInfoAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
},
setValue(value) {
console.log(value)
}
}
}
</script>

View File

@@ -0,0 +1,122 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-10 14:48:27
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.ScrapInfo.scrapType')" prop="scrapType">
<el-input v-model="dataForm.scrapType" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.scrapType')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.ScrapInfo.scrapTypeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.scrapTypeCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Description')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Description')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { scrapTypeDetail, scrapTypeUpdate, scrapTypeAdd, scrapTypeCode } from '@/api/basicData/Scrap/ScrapType'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
scrapType: '',
code: '',
description: '',
remark: ''
},
dataRule: {
scrapType: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.scrapType')]),
trigger: 'blur' }
],
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.scrapTypeCode')]),
trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
scrapTypeDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
scrapTypeCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'scrapType': this.dataForm.scrapType,
'code': this.dataForm.code,
'description': this.dataForm.description,
'remark': this.dataForm.remark,
'id': this.dataForm.id
}
if (this.dataForm.id) {
scrapTypeUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
scrapTypeAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,222 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-10 11:13:58
* @Description:
-->
<template>
<div class="app-container">
<el-form
:model="formData"
:inline="true"
size="medium"
label-width="80px"
>
<el-form-item v-if="false" :label="$t('module.basicData.ScrapInfo.PlateId')" prop="basalId">
<el-input v-model="formData.basalId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.PlateId')])" style="width:200px" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.ScrapInfo.TimePeriod')" prop="time">
<el-date-picker
v-model="formData.timeSlot"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:start-placeholder="$t('module.basicData.ScrapInfo.StartTime')"
:end-placeholder="$t('module.basicData.ScrapInfo.EndTime')"
:range-separator="$t('module.basicData.ScrapInfo.To')"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
<el-button type="primary" @click="addNew()"> {{ 'btn.add' | i18nFilter }} </el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="formData.current"
:limit.sync="formData.size"
@pagination="getList()"
/>
<ScrapInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { ScrapInfoList, ScrapInfoDelete } from '@/api/basicData/ScrapInfo'
import ScrapInfoAdd from './components/ScrapInfo-add.vue'
import ScrapInfoCause from './components/ScrapInfoCause.vue'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter
},
// {
// prop: 'basalId',
// label: i18n.t('module.basicData.ScrapInfo.PlateId'),
// align: 'center'
// },
{
prop: 'source',
label: i18n.t('module.basicData.ScrapInfo.source'),
align: 'center'
},
{
prop: 'wasteGrade',
label: i18n.t('module.basicData.ScrapInfo.wasteGrade'),
align: 'center'
},
{
prop: 'creatorName',
label: i18n.t('module.basicData.ScrapInfo.RegisterPerson')
},
{
prop: 'updateTime',
label: i18n.t('module.basicData.ScrapInfo.updateTime'),
filter: timeFormatter
},
{
prop: 'cause',
label: i18n.t('module.basicData.ScrapInfo.cause'),
subcomponent: ScrapInfoCause
}
]
export default {
name: 'ScrapInfo',
components: { Pagination, BaseTable, MethodBtn, ScrapInfoAdd },
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
formData: {
timeSlot: [],
basalId: '',
current: 1,
size: 10
},
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.status}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
ScrapInfoDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList() {
this.listLoading = true
if (this.formData.timeSlot) {
this.formData.startTime = this.formData.timeSlot[0]
this.formData.endTime = this.formData.timeSlot[1]
} else {
this.formData.startTime = ''
this.formData.endTime = ''
}
ScrapInfoList(this.formData).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,195 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-04-07 13:45:43
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
:show-add="showAdd"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<StateConfig-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { StateConfigList, StateConfigDelete } from '@/api/basicData/StateConfig'
import StateConfigAdd from './components/StateConfig-add.vue'
import colorDiv from './components/colorDiv.vue'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import basicData from '@/filters/basicData'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
}
// {
// type: 'delete',
// btnName: 'btn.delete'
// }
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'status',
label: i18n.t('module.basicData.StateConfig.status'),
align: 'center'
},
{
prop: 'twinkle',
label: i18n.t('module.basicData.StateConfig.Twinkle'),
filter: basicData('onDuty'),
align: 'center'
},
{
prop: 'colour',
label: i18n.t('module.basicData.StateConfig.DisplayColor'),
align: 'center'
},
{
prop: 'color',
label: i18n.t('module.basicData.StateConfig.DisplayColor'),
subcomponent: colorDiv,
align: 'center'
},
{
prop: 'description',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'StateConfig',
components: { Pagination, BaseTable, MethodBtn, HeadForm, StateConfigAdd },
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.StateConfig.status'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 150,
tableProps,
list: [],
total: 0,
showAdd: false,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.status}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
StateConfigDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
this.listLoading = true
this.listQuery.status = key
StateConfigList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,187 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: gtz
* @LastEditTime: 2021-03-11 19:50:03
* @Description:
-->
<template>
<div class="app-container">
<el-form
:model="listQuery"
:inline="true"
size="medium"
>
<el-form-item :label="$t('module.basicData.visual.areaName')" prop="name">
<el-input v-model="listQuery.name" :placeholder="['placeholder.input', $t('module.basicData.visual.areaName')] | i18nFilterForm" style="width:200px" clearable />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
<el-button type="primary" @click="addNew()"> {{ 'btn.add' | i18nFilter }} </el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
@emitFun="emitFun"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<VisualInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import { VisualList, VisualDelete } from '@/api/basicData/visual'
import VisualLocationInfo from './components/VisualLocationInfo.vue'
import VisualInfoAdd from './components/VisualInfo-add.vue'
import VisualImgInfo from './components/VisualImgInfo.vue'
import VisualPointInfo from './components/VisualPointInfo.vue'
// import VisualRouteInfo from './components/VisualRouteInfo.vue'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import i18n from '@/lang'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'name',
label: i18n.t('module.basicData.visual.areaName'),
align: 'center'
},
{
prop: 'source',
label: i18n.t('module.basicData.visual.annex'),
align: 'center',
subcomponent: VisualImgInfo
},
{
prop: 'equipmentPoint',
label: i18n.t('module.basicData.visual.locationInformation'),
align: 'center',
subcomponent: VisualPointInfo
},
{
prop: 'stock',
label: i18n.t('module.basicData.visual.stock'),
align: 'center',
subcomponent: VisualLocationInfo
}
// {
// prop: 'trajectory',
// label: i18n.t('module.basicData.visual.runningTrack'),
// align: 'center',
// subcomponent: VisualRouteInfo
// }
]
export default {
name: 'VisualInfo',
components: { Pagination, BaseTable, MethodBtn, VisualInfoAdd },
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
name: '',
current: 1,
size: 10,
type: 1
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('deleteTip.header')}${raw.data.name}${this.$t('deleteTip.footer')}`, this.$t('deleteTip.tip'), {
confirmButtonText: this.$t('deleteTip.confirm'),
cancelButtonText: this.$t('deleteTip.cancel'),
type: 'warning'
}).then(() => {
VisualDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList() {
this.listLoading = true
VisualList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
emitFun(val) {
if (val.type.indexOf('refresh') >= 0) {
this.getList()
}
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,119 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:23:14
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.CodeRules.RuleName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.CodeRules.RuleName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.CodeRules.RuleCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.CodeRules.RuleCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbreviation">
<el-input v-model="dataForm.abbreviation" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { CodeRulesDetail, CodeRulesUpdate, CodeRulesAdd, CodeRulesCode } from '@/api/basicData/CodeRules'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
abbreviation: '',
description: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.CodeRules.RuleName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.CodeRules.RuleCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
CodeRulesDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.abbreviation = res.data.abbreviation
this.dataForm.description = res.data.description
})
} else {
CodeRulesCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'abbreviation': this.dataForm.abbreviation,
'description': this.dataForm.description,
'id': this.dataForm.id
}
if (this.dataForm.id) {
CodeRulesUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
CodeRulesAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,128 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:23:24
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.CodeRules.PropertyName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.CodeRules.PropertyName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.CodeRules.PropertyCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.CodeRules.PropertyCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.AttributeValue')" prop="value">
<el-input v-model="dataForm.value" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeValue')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.CodeRules.Length')" prop="codeLength">
<el-input v-model="dataForm.codeLength" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.CodeRules.Length')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.CodeRules.order')" prop="codeOrder">
<el-input v-model="dataForm.codeOrder" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.CodeRules.order')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { CodeRulesAttrDetail, CodeRulesAttrUpdate, CodeRulesAttrAdd, CodeRulesAttrCode } from '@/api/basicData/CodeRulesAttr'
export default {
props: {
codeRuleId: {
type: String,
default: () => ({})
}
},
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
value: '',
codeOrder: '',
codeLength: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.CodeRules.PropertyName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.CodeRules.PropertyCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
CodeRulesAttrDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
CodeRulesAttrCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'value': this.dataForm.value,
'codeLength': this.dataForm.codeLength,
'codeOrder': this.dataForm.codeOrder,
'id': this.dataForm.id,
'codeRuleId': this.codeRuleId
}
if (this.dataForm.id) {
CodeRulesAttrUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
CodeRulesAttrAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,187 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:44:24
* @Description:
-->
<template>
<div class="app-container">
<div style="margin:10px 50px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</div>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<CodeRulesAttr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :code-rule-id="listQuery.codeRuleId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { CodeRulesAttrList, CodeRulesAttrDelete } from '@/api/basicData/CodeRulesAttr'
import CodeRulesAttrAdd from './CodeRulesAttr-add.vue'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.CodeRules.PropertyName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.CodeRules.PropertyCode'),
align: 'center'
},
{
prop: 'value',
label: i18n.t('module.basicData.visual.AttributeValue'),
align: 'center'
},
{
prop: 'codeLength',
label: i18n.t('module.basicData.CodeRules.Length'),
align: 'center'
},
{
prop: 'codeOrder',
label: i18n.t('module.basicData.CodeRules.order'),
align: 'center'
}
]
export default {
name: 'CodeRulesAttr',
components: { BaseTable, MethodBtn, CodeRulesAttrAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
listLoading: true,
listQuery: {
current: 1,
size: 990,
codeRuleId: ''
}
}
},
created() {
this.listQuery.codeRuleId = this.$route.query.id
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
CodeRulesAttrDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList() {
this.listLoading = true
CodeRulesAttrList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.listLoading = false
})
},
// 新增 / 修改
addNew(codeRuleId) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(codeRuleId)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,144 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-07-06 11:26:28
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.equipment.EquipmentName')" prop="equipmentId">
<el-select v-model="dataForm.equipmentId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.equipment.EquipmentName')])" clearable>
<el-option
v-for="item in equipmentArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.EquipmentScrapGrade.ScrapGrade')" prop="scrapsGradeId">
<el-select v-model="dataForm.scrapsGradeId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.EquipmentScrapGrade.ScrapGrade')])" clearable>
<el-option
v-for="item in scrapsArr"
:key="item.id"
:label="item.dataName"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { EquipmentScrapGradeDetail, EquipmentScrapGradeUpdate, EquipmentScrapGradeAdd } from '@/api/basicData/EquipmentScrapGrade'
import { equipmentInfoList } from '@/api/basicData/Equipment/equipmentInfo'
import { dataDictionaryDataList } from '@/api/basicData/dataDictionary'
export default {
data() {
return {
visible: false,
scrapsArr: [],
equipmentArr: [],
dataForm: {
id: 0,
equipmentId: '',
scrapsGradeId: '',
remark: ''
},
dataRule: {
equipmentId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.equipment.EquipmentName')]), trigger: 'blur' }
],
scrapsGradeId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.EquipmentScrapGrade.ScrapGrade')]), trigger: 'change' }
]
}
}
},
methods: {
init(id) {
equipmentInfoList({
current: 1,
size: 999
}).then(response => {
if (response.data.records) {
this.equipmentArr = response.data.records
} else {
this.equipmentArr.splice(0, this.equipmentArr.length)
}
})
dataDictionaryDataList({
current: 1,
size: 999,
dictTypeId: '1412216979622785026'
}).then(response => {
if (response.data.records) {
this.scrapsArr = response.data.records
} else {
this.scrapsArr.splice(0, this.scrapsArr.length)
}
})
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
EquipmentScrapGradeDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'equipmentId': this.dataForm.equipmentId,
'scrapsGradeId': this.dataForm.scrapsGradeId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
EquipmentScrapGradeUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
EquipmentScrapGradeAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,134 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-07 17:00:50
* @Description:
-->
<template>
<el-drawer
:append-to-body="true"
:show-close="false"
:visible.sync="visible"
size="38%"
>
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.visual.AttributeName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.AttributeValue')" prop="value">
<el-input v-model="dataForm.value" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeValue')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.AttributeCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.AttributeCode')])" clearable />
</el-form-item>
</el-form>
<div class="drawer-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-drawer>
</template>
<script>
import { productDetail, productUpdate, productAdd, productCode } from '@/api/basicData/ProductAttr'
export default {
props: {
productId: {
type: String,
default: () => ({})
}
},
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
value: '',
code: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.AttributeCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
productDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.value = res.data.value
this.dataForm.code = res.data.code
})
} else {
productCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'value': this.dataForm.value,
'productId': this.productId,
'code': this.dataForm.code,
'id': this.dataForm.id
}
if (this.dataForm.id) {
productUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
productAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,252 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:01:37
* @specifications:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
size="65%"
>
<div slot="title" style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px">{{ isdetail? 'btn.detail' : !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}</div>
<div style="margin:0 15px">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.productPool.productName')" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.productPool.productName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.productPool.productCode')" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.productPool.productCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="specifications">
<el-input v-model="dataForm.specifications" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.unit')" prop="dictDataId">
<el-select v-model="dataForm.dictDataId" :disabled="isdetail" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.unit')])" clearable>
<el-option
v-for="item in unitArr"
:key="item.id"
:label="item.dataName"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">{{ 'btn.edit' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="listQuery.productId" type="primary" @click="addNew()">{{ 'btn.addattr' | i18nFilter }}</el-button>
</span>
</div>
<div style="height:380px;overflow:auto">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
</div>
<product-attr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :product-id="listQuery.productId" @refreshDataList="getList" />
</el-drawer>
</template>
<script>import i18n from '@/lang'
import { ProductPoolDetail, ProductPoolUpdate, ProductPoolAdd, ProductPoolCode, ProductPoolUnit } from '@/api/basicData/ProductPool'
import { productList, productDelete } from '@/api/basicData/ProductAttr'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import productAttrAdd from './ProductAttr-add'
import { timeFormatter } from '@/filters'
const tableBtn = [
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.visual.AttributeName'),
align: 'center'
},
{
prop: 'value',
label: i18n.t('module.basicData.visual.AttributeValue'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.visual.AttributeCode'),
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, productAttrAdd },
data() {
return {
visible: false,
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
unitArr: [],
dataForm: {
id: 0,
name: '',
code: '',
specifications: '',
dictDataId: ''
},
listQuery: {
current: 1,
size: 10,
productId: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.productPool.productName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.productPool.productCode')]), trigger: 'blur' }
]
},
isdetail: false
}
},
methods: {
init(id, isdetail) {
this.isdetail = false
this.isdetail = isdetail
this.dataForm.id = id || ''
this.listQuery.productId = ''
this.list.splice(0, this.list.length)
ProductPoolUnit().then(res => {
this.unitArr = res.data
})
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
ProductPoolDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.specifications = res.data.specifications
this.dataForm.dictDataId = res.data.dictDataId
})
this.listQuery.productId = this.dataForm.id
productList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
} else {
ProductPoolCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
getList() {
productList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
productDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'specifications': this.dataForm.specifications,
'dictDataId': this.dataForm.dictDataId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
ProductPoolUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
ProductPoolAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.listQuery.productId = res.data.id
})
}
}
})
},
goEdit() {
this.isdetail = false
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$emit('refreshDataList')
this.visible = false
}
}
}
</script>

View File

@@ -0,0 +1,198 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:23:37
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-row :gutter="15">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="110px"
label-position="left"
>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.ScrapInfo.WasteName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.WasteName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.ScrapInfo.WasteCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.WasteCode')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item v-if="false" :label="$t('module.basicData.ScrapInfo.PlateId')" prop="basalId">
<el-input v-model="dataForm.basalId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.PlateId')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.ScrapInfo.updateTime')" prop="boardTime">
<el-date-picker
v-model="dataForm.boardTime"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.updateTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.ScrapInfo.RegisterPerson')" prop="creatorName">
<el-input v-model="dataForm.creatorName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.RegisterPerson')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.ScrapInfo.source')" prop="source">
<el-input v-model="dataForm.source" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.source')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.ScrapInfo.wasteGrade')" prop="wasteGrade">
<el-select
v-model="dataForm.wasteGrade"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.wasteGrade')])"
clearable
:style="{width: '100%'}"
>
<el-option
v-for="item in wasteGradeArr"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.ScrapInfo.cause')" prop="description">
<el-input
v-model="dataForm.description"
type="textarea"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.cause')])"
:autosize="{minRows: 4, maxRows: 4}"
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { ScrapInfoDetail, ScrapInfoUpdate, ScrapInfoAdd, ScrapInfoCode } from '@/api/basicData/ScrapInfo'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
basalId: '',
source: '',
boardTime: '',
creatorName: '',
wasteGrade: '',
description: ''
},
wasteGradeArr: [{
value: 0,
label: '加工可用'
},
{
value: 1,
label: '完全废品'
}],
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.WasteName')]),
trigger: 'blur'
}],
code: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.ScrapInfo.WasteCode')]),
trigger: 'blur'
}]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
ScrapInfoDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
ScrapInfoCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'basalId': this.dataForm.basalId,
'source': this.dataForm.source,
'boardTime': this.dataForm.boardTime,
'creatorName': this.dataForm.creatorName,
'wasteGrade': this.dataForm.wasteGrade,
'description': this.dataForm.description,
'name': this.dataForm.name,
'code': this.dataForm.code,
'id': this.dataForm.id
}
if (this.dataForm.id) {
ScrapInfoUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
ScrapInfoAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,45 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-03-06 14:58:10
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.ScrapInfo.cause') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
console.log(this.injectData)
const h = this.$createElement
this.$msgbox({
title: this.$t('module.basicData.ScrapInfo.cause'),
message: h('div', null, [
h('span', null, `${this.$t('module.basicData.ScrapInfo.PlateId')}:${this.injectData.basalId}`),
h('br'),
h('span', null, `${this.$t('module.basicData.ScrapInfo.source')}:${this.injectData.source}`),
h('br'),
h('span', null, `${this.$t('module.basicData.ScrapInfo.updateTime')}:${this.injectData.createTime}`),
h('br'),
h('div', null, `${this.$t('module.basicData.ScrapInfo.cause')}:${this.injectData.description}`)
]),
showCancelButton: true,
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: '取消'
}).then(action => {
})
}
}
}
</script>

View File

@@ -0,0 +1,114 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-07 13:42:54
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="120px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.StateConfig.status')" prop="status">
<el-input v-model="dataForm.status" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.StateConfig.status')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.StateConfig.DisplayColor')" prop="colour">
<el-color-picker v-model="dataForm.colour" />
</el-form-item>
<el-form-item :label="$t('module.basicData.StateConfig.Twinkle')" prop="twinkle">
<el-switch
v-model="dataForm.twinkle"
:active-value="0"
:inactive-value="1"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { StateConfigDetail, StateConfigUpdate, StateConfigAdd } from '@/api/basicData/StateConfig'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
status: '',
colour: '',
twinkle: '',
description: ''
},
dataRule: {
status: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.StateConfig.status')]), trigger: 'blur' }
],
colour: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.StateConfig.DisplayColor')]), trigger: 'change' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
StateConfigDetail(this.dataForm.id).then(res => {
this.dataForm.status = res.data.status
this.dataForm.colour = res.data.colour
this.dataForm.description = res.data.description
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
if (this.dataForm.id) {
StateConfigUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
StateConfigAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,48 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: gtz
* @LastEditTime: 2021-03-12 16:32:06
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ 'btn.see' | i18nFilter }}</el-button>
<el-dialog width="1000px" top="50px" :title="$t('module.basicData.visual.annex')" :visible.sync="showPic">
<img :src="imageUrl" style="width: 100%" alt="">
</el-dialog>
</span>
</template>
<script>
import { getUrl } from '@/api/file'
import { blobToBase64 } from '@/utils/blobToBase64'
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
showPic: false,
imageUrl: null
}
},
methods: {
emitClick() {
getUrl({
attachmentId: this.injectData.annexId,
type: 0
}).then(blob => {
blobToBase64(blob.data).then(res => {
this.imageUrl = res
this.showPic = true
})
})
}
}
}
</script>

View File

@@ -0,0 +1,171 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-03-15 10:48:36
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:close-on-click-modal="false"
:visible.sync="visible"
@close="clearAnnex"
>
<el-row :gutter="15">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="160px"
label-position="left"
>
<el-col :span="24">
<el-form-item :label="$t('module.basicData.visual.areaName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="['placeholder.input', $t('module.basicData.visual.areaName')] | i18nFilterForm" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<!-- <el-col v-if="!dataForm.id" :span="24">
<el-form-item :label="$t('module.basicData.visual.baseRouteName')" prop="trajectory">
<el-input v-model="baseRouteName" :placeholder="['placeholder.input', $t('module.basicData.visual.baseRouteName')] | i18nFilterForm" clearable :style="{width: '100%'}" @change="changeTrajectory" />
</el-form-item>
</el-col> -->
<el-col :span="24">
<el-form-item :label="$t('module.basicData.visual.isStock')" prop="stock">
<el-switch v-model="dataForm.stock" :active-value="1" :inactive-value="0" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label="$t('module.basicData.visual.annex')" prop="annexId">
<Single-image v-if="visible" :file-id="dataForm.annexId" @input="updateAnnex" />
</el-form-item>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import Vue from 'vue'
import SingleImage from '@/components/Upload/SingleImage'
import { VisualDetail, VisualUpdate, VisualAdd } from '@/api/basicData/visual'
export default {
components: {
SingleImage
},
data() {
return {
visible: false,
baseRouteName: null,
dataForm: {
id: 0,
name: null,
annexId: null,
stock: 0
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.areaName')]),
trigger: 'blur'
}],
annexId: [{
required: true,
message: this.$i18nForm(['placeholder.upload', this.$t('module.basicData.visual.annex')]),
trigger: 'blur'
}],
stock: [{
required: true,
message: this.$i18nForm(['placeholder.select', this.$t('module.basicData.visual.isStock')]),
trigger: 'blur'
}]
// trajectory: [{
// required: true,
// message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.baseRouteName')]),
// trigger: 'blur'
// }]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
VisualDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
// 附件变更
updateAnnex(fileInfo) {
if (fileInfo) {
this.dataForm.annexId = fileInfo.id
} else {
this.dataForm.annexId = ''
}
},
changeTrajectory(val) {
if (val || val === 0) {
this.dataForm.trajectory = JSON.stringify([
{ lineName: this.baseRouteName, list: [] }
])
} else {
this.dataForm.trajectory = null
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'annexId': this.dataForm.annexId,
'id': this.dataForm.id,
'stock': this.dataForm.stock,
'type': 1
}
if (this.dataForm.id) {
VisualUpdate(data).then(res => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
VisualAdd(data).then(res => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
},
// 清除附件信息
clearAnnex() {
Vue.set(this.dataForm, 'annexId', null)
}
}
}
</script>

View File

@@ -0,0 +1,194 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-03-15 10:48:36
* @Description:
-->
<template>
<span v-if="injectData.stock">
<el-button type="text" size="small" @click="emitClick">{{ 'btn.edit' | i18nFilter }}</el-button>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:close-on-click-modal="false"
:visible.sync="visible"
top="10vh"
@close="clearAnnex"
>
<div class="location-box">
<el-row class="location-form" :gutter="15">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="160px"
label-position="left"
>
<el-col :span="24">
<el-form-item :label="$t('module.basicData.visual.areaName')" prop="name">
<el-input v-model="areaName" disabled :placeholder="['placeholder.input', $t('module.basicData.visual.areaName')] | i18nFilterForm" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<!-- <el-col v-if="!dataForm.id" :span="24">
<el-form-item :label="$t('module.basicData.visual.baseRouteName')" prop="trajectory">
<el-input v-model="baseRouteName" :placeholder="['placeholder.input', $t('module.basicData.visual.baseRouteName')] | i18nFilterForm" clearable :style="{width: '100%'}" @change="changeTrajectory" />
</el-form-item>
</el-col> -->
<el-col :span="24">
<el-form-item :label="$t('module.basicData.visual.annex')" prop="annexId">
<Single-image v-if="visible" :file-id="dataForm.annexId" @input="updateAnnex" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item v-if="dataForm.id" :label="$t('module.basicData.visual.editLocation')">
<el-button style="float: left" type="primary" @click="showPointModel">{{ $t('module.basicData.visual.editLocation') }}</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
<Visual-location-info-point ref="locationpoint" :inject-data="dataForm" @emitData="emitData" />
</el-dialog>
</span>
</template>
<script>
import Vue from 'vue'
import SingleImage from '@/components/Upload/SingleImage'
import VisualLocationInfoPoint from './VisualLocationInfoPoint'
import { VisualUpdate, VisualAdd, VisualList } from '@/api/basicData/visual'
export default {
components: {
SingleImage,
VisualLocationInfoPoint
},
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
visible: false,
baseRouteName: null,
areaName: null,
dataForm: {
id: null,
annexId: null
},
rules: {
annexId: [{
required: true,
message: this.$i18nForm(['placeholder.upload', this.$t('module.basicData.visual.annex')]),
trigger: 'blur'
}],
trajectory: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.baseRouteName')]),
trigger: 'blur'
}]
}
}
},
methods: {
emitClick() {
this.areaName = this.injectData.name
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.injectData.id) {
VisualList({
parentId: this.injectData.id,
current: 1,
size: 10
}).then(res => {
if (res.data.records.length) {
this.dataForm = res.data.records[0]
}
})
}
})
},
// 附件变更
updateAnnex(fileInfo) {
if (fileInfo) {
this.dataForm.annexId = fileInfo.id
} else {
this.dataForm.annexId = ''
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'annexId': this.dataForm.annexId,
'id': this.dataForm.id,
'parentId': this.injectData.id,
'type': 2
}
if (this.dataForm.id) {
VisualUpdate(data).then(res => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('emitData', {
type: ['refresh']
})
}
})
})
} else {
VisualAdd(data).then(res => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
},
// 清除附件信息
clearAnnex() {
Vue.set(this.dataForm, 'annexId', null)
},
showPointModel() {
this.$refs.locationpoint.emitClick()
},
emitData(v) {
console.log(v)
if (v.type.indexOf('refresh') >= 0) {
this.emitClick()
}
}
}
}
</script>
<style lang="scss" scoped>
.location-box {
width: 100%;
overflow: hidden;
.location-form{
width: calc(100% + 24px);
max-height: calc(80vh - 181px);
overflow-y: scroll;
}
}
</style>

View File

@@ -0,0 +1,279 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:00:51
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-dialog
:id="'imgbox' + injectData.id"
:close-on-click-modal="false"
:modal="false"
width="60%"
top="50px"
:title="$t('module.basicData.visual.locationInformation')"
:visible.sync="showPic"
>
<div slot="title">
{{ $t('module.basicData.visual.locationInformation') }}
<el-popover
placement="top-start"
:title="$t('module.basicData.visual.help')"
width="400"
trigger="hover"
:content="$t('module.basicData.visual.tip')"
>
<svg-icon slot="reference" class-name="international-icon" icon-class="helptitle" style="cursor: pointer" />
</el-popover>
</div>
<div class="imgbox">
<img id="lingImg" :src="imageUrl" style="width: 100%" alt="" @click="setPoint">
<el-popover
v-for="(item, index) in pointList"
:key="index"
v-model="item.show"
placement="right"
trigger="click"
@hide="clearIndex"
>
<el-select v-model="eqId" clearable filterable>
<el-option v-for="i in equipmentList" :key="i.id" :value="i.id" :label="i.name" />
</el-select>
<div style="text-align: right; margin-top: 5px">
<el-button type="danger" @click="delEqPoint(index)">{{ 'btn.delete' | i18nFilter }}</el-button>
<el-button type="primary" @click="confirmPointEq(index)">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
<el-button
slot="reference"
class="point-badge"
:style="{left: `calc(${item.pointX} - 10px)`, top: `calc(${item.pointY} - 10px)`}"
type="danger"
@click="handleIndex(index)"
>
{{ index + 1 }}
</el-button>
</el-popover>
</div>
<el-row style="text-align:left">
<vuedraggable v-model="pointList" group="route">
<el-tag v-for="(item, index) in pointList" :key="index" type="info" closable style="margin: 5px" @close="delEqPoint(index)">
{{ index + 1 }}{{ $t('module.basicData.visual.location') }}{{ equipmentObj[item.id] }}
</el-tag>
</vuedraggable>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="showPic = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button @click="resetPoint()">{{ 'btn.reset' | i18nFilter }}</el-button>
<el-button type="primary" @click="pointConfirm()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</span>
</template>
<script>
import Vue from 'vue'
import vuedraggable from 'vuedraggable'
import { getUrl } from '@/api/file'
import { locationList, VisualUpdate } from '@/api/basicData/visual'
import { blobToBase64 } from '@/utils/blobToBase64'
export default {
components: {
vuedraggable
},
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
showPic: false,
imageUrl: null,
windowWidth: null,
pointList: [],
resetPointList: [],
equipmentList: [],
equipmentObj: {},
addNow: false,
eqId: null,
pointIndex: null
}
},
watch: {
pointIndex: function(val) {
if (val || val === 0) {
this.eqId = this.pointList[val].id
} else {
this.eqId = null
}
},
showPic: function(val) {
if (val && this.injectData.equipmentPoint) {
this.pointList = JSON.parse(this.injectData.equipmentPoint).map(item => {
item.show = false
return item
})
this.resetPointList = JSON.parse(this.injectData.equipmentPoint).map(item => {
item.show = false
return item
})
}
if (!val) {
this.addNow = false
this.eqId = null
this.pointIndex = null
this.pointList = []
this.resetPointList = []
}
}
},
mounted() {
this.windowWidth = window.innerWidth
this.getEqList()
window.addEventListener('resize', () => {
this.windowWidth = window.innerWidth
})
},
methods: {
// 获取设备数据字典
getEqList() {
locationList({}).then(res => {
this.equipmentList = res.data
this.equipmentList.map(item => {
this.equipmentObj[item.id] = item.name
})
}).catch(() => {
setTimeout(() => {
this.getEqList()
}, 10000)
})
},
emitClick() {
getUrl({
attachmentId: this.injectData.annexId,
type: 0
}).then(blob => {
blobToBase64(blob.data).then(res => {
this.imageUrl = res
this.showPic = true
})
})
},
// 添加位置点
setPoint(e) {
if (!this.addNow) {
const windowWidth = document.getElementById('imgbox' + this.injectData.id).clientWidth
const scrollY = document.getElementById('imgbox' + this.injectData.id).scrollTop
const [imgX, imgY] = [document.getElementById('lingImg').width, document.getElementById('lingImg').height]
const pointY = ((e.clientY + scrollY - 135) / imgY) * 100 + '%'
const pointX = ((e.clientX - windowWidth * 0.2 - 20) / imgX) * 100 + '%'
this.pointList.push({
id: null,
pointX,
pointY,
show: false
})
setTimeout(() => {
Vue.set(this.pointList[this.pointList.length - 1], 'show', true)
this.pointIndex = this.pointList.length - 1
}, 100)
this.addNow = true
} else {
this.$message.warning(this.$t('module.basicData.visual.addNow'))
}
},
// 删除位置点
delEqPoint(index) {
if (index === this.pointList.length - 1) {
this.addNow = false
} else {
Vue.set(this.pointList[index], 'show', false)
}
this.pointList.splice(index, 1)
},
// 确认位置点
confirmPointEq(index) {
if (index === this.pointList.length - 1) {
this.addNow = false
}
for (let i = 0; i < this.pointList.length; i++) {
if (this.eqId === null) {
this.$message.error(this.$t('module.basicData.visual.unSelect'))
return false
} else if (this.pointList[i].id === this.eqId) {
this.$message.error(this.$t('module.basicData.visual.choiseError'))
return false
}
}
Vue.set(this.pointList[index], 'id', this.eqId)
Vue.set(this.pointList[index], 'show', false)
this.clearIndex()
this.$message.success(this.$t('module.basicData.visual.choiseSucc'))
},
// 保存点击的气泡index
handleIndex(index) {
this.pointIndex = index
},
// 清除保存的index
clearIndex() {
this.pointIndex = null
},
// 提交位置点信息
pointConfirm() {
if (this.addNow) {
this.$message.warning(this.$t('module.basicData.visual.addNow'))
} else {
VisualUpdate({
id: this.injectData.id,
name: this.injectData.name,
annexId: this.injectData.annexId,
equipmentPoint: JSON.stringify(this.pointList)
}).then(res => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.showPic = false
this.$emit('emitData', {
type: ['refresh']
})
}
})
})
}
},
// 重置
resetPoint() {
Object.assign(this.pointList, this.resetPointList)
this.showPic = false
setTimeout(() => {
this.showPic = true
}, 100)
}
}
}
</script>
<style lang="scss">
.imgbox{
position: relative;
.point-badge{
position: absolute;
top: 0;
left: 0;
width: 20px;
height: 20px;
border-radius: 100%;
line-height: 20px;
font-size: 12px;
text-align: center;
padding: 0;
cursor: pointer;
}
}
</style>

View File

@@ -0,0 +1,282 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:00:51
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ 'btn.edit' | i18nFilter }}</el-button>
<el-dialog
:id="'imgbox' + injectData.id"
:close-on-click-modal="false"
width="60%"
top="50px"
:title="$t('module.basicData.visual.locationInformation')"
:visible.sync="showPic"
>
<div slot="title">
{{ $t('module.basicData.visual.locationInformation') }}
<el-popover
placement="top-start"
:title="$t('module.basicData.visual.help')"
width="400"
trigger="hover"
:content="$t('module.basicData.visual.tip')"
>
<svg-icon slot="reference" class-name="international-icon" icon-class="helptitle" style="cursor: pointer" />
</el-popover>
</div>
<div v-if="showPic" class="imgbox">
<img id="lingImg" :src="imageUrl" style="width: 100%" alt="" @click="setPoint">
<el-popover
v-for="(item, index) in pointList"
:key="index"
v-model="item.show"
placement="right"
trigger="click"
@hide="clearIndex"
>
<el-select v-model="eqId" clearable filterable>
<el-option v-for="i in equipmentList" :key="i.id" :value="i.id" :label="i.name" />
</el-select>
<div style="text-align: right; margin-top: 5px">
<el-button type="danger" @click="delEqPoint(index)">{{ 'btn.delete' | i18nFilter }}</el-button>
<el-button type="primary" @click="confirmPointEq(index)">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
<el-button
slot="reference"
class="point-badge"
:style="{left: `calc(${item.pointX} - 10px)`, top: `calc(${item.pointY} - 10px)`}"
type="danger"
@click="handleIndex(index)"
>
{{ index + 1 }}
</el-button>
</el-popover>
</div>
<el-row style="text-align:left">
<vuedraggable v-model="pointList" group="route">
<el-tag v-for="(item, index) in pointList" :key="index" type="info" closable style="margin: 5px" @close="delEqPoint(index)">
{{ index + 1 }}{{ 'module.basicData.visual.equipment' | i18nFilter }}{{ equipmentObj[item.id] }}
</el-tag>
</vuedraggable>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="showPic = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button @click="resetPoint()">{{ 'btn.reset' | i18nFilter }}</el-button>
<el-button type="primary" @click="pointConfirm()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</span>
</template>
<script>
import Vue from 'vue'
import vuedraggable from 'vuedraggable'
import { getUrl } from '@/api/file'
import { eqList, VisualUpdate } from '@/api/basicData/visual'
import { blobToBase64 } from '@/utils/blobToBase64'
export default {
components: {
vuedraggable
},
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
showPic: false,
imageUrl: null,
windowWidth: null,
pointList: [],
resetPointList: [],
equipmentList: [],
equipmentObj: {},
addNow: false,
eqId: null,
pointIndex: null
}
},
watch: {
pointIndex: function(val) {
if (val || val === 0) {
this.eqId = this.pointList[val].id
} else {
this.eqId = null
}
},
showPic: function(val) {
if (val && this.injectData.equipmentPoint) {
this.pointList = JSON.parse(this.injectData.equipmentPoint).map(item => {
item.show = false
return item
})
this.resetPointList = JSON.parse(this.injectData.equipmentPoint).map(item => {
item.show = false
return item
})
}
if (!val) {
this.addNow = false
this.eqId = null
this.pointIndex = null
this.pointList = []
this.resetPointList = []
}
}
},
mounted() {
this.windowWidth = window.innerWidth
this.getEqList()
window.addEventListener('resize', () => {
this.windowWidth = window.innerWidth
})
},
methods: {
// 获取设备数据字典
getEqList() {
eqList({
current: 1,
size: 999
}).then(res => {
this.equipmentList = res.data.records
this.equipmentList.map(item => {
this.equipmentObj[item.id] = item.name
})
}).catch(() => {
setTimeout(() => {
this.getEqList()
}, 10000)
})
},
emitClick() {
getUrl({
attachmentId: this.injectData.annexId,
type: 0
}).then(blob => {
blobToBase64(blob.data).then(res => {
this.imageUrl = res
this.showPic = true
})
})
},
// 添加位置点
setPoint(e) {
if (!this.addNow) {
const windowWidth = document.getElementById('imgbox' + this.injectData.id).clientWidth
const scrollY = document.getElementById('imgbox' + this.injectData.id).scrollTop
const [imgX, imgY] = [document.getElementById('lingImg').width, document.getElementById('lingImg').height]
const pointY = ((e.clientY + scrollY - 135) / imgY) * 100 + '%'
const pointX = ((e.clientX - windowWidth * 0.2 - 20) / imgX) * 100 + '%'
this.pointList.push({
id: null,
pointX,
pointY,
show: false
})
setTimeout(() => {
Vue.set(this.pointList[this.pointList.length - 1], 'show', true)
this.pointIndex = this.pointList.length - 1
}, 100)
this.addNow = true
} else {
this.$message.warning(this.$t('module.basicData.visual.addNow'))
}
},
// 删除位置点
delEqPoint(index) {
if (index === this.pointList.length - 1) {
this.addNow = false
} else {
Vue.set(this.pointList[index], 'show', false)
}
this.pointList.splice(index, 1)
},
// 确认位置点
confirmPointEq(index) {
if (index === this.pointList.length - 1) {
this.addNow = false
}
for (let i = 0; i < this.pointList.length; i++) {
if (this.eqId === null) {
this.$message.error(this.$t('module.basicData.visual.unSelect'))
return false
} else if (this.pointList[i].id === this.eqId) {
this.$message.error(this.$t('module.basicData.visual.choiseError'))
return false
}
}
Vue.set(this.pointList[index], 'id', this.eqId)
Vue.set(this.pointList[index], 'show', false)
this.clearIndex()
this.$message.success(this.$t('module.basicData.visual.choiseSucc'))
},
// 保存点击的气泡index
handleIndex(index) {
this.pointIndex = index
},
// 清除保存的index
clearIndex() {
this.pointIndex = null
},
// 提交位置点信息
pointConfirm() {
if (this.addNow) {
this.$message.warning(this.$t('module.basicData.visual.addNow'))
} else {
VisualUpdate({
id: this.injectData.id,
name: this.injectData.name,
annexId: this.injectData.annexId,
equipmentPoint: JSON.stringify(this.pointList)
}).then(res => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.showPic = false
this.$emit('emitData', {
type: ['refresh']
})
}
})
})
}
},
// 重置
resetPoint() {
Object.assign(this.pointList, this.resetPointList)
this.showPic = false
setTimeout(() => {
this.showPic = true
}, 100)
}
}
}
</script>
<style lang="scss">
.imgbox{
position: relative;
.point-badge{
position: absolute;
top: 0;
left: 0;
width: 20px;
height: 20px;
border-radius: 100%;
line-height: 20px;
font-size: 12px;
text-align: center;
padding: 0;
cursor: pointer;
}
}
</style>

View File

@@ -0,0 +1,475 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:01:03
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ 'btn.edit' | i18nFilter }}</el-button>
<el-dialog
:id="'imgbox-route-' + injectData.id"
:close-on-click-modal="false"
width="60%"
top="50px"
:visible.sync="showPic"
>
<div slot="title">
{{ $t('module.basicData.visual.runningTrack') }}
<el-popover
placement="top-start"
:title="$t('module.basicData.visual.help')"
width="400"
trigger="hover"
:content="$t('module.basicData.visual.tip') + $t('module.basicData.visual.routeTip')"
>
<svg-icon slot="reference" class-name="international-icon" icon-class="helptitle" style="cursor: pointer" />
</el-popover>
</div>
<el-row :id="'lineSelect' + injectData.id" style="text-align: left; margin-bottom: 10px">
<el-select v-model="lineIndex" clearable filterable @change="resetAllStadus">
<el-option v-for="(item, index) in routeList" :key="index" :value="index" :label="item.lineName" />
</el-select>
<el-button type="primary" @click="addLine">{{ 'btn.add' | i18nFilter }}</el-button>
<el-button type="primary" @click="editLine">{{ 'btn.edit' | i18nFilter }}</el-button>
<el-button type="danger" @click="deleteLine">{{ 'btn.delete' | i18nFilter }}</el-button>
</el-row>
<div v-if="showPic && lineIndex >= 0" class="imgbox">
<canvas :id="'canvas' + injectData.id" class="visual-canvas" width="500" height="500" />
<img id="lingImg" :src="imageUrl" style="width: 100%" alt="" @click="setRoute">
<el-popover
v-for="(item, index) in routeList[lineIndex].list"
:key="index"
v-model="item.show"
placement="right"
trigger="click"
@hide="clearIndex"
>
<el-select v-model="eqId" clearable filterable>
<el-option v-for="i in equipmentList" :key="i.id" :value="i.id" :label="i.name" />
</el-select>
<div style="text-align: right; margin-top: 5px">
<el-button type="danger" @click="delEqRoute(index)">{{ 'btn.delete' | i18nFilter }}</el-button>
<el-button type="primary" @click="confirmRouteEq(index)">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
<el-button
slot="reference"
class="route-badge"
:style="{left: `calc(${item.routeX} - 10px)`, top: `calc(${item.routeY} - 10px)`}"
type="success"
@click="handleIndex(index)"
>
{{ index + 1 }}
</el-button>
</el-popover>
</div>
<el-row v-if="showPic && lineIndex >= 0" style="text-align:left">
<vuedraggable v-model="routeList" group="route">
<el-tag v-for="(item, index) in routeList[lineIndex].list" :key="index" type="info" closable style="margin: 5px" @close="delEqRoute(index)">
{{ index + 1 }}{{ 'module.basicData.visual.equipment' | i18nFilter }}{{ equipmentObj[item.id] }}
</el-tag>
</vuedraggable>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="showPic = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button @click="resetRoute()">{{ 'btn.reset' | i18nFilter }}</el-button>
<el-button type="primary" @click="routeConfirm()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
<el-dialog
:title="addLineStatus ? 'btn.add' : 'btn.edit' | i18nFilter"
:close-on-click-modal="false"
:visible.sync="lineShow"
>
<el-form
ref="lineData"
:model="lineData"
:rules="lineDataRules"
size="medium"
label-width="120px"
label-position="left"
>
<el-col :span="24">
<el-form-item :label="$t('module.basicData.visual.editLineName')" prop="name">
<el-input v-model="lineData.editLineName" :placeholder="['placeholder.input', $t('module.basicData.visual.editLineName')] | i18nFilterForm" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="lineShow = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="lineFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</span>
</template>
<script>
import Vue from 'vue'
import vuedraggable from 'vuedraggable'
import { getUrl } from '@/api/file'
import { eqList, VisualUpdate } from '@/api/basicData/visual'
import { blobToBase64 } from '@/utils/blobToBase64'
export default {
components: {
vuedraggable
},
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
showPic: false,
imageUrl: null,
windowWidth: null,
routeList: [],
resetRouteList: [],
equipmentList: [],
equipmentObj: {},
addNow: false,
eqId: null,
routeIndex: null,
lineIndex: null,
lineShow: false,
addLineStatus: false,
imgW: 400,
imgH: 400,
lineData: {
editLineName: null
},
drawloading: false,
lineDataRules: {
editLineName: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.visual.editLineName')]),
trigger: 'blur'
}]
}
}
},
watch: {
routeIndex: function(val) {
if (val || val === 0) {
this.eqId = this.routeList[this.lineIndex].list[val].id
} else {
this.eqId = null
}
},
showPic: function(val) {
if (val && this.injectData.trajectory) {
this.routeList = JSON.parse(this.injectData.trajectory)
for (let i = 0; i < this.routeList.length; i++) {
this.routeList[i].list.map(item => {
item.show = false
return item
})
}
this.addNow = false
this.lineIndex = 0
this.resetRouteList = JSON.parse(this.injectData.trajectory)
for (let i = 0; i < this.resetRouteList.length; i++) {
this.resetRouteList[i].list.map(item => {
item.show = false
return item
})
}
}
}
},
mounted() {
this.windowWidth = window.innerWidth
this.getEqList()
window.addEventListener('resize', () => {
this.windowWidth = window.innerWidth
if (this.showPic) {
this.imgW = document.getElementById('lingImg').width
this.imgH = document.getElementById('lingImg').height
if (!this.drawloading) {
this.drawCanvas()
this.drawloading = true
setTimeout(() => {
this.drawloading = false
}, 100)
}
}
})
},
methods: {
// 获取设备数据字典
getEqList() {
eqList().then(res => {
this.equipmentList = res.data
this.equipmentList.splice(0, 0, { id: 'daogui', name: '导轨' }, { id: 'zhuanzhedian', name: '转折点' })
this.equipmentList.map(item => {
this.equipmentObj[item.id] = item.name
})
}).catch(() => {
setTimeout(() => {
this.getEqList()
}, 10000)
})
},
emitClick() {
getUrl({
attachmentId: this.injectData.annexId,
type: 0
}).then(blob => {
blobToBase64(blob.data).then(res => {
this.imageUrl = res
this.showPic = true
setTimeout(() => {
this.imgW = document.getElementById('lingImg').width
this.imgH = document.getElementById('lingImg').height
this.drawCanvas()
}, 10)
})
}).catch(err => {
this.$message.error(err)
})
},
// 绘制辅助线
drawCanvas() {
const c = document.getElementById('canvas' + this.injectData.id)
c.width = this.imgW
c.height = this.imgH
const cxt = c.getContext('2d')
for (let i = 0; i < this.routeList[this.lineIndex].list.length; i++) {
if (i === 0) {
cxt.moveTo(this.toNumber(this.routeList[this.lineIndex].list[i].routeX) * this.imgW + 0.5, this.toNumber(this.routeList[this.lineIndex].list[i].routeY) * this.imgH + 0.5)
} else if (i === this.routeList[this.lineIndex].list.length - 1) {
cxt.lineTo(this.toNumber(this.routeList[this.lineIndex].list[i].routeX) * this.imgW + 0.5, this.toNumber(this.routeList[this.lineIndex].list[i].routeY) * this.imgH + 0.5)
cxt.strokeStyle = '#000000'
cxt.lineWidth = '6'
cxt.stroke()
} else if (i > 0) {
cxt.lineTo(this.toNumber(this.routeList[this.lineIndex].list[i].routeX) * this.imgW + 0.5, this.toNumber(this.routeList[this.lineIndex].list[i].routeY) * this.imgH + 0.5)
}
}
for (let i = 0; i < this.routeList[this.lineIndex].list.length; i++) {
if (i === 0) {
cxt.moveTo(this.toNumber(this.routeList[this.lineIndex].list[i].routeX) * this.imgW, this.toNumber(this.routeList[this.lineIndex].list[i].routeY) * this.imgH)
} else if (i === this.routeList[this.lineIndex].list.length - 1) {
cxt.lineTo(this.toNumber(this.routeList[this.lineIndex].list[i].routeX) * this.imgW, this.toNumber(this.routeList[this.lineIndex].list[i].routeY) * this.imgH)
cxt.strokeStyle = '#13ce66'
cxt.lineWidth = '2'
cxt.stroke()
} else if (i > 0) {
cxt.lineTo(this.toNumber(this.routeList[this.lineIndex].list[i].routeX) * this.imgW, this.toNumber(this.routeList[this.lineIndex].list[i].routeY) * this.imgH)
}
}
},
// 去除百分号除以100通用方法
toNumber(v) {
return Number(v.substring(0, v.length - 1)) / 100
},
// 添加位置点
setRoute(e) {
if (!this.addNow) {
const windowWidth = document.getElementById('imgbox-route-' + this.injectData.id).clientWidth
const scrollY = document.getElementById('imgbox-route-' + this.injectData.id).scrollTop
const routeY = ((e.clientY + scrollY - (145 + document.getElementById('lineSelect' + this.injectData.id).clientHeight)) / this.imgH) * 100 + '%'
const routeX = ((e.clientX - windowWidth * 0.2 - 20) / this.imgW) * 100 + '%'
this.routeList[this.lineIndex].list.push({
id: null,
routeX,
routeY,
show: false
})
setTimeout(() => {
Vue.set(this.routeList[this.lineIndex].list[this.routeList[this.lineIndex].list.length - 1], 'show', true)
this.routeIndex = this.routeList[this.lineIndex].list.length - 1
this.drawCanvas()
}, 100)
this.addNow = true
} else {
this.$message.warning(this.$t('module.basicData.visual.addNow'))
}
},
// 删除位置点
delEqRoute(index) {
if (index === this.routeList[this.lineIndex].list.length - 1) {
this.addNow = false
} else {
Vue.set(this.routeList[this.lineIndex].list[index], 'show', false)
}
this.routeList[this.lineIndex].list.splice(index, 1)
this.drawCanvas()
this.clearIndex()
},
// 确认位置点
confirmRouteEq(index) {
if (index === this.routeList[this.lineIndex].list.length - 1) {
this.addNow = false
}
for (let i = 0; i < this.routeList[this.lineIndex].list.length; i++) {
if (this.eqId === null) {
this.$message.error(this.$t('module.basicData.visual.unSelect'))
return false
} else if (this.routeList[this.lineIndex].list[i].id === this.eqId && this.eqId !== 'daogui' && this.eqId !== 'zhuanzhedian') {
this.$message.error(this.$t('module.basicData.visual.choiseError'))
return false
}
}
Vue.set(this.routeList[this.lineIndex].list[index], 'id', this.eqId)
Vue.set(this.routeList[this.lineIndex].list[index], 'show', false)
this.clearIndex()
this.$message.success(this.$t('module.basicData.visual.choiseSucc'))
},
// 保存点击的气泡index
handleIndex(index) {
this.routeIndex = index
},
// 清除保存的index
clearIndex() {
this.routeIndex = null
},
// 提交位置点信息
routeConfirm() {
if (this.addNow) {
this.$message.warning(this.$t('module.basicData.visual.addNow'))
} else {
VisualUpdate({
id: this.injectData.id,
name: this.injectData.name,
annexId: this.injectData.annexId,
trajectory: JSON.stringify(this.routeList)
}).then(res => {
this.$message({
message: this.$t('baseTip.OperationSucc'),
type: 'success',
duration: 1500,
onClose: () => {
this.showPic = false
this.$emit('emitData', {
type: ['refresh']
})
}
})
})
}
},
// 重置 待完善
resetRoute() {
new Promise(resolve => {
Object.assign(this.routeList, this.resetRouteList)
this.showPic = false
setTimeout(() => {
this.showPic = true
resolve()
}, 100)
}).then(() => {
this.lineIndex = 0
this.drawCanvas()
})
},
// 切换轨迹时清除所有虚拟状态
resetAllStadus() {
if (this.addNow) {
this.$message.warning(this.$t('module.basicData.visual.changeLine'))
} else {
this.clearIndex()
this.drawCanvas()
}
},
// 添加产线
addLine() {
this.addLineStatus = true
this.lineData.editLineName = null
this.lineShow = true
},
editLine() {
this.addLineStatus = false
this.lineData.editLineName = this.routeList[this.lineIndex].lineName
this.lineShow = true
},
// 删除产线
deleteLine() {
if (this.routeList.length === 1) {
this.$message.error(this.$t('module.basicData.visual.oneLineTip'))
} else {
this.$confirm(`${this.$t('deleteTip.header')}${this.routeList[this.lineIndex].lineName}${this.$t('deleteTip.footer')}`, this.$t('deleteTip.tip'), {
confirmButtonText: this.$t('deleteTip.confirm'),
cancelButtonText: this.$t('deleteTip.cancel'),
type: 'warning'
}).then(() => {
new Promise(resolve => {
this.routeList.splice(this.lineIndex, 1)
resolve()
}).then(() => {
this.lineIndex = 0
this.addNow = false
this.routeIndex = null
this.drawCanvas()
this.clearIndex()
this.$message.success(this.$t('baseTip.OperationSucc'))
})
})
}
},
// 新增、修改路径名
lineFormSubmit() {
if (this.addLineStatus) {
for (let i = 0; i < this.routeList.length; i++) {
if (this.routeList[i].lineName === this.lineData.editLineName) {
this.$message.error(this.$t('module.basicData.visual.oneLineNameTip'))
return false
}
}
if (this.lineData.editLineName) {
this.routeList.push({
lineName: this.lineData.editLineName,
list: []
})
this.$message.success(this.$t('baseTip.OperationSucc'))
this.lineShow = false
} else {
this.$message.error(this.$t('module.basicData.visual.lineNameNotNullTip'))
}
} else {
for (let i = 0; i < this.routeList.length; i++) {
if (this.routeList[i].lineName === this.lineData.editLineName && this.lineIndex !== i) {
this.$message.error(this.$t('module.basicData.visual.oneLineNameTip'))
return false
}
}
if (this.lineData.editLineName) {
Vue.set(this.routeList[this.lineIndex], 'lineName', this.lineData.editLineName)
this.$message.success(this.$t('baseTip.OperationSucc'))
this.lineShow = false
} else {
this.$message.error(this.$t('module.basicData.visual.lineNameNotNullTip'))
}
}
}
}
}
</script>
<style lang="scss">
.imgbox{
position: relative;
.route-badge{
position: absolute;
top: 0;
left: 0;
width: 20px;
height: 20px;
border-radius: 100%;
line-height: 20px;
font-size: 12px;
text-align: center;
padding: 0;
cursor: pointer;
}
.visual-canvas{
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}
}
</style>

View File

@@ -0,0 +1,34 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-03-06 16:16:12
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.CodeRules.manageProperty') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
console.log(this.injectData)
this.$router.push({
name: 'codeAttr',
query: {
id: this.injectData.id
}
})
}
}
}
</script>

Some files were not shown because too many files have changed in this diff Show More