Browse Source

公共组件-编辑列

master
[li_she] 5 years ago
parent
commit
97636f18ec
  1. 139
      src/views/modules/common/column.vue
  2. 3
      src/views/modules/knifemold/receive.vue
  3. 676
      src/views/modules/report/reportCategory.vue
  4. 864
      src/views/modules/report/reportList.vue
  5. 113
      src/views/modules/sys/language/common.vue

139
src/views/modules/common/column.vue

@ -0,0 +1,139 @@
<template>
<el-dialog :close-on-click-modal="false" :show-close="false" :close-on-press-escape="false" title="设置table列"
:visible.sync="visible"
width="1000px" v-drag>
<el-form @keyup.enter.native="updateColumnList()"
v-model="userColumnList"
inline="inline"
size="mini"
label-width="80px">
<el-form-item v-for="(item,index) in userColumnList"
:key="index"
:label="item.columnLabel"
:prop="item.columnProp">
<el-form-item>
排序
<el-input-number v-model="item.sortLv" controls-position="right" size="mini" :min="0"
:max="10"></el-input-number>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.status"
active-text="显示"
inactive-text="隐藏">
</el-switch>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.columnSortable"
active-text="排序"
inactive-text="不排序">
</el-switch>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.fixed"
active-text="固定"
inactive-text="不固定">
</el-switch>
</el-form-item>
<el-form-item>
宽度
<el-input-number v-model="item.columnWidth" controls-position="right" size="mini" :min="0"
:max="1000"></el-input-number>
</el-form-item>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="updateColumnList()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import {
saveTableUser,
getTableDefaultListLanguage,
getTableUserListLanguage
} from "@/api/table.js"
export default {
data() {
return {
// table
userColumnList: [],
queryTable: {},
visible: false
}
},
methods: {
//
init(queryTable) {
console.log(queryTable)
this.queryTable = queryTable
getTableUserListLanguage( this.queryTable ).then(({data}) => {
if (data.code == 0) {
this.userColumnList = data.rows
if (data.rows.length <= 0) {
getTableDefaultListLanguage( this.queryTable ).then(({data}) => {
this.userColumnList = data.rows
})
}
}
}).then(() => {
this.visible = true
this.$nextTick(() => {
// this.$refs['userColumnList'].resetFields()
})
})
},
// table
updateColumnList() {
let userColumns = []
for (let column of this.userColumnList) {
let userColumn = {
userId: this.$store.state.user.name,
functionId: column.functionId,
tableId: column.tableId,
tableName: column.tableName,
columnProp: column.columnProp,
headerAlign: column.headerAlign,
align: column.align,
columnWidth: column.columnWidth,
columnLabel: column.columnLabel,
columnHidden: column.columnHidden,
columnImage: column.columnImage,
columnSortable: column.columnSortable,
format: column.format,
sortLv: column.sortLv,
status: column.status,
fixed: column.fixed,
serialNumber: column.serialNumber
}
userColumns.push(userColumn)
this.$emit("refreshData");
}
saveTableUser(userColumns).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.visible = false
this.$emit("refreshData");
} else {
this.$message.error(data.msg)
}
})
},
}
}
</script>
<style scoped>
</style>

3
src/views/modules/knifemold/receive.vue

@ -47,9 +47,6 @@
<el-button type="primary" @click="addLanguageFun()">{{ buttons.add }}
</el-button>
</el-form-item>
<el-form-item>
<el-button @click="favorites()" type="primary">收藏</el-button>
</el-form-item>
</el-form>
<el-table

676
src/views/modules/report/reportCategory.vue

@ -0,0 +1,676 @@
<template>
<div class="mod-config">
<div>
<span @click="favoriteFunction()">
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg" ></icon-svg>
</span>
</div>
<el-form :inline="true" :model="querySysLanguagePack" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input filterable v-model="querySysLanguagePack.functionId" clearable>
</el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()" type="primary">{{buttons.search}}</el-button>
<el-button @click="saveColumnList()" type="primary" v-show="showDefault">{{buttons.defaultTable}}
</el-button>
<el-button @click="userSetting" type="primary">{{ buttons.settingTable}}</el-button>
<download-excel
:fields="exportDataStandard"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:defaultValue="exportDefaultValue"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{buttons.download}}
</download-excel>
<el-button type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">{{ buttons.deleteList}}
</el-button>
</el-form-item>
<el-button type="primary" plain @click="printReport" @refreshData="getTableUserColumn">打印报表</el-button>
</el-form>
<el-table
id="commmon"
:height="height"
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
width="40"
align="center">
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed"
:width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 50, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
</div>
</template>
<script>
import {
searchSysLanguagePackList,
searchSysLanguageParam,
searchFunctionButtonList,
saveButtonList,
} from "@/api/sysLanguage.js"
import getLodop from '@/utils/LodopFuncs.js'
import {
saveTableDefaultList,
getTableDefaultListLanguage,
getTableUserListLanguage
} from "@/api/table.js"
import {userFavoriteList,saveUserFavorite,removeUserFavorite} from '@/api/userFavorite.js'
import column from "../common/column";
export default {
components: {
column:column
},
data() {
return {
// table
height:450,
//
favorite: false,
addLanguage: false,
functionId: 9001,
tableId: "common1001",
value1: true,
visible: false,
showDefault: false,
// table
queryTable: {
functionId: 9001,
tableId: "common1001",
languageCode: this.$i18n.locale
},
// table
queryTableUser: {
userId: this.$store.state.user.name,
functionId: 9001,
tableId: "common1001",
status: true,
languageCode: this.$i18n.locale
},
//
querySysLanguageParam: {
languageCode: this.$i18n.locale
},
//
sysLanguageParams: [],
// table
userColumnList: [],
//
columnList: [
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001functionId',
// tableId: "common1001",
// tableName: "common",
// columnProp: "functionId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001serialNumber',
// tableId: "common1001",
// tableName: "common",
// columnProp: "objectId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001type',
// tableId: "common1001",
// tableName: "common",
// columnProp: "objectType",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001value',
// tableId: "common1001",
// tableName: "common",
// columnProp: "languageValue",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// }
],
//
columnList1: [
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "functionId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "objectId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "objectType",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "languageValue",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "languageCode",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// }
],
//
dataList: [],
queryButton: {
functionId: 9001,
table_id: 'common1001',
languageCode: this.$i18n.locale,
objectType: 'button'
},
buttons: {
add: '添加',
edit: '编辑',
delete: '删除',
deleteList: '批量删除',
cz: '操作',
search: '查询',
download: '导出',
settingTable: '设置列表',
defaultTable: '设置默认配置'
},
// start
exportData: [],
exportDataStandard: {
"功能编码": "functionId",
"序列化编码": "objectId",
"类型": "objectType",
"语言值": "languageValue"
},
exportName: "页面功能语言",
exportHeader: ["页面功能语言"],
exportFooter: [],
exportDefaultValue: "这一行这一列没有数据",
// end
buttonList: [
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'add',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'edit',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'delete',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'deleteList',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'cz',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'search',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'download',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'settingTable',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'defaultTable',
// objectType: "button",
// tableId: "common1001"
// }
],
languageList: [],
languageColumnList: [],
languageDataList: [],
queryLanguage: {},
//
querySysLanguagePack: {
page: 1,
limit: 1,
languageValue: '',
objectType: '',
objectId: ''
},
//
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
mounted() {
this.$nextTick(()=>{
this.height = window.innerHeight - 255;
})
},
activated() {
this.getDataList()
},
methods: {
//
printReport(){
const LODOP = getLodop()
if (LODOP) {
var strBodyStyle = '<style>'
strBodyStyle += 'table { border-top: 1 solid #000000; border-left: 1 solid #000000; border-collapse:collapse; border-spacing:0;}'
strBodyStyle += 'caption { line-height:2em; }'
strBodyStyle += 'td { border-right: 1 solid #000000; border-bottom: 1 solid #000000; text-align:center; padding:2px 3px; font-size:11px;}'
strBodyStyle += '</style>' //
var strFormHtml = strBodyStyle + '<body>' + document.getElementById('commmon').innerHTML + '</body>' //
LODOP.PRINT_INIT('') //
LODOP.PRINT_DESIGN();
//LODOP.PREVIEW();
//LODOP.PRINT();
LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') //
LODOP.ADD_PRINT_HTM('1%', '1%', '98%', '98%', strFormHtml) //
LODOP.SET_PREVIEW_WINDOW(2, 0, 0, 800, 600, '') //
LODOP.PREVIEW()
}
},
//
favoriteIsOk(){
let userFavorite ={
userId:this.$store.state.user.id,
languageCode:this.$i18n.locale
}
userFavoriteList(userFavorite).then(({data}) =>{
let size = data.list.filter(item => item.userId==userFavorite.menuId).length;
if (size>0){
this.favorite = true
}else {
this.favorite = false
}
})
},
// OR
favoriteFunction(){
let userFavorite ={
userId: this.$store.state.user.id,
functionId: this.$route.meta.menuId,
}
if (this.favorite){
//
this.$confirm(`确定取消收藏`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeUserFavorite(userFavorite).then(({data})=>{
this.$message.success(data.msg)
this.favorite = false
})
})
}else {
//
saveUserFavorite(userFavorite).then(({data})=>{
this.$message.success(data.msg)
this.favorite = true
})
}
},
// button
getFunctionButtonList() {
searchFunctionButtonList(this.queryButton).then(({data}) => {
console.log(data.data)
if (data.data.length > 0) {
this.buttons = data.data
} else {
saveButtonList(this.buttonList).then(({data}) => {
})
}
})
},
//
getSysLanguageParamList() {
searchSysLanguageParam(this.querySysLanguageParam).then(({data}) => {
this.sysLanguageParams = data.rows
})
},
//
userSetting() {
this.visible = true;
let queryTable = {
userId: this.$store.state.user.name,
functionId: 9001,
tableId: "common1001",
languageCode: this.$i18n.locale
}
this.$nextTick(() => {
this.$refs.column.init(queryTable);
});
//this.getTableUserAll()
},
//
getTableUserColumn() {
getTableUserListLanguage(this.queryTableUser).then(({data}) => {
if (data.rows.length > 0) {
//this.columnList = []
this.columnList = data.rows
} else {
this.getColumnList()
}
})
},
//
saveColumnList() {
saveTableDefaultList(this.columnList).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.showDefault = false
} else {
this.$message.error(data.msg)
}
})
saveTableDefaultList(this.columnList1).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.showDefault = false
} else {
this.$message.error(data.msg)
}
})
this.getFunctionButtonList();
this.getColumnList()
},
// tableDefault
getColumnList() {
getTableDefaultListLanguage(this.queryTable).then(({data}) => {
if (!data.rows.length == 0) {
this.showDefault = false
this.columnList = data.rows
} else {
this.showDefault = true
}
})
},
//
getDataList() {
this.dataListLoading = true
this.querySysLanguagePack.limit = this.pageSize
this.querySysLanguagePack.page = this.pageIndex
searchSysLanguagePackList(this.querySysLanguagePack).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
//
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('//prd/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
createExportData() {
// ,,
// TODO:
if(this.dataListSelections.length>0){
return this.dataListSelections;
}
return this.dataList;
},
startDownload() {
// this.exportData = this.dataList
console.log("数据开始")
},
finishDownload() {
console.log("数据下载完成")
}
},
created() {
this.getTableUserColumn()
this.getSysLanguageParamList()
this.getFunctionButtonList()
this.favoriteIsOk()
}
}
</script>
<style scoped >
.wrapper {
height: calc(100% - 40px);
}
.sl-input {
background-color: transparent;
border: 0 !important;
font-size: 12px !important;
height: 12px !important;
line-height: 14px !important;
background-color: transparent !important;
width: 140px;
}
.sl-input:focus, textarea:focus {
outline: none;
}
.sl-svg{
overflow: hidden;
float: right;
}
</style>

864
src/views/modules/report/reportList.vue

@ -0,0 +1,864 @@
<template>
<div class="mod-config">
<div>
<span @click="favoriteFunction()">
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg" ></icon-svg>
</span>
</div>
<el-form :inline="true" :model="querySysLanguagePack" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input filterable v-model="querySysLanguagePack.functionId" clearable>
</el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()" type="primary">{{buttons.search}}</el-button>
<el-button @click="saveColumnList()" type="primary" v-show="showDefault">{{buttons.defaultTable}}
</el-button>
<el-button @click="userSetting" type="primary">{{ buttons.settingTable}}</el-button>
<download-excel
:fields="exportDataStandard"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:defaultValue="exportDefaultValue"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{buttons.download}}
</download-excel>
<el-button v-if="isAuth(':prd:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">{{ buttons.deleteList}}
</el-button>
</el-form-item>
<el-form-item>
<el-select filterable v-model="querySysLanguagePack.languageCode" clearable>
<el-option :label="item.languageName" :value="item.languageCode" v-for="(item,index) in languageList "
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addLanguageFun()">{{buttons.add}}
</el-button>
</el-form-item>
<el-button type="primary" plain @click="printReport">打印报表</el-button>
</el-form>
<el-table
id="commmon"
:height="height"
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
width="40"
align="center">
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed"
:width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 50, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-dialog :close-on-click-modal="false" :show-close="false" :close-on-press-escape="false" title="设置table列" :visible.sync="visible" width="1000px" v-drag>
<el-form @keyup.enter.native="updateColumnList()"
v-model="userColumnList"
inline="inline"
size="mini"
label-width="80px">
<el-form-item v-for="(item,index) in userColumnList"
:key="item.columnProp"
:label="item.columnLabel"
:prop="item.columnProp">
<el-form-item>
排序
<el-input-number v-model="item.sortLv" controls-position="right" size="mini" :min="0"
:max="10"></el-input-number>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.status"
active-text="显示"
inactive-text="隐藏">
</el-switch>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.columnSortable"
active-text="排序"
inactive-text="不排序">
</el-switch>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.fixed"
active-text="固定"
inactive-text="不固定">
</el-switch>
</el-form-item>
<el-form-item>
宽度
<el-input-number v-model="item.columnWidth" controls-position="right" size="mini" :min="0"
:max="1000"></el-input-number>
</el-form-item>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="updateColumnList()">确定</el-button>
</span>
</el-dialog>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="'设置语言一'+querySysLanguagePack.languageCode" :visible.sync="addLanguage" width="1000px">
<el-table
height="450"
:data="languageDataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
width="40"
align="center">
</el-table-column>
<el-table-column
v-for="(item,index) in languageColumnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="item.columnProp!='languageValue'"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnProp=='languageValue'"><input
class="sl-input"
v-model="scope.row[item.columnProp]" type="text"
clearable></input></span>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
:label="buttons.cz">
<template slot-scope="scope">
<a type="text" size="small" @click="saveLanguageList(scope.row)">添加</a>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import {
searchSysLanguagePackList,
searchSysLanguageParam,
searchFunctionButtonList,
saveButtonList,
searchSysLanguage,
searchLanguageListByLanguageCode,
saveSysLanguageOne
} from "@/api/sysLanguage.js"
import getLodop from '@/utils/LodopFuncs.js'
import {
saveTableDefaultList,
saveTableUser,
getTableDefaultListLanguage,
getTableUserListLanguage
} from "@/api/table.js"
import {userFavoriteList,saveUserFavorite,removeUserFavorite} from '@/api/userFavorite.js'
export default {
data() {
return {
// table
height:450,
//
favorite: false,
addLanguage: false,
functionId: 9001,
tableId: "common1001",
value1: true,
visible: false,
showDefault: false,
// table
queryTable: {
functionId: 9001,
tableId: "common1001",
languageCode: this.$i18n.locale
},
// table
queryTableUser: {
userId: this.$store.state.user.name,
functionId: 9001,
tableId: "common1001",
status: true,
languageCode: this.$i18n.locale
},
//
querySysLanguageParam: {
languageCode: this.$i18n.locale
},
//
sysLanguageParams: [],
// table
userColumnList: [],
//
columnList: [
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001functionId',
// tableId: "common1001",
// tableName: "common",
// columnProp: "functionId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001serialNumber',
// tableId: "common1001",
// tableName: "common",
// columnProp: "objectId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001type',
// tableId: "common1001",
// tableName: "common",
// columnProp: "objectType",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// serialNumber: 'common1001value',
// tableId: "common1001",
// tableName: "common",
// columnProp: "languageValue",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// }
],
//
columnList1: [
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "functionId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "objectId",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "objectType",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "languageValue",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// },
// {
// userId: this.$store.state.user.name,
// functionId: 9001,
// tableId: "common1002",
// tableName: "commonLanguage",
// columnProp: "languageCode",
// headerAlign: "center",
// align: "center",
// columnLabel: "",
// columnHidden: false,
// columnImage: false,
// columnSortable: true,
// sortLv: 0,
// status: true,
// fixed: false,
// }
],
//
dataList: [],
queryButton: {
functionId: 9001,
table_id: 'common1001',
languageCode: this.$i18n.locale,
objectType: 'button'
},
buttons: {
add: '添加',
edit: '编辑',
delete: '删除',
deleteList: '批量删除',
cz: '操作',
search: '查询',
download: '导出',
settingTable: '设置列表',
defaultTable: '设置默认配置'
},
// start
exportData: [],
exportDataStandard: {
"功能编码": "functionId",
"序列化编码": "objectId",
"类型": "objectType",
"语言值": "languageValue"
},
exportName: "页面功能语言",
exportHeader: ["页面功能语言"],
exportFooter: [],
exportDefaultValue: "这一行这一列没有数据",
// end
buttonList: [
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'add',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'edit',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'delete',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'deleteList',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'cz',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'search',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'download',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'settingTable',
// objectType: "button",
// tableId: "common1001"
// },
// {
// functionId: "9001",
// languageValue: '',
// objectId: 'defaultTable',
// objectType: "button",
// tableId: "common1001"
// }
],
languageList: [],
languageColumnList: [],
languageDataList: [],
queryLanguage: {},
//
querySysLanguagePack: {
page: 1,
limit: 1,
languageValue: '',
objectType: '',
objectId: ''
},
//
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
mounted() {
this.$nextTick(()=>{
this.height = window.innerHeight - 255;
})
},
activated() {
this.getDataList()
this.getLanguageList()
},
methods: {
//
printReport(){
const LODOP = getLodop()
if (LODOP) {
var strBodyStyle = '<style>'
strBodyStyle += 'table { border-top: 1 solid #000000; border-left: 1 solid #000000; border-collapse:collapse; border-spacing:0;}'
strBodyStyle += 'caption { line-height:2em; }'
strBodyStyle += 'td { border-right: 1 solid #000000; border-bottom: 1 solid #000000; text-align:center; padding:2px 3px; font-size:11px;}'
strBodyStyle += '</style>' //
var strFormHtml = strBodyStyle + '<body>' + document.getElementById('commmon').innerHTML + '</body>' //
LODOP.PRINT_INIT('') //
LODOP.PRINT_DESIGN();
//LODOP.PREVIEW();
//LODOP.PRINT();
LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') //
LODOP.ADD_PRINT_HTM('1%', '1%', '98%', '98%', strFormHtml) //
LODOP.SET_PREVIEW_WINDOW(2, 0, 0, 800, 600, '') //
LODOP.PREVIEW()
}
},
//
favoriteIsOk(){
let userFavorite ={
userId:this.$store.state.user.id,
languageCode:this.$i18n.locale
}
userFavoriteList(userFavorite).then(({data}) =>{
let size = data.list.filter(item => item.userId==userFavorite.menuId).length;
if (size>0){
this.favorite = true
}else {
this.favorite = false
}
})
},
// OR
favoriteFunction(){
let userFavorite ={
userId: this.$store.state.user.id,
functionId: this.$route.meta.menuId,
}
if (this.favorite){
//
this.$confirm(`确定取消收藏`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeUserFavorite(userFavorite).then(({data})=>{
this.$message.success(data.msg)
this.favorite = false
})
})
}else {
//
saveUserFavorite(userFavorite).then(({data})=>{
this.$message.success(data.msg)
this.favorite = true
})
}
},
//
saveLanguageList(val) {
saveSysLanguageOne(val).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
} else {
this.$message.error(data.msg)
}
})
},
//
addLanguageFun() {
if (this.querySysLanguagePack.languageCode) {
this.addLanguage = true
this.languageColumnList = []
let query = {
functionId: 9001,
tableId: "common1002",
languageCode: this.$i18n.locale
}
getTableDefaultListLanguage(query).then(({data}) => {
if (data.rows.length > 0) {
this.languageColumnList = data.rows
}
})
this.languageColumnList = this.columnList
searchLanguageListByLanguageCode(this.querySysLanguagePack).then(({data}) => {
this.languageDataList = data.rows
})
} else {
this.$message("请选中一种语言")
}
},
//
getLanguageList() {
searchSysLanguage(this.queryLanguage).then(({data}) => {
this.languageList = data.rows
})
},
// button
getFunctionButtonList() {
searchFunctionButtonList(this.queryButton).then(({data}) => {
console.log(data.data)
if (data.data.length > 0) {
this.buttons = data.data
} else {
saveButtonList(this.buttonList).then(({data}) => {
})
}
})
},
//
getSysLanguageParamList() {
searchSysLanguageParam(this.querySysLanguageParam).then(({data}) => {
this.sysLanguageParams = data.rows
})
},
//
userSetting() {
this.visible = true;
this.getTableUserAll()
},
//
getTableUserAll() {
let queryTable = {
userId: this.$store.state.user.name,
functionId: 9001,
tableId: "common1001",
languageCode: this.$i18n.locale
}
getTableUserListLanguage(queryTable).then(({data}) => {
if (data.code == 0) {
this.userColumnList = data.rows
if (data.rows.length <= 0) {
getTableDefaultListLanguage(this.queryTable).then(({data}) => {
this.userColumnList = data.rows
})
}
}
})
},
// table
updateColumnList() {
let userColumns = []
for (let column of this.userColumnList) {
let userColumn = {
userId: this.$store.state.user.name,
functionId: column.functionId,
tableId: column.tableId,
tableName: column.tableName,
columnProp: column.columnProp,
headerAlign: column.headerAlign,
align: column.align,
columnWidth: column.columnWidth,
columnLabel: column.columnLabel,
columnHidden: column.columnHidden,
columnImage: column.columnImage,
columnSortable: column.columnSortable,
format: column.format,
sortLv: column.sortLv,
status: column.status,
fixed: column.fixed,
serialNumber: column.serialNumber
}
userColumns.push(userColumn)
}
saveTableUser(userColumns).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.visible = false
this.getTableUserColumn()
} else {
this.$message.error(data.msg)
}
})
},
//
getTableUserColumn() {
getTableUserListLanguage(this.queryTableUser).then(({data}) => {
if (data.rows.length > 0) {
//this.columnList = []
this.columnList = data.rows
} else {
this.getColumnList()
}
})
},
//
saveColumnList() {
saveTableDefaultList(this.columnList).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.showDefault = false
} else {
this.$message.error(data.msg)
}
})
saveTableDefaultList(this.columnList1).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.showDefault = false
} else {
this.$message.error(data.msg)
}
})
this.getFunctionButtonList();
this.getColumnList()
},
// tableDefault
getColumnList() {
getTableDefaultListLanguage(this.queryTable).then(({data}) => {
if (!data.rows.length == 0) {
this.showDefault = false
this.columnList = data.rows
} else {
this.showDefault = true
}
})
},
//
getDataList() {
this.dataListLoading = true
this.querySysLanguagePack.limit = this.pageSize
this.querySysLanguagePack.page = this.pageIndex
searchSysLanguagePackList(this.querySysLanguagePack).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
//
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('//prd/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
createExportData() {
// ,,
// TODO:
if(this.dataListSelections.length>0){
return this.dataListSelections;
}
return this.dataList;
},
startDownload() {
// this.exportData = this.dataList
console.log("数据开始")
},
finishDownload() {
console.log("数据下载完成")
}
},
created() {
this.getTableUserColumn()
this.getSysLanguageParamList()
this.getFunctionButtonList()
this.favoriteIsOk()
}
}
</script>
<style scoped >
.wrapper {
height: calc(100% - 40px);
}
.sl-input {
background-color: transparent;
border: 0 !important;
font-size: 12px !important;
height: 12px !important;
line-height: 14px !important;
background-color: transparent !important;
width: 140px;
}
.sl-input:focus, textarea:focus {
outline: none;
}
.sl-svg{
overflow: hidden;
float: right;
}
</style>

113
src/views/modules/sys/language/common.vue

@ -92,56 +92,8 @@
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
<el-dialog :close-on-click-modal="false" :show-close="false" :close-on-press-escape="false" title="设置table列" :visible.sync="visible" width="1000px" v-drag>
<el-form @keyup.enter.native="updateColumnList()"
v-model="userColumnList"
inline="inline"
size="mini"
label-width="80px">
<el-form-item v-for="(item,index) in userColumnList"
:key="item.columnProp"
:label="item.columnLabel"
:prop="item.columnProp">
<el-form-item>
排序
<el-input-number v-model="item.sortLv" controls-position="right" size="mini" :min="0"
:max="10"></el-input-number>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.status"
active-text="显示"
inactive-text="隐藏">
</el-switch>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.columnSortable"
active-text="排序"
inactive-text="不排序">
</el-switch>
</el-form-item>
<el-form-item>
<el-switch
v-model="item.fixed"
active-text="固定"
inactive-text="不固定">
</el-switch>
</el-form-item>
<el-form-item>
宽度
<el-input-number v-model="item.columnWidth" controls-position="right" size="mini" :min="0"
:max="1000"></el-input-number>
</el-form-item>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="updateColumnList()">确定</el-button>
</span>
</el-dialog>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="'设置语言一'+querySysLanguagePack.languageCode" :visible.sync="addLanguage" width="1000px">
<el-table
@ -190,6 +142,7 @@
<script>
import column from "../../common/column";
import {
searchSysLanguagePackList,
searchSysLanguageParam,
@ -208,6 +161,9 @@
} from "@/api/table.js"
import {userFavoriteList,saveUserFavorite,removeUserFavorite} from '@/api/userFavorite.js'
export default {
components: {
column
},
data() {
return {
// table
@ -505,7 +461,6 @@
objectType: '',
objectId: ''
},
//
//
pageIndex: 1,
pageSize: 10,
@ -539,8 +494,8 @@
LODOP.PRINT_INIT('') //
LODOP.PRINT_DESIGN();
LODOP.PREVIEW();
LODOP.PRINT();
//LODOP.PREVIEW();
//LODOP.PRINT();
LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') //
LODOP.ADD_PRINT_HTM('1%', '1%', '98%', '98%', strFormHtml) //
@ -650,63 +605,15 @@
//
userSetting() {
this.visible = true;
this.getTableUserAll()
},
//
getTableUserAll() {
let queryTable = {
userId: this.$store.state.user.name,
functionId: 9001,
tableId: "common1001",
languageCode: this.$i18n.locale
}
getTableUserListLanguage(queryTable).then(({data}) => {
if (data.code == 0) {
this.userColumnList = data.rows
if (data.rows.length <= 0) {
getTableDefaultListLanguage(this.queryTable).then(({data}) => {
this.userColumnList = data.rows
})
}
}
})
},
// table
updateColumnList() {
let userColumns = []
for (let column of this.userColumnList) {
let userColumn = {
userId: this.$store.state.user.name,
functionId: column.functionId,
tableId: column.tableId,
tableName: column.tableName,
columnProp: column.columnProp,
headerAlign: column.headerAlign,
align: column.align,
columnWidth: column.columnWidth,
columnLabel: column.columnLabel,
columnHidden: column.columnHidden,
columnImage: column.columnImage,
columnSortable: column.columnSortable,
format: column.format,
sortLv: column.sortLv,
status: column.status,
fixed: column.fixed,
serialNumber: column.serialNumber
}
userColumns.push(userColumn)
}
saveTableUser(userColumns).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.visible = false
this.getTableUserColumn()
} else {
this.$message.error(data.msg)
}
})
this.$nextTick(() => {
this.$refs.column.init(queryTable);
});
},
//
getTableUserColumn() {

Loading…
Cancel
Save