moldDetail.vue 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <el-form-item>
  7. <el-button type="text" @click="backToList" icon="el-icon-back" class="back">返回</el-button>
  8. </el-form-item>
  9. <el-form-item class="divLine"></el-form-item>
  10. <el-form-item>
  11. <span class="projectTitle">{{moldDetail.modelName}}</span>
  12. </el-form-item>
  13. <el-form-item class="state">
  14. 当前状态:
  15. <a style="color: #999999; cursor: pointer" @click="toDetection" v-if="moldDetail.state == 0">静止</a>
  16. <a style="color: #00CD66; cursor: pointer" @click="toDetection" v-if="moldDetail.state == 1">运行</a>
  17. <span class="tips">(点击查看运行状态)</span>
  18. </el-form-item>
  19. </el-form>
  20. </el-col>
  21. <!-- 主区域 -->
  22. <el-col :span="24" :style="allDetail">
  23. <el-col :span="24" class="title">
  24. 模具基本信息
  25. <!-- <i class="el-icon-edit editDetail" v-if="user.id == moldDetail.managerId || user.id == moldDetail.creatorId" @click="edit"></i> -->
  26. </el-col>
  27. <el-col :span="24" class="main">
  28. <el-col :span="6" class="detail">
  29. 模具编号:
  30. <span class="info">{{moldDetail.modelNo}}</span>
  31. </el-col>
  32. <el-col :span="6" class="detail">
  33. 云模盒编号:
  34. <span class="info">{{moldDetail.equipmentNo}}</span>
  35. </el-col>
  36. <el-col :span="6" class="detail">
  37. 设备电量:
  38. <span class="info">{{moldDetail.hillNumber}}</span>
  39. </el-col>
  40. <el-col :span="6" class="detail">
  41. 倒计时:
  42. <span class="info">{{moldDetail.diffTime}}</span>
  43. </el-col>
  44. <el-col :span="6" class="detail">
  45. 初始模次:
  46. <span class="info">{{moldDetail.initialModulus}}</span>
  47. </el-col>
  48. <el-col :span="6" class="detail">
  49. 模次寿命:
  50. <span class="info">{{moldDetail.settingLife}}</span>
  51. </el-col>
  52. <el-col :span="6" class="detail">
  53. 对应RFID码:
  54. <span class="info">{{moldDetail.rfid}}</span>
  55. </el-col>
  56. <el-col :span="6" class="detail">
  57. 穴数:
  58. <span class="info">{{moldDetail.holes}}</span>
  59. </el-col>
  60. <el-col :span="12" class="detail">
  61. 所属项目:
  62. <span class="info belongPro" @click="toPro(moldDetail.projectId)">{{moldDetail.projectName}}</span>
  63. </el-col>
  64. <el-col :span="24" class="detail">
  65. 生产方:
  66. <!-- <span class="info" v-for="(item, index) in customCompany">
  67. {{item.companyName}}
  68. <span v-if="index != customCompany.length-1">、</span>
  69. </span> -->
  70. <span class="info">{{moldDetail.produceCompany}}</span>
  71. </el-col>
  72. <el-col :span="24" class="detail">
  73. 生产方地址:
  74. <!-- <span class="info" v-for="(item, index) in customCompany">
  75. {{item.companyName}}
  76. <span v-if="index != customCompany.length-1">、</span>
  77. </span> -->
  78. <span class="info">{{moldDetail.area}}</span>
  79. </el-col>
  80. </el-col>
  81. <el-col :span="24" class="title">
  82. 文档资料
  83. <!-- 上传 模具0 时 -->
  84. <el-dropdown trigger="click" style="float: right;" v-show="activeTab == 0 && update == 1">
  85. <el-button size="mini" type="primary" :loading="uploading[0]">
  86. 上传
  87. <i class="el-icon-arrow-down el-icon--right"></i>
  88. </el-button>
  89. <el-dropdown-menu slot="dropdown">
  90. <el-upload ref="upload" action="customize" :http-request="uploadFile" :show-file-list="false" multiple :limit="5" style="float:right;">
  91. <el-dropdown-item @click.native="fileType = 0">2D图档</el-dropdown-item>
  92. <el-dropdown-item @click.native="fileType = 1">3D图档</el-dropdown-item>
  93. </el-upload>
  94. </el-dropdown-menu>
  95. </el-dropdown>
  96. <!-- 上传 零件1 时 -->
  97. <el-button size="mini" type="primary" style="float:right;" v-show="activeTab == 1 && update == 1" @click.native="fileType = 0;centerDialog4Visible = true;">
  98. 上传
  99. </el-button>
  100. <!-- 零件1 新建零件 -->
  101. <el-dropdown trigger="click" style="float: right; margin-right: 10px;" v-show=" activeTab == 1 && update == 1">
  102. <el-button size="mini" type="primary">
  103. 新建零件
  104. <i class="el-icon-arrow-down el-icon--right"></i>
  105. </el-button>
  106. <el-dropdown-menu slot="dropdown">
  107. <el-dropdown-item @click.native="centerDialog3Visible = true">单个新建</el-dropdown-item>
  108. <el-dropdown-item>
  109. <el-upload ref="upload" action="customize" :http-request="uploadPart" :show-file-list="false" :limit="1">
  110. 批量导入
  111. </el-upload>
  112. </el-dropdown-item>
  113. </el-dropdown-menu>
  114. </el-dropdown>
  115. <!-- 上传 试模2 保养3 时 -->
  116. <el-upload ref="upload"
  117. v-show="(activeTab == 2 || activeTab == 3) && update == 1"
  118. action="customize"
  119. :http-request="uploadFile"
  120. :show-file-list="false"
  121. multiple
  122. :limit="5"
  123. style="float:right;"
  124. >
  125. <el-button size="mini" type="primary" :loading="uploading[1]">上传</el-button>
  126. </el-upload>
  127. <!-- 更新4 -->
  128. <el-button
  129. v-show="activeTab == 4 && user.id == moldDetail.managerId && canInitiate && updateAble"
  130. size="mini"
  131. type="primary"
  132. style="float: right;"
  133. @click="updateRequest"
  134. >申请</el-button>
  135. <!-- 上传 报废5 时 -->
  136. <el-button
  137. v-show="activeTab == 5 && update == 1"
  138. size="mini"
  139. type="primary"
  140. style="float: right;"
  141. @click="centerDialog2Visible = true;"
  142. >上传</el-button>
  143. </el-col>
  144. <!-- 文档列表部分 -->
  145. <el-col :span="24">
  146. <el-tabs v-model="activePage" @tab-click="handleClick">
  147. <!-- 模具文档 -->
  148. <el-tab-pane label="模具文档" name="0">
  149. <el-table
  150. :data="documents.mould"
  151. highlight-current-row
  152. v-loading="listLoading"
  153. style="width: 100%;"
  154. >
  155. <el-table-column type="index" width="40"></el-table-column>
  156. <el-table-column prop="fileName" label="名称" sortable></el-table-column>
  157. <el-table-column prop="fileSize" label="大小" width="200" align="center" sortable></el-table-column>
  158. <el-table-column prop="uploadtor" label="上传者" width="200" align="center" sortable></el-table-column>
  159. <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
  160. <el-table-column label="状态" width="120" align="center" sortable>
  161. <template slot-scope="scope">
  162. <span v-if="scope.row.state == -2">生产方审核不通过</span>
  163. <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
  164. <span v-else-if="scope.row.state == 0">待双方审核</span>
  165. <span v-else-if="scope.row.state == 1">待生产方审核</span>
  166. <span v-else-if="scope.row.state == 2">待资产方审核</span>
  167. <span v-else-if="scope.row.state == 3">审核通过</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="操作" width="200" align="center" sortable>
  171. <template slot-scope="scope">
  172. <el-button size="small"
  173. v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
  174. @click="checkOpen(scope.row)">审批</el-button>
  175. <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
  176. <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
  177. </a>
  178. <el-button size="small"
  179. v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
  180. @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
  181. </template>
  182. </el-table-column>
  183. </el-table>
  184. </el-tab-pane>
  185. <!-- 零件文档 -->
  186. <el-tab-pane label="零件文档" name="1">
  187. <el-table
  188. :data="documents.part"
  189. highlight-current-row
  190. v-loading="listLoading"
  191. style="width: 100%;"
  192. >
  193. <el-table-column type="index" width="40"></el-table-column>
  194. <el-table-column prop="partNo" label="零件编号" width="150" sortable></el-table-column>
  195. <el-table-column prop="partName" label="零件名称" sortable></el-table-column>
  196. <el-table-column prop="partLife" label="寿命次数" align="center" width="100" sortable></el-table-column>
  197. <el-table-column prop="isVulnerable" label="易损件" align="center" width="100" sortable>
  198. <template slot-scope="scope">{{scope.row.isVulnerable==0?'否':'是'}}</template>
  199. </el-table-column>
  200. <el-table-column prop="part3dFile.fileName" label="3D图档" width="200" sortable>
  201. <template slot-scope="scope" v-if="scope.row.part3dFile != null">
  202. <a class="download" :href="scope.row.part3dFile.fileUrl" target="_blank">{{scope.row.part3dFile.fileName}}</a>
  203. </template>
  204. </el-table-column>
  205. <el-table-column prop="part2dFile.fileName" label="2D图档" width="200" sortable>
  206. <template slot-scope="scope" v-if="scope.row.part2dFile != null">
  207. <a class="download" :href="scope.row.part2dFile.fileUrl" :download="scope.row.part2dFile.fileName">{{scope.row.part2dFile.fileName}}</a>
  208. </template>
  209. </el-table-column>
  210. <el-table-column prop="indate" label="上传时间" width="200" align="center" sortable></el-table-column>
  211. <el-table-column label="状态" width="120" align="center" sortable>
  212. <template slot-scope="scope">
  213. <span v-if="scope.row.state == -2">生产方审核不通过</span>
  214. <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
  215. <span v-else-if="scope.row.state == 0">待双方审核</span>
  216. <span v-else-if="scope.row.state == 1">待生产方审核</span>
  217. <span v-else-if="scope.row.state == 2">待资产方审核</span>
  218. <span v-else-if="scope.row.state == 3">审核通过</span>
  219. </template>
  220. </el-table-column>
  221. <el-table-column label="操作" width="200" align="center" sortable>
  222. <template slot-scope="scope">
  223. <el-button size="small"
  224. v-if="approve == 1 && (scope.row.state == 0
  225. || (scope.row.state == 1 && user.subordinateType == 1)
  226. || (scope.row.state == 2 && user.subordinateType == 0))"
  227. @click="checkOpenPort(scope.row)">审批</el-button>
  228. <el-button size="small" @click="editPort(scope.row)" v-if="scope.row.creatorId == user.id">
  229. 修改
  230. </el-button>
  231. <!-- <el-button size="small" @click="dowloadfile(scope.row.id)" v-if="download == 1 && scope.row.state == 3 ">
  232. <a :href="scope.row.fileUrl" :download="scope.row.fileName">下载 </a>
  233. </el-button> -->
  234. <!-- <el-button size="small"
  235. v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
  236. @click="deleteFile(scope.row.id)" type="danger">删除</el-button> -->
  237. </template>
  238. </el-table-column>
  239. </el-table>
  240. </el-tab-pane>
  241. <!-- 试模及验收 -->
  242. <el-tab-pane label="试模及验收" name="2">
  243. <el-table
  244. :data="documents.check"
  245. highlight-current-row
  246. v-loading="listLoading"
  247. style="width: 100%;"
  248. >
  249. <el-table-column type="index" width="40"></el-table-column>
  250. <el-table-column prop="fileName" label="名称" sortable></el-table-column>
  251. <el-table-column prop="fileSize" label="大小" width="200" sortable></el-table-column>
  252. <el-table-column prop="uploadtor" label="上传者" width="200" sortable></el-table-column>
  253. <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
  254. <el-table-column label="状态" width="120" sortable>
  255. <template slot-scope="scope">
  256. <span v-if="scope.row.state == -2">生产方审核不通过</span>
  257. <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
  258. <span v-else-if="scope.row.state == 0">待双方审核</span>
  259. <span v-else-if="scope.row.state == 1">待生产方审核</span>
  260. <span v-else-if="scope.row.state == 2">待资产方审核</span>
  261. <span v-else-if="scope.row.state == 3">审核通过</span>
  262. </template>
  263. </el-table-column>
  264. <el-table-column label="操作" width="200" sortable>
  265. <template slot-scope="scope">
  266. <el-button size="small"
  267. v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
  268. @click="checkOpen(scope.row)">审批</el-button>
  269. <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
  270. <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
  271. </a>
  272. <el-button size="small"
  273. v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
  274. @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
  275. </template>
  276. </el-table-column>
  277. </el-table>
  278. </el-tab-pane>
  279. <!-- 保养方案 -->
  280. <el-tab-pane label="保养方案" name="3">
  281. <el-table
  282. :data="documents.maintain"
  283. highlight-current-row
  284. v-loading="listLoading"
  285. style="width: 100%;"
  286. >
  287. <el-table-column type="index" width="40"></el-table-column>
  288. <el-table-column prop="fileName" label="名称" sortable></el-table-column>
  289. <el-table-column prop="fileSize" label="大小" width="200" sortable></el-table-column>
  290. <el-table-column prop="uploadtor" label="上传者" width="200" sortable></el-table-column>
  291. <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
  292. <el-table-column label="状态" width="120" sortable>
  293. <template slot-scope="scope">
  294. <span v-if="scope.row.state == -2">生产方审核不通过</span>
  295. <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
  296. <span v-else-if="scope.row.state == 0">待双方审核</span>
  297. <span v-else-if="scope.row.state == 1">待生产方审核</span>
  298. <span v-else-if="scope.row.state == 2">待资产方审核</span>
  299. <span v-else-if="scope.row.state == 3">审核通过</span>
  300. </template>
  301. </el-table-column>
  302. <el-table-column label="操作" width="200" sortable>
  303. <template slot-scope="scope">
  304. <el-button size="small"
  305. v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
  306. @click="checkOpen(scope.row)">审批</el-button>
  307. <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
  308. <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
  309. </a>
  310. <el-button size="small"
  311. v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
  312. @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
  313. </template>
  314. </el-table-column>
  315. </el-table>
  316. </el-tab-pane>
  317. <!-- 模具更新 -->
  318. <el-tab-pane label="模具更新" name="4">
  319. <el-table :data="documents.update" highlight-current-row v-loading="listLoading" style="width: 100%;">
  320. <el-table-column type="index" width="40"></el-table-column>
  321. <el-table-column prop="uploadtor" label="申请人" sortable></el-table-column>
  322. <el-table-column prop="indate" label="申请时间" width="200" sortable></el-table-column>
  323. <el-table-column label="状态" width="120" sortable>
  324. <template slot-scope="scope">
  325. <span v-if="scope.row.state == -2">生产方审核不通过</span>
  326. <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
  327. <span v-else-if="scope.row.state == 0">待双方审核</span>
  328. <span v-else-if="scope.row.state == 1">待生产方审核</span>
  329. <span v-else-if="scope.row.state == 2">待资产方审核</span>
  330. <span v-else-if="scope.row.state == 3">审核通过</span>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="操作" width="200" sortable>
  334. <template slot-scope="scope">
  335. <el-button size="small" @click="checkUpdate(scope.row.id, true)" type="primary"
  336. v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
  337. >通过</el-button>
  338. <el-button size="small" @click="checkUpdate(scope.row.id, false)" type="danger"
  339. v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
  340. >不通过</el-button>
  341. <el-button size="small" @click="showAdd(scope.row.id)" type="primary"
  342. v-if="scope.row.uplodtorId == user.id && scope.row.state == 3">更新模具</el-button>
  343. </template>
  344. </el-table-column>
  345. </el-table>
  346. </el-tab-pane>
  347. <!-- 模具报废 -->
  348. <el-tab-pane label="模具报废" name="5">
  349. <el-table :data="documents.abandon" highlight-current-row v-loading="listLoading" style="width: 100%;">
  350. <el-table-column type="index" width="40"></el-table-column>
  351. <el-table-column prop="fileName" label="申请单名称" sortable></el-table-column>
  352. <el-table-column prop="fileSize" label="申请单大小" width="200" sortable></el-table-column>
  353. <el-table-column prop="fileName2" label="报废单名称" sortable></el-table-column>
  354. <el-table-column prop="fileSize2" label="报废单大小" width="200" sortable></el-table-column>
  355. <el-table-column prop="uploadtor" label="上传者" width="200" sortable></el-table-column>
  356. <el-table-column prop="indate" label="上传时间" width="200" sortable></el-table-column>
  357. <el-table-column label="状态" width="120" sortable>
  358. <template slot-scope="scope">
  359. <span v-if="scope.row.state == -2">生产方审核不通过</span>
  360. <span v-else-if="scope.row.state == -1">资产方审核不通过</span>
  361. <span v-else-if="scope.row.state == 0">待双方审核</span>
  362. <span v-else-if="scope.row.state == 1">待生产方审核</span>
  363. <span v-else-if="scope.row.state == 2">待资产方审核</span>
  364. <span v-else-if="scope.row.state == 3">审核通过</span>
  365. </template>
  366. </el-table-column>
  367. <el-table-column label="操作" width="200" sortable>
  368. <template slot-scope="scope">
  369. <el-button size="small"
  370. v-if="approve == 1 && (scope.row.state == 0 || (scope.row.state == 1 && user.subordinateType == 1) || (scope.row.state == 2 && user.subordinateType == 0))"
  371. @click="checkOpen(scope.row)">审批</el-button>
  372. <a :href="scope.row.fileUrl" :download="scope.row.fileName" v-if="download == 1 && scope.row.state == 3">
  373. <el-button size="small" @click="dowloadfile(scope.row.id)">下载</el-button>
  374. </a>
  375. <el-button size="small"
  376. v-if="scope.row.uplodtorId == user.id && scope.row.state <= 0"
  377. @click="deleteFile(scope.row.id)" type="danger">删除</el-button>
  378. </template>
  379. </el-table-column>
  380. </el-table>
  381. </el-tab-pane>
  382. </el-tabs>
  383. </el-col>
  384. <!-- 操作记录 -->
  385. <el-col :span="24" class="title">
  386. {{activeTab == 4?"更新":"操作"}}记录
  387. <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">导出</el-button>
  388. </el-col>
  389. <el-table v-if="activeTab != 4" :data="operations" highlight-current-row v-loading="listLoading" style="width: 100%;">
  390. <el-table-column type="index" width="40"></el-table-column>
  391. <el-table-column prop="content" label="操作" width="120" sortable></el-table-column>
  392. <el-table-column v-if="activeTab!= 4" prop="fileName" label="操作文档名称" sortable></el-table-column>
  393. <el-table-column prop="operatorName" label="操作人" align="center" width="120" sortable></el-table-column>
  394. <el-table-column prop="indate" label="操作时间" width="200" align="center" sortable></el-table-column>
  395. </el-table>
  396. <el-table v-else :data="operations" highlight-current-row v-loading="listLoading" style="width: 100%;">
  397. <el-table-column type="index" width="40"></el-table-column>
  398. <el-table-column prop="mouldId" label="模具编号" sortable></el-table-column>
  399. <el-table-column prop="applicantName" label="申请人" align="center" width="200" sortable></el-table-column>
  400. <el-table-column prop="operatorName" label="审批人" align="center" width="200" sortable></el-table-column>
  401. <el-table-column prop="isPass" label="状态" width="200" align="center" sortable>
  402. <template slot-scope="scope">
  403. <span v-if="scope.row.isPass == 1">已通过</span>
  404. <span v-else>未通过</span>
  405. </template>
  406. </el-table-column>
  407. <el-table-column prop="indate" label="时间" width="400" align="center" sortable></el-table-column>
  408. </el-table>
  409. </el-col>
  410. <!-- 审批弹窗 -->
  411. <el-dialog title="审批" :visible.sync="centerDialogVisible" width="450px">
  412. <a :href="this.fileUrl" :download="this.activeFileName"><el-link type="primary">{{this.activeFileName}}</el-link></a>
  413. <span slot="footer" class="dialog-footer">
  414. <el-button @click="check(false)">不通过</el-button>
  415. <el-button type="primary" @click="check(true)">通过</el-button>
  416. </span>
  417. </el-dialog>
  418. <!-- 模具报废上传弹窗 -->
  419. <el-dialog title="模具报废上传" :visible.sync="centerDialog2Visible" width="450px" :before-close="clearFileRecord">
  420. <p style="height:60px;">
  421. <span style="float:left;margin-right:30px;">申请单</span>
  422. <el-upload ref="upload1" action="customize" :http-request="uploadDiscardFile1" :limit="1" :before-remove="beforeRemove1" style="float:left">
  423. <el-button size="small" type="primary">上传</el-button>
  424. </el-upload>
  425. </p>
  426. <p style="height:60px;">
  427. <span style="float:left;margin-right:30px;">报废单</span>
  428. <el-upload ref="upload2" action="customize" :http-request="uploadDiscardFile2" :limit="1" :before-remove="beforeRemove2" style="float:left">
  429. <el-button size="small" type="primary">上传</el-button>
  430. </el-upload>
  431. </p>
  432. <span slot="footer" class="dialog-footer">
  433. <el-button @click="discardUpload" :loading="uploading[3]">确定</el-button>
  434. </span>
  435. </el-dialog>
  436. <!-- 零件文档上传弹窗 -->
  437. <el-dialog title="零件文档上传" v-if="centerDialog4Visible" :visible.sync="centerDialog4Visible" width="450px" :before-close="clearFileRecord2">
  438. <p style="color:#ccc;">文件命名规则:零件编号+2D/3D 如 LJ001+2D.dwg</p>
  439. <el-upload ref="upload4" action="uploadFile" :http-request="uploadPartFile" :show-file-list="true" :before-remove="beforeRemove" multiple>
  440. <el-button size="small" type="primary" :loading="uploading[2]">上传</el-button>
  441. </el-upload>
  442. <span slot="footer" class="dialog-footer">
  443. <el-button @click="uploadFilePart">确定</el-button>
  444. </span>
  445. </el-dialog>
  446. <!-- 批量导出操作记录弹窗 -->
  447. <el-dialog title="批量导出操作记录" v-if="centerDialog5Visible" :visible.sync="centerDialog5Visible" width="450px">
  448. <div style="text-align:center;">
  449. <el-date-picker v-model="recordTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  450. </div>
  451. <span slot="footer" class="dialog-footer">
  452. <el-button @click="centerDialog5Visible = false">取消</el-button>
  453. <el-button type="primary" @click="exportRecords">确定</el-button>
  454. </span>
  455. </el-dialog>
  456. <!-- 单个新增零件弹窗 -->
  457. <el-dialog title="新增零件" v-if="centerDialog3Visible" :visible.sync="centerDialog3Visible" :close-on-click-modal="false" customClass="customWidth">
  458. <el-form :model="newParts" label-width="100px" :rules="formRules" ref="newParts" :inline="true" class="demo-form-inline">
  459. <el-form-item label="零件编号" prop="number">
  460. <el-input v-model="newParts.number" autocomplete="off" placeholder="请输入零件编号"></el-input>
  461. </el-form-item>
  462. <el-form-item label="零件名称" prop="name">
  463. <el-input v-model="newParts.name" autocomplete="off" placeholder="请输入零件名称"></el-input>
  464. </el-form-item>
  465. <el-form-item label="零件寿命" prop="life">
  466. <el-input v-model="newParts.life" autocomplete="off" placeholder="请输入零件寿命"></el-input>
  467. </el-form-item>
  468. </el-form>
  469. <div slot="footer" class="dialog-footer">
  470. <el-button @click.native="centerDialog3Visible = false">取消</el-button>
  471. <el-button type="primary" @click.native="subPart" :loading="editLoading">提交</el-button>
  472. </div>
  473. </el-dialog>
  474. <!-- 单个编辑零件弹窗 -->
  475. <el-dialog title="编辑零件" v-if="editPortVisible" :visible.sync="editPortVisible" :close-on-click-modal="false" customClass="customWidth">
  476. <el-form :model="editParts" label-width="100px" :rules="formRules" ref="editParts" :inline="true" class="demo-form-inline">
  477. <el-form-item label="零件编号" prop="number">
  478. <el-input v-model="editParts.number" autocomplete="off" placeholder="请输入零件编号"></el-input>
  479. </el-form-item>
  480. <el-form-item label="零件名称" prop="name">
  481. <el-input v-model="editParts.name" autocomplete="off" placeholder="请输入零件名称"></el-input>
  482. </el-form-item>
  483. <el-form-item label="零件寿命" prop="life">
  484. <el-input v-model="editParts.life" autocomplete="off" placeholder="请输入零件寿命"></el-input>
  485. </el-form-item>
  486. </el-form>
  487. <div slot="footer" class="dialog-footer">
  488. <el-button @click.native="editPortVisible = false">取消</el-button>
  489. <el-button type="primary" @click.native="editPartVisible" :loading="editLoading">提交</el-button>
  490. </div>
  491. </el-dialog>
  492. <!--更新界面-->
  493. <el-dialog title="更新模具" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth">
  494. <el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm" :inline="true" class="demo-form-inline">
  495. <el-form-item label="模具名称" prop="modelName">
  496. <el-input v-model="addForm.modelName" autocomplete="off" placeholder="请输入模具名称"></el-input>
  497. </el-form-item>
  498. <el-form-item label="初始模次" prop="initialModulus">
  499. <el-input v-model="addForm.initialModulus" autocomplete="off" placeholder="请输入初始模次"></el-input>
  500. </el-form-item>
  501. <el-form-item label="模次寿命" prop="settingLife">
  502. <el-input v-model="addForm.settingLife" autocomplete="off" placeholder="请输入模次寿命"></el-input>
  503. </el-form-item>
  504. <el-form-item label="RIFD码" prop="rfid">
  505. <el-input v-model="addForm.rfid" autocomplete="off" placeholder="请输入RIFD码"></el-input>
  506. </el-form-item>
  507. <el-form-item label="穴数" prop="holes">
  508. <el-input v-model="addForm.holes" autocomplete="off" placeholder="请输入穴数"></el-input>
  509. </el-form-item>
  510. <el-form-item label="保养次数" prop="maintainCount">
  511. <el-select v-model="addForm.maintainCount" clearable multiple allow-create filterable default-first-option placeholder="请选择保养次数" style="width:515px">
  512. <el-option v-for="item in maintainCount" :key="item" :label="item" :value="item"></el-option>
  513. </el-select>
  514. </el-form-item>
  515. </el-form>
  516. <div slot="footer" class="dialog-footer">
  517. <el-button @click.native="addFormVisible = false">取消</el-button>
  518. <el-button type="primary" @click.native="inviteSubmit" :loading="addLoading">提交</el-button>
  519. </div>
  520. </el-dialog>
  521. </section>
  522. </template>
  523. <script>
  524. import util from "../../common/js/util";
  525. export default {
  526. data() {
  527. return {
  528. detailId: this.$route.params.id,
  529. user: JSON.parse(sessionStorage.getItem("user")),
  530. moldDetail: {},
  531. customCompany: [],
  532. //操作记录的时间
  533. recordTime: "",
  534. //单独新增零件时所需的三个变量
  535. newParts: {
  536. number: "",
  537. name: "",
  538. life: ""
  539. },
  540. uploading:[false, false, false, false],
  541. editParts: {
  542. id: 0,
  543. number: "",
  544. name: "",
  545. life: ""
  546. },
  547. maintainCount: [5000,10000],
  548. formRules: {
  549. modelName: [
  550. { required: true, message: "请输入模具名称", trigger: "blur" }
  551. ],
  552. initialModulus: [
  553. { required: true, message: "请输入初始模次", trigger: "blur" }
  554. ],
  555. settingLife: [
  556. { required: true, message: "请输入模次寿命", trigger: "blur" }
  557. ],
  558. rfid: [
  559. { required: true, message: "请输入RIFD码", trigger: "blur" }
  560. ],
  561. holes: [
  562. { required: true, message: "请输入穴数", trigger: "blur" }
  563. ],
  564. maintainCount: [
  565. { required: true, message: "请输入保养次数", trigger: ["blur", "change"] }
  566. ],
  567. number: [
  568. { required: true, message: "请输入零件编号", trigger: "blur" }
  569. ],
  570. name: [
  571. { required: true, message: "请输入零件名称", trigger: "blur" }
  572. ],
  573. life: [
  574. { required: true, message: "请输入零件寿命次数", trigger: "blur" }
  575. ],
  576. },
  577. //权限
  578. update: 0,
  579. download: 0,
  580. view: 0,
  581. approve: 0,
  582. canInitiate: true,
  583. //根据状态判断能否更新
  584. updateAble: true,
  585. //6种文档
  586. documents: {
  587. mould: [],
  588. part: [],
  589. check: [],
  590. maintain: [],
  591. update: [],
  592. abandon: []
  593. },
  594. //2D还是3D
  595. fileType: 1,
  596. //操作记录
  597. operations: [],
  598. allDetail: {
  599. overflow: "auto",
  600. padding: "0px 5px",
  601. height: 0
  602. },
  603. centerDialogVisible: false, //审批界面
  604. centerDialog2Visible: false, //模具界面
  605. centerDialog3Visible: false, //创建零件界面
  606. centerDialog4Visible: false, //零件文档上传界面
  607. centerDialog5Visible: false, //批量导出操作界面
  608. editPortVisible: false,//编辑零件界面
  609. editLoading: false,
  610. listLoading: false,
  611. activeTab: 0,
  612. activePage: 0,
  613. activeArticleId: null,
  614. activeFileName: null,
  615. fileUrl: null,
  616. boxes: [],
  617. companys: [],
  618. projects: [],
  619. maintainCount: [5000,10000,15000,20000,25000],
  620. addLoading: false,
  621. addFormVisible: false,
  622. addForm: {
  623. modelName: "",
  624. initialModulus: "",
  625. settingLife: "",
  626. maintainCount: [],
  627. rfid: "",
  628. holes: "",
  629. },
  630. //零件文件
  631. files: [],
  632. //报废文件
  633. files2: [null, null],
  634. twoId: null,
  635. threeId: null,
  636. };
  637. },
  638. methods: {
  639. backToList() {
  640. this.$router.go(-1);
  641. },
  642. toDetection() {
  643. this.$router.push("/detection");
  644. },
  645. toPro(id) {
  646. this.$router.push('/project/' + id);
  647. },
  648. //标签页面切换时
  649. handleClick(tab, event) {
  650. this.activeTab = tab.name;
  651. this.getOperationRecord(this.activeTab);
  652. },
  653. getMsg() {
  654. this.http.post( this.port.base.moulds, {
  655. belongCompanyId: this.user.companyId,
  656. mouldId: this.detailId
  657. },
  658. res => {
  659. if (res.code == "ok") {
  660. this.boxes = res.data;
  661. } else {
  662. this.$message({
  663. message: res.msg,
  664. type: "error"
  665. });
  666. }
  667. },
  668. error => {
  669. this.listLoading = false;
  670. this.$message({
  671. message: error,
  672. type: "error"
  673. });
  674. });
  675. },
  676. //模具详情
  677. getDetail() {
  678. this.http.post( this.port.mold.moldDetail, {
  679. id: this.detailId
  680. },
  681. res => {
  682. if (res.code == "ok") {
  683. var detail = res.data.vo;
  684. if (detail.endTime == null) {
  685. detail.diffTime = "";
  686. } else {
  687. detail.diffTime = util.formatDate.dateDiff(
  688. util.formatDate.format(new Date(detail.endTime), "yyyy-MM-dd"),
  689. util.formatDate.format(new Date(new Date()), "yyyy-MM-dd")
  690. );
  691. }
  692. this.moldDetail = detail;
  693. this.customCompany = res.data.customCompany;
  694. this.update = res.data.update;
  695. this.download = res.data.download;
  696. this.view = res.data.view;
  697. this.approve = res.data.approve;
  698. this.getDocument();
  699. this.getPartList();
  700. } else {
  701. this.$message({
  702. message: res.msg,
  703. type: "error"
  704. });
  705. }
  706. },
  707. error => {
  708. this.$message({
  709. message: error,
  710. type: "error"
  711. });
  712. });
  713. },
  714. //打开编辑
  715. edit() {
  716. this.editFormVisible = true;
  717. var maintainCount = this.moldDetail.maintainCount;
  718. maintainCount = maintainCount.split(",");
  719. this.editForm = {
  720. id: this.moldDetail.id,
  721. modelName: this.moldDetail.modelName,
  722. modelNo: this.moldDetail.modelNo,
  723. equipmentId: this.moldDetail.equipmentId,
  724. initialModulus: this.moldDetail.initialModulus,
  725. settingLife: this.moldDetail.settingLife,
  726. rfid: this.moldDetail.rfid,
  727. produceCompanyId: this.moldDetail.produceCompanyId,
  728. maintainCount: maintainCount,
  729. flag: 1
  730. };
  731. },
  732. addSubmit() {
  733. this.$refs.editForm.validate(valid => {
  734. if (valid) {
  735. this.editLoading = true;
  736. var maintainCount = this.editForm.maintainCount , str = "";
  737. for(var i in maintainCount) {
  738. if(i == maintainCount.length-1){
  739. str += maintainCount[i]
  740. } else {
  741. str += maintainCount[i] + ","
  742. }
  743. }
  744. this.editForm.maintainCount = str;
  745. this.http.post( this.port.mold.addMold, this.editForm,
  746. res => {
  747. this.editLoading = false;
  748. if (res.code == "ok") {
  749. this.editFormVisible = false;
  750. this.$message({
  751. message: "修改成功",
  752. type: "success"
  753. });
  754. this.getDetail();
  755. } else {
  756. this.$message({
  757. message: res.msg,
  758. type: "error"
  759. });
  760. }
  761. },
  762. error => {
  763. this.editLoading = false;
  764. this.editFormVisible = false;
  765. this.$message({
  766. message: error,
  767. type: "error"
  768. });
  769. });
  770. }
  771. });
  772. },
  773. //获取文档
  774. getDocument() {
  775. this.http.post( this.port.mold.moldFileListAll, {
  776. mouldId: this.detailId
  777. },
  778. res => {
  779. if (res.code == "ok") {
  780. for(var i in res.data){
  781. this.setList(res.data[i].list,i);
  782. }
  783. //顺便再把下面操作记录读取一下
  784. this.getOperationRecord(this.activeTab);
  785. //顺便再看看可不可以申请更新
  786. this.checkUpdateState();
  787. } else {
  788. this.$message({
  789. message: res.msg,
  790. type: "error"
  791. });
  792. }
  793. },
  794. error => {
  795. this.$message({
  796. message: error,
  797. type: "error"
  798. });
  799. });
  800. },
  801. //查看有无审核中或者审核成功的更新申请
  802. checkUpdateState(){
  803. this.updateAble = true;
  804. this.documents.update.forEach(item => {
  805. if(item.state != "-1" || item.state != "-2"){
  806. //有进行中的更新申请 现在不能再申请更新了
  807. this.updateAble = false;
  808. }
  809. });
  810. },
  811. //将list中对应的文件传入相应的document下
  812. setList(list, num) {
  813. var array = [];
  814. for(var i in list){
  815. if(this.approve == 1){
  816. array.push(list[i]);
  817. } else {
  818. if(list[i].uplodtorId == this.user.id){
  819. array.push(list[i]);
  820. }
  821. }
  822. }
  823. if(num == 0){
  824. this.documents.mould = array;
  825. } else if(num == 1) {
  826. //this.documents.part = array;
  827. } else if(num == 2) {
  828. this.documents.check = array;
  829. } else if(num == 3) {
  830. this.documents.maintain = array;
  831. } else if(num == 4) {
  832. for(var i in array){
  833. if(i == 0){
  834. if(array[i].state == 3){
  835. this.canInitiate = false
  836. } else if(array[i].state < 0) {
  837. this.canInitiate = true
  838. }
  839. }
  840. }
  841. this.documents.update = array;
  842. } else if(num == 5) {
  843. this.documents.abandon = array;
  844. }
  845. },
  846. //打开审批窗口
  847. checkOpen(row) {
  848. this.activeArticleId = row.id;
  849. this.activeFileName = row.fileName;
  850. this.fileUrl = row.fileUrl;
  851. this.twoId = null;
  852. this.threeId = null;
  853. this.centerDialogVisible = true;
  854. },
  855. //打开审批窗口
  856. checkOpenPort(row) {
  857. if(row.part2dFile != null) {
  858. this.twoId = row.part2dFile.id
  859. }
  860. if(row.part3dFile != null) {
  861. this.threeId = row.part3dFile.id
  862. }
  863. this.activeArticleId = null;
  864. this.activeFileName = null;
  865. this.centerDialogVisible = true;
  866. },
  867. //清理零件文档上传窗口中的文件
  868. clearFileRecord2() {
  869. this.centerDialog4Visible = false;
  870. this.$refs.upload4.clearFiles();
  871. },
  872. //审批文件
  873. check(adoption) {
  874. if(this.activeArticleId != null) {
  875. this.onSubMit(this.activeArticleId , adoption , 0)
  876. }
  877. if(this.twoId != null) {
  878. this.onSubMit(this.twoId , adoption , 1)
  879. }
  880. if(this.threeId != null) {
  881. this.onSubMit(this.threeId , adoption , 1)
  882. }
  883. },
  884. onSubMit(id , type , from) {
  885. this.http.post( this.port.mold.moldFileCheck, {
  886. mouldFileId: id,
  887. isPass: type ? 1 : 0 //通过为1 不通过为0
  888. },
  889. res => {
  890. if (res.code == "ok") {
  891. this.centerDialogVisible = false;
  892. this.$message({
  893. message: "审批成功",
  894. type: "success"
  895. });
  896. if(from == 0){
  897. this.getDocument();
  898. } else {
  899. this.getPartList();
  900. }
  901. } else {
  902. this.$message({
  903. message: res.msg,
  904. type: "error"
  905. });
  906. }
  907. },
  908. error => {
  909. this.$message({
  910. message: error,
  911. type: "error"
  912. });
  913. }
  914. );
  915. },
  916. //更新审批通过
  917. checkUpdate(id, approval) {
  918. var tipString = "";
  919. if(approval){
  920. tipString = "确认通过审批吗?";
  921. }else{
  922. tipString = "确认不通过审批吗?";
  923. }
  924. this.$confirm(tipString, '审批', {
  925. type: approval?'success':'error'
  926. }).then(() => {
  927. this.http.post( this.port.mold.moldFileCheck, {
  928. mouldFileId: id,
  929. isPass: approval ? 1 : 0 //通过为1 不通过为0
  930. },
  931. res => {
  932. if (res.code == "ok") {
  933. this.$message({
  934. message: "审批完成",
  935. type: "success"
  936. });
  937. this.getDocument();
  938. } else {
  939. this.$message({
  940. message: res.msg,
  941. type: "error"
  942. });
  943. }
  944. },
  945. error => {
  946. this.$message({
  947. message: error,
  948. type: "error"
  949. });
  950. }
  951. );
  952. })
  953. },
  954. //文件上传
  955. uploadFile(params) {
  956. var fileObj = params.file;
  957. var form = new FormData();
  958. form.append("file", fileObj);
  959. form.append("belongType", this.activeTab);
  960. form.append("mouldId", this.detailId);
  961. if (this.activeTab == 0 || this.activeTab == 1) {
  962. form.append("dwgType", this.fileType);
  963. }
  964. this.http.uploadFile( this.port.mold.moldFileUpload, form,
  965. res => {
  966. if (res.code == "ok") {
  967. this.$message({
  968. message: "上传成功",
  969. type: "success"
  970. });
  971. this.$refs.upload.clearFiles();
  972. this.getDocument();
  973. } else {
  974. this.$message({
  975. message: res.msg,
  976. type: "error"
  977. });
  978. }
  979. },
  980. error => {
  981. this.$message({
  982. message: error,
  983. type: "error"
  984. });
  985. });
  986. },
  987. //文件下载
  988. dowloadfile(id) {
  989. this.http.post( this.port.mold.moldFileDowload, {
  990. id: id
  991. },
  992. res => {
  993. this.getOperationRecord(this.activePage);
  994. },
  995. error => {
  996. this.$message({
  997. message: error,
  998. type: "error"
  999. });
  1000. });
  1001. },
  1002. //文件删除
  1003. deleteFile(fileId) {
  1004. this.$confirm('确认删除该文档吗?', '提示', {
  1005. type: 'warning'
  1006. }).then(() => {
  1007. this.http.post( this.port.mold.moldFileDelete, { id: fileId },
  1008. res => {
  1009. if (res.code == "ok") {
  1010. this.$message({
  1011. message: "删除成功",
  1012. type: "success"
  1013. });
  1014. this.getDocument();
  1015. } else {
  1016. this.$message({
  1017. message: res.msg,
  1018. type: "error"
  1019. });
  1020. }
  1021. },
  1022. error => {
  1023. this.$message({
  1024. message: error,
  1025. type: "error"
  1026. });
  1027. });
  1028. }).catch(() => {});
  1029. },
  1030. //零件新建
  1031. subPart() {
  1032. this.$refs.newParts.validate(valid => {
  1033. if (valid) {
  1034. this.editLoading = true;
  1035. this.http.post( this.port.mold.addPart, {
  1036. partNo: this.newParts.number,
  1037. partName: this.newParts.name,
  1038. partLife: this.newParts.life,
  1039. mouldId: this.detailId
  1040. },
  1041. res => {
  1042. this.editLoading = false;
  1043. if (res.code == "ok") {
  1044. this.centerDialog3Visible = false;
  1045. this.$message({
  1046. message: "新建成功",
  1047. type: "success"
  1048. });
  1049. this.getPartList();
  1050. } else {
  1051. this.$message({
  1052. message: res.msg,
  1053. type: "error"
  1054. });
  1055. }
  1056. },
  1057. error => {
  1058. this.editLoading = false;
  1059. this.centerDialog3Visible = false;
  1060. this.$message({
  1061. message: error,
  1062. type: "error"
  1063. });
  1064. });
  1065. }
  1066. })
  1067. },
  1068. //打开零件修改
  1069. editPort(row) {
  1070. this.editPortVisible = true;
  1071. this.editParts = {
  1072. id: row.id,
  1073. number: row.partNo,
  1074. name: row.partName,
  1075. life: row.partLife
  1076. }
  1077. },
  1078. editPartVisible() {
  1079. this.$refs.editParts.validate(valid => {
  1080. if (valid) {
  1081. this.editLoading = true;
  1082. this.http.post( this.port.mold.addPart, {
  1083. partNo: this.editParts.number,
  1084. partName: this.editParts.name,
  1085. partLife: this.editParts.life,
  1086. mouldId: this.detailId,
  1087. id: this.editParts.id
  1088. },
  1089. res => {
  1090. this.editLoading = false;
  1091. if (res.code == "ok") {
  1092. this.editPortVisible = false;
  1093. this.$message({
  1094. message: "新建成功",
  1095. type: "success"
  1096. });
  1097. this.getPartList();
  1098. } else {
  1099. this.$message({
  1100. message: res.msg,
  1101. type: "error"
  1102. });
  1103. }
  1104. },
  1105. error => {
  1106. this.editLoading = false;
  1107. this.editPortVisible = false;
  1108. this.$message({
  1109. message: error,
  1110. type: "error"
  1111. });
  1112. });
  1113. }
  1114. })
  1115. },
  1116. //零件列表
  1117. getPartList() {
  1118. this.http.post( this.port.mold.partList, {
  1119. mouldId: this.detailId
  1120. },
  1121. res => {
  1122. if (res.code == "ok") {
  1123. var list = res.data;
  1124. for(var i in list){
  1125. if(list[i].state == null){
  1126. list[i].state = 100;
  1127. }
  1128. }
  1129. this.documents.part = list;
  1130. } else {
  1131. this.$message({
  1132. message: res.msg,
  1133. type: "error"
  1134. });
  1135. }
  1136. },
  1137. error => {
  1138. this.$message({
  1139. message: error,
  1140. type: "error"
  1141. });
  1142. });
  1143. },
  1144. //零件导入
  1145. uploadPart(params) {
  1146. var fileObj = params.file;
  1147. var form = new FormData();
  1148. form.append("file", fileObj);
  1149. form.append("mouldId", this.detailId);
  1150. this.http.uploadFile( this.port.mold.importPart, form,
  1151. res => {
  1152. if (res.code == "ok") {
  1153. this.$message({
  1154. message: "上传成功",
  1155. type: "success"
  1156. });
  1157. this.$refs.upload.clearFiles();
  1158. this.getPartList();
  1159. } else {
  1160. this.$message({
  1161. message: res.msg,
  1162. type: "error"
  1163. });
  1164. }
  1165. },
  1166. error => {
  1167. this.$message({
  1168. message: error,
  1169. type: "error"
  1170. });
  1171. });
  1172. },
  1173. //零件文档批量
  1174. beforeRemove(params) {
  1175. for(var i in this.files){
  1176. if(this.files[i].uid == params.uid) {
  1177. this.files.splice(i , 1);
  1178. }
  1179. }
  1180. },
  1181. uploadPartFile(params) {
  1182. this.files.push(params.file);
  1183. return false;
  1184. },
  1185. uploadFilePart() {
  1186. var fileObj = this.files;
  1187. var form = new FormData();
  1188. for(var i in fileObj){
  1189. form.append("file", fileObj[i]);
  1190. }
  1191. form.append("mouldId", this.detailId);
  1192. this.http.uploadFile( this.port.mold.partUpload, form,
  1193. res => {
  1194. if (res.code == "ok") {
  1195. this.$message({
  1196. message: "上传成功",
  1197. type: "success"
  1198. });
  1199. this.centerDialog4Visible = false;
  1200. this.$refs.upload4.clearFiles();
  1201. this.getPartList();
  1202. } else {
  1203. this.$message({
  1204. message: res.msg,
  1205. type: "error"
  1206. });
  1207. }
  1208. },
  1209. error => {
  1210. this.centerDialog4Visible = false;
  1211. this.$message({
  1212. message: error,
  1213. type: "error"
  1214. });
  1215. });
  1216. },
  1217. //报废文件上传
  1218. discardUpload() {
  1219. if (this.files2[0] != null && this.files2[1] != null) {
  1220. var form = new FormData();
  1221. form.append("file", this.files2[0]);
  1222. form.append("file2", this.files2[1]);
  1223. form.append("belongType", this.activeTab);
  1224. form.append("mouldId", this.detailId);
  1225. if (this.activeTab == 0 || this.activeTab == 1) {
  1226. form.append("dwgType", this.fileType);
  1227. }
  1228. this.http.uploadFile( this.port.mold.moldFileUpload, form,
  1229. res => {
  1230. if (res.code == "ok") {
  1231. this.$message({
  1232. message: "上传成功",
  1233. type: "success"
  1234. });
  1235. this.centerDialog2Visible = false;
  1236. this.clearFileRecord();
  1237. this.getDocument();
  1238. } else {
  1239. this.$message({
  1240. message: res.msg,
  1241. type: "error"
  1242. });
  1243. }
  1244. },
  1245. error => {
  1246. this.$message({
  1247. message: error,
  1248. type: "error"
  1249. });
  1250. });
  1251. } else {
  1252. console.log(this.files2);
  1253. this.$message({
  1254. message: "必须各上传一个文件",
  1255. type: "error"
  1256. });
  1257. }
  1258. },
  1259. //清理报废文档上传窗口中的文件
  1260. clearFileRecord() {
  1261. this.centerDialog2Visible = false;
  1262. this.$refs.upload1.clearFiles();
  1263. this.$refs.upload2.clearFiles();
  1264. this.files2[0] = null;
  1265. this.files2[1] = null;
  1266. },
  1267. //报废的申请单上传
  1268. uploadDiscardFile1(params){
  1269. this.files2[0] = params.file;
  1270. return false;
  1271. },
  1272. //报废的报废单上传
  1273. uploadDiscardFile2(params){
  1274. this.files2[1] = params.file;
  1275. return false;
  1276. },
  1277. //报废的申请单移除
  1278. beforeRemove1(params) {
  1279. this.files2[0] = null;
  1280. },
  1281. //报废的报废单移除
  1282. beforeRemove2(params) {
  1283. this.files2[0] = null;
  1284. },
  1285. //获取操作记录
  1286. getOperationRecord(type) {
  1287. this.http.post( this.port.mold.moldOperationList, {
  1288. mouldId: this.detailId,
  1289. belongType: type
  1290. },
  1291. res => {
  1292. if (res.code == "ok") {
  1293. this.operations = res.data;
  1294. } else {
  1295. this.$message({
  1296. message: res.msg,
  1297. type: "error"
  1298. });
  1299. }
  1300. },
  1301. error => {
  1302. this.$message({
  1303. message: error,
  1304. type: "error"
  1305. });
  1306. });
  1307. },
  1308. //更新申请
  1309. updateRequest(){
  1310. this.$confirm('要申请更新模具吗?', '申请', {
  1311. type: 'info'
  1312. }).then(() => {
  1313. this.http.post( this.port.mold.moldFileUpload, {
  1314. belongType: 4,
  1315. mouldId: this.detailId
  1316. },
  1317. res => {
  1318. if (res.code == "ok") {
  1319. this.$message({
  1320. message: "申请成功",
  1321. type: "success"
  1322. });
  1323. this.getDocument();
  1324. } else {
  1325. this.$message({
  1326. message: res.msg,
  1327. type: "error"
  1328. });
  1329. }
  1330. },
  1331. error => {
  1332. this.$message({
  1333. message: error,
  1334. type: "error"
  1335. });
  1336. });
  1337. }).catch(() => {});
  1338. },
  1339. //导出操作记录
  1340. exportRecords(){
  1341. if(this.recordTime[0] == null || this.recordTime[1] == null){
  1342. this.$message({
  1343. message: "未输入时间",
  1344. type: "error"
  1345. });
  1346. }else{
  1347. this.centerDialog5Visible = false;
  1348. this.http.post( this.port.mold.exportOperationExcel, {
  1349. mouldId: this.detailId,
  1350. startTime: this.recordTime[0],
  1351. endTime: this.recordTime[1]
  1352. },
  1353. res => {
  1354. if (res.code == "ok") {
  1355. let aTag = document.createElement('a');
  1356. let blob = new Blob([res.data]);
  1357. var arr = res.data.split("/");
  1358. aTag.download = arr.pop();
  1359. aTag.href = URL.createObjectURL(blob);
  1360. aTag.click();              
  1361. URL.revokeObjectURL(blob);
  1362. } else {
  1363. this.$message({
  1364. message: res.msg,
  1365. type: "error"
  1366. });
  1367. }
  1368. },
  1369. error => {
  1370. this.$message({
  1371. message: error,
  1372. type: "error"
  1373. });
  1374. });
  1375. }
  1376. },
  1377. //更新弹框
  1378. showAdd(id) {
  1379. this.addFormVisible = true;
  1380. this.addForm = {
  1381. dynamicId: id,
  1382. modelName: "",
  1383. initialModulus: "",
  1384. settingLife: "",
  1385. maintainCount: [],
  1386. rfid: "",
  1387. holes: ""
  1388. };
  1389. },
  1390. //更新提交
  1391. inviteSubmit(){
  1392. this.$refs.addForm.validate(valid => {
  1393. if (valid) {
  1394. this.addLoading = true;
  1395. var maintainCount = this.addForm.maintainCount , str = "";
  1396. for(var i in maintainCount) {
  1397. if(i == maintainCount.length-1){
  1398. str += maintainCount[i]
  1399. } else {
  1400. str += maintainCount[i] + ","
  1401. }
  1402. }
  1403. this.addForm.maintainCount = str;
  1404. this.addForm.preUpdateId = this.detailId;
  1405. this.http.post( this.port.mold.addMold, this.addForm,
  1406. res => {
  1407. this.addLoading = false;
  1408. if (res.code == "ok") {
  1409. this.addFormVisible = false;
  1410. this.$message({
  1411. message: "更新成功",
  1412. type: "success"
  1413. });
  1414. this.$router.push("/moldList/" + res.data.id );
  1415. this.detailId = res.data.id;
  1416. this.getDetail();
  1417. } else {
  1418. this.$message({
  1419. message: res.msg,
  1420. type: "error"
  1421. });
  1422. }
  1423. },
  1424. error => {
  1425. this.addLoading = false;
  1426. this.addFormVisible = false;
  1427. this.$message({
  1428. message: error,
  1429. type: "error"
  1430. });
  1431. });
  1432. }
  1433. });
  1434. }
  1435. },
  1436. created() {
  1437. let height = window.innerHeight;
  1438. this.allDetail.height = height - 170 + "px";
  1439. const that = this;
  1440. window.onresize = function temp() {
  1441. that.allDetail.height = window.innerHeight - 170;
  1442. };
  1443. },
  1444. mounted() {
  1445. this.getMsg();
  1446. this.getDetail();
  1447. }
  1448. };
  1449. </script>
  1450. <style scoped>
  1451. a {
  1452. text-decoration: none;
  1453. }
  1454. .toolbar .el-form-item {
  1455. font-size: 14px;
  1456. vertical-align: middle;
  1457. }
  1458. .back {
  1459. font-size: 16px;
  1460. }
  1461. .divLine {
  1462. width: 2px;
  1463. background: #c3c3c3;
  1464. height: 100%;
  1465. }
  1466. .projectTitle {
  1467. font-size: 18px;
  1468. color: #333;
  1469. }
  1470. .state {
  1471. float: right;
  1472. }
  1473. .tips {
  1474. color: #bbb;
  1475. }
  1476. .title {
  1477. padding-left: 10px;
  1478. padding-bottom: 0px;
  1479. margin: 20px 0;
  1480. font-size: 16px;
  1481. line-height: 24px;
  1482. border-left: 1px #20a0ff solid;
  1483. }
  1484. .editDetail {
  1485. margin-left: 10px;
  1486. color: #20a0ff;
  1487. cursor: pointer;
  1488. }
  1489. .download {
  1490. text-decoration:none;
  1491. color: #20a0ff;
  1492. cursor: pointer;
  1493. }
  1494. .info {
  1495. color: grey;
  1496. }
  1497. .belongPro {
  1498. cursor: pointer;
  1499. color:#20a0ff;
  1500. }
  1501. .main {
  1502. padding-left: 10px;
  1503. }
  1504. .detail {
  1505. margin-bottom: 20px;
  1506. }
  1507. </style>