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,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>