moldDetail.vue 77 KB

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