时间格式

dev
lilu 2 years ago
parent d1794cb0a2
commit 9e0537d3e9

@ -1667,25 +1667,25 @@ export default {
// }
},
closingdateChange (date, dateString) {
// if (!dateString) {
// this.details.closingdate = null
// } else {
if (!dateString) {
this.details.closingdate = null
} else {
this.details.closingdate = dateString + ':00'
// }
}
},
closevgmdateChange (date, dateString) {
// if (!dateString) {
// this.details.closevgmdate = null
// } else {
if (!dateString) {
this.details.closevgmdate = null
} else {
this.details.closevgmdate = dateString + ':00'
// }
}
},
closedocdateChange (date, dateString) {
// if (!dateString) {
// this.details.closedocdate = null
// } else {
if (!dateString) {
this.details.closedocdate = null
} else {
this.details.closedocdate = dateString + ':00'
// }
}
},
getTextareaChange ({ type, value }) {
console.log('== 输入框更新 ==', type, value)

@ -1568,7 +1568,7 @@ export default {
this.traceModalVisible = false
this.traceValue = []
} else {
this.$message.success(res.message)
this.$message.error(res.message)
this.traceModalVisible = false
this.traceValue = []
}

@ -0,0 +1,313 @@
<template>
<div>
<a-row :gutter="24">
<a-col :md="24" :sm="24" style="padding: 0 0 0 0" class="content-box">
<x-card>
<div slot="content" class="table-page-search-wrapper">
<a-form layout="inline" :form="form">
<a-row :gutter="48">
<a-col :md="6" :sm="24">
<a-form-item label="品名分类">
<a-input
placeholder="请输入品名分类"
v-decorator="['goodsCategory', { rules: [{ required: false, message: '请输入品名分类' }] }]"
/>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="品名分类名称">
<a-input
placeholder="请输入品名分类名称"
v-decorator="[
'goodsCategoryName',
{ rules: [{ required: false, message: '请输入品名分类名称' }] },
]"
/>
</a-form-item>
</a-col>
<a-col :md="12" :sm="24" :labelCol="{ span: 2, offset: 12 }">
<span class="table-page-search-submitButtons" style="text-align: right">
<a-button type="primary" @click="tableRefresh"></a-button>
<a-button style="margin-left: 8px" @click="tableReset"></a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
</x-card>
<x-card class="content-table">
<div slot="content" class="table-page-search-wrapper" :style="{ marginTop: '-8px' }">
<vxe-toolbar>
<template #buttons>
<a-button type="primary" icon="edit" @click="addProject"></a-button>
</template>
<template #tools>
<div class="right">
<span class="tab-btn" @click="tableRefresh">
<a-icon type="redo" :style="{ fontSize: '16px' }" /> 刷新
</span>
</div>
</template>
</vxe-toolbar>
<vxe-grid
ref="xGrid"
v-bind="gridOptions"
row-class-name="line-box"
@page-change="handlePageChange"
style="margin-top: 6px"
>
<template #operate="{ row }">
<vxe-button type="text" icon="vxe-icon-edit" @click="editColumns(row)"></vxe-button>
<vxe-button type="text" icon="vxe-icon-delete" @click="removeColumns(row)"></vxe-button>
</template>
</vxe-grid>
</div>
</x-card>
</a-col>
</a-row>
<add-form ref="addForm" :fromData="addFromData" :type="addFromType" @ok="handleOk" />
</div>
</template>
<script>
import { XCard } from '@/components'
import initData from './modules/initData'
import columnSetting from '@/components/tableColumnSetting'
import addForm from './modules/addFrom'
import {
GetParaGoodsCategoryPage,
SaveParaGoodsCategoryInfo,
DeleteParaGoodsCategoryInfo,
GetParaGoodsCategoryInfo,
} from '@/api/modular/main/ProductCategoryList'
export default {
name: 'BookingLedger',
components: {
XCard,
columnSetting,
addForm,
},
data() {
return {
form: this.$form.createForm(this),
setVisible: false,
showColumns: null,
gridOptions: {
border: false,
resizable: true,
showOverflow: true,
loading: true,
round: true,
autoResize: true,
align: 'center',
columnConfig: { resizable: true },
importConfig: {},
exportConfig: {},
pagerConfig: {
total: 0,
currentPage: 1,
pageSize: 10,
pageSizes: [10, 20, 50, 100, 200, 500],
},
columns: JSON.parse(JSON.stringify(initData.columns)),
data: [],
},
addFromData: {},
addFromType: 'add',
}
},
created() {
this.showColumns = JSON.parse(JSON.stringify(initData.columns))
this.getList()
},
mounted() {},
methods: {
init(queryParam = {}) {
this.gridOptions.pagerConfig = {
total: 0,
currentPage: 1,
pageSize: 10,
pageSizes: [10, 20, 50, 100, 200, 500],
}
this.gridOptions.data = []
this.getList(queryParam)
},
handlePageChange({ currentPage, pageSize }) {
console.log(currentPage, pageSize)
const {
form: { validateFields },
} = this
validateFields((err, values) => {
if (!err) {
if (values.createdTime) {
const time = values.createdTime.map((item, index) => {
const str = this.dateFtt('YYYY-MM-DD', item._d)
return str
})
console.log(time)
values.createdTime = time
}
if (values.updataTime) {
const _time = values.updataTime.map((item, index) => {
const str = this.dateFtt('YYYY-MM-DD', item._d)
return str
})
console.log(_time)
values.updataTime = _time
}
this.gridOptions.pagerConfig.currentPage = currentPage
this.gridOptions.pagerConfig.pageSize = pageSize
this.getList(values)
}
})
},
getList(queryParam = {}) {
const { currentPage, pageSize } = this.gridOptions.pagerConfig
GetParaGoodsCategoryPage({
goodsCategory: queryParam.goodsCategory,
goodsCategoryName: queryParam.goodsCategoryName,
pageNo: currentPage,
pageSize: pageSize,
})
.then((res) => {
const _data = res.data.items.map((item, index) => {
item.row_id = (currentPage - 1) * pageSize + index
return item
})
this.$set(this.gridOptions.pagerConfig, 'total', res.data.totalCount)
this.$set(this.gridOptions, 'data', JSON.parse(JSON.stringify(_data)))
this.$set(this.gridOptions, 'loading', false)
this.$forceUpdate()
})
.catch((err) => {
console.log(err)
})
},
editColumns(data) {
this.addFromType = 'edit'
this.addFromId = data.id
GetParaGoodsCategoryInfo({
id: this.addFromId,
}).then((res) => {
if (res.success) {
this.addFromData = res.data
console.log(this.addFromData)
this.$refs.addForm.add()
} else {
this.$message.error(res.message)
}
})
},
removeColumns(data) {
DeleteParaGoodsCategoryInfo(data.id).then((res) => {
if (res.success) {
this.$message.success('删除成功')
const {
form: { validateFields },
} = this
validateFields((err, values) => {
if (!err) {
this.init(values)
}
})
} else {
this.$message.error(res.message)
}
})
},
addProject() {
this.addFromData = {}
this.addFromType = 'add'
this.addFromId = ''
this.$refs.addForm.add()
},
columnChange(data) {
const arr = []
data.map((item, index) => {
if (item.checked) {
arr.push(item)
}
})
this.showColumns = []
this.showColumns = arr
this.gridOptions.columns = arr
this.$forceUpdate()
},
confirmRemove(e) {
console.log(e)
const select = this.$refs.xGrid.getCheckboxRecords()
const pkIdArr = select.map((item, index) => {
return Number(item.id)
})
console.log(pkIdArr)
DeleteParaGoodsCategoryInfo({
Ids: pkIdArr,
}).then((res) => {
if (res.success) {
this.$message.success('删除成功')
const {
form: { validateFields },
} = this
validateFields((err, values) => {
if (!err) {
this.init(values)
}
})
} else {
this.$message.error(res.message)
}
})
},
cancelRemove(e) {
console.log(e)
this.$message.error('取消操作')
},
handleOk() {
const form = this.$refs.addForm.form
form.validateFields((errors, values) => {
if (!errors) {
console.log('values', values)
SaveParaGoodsCategoryInfo({
id: this.addFromId,
goodsCode: values.goodsCode,
goodsNameCN: values.goodsNameCN,
goodsNameEN: values.goodsNameEN,
goodsDesp: values.goodsDesp,
goodsCategory: values.goodsCategory,
goodsCategoryName: values.goodsCategoryName,
})
.then((res) => {
this.$refs.addForm.$data.confirmLoading = false
if (res.success) {
this.$message.success('保存成功')
this.$refs.addForm.handleCancel()
this.init()
} else {
this.$message.error(res.message)
}
})
.catch((err) => {
console.log(err)
})
}
})
},
tableRefresh() {
const {
form: { validateFields },
} = this
validateFields((err, values) => {
if (!err) {
this.init(values)
}
})
},
tableReset() {
this.form.resetFields()
this.init()
},
tableHeaderEdit() {},
},
}
</script>

@ -0,0 +1,170 @@
<template>
<a-modal
:title="`品名分类编辑(${type=='edit' ? '修改' : '新增'}`"
:width="900"
:visible="visible"
:confirmLoading="confirmLoading"
:maskClosable="false"
cancelText="关闭"
okText="保存"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="formLoading">
<a-form :form="form">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item
label="品名分类"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入品名分类" v-decorator="['goodsCategory', {rules: [{required: true, message: ''}]}]" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
label="品名分类名称"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入品名分类名称" v-decorator="['goodsCategoryName']" />
</a-form-item>
</a-col>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { AutoComplete } from 'ant-design-vue'
import {
QueryParaGoodsCategoryInfo
} from '@/api/modular/main/ProductNameList'
export default {
props: {
type: {
type: String,
default: 'add'
},
fromData: {
type: Object,
default: null
}
},
components: {
AutoComplete
},
data () {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
labelCol2: {
xs: { span: 24 },
sm: { span: 3 }
},
wrapperCol2: {
xs: { span: 24 },
sm: { span: 20 }
},
visible: false,
confirmLoading: false,
formLoading: true,
form: this.$form.createForm(this),
goodsCategory: []
}
},
computed: {
goodsCategoryArr () {
if (this.goodsCategory) {
const arr = []
this.goodsCategory.map((item, index) => {
if (!arr.includes(item.goodsCategory)) {
arr.push(item.goodsCategory)
}
})
return arr
} else {
return []
}
}
},
watch: {
fromData: {
handler (nval, oval) {
if (!this.formLoading) {
this.$nextTick(() => {
this.form.setFieldsValue(nval)
})
}
},
deep: true
}
},
methods: {
add () {
this.visible = true
this.formLoading = false
},
handleSubmit () {
const { form: { validateFields } } = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
this.$emit('ok', values)
} else {
this.confirmLoading = false
}
})
},
handleCancel () {
this.form.resetFields()
this.visible = false
},
getGoodsCategory(name = '') {
// console.log('', name, this.goodsCategory, this.goodsCategoryArr)
QueryParaGoodsCategoryInfo({
queryItem: name,
top: 50
}).then((res) => {
this.goodsCategory = res.data
})
},
goodsCategorySelect(value) {
const index = this.goodsCategoryArr.indexOf(value)
this.form.setFieldsValue({
goodsCategory: this.goodsCategory[index].goodsCategory || '',
goodsCategoryName: this.goodsCategory[index].goodsCategoryName || ''
})
},
goodsCategoryChange(value) {
this.getGoodsCategory(value)
}
}
}
</script>
<style lang="less" scoped>
.line{
height: 30px;
line-height:30px;
text-align: right;
font-size: 14px;
span{
margin-left: 20px;
}
span:nth-of-type(2){
width: 120px;
display: inline-block;
text-align: left;
}
}
</style>

@ -0,0 +1,11 @@
export default {
columns: [
{ type: 'seq', width: 60, noDraggable: true },
{ field: 'goodsCategory', title: '品名分类', showHeaderOverflow: true, sortable: true },
{ field: 'goodsCategoryName', title: '品名分类名称', showHeaderOverflow: true, sortable: true },
{ field: 'createUserName', title: '创建者名称', showHeaderOverflow: true, sortable: true },
{ field: 'createTime', title: '创建时间', showHeaderOverflow: true, sortable: true },
{ field: 'updateTime', title: '更新时间', showHeaderOverflow: true, sortable: true },
{ field: 'operate', title: '操作', width: 150, noDraggable: true, slots: { default: 'operate' }, fixed: 'right', resizable: false }
]
}
Loading…
Cancel
Save