|
@@ -9,7 +9,7 @@
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" v-on:click="getProject">查询</el-button>
|
|
|
</el-form-item>
|
|
|
- <el-form-item style="float:right;" v-if="">
|
|
|
+ <el-form-item style="float:right;" v-if="user.parentId == 1">
|
|
|
<el-button type="primary" @click="handleAdd">新增</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -58,23 +58,24 @@
|
|
|
<el-input v-model="addForm.projectName" autocomplete="off" placeholder="请输入项目名称" style="width:510px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="24">
|
|
|
<el-form-item label="生产方公司" prop="customerCompany">
|
|
|
- <el-select v-model="addForm.customerCompany" clearable filterable placeholder="请选择生产方公司" value-key='id' @change="companyChange(0)" style="width:195px">
|
|
|
+ <el-select v-model="addForm.customerCompany" clearable filterable multiple placeholder="请选择生产方公司" @change="companyChange" value-key='id' style="width:510px">
|
|
|
+ <!-- @change="companyChange(0)" -->
|
|
|
<el-option v-for="item in company" :key="item.id" :label="item.companyName" :value="item">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="生产方负责人" prop="charger">
|
|
|
- <el-select v-model="addForm.charger" clearable filterable placeholder="请选择生产方负责人" value-key='id' style="width:195px">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="项目经理" prop="managerId">
|
|
|
+ <el-select v-model="addForm.managerId" clearable filterable placeholder="请选择项目经理" value-key='id' style="width:510px">
|
|
|
<el-option v-for="item in charger" :key="item.id" :label="item.username" :value="item">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <!-- <el-col :span="24">
|
|
|
<el-form-item label="本方参与人">
|
|
|
<el-select v-model="addForm.userA" clearable filterable multiple placeholder="请选择本方参与人" style="width:510px">
|
|
|
<el-option v-for="item in userA" :key="item.id" :label="item.username" :value="item.id">
|
|
@@ -89,60 +90,13 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click.native="addFormVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
- <!--编辑界面-->
|
|
|
- <el-dialog title="编辑" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
|
|
|
- <el-form :model="editForm" label-width="120px" :rules="formRules" ref="editForm" class="demo-form-inline">
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="项目名称" prop="projectName">
|
|
|
- <el-input v-model="editForm.projectName" autocomplete="off" placeholder="请输入项目名称" style="width:510px"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="生产方公司" prop="customerCompany">
|
|
|
- <el-select v-model="editForm.customerCompany" clearable filterable placeholder="请选择生产方公司" value-key='id' @change="companyChange(1)" style="width:195px">
|
|
|
- <el-option v-for="item in company" :key="item.id" :label="item.companyName" :value="item">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="生产方负责人" prop="charger">
|
|
|
- <el-select v-model="editForm.charger" clearable filterable placeholder="请选择生产方负责人" value-key='id' style="width:195px">
|
|
|
- <el-option v-for="item in charger" :key="item.id" :label="item.username" :value="item">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="本方参与人">
|
|
|
- <el-select v-model="editForm.userA" clearable filterable multiple placeholder="请选择本方参与人" style="width:510px">
|
|
|
- <el-option v-for="item in userA" :key="item.id" :label="item.username" :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="生产方参与人">
|
|
|
- <el-select v-model="editForm.userB" clearable filterable multiple placeholder="请选择生产方参与人" style="width:510px">
|
|
|
- <el-option v-for="item in userB" :key="item.id" :label="item.username" :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click.native="editFormVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
</section>
|
|
|
</template>
|
|
|
|
|
@@ -158,8 +112,8 @@
|
|
|
user: JSON.parse(sessionStorage.getItem('user')),
|
|
|
company:[],
|
|
|
charger: [],
|
|
|
- userA: [],
|
|
|
- userB: [],
|
|
|
+ // userA: [],
|
|
|
+ // userB: [],
|
|
|
|
|
|
list: [],
|
|
|
total: 0,
|
|
@@ -173,10 +127,10 @@
|
|
|
{ required: true, message: '请输入项目名称', trigger: 'blur' }
|
|
|
],
|
|
|
customerCompany: [
|
|
|
- { required: true, message: '请选择客户公司', trigger: ['blur','change'] }
|
|
|
+ { required: true, message: '请选择客户公司', trigger: 'blur' }
|
|
|
],
|
|
|
- charger: [
|
|
|
- { required: true, message: '请选择客户方负责人', trigger: ['blur','change'] }
|
|
|
+ managerId: [
|
|
|
+ { required: true, message: '请选择项目经理', trigger: ['blur','change'] }
|
|
|
]
|
|
|
},
|
|
|
|
|
@@ -185,22 +139,10 @@
|
|
|
//新增界面数据
|
|
|
addForm: {
|
|
|
projectName: '',
|
|
|
- customerCompany: '',
|
|
|
- charger: '',
|
|
|
- userA: [],
|
|
|
- userB: []
|
|
|
- },
|
|
|
-
|
|
|
- editFormVisible: false,//编辑界面是否显示
|
|
|
- editLoading: false,
|
|
|
- //编辑界面数据
|
|
|
- editForm: {
|
|
|
- id: 0,
|
|
|
- projectName: '',
|
|
|
- customerCompany: '',
|
|
|
- charger: '',
|
|
|
- userA: [],
|
|
|
- userB: []
|
|
|
+ customerCompany: [],
|
|
|
+ managerId: '',
|
|
|
+ // userA: [],
|
|
|
+ // userB: []
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -208,7 +150,28 @@
|
|
|
methods: {
|
|
|
// 获取基础数据
|
|
|
getMsg(){
|
|
|
- this.http.post(this.port.base.companys, {}, res => {
|
|
|
+ this.http.post(this.port.project.getUserById, {
|
|
|
+ companyIds: this.user.companyId
|
|
|
+ } , res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.charger = res.data;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+ this.http.post(this.port.base.companys, {
|
|
|
+ parentId: this.user.parentId,
|
|
|
+ id: this.user.id
|
|
|
+ }, res => {
|
|
|
if (res.code == "ok") {
|
|
|
var list = res.data , array = [];
|
|
|
for(var i in list){
|
|
@@ -270,25 +233,16 @@
|
|
|
},
|
|
|
|
|
|
//选择公司切换人员
|
|
|
- companyChange: function(type){
|
|
|
- var param = {};
|
|
|
- if(type == 0){
|
|
|
- param.companyId = this.addForm.customerCompany.id;
|
|
|
- } else if(type == 1) {
|
|
|
- param.companyId = this.editForm.customerCompany.id;
|
|
|
+ companyChange: function(){
|
|
|
+ var param = {} ,
|
|
|
+ str = this.user.companyId;
|
|
|
+ for(var i in this.addForm.customerCompany){
|
|
|
+ str += "," + this.addForm.customerCompany[i].id;
|
|
|
}
|
|
|
- param.subordinateType = 1;
|
|
|
- this.http.post(this.port.project.getUserList, param , res => {
|
|
|
+ param.companyIds = str;
|
|
|
+ this.http.post(this.port.project.getUserById, param , res => {
|
|
|
if (res.code == "ok") {
|
|
|
this.charger = res.data;
|
|
|
- this.userB = res.data;
|
|
|
- if(type == 0){
|
|
|
- this.addForm.charger = '';
|
|
|
- this.addForm.userB = [];
|
|
|
- } else {
|
|
|
- this.editForm.charger = '';
|
|
|
- this.editForm.userB = [];
|
|
|
- }
|
|
|
} else {
|
|
|
this.$message({
|
|
|
message: res.msg,
|
|
@@ -309,9 +263,9 @@
|
|
|
this.addForm = {
|
|
|
projectName: '',
|
|
|
customerCompany: '',
|
|
|
- charger: '',
|
|
|
- userA: [],
|
|
|
- userB: []
|
|
|
+ managerId: '',
|
|
|
+ // userA: [],
|
|
|
+ // userB: []
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -319,29 +273,38 @@
|
|
|
addSubmit: function () {
|
|
|
this.$refs.addForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- console.log(this.addForm)
|
|
|
- var userIds = "";
|
|
|
- if(this.addForm.userA.length != 0){
|
|
|
- for(var i in this.addForm.userA){
|
|
|
- userIds += this.addForm.userA[i] + ","
|
|
|
- }
|
|
|
- }
|
|
|
+ // console.log(this.addForm)
|
|
|
+ // var userIds = "";
|
|
|
+ // if(this.addForm.userA.length != 0){
|
|
|
+ // for(var i in this.addForm.userA){
|
|
|
+ // userIds += this.addForm.userA[i] + ","
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- if(this.addForm.userB.length != 0){
|
|
|
- for(var i in this.addForm.userB){
|
|
|
- userIds += this.addForm.userB[i] + ","
|
|
|
- }
|
|
|
- }
|
|
|
+ // if(this.addForm.userB.length != 0){
|
|
|
+ // for(var i in this.addForm.userB){
|
|
|
+ // userIds += this.addForm.userB[i] + ","
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- userIds = userIds.substring(0,userIds.length-1)
|
|
|
+ // userIds = userIds.substring(0,userIds.length-1)
|
|
|
+ var cId = "",
|
|
|
+ cName = "";
|
|
|
+ for(var i in this.addForm.customerCompany){
|
|
|
+ console.log(this.addForm.customerCompany[i])
|
|
|
+ cId += this.addForm.customerCompany[i].id + ",";
|
|
|
+ cName += this.addForm.customerCompany[i].companyName + ",";
|
|
|
+ }
|
|
|
+ cId = cId.substring(0,cId.length-1);
|
|
|
+ cName = cName.substring(0,cName.length-1);
|
|
|
this.addLoading = true;
|
|
|
this.http.post(this.port.project.addProject, {
|
|
|
projectName: this.addForm.projectName,
|
|
|
- customerCompany: this.addForm.customerCompany.id,
|
|
|
- customerCompanyName: this.addForm.customerCompany.companyName,
|
|
|
- chargerId: this.addForm.charger.id,
|
|
|
- charger: this.addForm.charger.username,
|
|
|
- userIds: userIds,
|
|
|
+ customerCompanyIds: cId,
|
|
|
+ customerCompanyNames: cName,
|
|
|
+ managerName: this.addForm.managerId.username,
|
|
|
+ managerId: this.addForm.managerId.id,
|
|
|
+ // userIds: userIds,
|
|
|
flag: 0
|
|
|
} , res => {
|
|
|
this.addLoading = false;
|
|
@@ -371,64 +334,24 @@
|
|
|
},
|
|
|
|
|
|
//删除
|
|
|
- handleDel: function (index, row) {
|
|
|
- this.$confirm('确认删除该记录吗?', '提示', {
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.listLoading = true;
|
|
|
- let para = { id: row.id };
|
|
|
- removeUser(para).then((res) => {
|
|
|
- this.listLoading = false;
|
|
|
- this.$message({
|
|
|
- message: '删除成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.getProject();
|
|
|
- });
|
|
|
- }).catch(() => {
|
|
|
+ // handleDel: function (index, row) {
|
|
|
+ // this.$confirm('确认删除该记录吗?', '提示', {
|
|
|
+ // type: 'warning'
|
|
|
+ // }).then(() => {
|
|
|
+ // this.listLoading = true;
|
|
|
+ // let para = { id: row.id };
|
|
|
+ // removeUser(para).then((res) => {
|
|
|
+ // this.listLoading = false;
|
|
|
+ // this.$message({
|
|
|
+ // message: '删除成功',
|
|
|
+ // type: 'success'
|
|
|
+ // });
|
|
|
+ // this.getProject();
|
|
|
+ // });
|
|
|
+ // }).catch(() => {
|
|
|
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- //显示编辑界面
|
|
|
- handleEdit: function (index, row) {
|
|
|
- this.editFormVisible = true;
|
|
|
- this.editForm = Object.assign({}, row);
|
|
|
- this.editForm = {
|
|
|
- id: row.id,
|
|
|
- projectName: row.projectName,
|
|
|
- customerCompany: row.customerCompanyName,
|
|
|
- charger: row.charger,
|
|
|
- userA: [],
|
|
|
- userB: []
|
|
|
- };
|
|
|
- },
|
|
|
-
|
|
|
- //编辑
|
|
|
- editSubmit: function () {
|
|
|
- this.$refs.editForm.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.$confirm('确认提交吗?', '提示', {}).then(() => {
|
|
|
- this.editLoading = true;
|
|
|
- //NProgress.start();
|
|
|
- let para = Object.assign({}, this.editForm);
|
|
|
- para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd');
|
|
|
- editUser(para).then((res) => {
|
|
|
- this.editLoading = false;
|
|
|
- //NProgress.done();
|
|
|
- this.$message({
|
|
|
- message: '提交成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.$refs['editForm'].resetFields();
|
|
|
- this.editFormVisible = false;
|
|
|
- this.getProject();
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
+ // });
|
|
|
+ // }
|
|
|
},
|
|
|
created() {
|
|
|
let height = window.innerHeight;
|