allocation.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.value" placeholder="按公司筛选">
  9. <el-option label="编号" value="0"></el-option>
  10. <el-option label="名称" value="1"></el-option>
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-form-item>
  15. <el-input v-model="filters.name" placeholder="请输入关键字进行搜索"></el-input>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-button type="primary">查询</el-button>
  19. </el-form-item>
  20. <el-form-item style="float: right;">
  21. <el-button type="primary" @click="showAllocation">分配云模</el-button>
  22. </el-form-item>
  23. </el-form>
  24. </el-col>
  25. <!--列表-->
  26. <el-table :data="allocations" :height="tableHeight" highlight-current-row v-loading="listLoading" style="width: 100%;">
  27. <el-table-column type="index" width="60"></el-table-column>
  28. <el-table-column prop="deviceNumber" label="云模设备号" width="120" sortable></el-table-column>
  29. <el-table-column prop="power" label="电量" width="80" sortable></el-table-column>
  30. <el-table-column prop="countdown" label="倒计时" width="100" sortable></el-table-column>
  31. <el-table-column prop="name" label="模具名称" width="100" sortable></el-table-column>
  32. <el-table-column prop="mouldNumber" label="模具编号" width="120" sortable></el-table-column>
  33. <el-table-column prop="assets" label="资产方" width="120" sortable></el-table-column>
  34. <el-table-column prop="state" label="模具状态" width="100" sortable>
  35. <template slot-scope="scope">
  36. <span v-if="scope.row.state == false">未启用</span>
  37. <span v-else>已启用</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="操作" width="220" sortable>
  41. <template slot-scope="scope">
  42. <el-button
  43. size="small"
  44. type="primary"
  45. @click="enable(scope.$index)"
  46. :disabled="scope.row.state == true"
  47. >启用</el-button>
  48. <el-button size="small">修改</el-button>
  49. <el-button type="danger" size="small">删除</el-button>
  50. </template>
  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]"
  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. enable(index) {
  157. this.allocations[index].state = true;
  158. }
  159. },
  160. created() {
  161. let height = window.innerHeight;
  162. this.tableHeight = height - 210;
  163. },
  164. mounted() {}
  165. };
  166. </script>
  167. <style scoped>
  168. </style>