allocation.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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-form-item style="float: left;">公司</el-form-item>
  7. <el-col :span="3">
  8. <el-form-item>
  9. <el-select v-model="filters.value" placeholder="按公司筛选">
  10. <el-option label="编号" value="0"></el-option>
  11. <el-option label="名称" value="1"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. </el-col>
  15. <el-form-item>
  16. <el-input v-model="filters.name" placeholder="请输入关键字进行搜索"></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button type="primary">查询</el-button>
  20. </el-form-item>
  21. <el-form-item style="float: right;">
  22. <el-button type="primary" @click="showAllocation">分配云模</el-button>
  23. </el-form-item>
  24. </el-form>
  25. </el-col>
  26. <!--列表-->
  27. <el-table
  28. :data="allocations"
  29. :height="tableHeight"
  30. highlight-current-row
  31. v-loading="listLoading"
  32. style="width: 100%;"
  33. >
  34. <el-table-column type="index" width="60"></el-table-column>
  35. <el-table-column prop="deviceNumber" label="云模设备号" width="120" sortable></el-table-column>
  36. <el-table-column prop="power" label="电量" width="80" sortable></el-table-column>
  37. <el-table-column prop="countdown" label="倒计时" width="100" sortable></el-table-column>
  38. <el-table-column prop="name" label="模具名称" width="100" sortable></el-table-column>
  39. <el-table-column prop="mouldNumber" label="模具编号" width="120" sortable></el-table-column>
  40. <el-table-column prop="assets" label="资产方" width="120" sortable></el-table-column>
  41. <el-table-column prop="state" label="模具状态" width="100" sortable>
  42. <template slot-scope="scope">
  43. <span v-if="scope.row.state == true">运行</span>
  44. <span v-else>停止</span>
  45. <el-switch v-model="scope.row.state"></el-switch>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="操作" width="160" sortable>
  49. <el-button size="small">修改</el-button>
  50. <el-button type="danger" size="small">删除</el-button>
  51. </el-table-column>
  52. </el-table>
  53. <!--工具条-->
  54. <el-col :span="24" class="toolbar">
  55. <el-pagination
  56. @size-change="handleSizeChange"
  57. @current-change="handleCurrentChange"
  58. :page-sizes="[20 , 50 , 80 , 100 , 200]"
  59. :page-size="20"
  60. layout="total, sizes, prev, pager, next"
  61. :total="total"
  62. style="float:right;"
  63. ></el-pagination>
  64. </el-col>
  65. <!--新增界面-->
  66. <el-dialog
  67. title="新建模具"
  68. v-if="addFormVisible"
  69. :visible.sync="addFormVisible"
  70. :close-on-click-modal="false"
  71. customClass="customWidth"
  72. >
  73. <el-form
  74. :model="newAllocation"
  75. label-width="100px"
  76. :rules="formRules"
  77. ref="newAllocation"
  78. :inline="true"
  79. class="demo-form-inline"
  80. >
  81. <el-form-item label="设备号" prop="typeNumber">
  82. <el-input v-model="newAllocation.deviceNumber" autocomplete="off" placeholder="请填写"></el-input>
  83. </el-form-item>
  84. <el-form-item label="所属公司" prop="name">
  85. <el-input v-model="newAllocation.company" autocomplete="off" placeholder="请填写"></el-input>
  86. </el-form-item>
  87. </el-form>
  88. <div slot="footer" class="dialog-footer">
  89. <el-button @click.native="addFormVisible = false">取消</el-button>
  90. <!-- 这里少了几个属性别忘了加上了 -->
  91. <el-button type="primary">提交</el-button>
  92. </div>
  93. </el-dialog>
  94. </section>
  95. </template>
  96. <script>
  97. import util from "../../common/js/util";
  98. export default {
  99. data() {
  100. return {
  101. allocations: [
  102. //临时数据
  103. {
  104. deviceNumber: "0123456",
  105. power: "50%",
  106. countdown: "400天",
  107. name: "墨盒",
  108. mouldNumber: "MUJU123456",
  109. assets: "南京火石闪信",
  110. state: true
  111. },
  112. {
  113. deviceNumber: "7891011",
  114. power: "20%",
  115. countdown: "100天",
  116. name: "墨盒2",
  117. mouldNumber: "MUJU654321",
  118. assets: "南京火石闪信",
  119. state: false
  120. }
  121. ],
  122. newAllocation: {
  123. deviceNumber: "",
  124. company: ""
  125. },
  126. filters: {
  127. name: "",
  128. value: ""
  129. },
  130. formRules: {},
  131. listLoading: false,
  132. total: 0,
  133. tableHeight: 0,
  134. addFormVisible: false
  135. };
  136. },
  137. methods: {
  138. //分页
  139. handleCurrentChange(val) {
  140. this.page = val;
  141. // this.getMoulds();
  142. },
  143. handleSizeChange(val) {
  144. this.size = val;
  145. // this.getMoulds();
  146. },
  147. //添加界面
  148. showAllocation() {
  149. this.addFormVisible = true;
  150. this.newAllocation = {
  151. deviceNumber: "",
  152. company: ""
  153. };
  154. }
  155. },
  156. created() {
  157. let height = window.innerHeight;
  158. this.tableHeight = height - 210;
  159. },
  160. mounted() {}
  161. };
  162. </script>
  163. <style scoped>
  164. </style>