7 changed files with 1009 additions and 100 deletions
-
1package.json
-
4src/api/factory.js
-
2src/main.js
-
265src/views/modules/factory/tblbasedata-add-or-update.vue
-
650src/views/modules/factory/tblbasedata.vue
-
14src/views/modules/sys/language/common.vue
-
117src/views/modules/sys/user-add-or-update.vue
@ -0,0 +1,4 @@ |
|||||
|
import { createAPI } from "@/utils/httpRequest.js"; |
||||
|
|
||||
|
// 获取工厂列表
|
||||
|
export const getFactory = data => createAPI(`/factory/tblbasedata/list`,'get',data) |
||||
@ -0,0 +1,265 @@ |
|||||
|
<template> |
||||
|
<el-dialog |
||||
|
v-drag |
||||
|
width="40%" |
||||
|
:title="!dataForm.id ? '新增' : '修改'" |
||||
|
:close-on-click-modal="false" |
||||
|
:visible.sync="visible"> |
||||
|
<el-form :inline="true" label-position="top" ref="dataForm" @keyup.enter.native="dataFormSubmit()" |
||||
|
label-width="80px"> |
||||
|
<el-form-item :label="columnList[0].columnLabel" prop="site"> |
||||
|
<el-input v-model="dataForm.site" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="columnList[1].columnLabel" prop="type"> |
||||
|
<el-input v-model="dataForm.type" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="columnList[2].columnLabel" prop="secondType"> |
||||
|
<el-input v-model="dataForm.secondType" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-form :inline="true" label-position="top" ref="dataForm" |
||||
|
label-width="80px"> |
||||
|
<el-form-item :label="columnList[3].columnLabel" prop="baseData"> |
||||
|
<el-input v-model="dataForm.baseData" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="columnList[4].columnLabel" prop="baseDesc"> |
||||
|
<el-input v-model="dataForm.baseDesc" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="columnList[5].columnLabel" prop="status"> |
||||
|
<el-input v-model="dataForm.status" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-form :inline="true" label-position="top" ref="dataForm" |
||||
|
label-width="80px"> |
||||
|
<el-form-item :label="columnList[6].columnLabel" prop="sortNo"> |
||||
|
<el-input v-model="dataForm.sortNo" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="columnList[7].columnLabel" prop="remark"> |
||||
|
<el-input v-model="dataForm.remark" style="width: 160px"></el-input> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<span slot="footer" class="dialog-footer"> |
||||
|
<el-button @click="visible = false">取消</el-button> |
||||
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> |
||||
|
</span> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
visible: false, |
||||
|
columnList: [ |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataSite', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "site", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "site", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataType', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "type", |
||||
|
headerAlign: "type", |
||||
|
align: "center", |
||||
|
columnLabel: "type", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataSecondType', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "secondType", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "secondType", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataBaseData', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "baseData", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "工厂编号", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataBaseDesc', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "baseDesc", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "工厂描述", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataStatus', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "status", |
||||
|
headerAlign: "status", |
||||
|
align: "center", |
||||
|
columnLabel: "status", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataSortNo', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "sortNo", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "sortNo", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataRemark', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "remark", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "工厂备注", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
], |
||||
|
dataForm: { |
||||
|
id: 0, |
||||
|
site: '', |
||||
|
type: '', |
||||
|
secondType: '', |
||||
|
baseData: '', |
||||
|
baseDesc: '', |
||||
|
status: '', |
||||
|
sortNo: '', |
||||
|
remark: '', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
init(id, baseColumns) { |
||||
|
this.dataForm.id = id || 0 |
||||
|
this.visible = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs['dataForm'].resetFields() |
||||
|
if (this.dataForm.id) { |
||||
|
this.$http({ |
||||
|
url: this.$http.adornUrl(`/factory/tblbasedata/info/` + this.dataForm.id), |
||||
|
method: 'get', |
||||
|
params: this.$http.adornParams() |
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.dataForm.site = data.data.site |
||||
|
this.dataForm.type = data.data.type |
||||
|
this.dataForm.secondType = data.data.secondType |
||||
|
this.dataForm.baseData = data.data.baseData |
||||
|
this.dataForm.baseDesc = data.data.baseDesc |
||||
|
this.dataForm.status = data.data.status |
||||
|
this.dataForm.sortNo = data.data.sortNo |
||||
|
this.dataForm.remark = data.data.remark |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 表单提交 |
||||
|
dataFormSubmit() { |
||||
|
|
||||
|
this.$http({ |
||||
|
url: this.$http.adornUrl(`/factory/tblbasedata/${!this.dataForm.id ? 'save' : 'update'}`), |
||||
|
method: 'post', |
||||
|
data: this.$http.adornData({ |
||||
|
'id': this.dataForm.id || undefined, |
||||
|
'site': this.dataForm.site, |
||||
|
'type': this.dataForm.type, |
||||
|
'secondType': this.dataForm.secondType, |
||||
|
'baseData': this.dataForm.baseData, |
||||
|
'baseDesc': this.dataForm.baseDesc, |
||||
|
'status': this.dataForm.status, |
||||
|
'sortNo': this.dataForm.sortNo, |
||||
|
'remark': this.dataForm.remark |
||||
|
}) |
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.$message({ |
||||
|
message: '操作成功', |
||||
|
type: 'success', |
||||
|
duration: 1500, |
||||
|
onClose: () => { |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataList') |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$message.error(data.msg) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
@ -0,0 +1,650 @@ |
|||||
|
<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="queryData" @keyup.enter.native="getDataList()"> |
||||
|
<el-form-item> |
||||
|
<el-input filterable v-model="queryData.key" 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> |
||||
|
<el-button @click="addOrUpdateHandle(0)" type="primary">{{ buttons.add}}</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-table |
||||
|
:height="height" |
||||
|
:data="dataList" |
||||
|
border |
||||
|
v-loading="dataListLoading" |
||||
|
@selection-change="selectionChangeHandle" |
||||
|
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" |
||||
|
: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-column |
||||
|
fixed="right" |
||||
|
header-align="center" |
||||
|
align="center" |
||||
|
width="150" |
||||
|
label="操作"> |
||||
|
<template slot-scope="scope"> |
||||
|
<a type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</a> |
||||
|
<a type="text" size="small" @click="deleteHandle(scope.row.id)">删除</a> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<el-pagination |
||||
|
@size-change="sizeChangeHandle" |
||||
|
@current-change="currentChangeHandle" |
||||
|
:current-page="pageIndex" |
||||
|
:page-sizes="[10, 20, 50, 100]" |
||||
|
:page-size="pageSize" |
||||
|
:total="totalPage" |
||||
|
layout="total, sizes, prev, pager, next, jumper"> |
||||
|
</el-pagination> |
||||
|
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column> |
||||
|
<!-- 弹窗, 新增 / 修改 --> |
||||
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import column from "../common/column"; |
||||
|
import { |
||||
|
searchSysLanguageParam, |
||||
|
searchFunctionButtonList, |
||||
|
saveButtonList, |
||||
|
} from "@/api/sysLanguage.js" |
||||
|
import { |
||||
|
saveTableDefaultList, |
||||
|
getTableDefaultListLanguage, |
||||
|
getTableUserListLanguage |
||||
|
} from "@/api/table.js" |
||||
|
import {userFavoriteList,saveUserFavorite,removeUserFavorite} from '@/api/userFavorite.js' |
||||
|
import AddOrUpdate from './tblbasedata-add-or-update' |
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
queryData:{ |
||||
|
key: '' |
||||
|
}, |
||||
|
// table高度 |
||||
|
height:450, |
||||
|
// 是否收藏 |
||||
|
favorite: false, |
||||
|
addLanguage: false, |
||||
|
functionId: 9002, |
||||
|
tableId: "9002Blbasedata", |
||||
|
languageCode: this.$i18n.locale, |
||||
|
visible: false, |
||||
|
showDefault: false, |
||||
|
// 语言词典集合 |
||||
|
sysLanguageParams: [], |
||||
|
// 用户table 配置集合 |
||||
|
userColumnList: [], |
||||
|
columnList: [ |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataId', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "id", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "工厂id", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataSite', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "site", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "site", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataType', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "sortNo", |
||||
|
headerAlign: "type", |
||||
|
align: "center", |
||||
|
columnLabel: "type", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataSecondType', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "secondType", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "secondType", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataBaseData', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "baseData", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "工厂编号", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataBaseDesc', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "baseDesc", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "工厂描述", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataStatus', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "status", |
||||
|
headerAlign: "status", |
||||
|
align: "center", |
||||
|
columnLabel: "status", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataSortNo', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "sortNo", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "sortNo", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
{ |
||||
|
userId: this.$store.state.user.name, |
||||
|
functionId: 9002, |
||||
|
serialNumber: '9002tBlbasedataRemark', |
||||
|
tableId: "9002Blbasedata", |
||||
|
tableName: "工厂信息", |
||||
|
columnProp: "remark", |
||||
|
headerAlign: "center", |
||||
|
align: "center", |
||||
|
columnLabel: "工厂备注", |
||||
|
columnHidden: false, |
||||
|
columnImage: false, |
||||
|
columnSortable: false, |
||||
|
sortLv: 0, |
||||
|
status: true, |
||||
|
fixed: false |
||||
|
}, |
||||
|
], |
||||
|
// 数据集 |
||||
|
dataList: [], |
||||
|
buttons: { |
||||
|
add: '添加', |
||||
|
edit: '编辑', |
||||
|
delete: '删除', |
||||
|
deleteList: '批量删除', |
||||
|
cz: '操作', |
||||
|
search: '查询', |
||||
|
download: '导出', |
||||
|
settingTable: '设置列表', |
||||
|
defaultTable: '设置默认配置' |
||||
|
}, |
||||
|
// 导出 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" |
||||
|
// } |
||||
|
], |
||||
|
// 分页 |
||||
|
pageIndex: 1, |
||||
|
pageSize: 20, |
||||
|
totalPage: 0, |
||||
|
dataListLoading: false, |
||||
|
dataListSelections: [], |
||||
|
addOrUpdateVisible: false |
||||
|
} |
||||
|
}, |
||||
|
components: { |
||||
|
AddOrUpdate, |
||||
|
column |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.$nextTick(()=>{ |
||||
|
this.height = window.innerHeight - 240; |
||||
|
}) |
||||
|
}, |
||||
|
activated () { |
||||
|
this.getDataList() |
||||
|
}, |
||||
|
methods: { |
||||
|
// 添加 |
||||
|
addOrUpdateBase(){ |
||||
|
|
||||
|
}, |
||||
|
// 打印方式 |
||||
|
printReport(){ |
||||
|
alert( this.$store.state.user.site) |
||||
|
// |
||||
|
// 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.menuId == this.$route.meta.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() { |
||||
|
let queryButton = { |
||||
|
functionId: this.functionId, |
||||
|
tableId: this.tableId, |
||||
|
languageCode: this.languageCode, |
||||
|
objectType: 'button' |
||||
|
} |
||||
|
searchFunctionButtonList(queryButton).then(({data}) => { |
||||
|
if (data.data.length>0) { |
||||
|
this.buttons = data.data |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 获取语言词典 |
||||
|
getSysLanguageParamList() { |
||||
|
let querySysLanguageParam = { |
||||
|
languageCode: this.$i18n.locale |
||||
|
} |
||||
|
searchSysLanguageParam(querySysLanguageParam).then(({data}) => { |
||||
|
this.sysLanguageParams = data.rows |
||||
|
}) |
||||
|
}, |
||||
|
// 打开页面设置 |
||||
|
userSetting() { |
||||
|
this.visible = true; |
||||
|
let queryTable = { |
||||
|
userId: this.userId, |
||||
|
functionId: this.functionId, |
||||
|
tableId: this.tableId, |
||||
|
languageCode: this.languageCode |
||||
|
} |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.column.init(queryTable); |
||||
|
}); |
||||
|
}, |
||||
|
// 获取 用户保存的 格式列 |
||||
|
getTableUserColumn() { |
||||
|
let queryTableUser = { |
||||
|
userId: this.userId, |
||||
|
functionId: this.functionId, |
||||
|
tableId: this.tableId, |
||||
|
languageCode: this.languageCode, |
||||
|
status: true, |
||||
|
} |
||||
|
getTableUserListLanguage(queryTableUser).then(({data}) => { |
||||
|
if (data.rows.length > 0) { |
||||
|
//this.columnList = [] |
||||
|
this.columnList = data.rows |
||||
|
} else { |
||||
|
this.getColumnList() |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
// 保存 默认配置 列 |
||||
|
saveColumnList() { |
||||
|
|
||||
|
saveButtonList(this.buttonList).then(({data}) => { |
||||
|
}) |
||||
|
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() { |
||||
|
let queryTable = { |
||||
|
functionId: this.functionId, |
||||
|
tableId: this.tableId, |
||||
|
languageCode: this.languageCode |
||||
|
} |
||||
|
getTableDefaultListLanguage(queryTable).then(({data}) => { |
||||
|
if (!data.rows.length == 0) { |
||||
|
this.showDefault = false |
||||
|
this.columnList = data.rows |
||||
|
} else { |
||||
|
this.showDefault = true |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 获取数据列表 |
||||
|
getDataList () { |
||||
|
this.dataListLoading = true |
||||
|
this.$http({ |
||||
|
url: this.$http.adornUrl('/factory/tblbasedata/list'), |
||||
|
method: 'get', |
||||
|
params: this.$http.adornParams({ |
||||
|
'page': this.pageIndex, |
||||
|
'limit': this.pageSize, |
||||
|
'key': this.queryData.key |
||||
|
}) |
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.dataList = data.list |
||||
|
this.totalPage = data.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 |
||||
|
}, |
||||
|
// 新增 / 修改 |
||||
|
addOrUpdateHandle (id) { |
||||
|
this.addOrUpdateVisible = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.addOrUpdate.init(id) |
||||
|
}) |
||||
|
}, |
||||
|
// 删除 |
||||
|
deleteHandle (id) { |
||||
|
var ids = id ? [id] : this.dataListSelections.map(item => { |
||||
|
return item.id |
||||
|
}) |
||||
|
this.$confirm(`确定删除选择中的数据`, '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(() => { |
||||
|
this.$http({ |
||||
|
url: this.$http.adornUrl('/factory/tblbasedata/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(){ |
||||
|
let json = "{" |
||||
|
this.columnList.forEach((item,index) =>{ |
||||
|
if (index == this.columnList.length-1 ){ |
||||
|
json +="\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\"" |
||||
|
}else { |
||||
|
json += "\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\""+ "," |
||||
|
} |
||||
|
}) |
||||
|
json +="}" |
||||
|
let s = eval("(" + json + ")") |
||||
|
return s |
||||
|
}, |
||||
|
createExportData() { |
||||
|
// 点击导出按钮之后,开始导出数据之前的执行函数,返回值为需要下载的数据 |
||||
|
// TODO:构造需要下载的数据返回 |
||||
|
if(this.dataListSelections.length>0){ |
||||
|
return this.dataListSelections; |
||||
|
} |
||||
|
return this.dataList; |
||||
|
}, |
||||
|
startDownload() { |
||||
|
// this.exportData = this.dataList |
||||
|
|
||||
|
}, |
||||
|
finishDownload() { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.getTableUserColumn() |
||||
|
this.getSysLanguageParamList() |
||||
|
this.getFunctionButtonList() |
||||
|
this.favoriteIsOk() |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style scoped> |
||||
|
.sl-svg{ |
||||
|
overflow: hidden; |
||||
|
float: right; |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue