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,228 @@
<template>
<div :class="$style.container">
<SearchBar
:placeholder="$t('module.report.reportList.reportName')"
:input-width="200"
@on-search="handleSearch"
>
<el-button type="success" icon="el-icon-plus" @click="handleAdd()">{{ "btn.add" | i18nFilter }}</el-button>
<el-button icon="el-icon-arrow-left" @click="$router.go(-1)">{{ 'btn.back' | i18nFilter }}</el-button>
</SearchBar>
<el-table
:data="tableDataList"
:class="$style.table"
:stripe="true"
:header-cell-style="{background:'#eef1f6',color:'#606266',height: '56px', textAlign: 'center'}"
:cell-style="{ textAlign: 'center' }"
size="medium"
>
<el-table-column prop="index" :label="'tableHeader.index' | i18nFilter" width="80" fixed="left" />
<el-table-column prop="fileName" :label="$t('module.report.reportList.reportName')" />
<el-table-column prop="reportType" :label="$t('module.report.reportList.reportSort')" width="300">
<template
slot-scope="scope"
><el-select
v-model="scope.row.category"
:class="$style.select"
filterable
clearable
@change="reportChange(scope.row)"
>
<el-option
v-for="item in reportTypeList"
:key="item.id"
:label="item.name"
:value="item.id"
/> </el-select></template>
</el-table-column>
<el-table-column prop="createTime" :label="$t('module.report.reportList.createTime')" width="220">
<template slot-scope="scope">
<span>{{ scope.row.createTime | commonFilter(timeFormatter) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('module.report.reportList.operation')" width="420" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-search"
@click="handleView(scope.row.fileName)"
>{{ "btn.view" | i18nFilter }}</el-button>
<el-button
size="mini"
type="info"
icon="el-icon-edit"
@click="handleDesign(scope.row.name)"
>{{ "btn.design" | i18nFilter }}</el-button>
<el-button
size="mini"
type="info"
icon="el-icon-edit"
@click="handleEdit(scope.row.id)"
>{{ "btn.edit" | i18nFilter }}</el-button>
<el-button
type="danger"
size="mini"
icon="el-icon-delete"
@click="handleDelete(scope.row.id)"
>{{ "btn.delete" | i18nFilter }}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:hide-on-single-page="false"
:class="$style.table"
:current-page="page.current"
:page-sizes="[10, 20, 30, 40]"
:page-size="page.size"
layout="total, sizes, prev, pager, next"
:total="pageTotal"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<Report-edit v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="handleSearch" />
</div>
</template>
<script>
import moment from 'moment'
import { page, del, listCategory, update } from '@/api/report-manage/report.js'
import SearchBar from './components/search-bar'
import ReportEdit from './components/report-edit'
import i18n from '@/lang'
import { timeFormatter } from '@/filters'
export default {
components: { SearchBar, ReportEdit },
filters: {
commonFilter: (source, filterType = a => a) => {
return filterType(source)
}
},
props: {},
data() {
return {
reportTypeList: [],
moment,
tableDataList: [],
pageTotal: 0,
page: {
current: 1,
size: 10
},
param: {},
addOrUpdateVisible: false,
timeFormatter
}
},
created() {
this.init()
this.handleSearch()
},
methods: {
init() {
listCategory({}).then(res => {
this.reportTypeList = res.data
})
},
handleSearch(param) {
this.param = param
console.log(param)
page({ ...param, key: param && param.keywords, category: this.$route.query.sortId, ...this.page }).then(
res => {
if (!res.data) {
return
}
this.pageTotal = res.data && res.data.total
console.log(this.pageTotal)
if (!res.data.records) {
this.tableDataList = []
return
}
this.tableDataList = res.data.records.map((m, index) => ({
...m,
index: this.page.size * (this.page.current - 1) + index + 1
}))
}
)
},
handleView(name) {
this.$router.push({
path: '/form/report-view',
query: {
redirect: '/form/report',
name
}
})
},
handleAdd() {
this.$router.push({
path: '/form/report-design',
query: {
redirect: '/form/report'
}
})
},
handleDesign(name) {
this.$router.push({
path: '/form/report-design',
query: {
redirect: '/form/report',
name
}
})
},
handleEdit(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
handleSizeChange(val) {
console.log(`每页 ${val}`)
this.page.size = val
this.handleSearch(this.param)
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.page.current = val
this.handleSearch(this.param)
},
handleDelete(id) {
this.$confirm(
i18n.t('deleteMsgBox.content'),
i18n.t('deleteMsgBox.hint'),
{
confirmButtonText: i18n.t('btn.confirm'),
cancelButtonText: i18n.t('btn.cancel'),
type: 'warning'
}
).then(async() => {
del({ id }).then(res => {
this.page.current = 1
this.handleSearch(this.param)
this.$message({
type: 'info',
message: i18n.t('deleteMsgBox.doneMsg')
})
})
})
},
reportChange($e, row) {
console.log($e)
$e.url = $e.url || '-'
update($e).then(res => {
this.$message.info('更新成功!')
this.handleSearch()
})
}
}
}
</script>
<style lang="scss" module>
.container {
.table {
margin: 16px;
width: 98.5%;
}
}
</style>

View File

@@ -0,0 +1,47 @@
<template>
<div v-loading="loading" :class="$style.container">
<iframe
id="zgboke"
:class="$style.mainIframe"
name="mainIframe"
:src="url"
frameborder="0"
scrolling="auto"
/>
</div>
</template>
<script>
export default {
components: {},
props: {},
data() {
return {
loading: true,
url: process.env.VUE_APP_REPORT_DESIGN_URL
}
},
mounted() {
const vm = this
console.log(this.$route.query)
const { name } = this.$route.query
this.url += name ? '?_u=db:' + this.$route.query.name : ''
const ifream = document.getElementById('zgboke')
ifream.onload = function() {
console.log('加载完成')
vm.loading = false
}
},
methods: {}
}
</script>
<style lang="scss" module>
.container {
margin: 0px 16px 0 8px;
width: 98.5%;
height: calc(100vh - 180px);
.mainIframe {
width: 100%;
height: 100%;
}
}
</style>

View File

@@ -0,0 +1,81 @@
<!--
* @Date: 2021-01-12 09:37:27
* @LastEditors: gtz
* @LastEditTime: 2021-04-01 10:22:56
* @FilePath: \basic-admin\src\views\EquipmentManager\BOMManager\AddForm.vue
* @Description: 物料BOM添加弹窗页面
-->
<template>
<div>
<el-dialog v-bind="$attrs" :title="$t('module.formManage.formSort.addDialogTitle')" v-on="$listeners" @open="onOpen" @close="onClose">
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="150px">
<el-form-item :label="$t('module.formManage.formSort.name')" prop="name">
<el-input v-model="formData.name" :placeholder="$t('module.formManage.formSort.name')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-form>
<div slot="footer">
<el-button @click="close">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" :loading="waiting" @click="handelConfirm">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { add } from '@/api/report-manage/formSort'
export default {
components: {},
inheritAttrs: false,
props: [],
data() {
return {
waiting: false,
formData: {
name: undefined
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.formManage.formSort.name')]),
trigger: 'blur'
}]
}
}
},
computed: {},
watch: {},
created() {},
mounted() {},
methods: {
onOpen() {},
onClose() {
this.$refs['elForm'].resetFields()
},
close() {
this.$emit('update:visible', false)
},
handelConfirm() {
this.waiting = true
this.$refs['elForm'].validate(async valid => {
if (!valid) {
this.waiting = false
return
}
const result = await add(this.formData)
this.waiting = false
if (result.code === 0) {
this.$message({
type: 'success',
message: this.$t('baseTip.OperationSucc')
})
}
this.$emit('done')
this.close()
})
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,93 @@
<!--
* @Date: 2021-01-12 09:37:27
* @LastEditors: gtz
* @LastEditTime: 2021-04-01 10:22:47
* @FilePath: \basic-admin\src\views\EquipmentManager\BOMManager\EditForm.vue
* @Description: 物料BOM编辑弹窗页面
-->
<template>
<div>
<el-dialog v-bind="$attrs" :title="$t('module.formManage.formSort.editDialogTitle')" v-on="$listeners" @open="onOpen" @close="onClose">
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="150px">
<el-form-item :label="$t('module.formManage.formSort.name')" prop="name">
<el-input v-model="formData.name" :placeholder="$t('module.formManage.formSort.name')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-form>
<div slot="footer">
<el-button @click="close">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="handelConfirm">{{ 'btn.confirm' | i18nFilter }}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getData, update } from '@/api/report-manage/formSort'
export default {
components: {},
inheritAttrs: false,
props: {
targetInfo: {
type: Object,
default: () => ({})
}
},
data() {
return {
formData: {
name: undefined
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.formManage.formSort.name')]),
trigger: 'blur'
}]
}
}
},
computed: {},
watch: {},
created() {},
mounted() {},
methods: {
onOpen() {
this.getDetail()
},
onClose() {
this.$refs['elForm'].resetFields()
},
close() {
this.$emit('update:visible', false)
},
handelConfirm() {
this.$refs['elForm'].validate(async valid => {
if (!valid) return
const result = await update({
...this.formData,
id: this.targetInfo?.id
})
if (result.code === 0) {
this.$message({
type: 'success',
message: this.$t('baseTip.OperationSucc')
})
this.$emit('done')
this.close()
}
})
},
async getDetail() {
const result = await getData({
id: this.targetInfo?.id
})
if (result.code === 0) {
this.formData = result.data
// console.log(result)
}
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,119 @@
<!--
* @Date: 2020-12-15 15:36:52
* @LastEditors: gtz
* @LastEditTime: 2021-04-01 10:11:04
* @FilePath: \basic-admin\src\views\EquipmentManager\BOMManager\index.vue
* @Description:
-->
<template>
<div class="usermanager-container">
<div class="method-btn-area">
<el-input v-model="listQuery.name" :placeholder="$t('module.formManage.formSort.name')" style="width: 200px;" clearable />
<el-button @click="getList">{{ 'btn.search' | i18nFilter }}</el-button>
<el-button type="primary" @click="showDialog = true">{{ 'btn.add' | i18nFilter }}</el-button>
</div>
<base-table :table-config="tableProps" :table-data="list" :is-loading="listLoading" :page="listQuery.current" :limit="listQuery.size">
<method-btn slot="handleBtn" :method-list="tableBtn" @clickBtn="handleClick" />
</base-table>
<pagination :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="getList" />
<add-form :visible.sync="showDialog" @done="getList" />
<edit-form :visible.sync="showEditDialog" :target-info="{id: curEditId}" @done="getList" />
</div>
</template>
<script>
// edit here
const tableBtn = [{
type: 'edit',
btnName: 'btn.edit'
}, {
type: 'delete',
btnName: 'btn.delete'
}]
const tableProps = [{
prop: 'name',
label: i18n.t('module.formManage.formSort.name'),
align: 'center'
}]
import AddForm from './AddForm'
import EditForm from './EditForm'
import BaseTable from '@/components/BaseTable'
// edit here
import { page, del } from '@/api/report-manage/formSort'
import Pagination from '@/components/Pagination'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import i18n from '@/lang'
export default {
name: 'OrgManager',
components: { Pagination, BaseTable, MethodBtn, AddForm, EditForm },
props: {},
data() {
return {
tableBtn,
tableProps,
list: [],
total: 0,
listLoading: true,
showDialog: false,
curEditId: null,
showEditDialog: false,
listQuery: {
current: 1,
size: 10,
name: ''
}
}
},
created() {
this.getList()
// this.listLoading = false
},
mounted() {},
methods: {
handleClick(raw) {
console.log(raw)
switch (raw.type) {
case 'delete':
this.$confirm(i18n.t('deleteMsgBox.content'), i18n.t('deleteMsgBox.hint'), {
confirmButtonText: i18n.t('btn.confirm'),
cancelButtonText: i18n.t('btn.cancel'),
type: 'warning'
}).then(async() => {
// 走接口
const result = await del({
id: raw.data.id
})
if (result.code === 0) {
this.$message({
type: 'success',
message: i18n.t('deleteMsgBox.doneMsg')
})
this.getList()
}
})
break
case 'edit':
this.showEditDialog = true
this.curEditId = raw.data.id
break
}
},
async getList() {
this.listLoading = true
// edit here
const res = await page(this.listQuery)
if (res.code === 0) {
this.list = res.data.records
this.total = res.data.total
this.listLoading = false
}
}
}
}
</script>
<style lang="scss" scoped>
.usermanager-container{
padding: 10px;
}
</style>

View File

@@ -0,0 +1,144 @@
<!--
* @Author: gtz
* @Date: 2021-04-16 10:57:43
* @LastEditors: gtz
* @LastEditTime: 2021-04-23 14:13:48
* @Description: file content
-->
<template>
<div :class="$style.container" class="container">
<el-row class="sort-box" :gutter="20">
<el-col class="sort-item" :span="4" @click.native="handleClick('')">
<div class="sort-item-box">
<div class="sort-item-box-top">
<p>{{ $t('module.report.reportSort.all') }}</p>
</div>
<div class="sort-item-box-bottom">
{{ allNum }} {{ allNum > 1 ? 'Reports' : 'Report' }}
</div>
</div>
</el-col>
<el-col v-for="item in sortList" :key="item.id" class="sort-item" @click.native="handleClick(item.id)">
<div class="sort-item-box">
<div class="sort-item-box-top">
<p>{{ item.name }}</p>
</div>
<div class="sort-item-box-bottom">
{{ item.quantity }} {{ item.quantity > 1 ? 'Reports' : 'Report' }}
</div>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import { list } from '@/api/report-manage/formSort'
export default {
data() {
return {
sortList: [],
allNum: 0
}
},
created() {
this.init()
},
methods: {
init() {
list({}).then(res => {
this.allNum = 0
this.sortList = res.data
res.data.forEach(item => {
this.allNum += item.quantity
})
})
},
handleClick(id) {
this.$router.push({
name: 'ReportSortList',
query: {
sortId: id
}
})
}
}
}
</script>
<style lang="scss" module>
.container {}
</style>
<style lang="scss">
.container {
padding: 20px;
.sort-box {
.sort-item {
height: 400px;
width: 280px;
margin-bottom: 20px;
.sort-item-box{
width: 100%;
height: 400px;
background: #faefc2;
border-radius: 10px;
box-shadow: 0px 3px 3px rgba(0, 0, 0, .5);
cursor: pointer;
position: relative;
overflow: hidden;
.sort-item-box-top {
margin: 0 10%;
width: 80%;
height: 199px;
border-bottom: 1px solid #e3d47d;
color: #b3a995;
position: relative;
p {
width: 100%;
position: absolute;
bottom: 0px;
line-height: 50px;
font-size: 24px;
letter-spacing: 5px;
text-align: center;
}
}
.sort-item-box-bottom {
width: 100%;
height: 200px;
line-height: 200px;
font-size: 24px;
font-weight: bold;
text-align: center;
letter-spacing: 5px;
color: #6e7680;
}
}
.sort-item-box::before{
content: '';
position: absolute;
right: 0;
width: 4px;
height: 400px;
background: #f8e69b;
}
.sort-item-box::after{
content: '';
position: absolute;
right: 0;
top: 70px;
width: 18px;
height: 60px;
background: #f8e69b;
border-radius: 5px;
}
.sort-item-box:hover{
transition:border linear .2s,
box-shadow linear .2s;
border-color:rgba(141,39,142,.75);
box-shadow:0 0 5px rgba(111,1,32,3);
// border: 2px solid #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,58 @@
<!--
* @Author: gtz
* @Date: 2021-03-07 18:39:03
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 10:56:56
* @Description: file content
-->
<template>
<div v-loading="loading" :class="$style.container">
<HeaderTitleBar>
<span slot="title">{{ $route.query.name }}</span>
</HeaderTitleBar>
<iframe
id="reportView"
:class="$style.mainIframe"
name="mainIframe"
:src="url"
frameborder="0"
scrolling="auto"
/>
</div>
</template>
<script>
import HeaderTitleBar from '@/views/material-manage/components/header-title-bar'
export default {
components: { HeaderTitleBar },
props: {},
data() {
return {
loading: true,
url: process.env.VUE_APP_REPORT_VIEW_URL
}
},
mounted() {
const vm = this
console.log(this.$route.query)
this.url += '?_u=db:' + this.$route.query.name + '.ureport.xml'
const ifream = document.getElementById('reportView')
ifream.onload = function() {
console.log('加载完成')
vm.loading = false
}
},
methods: {}
}
</script>
<style lang="scss" module>
.container {
margin: 0px 16px 0 8px;
width: 98.5%;
height: calc(100vh - 180px);
.mainIframe {
width: 100%;
height: 100%;
}
}
</style>

View File

@@ -0,0 +1,237 @@
<template>
<div :class="$style.container">
<HeaderTitleBar>
<div slot="content">
<el-button type="success" @click="btnClickDesign">
模版设计
</el-button>
<el-button icon="ios-search" @click="btnClickPrint">
模版预览
</el-button>
<el-button icon="md-help" @click="btnClickInfo">
设计说明
</el-button>
</div>
</HeaderTitleBar>
<el-form
ref="printModel"
:model="printModel"
:rules="rules"
label-width="100px"
:class="$style.form"
>
<el-form-item
label="标签名称"
prop="printModelName"
:class="$style['form-item']"
>
<el-input v-model="printModel.printModelName" />
</el-form-item>
<el-form-item label="标签分类" prop="printModelType" :class="$style['form-item']">
<el-select
v-model="printModel.printModelType"
:class="$style.select"
filterable
clearable
placeholder="标签分类"
>
<el-option
v-for="item in printModelTypeList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label="标签内容"
prop="printModelContent"
:class="$style['form-item-remark']"
>
<el-input
v-model="printModelContent"
:readonly="true"
type="textarea"
:autosize="{ minRows: 4, maxRows: 8}"
/>
</el-form-item>
<SubmitBar @on-cancle="close()" @on-submit="handleSubmit('printModel')" />
</el-form>
</div>
</template>
<script>
import { find } from 'lodash'
import { list } from '@/api/material-manage/material'
import { add, getInfo, update } from '@/api/material-manage/batch.js'
import SubmitBar from '@/views/art/components/submit-bar'
import HeaderTitleBar from '@/views/material-manage/components/header-title-bar'
import { getLodop } from '@/assets/libs/LodopFuncs.js'
export default {
name: 'Refueling',
components: {
SubmitBar,
HeaderTitleBar
},
props: {},
data() {
return {
printModelContent: '',
printModel: {
printModelId: '',
printModelCode: '',
printModelName: '',
printModelContent: '',
printModelType: 1,
isDefault: 0,
isPreview: 1,
state: 'normal'
},
printModelTypeList: [{
id: 1,
name: '自定义'
}],
rules: {
printModelName: [
{ required: true, message: '标签名称不能为空', trigger: 'blur' },
{ min: 1, message: '长度在3个字符以上', trigger: 'blur' }
],
printModelType: [
{
required: true,
message: '请至少选择一个标签分类',
trigger: 'change'
}
],
printModelContent: [
{ required: true, message: '标签内容不能为空', trigger: 'blur' },
{ min: 1, message: '长度在3个字符以上', trigger: 'blur' }
]
},
id: null
}
},
watch: {},
created() {
this.init()
},
methods: {
init() {
this.id = this.$route.query.id
console.log(this.id)
console.log(!this.id)
list().then(res => {
console.log(res)
this.materialList = res.data
if (!this.id && this.materialList && this.materialList.length > 0) {
this.materialCode = this.materialList[0].externalCode
this.printModel.materialId = this.materialList[0].id
}
})
if (this.id) {
getInfo({ id: this.id }).then((res) => {
console.log(res)
this.printModel = res.data
this.materialCode = this.printModel.materialCode
})
}
},
handleSubmit(formName) {
console.log('handleSubmit')
this.$refs[formName].validate(valid => {
if (!valid) {
return false
}
if (this.id) {
update(this.printModel).then(res => {
this.close()
})
} else {
add(this.printModel).then(res => {
this.close()
})
}
})
},
close() {
this.$router.push({ path: this.$route.query.redirect })
},
materialChange(item) {
const material = find(this.materialList, m => m.id === item)
this.materialCode = material && material.externalCode
},
btnClickDesign() {
const LODOP = getLodop()
LODOP.PRINT_INIT('初始化打印')
LODOP.SET_PRINT_MODE('PROGRAM_CONTENT_BYVAR', true) // 生成程序时,内容参数有变量用变量,无变量用具体值
LODOP.SET_SHOW_MODE('DESIGN_IN_BROWSE', 1)
const modelCode = this.printModel.printModelContent
LODOP.ADD_PRINT_DATA('ProgramData', modelCode) // 装载模板
this.printModel.printModelContent = LODOP.PRINT_DESIGN()
if (LODOP.CVERSION) {
LODOP.On_Return = (TaskID, Value) => {
console.log('CVERSION')
console.log(Value)
this.printModel.printModelContent = Value
this.printModelContent = Value
this.getProgramData()
}
}
},
getProgramData() {
const LODOP = getLodop()
console.log('getProgramData')
const content = LODOP.GET_VALUE('ProgramData', 0) // 获得文档式模板
console.log(content)
if (LODOP.CVERSION) {
LODOP.On_Return = (TaskID, Value) => {
console.log(Value)
this.printModel.printModelContent = Value
}
}
},
btnClickPrint() {
const LODOP = getLodop()
const modelCode = this.printModel.printModelContent
LODOP.ADD_PRINT_DATA('ProgramData', modelCode) // 装载模板
// 按类名赋值
LODOP.SET_PRINT_STYLEA('name', 'CONTENT', '张三')
LODOP.SET_PRINT_STYLEA('code', 'CONTENT', '123455')
LODOP.PREVIEW()
},
btnClickInfo() {
}
}
}
</script>
<style lang="scss" module>
.container {
display: flex;
flex-direction: column;
align-items: center;
.form {
width: 60%;
margin-top: 30px;
display: flex;
flex-flow: wrap;
.form-item {
width: 50%;
}
.form-item-remark {
width: 100%;
}
}
.input {
display: flex;
margin: 8px 16px 8px 4px;
align-items: center;
.select {
width: 100%;
}
}
.select {
width: 100%;
}
}
</style>

View File

@@ -0,0 +1,87 @@
<!--
* @Author: gtz
* @Date: 2021-04-22 19:31:36
* @LastEditors: gtz
* @LastEditTime: 2021-04-22 20:40:57
* @Description: file content
-->
<template>
<el-dialog
:title="'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.report.reportList.reportName')" prop="fileName">
<el-input v-model="dataForm.fileName" :placeholder="$i18nForm(['placeholder.input', $t('module.report.reportList.reportName')])" 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 { getInfo, update } from '@/api/report-manage/report'
export default {
data() {
return {
visible: false,
dataForm: {
id: null,
fileName: '',
name: ''
},
dataRule: {
fileName: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.report.reportList.reportName')]),
trigger: 'blur'
}
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
getInfo({ id: this.dataForm.id }).then(res => {
this.dataForm.fileName = res.data.fileName
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'fileName': this.dataForm.fileName,
'id': this.dataForm.id
}
if (this.dataForm.id) {
update(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,124 @@
<template>
<div class="container">
<span class="label-name">{{ $t('module.teamManager.Handover.Keyword') }}</span>
<el-input
v-model="keywords"
:placeholder="placeholder"
:clearable="true"
:style="{
width: inputWidth + 'px',
maxWidth: '100%',
marginRight: '16px'
}"
/>
<el-date-picker
v-if="showTime"
v-model="dts"
style="margin-right:16px;"
type="daterange"
align="right"
unlink-panels
:range-separator="'formItem.to' | i18nFilter"
:start-placeholder="'formItem.beginTime' | i18nFilter"
:end-placeholder="'formItem.endTime' | i18nFilter"
:picker-options="pickerOptions"
/>
<el-button type="primary" icon="el-icon-search" @click="handleSearch()">
{{ "btn.search" | i18nFilter }}
</el-button>
<slot />
</div>
</template>
<script>
import moment from 'moment'
import i18n from '@/lang'
const pickerOptions = {
shortcuts: [
{
text: i18n.t('datePickerOption.lastWeek'),
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
},
{
text: i18n.t('datePickerOption.lastMonth'),
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
},
{
text: i18n.t('datePickerOption.lastThreeMonths'),
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}
]
}
export default {
props: {
showTime: {
type: Boolean,
default: false
},
lableName: {
type: String,
default: '关键字'
},
placeholder: {
type: String,
default: '请输入'
},
inputWidth: {
type: Number,
default: 180
}
},
data() {
return {
keywords: '',
dts: ['', ''],
pickerOptions
}
},
methods: {
handleSearch() {
const param = {
name: this.keywords,
key: this.keywords,
begDate: this.dts[0]
? moment(this.dts[0]).format('YYYY-MM-DD')
: this.dts[0],
endDate: this.dts[1]
? moment(this.dts[1]).format('YYYY-MM-DD')
: this.dts[1]
}
this.$emit('on-search', param)
}
}
}
</script>
<style lang="scss" scoped>
.container {
display: flex;
align-items: center;
width: 100%;
height: 50px;
padding: 4px 40px;
background-color: #eee;
.label-name {
margin-right: 8px;
font-size: 14px;
}
}
</style>