Browse Source

文件上传组件,批量修改有效期

master
[li_she] 5 years ago
parent
commit
695aca4547
  1. 3
      src/api/crollinfo/crollinfo.js
  2. 8
      src/views/modules/common/column.vue
  3. 14
      src/views/modules/common/search.vue
  4. 10
      src/views/modules/common/upload.vue
  5. 134
      src/views/modules/finishedProductWarehouse/expirationTimeModification.vue
  6. 2
      src/views/modules/finishedProductWarehouse/sluggishMaterialWarning.vue
  7. 10
      src/views/modules/oss/oss-upload.vue
  8. 1
      src/views/modules/oss/oss.vue
  9. 64
      src/views/modules/rawMaterials/expirationTimeModification.vue
  10. 2
      src/views/modules/rawMaterials/sluggishMaterialWarning.vue

3
src/api/crollinfo/crollinfo.js

@ -8,3 +8,6 @@ export const updateExpireddate = data => createAPI(`/finishedProduct/crollinfo/u
// 获取详情
export const infoRollno = data => createAPI(`/finishedProduct/crollinfo/infoRollno`,'post',data)
//批量修改有效期
export const batchUpdateExpireddate = data => createAPI(`/finishedProduct/crollinfo/batchUpdateExpireddate`,'post',data)

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

@ -50,6 +50,14 @@
<el-option value="date" label="date"></el-option>
</el-select>
</el-form-item>
<el-form-item>
位置
<el-select v-model="item.align" >
<el-option value="left" label="居左"></el-option>
<el-option value="center" label="居中"></el-option>
<el-option value="right" label="居右"></el-option>
</el-select>
</el-form-item>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">

14
src/views/modules/common/search.vue

@ -178,16 +178,16 @@ export default {
methods: {
//
searchCriteria() {
const loading = this.$loading({
lock: true,
text: '查询中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
// const loading = this.$loading({
// lock: true,
// text: '',
// spinner: 'el-icon-loading',
// background: 'rgba(0, 0, 0, 0.7)'
// });
var filter = this.userColumnList.filter(item => item.queryValue!="");
this.$emit('childByValue', filter)
setTimeout(() => {
loading.close();
// loading.close();
}, 2000);
},
//

10
src/views/modules/common/upload.vue

@ -28,16 +28,16 @@
},
methods: {
init (id) {
this.url = this.$http.adornUrl(`/sys/oss/upload?token=${this.$cookie.get('token')}`)
this.url = this.$http.adornUrl(`/ftp/file/upload?token=${this.$cookie.get('token')}`)
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
}
// if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
// this.$message.error('jpgpnggif')
// return false
// }
this.num++
},
//

134
src/views/modules/finishedProductWarehouse/expirationTimeModification.vue

@ -2,20 +2,25 @@
<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-button @click="searchList()" type="primary">{{buttons.search}}</el-button>
<el-button @click="saveColumnList()" type="primary" v-show="showDefault">{{buttons.defaultTable}}
<el-button @click="searchList()" type="primary">{{ buttons.search }}</el-button>
<el-button @click="userSetting" type="primary">{{ buttons.settingTable }}</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="updateExpDate()" type="primary">{{ buttons.updateExp }}
</el-button>
<el-table
ref="rollInfo"
:height="height"
:data="dataList"
border
:cell-style="{ padding: '2px' }"
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
@ -27,7 +32,7 @@
: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.columnHidden"> {{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
@ -40,23 +45,42 @@
width="150"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="addOrUpdateHandle(scope.row.rollno,scope.row.site)">修改失效日</a>
<a type="text" size="small" @click="addOrUpdateHandle(scope.row.rollno,scope.row.site)">修改有效</a>
</template>
</el-table-column>
</el-table>
<!-- 设置查询条件 -->
<search v-if="searchVisible" v-on:childByValue="childByValue" ref="search" @refreshDataList="getDataList" ></search>
<search v-if="searchVisible" v-on:childByValue="childByValue" ref="search" @refreshDataList="getDataList"></search>
<!-- 设置列 -->
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<el-dialog
:title="'修改有效期'"
:close-on-click-modal="false"
width="350px"
:visible.sync="updateExp">
<el-form ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-form-item label="失效日期" prop="expireddate">
<el-date-picker value-format="yyyy-MM-dd" v-model="expireddate" placeholder="失效日期"></el-date-picker>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateExpSubmit()">确定</el-button>
<el-button @click="updateExp = false">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import AddOrUpdate from './crollinfo-add-or-update'
import {getCRollInfoList} from '@/api/crollinfo/crollinfo.js'
import {getCRollInfoList,batchUpdateExpireddate} from '@/api/crollinfo/crollinfo.js'
import column from "../common/column";
import search from "../common/search";
import {
@ -69,14 +93,16 @@ import {
getTableDefaultListLanguage,
getTableUserListLanguage
} from "@/api/table.js"
import {userFavoriteList,saveUserFavorite,removeUserFavorite} from '@/api/userFavorite.js'
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
export default {
data () {
data() {
return {
searchVisible: false,
updateExp: false,
expireddate:'',
// table
height:450,
height: 450,
//
favorite: false,
addLanguage: false,
@ -85,13 +111,10 @@ export default {
languageCode: this.$i18n.locale,
visible: false,
showDefault: false,
query:{
},
query: {},
//
sysLanguageParams: [],
columnList: [
],
columnList: [],
dataList: [],
buttons: {
add: '添加',
@ -102,7 +125,8 @@ export default {
search: '搜索',
download: '导出',
settingTable: '设置列表',
defaultTable: '设置默认配置'
defaultTable: '设置默认配置',
updateExp: '修改有效期'
},
dataListLoading: false,
dataListSelections: [],
@ -115,14 +139,44 @@ export default {
search
},
mounted() {
this.$nextTick(()=>{
this.$nextTick(() => {
this.height = window.innerHeight - 165;
})
},
activated () {
activated() {
this.getDataList()
},
methods: {
//
updateExpDate() {
this.updateExp = true
},
//
updateExpSubmit() {
let rollInfoList = this.$refs.rollInfo.selection.map(item =>{
let rollInfo = {
site:item.site,
rollno: item.rollno,
expireddate: this.expireddate
}
return rollInfo;
})
batchUpdateExpireddate(rollInfoList).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.updateExp = false
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
},
childByValue(childValue) {
this.getDataList(childValue)
},
@ -140,41 +194,41 @@ export default {
});
},
//
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}) =>{
userFavoriteList(userFavorite).then(({data}) => {
let size = data.list.filter(item => item.menuId == this.$route.meta.menuId).length;
if (size>0){
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
})
@ -190,7 +244,7 @@ export default {
objectType: 'button'
}
searchFunctionButtonList(queryButton).then(({data}) => {
if (data.data.length>0) {
if (data.data.length > 0) {
this.buttons = data.data
}
})
@ -269,9 +323,9 @@ export default {
})
},
//
getDataList (val) {
getDataList(val) {
this.dataListLoading = true
let query = val?val:[]
let query = val ? val : []
let f = {
queryAttributes: "parttypeFlag",
queryType: "string",
@ -286,14 +340,14 @@ export default {
})
},
// /
addOrUpdateHandle (rollno,site) {
addOrUpdateHandle(rollno, site) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(rollno,site)
this.$refs.addOrUpdate.init(rollno, site)
})
},
//
deleteHandle (id) {
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.site
})
@ -332,7 +386,7 @@ export default {
}
</script>
<style scoped>
.sl-svg{
.sl-svg {
overflow: hidden;
float: right;
}

2
src/views/modules/finishedProductWarehouse/sluggishMaterialWarning.vue

@ -90,7 +90,7 @@
visible: false,
showDefault: false,
queryData: {
day: 30,
day: '',
rollno: '',
partno: ''
},

10
src/views/modules/oss/oss-upload.vue

@ -32,16 +32,16 @@
},
methods: {
init (id) {
this.url = this.$http.adornUrl(`/sys/oss/upload?token=${this.$cookie.get('token')}`)
this.url = this.$http.adornUrl(`/ftp/file/upload?token=${this.$cookie.get('token')}`)
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
}
// if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
// this.$message.error('jpgpnggif')
// return false
// }
this.num++
},
//

1
src/views/modules/oss/oss.vue

@ -13,6 +13,7 @@
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column
prop="url"
header-align="center"

64
src/views/modules/rawMaterials/expirationTimeModification.vue

@ -9,12 +9,15 @@
<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="updateExpDate()" type="primary">{{ buttons.updateExp }}</el-button>
<el-table
ref="rawRollInfo"
:height="height"
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
@ -39,7 +42,7 @@
width="150"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="update(scope.row)">修改有效期天数</a>
<a type="text" size="small" @click="update(scope.row)">修改有效期</a>
</template>
</el-table-column>
@ -50,12 +53,30 @@
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<el-dialog
:title="'修改有效期'"
:close-on-click-modal="false"
width="350px"
:visible.sync="updateExp">
<el-form ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-form-item label="失效日期" prop="expireddate">
<el-date-picker value-format="yyyy-MM-dd" v-model="expireddate" placeholder="失效日期"></el-date-picker>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateExpSubmit()">确定</el-button>
<el-button @click="updateExp = false">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import AddOrUpdate from './crollinfo-add-or-update'
import {getCRollInfoList} from '@/api/crollinfo/crollinfo.js'
import {getCRollInfoList,batchUpdateExpireddate} from '@/api/crollinfo/crollinfo.js'
import column from "../common/column";
import search from "../common/search";
import {
@ -75,6 +96,8 @@ export default {
return {
searchVisible: false,
visible: false,
updateExp: false,
expireddate:'',
addOrUpdateVisible: false,
CRollInfo: {},
// table
@ -104,7 +127,8 @@ export default {
search: '搜索',
download: '导出',
settingTable: '设置列表',
defaultTable: '设置默认配置'
defaultTable: '设置默认配置',
updateExp: '修改有效期'
},
dataListLoading: false,
dataListSelections: [],
@ -125,6 +149,37 @@ export default {
this.getDataList()
},
methods: {
//
updateExpDate() {
this.updateExp = true
},
//
updateExpSubmit() {
let rollInfoList = this.$refs.rawRollInfo.selection.map(item =>{
let rollInfo = {
site:item.site,
rollno: item.rollno,
expireddate: this.expireddate
}
return rollInfo;
})
batchUpdateExpireddate(rollInfoList).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.updateExp = false
this.expireddate = ''
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
},
//
update(val){
this.CRollInfo = val
@ -167,9 +222,8 @@ export default {
//
childByValue(childValue) {
// childValue
console.log(childValue)
this.getDataList(childValue)
this.searchVisible = false;
},
//
favoriteIsOk(){

2
src/views/modules/rawMaterials/sluggishMaterialWarning.vue

@ -92,7 +92,7 @@ export default {
visible: false,
showDefault: false,
queryData: {
day: 30,
day: '',
rollno: '',
partno: ''
},

Loading…
Cancel
Save