allocation.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true" :model="filters">
  6. <el-col :span="3">
  7. <el-form-item>
  8. <el-select v-model="filters.companyId" clearable filterable :placeholder="$t('basic.chooseComp')">
  9. <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id">
  10. </el-option>
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-form-item>
  15. <el-input v-model="filters.keyName" :placeholder="$t('msg.keySearch')"></el-input>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type="primary" @click="getMoulds">{{$t('base.query')}}</el-button>
  19. </el-form-item>
  20. <el-form-item style="float: right;">
  21. <a class="download" href="/upload/云模盒批量导入模板.xlsx" download="云模盒批量导入模板.xlsx">
  22. <el-button type="primary">
  23. {{$t('mold.downloadMould')}}
  24. </el-button>
  25. </a>
  26. </el-form-item>
  27. <el-form-item style="float: right;">
  28. <el-upload ref="upload" action="customize" :show-file-list="false" :http-request="uploadFile" :limit="1">
  29. <el-button type="primary" :loading="uploading">{{$t('base.imput')}}</el-button>
  30. </el-upload>
  31. </el-form-item>
  32. <el-form-item style="float: right;">
  33. <el-button type="primary" @click="showAllocation">{{$t('base.add')}}</el-button>
  34. </el-form-item>
  35. <!-- <el-form-item style="float: right;">
  36. <el-button type="primary" @click="issued">{{$t('base.issued')}}</el-button>
  37. </el-form-item> -->
  38. </el-form>
  39. </el-col>
  40. <!--列表-->
  41. <el-table :data="allocations" :height="tableHeight" highlight-current-row v-loading="listLoading" @selection-change="handleSelectionChange" style="width: 100%;">
  42. <!-- <el-table-column type="selection" width="50"></el-table-column> -->
  43. <el-table-column type="index" width="60"></el-table-column>
  44. <el-table-column prop="equipmentNo" :label="$t('basic.equipmentNo')" width="180" sortable></el-table-column>
  45. <el-table-column prop="sim" :label="$t('basic.sim')" width="120" sortable></el-table-column>
  46. <el-table-column prop="hillNumber" :label="$t('mold.hillNumber')" width="80" align="center" sortable>
  47. <template slot-scope="scope">{{scope.row.hillNumber}}<span v-if="scope.row.hillNumber">%</span></template>
  48. </el-table-column>
  49. <el-table-column prop="alarmBattery" :label="$t('basic.alarmBattery')" width="130" align="center" sortable>
  50. <template slot-scope="scope">{{scope.row.alarmBattery}}<span v-if="scope.row.alarmBattery">%</span></template>
  51. </el-table-column>
  52. <el-table-column prop="alarmDegree" :label="$t('basic.alarmDegree')" width="120" align="center" sortable>
  53. <template slot-scope="scope">{{scope.row.alarmDegree}}<span v-if="scope.row.alarmDegree">℃</span></template>
  54. </el-table-column>
  55. <el-table-column prop="useLife" :label="$t('basic.useLife')" width="100" align="center" sortable>
  56. <template slot-scope="scope">{{scope.row.useLife}}{{$t('basic.year')}}</template>
  57. </el-table-column>
  58. <el-table-column prop="diffTime" :label="$t('basic.diffTime')" width="100" align="center" sortable>
  59. <template slot-scope="scope">{{scope.row.diffTime}}</template>
  60. </el-table-column>
  61. <el-table-column prop="modelName" :label="$t('mold.modelName')" sortable></el-table-column>
  62. <el-table-column prop="modelNo" :label="$t('mold.moldNo')" width="120" align="center" sortable></el-table-column>
  63. <el-table-column prop="companyName" :label="$t('basic.compName')" sortable></el-table-column>
  64. <el-table-column prop="agent" :label="$t('basic.agent')" width="120" sortable></el-table-column>
  65. <el-table-column :label="$t('basic.equipmentState')" align="center" width="120" sortable>
  66. <template slot-scope="scope">
  67. <span v-if="scope.row.isUse == 0">{{$t('basic.state0')}}</span>
  68. <span v-else>{{$t('basic.state1')}}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column :label="$t('base.operate')" align="center" width="160">
  72. <template slot-scope="scope">
  73. <el-button size="small" v-if="scope.row.modelNo != null && scope.row.isUse == 0" type="primary" @click="openEnable(scope.$index)">{{$t('basic.use')}}</el-button>
  74. <el-button size="small" v-if="scope.row.modelNo != null && scope.row.isUse == 1" type="danger" @click="disableEquipment(scope.$index)">{{$t('basic.disuse')}}</el-button>
  75. <!-- :disabled="scope.row.isUse == 1" -->
  76. <el-button size="small" :style="scope.row.modelNo!=null?'':'float:right;margin-right:6px'" @click="showEdit(scope.$index, scope.row, scope.row.isUse == 1)">{{$t('base.edit')}}</el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <!--工具条-->
  81. <el-col :span="24" class="toolbar">
  82. <el-pagination
  83. @size-change="handleSizeChange"
  84. @current-change="handleCurrentChange"
  85. :page-sizes="[20 , 50 , 80 , 100]"
  86. :page-size="20"
  87. layout="total, sizes, prev, pager, next"
  88. :total="total"
  89. style="float:right;"
  90. ></el-pagination>
  91. </el-col>
  92. <!--新增界面-->
  93. <el-dialog :title="$t('basic.addYM')" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth">
  94. <el-form :model="newAllocation" label-width="130px" :rules="formRules" ref="newAllocation">
  95. <el-form-item :label="$t('basic.equipmentNo')" prop="equipmentNo">
  96. <el-input v-model="newAllocation.equipmentNo" autocomplete="off" :placeholder="$t('basic.inputequipmentNo')" style="width:505px;"></el-input>
  97. </el-form-item>
  98. <el-form-item :label="$t('project.company')" prop="belongCompanyId">
  99. <el-select v-model="newAllocation.belongCompanyId" filterable clearable :placeholder="$t('project.inputCompany')" style="width:505px;">
  100. <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id"></el-option>
  101. </el-select>
  102. </el-form-item>
  103. <el-form-item :label="$t('basic.useLife')" prop="useLife">
  104. <el-input v-model.number="newAllocation.useLife" type="age" autocomplete="off" :placeholder="$t('basic.inputUseLife')" style="width:505px;"></el-input>
  105. </el-form-item>
  106. <el-form-item :label="$t('basic.agent')" prop="agent">
  107. <el-input v-model="newAllocation.agent" autocomplete="off" :placeholder="$t('basic.inputAgent')" style="width:505px;"></el-input>
  108. </el-form-item>
  109. </el-form>
  110. <div slot="footer" class="dialog-footer">
  111. <el-button @click.native="addFormVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
  112. <el-button type="primary" @click="addMould()">{{$t('el.messagebox.confirm')}}</el-button>
  113. </div>
  114. </el-dialog>
  115. <!--修改界面-->
  116. <el-dialog :title="$t('basic.editYM')" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass="customWidth">
  117. <el-form :model="newAllocation" label-width="130px" :rules="formRules" ref="newAllocation">
  118. <el-form-item :label="$t('basic.equipmentNo')" prop="equipmentNo">
  119. <el-input v-model="newAllocation.equipmentNo" autocomplete="off" :placeholder="$t('basic.inputequipmentNo')" style="width:505px;"></el-input>
  120. </el-form-item>
  121. <el-form-item :label="$t('project.company')" prop="belongCompanyId">
  122. <el-select v-model="newAllocation.belongCompanyId" filterable clearable :placeholder="$t('project.inputCompany')" style="width:505px;" :disabled="newAllocation.usage">
  123. <el-option v-for="item in companies" :key="item.id" :label="item.companyName" :value="item.id"></el-option>
  124. </el-select>
  125. </el-form-item>
  126. <el-form-item :label="$t('basic.useLife')" prop="useLife">
  127. <el-input v-model.number="newAllocation.useLife" type="age" autocomplete="off" :placeholder="$t('basic.inputUseLife')" style="width:505px;"></el-input>
  128. </el-form-item>
  129. <el-form-item :label="$t('basic.agent')" prop="agent">
  130. <el-input v-model="newAllocation.agent" autocomplete="off" :placeholder="$t('basic.inputAgent')" style="width:505px;"></el-input>
  131. </el-form-item>
  132. </el-form>
  133. <div slot="footer" class="dialog-footer">
  134. <el-button @click.native="editFormVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
  135. <el-button type="primary" @click="editMould(newAllocation.id)">{{$t('el.messagebox.confirm')}}</el-button>
  136. </div>
  137. </el-dialog>
  138. <!-- 启用弹窗 -->
  139. <el-dialog :title="$t('base.use')" :visible.sync="operateDialogVisible" width="450px">
  140. <!-- <el-form label-width="100px" :rules="formRules" :inline="true" class="demo-form-inline">
  141. <el-form-item label="某个参数">
  142. <el-input autocomplete="off" placeholder="填了也不会发生什么"></el-input>
  143. </el-form-item>
  144. </el-form>
  145. <span slot="footer" class="dialog-footer">
  146. <el-button @click="operateDialogVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
  147. <el-button type="primary" @click="enable">{{$t('base.use')}}</el-button>
  148. </span> -->
  149. <el-form :model="issuedVal" label-width="130px" :rules="formRules" ref="issuedVal" :inline="true" class="demo-form-inline">
  150. <el-form-item :label="$t('basic.alarmBattery')" prop="alarmBattery">
  151. <el-input v-model.number="issuedVal.alarmBattery" type="age" autocomplete="off" :placeholder="$t('basic.inputAlarmBattery')" style="width:250px;"></el-input>
  152. %
  153. </el-form-item>
  154. <el-form-item :label="$t('basic.alarmDegree')" prop="alarmDegree">
  155. <el-input v-model.number="issuedVal.alarmDegree" type="age" autocomplete="off" :placeholder="$t('basic.inputAlarmDegree')" style="width:250px;"></el-input>
  156. </el-form-item>
  157. </el-form>
  158. <span slot="footer" class="dialog-footer">
  159. <el-button @click="operateDialogVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
  160. <el-button type="primary" @click="enable">{{$t('base.use')}}</el-button>
  161. </span>
  162. </el-dialog>
  163. <!-- 下发弹窗 -->
  164. <el-dialog :title="$t('basic.issued')" :visible.sync="issuedVisible" width="450px">
  165. <el-form :model="issuedVal" label-width="130px" :rules="formRules" ref="issuedVal" :inline="true" class="demo-form-inline">
  166. <el-form-item :label="$t('basic.alarmBattery')" prop="alarmBattery">
  167. <el-input v-model.number="issuedVal.alarmBattery" type="age" autocomplete="off" :placeholder="$t('basic.inputAlarmBattery')" style="width:250px;"></el-input>
  168. %
  169. </el-form-item>
  170. <el-form-item :label="$t('basic.alarmDegree')" prop="alarmDegree">
  171. <el-input v-model.number="issuedVal.alarmDegree" type="age" autocomplete="off" :placeholder="$t('basic.inputAlarmDegree')" style="width:250px;"></el-input>
  172. </el-form-item>
  173. </el-form>
  174. <span slot="footer" class="dialog-footer">
  175. <el-button @click="issuedVisible = false">{{$t('el.messagebox.cancel')}}</el-button>
  176. <el-button type="primary" @click="saveIssued">{{$t('basic.issued')}}</el-button>
  177. </span>
  178. </el-dialog>
  179. </section>
  180. </template>
  181. <script>
  182. import util from "../../common/js/util";
  183. export default {
  184. data() {
  185. const msg = (rule, value, callback) => {
  186. if (!value) {
  187. switch(rule.field) {
  188. case "equipmentNo":
  189. return callback(new Error(this.$t('basic.inputequipmentNo')));
  190. break;
  191. case "useLife":
  192. return callback(new Error(this.$t('basic.inputUseLife')));
  193. break;
  194. case "belongCompanyId":
  195. return callback(new Error(this.$t('project.inputCompany')));
  196. break;
  197. case "agent":
  198. return callback(new Error(this.$t('basic.inputAgent')));
  199. break;
  200. case "alarmBattery":
  201. return callback(new Error(this.$t('basic.inputAlarmBattery')));
  202. break;
  203. case "alarmDegree":
  204. return callback(new Error(this.$t('basic.inputAlarmDegree')));
  205. break;
  206. default:
  207. callback();
  208. }
  209. } else {
  210. callback();
  211. }
  212. };
  213. return {
  214. allocations: [],
  215. companies: {},
  216. newAllocation: {
  217. equipmentNo: "", //设备编号
  218. useLife: "", //使用年限
  219. equipmentName: "", //设备名称
  220. id: "", //设备id
  221. belongCompanyId: "", //所属公司ID
  222. agent: "", //代理商
  223. usage: true //是否可以修改公司
  224. },
  225. filters: {
  226. keyName: "",
  227. companyId: ""
  228. },
  229. formRules: {
  230. equipmentNo: [
  231. { required: true, validator: msg , trigger: "blur" }
  232. ],
  233. useLife: [
  234. { required: true, validator: msg },
  235. { type: 'number', message: this.$t('basic.inputUseLifeNum')}
  236. // message: '使用年限必须为数字值'
  237. ],
  238. belongCompanyId: [
  239. { required: true, validator: msg , trigger: ["blur", "change"] }
  240. ],
  241. agent: [
  242. { required: true, validator: msg , trigger: "blur" }
  243. ],
  244. alarmBattery: [
  245. { required: true, validator: msg },
  246. { type: 'number', message: this.$t('basic.inputAlarmBatteryNum')}
  247. ],
  248. alarmDegree: [
  249. { required: true, validator: msg },
  250. { type: 'number', message: this.$t('basic.inputAlarmDegreeNum')}
  251. ],
  252. },
  253. listLoading: false,
  254. addLoading: false,
  255. editLoading: false,
  256. uploading: false,
  257. total: 0,
  258. page: 1,
  259. size: 20,
  260. tableHeight: 0,
  261. addFormVisible: false,
  262. editFormVisible: false,
  263. operateDialogVisible: false,
  264. activeIndex: 0,
  265. issuedVal: {
  266. alarmBattery: 30,
  267. alarmDegree: 80,
  268. },
  269. issuedVisible: false,
  270. multipleSelection: [],
  271. };
  272. },
  273. methods: {
  274. getMsg() {
  275. //获取公司下拉列表
  276. this.http.post( this.port.base.getCompanys, {},
  277. res => {
  278. if (res.code == "ok") {
  279. this.companies = res.data;
  280. } else {
  281. this.$message({
  282. message: res.msg,
  283. type: "error"
  284. });
  285. }
  286. },
  287. error => {
  288. this.$message({
  289. message: error,
  290. type: "error"
  291. });
  292. });
  293. },
  294. //分页
  295. handleCurrentChange(val) {
  296. this.page = val;
  297. this.getMoulds();
  298. },
  299. handleSizeChange(val) {
  300. this.size = val;
  301. this.getMoulds();
  302. },
  303. //读取云模盒信息
  304. getMoulds() {
  305. this.listLoading = true;
  306. this.http.post(this.port.base.mouldeList,{
  307. pageNum: this.page,
  308. pageSize: this.size,
  309. keyName: this.filters.keyName,
  310. companyId: this.filters.companyId
  311. },
  312. res => {
  313. this.listLoading = false;
  314. if (res.code == "ok") {
  315. var list = res.data.list
  316. for(var i in list){
  317. if(list[i].endTime == null){
  318. list[i].diffTime = "";
  319. } else {
  320. list[i].diffTime = util.formatDate.dateDiff(
  321. // util.formatDate.format(new Date(list[i].endTime), 'yyyy-MM-dd'),
  322. list[i].endTime,
  323. util.formatDate.format(new Date(new Date()), 'yyyy-MM-dd')
  324. );
  325. }
  326. }
  327. this.allocations = list;
  328. this.total = res.data.total;
  329. } else {
  330. this.$message({
  331. message: res.msg,
  332. type: "error"
  333. });
  334. }
  335. },
  336. error => {
  337. this.listLoading = false;
  338. this.$message({
  339. message: error,
  340. type: "error"
  341. });
  342. });
  343. },
  344. //添加界面
  345. showAllocation() {
  346. this.addFormVisible = true;
  347. this.newAllocation = {
  348. id: "",
  349. useLife: "",
  350. equipmentNo: "",
  351. belongCompanyId: "",
  352. agent: ""
  353. };
  354. },
  355. //添加模具
  356. addMould() {
  357. this.$refs.newAllocation.validate(valid => {
  358. if (valid) {
  359. this.addLoading = true;
  360. this.http.post(
  361. this.port.base.editMould,
  362. {
  363. equipmentNo: this.newAllocation.equipmentNo,
  364. belongCompanyId: this.newAllocation.belongCompanyId,
  365. useLife: this.newAllocation.useLife,
  366. agent: this.newAllocation.agent
  367. },
  368. res => {
  369. this.addLoading = false;
  370. if (res.code == "ok") {
  371. this.addFormVisible = false;
  372. this.$message({
  373. message: this.$t('prompt.success2'),
  374. type: "success"
  375. });
  376. this.getMoulds();
  377. } else {
  378. this.$message({
  379. message: res.msg,
  380. type: "error"
  381. });
  382. }
  383. },
  384. error => {
  385. this.addLoading = false;
  386. this.addFormVisible = false;
  387. this.$message({
  388. message: error,
  389. type: "error"
  390. });
  391. }
  392. );
  393. }
  394. });
  395. },
  396. //修改界面
  397. showEdit(index, row, usageBoolean) {
  398. this.editFormVisible = true;
  399. this.newAllocation = {
  400. id: row.id,
  401. useLife: row.useLife,
  402. equipmentNo: row.equipmentNo,
  403. belongCompanyId: row.belongCompanyId,
  404. agent: row.agent,
  405. usage: usageBoolean
  406. };
  407. },
  408. //编辑模具
  409. editMould() {
  410. this.$refs.newAllocation.validate(valid => {
  411. if (valid) {
  412. this.editLoading = true;
  413. this.http.post( this.port.base.editMould, {
  414. id: this.newAllocation.id,
  415. equipmentNo: this.newAllocation.equipmentNo,
  416. equipmentName: this.newAllocation.equipmentName,
  417. belongCompanyId: this.newAllocation.belongCompanyId,
  418. useLife: this.newAllocation.useLife,
  419. agent: this.newAllocation.agent
  420. },
  421. res => {
  422. this.editLoading = false;
  423. if (res.code == "ok") {
  424. this.editFormVisible = false;
  425. this.$message({
  426. message: this.$t('prompt.success'),
  427. type: "success"
  428. });
  429. this.getMoulds();
  430. } else {
  431. this.$message({
  432. message: res.msg,
  433. type: "error"
  434. });
  435. }
  436. },
  437. error => {
  438. this.editLoading = false;
  439. this.editFormVisible = false;
  440. this.$message({
  441. message: error,
  442. type: "error"
  443. });
  444. });
  445. }
  446. });
  447. },
  448. //打开启用窗口
  449. openEnable(index) {
  450. this.operateDialogVisible = true;
  451. this.issuedVal.alarmBattery = this.allocations[this.activeIndex].alarmBattery;
  452. this.issuedVal.alarmDegree = this.allocations[this.activeIndex].alarmDegree;
  453. this.activeIndex = index;
  454. },
  455. //启用设备
  456. enable() {
  457. // if(this.allocations[this.activeIndex].belongCompanyId == null){
  458. // this.$message({
  459. // message: this.$t("basic.inputBlongComp"),
  460. // type: "error"
  461. // });
  462. // }else{
  463. this.allocations[this.activeIndex].isUse = 1;
  464. this.operateDialogVisible = false;
  465. // this.http.post( this.port.base.enableMould, {
  466. // id: this.allocations[this.activeIndex].id,
  467. // isUse: 1
  468. // },
  469. var str = this.allocations[this.activeIndex].equipmentNo;
  470. this.http.post( this.port.base.setPacket, {
  471. lowPowerLimit: this.issuedVal.alarmBattery,//.toString(16),
  472. hotAlarmLimit: this.issuedVal.alarmDegree,//.toString(16),
  473. isUse: 1,
  474. equipmentNo: str
  475. },
  476. res => {
  477. if (res.code == "ok") {
  478. this.$message({
  479. message: this.$t("basic.inUse"),
  480. type: "success"
  481. });
  482. this.getMoulds();
  483. } else {
  484. this.$message({
  485. message: res.msg,
  486. type: "error"
  487. });
  488. }
  489. },
  490. error => {
  491. this.$message({
  492. message: error,
  493. type: "error"
  494. });
  495. });
  496. },
  497. //停用云模盒
  498. disableEquipment(index) {
  499. // if(this.allocations[index].belongCompanyId == null){
  500. // this.$message({
  501. // message: this.$t("basic.inputBlongComp"),
  502. // type: "error"
  503. // });
  504. // }else{
  505. this.allocations[index].isUse = 1;
  506. // this.http.post( this.port.base.enableMould, {
  507. // id: this.allocations[index].id,
  508. // isUse: 0
  509. // },
  510. var str = this.allocations[this.activeIndex].equipmentNo;
  511. this.http.post( this.port.base.setPacket, {
  512. lowPowerLimit: this.issuedVal.alarmBattery,//.toString(16),
  513. hotAlarmLimit: this.issuedVal.alarmDegree,//.toString(16),
  514. isUse: 0,
  515. equipmentNo: str
  516. },
  517. res => {
  518. if (res.code == "ok") {
  519. this.$message({
  520. message: this.$t("basic.offUse"),
  521. type: "success"
  522. });
  523. this.getMoulds();
  524. } else {
  525. this.$message({
  526. message: res.msg,
  527. type: "error"
  528. });
  529. }
  530. },
  531. error => {
  532. this.$message({
  533. message: error,
  534. type: "error"
  535. });
  536. });
  537. },
  538. //导入云模盒
  539. uploadFile(params) {
  540. var fileObj = params.file;
  541. var form = new FormData();
  542. form.append("file", fileObj);
  543. this.uploading = true;
  544. this.http.uploadFile( this.port.base.importMouldEquipmentExcel, form,
  545. res => {
  546. this.uploading = false;
  547. this.$refs.upload.clearFiles();
  548. if (res.code == "ok") {
  549. this.$message({
  550. message: this.$t("prompt.success4"),
  551. type: "success"
  552. });
  553. this.getMoulds();
  554. } else {
  555. this.$message({
  556. message: res.msg,
  557. type: "error"
  558. });
  559. }
  560. },
  561. error => {
  562. this.uploading = false;
  563. this.$refs.upload.clearFiles();
  564. this.$message({
  565. message: error,
  566. type: "error"
  567. });
  568. });
  569. },
  570. //下发云模盒
  571. issued() {
  572. this.issuedVisible = true;
  573. },
  574. saveIssued() {
  575. if(this.multipleSelection.length == 0) {
  576. this.$message({
  577. message: this.$t('basic.chooseEquipment'),
  578. type: "error"
  579. });
  580. } else {
  581. var str = '';
  582. for(var i in this.multipleSelection) {
  583. str += this.multipleSelection[i].equipmentNo + ',';
  584. }
  585. str = str.substring(0,str.length-1)
  586. this.http.post( this.port.base.setPacket, {
  587. lowPowerLimit: this.issuedVal.alarmBattery,//.toString(16),
  588. hotAlarmLimit: this.issuedVal.alarmDegree,//.toString(16),
  589. equipmentNo: str
  590. },
  591. res => {
  592. if (res.code == "ok") {
  593. this.$message({
  594. message: this.$t('basic.issuedSuccess'),
  595. type: "success"
  596. });
  597. this.issuedVisible = false;
  598. this.getMoulds();
  599. } else {
  600. this.$message({
  601. message: res.msg,
  602. type: "error"
  603. });
  604. }
  605. },
  606. error => {
  607. this.$message({
  608. message: error,
  609. type: "error"
  610. });
  611. });
  612. }
  613. }
  614. },
  615. created() {
  616. let height = window.innerHeight;
  617. this.tableHeight = height - 210;
  618. const that = this;
  619. window.onresize = function temp() {
  620. that.tableHeight = window.innerHeight - 210;
  621. };
  622. },
  623. mounted() {
  624. this.getMsg();
  625. //获取模具列表
  626. this.getMoulds();
  627. }
  628. };
  629. </script>
  630. <style scoped>
  631. .download {
  632. color: #fff;
  633. text-decoration: none;
  634. }
  635. </style>