moldDetail.vue 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617
  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-show="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-show="activeTab == 4" :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 label="模具编号" sortable>
  399. <template slot-scope="scope">
  400. <span @click="toAnotherMould(scope.row.mouldId)" style="cursor: pointer;color: #409eff;">{{scope.row.mouldNo}}</span>
  401. </template>
  402. </el-table-column>
  403. <el-table-column prop="applicantName" label="申请人" align="center" width="200" sortable></el-table-column>
  404. <el-table-column prop="operatorName" label="审批人" align="center" width="200" sortable></el-table-column>
  405. <el-table-column label="状态" align="center" sortable>
  406. <template slot-scope="scope">
  407. <span v-if="scope.row.isPass == 1">已通过</span>
  408. <span v-else>未通过</span>
  409. </template>
  410. </el-table-column>
  411. <el-table-column prop="indate" label="时间" width="400" align="center" sortable></el-table-column>
  412. </el-table>
  413. </el-col>
  414. <!-- 审批弹窗 -->
  415. <el-dialog title="审批" :visible.sync="centerDialogVisible" width="450px">
  416. <a :href="this.fileUrl" :download="this.activeFileName"><el-link type="primary">{{this.activeFileName}}</el-link></a>
  417. <span slot="footer" class="dialog-footer">
  418. <el-button @click="check(false)">不通过</el-button>
  419. <el-button type="primary" @click="check(true)">通过</el-button>
  420. </span>
  421. </el-dialog>
  422. <!-- 模具报废上传弹窗 -->
  423. <el-dialog title="模具报废上传" :visible.sync="centerDialog2Visible" width="450px" :before-close="clearFileRecord">
  424. <p style="height:60px;">
  425. <span style="float:left;margin-right:30px;">申请单</span>
  426. <el-upload ref="upload1" action="customize" :http-request="uploadDiscardFile1" :limit="1" :before-remove="beforeRemove1" style="float:left">
  427. <el-button size="small" type="primary">上传</el-button>
  428. </el-upload>
  429. </p>
  430. <p style="height:60px;">
  431. <span style="float:left;margin-right:30px;">报废单</span>
  432. <el-upload ref="upload2" action="customize" :http-request="uploadDiscardFile2" :limit="1" :before-remove="beforeRemove2" style="float:left">
  433. <el-button size="small" type="primary">上传</el-button>
  434. </el-upload>
  435. </p>
  436. <span slot="footer" class="dialog-footer">
  437. <el-button @click="discardUpload" :loading="uploading[3]">确定</el-button>
  438. </span>
  439. </el-dialog>
  440. <!-- 零件文档上传弹窗 -->
  441. <el-dialog title="零件文档上传" v-if="centerDialog4Visible" :visible.sync="centerDialog4Visible" width="450px" :before-close="clearFileRecord2">
  442. <p style="color:#ccc;">文件命名规则:零件编号+2D/3D 如 LJ001+2D.dwg</p>
  443. <el-upload ref="upload4" action="uploadFile" :http-request="uploadPartFile" :show-file-list="true" :before-remove="beforeRemove" multiple>
  444. <el-button size="small" type="primary" :loading="uploading[2]">上传</el-button>
  445. </el-upload>
  446. <span slot="footer" class="dialog-footer">
  447. <el-button @click="uploadFilePart">确定</el-button>
  448. </span>
  449. </el-dialog>
  450. <!-- 批量导出操作记录弹窗 -->
  451. <el-dialog title="批量导出操作记录" v-if="centerDialog5Visible" :visible.sync="centerDialog5Visible" width="450px">
  452. <div style="text-align:center;">
  453. <el-date-picker v-model="recordTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  454. </div>
  455. <span slot="footer" class="dialog-footer">
  456. <el-button @click="centerDialog5Visible = false">取消</el-button>
  457. <el-button type="primary" @click="exportRecords">确定</el-button>
  458. </span>
  459. </el-dialog>
  460. <!-- 单个新增零件弹窗 -->
  461. <el-dialog title="新增零件" v-if="centerDialog3Visible" :visible.sync="centerDialog3Visible" :close-on-click-modal="false" customClass="customWidth">
  462. <el-form :model="newParts" label-width="100px" :rules="formRules" ref="newParts" :inline="true" class="demo-form-inline">
  463. <el-form-item label="零件编号" prop="number">
  464. <el-input v-model="newParts.number" autocomplete="off" placeholder="请输入零件编号"></el-input>
  465. </el-form-item>
  466. <el-form-item label="零件名称" prop="name">
  467. <el-input v-model="newParts.name" autocomplete="off" placeholder="请输入零件名称"></el-input>
  468. </el-form-item>
  469. <el-form-item label="零件寿命" prop="life">
  470. <el-input v-model="newParts.life" autocomplete="off" placeholder="请输入零件寿命"></el-input>
  471. </el-form-item>
  472. </el-form>
  473. <div slot="footer" class="dialog-footer">
  474. <el-button @click.native="centerDialog3Visible = false">取消</el-button>
  475. <el-button type="primary" @click.native="subPart" :loading="editLoading">提交</el-button>
  476. </div>
  477. </el-dialog>
  478. <!-- 单个编辑零件弹窗 -->
  479. <el-dialog title="编辑零件" v-if="editPortVisible" :visible.sync="editPortVisible" :close-on-click-modal="false" customClass="customWidth">
  480. <el-form :model="editParts" label-width="100px" :rules="formRules" ref="editParts" :inline="true" class="demo-form-inline">
  481. <el-form-item label="零件编号" prop="number">
  482. <el-input v-model="editParts.number" autocomplete="off" placeholder="请输入零件编号"></el-input>
  483. </el-form-item>
  484. <el-form-item label="零件名称" prop="name">
  485. <el-input v-model="editParts.name" autocomplete="off" placeholder="请输入零件名称"></el-input>
  486. </el-form-item>
  487. <el-form-item label="零件寿命" prop="life">
  488. <el-input v-model="editParts.life" autocomplete="off" placeholder="请输入零件寿命"></el-input>
  489. </el-form-item>
  490. </el-form>
  491. <div slot="footer" class="dialog-footer">
  492. <el-button @click.native="editPortVisible = false">取消</el-button>
  493. <el-button type="primary" @click.native="editPartVisible" :loading="editLoading">提交</el-button>
  494. </div>
  495. </el-dialog>
  496. <!--更新界面-->
  497. <el-dialog title="更新模具" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth">
  498. <el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm" :inline="true" class="demo-form-inline">
  499. <el-form-item label="模具名称" prop="modelName">
  500. <el-input v-model="addForm.modelName" autocomplete="off" placeholder="请输入模具名称"></el-input>
  501. </el-form-item>
  502. <el-form-item label="初始模次" prop="initialModulus">
  503. <el-input v-model="addForm.initialModulus" autocomplete="off" placeholder="请输入初始模次"></el-input>
  504. </el-form-item>
  505. <el-form-item label="模次寿命" prop="settingLife">
  506. <el-input v-model="addForm.settingLife" autocomplete="off" placeholder="请输入模次寿命"></el-input>
  507. </el-form-item>
  508. <el-form-item label="RIFD码" prop="rfid">
  509. <el-input v-model="addForm.rfid" autocomplete="off" placeholder="请输入RIFD码"></el-input>
  510. </el-form-item>
  511. <el-form-item label="穴数" prop="holes">
  512. <el-input v-model="addForm.holes" autocomplete="off" placeholder="请输入穴数"></el-input>
  513. </el-form-item>
  514. <el-form-item label="保养次数" prop="maintainCount">
  515. <el-select v-model="addForm.maintainCount" clearable multiple allow-create filterable default-first-option placeholder="请选择保养次数" style="width:515px">
  516. <el-option v-for="item in maintainCount" :key="item" :label="item" :value="item"></el-option>
  517. </el-select>
  518. </el-form-item>
  519. </el-form>
  520. <div slot="footer" class="dialog-footer">
  521. <el-button @click.native="addFormVisible = false">取消</el-button>
  522. <el-button type="primary" @click.native="inviteSubmit" :loading="addLoading">提交</el-button>
  523. </div>
  524. </el-dialog>
  525. </section>
  526. </template>
  527. <script>
  528. import util from "../../common/js/util";
  529. export default {
  530. data() {
  531. return {
  532. detailId: this.$route.params.id,
  533. user: JSON.parse(sessionStorage.getItem("user")),
  534. moldDetail: {},
  535. customCompany: [],
  536. //操作记录的时间
  537. recordTime: "",
  538. //单独新增零件时所需的三个变量
  539. newParts: {
  540. number: "",
  541. name: "",
  542. life: ""
  543. },
  544. uploading:[false, false, false, false],
  545. editParts: {
  546. id: 0,
  547. number: "",
  548. name: "",
  549. life: ""
  550. },
  551. maintainCount: [5000,10000],
  552. formRules: {
  553. modelName: [
  554. { required: true, message: "请输入模具名称", trigger: "blur" }
  555. ],
  556. initialModulus: [
  557. { required: true, message: "请输入初始模次", trigger: "blur" }
  558. ],
  559. settingLife: [
  560. { required: true, message: "请输入模次寿命", trigger: "blur" }
  561. ],
  562. rfid: [
  563. { required: true, message: "请输入RIFD码", trigger: "blur" }
  564. ],
  565. holes: [
  566. { required: true, message: "请输入穴数", trigger: "blur" }
  567. ],
  568. maintainCount: [
  569. { required: true, message: "请输入保养次数", trigger: ["blur", "change"] }
  570. ],
  571. number: [
  572. { required: true, message: "请输入零件编号", trigger: "blur" }
  573. ],
  574. name: [
  575. { required: true, message: "请输入零件名称", trigger: "blur" }
  576. ],
  577. life: [
  578. { required: true, message: "请输入零件寿命次数", trigger: "blur" }
  579. ],
  580. },
  581. //权限
  582. update: 0,
  583. download: 0,
  584. view: 0,
  585. approve: 0,
  586. canInitiate: true,
  587. //根据状态判断能否更新
  588. updateAble: true,
  589. //6种文档
  590. documents: {
  591. mould: [],
  592. part: [],
  593. check: [],
  594. maintain: [],
  595. update: [],
  596. abandon: []
  597. },
  598. //2D还是3D
  599. fileType: 1,
  600. //操作记录
  601. operations: [],
  602. allDetail: {
  603. overflow: "auto",
  604. padding: "0px 5px",
  605. height: 0
  606. },
  607. centerDialogVisible: false, //审批界面
  608. centerDialog2Visible: false, //模具界面
  609. centerDialog3Visible: false, //创建零件界面
  610. centerDialog4Visible: false, //零件文档上传界面
  611. centerDialog5Visible: false, //批量导出操作界面
  612. editPortVisible: false,//编辑零件界面
  613. editLoading: false,
  614. listLoading: false,
  615. activeTab: 0,
  616. activePage: 0,
  617. activeArticleId: null,
  618. activeFileName: null,
  619. fileUrl: null,
  620. boxes: [],
  621. companys: [],
  622. projects: [],
  623. maintainCount: [5000,10000,15000,20000,25000],
  624. addLoading: false,
  625. addFormVisible: false,
  626. addForm: {
  627. modelName: "",
  628. initialModulus: "",
  629. settingLife: "",
  630. maintainCount: [],
  631. rfid: "",
  632. holes: "",
  633. },
  634. //零件文件
  635. files: [],
  636. //报废文件
  637. files2: [null, null],
  638. twoId: null,
  639. threeId: null,
  640. };
  641. },
  642. methods: {
  643. backToList() {
  644. this.$router.go(-1);
  645. },
  646. toDetection() {
  647. this.$router.push("/detection");
  648. },
  649. toPro(id) {
  650. this.$router.push('/project/' + id);
  651. },
  652. toAnotherMould(id){
  653. var currentRoute = this.$route.path.split("/");
  654. if (currentRoute.length == 3 && currentRoute[1] == "moldList") {
  655. this.$router.go(0);
  656. }
  657. this.$router.push('/mould/' + id);
  658. },
  659. //标签页面切换时
  660. handleClick(tab, event) {
  661. this.activeTab = tab.name;
  662. this.getOperationRecord(this.activeTab);
  663. },
  664. //意义不明的获取资产方公司的设备列表
  665. getMsg() {
  666. this.http.post( this.port.base.moulds, {
  667. belongCompanyId: this.user.companyId,
  668. mouldId: this.detailId
  669. },
  670. res => {
  671. if (res.code == "ok") {
  672. this.boxes = res.data;
  673. } else {
  674. this.$message({
  675. message: res.msg,
  676. type: "error"
  677. });
  678. }
  679. },
  680. error => {
  681. this.listLoading = false;
  682. this.$message({
  683. message: error,
  684. type: "error"
  685. });
  686. });
  687. },
  688. //模具详情
  689. getDetail() {
  690. this.http.post( this.port.mold.moldDetail, {
  691. id: this.detailId
  692. },
  693. res => {
  694. if (res.code == "ok") {
  695. var detail = res.data.vo;
  696. if (detail.endTime == null) {
  697. detail.diffTime = "";
  698. } else {
  699. detail.diffTime = util.formatDate.dateDiff(
  700. util.formatDate.format(new Date(detail.endTime), "yyyy-MM-dd"),
  701. util.formatDate.format(new Date(new Date()), "yyyy-MM-dd")
  702. );
  703. }
  704. this.moldDetail = detail;
  705. this.customCompany = res.data.customCompany;
  706. this.update = res.data.update;
  707. this.download = res.data.download;
  708. this.view = res.data.view;
  709. this.approve = res.data.approve;
  710. this.getDocument();
  711. this.getPartList();
  712. } else {
  713. this.$message({
  714. message: res.msg,
  715. type: "error"
  716. });
  717. }
  718. },
  719. error => {
  720. this.$message({
  721. message: error,
  722. type: "error"
  723. });
  724. });
  725. },
  726. //打开编辑
  727. edit() {
  728. this.editFormVisible = true;
  729. var maintainCount = this.moldDetail.maintainCount;
  730. maintainCount = maintainCount.split(",");
  731. this.editForm = {
  732. id: this.moldDetail.id,
  733. modelName: this.moldDetail.modelName,
  734. modelNo: this.moldDetail.modelNo,
  735. equipmentId: this.moldDetail.equipmentId,
  736. initialModulus: this.moldDetail.initialModulus,
  737. settingLife: this.moldDetail.settingLife,
  738. rfid: this.moldDetail.rfid,
  739. produceCompanyId: this.moldDetail.produceCompanyId,
  740. maintainCount: maintainCount,
  741. flag: 1
  742. };
  743. },
  744. addSubmit() {
  745. this.$refs.editForm.validate(valid => {
  746. if (valid) {
  747. this.editLoading = true;
  748. var maintainCount = this.editForm.maintainCount , str = "";
  749. for(var i in maintainCount) {
  750. if(i == maintainCount.length-1){
  751. str += maintainCount[i]
  752. } else {
  753. str += maintainCount[i] + ","
  754. }
  755. }
  756. this.editForm.maintainCount = str;
  757. this.http.post( this.port.mold.addMold, this.editForm,
  758. res => {
  759. this.editLoading = false;
  760. if (res.code == "ok") {
  761. this.editFormVisible = false;
  762. this.$message({
  763. message: "修改成功",
  764. type: "success"
  765. });
  766. this.getDetail();
  767. } else {
  768. this.$message({
  769. message: res.msg,
  770. type: "error"
  771. });
  772. }
  773. },
  774. error => {
  775. this.editLoading = false;
  776. this.editFormVisible = false;
  777. this.$message({
  778. message: error,
  779. type: "error"
  780. });
  781. });
  782. }
  783. });
  784. },
  785. //获取文档
  786. getDocument() {
  787. this.http.post( this.port.mold.moldFileListAll, {
  788. mouldId: this.detailId
  789. },
  790. res => {
  791. if (res.code == "ok") {
  792. for(var i in res.data){
  793. this.setList(res.data[i].list,i);
  794. }
  795. //顺便再把下面操作记录读取一下
  796. this.getOperationRecord(this.activeTab);
  797. //顺便再看看可不可以申请更新
  798. this.checkUpdateState();
  799. } else {
  800. this.$message({
  801. message: res.msg,
  802. type: "error"
  803. });
  804. }
  805. },
  806. error => {
  807. this.$message({
  808. message: error,
  809. type: "error"
  810. });
  811. });
  812. },
  813. //查看有无审核中或者审核成功的更新申请
  814. checkUpdateState(){
  815. this.updateAble = true;
  816. this.documents.update.forEach(item => {
  817. if(item.state != "-1" || item.state != "-2"){
  818. //有进行中的更新申请 现在不能再申请更新了
  819. this.updateAble = false;
  820. }
  821. });
  822. },
  823. //将list中对应的文件传入相应的document下
  824. setList(list, num) {
  825. var array = [];
  826. for(var i in list){
  827. if(this.approve == 1){
  828. array.push(list[i]);
  829. } else {
  830. if(list[i].uplodtorId == this.user.id){
  831. array.push(list[i]);
  832. }
  833. }
  834. }
  835. if(num == 0){
  836. this.documents.mould = array;
  837. } else if(num == 1) {
  838. //this.documents.part = array;
  839. } else if(num == 2) {
  840. this.documents.check = array;
  841. } else if(num == 3) {
  842. this.documents.maintain = array;
  843. } else if(num == 4) {
  844. for(var i in array){
  845. if(i == 0){
  846. if(array[i].state == 3){
  847. this.canInitiate = false
  848. } else if(array[i].state < 0) {
  849. this.canInitiate = true
  850. }
  851. }
  852. }
  853. this.documents.update = array;
  854. } else if(num == 5) {
  855. this.documents.abandon = array;
  856. }
  857. },
  858. //打开审批窗口
  859. checkOpen(row) {
  860. this.activeArticleId = row.id;
  861. this.activeFileName = row.fileName;
  862. this.fileUrl = row.fileUrl;
  863. this.twoId = null;
  864. this.threeId = null;
  865. this.centerDialogVisible = true;
  866. },
  867. //打开审批窗口
  868. checkOpenPort(row) {
  869. if(row.part2dFile != null) {
  870. this.twoId = row.part2dFile.id
  871. }
  872. if(row.part3dFile != null) {
  873. this.threeId = row.part3dFile.id
  874. }
  875. this.activeArticleId = null;
  876. this.activeFileName = null;
  877. this.centerDialogVisible = true;
  878. },
  879. //清理零件文档上传窗口中的文件
  880. clearFileRecord2() {
  881. this.centerDialog4Visible = false;
  882. this.$refs.upload4.clearFiles();
  883. },
  884. //审批文件
  885. check(adoption) {
  886. if(this.activeArticleId != null) {
  887. this.onSubMit(this.activeArticleId , adoption , 0)
  888. }
  889. if(this.twoId != null) {
  890. this.onSubMit(this.twoId , adoption , 1)
  891. }
  892. if(this.threeId != null) {
  893. this.onSubMit(this.threeId , adoption , 1)
  894. }
  895. },
  896. onSubMit(id , type , from) {
  897. this.http.post( this.port.mold.moldFileCheck, {
  898. mouldFileId: id,
  899. isPass: type ? 1 : 0 //通过为1 不通过为0
  900. },
  901. res => {
  902. if (res.code == "ok") {
  903. this.centerDialogVisible = false;
  904. this.$message({
  905. message: "审批成功",
  906. type: "success"
  907. });
  908. if(from == 0){
  909. this.getDocument();
  910. } else {
  911. this.getPartList();
  912. }
  913. } else {
  914. this.$message({
  915. message: res.msg,
  916. type: "error"
  917. });
  918. }
  919. },
  920. error => {
  921. this.$message({
  922. message: error,
  923. type: "error"
  924. });
  925. }
  926. );
  927. },
  928. //更新审批通过
  929. checkUpdate(id, approval) {
  930. var tipString = "";
  931. if(approval){
  932. tipString = "确认通过审批吗?";
  933. }else{
  934. tipString = "确认不通过审批吗?";
  935. }
  936. this.$confirm(tipString, '审批', {
  937. type: approval?'success':'error'
  938. }).then(() => {
  939. this.http.post( this.port.mold.moldFileCheck, {
  940. mouldFileId: id,
  941. isPass: approval ? 1 : 0 //通过为1 不通过为0
  942. },
  943. res => {
  944. if (res.code == "ok") {
  945. this.$message({
  946. message: "审批完成",
  947. type: "success"
  948. });
  949. this.getDocument();
  950. } else {
  951. this.$message({
  952. message: res.msg,
  953. type: "error"
  954. });
  955. }
  956. },
  957. error => {
  958. this.$message({
  959. message: error,
  960. type: "error"
  961. });
  962. }
  963. );
  964. })
  965. },
  966. //文件上传
  967. uploadFile(params) {
  968. var fileObj = params.file;
  969. var form = new FormData();
  970. form.append("file", fileObj);
  971. form.append("belongType", this.activeTab);
  972. form.append("mouldId", this.detailId);
  973. if (this.activeTab == 0 || this.activeTab == 1) {
  974. form.append("dwgType", this.fileType);
  975. }
  976. this.http.uploadFile( this.port.mold.moldFileUpload, form,
  977. res => {
  978. if (res.code == "ok") {
  979. this.$message({
  980. message: "上传成功",
  981. type: "success"
  982. });
  983. this.$refs.upload.clearFiles();
  984. this.getDocument();
  985. } else {
  986. this.$message({
  987. message: res.msg,
  988. type: "error"
  989. });
  990. }
  991. },
  992. error => {
  993. this.$message({
  994. message: error,
  995. type: "error"
  996. });
  997. });
  998. },
  999. //文件下载
  1000. dowloadfile(id) {
  1001. this.http.post( this.port.mold.moldFileDowload, {
  1002. id: id
  1003. },
  1004. res => {
  1005. // const elink = document.createElement('a')
  1006. // elink.download = row.fileName
  1007. // elink.style.display = 'none'
  1008. // const blob = new Blob([res])
  1009. // elink.href = URL.createObjectURL(blob)
  1010. // document.body.appendChild(elink)
  1011. // elink.click()
  1012. // document.body.removeChild(elink)
  1013. this.getOperationRecord(this.activePage);
  1014. },
  1015. error => {
  1016. this.$message({
  1017. message: error,
  1018. type: "error"
  1019. });
  1020. });
  1021. },
  1022. //文件删除
  1023. deleteFile(fileId) {
  1024. this.$confirm('确认删除该文档吗?', '提示', {
  1025. type: 'warning'
  1026. }).then(() => {
  1027. this.http.post( this.port.mold.moldFileDelete, { id: fileId },
  1028. res => {
  1029. if (res.code == "ok") {
  1030. this.$message({
  1031. message: "删除成功",
  1032. type: "success"
  1033. });
  1034. this.getDocument();
  1035. } else {
  1036. this.$message({
  1037. message: res.msg,
  1038. type: "error"
  1039. });
  1040. }
  1041. },
  1042. error => {
  1043. this.$message({
  1044. message: error,
  1045. type: "error"
  1046. });
  1047. });
  1048. }).catch(() => {});
  1049. },
  1050. //零件新建
  1051. subPart() {
  1052. this.$refs.newParts.validate(valid => {
  1053. if (valid) {
  1054. this.editLoading = true;
  1055. this.http.post( this.port.mold.addPart, {
  1056. partNo: this.newParts.number,
  1057. partName: this.newParts.name,
  1058. partLife: this.newParts.life,
  1059. mouldId: this.detailId
  1060. },
  1061. res => {
  1062. this.editLoading = false;
  1063. if (res.code == "ok") {
  1064. this.centerDialog3Visible = false;
  1065. this.$message({
  1066. message: "新建成功",
  1067. type: "success"
  1068. });
  1069. this.getPartList();
  1070. } else {
  1071. this.$message({
  1072. message: res.msg,
  1073. type: "error"
  1074. });
  1075. }
  1076. },
  1077. error => {
  1078. this.editLoading = false;
  1079. this.centerDialog3Visible = false;
  1080. this.$message({
  1081. message: error,
  1082. type: "error"
  1083. });
  1084. });
  1085. }
  1086. })
  1087. },
  1088. //打开零件修改
  1089. editPort(row) {
  1090. this.editPortVisible = true;
  1091. this.editParts = {
  1092. id: row.id,
  1093. number: row.partNo,
  1094. name: row.partName,
  1095. life: row.partLife
  1096. }
  1097. },
  1098. editPartVisible() {
  1099. this.$refs.editParts.validate(valid => {
  1100. if (valid) {
  1101. this.editLoading = true;
  1102. this.http.post( this.port.mold.addPart, {
  1103. partNo: this.editParts.number,
  1104. partName: this.editParts.name,
  1105. partLife: this.editParts.life,
  1106. mouldId: this.detailId,
  1107. id: this.editParts.id
  1108. },
  1109. res => {
  1110. this.editLoading = false;
  1111. if (res.code == "ok") {
  1112. this.editPortVisible = false;
  1113. this.$message({
  1114. message: "新建成功",
  1115. type: "success"
  1116. });
  1117. this.getPartList();
  1118. } else {
  1119. this.$message({
  1120. message: res.msg,
  1121. type: "error"
  1122. });
  1123. }
  1124. },
  1125. error => {
  1126. this.editLoading = false;
  1127. this.editPortVisible = false;
  1128. this.$message({
  1129. message: error,
  1130. type: "error"
  1131. });
  1132. });
  1133. }
  1134. })
  1135. },
  1136. //零件列表
  1137. getPartList() {
  1138. this.http.post( this.port.mold.partList, {
  1139. mouldId: this.detailId
  1140. },
  1141. res => {
  1142. if (res.code == "ok") {
  1143. var list = res.data;
  1144. for(var i in list){
  1145. if(list[i].state == null){
  1146. list[i].state = 100;
  1147. }
  1148. }
  1149. this.documents.part = list;
  1150. } else {
  1151. this.$message({
  1152. message: res.msg,
  1153. type: "error"
  1154. });
  1155. }
  1156. },
  1157. error => {
  1158. this.$message({
  1159. message: error,
  1160. type: "error"
  1161. });
  1162. });
  1163. },
  1164. //零件导入
  1165. uploadPart(params) {
  1166. var fileObj = params.file;
  1167. var form = new FormData();
  1168. form.append("file", fileObj);
  1169. form.append("mouldId", this.detailId);
  1170. this.http.uploadFile( this.port.mold.importPart, form,
  1171. res => {
  1172. if (res.code == "ok") {
  1173. this.$message({
  1174. message: "上传成功",
  1175. type: "success"
  1176. });
  1177. this.$refs.upload.clearFiles();
  1178. this.getPartList();
  1179. } else {
  1180. this.$message({
  1181. message: res.msg,
  1182. type: "error"
  1183. });
  1184. }
  1185. },
  1186. error => {
  1187. this.$message({
  1188. message: error,
  1189. type: "error"
  1190. });
  1191. });
  1192. },
  1193. //零件文档批量
  1194. beforeRemove(params) {
  1195. for(var i in this.files){
  1196. if(this.files[i].uid == params.uid) {
  1197. this.files.splice(i , 1);
  1198. }
  1199. }
  1200. },
  1201. uploadPartFile(params) {
  1202. this.files.push(params.file);
  1203. return false;
  1204. },
  1205. uploadFilePart() {
  1206. var fileObj = this.files;
  1207. var form = new FormData();
  1208. for(var i in fileObj){
  1209. form.append("file", fileObj[i]);
  1210. }
  1211. form.append("mouldId", this.detailId);
  1212. this.http.uploadFile( this.port.mold.partUpload, form,
  1213. res => {
  1214. if (res.code == "ok") {
  1215. this.$message({
  1216. message: "上传成功",
  1217. type: "success"
  1218. });
  1219. this.centerDialog4Visible = false;
  1220. this.$refs.upload4.clearFiles();
  1221. this.getPartList();
  1222. } else {
  1223. this.$message({
  1224. message: res.msg,
  1225. type: "error"
  1226. });
  1227. }
  1228. },
  1229. error => {
  1230. this.centerDialog4Visible = false;
  1231. this.$message({
  1232. message: error,
  1233. type: "error"
  1234. });
  1235. });
  1236. },
  1237. //报废文件上传
  1238. discardUpload() {
  1239. if (this.files2[0] != null && this.files2[1] != null) {
  1240. var form = new FormData();
  1241. form.append("file", this.files2[0]);
  1242. form.append("file2", this.files2[1]);
  1243. form.append("belongType", this.activeTab);
  1244. form.append("mouldId", this.detailId);
  1245. if (this.activeTab == 0 || this.activeTab == 1) {
  1246. form.append("dwgType", this.fileType);
  1247. }
  1248. this.http.uploadFile( this.port.mold.moldFileUpload, form,
  1249. res => {
  1250. if (res.code == "ok") {
  1251. this.$message({
  1252. message: "上传成功",
  1253. type: "success"
  1254. });
  1255. this.centerDialog2Visible = false;
  1256. this.clearFileRecord();
  1257. this.getDocument();
  1258. } else {
  1259. this.$message({
  1260. message: res.msg,
  1261. type: "error"
  1262. });
  1263. }
  1264. },
  1265. error => {
  1266. this.$message({
  1267. message: error,
  1268. type: "error"
  1269. });
  1270. });
  1271. } else {
  1272. console.log(this.files2);
  1273. this.$message({
  1274. message: "必须各上传一个文件",
  1275. type: "error"
  1276. });
  1277. }
  1278. },
  1279. //清理报废文档上传窗口中的文件
  1280. clearFileRecord() {
  1281. this.centerDialog2Visible = false;
  1282. this.$refs.upload1.clearFiles();
  1283. this.$refs.upload2.clearFiles();
  1284. this.files2[0] = null;
  1285. this.files2[1] = null;
  1286. },
  1287. //报废的申请单上传
  1288. uploadDiscardFile1(params){
  1289. this.files2[0] = params.file;
  1290. return false;
  1291. },
  1292. //报废的报废单上传
  1293. uploadDiscardFile2(params){
  1294. this.files2[1] = params.file;
  1295. return false;
  1296. },
  1297. //报废的申请单移除
  1298. beforeRemove1(params) {
  1299. this.files2[0] = null;
  1300. },
  1301. //报废的报废单移除
  1302. beforeRemove2(params) {
  1303. this.files2[0] = null;
  1304. },
  1305. //获取操作记录
  1306. getOperationRecord(type) {
  1307. this.http.post( this.port.mold.moldOperationList, {
  1308. mouldId: this.detailId,
  1309. belongType: type
  1310. },
  1311. res => {
  1312. if (res.code == "ok") {
  1313. this.operations = res.data;
  1314. } else {
  1315. this.$message({
  1316. message: res.msg,
  1317. type: "error"
  1318. });
  1319. }
  1320. },
  1321. error => {
  1322. this.$message({
  1323. message: error,
  1324. type: "error"
  1325. });
  1326. });
  1327. },
  1328. //更新申请
  1329. updateRequest(){
  1330. this.$confirm('要申请更新模具吗?', '申请', {
  1331. type: 'info'
  1332. }).then(() => {
  1333. this.http.post( this.port.mold.moldFileUpload, {
  1334. belongType: 4,
  1335. mouldId: this.detailId
  1336. },
  1337. res => {
  1338. if (res.code == "ok") {
  1339. this.$message({
  1340. message: "申请成功",
  1341. type: "success"
  1342. });
  1343. this.getDocument();
  1344. } else {
  1345. this.$message({
  1346. message: res.msg,
  1347. type: "error"
  1348. });
  1349. }
  1350. },
  1351. error => {
  1352. this.$message({
  1353. message: error,
  1354. type: "error"
  1355. });
  1356. });
  1357. }).catch(() => {});
  1358. },
  1359. //导出操作记录
  1360. exportRecords(){
  1361. if(this.recordTime[0] == null || this.recordTime[1] == null){
  1362. this.$message({
  1363. message: "未输入时间",
  1364. type: "error"
  1365. });
  1366. }else{
  1367. this.centerDialog5Visible = false;
  1368. this.http.post( this.port.mold.exportOperationExcel, {
  1369. mouldId: this.detailId,
  1370. startTime: this.recordTime[0],
  1371. endTime: this.recordTime[1]
  1372. },
  1373. res => {
  1374. if (res.code == "ok") {
  1375. let aTag = document.createElement('a');
  1376. let blob = new Blob([res.data]);
  1377. var arr = res.data.split("/");
  1378. aTag.download = arr.pop();
  1379. aTag.href = URL.createObjectURL(blob);
  1380. aTag.click();              
  1381. URL.revokeObjectURL(blob);
  1382. } else {
  1383. this.$message({
  1384. message: res.msg,
  1385. type: "error"
  1386. });
  1387. }
  1388. },
  1389. error => {
  1390. this.$message({
  1391. message: error,
  1392. type: "error"
  1393. });
  1394. });
  1395. }
  1396. },
  1397. //更新弹框
  1398. showAdd(id) {
  1399. this.addFormVisible = true;
  1400. this.addForm = {
  1401. dynamicId: id,
  1402. modelName: "",
  1403. initialModulus: "",
  1404. settingLife: "",
  1405. maintainCount: [],
  1406. rfid: "",
  1407. holes: ""
  1408. };
  1409. },
  1410. //更新提交
  1411. inviteSubmit(){
  1412. this.$refs.addForm.validate(valid => {
  1413. if (valid) {
  1414. this.addLoading = true;
  1415. var maintainCount = this.addForm.maintainCount , str = "";
  1416. for(var i in maintainCount) {
  1417. if(i == maintainCount.length-1){
  1418. str += maintainCount[i]
  1419. } else {
  1420. str += maintainCount[i] + ","
  1421. }
  1422. }
  1423. this.addForm.maintainCount = str;
  1424. this.addForm.preUpdateId = this.detailId;
  1425. this.http.post( this.port.mold.addMold, this.addForm,
  1426. res => {
  1427. this.addLoading = false;
  1428. if (res.code == "ok") {
  1429. this.addFormVisible = false;
  1430. this.$message({
  1431. message: "更新成功",
  1432. type: "success"
  1433. });
  1434. this.$router.push("/moldList/" + res.data.id );
  1435. this.detailId = res.data.id;
  1436. this.getDetail();
  1437. } else {
  1438. this.$message({
  1439. message: res.msg,
  1440. type: "error"
  1441. });
  1442. }
  1443. },
  1444. error => {
  1445. this.addLoading = false;
  1446. this.addFormVisible = false;
  1447. this.$message({
  1448. message: error,
  1449. type: "error"
  1450. });
  1451. });
  1452. }
  1453. });
  1454. }
  1455. },
  1456. created() {
  1457. let height = window.innerHeight;
  1458. this.allDetail.height = height - 170 + "px";
  1459. const that = this;
  1460. window.onresize = function temp() {
  1461. that.allDetail.height = window.innerHeight - 170;
  1462. };
  1463. },
  1464. mounted() {
  1465. // this.getMsg();
  1466. this.getDetail();
  1467. }
  1468. };
  1469. </script>
  1470. <style scoped>
  1471. a {
  1472. text-decoration: none;
  1473. }
  1474. .toolbar .el-form-item {
  1475. font-size: 14px;
  1476. vertical-align: middle;
  1477. }
  1478. .back {
  1479. font-size: 16px;
  1480. }
  1481. .divLine {
  1482. width: 2px;
  1483. background: #c3c3c3;
  1484. height: 100%;
  1485. }
  1486. .projectTitle {
  1487. font-size: 18px;
  1488. color: #333;
  1489. }
  1490. .state {
  1491. float: right;
  1492. }
  1493. .tips {
  1494. color: #bbb;
  1495. }
  1496. .title {
  1497. padding-left: 10px;
  1498. padding-bottom: 0px;
  1499. margin: 20px 0;
  1500. font-size: 16px;
  1501. line-height: 24px;
  1502. border-left: 1px #20a0ff solid;
  1503. }
  1504. .editDetail {
  1505. margin-left: 10px;
  1506. color: #20a0ff;
  1507. cursor: pointer;
  1508. }
  1509. .download {
  1510. text-decoration:none;
  1511. color: #20a0ff;
  1512. cursor: pointer;
  1513. }
  1514. .info {
  1515. color: grey;
  1516. }
  1517. .belongPro {
  1518. cursor: pointer;
  1519. color:#20a0ff;
  1520. }
  1521. .main {
  1522. padding-left: 10px;
  1523. }
  1524. .detail {
  1525. margin-bottom: 20px;
  1526. }
  1527. </style>