Browse Source

基础数据列表 sxm 2021-12-22

master
[li_she] 4 years ago
parent
commit
8a5945a1b7
  1. 7
      src/api/chooselist/chooselist.js
  2. 177
      src/views/modules/common/list.vue
  3. 555
      src/views/modules/sys/language/common.vue

7
src/api/chooselist/chooselist.js

@ -0,0 +1,7 @@
import { createAPI } from "@/utils/httpRequest.js";
export const getChooselist = data => createAPI(`/chooselist/getChooselist/${data.tagNo}`,'get',data)
export const getChooselistData = data => createAPI(`/chooselist/getChooselistData`,'post',data)

177
src/views/modules/common/list.vue

@ -0,0 +1,177 @@
<template>
<el-dialog :title="title" center
:close-on-click-modal="false" :show-close="false" :close-on-press-escape="false"
:visible.sync="visible"
width="685px" v-drag>
<el-form label-position="top"
inline="inline"
size="mini"
label-width="120px">
<el-form-item :label="baseListData.caption1" v-if="baseListData.caption1!='' && baseListData.caption1!=null">
<el-input v-model="param1"></el-input>
</el-form-item>
<el-form-item :label="baseListData.caption2" v-if="baseListData.caption2!='' && baseListData.caption2!=null">
<el-input v-model="param2"></el-input>
</el-form-item>
<el-form-item :label="baseListData.caption4" v-if="baseListData.caption4!='' && baseListData.caption4!=null">
<el-input v-model="param4"></el-input>
</el-form-item>
<el-form-item :label="baseListData.caption3" v-if="baseListData.caption3!='' && baseListData.caption3!=null">
<el-select v-model="param3">
<el-option label="全部" value=""></el-option>
<el-option label="在用" value="Y"></el-option>
<el-option label="不在用" value="N"></el-option>
</el-select>
</el-form-item>
<el-button style="margin-top: 18px" type="primary" @click="getDataList()">查询
</el-button>
</el-form>
<el-table
:height="height"
:data="dataList"
border
@row-dblclick="getRowData"
v-loading="dataListLoading"
style="width: 100%;">
<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"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
{{ scope.row[item.columnProp] }}
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">关闭</el-button>
</span>
</el-dialog>
</template>
<script>
import {
getChooselist,
getChooselistData
} from "@/api/chooselist/chooselist.js"
export default {
data() {
return {
height: 200,
title: '列表',
columnList: [],
queryTable: {},
visible: false,
dataListLoading: true,
fullscreenLoading: false,
param1: '',
param2: '',
param3: '',
param4: '',
dataList: [],
baseListData: {
caption1: '',
caption2: '',
caption3: '',
caption4: '',
description: '',
fieldname1: '',
fieldname2: '',
sqlcode: '',
tagno: '',
}
}
},
methods: {
//
init(tagNo) {
this.visible = true;
// tagNo
getChooselist({"tagNo": tagNo}).then(({data}) => {
this.columnList = []
this.baseListData = data.data
let start = data.data.sqlcode.indexOf("Select")
let end = data.data.sqlcode.indexOf("from")
let length = end - start
let columns = data.data.sqlcode.trim().substring(start + 6, length).trim()
let props = columns.split(",")
props.forEach((item, index) => {
let name = '信息列'
switch (index) {
case 0:
name = this.baseListData.caption1
break;
case 1:
name = this.baseListData.caption2
break;
case 2:
name = this.baseListData.caption3
break;
case 3:
name = this.baseListData.caption4
break;
}
let column = {
"columnProp": item.trim(),
"columnLabel": name,
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"sortLv": index,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
}
this.columnList.push(column)
})
})
this.dataListLoading = false
},
getDataList() {
let sql = this.baseListData.sqlcode
if (this.param1) {
sql += " and " + this.baseListData.fieldname1 + " like '%" + this.param1 + "%'"
}
if (this.param2) {
sql += " and " + this.baseListData.fieldname2 + " like '%" + this.param2 + "%'"
}
if (this.param3) {
sql += " and active like '%" + this.param3 + "%'"
}
if (this.param4) {
sql += " and site=" + this.param4
}
getChooselistData({"sqlcode": sql}).then(({data}) => {
if (data.code == 0) {
this.dataList = data.baseListData;
} else {
this.$message.error(data.msg)
}
})
},
getRowData(row) {
this.$emit('getBaseData',row)
}
}
}
</script>
<style>
</style>

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

@ -2,7 +2,7 @@
<div class="mod-config">
<div>
<span @click="favoriteFunction()">
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg" ></icon-svg>
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
</span>
</div>
<el-form :inline="true" :model="querySysLanguagePack" @keyup.enter.native="getDataList()">
@ -11,10 +11,10 @@
</el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()" type="primary">{{buttons.search}}</el-button>
<el-button v-if="isAuth('sys:setting')" @click="saveColumnList()" type="primary" >{{buttons.defaultTable}}
<el-button @click="getDataList()" type="primary">{{ buttons.search }}</el-button>
<el-button v-if="isAuth('sys:setting')" @click="saveColumnList()" type="primary">{{ buttons.defaultTable }}
</el-button>
<el-button @click="userSetting" type="primary">{{ buttons.settingTable}}</el-button>
<el-button @click="userSetting" type="primary">{{ buttons.settingTable }}</el-button>
<download-excel
:fields="fields()"
:data="exportData"
@ -28,12 +28,10 @@
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{buttons.download}}
{{ buttons.download }}
</download-excel>
<el-button type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">{{ buttons.deleteList}}
</el-button>
<el-button type="primary" @click="getBaseList()">{{ buttons.list }}</el-button>
</el-form-item>
<el-form-item>
<el-select filterable v-model="querySysLanguagePack.languageCode" clearable>
@ -42,7 +40,7 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addLanguageFun()">{{buttons.add}}
<el-button type="primary" @click="addLanguageFun()">{{ buttons.add }}
</el-button>
</el-form-item>
</el-form>
@ -65,7 +63,7 @@
:width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<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>
@ -84,8 +82,10 @@
<!-- 动态列 -->
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
<!-- <list ref="baseList" @getBaseData="getBaseData"></list>-->
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="'设置语言一'+querySysLanguagePack.languageCode" :visible.sync="addLanguage" width="1000px">
<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"
@ -107,7 +107,7 @@
: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'"> {{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnProp=='languageValue'"><input
class="sl-input"
v-model="scope.row[item.columnProp]" type="text"
@ -127,13 +127,15 @@
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import column from "../../common/column";
import {
import list from '../../common/list'
import {
searchSysLanguagePackList,
searchSysLanguageParam,
searchFunctionButtonList,
@ -141,24 +143,30 @@ import column from "../../common/column";
searchSysLanguage,
searchLanguageListByLanguageCode,
saveSysLanguageOne,
searchPageLanguageData
} from "@/api/sysLanguage.js"
import getLodop from '@/utils/LodopFuncs.js'
import {
searchPageLanguageData,
removerLanguage
} 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 {
getTableUserListLanguage,
removerDefault,
removerUser
} from "@/api/table.js"
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
export default {
components: {
column
column,
list
},
data() {
return {
listShow:false,
// table
height:450,
height: 450,
//
favorite: false,
addLanguage: false,
@ -191,11 +199,171 @@ import column from "../../common/column";
userColumnList: [],
//
columnList: [
{
"tableId": "common1001",
"tableName": "common",
"columnProp": "functionId",
"columnLabel": "功能编码",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 0,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
},
{
"tableId": "common1001",
"tableName": "common",
"columnProp": "objectId",
"columnLabel": "序列化编码",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 0,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
},
{
"tableId": "common1001",
"tableName": "common",
"columnProp": "objectType",
"columnLabel": "类型",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 0,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
},
{
"tableId": "common1001",
"tableName": "common",
"columnProp": "languageValue",
"columnLabel": "语言值",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 0,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
}
],
//
columnList1: [
{
"tableId": "common1002",
"tableName": "commonLanguage",
"columnProp": "functionId",
"columnLabel": "功能编码",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 0,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
},
{
"tableId": "common1002",
"tableName": "commonLanguage",
"columnProp": "languageCode",
"columnLabel": "语言编码",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 0,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
},
{
"tableId": "common1002",
"tableName": "commonLanguage",
"columnProp": "objectId",
"columnLabel": "序列化编码",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 1,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
},
{
"tableId": "common1002",
"tableName": "commonLanguage",
"columnProp": "objectType",
"columnLabel": "类型",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 1,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
},
{
"tableId": "common1002",
"tableName": "commonLanguage",
"columnProp": "languageValue",
"columnLabel": "语言值",
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"functionId": "9001",
"sortLv": 2,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
}
],
//
dataList: [],
@ -214,169 +382,89 @@ import column from "../../common/column";
search: '查询',
download: '导出',
settingTable: '设置列表',
defaultTable: '设置默认配置'
},
pageLanguageData:{
defaultTable: '设置默认配置',
list: "列表"
},
pageLanguageDataList: [
// start
exportData: [],
exportName: "页面功能语言",
exportHeader: ["页面功能语言"],
exportFooter: [],
exportDefaultValue: "这一行这一列没有数据",
// end
buttonList: [
{
functionId: "1001",
languageValue: '操作',
objectId: 'operate',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '添加',
objectId: 'add',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '销售单号',
objectId: 'shopOrderNo',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '编辑',
objectId: 'edit',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '箱号',
objectId: 'boxNo',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '删除',
objectId: 'delete',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '物料编号',
objectId: 'partNo',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '批量删除',
objectId: 'deleteList',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '创建时间',
objectId: 'createdDate',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '操作',
objectId: 'cz',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '搜索',
functionId: "9001",
languageValue: '查询',
objectId: 'search',
objectType: "page",
tableId: "boxingPrint"
},
{
functionId: "1001",
languageValue: '设置列表',
objectId: 'setting',
objectType: "page",
tableId: "boxingPrint"
},
{
functionId: "1001",
languageValue: '取消',
objectId: 'recall',
objectType: "page",
tableId: "boxingPrint"
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '打印',
objectId: 'print',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '导出',
objectId: 'download',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '请选择模板',
objectId: 'printTemplateMsg',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '设置列表',
objectId: 'settingTable',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '打印模板选择',
objectId: 'printDialog',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '设置默认配置',
objectId: 'defaultTable',
objectType: "button",
tableId: "common1001"
},
{
functionId: "1001",
languageValue: '标签打印',
objectId: 'labelPrint',
objectType: "page",
tableId: "boxingPrint"
functionId: "9001",
languageValue: '列表',
objectId: 'list',
objectType: "button",
tableId: "common1001"
}
],
// start
exportData: [],
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: [],
@ -400,8 +488,9 @@ import column from "../../common/column";
}
},
mounted() {
this.$nextTick(()=>{
this.height = window.innerHeight - 255;
this.$nextTick(() => {
this.height = window.innerHeight - 175;
})
},
activated() {
@ -409,45 +498,54 @@ import column from "../../common/column";
this.getLanguageList()
},
methods: {
getBaseData(val){
console.log("父组件"+val)
},
//
getBaseList(){
this.$nextTick(() => {
this.$refs.baseList.init(3)
})
},
//
printReport(){
printReport() {
},
//
favoriteIsOk(){
let userFavorite ={
userId:this.$store.state.user.id,
languageCode:this.$i18n.locale
favoriteIsOk() {
let userFavorite = {
userId: this.$store.state.user.id,
languageCode: this.$i18n.locale
}
userFavoriteList(userFavorite).then(({data}) =>{
let size = data.list.filter(item => item.menuId==this.$route.meta.menuId).length;
if (size>0){
userFavoriteList(userFavorite).then(({data}) => {
let size = data.list.filter(item => item.menuId == this.$route.meta.menuId).length;
if (size > 0) {
this.favorite = true
}else {
} else {
this.favorite = false
}
})
},
// OR
favoriteFunction(){
let userFavorite ={
favoriteFunction() {
let userFavorite = {
userId: this.$store.state.user.id,
functionId: this.$route.meta.menuId,
}
if (this.favorite){
if (this.favorite) {
//
this.$confirm(`确定取消收藏`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeUserFavorite(userFavorite).then(({data})=>{
removeUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = false
})
})
}else {
} else {
//
saveUserFavorite(userFavorite).then(({data})=>{
saveUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = true
})
@ -494,23 +592,25 @@ import column from "../../common/column";
})
},
//
getMsgLanguage(){
getMsgLanguage() {
this.dataListLoading = true
let queryLang = {
functionId: 9001,
table_id: 'common1001',
languageCode: this.$i18n.locale
}
searchPageLanguageData(queryLang).then((data)=>{
if (JSON.stringify(data.data) != '{}' ) {
searchPageLanguageData(queryLang).then((data) => {
if (JSON.stringify(data.data) != '{}') {
this.pageLanguageData = data.data
} else {
}
})
this.dataListLoading = false
},
// button
getFunctionButtonList() {
searchFunctionButtonList(this.queryButton).then(({data}) => {
if (JSON.stringify(data.data) != '{}' ) {
if (JSON.stringify(data.data) != '{}') {
this.buttons = data.data
} else {
// saveButtonList(this.buttonList).then(({data}) => {
@ -551,22 +651,23 @@ import column from "../../common/column";
},
//
saveColumnList() {
// button label title
//
if (this.userColumnList) {
// user
removerUser(this.queryTable)
}
//
removerDefault(this.queryTable)
//
removerLanguage(this.queryTable)
// table
let sumColumnList = this.columnList.concat(this.columnList1);
saveTableDefaultList(sumColumnList).then(({data}) => {
if (data.code == 0) {
this.$message.success(data.msg)
this.showDefault = false
} else {
this.$message.error(data.msg)
}
})
let pageData =
// button label title
saveButtonList(this.buttonList).then(({data}) => {
})
this.getFunctionButtonList()
this.getFunctionButtonList();
this.getColumnList()
},
// tableDefault
@ -611,47 +712,17 @@ import column from "../../common/column";
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)
}
})
})
},
//
fields(){
fields() {
let json = "{"
this.columnList.forEach((item,index) =>{
if (index == this.columnList.length-1 ){
json +="\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\""
}else {
json += "\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\""+ ","
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
}
})
json +="}"
json += "}"
let s = eval("(" + json + ")")
return s
},
@ -659,7 +730,7 @@ import column from "../../common/column";
// ,,
// TODO:
if(this.dataListSelections.length>0){
if (this.dataListSelections.length > 0) {
return this.dataListSelections;
}
return this.dataList;
@ -679,13 +750,14 @@ import column from "../../common/column";
this.favoriteIsOk()
this.getMsgLanguage()
}
}
}
</script>
<style scoped >
<style scoped>
.wrapper {
height: calc(100% - 40px);
}
.sl-input {
.sl-input {
background-color: transparent;
border: 0 !important;
font-size: 12px !important;
@ -693,16 +765,17 @@ import column from "../../common/column";
line-height: 14px !important;
background-color: transparent !important;
width: 140px;
}
}
.sl-input:focus, textarea:focus {
.sl-input:focus, textarea:focus {
outline: none;
}
.sl-svg{
}
.sl-svg {
overflow: hidden;
float: right;
}
}
</style>
Loading…
Cancel
Save