maintenance.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  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="backToDetection" icon="el-icon-back" class="back">{{$t('base.back')}}</el-button>
  8. </el-form-item>
  9. <el-form-item class="divLine"></el-form-item>
  10. <el-form-item>{{mouldName}}</el-form-item>
  11. <el-form-item class="state" style="float: right;">{{$t('runTest.state')}}:
  12. <span style="color:#909399" v-if="mouldState == 0">{{$t('base.static')}}</span>
  13. <span style="color:#00CD66" v-else-if="mouldState == 1">{{$t('base.run')}}</span>
  14. <span style="color:#F56C6C" v-else-if="mouldState == 2">{{$t('base.warning')}}</span>
  15. <span style="color:#909399" v-else-if="mouldState == 3">{{$t('mold.beScrapped')}}</span>
  16. <span style="color:#909399" v-else-if="mouldState == 4">{{$t('mold.scraped')}}</span>
  17. <span style="color:#F56C6C" v-else-if="mouldState == 5">{{$t('mold.abnormal')}}</span>
  18. <span style="color:#F56C6C" v-else-if="mouldState == 6">{{$t('mold.dropped')}}</span>
  19. </el-form-item>
  20. </el-form>
  21. </el-col>
  22. <el-col :span="24" :style="allDetail">
  23. <!-- 模具处理 -->
  24. <el-col :span="24" class="title">{{$t('runTest.processMold')}}</el-col>
  25. <el-col :span="9" style="line-height: 32px; border-right: #c3c3c3 1px solid;">
  26. {{$t('runTest.nowState')}}:
  27. <span v-if="requirement" style="color: #ff4949;">{{$t('runTest.isMaintain0')}}</span>
  28. <span v-else style="color: black;">{{$t('runTest.isMaintain1')}}</span>
  29. <el-button size="small" type="primary" @click="showMaintenance" style="margin-left: 16px;"
  30. v-if="!(user.parentId == 1 && user.subordinateType == 1) && requirement">
  31. {{$t('runTest.immediate')}}
  32. </el-button>
  33. </el-col>
  34. <el-col :span="8" :offset="1" style="line-height: 32px;">
  35. {{$t('runTest.stage')}}:{{warningInfo}}
  36. <el-button size="small" type="primary" @click="warningFormVisible = true" style="margin-left: 16px;"
  37. v-if="!(user.parentId == 1 && user.subordinateType == 1) && stage != 0">
  38. {{$t('runTest.immediate')}}
  39. </el-button>
  40. </el-col>
  41. <!-- 开合周期 -->
  42. <el-col :span="24" class="title">{{$t('runTest.openCycle')}}</el-col>
  43. <el-col :span="24">
  44. <el-col :span="11">
  45. <div style="padding:0 20px">
  46. <b style="font-size:20px;text-align:center;margin-bottom:20px;">{{$t('runTest.openNumChart')}}</b>
  47. <el-date-picker v-model="openNum" style="float:right;width:125px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  48. @change='changeOpen(1)' size="mini" :clearable="false" type="date" :placeholder="$t('el.datepicker.selectDate')"></el-date-picker>
  49. </div>
  50. <div id="myChart1" :style="{ height: '300px'}"></div>
  51. </el-col>
  52. <el-col :span="11" :offset="2">
  53. <div style="padding:0 20px">
  54. <b style="font-size:20px;text-align:center;margin-bottom:20px;">{{$t('runTest.openCycleChart')}}</b>
  55. <!-- <el-date-picker v-model="openCycle" style="float:right;width:210px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  56. @change='changeOpen(2)' size="mini" :clearable="false" type="daterange"
  57. :start-placeholder="$t('el.datepicker.startDate')" :end-placeholder="$t('el.datepicker.endDate')"></el-date-picker> -->
  58. <el-date-picker v-model="openCycle" style="float:right;width:125px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  59. @change='changeOpen(2)' size="mini" :clearable="false" type="date" :placeholder="$t('el.datepicker.selectDate')"></el-date-picker>
  60. </div>
  61. <div id="myChart2" :style="{ height: '300px'}"></div>
  62. </el-col>
  63. </el-col>
  64. <!-- 操作记录 -->
  65. <el-col :span="24" class="title">{{$t('runTest.record')}}</el-col>
  66. <!-- 列表 -->
  67. <el-table :data="records" highlight-current-row v-loading="listLoading" style="width: 100%;" :height="tableHeight">
  68. <el-table-column type="index" width="60"></el-table-column>
  69. <el-table-column prop="maintainUserName" :label="$t('runTest.maintainUser')" width="250" sortable></el-table-column>
  70. <el-table-column prop="maintainType" :label="$t('runTest.maintainType')" sortable>
  71. <template slot-scope="scope">
  72. <span v-if="scope.row.maintainType == 0">{{$t('runTest.spray')}}</span>
  73. <span v-else-if="scope.row.maintainType == 1">{{$t('runTest.check')}}</span>
  74. <span v-else="scope.row.maintainType == 2">{{$t('runTest.vulnerable')}}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="fileName" :label="$t('runTest.fileName')" width="200" sortable>
  78. <template slot-scope="scope" v-if="scope.row.fileUrl != null">
  79. <!-- <a style="color: #409EFF; cursor: pointer; text-decoration: none;"
  80. :href="scope.row.fileUrl" :download="scope.row.fileName"> -->
  81. <!-- 大图加载 -->
  82. <div class="demo-image__preview">
  83. <el-image style="width: 100px; height: 100px"
  84. :src="scope.row.fileUrl" :preview-src-list="scope.row.fileUrl"></el-image>
  85. </div>
  86. <!-- </a> -->
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="indate" :label="$t('runTest.closeTime')" width="200" sortable></el-table-column>
  90. </el-table>
  91. <!--工具条-->
  92. <el-col :span="24" class="toolbar">
  93. <el-pagination
  94. @size-change="handleSizeChange"
  95. @current-change="handleCurrentChange"
  96. :page-sizes="[20 , 50 , 80 , 100 , 200]"
  97. :page-size="20"
  98. layout="total, sizes, prev, pager, next"
  99. :total="total"
  100. style="float:right;"
  101. ></el-pagination>
  102. </el-col>
  103. </el-col>
  104. <!--新增界面-->
  105. <el-dialog :title="$t('runTest.maintenance')" v-if="maintenanceFormVisible" :visible.sync="maintenanceFormVisible" :close-on-click-modal="false" customClass="customWidth">
  106. <el-form :model="maintenanceForm" label-width="135px" :rules="formRules" ref="addForm">
  107. <!-- 保养类型选择 -->
  108. <el-form-item :label="$t('runTest.type')" prop="type">
  109. <el-select v-model="type.value" filterable :placeholder="$t('runTest.inputType')" style="width:500px">
  110. <el-option v-for="item in type" :key="item.value" :label="item.label" :value="item.value"></el-option>
  111. </el-select>
  112. </el-form-item>
  113. <!-- 保养类型为1时 选择易损件ID -->
  114. <el-form-item v-if="type.value == 1" :label="$t('runTest.vulnerable')" prop="vulnerable">
  115. <el-select v-model="vulnerable.value" clearable filterable :placeholder="$t('runTest.inputVulnerable')" style="width: 500px;">
  116. <el-option v-for="item in vulnerable" :key="item.value" :label="item.label" :value="item.value"></el-option>
  117. </el-select>
  118. </el-form-item>
  119. <!-- 保养类型为0时 选择保养动作 -->
  120. <el-form-item v-else :label="$t('runTest.action')" prop="action">
  121. <el-select v-model="action.value" filterable :placeholder="$t('runTest.inputAction')" style="width: 500px;">
  122. <el-option v-for="item in action" :key="item.value" :label="item.label" :value="item.value"></el-option>
  123. </el-select>
  124. </el-form-item>
  125. <el-form-item :label="$t('runTest.fileName')">
  126. <el-upload ref="upload" action="customize" :http-request="maintain" :limit="1" :auto-upload="false" :before-upload="beforeUpload">
  127. <el-button size="small" type="primary">{{$t('base.upload')}}</el-button>
  128. </el-upload>
  129. </el-form-item>
  130. </el-form>
  131. <div slot="footer" class="dialog-footer">
  132. <el-button @click.native="maintenanceFormVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
  133. <el-button type="primary" @click.native="maintainConfirm" :loading="maintenanceLoading">{{$t('runTest.process')}}</el-button>
  134. </div>
  135. </el-dialog>
  136. <!--告警处理界面-->
  137. <el-dialog :title="$t('runTest.dealWarning')" v-if="warningFormVisible" :visible.sync="warningFormVisible" :close-on-click-modal="false" customClass="customWidth">
  138. <el-form :model="warningForm" label-width="105px" :rules="formRules" ref="addForm">
  139. <el-form-item :label="$t('runTest.warningType')">
  140. <el-input :placeholder="$t('runTest.inputWarningType')" v-model="warningInfo" :disabled="true"></el-input>
  141. </el-form-item>
  142. <el-form-item :label="$t('runTest.moldSet')" prop="action">
  143. <el-select v-model="warningForm.equipmentId" filterable :placeholder="$t('runTest.inputMoldSet')" style="width:530px">
  144. <el-option v-for="item in equipments" :key="item.value" :label="item.label" :value="item.value"></el-option>
  145. </el-select>
  146. </el-form-item>
  147. </el-form>
  148. <div slot="footer" class="dialog-footer">
  149. <el-button @click.native="warningFormVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
  150. <el-button type="primary" @click.native="warningArrangement" :loading="warningLoading">{{$t('runTest.process')}}</el-button>
  151. </div>
  152. </el-dialog>
  153. </section>
  154. </template>
  155. <script>
  156. import util from "../../common/js/util";
  157. export default {
  158. data() {
  159. return {
  160. user: JSON.parse(sessionStorage.getItem("user")),
  161. detail: '',
  162. //本页模具ID
  163. mouldId: null,
  164. //模具名字
  165. mouldName: null,
  166. //模具状态
  167. mouldState: 0,
  168. //记录
  169. records: [],
  170. //警告信息
  171. warningInfo: "",
  172. stage: 0,
  173. //告警时需要更换的设备的列表
  174. equipments: [],
  175. //标题栏过滤器
  176. filters: {
  177. name: "",
  178. value: ""
  179. },
  180. listLoading: false,
  181. page: 1,
  182. size: 20,
  183. total: 0,
  184. tableHeight: 0,
  185. //活跃页面
  186. activePage: 0,
  187. formRules: {},
  188. //保养界面 种类
  189. type: [{ label: this.$t('runTest.action'), value: 0 }, { label: this.$t('runTest.vulnerable'), value: 1 }],
  190. //保养界面 动作
  191. action: [{ label: this.$t('runTest.spray'), value: 0 }, { label: this.$t('runTest.check'), value: 1 }],
  192. //易损件 假数据
  193. vulnerable: [],
  194. //是否需要保养 提示
  195. requirement: false,
  196. prompt: true,
  197. //保养详情界面显示
  198. maintenanceFormVisible: false,
  199. maintenanceLoading: false,
  200. //告警详情界面显示
  201. warningFormVisible: false,
  202. warningLoading: false,
  203. //保养详情界面数据
  204. maintenanceForm: {
  205. username: "",
  206. account: "",
  207. mobile: "",
  208. teamName: "",
  209. companyId: "",
  210. roleType: "",
  211. flag: 0
  212. },
  213. //告警处理截面数据
  214. warningForm: {
  215. mouldId: null,
  216. equipmentId: null
  217. },
  218. imageUrl: "",
  219. openNum: util.formatDate.format(new Date(), 'yyyy-MM-dd'),
  220. // openCycle: [util.formatDate.format(new Date(), 'yyyy-MM-dd') , util.formatDate.format(new Date(), 'yyyy-MM-dd')],
  221. openCycle: util.formatDate.format(new Date(), 'yyyy-MM-dd'),
  222. allDetail: {
  223. overflow: 'auto',
  224. padding: '0px 5px',
  225. height: 0
  226. },
  227. echarts1: {},
  228. echarts2: {},
  229. };
  230. },
  231. methods: {
  232. //分页
  233. handleCurrentChange(val) {
  234. this.page = val;
  235. this.getList();
  236. },
  237. handleSizeChange(val) {
  238. this.size = val;
  239. this.getList();
  240. },
  241. //标签页面切换时
  242. handleClick(tab, event) {
  243. this.activeTab = tab.name;
  244. //应该是取得对应的消息 目前还没写
  245. },
  246. selsChange: function(sels) {
  247. this.sels = sels;
  248. },
  249. backToDetection() {
  250. this.$router.go(-1);
  251. },
  252. //上传格式和大小限制
  253. beforeUpload(file) {
  254. const isJPG = file.type === "image/jpg";
  255. const isJPEG = file.type === "image/jpeg";
  256. const isPNG = file.type === "image/png";
  257. var rightType = isJPG || isPNG || isJPEG;
  258. const isLt5M = file.size / 1024 / 1024 < 5;
  259. if (!rightType) {
  260. this.$message.error(this.$t('msg.uploadType'));
  261. }
  262. if (!isLt5M) {
  263. this.$message.error(this.$t('msg.uploadSize'));
  264. }
  265. return rightType && isLt5M;
  266. },
  267. //显示保养界面
  268. showMaintenance: function() {
  269. this.maintenanceFormVisible = true;
  270. },
  271. //获取记录
  272. getList() {
  273. this.listLoading = true;
  274. this.http.post( this.port.mold.moldMaintainList, {
  275. mouldId: this.mouldId,
  276. pageSize: this.size,
  277. pageNum: this.page
  278. },
  279. res => {
  280. this.listLoading = false;
  281. if (res.code == "ok") {
  282. this.records = res.data.list;
  283. this.total = res.data.total;
  284. } else {
  285. this.$message({
  286. message: res.msg,
  287. type: "error"
  288. });
  289. }
  290. },
  291. error => {
  292. this.listLoading = false;
  293. this.$message({
  294. message: error,
  295. type: "error"
  296. });
  297. });
  298. },
  299. //模具详情 获取模具名字用的
  300. getDetail() {
  301. this.http.post( this.port.mold.moldDetail, {
  302. id: this.mouldId
  303. },
  304. res => {
  305. if (res.code == "ok") {
  306. this.detail = res.data.vo;
  307. this.getEcharts1();
  308. this.getEcharts2();
  309. this.mouldName = res.data.vo.modelName;
  310. this.mouldState = res.data.vo.state;
  311. this.requirement = res.data.vo.isMaintain == 1;
  312. this.stage = res.data.vo.stage;
  313. if(this.stage == 0){
  314. this.warningInfo = this.$t('runTest.stage0');
  315. }else if(this.stage == 1){
  316. this.warningInfo = this.$t('runTest.stage1');
  317. }else if(this.stage == 2){
  318. this.warningInfo = this.$t('runTest.stage2');
  319. }else if(this.stage == 3){
  320. this.warningInfo = this.$t('runTest.stage3');
  321. }else{
  322. this.warningInfo = this.$t('runTest.stage4');
  323. }
  324. } else {
  325. this.$message({
  326. message: res.msg,
  327. type: "error"
  328. });
  329. }
  330. },
  331. error => {
  332. this.$message({
  333. message: error,
  334. type: "error"
  335. });
  336. });
  337. },
  338. //模具保养的按钮按下之后(关闭之后也要清理文件但是还没写)
  339. maintainConfirm() {
  340. if (this.$refs.upload.uploadFiles.length == 1) {
  341. this.$refs.upload.submit();
  342. } else {
  343. this.$message({
  344. message: this.$t('runTest.mustUpload'),
  345. type: "error"
  346. });
  347. }
  348. },
  349. //模具保养
  350. maintain(params) {
  351. if (this.type.value != null) {
  352. var fileObj = params.file;
  353. var form = new FormData();
  354. form.append("file", fileObj);
  355. form.append("mouldId", this.mouldId);
  356. form.append("maintainType", this.type.value);
  357. if (this.type.value == 0) {
  358. if (this.action.value == null) {
  359. return;
  360. }
  361. form.append("ways", this.action.value);
  362. } else {
  363. if (this.vulnerable.value == null) {
  364. return;
  365. }
  366. form.append("ways", this.vulnerable.value); //后面应该换成易损件的ID
  367. }
  368. this.http.uploadFile( this.port.mold.moldMaintain, form,
  369. res => {
  370. if (res.code == "ok") {
  371. this.$message({
  372. message: this.$t('prompt.success5'),
  373. type: "success"
  374. });
  375. this.maintenanceFormVisible = false;
  376. this.requirement = false;
  377. this.$refs.upload.clearFiles();
  378. this.getList();
  379. } else {
  380. this.$message({
  381. message: res.msg,
  382. type: "error"
  383. });
  384. }
  385. },
  386. error => {
  387. this.listLoading = false;
  388. this.$message({
  389. message: error,
  390. type: "error"
  391. });
  392. });
  393. }
  394. },
  395. //获取告警时可以更换的设备列表
  396. getAlternativeEquipment() {
  397. this.http.post( this.port.mold.moldChangeRequirement, {
  398. mouldId: this.mouldId
  399. },
  400. res => {
  401. if (res.code == "ok") {
  402. this.equipments = [];
  403. res.data.forEach(item => {
  404. this.equipments.push({ label: item.equipmentNo, value: item.id });
  405. });
  406. } else {
  407. this.$message({
  408. message: res.msg,
  409. type: "error"
  410. });
  411. }
  412. },
  413. error => {
  414. this.$message({
  415. message: error,
  416. type: "error"
  417. });
  418. });
  419. },
  420. //告警处理
  421. warningArrangement() {
  422. if (this.warningForm.equipmentId == null) {
  423. this.$message({
  424. message: this.$t('runTest.inputMoldSet'),
  425. type: "error"
  426. });
  427. } else {
  428. this.http.post( this.port.mold.moldChange, this.warningForm,
  429. res => {
  430. if (res.code == "ok") {
  431. this.$message({
  432. message: this.$t('runTest.completed'),
  433. type: "success"
  434. });
  435. this.warningFormVisible = false;
  436. } else {
  437. this.$message({
  438. message: res.msg,
  439. type: "error"
  440. });
  441. }
  442. },
  443. error => {
  444. this.$message({
  445. message: error,
  446. type: "error"
  447. });
  448. });
  449. }
  450. },
  451. // 绘制折线图
  452. getEcharts1() {
  453. this.http.post( this.port.base.openingAndClosingTimesChart, {
  454. equipmentNo: this.detail.equipmentNo,//"898602B5191730002945",
  455. time: this.openNum
  456. },
  457. res => {
  458. if (res.code == "ok") {
  459. var option = {
  460. tooltip: {
  461. trigger: 'axis'
  462. },
  463. // grid: {
  464. // left: '3%',
  465. // right: '4%',
  466. // bottom: '6%',
  467. // containLabel: true
  468. // },
  469. xAxis: {
  470. type: 'category',
  471. boundaryGap: false,
  472. data: []
  473. },
  474. yAxis: {
  475. name: this.$t('runTest.frequency') ,//+ '(‰)'
  476. type: 'value'
  477. },
  478. dataZoom: [{
  479. type: 'inside',
  480. start: 0,
  481. end: 10
  482. }, {
  483. start: 0,
  484. end: 10,
  485. handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
  486. handleSize: '80%',
  487. handleStyle: {
  488. color: '#fff',
  489. shadowBlur: 3,
  490. shadowColor: 'rgba(0, 0, 0, 0.6)',
  491. shadowOffsetX: 2,
  492. shadowOffsetY: 2
  493. }
  494. }],
  495. series: [
  496. {
  497. name: this.$t('runTest.openNum'),
  498. type: 'line',
  499. data: [],
  500. itemStyle : {
  501. normal : {
  502. color: "#009ad6", //改变折线点的颜色
  503. lineStyle:{
  504. color: "#009ad6" //改变折线颜色
  505. }
  506. }
  507. },
  508. label: {
  509. normal: {
  510. show: true,
  511. formatter: function(p){
  512. return p.value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
  513. }
  514. }
  515. }
  516. }
  517. ]
  518. },
  519. list = res.data,
  520. xData = [],
  521. sData = [];
  522. for(var i in list) {
  523. xData.push(list[i].timeSlot);
  524. sData.push(list[i].runtime)
  525. }
  526. option.xAxis.data = xData;
  527. option.series[0].data = sData;
  528. this.drawEchart(1,JSON.stringify(option))
  529. } else {
  530. this.$message({
  531. message: res.msg,
  532. type: "error"
  533. });
  534. }
  535. },
  536. error => {
  537. this.$message({
  538. message: error,
  539. type: "error"
  540. });
  541. });
  542. },
  543. getEcharts2() {
  544. this.http.post( this.port.base.openingAndClosingTimesChartCycle, {
  545. equipmentNo: this.detail.equipmentNo,//"898602B5191730002945",
  546. startTime: this.openCycle[0],
  547. endTime: this.openCycle[1]
  548. },
  549. res => {
  550. if (res.code == "ok") {
  551. var option = {
  552. tooltip: {
  553. trigger: 'axis'
  554. },
  555. // grid: {
  556. // left: '3%',
  557. // right: '4%',
  558. // bottom: '3%',
  559. // containLabel: true
  560. // },
  561. legend: {
  562. data:[this.$t('runTest.maxOpenCycle'),this.$t('runTest.minOpenCycle'),this.$t('runTest.avgOpenCycle'),this.$t('runTest.theoryCycle')]
  563. },
  564. xAxis: {
  565. type: 'category',
  566. boundaryGap: false,
  567. data: []
  568. },
  569. yAxis: {
  570. name: this.$t('runTest.sec') + '(s)',
  571. type: 'value'
  572. },
  573. dataZoom: [{
  574. type: 'inside',
  575. start: 0,
  576. end: 10
  577. }, {
  578. start: 0,
  579. end: 10,
  580. handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
  581. handleSize: '80%',
  582. handleStyle: {
  583. color: '#fff',
  584. shadowBlur: 3,
  585. shadowColor: 'rgba(0, 0, 0, 0.6)',
  586. shadowOffsetX: 2,
  587. shadowOffsetY: 2
  588. }
  589. }],
  590. series: [{
  591. name: this.$t('runTest.maxOpenCycle'),
  592. type: 'line',
  593. // stack: this.$t('runTest.openCycle'),
  594. data:[],
  595. itemStyle : {
  596. normal : {
  597. color: "#d93a49", //改变折线点的颜色
  598. lineStyle:{
  599. color: "#d93a49" //改变折线颜色
  600. }
  601. }
  602. }
  603. },
  604. {
  605. name: this.$t('runTest.minOpenCycle'),
  606. type:'line',
  607. // stack: this.$t('runTest.openCycle'),
  608. data:[],
  609. itemStyle : {
  610. normal : {
  611. color: "#009ad6", //改变折线点的颜色
  612. lineStyle:{
  613. color: "#009ad6" //改变折线颜色
  614. }
  615. }
  616. }
  617. },
  618. {
  619. name: this.$t('runTest.avgOpenCycle'),
  620. type: 'line',
  621. // stack: this.$t('runTest.openCycle'),
  622. data:[],
  623. itemStyle : {
  624. normal : {
  625. color: "#7fb80e", //改变折线点的颜色
  626. lineStyle:{
  627. color: "#7fb80e" //改变折线颜色
  628. }
  629. }
  630. }
  631. },
  632. {
  633. name: this.$t('runTest.theoryCycle'),
  634. type: 'line',
  635. // stack: this.$t('runTest.openCycle'),
  636. data:[],
  637. itemStyle : {
  638. normal : {
  639. color: "#f58220", //改变折线点的颜色
  640. lineStyle:{
  641. color: "#f58220" //改变折线颜色
  642. }
  643. }
  644. }
  645. }]
  646. },
  647. list = res.data,
  648. xData = [],
  649. avg = [] , max = [] , min = [] , the = [];
  650. for(var i in list) {
  651. xData.push(i);
  652. max.push(list[i].maxCycle/1000);
  653. min.push(list[i].minCycle/1000);
  654. avg.push(list[i].avgCycle/1000);
  655. the.push(list[i].theoryCycle/1000);
  656. }
  657. option.xAxis.data = xData;
  658. option.series[0].data = max;
  659. option.series[1].data = min;
  660. option.series[2].data = avg;
  661. option.series[3].data = the;
  662. this.drawEchart(2,JSON.stringify(option));
  663. } else {
  664. this.$message({
  665. message: res.msg,
  666. type: "error"
  667. });
  668. }
  669. },
  670. error => {
  671. this.$message({
  672. message: error,
  673. type: "error"
  674. });
  675. });
  676. },
  677. drawEchart(type,option) {
  678. let myChart = this.echarts.init(document.getElementById("myChart" + type));
  679. if(type == 1) {
  680. this.echarts1 = myChart;
  681. } else {
  682. this.echarts2 = myChart;
  683. }
  684. myChart.setOption(JSON.parse(option));
  685. },
  686. changeOpen(type) {
  687. if(type == 1) {
  688. this.getEcharts1();
  689. } else if(type == 2) {
  690. this.getEcharts2();
  691. }
  692. },
  693. },
  694. created() {
  695. let height = window.innerHeight;
  696. this.tableHeight = height - 370;
  697. this.allDetail.height = height - 170 + "px";
  698. const that = this;
  699. window.onresize = function temp() {
  700. that.allDetail.height = window.innerHeight - 170;
  701. };
  702. },
  703. mounted() {
  704. this.mouldId = this.$route.params.id; //传到当前页面的模具编号
  705. this.warningForm.mouldId = this.mouldId; //顺便把相关的告警中的模具ID赋值一下
  706. this.getList();
  707. this.getDetail();
  708. this.getAlternativeEquipment();
  709. const that = this
  710. window.onresize = function temp() {
  711. that.echarts1.resize();
  712. that.echarts2.resize();
  713. };
  714. }
  715. };
  716. </script>
  717. <style scoped>
  718. .title {
  719. padding-left: 10px;
  720. padding-bottom: 0px;
  721. margin: 20px 0;
  722. font-size: 16px;
  723. line-height: 24px;
  724. border-left: 1px #20a0ff solid;
  725. }
  726. .toolbar .el-form-item {
  727. font-size: 14px;
  728. vertical-align: middle;
  729. }
  730. .back {
  731. font-size: 16px;
  732. }
  733. .divLine {
  734. width: 2px;
  735. background: #c3c3c3;
  736. height: 100%;
  737. }
  738. .projectTitle {
  739. font-size: 18px;
  740. color: #333;
  741. }
  742. </style>