123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716 |
- <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">返回</el-button>
- </el-form-item>
- <el-form-item class="divLine"></el-form-item>
- <el-form-item>
- <span class="projectTitle">{{moldDetail.modelName}}</span>
- </el-form-item>
- <el-form-item class="state">
- 当前状态:
- <a style="color: #999999; cursor: pointer" @click="toDetection" v-if="moldDetail.state == 0">静止</a>
- <a style="color: #00CD66; cursor: pointer" @click="toDetection" v-if="moldDetail.state == 1">运行</a>
- <span class="tips">(点击查看运行状态)</span>
- </el-form-item>
- </el-form>
- </el-col>
- <!-- 主区域 -->
- <el-col :span="24" :style="allDetail">
- <el-col :span="24" class="title">
- 模具基本信息
- <!-- <i class="el-icon-edit editDetail" v-if="user.id == moldDetail.managerId || user.id == moldDetail.creatorId" @click="edit"></i> -->
- </el-col>
- <el-col :span="24" class="main">
- <el-col :span="6" class="detail">
- 模具编号:
- <span class="info">{{moldDetail.modelNo}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- 云模盒编号:
- <span class="info">{{moldDetail.equipmentNo}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- 设备电量:
- <span class="info">{{moldDetail.hillNumber}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- 倒计时:
- <span class="info">{{moldDetail.diffTime}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- 初始模次:
- <span class="info">{{moldDetail.initialModulus}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- 模次寿命:
- <span class="info">{{moldDetail.settingLife}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- 对应RFID码:
- <span class="info">{{moldDetail.rfid}}</span>
- </el-col>
- <el-col :span="6" class="detail">
- 穴数:
- <span class="info">{{moldDetail.holes}}</span>
- </el-col>
- <el-col :span="12" class="detail">
- 所属项目:
- <span class="info belongPro" @click="toPro(moldDetail.projectId)">{{moldDetail.projectName}}</span>
- </el-col>
- <el-col :span="24" class="detail">
- 生产方:
- <!-- <span class="info" v-for="(item, index) in customCompany">
- {{item.companyName}}
- <span v-if="index != customCompany.length-1">、</span>
- </span> -->
- <span class="info">{{moldDetail.produceCompany}}</span>
- </el-col>
- <el-col :span="24" class="detail">
- 生产方地址:
- <!-- <span class="info" v-for="(item, index) in customCompany">
- {{item.companyName}}
- <span v-if="index != customCompany.length-1">、</span>
- </span> -->
- <span class="info">{{moldDetail.area}}</span>
- </el-col>
- </el-col>
- <el-col :span="24" class="title">
- 文档资料
- <!-- 上传 模具0 时 -->
- <el-dropdown trigger="click" style="float: right;" v-show="activeTab == 0 && update == 1">
- <el-button size="mini" type="primary" :loading="uploading">
- 上传
- <i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-upload ref="upload" action="customize" :http-request="uploadFile" :show-file-list="false" multiple :limit="5" style="float:right;">
- <el-dropdown-item @click.native="fileType = 0">2D图档</el-dropdown-item>
- <el-dropdown-item @click.native="fileType = 1">3D图档</el-dropdown-item>
- </el-upload>
- </el-dropdown-menu>
- </el-dropdown>
-
- <!-- 上传 零件1 时 -->
- <el-button size="mini" type="primary" style="float:right;" v-show="activeTab == 1 && update == 1" @click.native="fileType = 0;centerDialog4Visible = true;">
- 上传
- </el-button>
- <!-- 零件1 新建零件 -->
- <el-dropdown trigger="click" style="float: right; margin-right: 10px;" v-show=" activeTab == 1 && update == 1">
- <el-button size="mini" type="primary">
- 新建零件
- <i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="centerDialog3Visible = true">单个新建</el-dropdown-item>
- <el-dropdown-item>
- <a class="download" href="/upload/零件信息导入模板示例.xlsx" download="零件信息导入模板示例.xlsx">
- 下载模板
- </a>
- </el-dropdown-item>
- <el-dropdown-item>
- <el-upload ref="upload" action="customize" :http-request="uploadPart" :show-file-list="false" :limit="1">
- 批量导入
- </el-upload>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <!-- 上传 试模2 保养3 时 -->
- <el-upload ref="upload"
- v-show="(activeTab == 2 || activeTab == 3) && update == 1"
- action="customize"
- :http-request="uploadFile"
- :show-file-list="false"
- multiple
- :limit="5"
- style="float:right;"
- >
- <el-button size="mini" type="primary" :loading="uploading">上传</el-button>
- </el-upload>
- <!-- 更新4 -->
- <el-button
- v-show="activeTab == 4 && user.id == moldDetail.managerId && canInitiate && updateAble"
- size="mini"
- type="primary"
- style="float: right;"
- @click="updateRequest"
- >申请</el-button>
-
- <!-- 上传 报废5 时 -->
- <el-button
- v-show="activeTab == 5 && update == 1 && abandonAble && moldDetail.managerId == user.id"
- size="mini"
- type="primary"
- style="float: right;"
- @click="centerDialog2Visible = true;"
- >上传</el-button>
- </el-col>
- <!-- 文档列表部分 -->
- <el-col :span="24">
- <el-tabs v-model="activePage" @tab-click="handleClick">
- <!-- 模具文档 -->
- <el-tab-pane label="模具文档" name="0">
- <el-table
- :data="documents.mould"
- 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="名称" sortable></el-table-column>
- <el-table-column prop="fileSize" label="大小" width="200" align="center" sortable></el-table-column>
- <el-table-column prop="uploadtor" label="上传者" width="200" align="center" sortable></el-table-column>
- <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
- <el-table-column label="状态" width="120" align="center" sortable>
- <template slot-scope="scope">
- <span v-if="scope.row.state == -2">生产方审核不通过</span>
- <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
- <span v-else-if="scope.row.state == 0">待双方审核</span>
- <span v-else-if="scope.row.state == 1">待生产方审核</span>
- <span v-else-if="scope.row.state == 2">待资产方审核</span>
- <span v-else-if="scope.row.state == 3">审核通过</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" align="center" sortable>
- <template slot-scope="scope">
- <el-button size="small"
- v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
- @click="checkOpen(scope.row)">审批</el-button>
- <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
- <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
- </a>
- <el-button size="small"
- v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
- @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- <!-- 零件文档 -->
- <el-tab-pane label="零件文档" name="1">
- <el-table
- :data="documents.part"
- highlight-current-row
- v-loading="listLoading"
- style="width: 100%;"
- >
- <el-table-column type="index" width="40"></el-table-column>
- <el-table-column prop="partNo" label="零件编号" width="150" sortable></el-table-column>
- <el-table-column prop="partName" label="零件名称" sortable></el-table-column>
- <el-table-column prop="partLife" label="寿命次数" align="center" width="100" sortable></el-table-column>
- <el-table-column prop="isVulnerable" label="易损件" align="center" width="100" sortable>
- <template slot-scope="scope">{{scope.row.isVulnerable==0?'否':'是'}}</template>
- </el-table-column>
- <el-table-column prop="part3dFile.fileName" label="3D图档" width="200" sortable>
- <template slot-scope="scope" v-if="scope.row.part3dFile != null">
- <a v-if="scope.row.state == 3 && download == 1" class="download" :href="scope.row.part3dFile.fileUrl" target="_blank">{{scope.row.part3dFile.fileName}}</a>
- <span v-else>{{scope.row.part2dFile.fileName}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="part2dFile.fileName" label="2D图档" width="200" sortable>
- <template slot-scope="scope" v-if="scope.row.part2dFile != null">
- <a v-if="scope.row.state == 3 && download == 1" class="download" :href="scope.row.part2dFile.fileUrl" :download="scope.row.part2dFile.fileName">{{scope.row.part2dFile.fileName}}</a>
- <span v-else>{{scope.row.part2dFile.fileName}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="indate" label="上传时间" width="200" align="center" sortable></el-table-column>
- <el-table-column label="状态" width="120" align="center" sortable>
- <template slot-scope="scope">
- <span v-if="scope.row.state == -2">生产方审核不通过</span>
- <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
- <span v-else-if="scope.row.state == 0">待双方审核</span>
- <span v-else-if="scope.row.state == 1">待生产方审核</span>
- <span v-else-if="scope.row.state == 2">待资产方审核</span>
- <span v-else-if="scope.row.state == 3">审核通过</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" align="center" sortable>
- <template slot-scope="scope">
- <el-button size="small"
- v-if="approve == 1 && (scope.row.state == 0
- || (scope.row.state == 1 && user.subordinateType == 1)
- || (scope.row.state == 2 && user.subordinateType == 0))"
- @click="checkOpenPort(scope.row)">审批</el-button>
- <el-button size="small" @click="editPort(scope.row)" v-if="scope.row.creatorId == user.id">
- 修改
- </el-button>
- <!-- <el-button size="small" @click="dowloadfile(scope.row.id)" v-if="download == 1 && scope.row.state == 3 ">
- <a :href="scope.row.fileUrl" :download="scope.row.fileName">下载 </a>
- </el-button> -->
- <!-- <el-button size="small"
- v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
- @click="deleteFile(scope.row.id)" type="danger">删除</el-button> -->
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- <!-- 试模及验收 -->
- <el-tab-pane label="试模及验收" name="2">
- <el-table
- :data="documents.check"
- 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="名称" sortable></el-table-column>
- <el-table-column prop="fileSize" label="大小" width="200" sortable></el-table-column>
- <el-table-column prop="uploadtor" label="上传者" width="200" sortable></el-table-column>
- <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
- <el-table-column label="状态" width="120" sortable>
- <template slot-scope="scope">
- <span v-if="scope.row.state == -2">生产方审核不通过</span>
- <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
- <span v-else-if="scope.row.state == 0">待双方审核</span>
- <span v-else-if="scope.row.state == 1">待生产方审核</span>
- <span v-else-if="scope.row.state == 2">待资产方审核</span>
- <span v-else-if="scope.row.state == 3">审核通过</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" sortable>
- <template slot-scope="scope">
- <el-button size="small"
- v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
- @click="checkOpen(scope.row)">审批</el-button>
- <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
- <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
- </a>
- <el-button size="small"
- v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
- @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- <!-- 保养方案 -->
- <el-tab-pane label="保养方案" name="3">
- <el-table
- :data="documents.maintain"
- 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="名称" sortable></el-table-column>
- <el-table-column prop="fileSize" label="大小" width="200" sortable></el-table-column>
- <el-table-column prop="uploadtor" label="上传者" width="200" sortable></el-table-column>
- <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
- <el-table-column label="状态" width="120" sortable>
- <template slot-scope="scope">
- <span v-if="scope.row.state == -2">生产方审核不通过</span>
- <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
- <span v-else-if="scope.row.state == 0">待双方审核</span>
- <span v-else-if="scope.row.state == 1">待生产方审核</span>
- <span v-else-if="scope.row.state == 2">待资产方审核</span>
- <span v-else-if="scope.row.state == 3">审核通过</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" sortable>
- <template slot-scope="scope">
- <el-button size="small"
- v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
- @click="checkOpen(scope.row)">审批</el-button>
- <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
- <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
- </a>
- <el-button size="small"
- v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
- @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- <!-- 模具更新 -->
- <el-tab-pane label="模具更新" name="4">
- <el-table :data="documents.update" highlight-current-row v-loading="listLoading" style="width: 100%;">
- <el-table-column type="index" width="40"></el-table-column>
- <el-table-column prop="uploadtor" label="申请人" sortable></el-table-column>
- <el-table-column prop="indate" label="申请时间" width="200" sortable></el-table-column>
- <el-table-column label="状态" width="120" sortable>
- <template slot-scope="scope">
- <span v-if="scope.row.state == -2">生产方审核不通过</span>
- <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
- <span v-else-if="scope.row.state == 0">待双方审核</span>
- <span v-else-if="scope.row.state == 1">待生产方审核</span>
- <span v-else-if="scope.row.state == 2">待资产方审核</span>
- <span v-else-if="scope.row.state == 3">审核通过</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" sortable>
- <template slot-scope="scope">
- <el-button size="small" @click="checkUpdate(scope.row.id, true)" type="primary"
- v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
- >通过</el-button>
- <el-button size="small" @click="checkUpdate(scope.row.id, false)" type="danger"
- v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
- >不通过</el-button>
- <el-button size="small" @click="showAdd(scope.row.id)" type="primary"
- v-if="scope.row.uplodtorId == user.id && scope.row.state == 3 && moldDetail.equipmentNo != null">更新模具</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- <!-- 模具报废 -->
- <el-tab-pane label="模具报废" name="5">
- <el-table :data="documents.abandon" 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="申请单名称" sortable>
- <template slot-scope="scope" v-if="scope.row.fileUrl != null">
- <a v-if="download == 1 && scope.row.state == 3" :href="scope.row.fileUrl" :download="scope.row.fileName" @click="dowloadfile(scope.row.id)">
- {{scope.row.fileName}}
- </a>
- <span v-else>{{scope.row.fileName}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="fileSize" label="申请单大小" width="130" sortable></el-table-column>
- <el-table-column prop="fileName2" label="报废单名称" sortable>
- <template slot-scope="scope" v-if="scope.row.fileUrl != null">
- <a v-if="download == 1 && scope.row.state == 3" :href="scope.row.fileUrl2" :download="scope.row.fileName2" @click="dowloadfile(scope.row.id)">
- {{scope.row.fileName2}}
- </a>
- <span v-else>{{scope.row.fileName2}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="fileSize2" label="报废单大小" width="130" sortable></el-table-column>
- <el-table-column prop="uploadtor" label="上传者" width="150" sortable></el-table-column>
- <el-table-column prop="indate" label="上传时间" width="180" sortable></el-table-column>
- <el-table-column label="状态" width="120" sortable>
- <template slot-scope="scope">
- <span v-if="scope.row.state == -2">生产方审核不通过</span>
- <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
- <span v-else-if="scope.row.state == 0">待双方审核</span>
- <span v-else-if="scope.row.state == 1">待生产方审核</span>
- <span v-else-if="scope.row.state == 2">待资产方审核</span>
- <span v-else-if="scope.row.state == 3">审核通过</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" sortable>
- <template slot-scope="scope">
- <el-button size="small"
- v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
- @click="checkOpen(scope.row)">审批</el-button>
- <el-button size="small"
- v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
- @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tab-pane>
- </el-tabs>
- </el-col>
- <!-- 操作记录 -->
- <el-col :span="24" class="title">
- {{activeTab == 4?"更新":"操作"}}记录
- <el-button v-if="(user.subordinateType == 0 || user.subordinateType == 1 || user.id == moldDetail.managerId) && activeTab != 4" size="mini" type="primary" style="float: right;" @click="centerDialog5Visible = true;recordTime=''">导出</el-button>
- </el-col>
- <el-table v-show="activeTab != 4" :data="operations" highlight-current-row v-loading="listLoading" style="width: 100%;">
- <el-table-column type="index" width="40"></el-table-column>
- <el-table-column prop="content" label="操作" width="120" sortable></el-table-column>
- <el-table-column v-if="activeTab!= 4" prop="fileName" label="操作文档名称" sortable></el-table-column>
- <el-table-column prop="operatorName" label="操作人" align="center" width="120" sortable></el-table-column>
- <el-table-column prop="indate" label="操作时间" width="200" align="center" sortable></el-table-column>
- </el-table>
- <el-table v-show="activeTab == 4" :data="operations" highlight-current-row v-loading="listLoading" style="width: 100%;">
- <el-table-column type="index" width="40"></el-table-column>
- <el-table-column label="模具编号" sortable>
- <template slot-scope="scope">
- <span @click="toAnotherMould(scope.row.mouldId)" style="cursor: pointer;color: #409eff;">{{scope.row.mouldNo}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="applicantName" label="申请人" align="center" width="200" sortable></el-table-column>
- <el-table-column prop="operatorName" label="审批人" align="center" width="200" sortable></el-table-column>
- <el-table-column label="状态" align="center" sortable>
- <template slot-scope="scope">
- <span v-if="scope.row.isPass == 1">已通过</span>
- <span v-else>未通过</span>
- </template>
- </el-table-column>
- <el-table-column prop="indate" label="时间" width="400" align="center" sortable></el-table-column>
- </el-table>
- </el-col>
- <!-- 审批弹窗 -->
- <el-dialog title="审批" :visible.sync="centerDialogVisible" width="450px">
- <a v-if="this.activeFileName != null && this.fileUrl2 == null" :href="this.fileUrl" :download="this.activeFileName"><el-link type="primary">{{this.activeFileName}}</el-link></a>
- <div v-if="this.fileUrl2 != null">
- <div v-if="this.activeFileName != null">
- 申请单:<a :href="this.fileUrl" :download="this.activeFileName"><el-link type="primary">{{this.activeFileName}}</el-link></a>
- </div>
- <br>
- <div v-if="this.fileUrl2 != null">
- 报废单:<a :href="this.fileUrl2" :download="this.fileUrl2Name"><el-link type="primary">{{this.fileUrl2Name}}</el-link></a>
- </div>
- </div>
- <div v-else>
- <div v-if="this.part2dFile != null">
- 2D:<a :href="this.part2dFile.fileUrl" :download="this.part2dFile.fileName"><el-link type="primary">{{this.part2dFile.fileName}}</el-link></a>
- </div>
- <br>
- <div v-if="this.part2dFile != null">
- 3D:<a :href="this.part3dFile.fileUrl" :download="this.part3dFile.fileName"><el-link type="primary">{{this.part3dFile.fileName}}</el-link></a>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="check(false)">不通过</el-button>
- <el-button type="primary" @click="check(true)">通过</el-button>
- </span>
- </el-dialog>
- <!-- 模具报废上传弹窗 -->
- <el-dialog title="模具报废上传" :visible.sync="centerDialog2Visible" width="450px" :before-close="clearFileRecord">
- <p style="height:60px;">
- <span style="float:left;margin-right:30px;">申请单</span>
- <el-upload ref="upload1" action="customize" :http-request="uploadDiscardFile1" :limit="1" :before-remove="beforeRemove1" style="float:left">
- <el-button size="small" type="primary">上传</el-button>
- </el-upload>
- </p>
- <p style="height:60px;">
- <span style="float:left;margin-right:30px;">报废单</span>
- <el-upload ref="upload2" action="customize" :http-request="uploadDiscardFile2" :limit="1" :before-remove="beforeRemove2" style="float:left">
- <el-button size="small" type="primary">上传</el-button>
- </el-upload>
- </p>
- <span slot="footer" class="dialog-footer">
- <el-button @click="discardUpload" :loading="uploading">确定</el-button>
- </span>
- </el-dialog>
- <!-- 零件文档上传弹窗 -->
- <el-dialog title="零件文档上传" v-if="centerDialog4Visible" :visible.sync="centerDialog4Visible" width="450px" :before-close="clearFileRecord2">
- <p style="color:#ccc;">文件命名规则:零件编号+2D/3D 如 LJ001+2D.dwg</p>
- <el-upload ref="upload4" action="uploadFile" :http-request="uploadPartFile" :show-file-list="true" :before-remove="beforeRemove" multiple>
- <el-button size="small" type="primary" :loading="uploading">上传</el-button>
- </el-upload>
- <span slot="footer" class="dialog-footer">
- <el-button @click="uploadFilePart" :loading="uploading">确定</el-button>
- </span>
- </el-dialog>
- <!-- 批量导出操作记录弹窗 -->
- <el-dialog title="批量导出操作记录" v-if="centerDialog5Visible" :visible.sync="centerDialog5Visible" width="450px">
- <div style="text-align:center;">
- <el-date-picker v-model="recordTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="centerDialog5Visible = false">取消</el-button>
- <el-button type="primary" @click="exportRecords">确定</el-button>
- </span>
- </el-dialog>
- <!-- 单个新增零件弹窗 -->
- <el-dialog title="新增零件" v-if="centerDialog3Visible" :visible.sync="centerDialog3Visible" :close-on-click-modal="false" customClass="customWidth">
- <el-form :model="newParts" label-width="100px" :rules="formRules" ref="newParts" :inline="true" class="demo-form-inline">
- <el-form-item label="零件编号" prop="number">
- <el-input v-model="newParts.number" autocomplete="off" placeholder="请输入零件编号"></el-input>
- </el-form-item>
- <el-form-item label="零件名称" prop="name">
- <el-input v-model="newParts.name" autocomplete="off" placeholder="请输入零件名称"></el-input>
- </el-form-item>
- <el-form-item label="零件寿命" prop="life">
- <el-input v-model="newParts.life" autocomplete="off" placeholder="请输入零件寿命"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="centerDialog3Visible = false">取消</el-button>
- <el-button type="primary" @click.native="subPart" :loading="editLoading">提交</el-button>
- </div>
- </el-dialog>
- <!-- 单个编辑零件弹窗 -->
- <el-dialog title="编辑零件" v-if="editPortVisible" :visible.sync="editPortVisible" :close-on-click-modal="false" customClass="customWidth">
- <el-form :model="editParts" label-width="100px" :rules="formRules" ref="editParts" :inline="true" class="demo-form-inline">
- <el-form-item label="零件编号" prop="number">
- <el-input v-model="editParts.number" autocomplete="off" placeholder="请输入零件编号"></el-input>
- </el-form-item>
- <el-form-item label="零件名称" prop="name">
- <el-input v-model="editParts.name" autocomplete="off" placeholder="请输入零件名称"></el-input>
- </el-form-item>
- <el-form-item label="零件寿命" prop="life">
- <el-input v-model="editParts.life" autocomplete="off" placeholder="请输入零件寿命"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="editPortVisible = false">取消</el-button>
- <el-button type="primary" @click.native="editPartVisible" :loading="editLoading">提交</el-button>
- </div>
- </el-dialog>
- <!--更新界面-->
- <el-dialog title="更新模具" 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="模具名称" prop="modelName">
- <el-input v-model="addForm.modelName" autocomplete="off" placeholder="请输入模具名称"></el-input>
- </el-form-item>
- <el-form-item label="初始模次" prop="initialModulus">
- <el-input v-model="addForm.initialModulus" autocomplete="off" placeholder="请输入初始模次"></el-input>
- </el-form-item>
- <el-form-item label="模次寿命" prop="settingLife">
- <el-input v-model="addForm.settingLife" autocomplete="off" placeholder="请输入模次寿命"></el-input>
- </el-form-item>
- <el-form-item label="RIFD码" prop="rfid">
- <el-input v-model="addForm.rfid" autocomplete="off" placeholder="请输入RIFD码"></el-input>
- </el-form-item>
- <el-form-item label="穴数" prop="holes">
- <el-input v-model="addForm.holes" autocomplete="off" placeholder="请输入穴数"></el-input>
- </el-form-item>
- <el-form-item label="保养次数" prop="maintainCount">
- <el-select v-model="addForm.maintainCount" clearable multiple allow-create filterable default-first-option placeholder="请选择保养次数" style="width:515px">
- <el-option v-for="item in maintainCount" :key="item" :label="item" :value="item"></el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="addFormVisible = false">取消</el-button>
- <el-button type="primary" @click.native="inviteSubmit" :loading="addLoading">提交</el-button>
- </div>
- </el-dialog>
- </section>
- </template>
- <script>
- import util from "../../common/js/util";
- export default {
- data() {
- const checkLife = (rule, value, callback) => {
- if (!value) {
- return callback(new Error('请输入零件寿命次数'));
- } else {
- if((/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(value) == false){
- callback(new Error("请填写大于0的数字"));
- }else{
- if (value > 100000000) {
- callback(new Error("请填写小于等于1亿的数字"));
- }else{
- callback();
- }
- }
- }
- };
- return {
- detailId: this.$route.params.id,
- user: JSON.parse(sessionStorage.getItem("user")),
- moldDetail: {},
- customCompany: [],
- //操作记录的时间
- recordTime: "",
- //单独新增零件时所需的三个变量
- newParts: {
- number: "",
- name: "",
- life: ""
- },
- uploading: false,
- editParts: {
- id: 0,
- number: "",
- name: "",
- life: ""
- },
- maintainCount: [5000,10000],
- formRules: {
- modelName: [
- { required: true, message: "请输入模具名称", trigger: "blur" }
- ],
- initialModulus: [
- { required: true, message: "请输入初始模次", trigger: "blur" }
- ],
- settingLife: [
- { required: true, message: "请输入模次寿命", trigger: "blur" }
- ],
- rfid: [
- { required: true, message: "请输入RIFD码", trigger: "blur" }
- ],
- holes: [
- { required: true, message: "请输入穴数", trigger: "blur" }
- ],
- maintainCount: [
- { required: true, message: "请输入保养次数", trigger: ["blur", "change"] }
- ],
- number: [
- { required: true, message: "请输入零件编号", trigger: "blur" }
- ],
- name: [
- { required: true, message: "请输入零件名称", trigger: "blur" }
- ],
- life: [
- // { required: true, message: "请输入零件寿命次数", trigger: "blur" }
- { required: true, validator: checkLife, trigger: 'blur'}
- ],
- },
- //权限
- update: 0,
- download: 0,
- view: 0,
- approve: 0,
- canInitiate: true,
- //根据状态判断能否更新
- updateAble: true,
- //能否进行报废
- abandonAble: false,
- //6种文档
- documents: {
- mould: [],
- part: [],
- check: [],
- maintain: [],
- update: [],
- abandon: []
- },
- //2D还是3D
- fileType: 1,
- //操作记录
- operations: [],
- allDetail: {
- overflow: "auto",
- padding: "0px 5px",
- height: 0
- },
- centerDialogVisible: false, //审批界面
- centerDialog2Visible: false, //模具界面
- centerDialog3Visible: false, //创建零件界面
- centerDialog4Visible: false, //零件文档上传界面
- centerDialog5Visible: false, //批量导出操作界面
- editPortVisible: false,//编辑零件界面
- editLoading: false,
- listLoading: false,
- activeTab: 0,
- activePage: 0,
- activeArticleId: null,
- activeFileName: null,
- fileUrl: null,
- fileUrl2: null,
- fileUrl2Name: null,
- part2dFile: null,
- part3dFile: null,
-
- boxes: [],
- companys: [],
- projects: [],
- maintainCount: [5000,10000,15000,20000,25000],
- addLoading: false,
- addFormVisible: false,
- addForm: {
- modelName: "",
- initialModulus: "",
- settingLife: "",
- maintainCount: [],
- rfid: "",
- holes: "",
- },
- //零件文件
- files: [],
- //报废文件
- files2: [null, null],
- twoId: null,
- threeId: null,
- };
- },
- methods: {
- backToList() {
- this.$router.go(-1);
- },
- toDetection() {
- this.$router.push("/detection");
- },
- toPro(id) {
- this.$router.push('/project/' + id);
- },
- toAnotherMould(id){
- //简单粗暴的方法到另一个模具详情
- // var currentRoute = this.$route.path.split("/");
- // if (currentRoute.length == 3 && currentRoute[1] == "moldList") {
- // this.$router.go(0);
- // }
- // this.$router.replace('/moldList/' + id);
- //更加简单粗暴地方法
- this.detailId = id;
- this.getDetail();
- },
- //标签页面切换时
- handleClick(tab, event) {
- this.activeTab = tab.name;
- this.getOperationRecord(this.activeTab);
- },
- //意义不明的获取资产方公司的设备列表
- getMsg() {
- this.http.post( this.port.base.moulds, {
- belongCompanyId: this.user.companyId,
- mouldId: this.detailId
- },
- res => {
- if (res.code == "ok") {
- this.boxes = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //模具详情
- getDetail() {
- this.http.post( this.port.mold.moldDetail, {
- id: this.detailId
- },
- res => {
- if (res.code == "ok") {
- var detail = res.data.vo;
- if (detail.endTime == null) {
- detail.diffTime = "";
- } else {
- detail.diffTime = util.formatDate.dateDiff(
- util.formatDate.format(new Date(detail.endTime), "yyyy-MM-dd"),
- util.formatDate.format(new Date(new Date()), "yyyy-MM-dd")
- );
- }
- this.moldDetail = detail;
- this.customCompany = res.data.customCompany;
- this.update = res.data.update;
- this.download = res.data.download;
- this.view = res.data.view;
- this.approve = res.data.approve;
- this.getDocument();
- this.getPartList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //打开编辑
- edit() {
- this.editFormVisible = true;
- var maintainCount = this.moldDetail.maintainCount;
- maintainCount = maintainCount.split(",");
- this.editForm = {
- id: this.moldDetail.id,
- modelName: this.moldDetail.modelName,
- modelNo: this.moldDetail.modelNo,
- equipmentId: this.moldDetail.equipmentId,
- initialModulus: this.moldDetail.initialModulus,
- settingLife: this.moldDetail.settingLife,
- rfid: this.moldDetail.rfid,
- produceCompanyId: this.moldDetail.produceCompanyId,
- maintainCount: maintainCount,
- flag: 1
- };
- },
- addSubmit() {
- this.$refs.editForm.validate(valid => {
- if (valid) {
- this.editLoading = true;
- var maintainCount = this.editForm.maintainCount , str = "";
- for(var i in maintainCount) {
- if(i == maintainCount.length-1){
- str += maintainCount[i]
- } else {
- str += maintainCount[i] + ","
- }
- }
- this.editForm.maintainCount = str;
- this.http.post( this.port.mold.addMold, this.editForm,
- res => {
- this.editLoading = false;
- if (res.code == "ok") {
- this.editFormVisible = false;
- this.$message({
- message: "修改成功",
- 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"
- });
- });
- }
- });
- },
- //获取文档
- getDocument() {
- this.http.post( this.port.mold.moldFileListAll, {
- mouldId: this.detailId
- },
- res => {
- if (res.code == "ok") {
- for(var i in res.data){
- this.setList(res.data[i].list,i);
- }
- //顺便再把下面操作记录读取一下
- this.getOperationRecord(this.activeTab);
- //顺便再看看可不可以申请更新
- this.checkUpdateState();
- //顺便再看看能不能报废
- this.checkAbandonState();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //查看有无审核中或者审核成功的更新申请
- checkUpdateState(){
- this.updateAble = true;
- this.documents.update.forEach(item => {
- if(item.state != "-1" && item.state != "-2"){
- //有进行中的更新申请 现在不能再申请更新了
- this.updateAble = false;
- }
- });
- },
- //查看有无审核中或者审核成功的报废申请
- checkAbandonState(){
- this.abandonAble = true;
- this.documents.abandon.forEach(item => {
- if(item.state != "-1" && item.state != "-2"){
- //有进行中的报废申请 现在不能再申请报废了
- this.abandonAble = false;
- }
- });
- },
- //将list中对应的文件传入相应的document下
- setList(list, num) {
- var array = [];
- for(var i in list){
- if(this.approve == 1){
- array.push(list[i]);
- } else {
- if(list[i].uplodtorId == this.user.id){
- array.push(list[i]);
- }
- }
- }
- if(num == 0){
- this.documents.mould = array;
- } else if(num == 1) {
- //this.documents.part = array;
- } else if(num == 2) {
- this.documents.check = array;
- } else if(num == 3) {
- this.documents.maintain = array;
- } else if(num == 4) {
- for(var i in array){
- if(i == 0){
- if(array[i].state == 3){
- this.canInitiate = false
- } else if(array[i].state < 0) {
- this.canInitiate = true
- }
- }
- }
- this.documents.update = array;
- } else if(num == 5) {
- this.documents.abandon = array;
- }
- },
- //打开审批窗口
- checkOpen(row) {
- this.activeArticleId = row.id;
- this.activeFileName = row.fileName;
- this.fileUrl = row.fileUrl;
- this.fileUrl2 = row.fileUrl2;
- this.fileUrl2Name = row.fileName2;
- this.twoId = null;
- this.threeId = null;
- this.centerDialogVisible = true;
- },
- //打开审批窗口
- checkOpenPort(row) {
- this.part2dFile = null;
- this.part3dFile = null;
- if(row.part2dFile != null) {
- this.twoId = row.part2dFile.id
- this.part2dFile = row.part2dFile;
- }
- if(row.part3dFile != null) {
- this.threeId = row.part3dFile.id
- this.part3dFile = row.part3dFile;
- }
- this.activeArticleId = null;
- this.activeFileName = null;
- this.centerDialogVisible = true;
- this.fileUrl = null;
- this.fileUrl2 = null;
- this.fileUrl2Name = null;
- },
- //清理零件文档上传窗口中的文件
- clearFileRecord2() {
- this.centerDialog4Visible = false;
- this.$refs.upload4.clearFiles();
- },
- //审批文件
- check(adoption) {
- if(this.activeArticleId != null) {
- this.onSubMit(this.activeArticleId , adoption , 0)
- }
- if(this.twoId != null) {
- this.onSubMit(this.twoId , adoption , 1)
- }
- if(this.threeId != null) {
- this.onSubMit(this.threeId , adoption , 1)
- }
- },
- onSubMit(id , type , from) {
- this.http.post( this.port.mold.moldFileCheck, {
- mouldFileId: id,
- isPass: type ? 1 : 0 //通过为1 不通过为0
- },
- res => {
- if (res.code == "ok") {
- this.centerDialogVisible = false;
- this.$message({
- message: "审批成功",
- type: "success"
- });
- if(from == 0){
- this.getDocument();
- } else {
- this.getPartList();
- }
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- //更新审批通过
- checkUpdate(id, approval) {
- var tipString = "";
- if(approval){
- tipString = "确认通过审批吗?";
- }else{
- tipString = "确认不通过审批吗?";
- }
- this.$confirm(tipString, '审批', {
- type: approval?'success':'error'
- }).then(() => {
- this.http.post( this.port.mold.moldFileCheck, {
- mouldFileId: id,
- isPass: approval ? 1 : 0 //通过为1 不通过为0
- },
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "审批完成",
- type: "success"
- });
- this.getDocument();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- })
- },
- //文件上传
- uploadFile(params) {
- this.uploading = true;
- var fileObj = params.file;
- var form = new FormData();
- form.append("file", fileObj);
- form.append("belongType", this.activeTab);
- form.append("mouldId", this.detailId);
- if (this.activeTab == 0 || this.activeTab == 1) {
- form.append("dwgType", this.fileType);
- }
- this.http.uploadFile( this.port.mold.moldFileUpload, form,
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "上传成功",
- type: "success"
- });
- this.$refs.upload.clearFiles();
- this.getDocument();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- this.uploading = false;
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- this.uploading = false;
- });
- },
- //文件下载
- dowloadfile(id) {
- this.http.post( this.port.mold.moldFileDowload, {
- id: 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.getOperationRecord(this.activePage);
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //文件删除
- deleteFile(fileId) {
- this.$confirm('确认删除该文档吗?', '提示', {
- type: 'warning'
- }).then(() => {
- this.http.post( this.port.mold.moldFileDelete, { id: fileId },
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "删除成功",
- type: "success"
- });
- this.getDocument();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- }).catch(() => {});
- },
- //零件新建
- subPart() {
- this.$refs.newParts.validate(valid => {
- if (valid) {
- this.editLoading = true;
- this.http.post( this.port.mold.addPart, {
- partNo: this.newParts.number,
- partName: this.newParts.name,
- partLife: this.newParts.life,
- mouldId: this.detailId
- },
- res => {
- this.editLoading = false;
- if (res.code == "ok") {
- this.centerDialog3Visible = false;
- this.$message({
- message: "新建成功",
- type: "success"
- });
- this.getPartList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.editLoading = false;
- this.centerDialog3Visible = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- })
- },
-
- //打开零件修改
- editPort(row) {
- this.editPortVisible = true;
- this.editParts = {
- id: row.id,
- number: row.partNo,
- name: row.partName,
- life: row.partLife
- }
- },
- editPartVisible() {
- this.$refs.editParts.validate(valid => {
- if (valid) {
- this.editLoading = true;
- this.http.post( this.port.mold.addPart, {
- partNo: this.editParts.number,
- partName: this.editParts.name,
- partLife: this.editParts.life,
- mouldId: this.detailId,
- id: this.editParts.id
- },
- res => {
- this.editLoading = false;
- if (res.code == "ok") {
- this.editPortVisible = false;
- this.$message({
- message: "修改成功",
- type: "success"
- });
- this.getPartList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.editLoading = false;
- this.editPortVisible = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- })
- },
- //零件列表
- getPartList() {
- this.http.post( this.port.mold.partList, {
- mouldId: this.detailId
- },
- res => {
- if (res.code == "ok") {
- var list = res.data;
- for(var i in list){
- if(list[i].state == null){
- list[i].state = 100;
- }
- }
- this.documents.part = list;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //零件导入
- uploadPart(params) {
- var fileObj = params.file;
- var form = new FormData();
- form.append("file", fileObj);
- form.append("mouldId", this.detailId);
- this.http.uploadFile( this.port.mold.importPart, form,
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "上传成功",
- type: "success"
- });
- this.$refs.upload.clearFiles();
- this.getPartList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //零件文档批量
- beforeRemove(params) {
- for(var i in this.files){
- if(this.files[i].uid == params.uid) {
- this.files.splice(i , 1);
- }
- }
- },
- uploadPartFile(params) {
- this.files.push(params.file);
- return false;
- },
- uploadFilePart() {
- this.uploading = true;
- var fileObj = this.files;
- var form = new FormData();
- for(var i in fileObj){
- form.append("file", fileObj[i]);
- }
- form.append("mouldId", this.detailId);
- this.http.uploadFile( this.port.mold.partUpload, form,
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "上传成功",
- type: "success"
- });
- this.centerDialog4Visible = false;
- this.$refs.upload4.clearFiles();
- this.getPartList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- this.uploading = false;
- },
- error => {
- this.centerDialog4Visible = false;
- this.$message({
- message: error,
- type: "error"
- });
- this.uploading = false;
- });
- },
- //报废文件上传
- discardUpload() {
- if (this.files2[0] != null && this.files2[1] != null) {
- this.uploading = true;
- var form = new FormData();
- form.append("file", this.files2[0]);
- form.append("file2", this.files2[1]);
- form.append("belongType", this.activeTab);
- form.append("mouldId", this.detailId);
- if (this.activeTab == 0 || this.activeTab == 1) {
- form.append("dwgType", this.fileType);
- }
- this.http.uploadFile( this.port.mold.moldFileUpload, form,
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "上传成功",
- type: "success"
- });
- this.centerDialog2Visible = false;
- this.clearFileRecord();
- this.getDocument();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- this.uploading = false;
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- this.uploading = false;
- });
- } else {
- console.log(this.files2);
- this.$message({
- message: "必须各上传一个文件",
- type: "error"
- });
- }
- },
- //清理报废文档上传窗口中的文件
- clearFileRecord() {
- this.centerDialog2Visible = false;
- this.$refs.upload1.clearFiles();
- this.$refs.upload2.clearFiles();
- this.files2[0] = null;
- this.files2[1] = null;
- },
- //报废的申请单上传
- uploadDiscardFile1(params){
- this.files2[0] = params.file;
- return false;
- },
- //报废的报废单上传
- uploadDiscardFile2(params){
- this.files2[1] = params.file;
- return false;
- },
- //报废的申请单移除
- beforeRemove1(params) {
- this.files2[0] = null;
- },
- //报废的报废单移除
- beforeRemove2(params) {
- this.files2[0] = null;
- },
- //获取操作记录
- getOperationRecord(type) {
- this.http.post( this.port.mold.moldOperationList, {
- mouldId: this.detailId,
- belongType: type
- },
- res => {
- if (res.code == "ok") {
- this.operations = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //更新申请
- updateRequest(){
- this.$confirm('要申请更新模具吗?', '申请', {
- type: 'info'
- }).then(() => {
- this.http.post( this.port.mold.moldFileUpload, {
- belongType: 4,
- mouldId: this.detailId
- },
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "申请成功",
- type: "success"
- });
- this.getDocument();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- }).catch(() => {});
- },
- //导出操作记录
- exportRecords(){
- if(this.recordTime[0] == null || this.recordTime[1] == null){
- this.$message({
- message: "未输入时间",
- type: "error"
- });
- }else{
- this.centerDialog5Visible = false;
- this.http.get( this.port.mold.exportOperationExcel+ "?mouldId=" + this.detailId
- + "&startTime=" + util.formatDate.format(new Date(this.recordTime[0]), 'yyyy-MM-dd')
- + "&endTime=" + util.formatDate.format(new Date(this.recordTime[1]), 'yyyy-MM-dd'),
- res => {
- if (res.code == "ok") {
- // let aTag = document.createElement('a');
- // let blob = new Blob([res.data]);
- // var arr = res.data.split("/");
- // aTag.download = arr.pop();
- // aTag.href = URL.createObjectURL(blob);
- // aTag.click();
- // URL.revokeObjectURL(blob);
- let a = document.createElement('a')
- a.setAttribute('download', res.data.split("/")[2]);
- a.setAttribute("href", res.data);
- a.click();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- },
- //更新弹框
- showAdd(id) {
- this.addFormVisible = true;
- this.addForm = {
- dynamicId: id,
- modelName: "",
- initialModulus: "",
- settingLife: "",
- maintainCount: [],
- rfid: "",
- holes: ""
- };
- },
- //更新提交
- inviteSubmit(){
- this.$refs.addForm.validate(valid => {
- if (valid) {
- this.addLoading = true;
- var maintainCount = this.addForm.maintainCount , str = "";
- for(var i in maintainCount) {
- if(i == maintainCount.length-1){
- str += maintainCount[i]
- } else {
- str += maintainCount[i] + ","
- }
- }
- this.addForm.maintainCount = str;
- this.addForm.preUpdateId = this.detailId;
- this.http.post( this.port.mold.addMold, this.addForm,
- res => {
- this.addLoading = false;
- if (res.code == "ok") {
- this.addFormVisible = false;
- this.$message({
- message: "更新成功",
- type: "success"
- });
- this.$router.push("/moldList/" + res.data.id );
- this.detailId = res.data.id;
- this.getDetail();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.addLoading = false;
- this.addFormVisible = false;
- 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();
- }
- };
- </script>
- <style scoped>
- a {
- text-decoration: none;
- }
- a.download {
- color:#20a0ff;
- }
- .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;
- }
- .state {
- float: right;
- }
- .tips {
- color: #bbb;
- }
- .title {
- padding-left: 10px;
- padding-bottom: 0px;
- margin: 20px 0;
- font-size: 16px;
- line-height: 24px;
- border-left: 1px #20a0ff solid;
- }
- .editDetail {
- margin-left: 10px;
- color: #20a0ff;
- cursor: pointer;
- }
- .download {
- text-decoration:none;
- color: #20a0ff;
- cursor: pointer;
- }
- .info {
- color: grey;
- }
- .belongPro {
- cursor: pointer;
- color:#20a0ff;
- }
- .main {
- padding-left: 10px;
- }
- .detail {
- margin-bottom: 20px;
- }
- </style>
|