moldDetail.vue 68 KB

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