更新
This commit is contained in:
@@ -2,18 +2,35 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 15:41:11
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2022-03-03 14:28:58
|
||||
* @LastEditTime: 2022-03-04 09:22:58
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form
|
||||
:placeholder-name="placeholderName"
|
||||
:key-name="keyName"
|
||||
:show-add="showAdd"
|
||||
@getDataList="getList"
|
||||
@add="addNew"
|
||||
/>
|
||||
<el-form
|
||||
ref="formData"
|
||||
:rules="rules"
|
||||
:model="listQuery"
|
||||
:inline="true"
|
||||
size="medium"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item :label="$t('module.basicData.Warehouse.TimeSlot')" prop="time">
|
||||
<el-date-picker
|
||||
v-model="listQuery.timeSlot"
|
||||
type="daterange"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:start-placeholder="$t('module.orderManage.order.StartTime')"
|
||||
:end-placeholder="$t('module.orderManage.order.StartTime')"
|
||||
:range-separator="$t('module.orderManage.order.To')"
|
||||
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"
|
||||
@@ -35,18 +52,17 @@
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<Factory-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import { StateConfigList, StateConfigDelete } from '@/api/basicData/StateConfig'
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import FactoryAdd from './components/ExecutionInfoDetail.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 basicData from '@/filters/basicData'
|
||||
import i18n from '@/lang'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
@@ -65,62 +81,51 @@ import basicData from '@/filters/basicData'
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
type: 'see',
|
||||
btnName: 'btn.see'
|
||||
}
|
||||
// {
|
||||
// type: 'delete',
|
||||
// btnName: 'btn.delete'
|
||||
// }
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.quality.QCPplan.QCPcode'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
label: i18n.t('module.quality.QCPplan.getTime'),
|
||||
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: 'description',
|
||||
label: i18n.t('module.basicData.visual.Remarks'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'QCPplan',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm },
|
||||
name: 'ExecutionInfo',
|
||||
components: { Pagination, BaseTable, MethodBtn, 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.StateConfig.status'),
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 150,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
showAdd: false,
|
||||
listLoading: true,
|
||||
rules: {},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10
|
||||
size: 10,
|
||||
timeSlot: []
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -129,37 +134,32 @@ export default {
|
||||
},
|
||||
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(() => {})
|
||||
}
|
||||
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
|
||||
getList() {
|
||||
// this.listLoading = true
|
||||
if (this.listQuery.timeSlot) {
|
||||
this.listQuery.startTime = this.listQuery.timeSlot[0]
|
||||
this.listQuery.endTime = this.listQuery.timeSlot[1]
|
||||
} else {
|
||||
this.listQuery.startTime = ''
|
||||
this.listQuery.endTime = ''
|
||||
}
|
||||
// ExecutionInfoList(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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user