项目部
This commit is contained in:
parent
b101f52e16
commit
f036bdd760
|
|
@ -1,6 +1,6 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询岗位列表
|
||||
// 查询列表
|
||||
export function listProject(query) {
|
||||
return request({
|
||||
url: '/bracelet/project/list',
|
||||
|
|
@ -9,7 +9,7 @@ export function listProject(query) {
|
|||
})
|
||||
}
|
||||
|
||||
// 查询岗位详细
|
||||
// 查询详细
|
||||
export function getProject(projectId) {
|
||||
return request({
|
||||
url: '/bracelet/project/' + projectId,
|
||||
|
|
@ -17,18 +17,26 @@ export function getProject(projectId) {
|
|||
})
|
||||
}
|
||||
|
||||
// 新增岗位
|
||||
// 新增
|
||||
export function addProject(data) {
|
||||
return request({
|
||||
url: '/bracelet/project',
|
||||
headers: { // 修改请求头
|
||||
'decrypt': 'decrypt',
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
url: '/bracelet/project/addtemp',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改岗位
|
||||
// 修改
|
||||
export function updateProject(data) {
|
||||
return request({
|
||||
headers: { // 修改请求头
|
||||
'decrypt': 'decrypt',
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
url: '/bracelet/project',
|
||||
method: 'put',
|
||||
data: data
|
||||
|
|
|
|||
|
|
@ -75,7 +75,14 @@
|
|||
<el-table-column label="项目部名称" align="center" prop="projectDepartName" />
|
||||
<el-table-column label="负责人" align="center" prop="projectHeadName" />
|
||||
<el-table-column label="电话" align="center" prop="contactInformation" />
|
||||
<el-table-column label="APP轮播图" align="center" prop="appnum" />
|
||||
<el-table-column label="APP轮播图" align="center" prop="appnum">
|
||||
<template slot-scope="scope">
|
||||
<div @click="picturesPreview(scope.row.appnum)" style="color: #02a7f0; cursor: pointer">
|
||||
<!-- {{ scope.row.appnum.length }} -->1
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- -->
|
||||
<el-table-column label="备注" align="center" prop="remarks" />
|
||||
<el-table-column label="项目部Id" width="0" prop="projectId" v-if="showName" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
|
|
@ -107,7 +114,7 @@
|
|||
/>
|
||||
|
||||
<!-- 添加或修改岗位对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="项目名称" prop="projectDepartName">
|
||||
<el-input v-model="form.projectDepartName" maxlength="16" placeholder="请输入项目名称" />
|
||||
|
|
@ -122,6 +129,23 @@
|
|||
<el-input v-model="form.remarks" maxlength="50" placeholder="请输入备注内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="APP展示图片 " label-width="120px">
|
||||
<el-upload
|
||||
action="#"
|
||||
:limit="5"
|
||||
:file-list="fileList"
|
||||
:show-file-list="true"
|
||||
:auto-upload="false"
|
||||
list-type="picture-card"
|
||||
accept=".png, .jpg, .jpeg"
|
||||
:on-change="handleChange"
|
||||
:class="{ disabled: uploadDisabled }"
|
||||
:on-preview="picturePreview"
|
||||
:on-remove="handleRemove"
|
||||
>
|
||||
<i
|
||||
class="el-icon-plus avatar-uploader-icon"
|
||||
></i>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -130,6 +154,15 @@
|
|||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 图片查看弹窗 -->
|
||||
<el-dialog :visible.sync="dialogVisible">
|
||||
<img width="100%" height="650px" :src="dialogImageUrl" alt />
|
||||
</el-dialog>
|
||||
<!--多图片查看弹窗 -->
|
||||
<el-dialog :visible.sync="dialogVisibles">
|
||||
<img v-for="(item,index) of dialogImageUrls" :key="index" width="100%" height="650px" :src="item" alt />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -172,6 +205,16 @@ export default {
|
|||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
//删除图片fileId
|
||||
delFileIdList:[],
|
||||
//图片上传
|
||||
fileList: [],
|
||||
//图片查看弹窗
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
//多图片查看弹窗
|
||||
dialogImageUrls: [],
|
||||
dialogVisibles: false,
|
||||
// 表单校验
|
||||
rules: {
|
||||
projectDepartName: [
|
||||
|
|
@ -197,6 +240,12 @@ export default {
|
|||
created() {
|
||||
this.getList();
|
||||
},
|
||||
computed: {
|
||||
//图片上传1张后,隐藏上传框
|
||||
uploadDisabled() {
|
||||
return this.fileList.length > 0
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 查询岗位列表 */
|
||||
getList() {
|
||||
|
|
@ -210,6 +259,7 @@ export default {
|
|||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.fileList=[];
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
|
|
@ -242,32 +292,101 @@ export default {
|
|||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.fileList = []
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加项目";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.fileList = []
|
||||
this.reset();
|
||||
const projectId = row.projectId || this.ids
|
||||
const projectId = row.projectId
|
||||
|
||||
getProject(projectId).then(response => {
|
||||
|
||||
this.form = response.data;
|
||||
response.data.fileList.forEach(item => {
|
||||
this.fileList.push({
|
||||
fileId: item.filePath,
|
||||
url: item.bast64Image
|
||||
})
|
||||
});
|
||||
response.data.fileList = [];
|
||||
|
||||
setTimeout(()=>{
|
||||
this.open = true;
|
||||
this.title = "修改项目";
|
||||
},100)
|
||||
|
||||
});
|
||||
},
|
||||
// 图片上传
|
||||
handleChange(file, fileList) {
|
||||
console.log(file)
|
||||
// this.$refs["form"].clearValidate()
|
||||
this.fileList = fileList;
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
let sum = 0
|
||||
this.fileList.forEach((item, index) => {
|
||||
if (item.uid == file.uid) {
|
||||
sum = index
|
||||
}
|
||||
})
|
||||
this.delFileIdList.push(this.fileList[sum].fileId)
|
||||
console.log(this.delFileIdList)
|
||||
this.fileList.splice(sum, 1)
|
||||
},
|
||||
//上传组件-图片查看
|
||||
picturePreview(file) {
|
||||
console.log(file)
|
||||
this.dialogImageUrl = file.url
|
||||
this.dialogVisible = true
|
||||
},
|
||||
//多图片查看
|
||||
picturesPreview(fileList) {
|
||||
console.log(fileList)
|
||||
this.dialogImageUrls = fileList;
|
||||
this.dialogVisibles = true;
|
||||
},
|
||||
//提交时循环fileList 获取raw文件
|
||||
getFileData() {
|
||||
const file = []
|
||||
this.fileList.forEach(item => {
|
||||
if (item?.hasOwnProperty('raw')) {
|
||||
file.push(item.raw)
|
||||
}
|
||||
})
|
||||
return { file }
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.projectId != undefined) {
|
||||
updateProject(this.form).then(response => {
|
||||
const reqData = new FormData();
|
||||
this.form.delFileIdList = this.delFileIdList;
|
||||
reqData.append('params', JSON.stringify(this.form))
|
||||
const { file } = this.getFileData()
|
||||
file.forEach(item => {
|
||||
reqData.append('file', item)
|
||||
})
|
||||
updateProject(reqData).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.fileList=[];
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addProject(this.form).then(response => {
|
||||
console.log(this.form)
|
||||
const reqData = new FormData()
|
||||
reqData.append('params', JSON.stringify(this.form))
|
||||
const { file } = this.getFileData()
|
||||
file.forEach(item => {
|
||||
reqData.append('file', item)
|
||||
})
|
||||
addProject(reqData).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -420,11 +420,14 @@
|
|||
},
|
||||
handleRemove(file, fileList) {
|
||||
let sum = 0
|
||||
console.log(111111)
|
||||
console.log(this.fileList)
|
||||
this.fileList.forEach((item, index) => {
|
||||
if (item.uid == file.uid) {
|
||||
sum = index
|
||||
}
|
||||
})
|
||||
|
||||
this.fileList.splice(sum, 1)
|
||||
},
|
||||
//上传组件-图片查看
|
||||
|
|
@ -451,6 +454,7 @@
|
|||
name: response.data.fileId,
|
||||
url: response.data.base64Url
|
||||
})
|
||||
|
||||
this.form.fileName = response.data.fileId;
|
||||
setTimeout(()=>{
|
||||
this.open = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue