123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098 |
- <template>
- <section>
- <!--工具条-->
- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
- <el-form :inline="true">
- <el-form-item>
- <el-button type="text" @click="backToList" icon="el-icon-back" class="back">{{$t('base.back')}}</el-button>
- </el-form-item>
- <el-form-item class="divLine">
- </el-form-item>
- <el-form-item>
- <span class="projectTitle">{{proDetail.projectName}}</span>
- </el-form-item>
- </el-form>
- </el-col>
- <el-col :span="24" :style="allDetail">
- <el-col :span="24" class="title">
- {{$t('project.detail')}}
- <i class="el-icon-edit editDetail" v-if="user.id == proDetail.managerId || user.id == proDetail.creatorId" @click="edit"></i>
- </el-col>
- <el-col :span="24" class="main">
- <el-col :span="6" class="detail">
- {{$t('project.projectNo')}}:
- <span class="info">{{proDetail.projectNo}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- {{$t('project.manager')}}:
- <span class="info">{{proDetail.manager}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- {{$t('project.ownerApprover')}}:
- <span class="info">{{proDetail.ownerApprover}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- {{$t('project.customerApprover')}}:
- <span class="info">{{proDetail.customerApprover}}</span>
- </el-col>
- <el-col :span="24" class="detail">
- {{$t('project.cusName')}}:
- <span class="info" v-for="(item, index) in proDetail.customCompanies">
- {{item.companyName}}
- <span v-if="index != proDetail.customCompanies.length-1">、</span>
- </span>
- </el-col>
- <!-- <el-col :span="24" class="detail">
- 项目模具:
- <span class="info model" v-for="(item, index) in proDetail.models">
- <span @click="toMold(item.id)">{{item.modelName}}({{item.modelNo}})</span>
- <span v-if="index != proDetail.models.length-1">、</span>
- </span>
- </el-col> -->
- <el-col :span="24" class="detail">
- {{$t('project.users')}}:
- <span class="info" v-for="(item, index) in proDetail.participateUsers">
- {{item.username}}
- <span v-if="index != proDetail.participateUsers.length-1">、</span>
- </span>
- </el-col>
- <!-- <el-col :span="24" class="detail">
- 生产方人员:
- <span class="info" v-for="(item, index) in proDetail.customUsers">
- {{item.username}}
- <span v-if="index != proDetail.customUsers.length-1">、</span>
- </span>
- </el-col> -->
- </el-col>
-
- <el-col :span="24">
- <el-collapse class="activeNames" v-model="activeNames">
- <el-collapse-item name="1">
- <template slot="title">
- <el-col :span="24" class="title">{{$t('project.moldName')}}</el-col>
- </template>
- <el-col :span="24" class="detail">
- <el-table :data="proDetail.models" highlight-current-row v-loading="modelsLoading" style="width: 100%;">
- <el-table-column type="index" width="40"></el-table-column>
- <el-table-column prop="modelNo" :label="$t('mold.moldNo')" width="200" sortable>
- <template slot-scope="scope">
- <span class="model" @click="toMold(scope.row.id)">{{scope.row.modelNo}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="modelName" :label="$t('mold.modelName')" width="500" sortable></el-table-column>
- <el-table-column prop="produceCompanyName" :label="$t('mold.factoryName')" sortable></el-table-column>
- </el-table>
- </el-col>
- </el-collapse-item>
- <el-collapse-item name="2">
- <template slot="title">
- <el-col :span="24" class="title">{{$t('project.proFile')}}
- <!-- update == 1 -->
- <span @click='doSomething'>
- <el-upload v-if="user.id == proDetail.managerId" ref="upload" action="customize" :http-request="uploadFile" :show-file-list="false" :limit="1" style="float:right;margin-right:20px;">
- <el-button size="mini" type="primary" :loading="upLoading">{{$t('base.upload')}}</el-button>
- </el-upload>
- </span>
- </el-col>
- </template>
- <el-col :span="24" class="detail">
- <el-table :data="files" highlight-current-row v-loading="listLoading" style="width: 100%;">
- <el-table-column type="index" width="40"></el-table-column>
- <el-table-column prop="fileName" :label="$t('project.fileName')" sortable></el-table-column>
- <el-table-column prop="fileSize" :label="$t('project.fileSize')" width="150" align="center" sortable></el-table-column>
- <el-table-column prop="uploader" :label="$t('project.uploader')" width="120" align="center" sortable></el-table-column>
- <el-table-column prop="indate" :label="$t('project.uploadTime')" width="200" align="center" sortable></el-table-column>
- <el-table-column :label="$t('base.operate')" width="220" align="center" sortable>
- <template slot-scope="scope" v-if="download == 1">
- <a :href="scope.row.url" :download="scope.row.fileName">
- <el-button size="small" @click="dowloadFile(scope.row)">{{$t('project.download')}}</el-button>
- </a>
- <el-button size="small" type="danger" @click="fileDel(scope.row.id)"v-if="scope.row.uploaderId == user.id">{{$t('el.upload.delete')}}</el-button>
- </template>
- <template slot-scope="scope" v-else>-</template>
- </el-table-column>
- </el-table>
- </el-col>
- </el-collapse-item>
- <el-collapse-item name="3">
- <template slot="title">
- <el-col :span="24" class="title">{{$t('project.operation')}}</el-col>
- </template>
- <el-col :span="24" class="detail">
- <el-table :data="opers" highlight-current-row v-loading="oplistLoading" style="width: 100%;">
- <el-table-column type="index" width="40"></el-table-column>
- <el-table-column prop="content" :label="$t('base.operate')" width="120" sortable></el-table-column>
- <el-table-column prop="fileName" :label="$t('project.operFileName')" sortable></el-table-column>
- <el-table-column prop="operator" :label="$t('project.operator')" width="120" align="center" sortable></el-table-column>
- <el-table-column prop="indate" :label="$t('project.operTime')" width="200" align="center" sortable></el-table-column>
- </el-table>
- </el-col>
- </el-collapse-item>
- </el-collapse>
- </el-col>
-
- </el-col>
- <!--编辑界面-->
- <el-dialog :title="$t('project.editPro')" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
- <el-form :model="editForm" label-width="120px" :rules="formRules" ref="editForm">
- <el-col :span="24">
- <el-form-item :label="$t('project.proName')" prop="projectName">
- <el-input v-model="editForm.projectName" autocomplete="off" :placeholder="$t('project.inputProName')" style="width:510px"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24" v-if="user.parentId == 1 && user.subordinateType == 0">
- <el-form-item :label="$t('project.moldName')" prop="modelIds">
- <el-select v-model="editForm.modelIds" @change="companyChange" clearable filterable multiple :placeholder="$t('project.inputMoldName')" value-key='id' style="width:510px">
- <el-option v-for="item in molds" :key="item.id" :label="item.modelName" :value="item">
- <span style="float: left">{{ item.modelName }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px;margin-right:17px;">{{ item.produceCompanyName }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24" v-if="user.parentId == 1 && user.subordinateType == 0">
- <el-form-item :label="$t('project.manager')" prop="managerId">
- <el-select v-model="editForm.managerId" @change="changeStaff(0)" clearable filterable :placeholder="$t('project.inputManager')" value-key='id' style="width:510px">
- <!-- <el-option v-for="item in charger" :key="item.id" :label="item.username" :value="item">
- </el-option> -->
- <el-option v-for="item in charger" :key="item.id" :label="item.username" :value="item">
- <span style="float: left">{{ item.username }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px;">{{ item.companyName }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('project.ownerApprover')">
- <!-- prop="ownerApproverId" -->
- <el-select v-model="editForm.ownerApproverId" @change="changeStaff(0)" clearable filterable :placeholder="$t('project.inputOwnerApprover')" value-key='id' style="width:510px">
- <!-- <el-option v-for="item in assets" :key="item.id" :label="item.username" :value="item.id">
- </el-option> -->
- <el-option v-for="item in assets" :key="item.id" :label="item.username" :value="item.id">
- <span style="float: left">{{ item.username }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px;">{{ item.companyName }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('project.customerApprover')">
- <!-- prop="customerApproverId" -->
- <el-select v-model="editForm.customerApproverId" @change="changeStaff(0)" clearable filterable :placeholder="$t('project.inputCustomerApprover')" value-key='id' style="width:510px">
- <!-- <el-option v-for="item in produce" :key="item.id" :label="item.username" :value="item.id">
- </el-option> -->
- <el-option v-for="item in produce" :key="item.id" :label="item.username" :value="item.id">
- <span style="float: left">{{ item.username }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px;">{{ item.companyName }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('project.users')">
- <el-select v-model="editForm.users" @change="changeStaff(1)" clearable filterable multiple :placeholder="$t('project.inputUsers')" style="width:510px">
- <!-- <el-option v-for="item in general" :key="item.id" :label="item.username" :value="item.id">
- </el-option> -->
- <el-option v-for="item in general" :key="item.id" :label="item.username" :value="item.id">
- <span style="float: left">{{ item.username }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px;margin-right:17px;">{{ item.companyName }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="24">
- <el-form-item label="资产方参与人">
- <el-select v-model="editForm.assets" clearable filterable multiple placeholder="请选择资产方参与人" style="width:510px">
- <el-option v-for="item in assets" :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.produce" clearable filterable multiple placeholder="请选择生产方参与人" style="width:510px">
- <el-option v-for="item in produce" :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 size="small" style="float:left;margin-left:20px;" type="primary" @click.native="addStaff" :loading="editLoading">{{$t('project.addUser')}}</el-button>
- <el-button @click.native="editFormVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
- <el-button type="primary" @click.native="addSubmit" :loading="editLoading">{{$t('el.messagebox.confirm')}}</el-button>
- </div>
- </el-dialog>
- <!--新增界面-->
- <el-dialog :title="$t('project.addPeo')" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
- <el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm" :inline="true" class="demo-form-inline">
- <el-form-item :label="$t('project.name')" prop="username">
- <el-input v-model="addForm.username" autocomplete="off" :placeholder="$t('project.inputName')" style="width:202px"></el-input>
- </el-form-item>
- <el-form-item :label="$t('project.mobile')" prop="account">
- <el-input v-model="addForm.account" autocomplete="off" :placeholder="$t('project.inputMobile')" style="width:202px"></el-input>
- </el-form-item>
- <el-form-item :label="$t('project.company')" prop="companyId">
- <el-select v-model="addForm.companyId" clearable filterable :placeholder="$t('project.inputCompany')" style="width:202px">
- <el-option v-for="item in staffComp" :key="item.id" :label="item.companyName" :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item :label="$t('project.remark')">
- <el-input v-model="addForm.roleName" autocomplete="off" :placeholder="$t('project.inputRemark')" style="width:202px"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <span style="color:#f00;float:left;margin-left:60px;">{{$t('project.initial')}}:000000</span>
- <el-button @click.native="addFormVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
- <el-button type="primary" @click.native="addPeople(1)" :loading="addLoading">{{$t('project.uploadAndAdd')}}</el-button>
- <el-button type="primary" @click.native="addPeople(0)" :loading="addLoading">{{$t('el.messagebox.confirm')}}</el-button>
- </div>
- </el-dialog>
- </section>
- </template>
- <script>
- import util from "../../common/js/util";
- export default {
- data() {
- const checkPhone = (rule, value, callback) => {
- if (!value) {
- return callback(this.$t('project.inputMobile'));
- } else {
- const reg = /^1[0-9]\d{9}$/
- if (reg.test(value)) {
- callback();
- } else {
- return callback(new Error(this.$t('project.inputTrueMobile')));
- }
- }
- };
- const msg = (rule, value, callback) => {
- if (!value) {
- switch(rule.field) {
- case "projectName":
- return callback(new Error(this.$t('project.inputProName')));
- break;
- case "modelIds":
- return callback(new Error(this.$t('project.inputMoldName')));
- break;
- case "managerId":
- return callback(new Error(this.$t('project.inputManager')));
- break;
- case "ownerApproverId":
- return callback(new Error(this.$t('project.inputOwnerApprover')));
- break;
- case "customerApproverId":
- return callback(new Error(this.$t('project.inputCustomerApprover')));
- break;
- case "username":
- return callback(new Error(this.$t('project.inputName')));
- break;
- case "companyId":
- return callback(new Error(this.$t('project.inputCompany')));
- break;
- default:
- callback();
- }
- } else {
- callback();
- }
- };
- return {
- activeNames: ['1','2','3'],
- detailId: this.$route.params.id,
- user: JSON.parse(sessionStorage.getItem('user')),
- //临时数据
- proDetail: {},
- files: [],
- opers: [],
- allDetail: {
- overflow: 'auto',
- padding: '0px 5px',
- height: 0
- },
- listLoading: false,
- modelsLoading: false,
- upLoading: false,
- oplistLoading: false,
- activePage: 0,
- update: 0,
- download: 0,
- view: 0,
- approve: 0,
- company: [],
- staffComp: [],
- allUser: [],
- assets: [],
- produce: [],
- charger: [],
- general: [],
- formRules: {
- projectName: [
- { required: true, validator: msg, trigger: 'blur' }
- ],
- modelIds: [
- { required: true, validator: msg, trigger: ['blur','change'] }
- ],
- managerId: [
- { required: true, validator: msg, trigger: ['blur','change'] }
- ],
- ownerApproverId: [
- { required: true, validator: msg, trigger: ['blur','change'] }
- ],
- customerApproverId: [
- { required: true, validator: msg, trigger: ['blur','change'] }
- ],
- // 新建人员
- username: [
- { required: true, validator: msg, trigger: 'blur' }
- ],
- account: [
- { required: true, validator: checkPhone, trigger: 'blur'}
- ],
- companyId: [
- { required: true, validator: msg, trigger: ["blur",'change'] }
- ],
- },
-
- editFormVisible: false,//编辑界面是否显示
- editLoading: false,
- //编辑界面数据
- editForm: {
- projectName: '',
- customerCompany: [],
- managerId: '',
- ownerApproverId: '',
- customerApproverId: '',
- modelIds: [],
- users: []
- },
- //新增界面是否显示
- addFormVisible: false,
- addLoading: false,
- //新增界面数据
- addForm: {
- username: '',
- account: '',
- companyId: '',
- roleName: '',
- flag: 0
- },
- };
- },
- methods: {
- //返回
- backToList() {
- this.$router.go(-1);
- },
- toMold(id) {
- this.$router.push('/moldList/' + id + "/0");
- },
-
- handleClick(tab, event) {
- },
- //获取详情
- getDetail() {
- this.modelsLoading = true;
- this.http.post(this.port.project.projectDetail, {
- id: this.detailId
- }, res => {
- this.modelsLoading = false;
- if (res.code == "ok") {
- this.update = res.data.update;
- this.download = res.data.download;
- this.view = res.data.view;
- this.approve = res.data.approve;
- var list = res.data.vo;
- var approves = res.data.vo.approves;
- for(var i in approves){
- if(approves[i].subordinateType == 0){
- list.ownerApprover = approves[i].approverName;
- } else {
- list.customerApprover = approves[i].approverName;
- }
- }
- this.proDetail = list;
- if(this.user.parentId != 0){
- this.getMsg();
- this.getStaff();
- }
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.modelsLoading = false;
- this.$message({
- message: error,
- type: 'error'
- });
- })
- },
- getFileList() {
- this.listLoading = true;
- // 获取文档列表
- this.http.post(this.port.project.fileList, {
- projectId: this.detailId
- }, res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.files = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: 'error'
- });
- })
- },
- getOperList() {
- this.oplistLoading = true;
- // 获取文档列表
- this.http.post(this.port.project.operList, {
- projectId: this.detailId
- }, res => {
- this.oplistLoading = false;
- if (res.code == "ok") {
- this.opers = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.oplistLoading = false;
- this.$message({
- message: error,
- type: 'error'
- });
- })
- },
- //获取信息
- getMsg() {
- // 获取公司
- this.http.post(this.port.base.addCompanyListToProject, {
- parentId: this.user.parentId,
- id: this.user.id
- }, res => {
- if (res.code == "ok") {
- var list = res.data , array = [];
- for(var i in list){
- if(list[i].id != this.proDetail.ownerCompany){
- array.push(list[i])
- }
- }
- this.company = array;
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.$message({
- message: error,
- type: 'error'
- });
- })
- // 获取模具
- this.http.post(this.port.mold.chooseModelList, {
- projectId: this.detailId
- }, res => {
- if (res.code == "ok") {
- this.molds = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.$message({
- message: error,
- type: 'error'
- });
- })
- this.http.post(this.port.base.getProduceCompany, {
- projectId: this.detailId
- }, res => {
- if (res.code == "ok") {
- this.staffComp = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.$message({
- message: error,
- type: 'error'
- });
- })
- },
- doSomething(e){
- e.stopPropagation();
- },
- // 获取人员
- getStaff() {
- // 获取人员
- var compIds = this.proDetail.ownerCompany;
- for(var i in this.proDetail.customCompanies){
- compIds += "," + this.proDetail.customCompanies[i].companyId;
- }
- this.http.post(this.port.project.getUserById, {
- companyIds: compIds,
- id: this.user.id,
- projectId: this.detailId
- } , res => {
- if (res.code == "ok") {
- var list = res.data , assets = [] , produce = [];
- for(var i in list) {
- if(list[i].companyId == this.proDetail.ownerCompany){
- if(list[i].id != this.user.id){
- if(list[i].id != this.proDetail.managerId){
- assets.push(list[i])
- }
- }
- } else {
- produce.push(list[i])
- }
- }
- this.allUser = res.data;
- this.charger = res.data;
- this.assets = assets;
- this.produce = produce;
- this.general = res.data;
- this.setMember();
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.$message({
- message: error,
- type: 'error'
- });
- })
- },
- //切换人员
- changeStaff(i) {
- if(i == 0){
- var list = this.allUser , array = [];
- for(var i in list){
- if(list[i].id != this.editForm.customerApproverId && list[i].id != this.editForm.managerId.id && list[i].id != this.editForm.ownerApproverId){
- array.push(list[i])
- }
- }
-
- this.general = array;
- } else if(i == 1) {
- var list = this.allUser , str = this.editForm.users.toString() , array = [] , assets = [] , produce = [];
- for(var i in list) {
- if(str.indexOf(list[i].id) == -1) {
- array.push(list[i]);
- }
- }
- for(var i in list) {
- if(str.indexOf(list[i].id) == -1) {
- if(list[i].subordinateType == 0){
- assets.push(list[i])
- } else {
- produce.push(list[i])
- }
- }
- }
- this.charger = array;
- this.assets = assets;
- this.produce = produce;
- }
- },
- //选择公司切换人员
- companyChange() {
- var param = {} ,
- str = this.proDetail.ownerCompany;
- for(var i in this.editForm.modelIds){
- str += "," + this.editForm.modelIds[i].produceCompanyId;
- }
- param.companyIds = str;
- param.id = this.user.id;
- param.projectId = this.detailId;
- this.http.post(this.port.project.getUserById, param , res => {
- if (res.code == "ok") {
- var list = res.data , assets = [] , produce = [];
- for(var i in list) {
- if(list[i].companyId == this.proDetail.ownerCompany){
- if(list[i].id != this.user.id){
- if(list[i].id != this.proDetail.managerId){
- assets.push(list[i])
- }
- }
- } else {
- produce.push(list[i])
- }
- }
- this.editForm.managerId = "";
- this.editForm.customerApproverId = "";
- this.editForm.users = [];
- this.allUser = res.data;
- this.charger = res.data;
- this.assets = assets;
- this.produce = produce;
- this.general = res.data;
- this.setMember();
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.$message({
- message: error,
- type: 'error'
- });
- })
- },
- //打开编辑页面
- edit() {
- var compArr = [] ,
- manager = {} ,
- ownerApproverId = '' ,
- customerApproverId = '' ,
- moldArr = [] ,
- assets = [] ,
- produce = [] ,
- users = [];
- for(var i in this.proDetail.customCompanies){
- for(var j in this.company){
- if(this.company[j].id == this.proDetail.customCompanies[i].companyId){
- compArr.push(this.company[j])
- }
- }
- }
- for(var i in this.charger){
- if(this.charger[i].id == this.proDetail.managerId){
- manager = this.charger[i];
- }
- }
- for(var i in this.proDetail.approves) {
- if(this.proDetail.approves[i].subordinateType == 0){
- ownerApproverId = this.proDetail.approves[i].approverId;
- } else {
- customerApproverId = this.proDetail.approves[i].approverId;
- }
- }
- for(var i in this.molds){
- for(var j in this.proDetail.models){
- if(this.molds[i].id == this.proDetail.models[j].id){
- moldArr.push(this.proDetail.models[j])
- }
- }
- }
- for(var i in this.proDetail.participateUsers){
- users.push(this.proDetail.participateUsers[i].id)
- }
- this.editForm = {
- id: this.proDetail.id,
- projectName: this.proDetail.projectName,
- customerCompany: compArr,
- managerId: manager,
- ownerApproverId: ownerApproverId,
- customerApproverId: customerApproverId,
- modelIds: moldArr,
- users: users
- }
- this.setMember();
- this.editFormVisible = true;
- },
- setMember() {
- var list = this.allUser , array = [];
- for(var i in list){
- if(list[i].id != this.editForm.customerApproverId && list[i].id != this.editForm.managerId.id && list[i].id != this.editForm.ownerApproverId){
- array.push(list[i])
- }
- }
- this.general = array;
- var list = this.allUser , str = this.editForm.users.toString() , newArray = [] , assets = [] , produce = [];
- for(var i in list) {
- if(str.indexOf(list[i].id) == -1) {
- newArray.push(list[i]);
- }
- }
- for(var i in list) {
- if(str.indexOf(list[i].id) == -1) {
- if(list[i].subordinateType == 0){
- assets.push(list[i])
- } else {
- produce.push(list[i])
- }
- }
- }
- this.charger = newArray;
- this.assets = assets;
- this.produce = produce;
- },
- //提交
- addSubmit() {
- this.$refs.editForm.validate((valid) => {
- if (valid) {
- var cId = "",
- cName = "",
- modelIds = "",
- userIds = "";
- for(var i in this.editForm.modelIds){
- if(cId.indexOf(this.editForm.modelIds[i].produceCompanyId) == -1){
- cId += this.editForm.modelIds[i].produceCompanyId + ",";
- cName += this.editForm.modelIds[i].produceCompanyName + ",";
- }
- modelIds += this.editForm.modelIds[i].id + ","
- }
- cId = cId.substring(0,cId.length-1);
- cName = cName.substring(0,cName.length-1);
- modelIds = modelIds.substring(0,modelIds.length-1);
- // for(var i in this.editForm.assets){
- // if(i == this.editForm.assets.length -1){
- // userIds += this.editForm.assets[i]
- // } else {
- // userIds += this.editForm.assets[i] + ","
- // }
- // }
-
- // if(userIds != "" && this.editForm.produce.length != 0){
- // userIds += ","
- // }
- // for(var i in this.editForm.produce){
- // if(i == this.editForm.produce.length -1){
- // userIds += this.editForm.produce[i]
- // } else {
- // userIds += this.editForm.produce[i] + ","
- // }
- // }
- for(var i in this.editForm.users) {
- if(i == this.editForm.users.length -1){
- userIds += this.editForm.users[i]
- } else {
- userIds += this.editForm.users[i] + ","
- }
- }
- this.editLoading = true;
- this.http.post(this.port.project.addProject, {
- id: this.editForm.id,
- projectName: this.editForm.projectName,
- customerCompanyIds: cId,
- customerCompanyNames: cName,
- manager: this.editForm.managerId.username,
- managerId: this.editForm.managerId.id,
- ownerApproverId: this.editForm.ownerApproverId,
- customerApproverId: this.editForm.customerApproverId,
- modelIds: modelIds,
- userIds: userIds,
- flag: 1
- } , res => {
- this.editLoading = false;
- this.editFormVisible = false;
- if (res.code == "ok") {
- this.$message({
- message: this.$t('prompt.success'),
- type: 'success'
- });
- this.getDetail();
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.editLoading = false;
- this.editFormVisible = false;
- this.$message({
- message: error,
- type: 'error'
- });
- })
- }
- });
- },
- //打开新增人员
- addStaff() {
- this.addFormVisible = true;
- this.addForm = {
- parentId: this.user.id,
- username: '',
- account: '',
- companyId: '',
- roleName: '',
- projectIds: this.detailId,
- flag: 0
- };
- },
- addPeople(i) {
- this.$refs.addForm.validate((valid) => {
- if (valid) {
- if(i == 0){
- this.addLoading = true;
- }
- this.http.post(this.port.project.addUser, this.addForm , res => {
- if(i == 0){ this.addLoading = false; }
- else { this.$refs.addForm.resetFields();this.addForm.roleName = "" }
- if (res.code == "ok") {
- if(i == 0){ this.addFormVisible = false; }
- this.getStaff();
- this.$message({
- message: this.$t('prompt.success2'),
- type: 'success'
- });
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- if(i == 0){ this.addLoading = false;this.addFormVisible = false; }
- else { this.$refs.addForm.resetFields();this.addForm.roleName = "" }
- this.$message({
- message: error,
- type: 'error'
- });
- })
- }
- });
- },
- //上传
- uploadFile(params) {
- this.upLoading = true;
- var fileObj = params.file;
- var form = new FormData();
- form.append("projectId", this.proDetail.id);
- form.append("file", fileObj);
- this.http.uploadFile(this.port.project.uploadFile, form , res => {
- this.upLoading = false;
- this.$refs.upload.clearFiles();
- if (res.code == "ok") {
- this.$message({
- message: this.$t('prompt.success4'),
- type: 'success'
- });
- this.getFileList();
- this.getOperList();
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.upLoading = false;
- this.$refs.upload.clearFiles();
- this.$message({
- message: error,
- type: 'error'
- });
- })
- },
- //下载
- dowloadFile(row) {
- this.http.post(this.port.project.dowloadFile, {
- id: row.id
- } , res => {
- // const elink = document.createElement('a')
- // elink.download = row.fileName
- // elink.style.display = 'none'
- // const blob = new Blob([res])
- // elink.href = URL.createObjectURL(blob)
- // document.body.appendChild(elink)
- // elink.click()
- // document.body.removeChild(elink)
- this.getOperList();
- }, error => {
- })
- },
- //删除上传文件
- fileDel(id) {
- this.$confirm(this.$t('project.delFile'), this.$t('el.messagebox.title'), {
- confirmButtonText: this.$t('el.messagebox.confirm'),
- cancelButtonText: this.$t('el.messagebox.cancel'),
- type: 'warning'
- }).then(() => {
- this.http.post(this.port.project.delFile, {
- id: id
- }, res => {
- if (res.code == "ok") {
- this.$message({
- message: this.$t('prompt.success3'),
- type: 'success'
- });
- this.getFileList();
- this.getOperList();
- } else {
- this.$message({
- message: res.msg,
- type: 'error'
- });
- }
- }, error => {
- this.$message({
- message: error,
- type: 'error'
- });
- })
- });
- },
- },
- created() {
- let height = window.innerHeight;
- this.allDetail.height = height - 170 + "px";
- const that = this;
- window.onresize = function temp() {
- that.allDetail.height = window.innerHeight - 170;
- };
- },
- mounted() {
- this.getDetail();
- this.getFileList();
- this.getOperList();
- }
- };
- </script>
- <style scoped>
- a {
- text-decoration:none;
- color: #333;
- }
- .allDetail {
- overflow-y: auto;
- }
- .toolbar .el-form-item {
- font-size: 14px;
- vertical-align: middle;
- }
- .back {
- font-size:16px;
- }
- .divLine {
- width: 2px;
- background: #c3c3c3;
- height: 100%;
- }
- .projectTitle {
- font-size: 18px;
- color: #333;
- }
- .title {
- padding-left: 10px;
- padding-bottom: 0px;
- margin: 20px 0;
- font-size: 16px;
- line-height: 24px;
- border-left: 1px #20a0ff solid;
- position: relative;
- }
- .upload-demo {
- position: absolute;
- right: 0;
- top: -5px;
- }
- .editDetail {
- margin-left: 10px;
- color:#20a0ff;
- cursor: pointer;
- }
- .info {
- color: grey;
- }
- .model {
- cursor: pointer;
- color:#20a0ff;
- }
- .main {
- padding-left: 10px;
- }
- .detail {
- margin-bottom: 20px;
- }
- .el-collapse {
- border: none;
- }
- </style>
|