| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 | <template>  <section>    <!--工具条-->    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">      <el-form :inline="true" :model="filters">        <el-form-item style="float: left;">公司</el-form-item>        <el-col :span="3">          <el-form-item>            <el-select v-model="filters.value" placeholder="按公司筛选">              <el-option label="编号" value="0"></el-option>              <el-option label="名称" value="1"></el-option>            </el-select>          </el-form-item>        </el-col>        <el-form-item>          <el-input v-model="filters.name" placeholder="请输入关键字进行搜索"></el-input>        </el-form-item>        <el-form-item>          <el-button type="primary">查询</el-button>        </el-form-item>        <el-form-item style="float: right;">          <el-button type="primary" @click="showAllocation">分配云模</el-button>        </el-form-item>      </el-form>    </el-col>    <!--列表-->    <el-table      :data="allocations"      :height="tableHeight"      highlight-current-row      v-loading="listLoading"      style="width: 100%;"    >      <el-table-column type="index" width="60"></el-table-column>      <el-table-column prop="deviceNumber" label="云模设备号" width="120" sortable></el-table-column>      <el-table-column prop="power" label="电量" width="80" sortable></el-table-column>      <el-table-column prop="countdown" label="倒计时" width="100" sortable></el-table-column>      <el-table-column prop="name" label="模具名称" width="100" sortable></el-table-column>      <el-table-column prop="mouldNumber" label="模具编号" width="120" sortable></el-table-column>      <el-table-column prop="assets" label="资产方" width="120" sortable></el-table-column>      <el-table-column prop="state" label="模具状态" width="100" sortable>        <template slot-scope="scope">          <span v-if="scope.row.state == true">运行</span>          <span v-else>停止</span>          <el-switch v-model="scope.row.state"></el-switch>        </template>      </el-table-column>      <el-table-column label="操作" width="160" sortable>        <el-button size="small">修改</el-button>        <el-button type="danger" size="small">删除</el-button>      </el-table-column>    </el-table>    <!--工具条-->    <el-col :span="24" class="toolbar">      <el-pagination        @size-change="handleSizeChange"        @current-change="handleCurrentChange"        :page-sizes="[20 , 50 , 80 , 100 , 200]"        :page-size="20"        layout="total, sizes, prev, pager, next"        :total="total"        style="float:right;"      ></el-pagination>    </el-col>    <!--新增界面-->    <el-dialog      title="新建模具"      v-if="addFormVisible"      :visible.sync="addFormVisible"      :close-on-click-modal="false"      customClass="customWidth"    >      <el-form        :model="newAllocation"        label-width="100px"        :rules="formRules"        ref="newAllocation"        :inline="true"        class="demo-form-inline"      >        <el-form-item label="设备号" prop="typeNumber">          <el-input v-model="newAllocation.deviceNumber" autocomplete="off" placeholder="请填写"></el-input>        </el-form-item>        <el-form-item label="所属公司" prop="name">          <el-input v-model="newAllocation.company" autocomplete="off" placeholder="请填写"></el-input>        </el-form-item>      </el-form>      <div slot="footer" class="dialog-footer">        <el-button @click.native="addFormVisible = false">取消</el-button>        <!-- 这里少了几个属性别忘了加上了 -->        <el-button type="primary">提交</el-button>      </div>    </el-dialog>  </section></template><script>import util from "../../common/js/util";export default {  data() {    return {      allocations: [        //临时数据        {          deviceNumber: "0123456",          power: "50%",          countdown: "400天",          name: "墨盒",          mouldNumber: "MUJU123456",          assets: "南京火石闪信",          state: true        },        {          deviceNumber: "7891011",          power: "20%",          countdown: "100天",          name: "墨盒2",          mouldNumber: "MUJU654321",          assets: "南京火石闪信",          state: false        }      ],      newAllocation: {        deviceNumber: "",        company: ""      },      filters: {        name: "",        value: ""      },      formRules: {},      listLoading: false,      total: 0,      tableHeight: 0,      addFormVisible: false    };  },  methods: {    //分页    handleCurrentChange(val) {      this.page = val;      // this.getMoulds();    },    handleSizeChange(val) {      this.size = val;      // this.getMoulds();    },    //添加界面    showAllocation() {      this.addFormVisible = true;      this.newAllocation = {        deviceNumber: "",        company: ""      };    }  },  created() {    let height = window.innerHeight;    this.tableHeight = height - 210;  },  mounted() {}};</script><style scoped></style>
 |