3 changed files with 415 additions and 6 deletions
-
23src/views/common/home.vue
-
65src/views/modules/common/excelUpload.vue
-
333src/views/modules/finishedProductWarehouse/otherOut.vue
@ -0,0 +1,65 @@ |
|||
<template> |
|||
<div> |
|||
<!-- 弹窗, 上传文件 --> |
|||
<el-upload |
|||
:action="url" |
|||
:before-upload="beforeUploadHandle" |
|||
:on-success="successHandle" |
|||
multiple |
|||
:show-file-list="false" |
|||
style="text-align: center;"> |
|||
<el-button size="small" type="primary">点击上传</el-button> |
|||
</el-upload> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data () { |
|||
return { |
|||
url: '', |
|||
num: 0, |
|||
successNum: 0, |
|||
fileList: [] |
|||
} |
|||
}, |
|||
methods: { |
|||
init (id) { |
|||
this.url = this.$http.adornUrl(`/excel/file/upload?token=${this.$cookie.get('token')}&folder=`+this.folder) |
|||
console.log(this.url) |
|||
this.visible = true |
|||
}, |
|||
// 上传之前 |
|||
beforeUploadHandle (file) { |
|||
// if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') { |
|||
// this.$message.error('只支持jpg、png、gif格式的图片!') |
|||
// return false |
|||
// } |
|||
this.num++ |
|||
}, |
|||
// 上传成功 |
|||
successHandle (response, file, fileList) { |
|||
this.fileList = fileList.map(item => { |
|||
return item.response.ossEntity |
|||
}) |
|||
this.successNum++ |
|||
if (response && response.code === 0) { |
|||
this.childClick() |
|||
} else { |
|||
this.$message.error(response.msg) |
|||
} |
|||
}, |
|||
childClick () { |
|||
// childByValue是在父组件on监听的方法 |
|||
this.$emit('childByValue', this.fileList) |
|||
} |
|||
}, |
|||
created() { |
|||
this.init() |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
@ -0,0 +1,333 @@ |
|||
<template> |
|||
<div class="mod-config"> |
|||
<div> |
|||
<span @click="favoriteFunction()"> |
|||
<icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg" ></icon-svg> |
|||
</span> |
|||
</div> |
|||
<el-button @click="searchList()" 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-form v-show="searchShow" :inline="true" :model="queryData" @keyup.enter.native="getDataList()"> |
|||
<excelUpload></excelUpload> |
|||
<el-form-item label="呆滞天数"> |
|||
<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="queryData.day" clearable> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="rollno"> |
|||
<el-input v-model="queryData.rollno" clearable> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="partno"> |
|||
<el-input v-model="queryData.partno" clearable> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button @click="getDataList()" type="primary">{{ buttons.search }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-table |
|||
:height="height" |
|||
:data="dataList" |
|||
border |
|||
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"> |
|||
<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 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 excelUpload from "../common/excelUpload"; |
|||
import AddOrUpdate from './crollinfo-add-or-update' |
|||
import {getCRollInfoList} from '@/api/crollinfo/crollinfo.js' |
|||
import column from "../common/column"; |
|||
import search from "../common/search"; |
|||
import { |
|||
searchSysLanguageParam, |
|||
searchFunctionButtonList, |
|||
saveButtonList, |
|||
} from "@/api/sysLanguage.js" |
|||
import { |
|||
saveTableDefaultList, |
|||
getTableDefaultListLanguage, |
|||
getTableUserListLanguage |
|||
} from "@/api/table.js" |
|||
import {userFavoriteList,saveUserFavorite,removeUserFavorite} from '@/api/userFavorite.js' |
|||
|
|||
export default { |
|||
data () { |
|||
return { |
|||
searchVisible: false, |
|||
searchShow: false, |
|||
// table高度 |
|||
height:450, |
|||
// 是否收藏 |
|||
favorite: false, |
|||
addLanguage: false, |
|||
functionId: 1001, |
|||
tableId: "1001SluggishMaterial", |
|||
languageCode: this.$i18n.locale, |
|||
visible: false, |
|||
showDefault: false, |
|||
queryData: { |
|||
day: '', |
|||
rollno: '', |
|||
partno: '' |
|||
}, |
|||
// 语言词典集合 |
|||
sysLanguageParams: [], |
|||
columnList: [], |
|||
dataList: [], |
|||
buttons: { |
|||
add: '添加', |
|||
edit: '编辑', |
|||
delete: '删除', |
|||
deleteList: '批量删除', |
|||
cz: '操作', |
|||
search: '搜索', |
|||
download: '导出', |
|||
settingTable: '设置列表', |
|||
defaultTable: '设置默认配置' |
|||
}, |
|||
dataListLoading: false, |
|||
dataListSelections: [], |
|||
addOrUpdateVisible: false |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate, |
|||
column, |
|||
search, |
|||
excelUpload |
|||
}, |
|||
mounted() { |
|||
this.$nextTick(()=>{ |
|||
this.height = window.innerHeight - 165; |
|||
}) |
|||
}, |
|||
activated () { |
|||
this.getDataList() |
|||
}, |
|||
methods: { |
|||
childByValue(childValue) { |
|||
// childValue就是子组件传过来的值 |
|||
console.log(childValue) |
|||
this.getDataList(childValue) |
|||
}, |
|||
// 打开搜索页面 |
|||
searchList() { |
|||
if (this.searchShow) { |
|||
this.searchShow = false |
|||
return |
|||
} else { |
|||
this.searchShow = true |
|||
} |
|||
}, |
|||
// 获取数据列表 |
|||
getDataList() { |
|||
this.dataListLoading = true |
|||
let query = [] |
|||
let f = { |
|||
queryAttributes: "parttypeFlag", |
|||
queryType: "string", |
|||
queryValue: "F", |
|||
} |
|||
query.push(f) |
|||
let toexpiredays = { |
|||
queryAttributes: "toexpiredays", |
|||
queryType: "number", |
|||
queryValue: this.queryData.day, |
|||
} |
|||
query.push(toexpiredays) |
|||
if (this.queryData.rollno != '') { |
|||
let rollno = { |
|||
queryAttributes: "rollno", |
|||
queryType: "string", |
|||
queryValue: this.queryData.rollno, |
|||
} |
|||
query.push(rollno) |
|||
} |
|||
if (this.queryData.partno != '') { |
|||
let partno = { |
|||
queryAttributes: "partno", |
|||
queryType: "string", |
|||
queryValue: this.queryData.partno, |
|||
} |
|||
query.push(partno) |
|||
} |
|||
getCRollInfoList(query).then(({data}) => { |
|||
if (data && data.code === 0) { |
|||
this.dataList = data.list |
|||
} |
|||
this.dataListLoading = false |
|||
}) |
|||
// this.searchShow = false |
|||
}, |
|||
// 校验用户是否收藏 |
|||
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() { |
|||
this.showDefault = false |
|||
saveButtonList(this.buttonList).then(({data}) => { |
|||
}) |
|||
saveTableDefaultList(this.columnList).then(({data}) => { |
|||
if (data.code == 0) { |
|||
this.$message.success(data.msg) |
|||
this.showDefault = false |
|||
} else { |
|||
this.showDefault = true |
|||
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 |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
}, |
|||
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