| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 | <template>  <div class="app-container">    <div class="operation">      <el-button class="success" @click="handleCreate">新增</el-button>    </div>    <div class="search">      <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />      <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="操作类型" class="filter-item" style="width: 120px;" clearable>        <el-option v-for="item in operationTypeList" :key="item.id" :label="item.name" :value="item.name" />      </el-select>      <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="饲料名称" class="filter-item" style="width: 150px;" clearable>        <el-option v-for="item in feedNameList" :key="item.id" :label="item.name" :value="item.name" />      </el-select>      <tree-select        class="typeSelect"        :height="150"        :width="150"        size="small"        clearable        :data="type.parentDept"        :disabled="type.disabled"        :placeholder="type.placeholder"        style="display:inline-block;"        :default-props="type.defaultProps"        :node-key="type.nodeKey"        :checked-keys="type.defaultCheckedKeys"        @popoverHide="popoverHide"      />      <el-button class="successBorder" @click="handleSearch">查询</el-button>      <el-button class="successBorder" @click="handleRefresh">重置</el-button>    </div>    <div class="table">      <el-table        :key="table.tableKey"        v-loading="table.listLoading"        element-loading-text="给我一点时间"        :data="table.list"        border        fit        highlight-current-row        style="width: 100%;"        :row-style="rowStyle"        :cell-style="cellStyle"        class="elTable table-fixed"      >        <el-table-column label="序号" align="center" type="index" width="50px">          <template slot-scope="scope">            <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>          </template>        </el-table-column>        <el-table-column label="出库日期" min-width="130px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.brandName }}</span>          </template>        </el-table-column>        <el-table-column label="牲畜类别" min-width="130px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.brandName }}</span>          </template>        </el-table-column>        <el-table-column label="饲料名称" min-width="110px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.brandName }}</span>          </template>        </el-table-column>        <el-table-column label="操作重量(kg)" min-width="110px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.brandName }}</span>          </template>        </el-table-column>        <el-table-column label="操作类型" min-width="110px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.brandName }}</span>          </template>        </el-table-column>        <el-table-column label="备注" min-width="110px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.brandName }}</span>          </template>        </el-table-column>        <el-table-column label="操作人" min-width="110px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.brandName }}</span>          </template>        </el-table-column>      </el-table>      <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />    </div>    <!-- 新增/编辑 -->    <el-dialog :title="textMap[create.dialogStatus]" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="80%">      <div class="app-add">        <el-form ref="createTemp" :rules="create.rules" :model="create.createTemp" label-position="right" label-width="130px" style="width: 90%;height:300px;margin:0 auto 50px">          <el-row>            <el-col :span="8">              <el-form-item label="操作类型:" prop="location">                <el-select v-model="create.createTemp.location" placeholder="操作类型" class="filter-item" style="width: 100%;">                  <el-option v-for="item in operationTypeList" :key="item.id" :label="item.name" :value="item.name" />                </el-select>              </el-form-item>            </el-col>            <el-col :span="8">              <el-form-item label="出库日期:" prop="location">                <el-date-picker v-model="create.createTemp.location" class="filter-item" type="datetime" placeholder="出库日期" />              </el-form-item>            </el-col>            <el-col :span="8">              <el-form-item label="饲料名称:" prop="location">                <el-select v-model="create.createTemp.location" placeholder="饲料名称" class="filter-item" style="width: 100%;">                  <el-option v-for="item in feedNameList" :key="item.id" :label="item.name" :value="item.name" />                </el-select>              </el-form-item>            </el-col>          </el-row>          <el-row>            <el-col :span="8">              <el-form-item label="畜牲类别:" prop="location">                <tree-select                  class="filter-item typeSelect"                  :height="150"                  :width="150"                  size="small"                  clearable                  :data="type.parentDept"                  :disabled="type.disabled"                  :placeholder="type.placeholder"                  style="display:inline-block;"                  :default-props="type.defaultProps"                  :node-key="type.nodeKey"                  :checked-keys="type.defaultCheckedKeys"                  @popoverHide="popoverHide"                />              </el-form-item>            </el-col>            <el-col :span="8">              <el-form-item label="操作重量(kg):" prop="location">                <el-input ref="location" v-model="create.createTemp.location" class="filter-item" placeholder="操作重量" type="text" />              </el-form-item>            </el-col>            <el-col :span="8">              <el-form-item label="备注:" prop="location">                <el-input ref="location" v-model="create.createTemp.location" class="filter-item" placeholder="备注" type="text" />              </el-form-item>            </el-col>          </el-row>        </el-form>        <div slot="footer" class="dialog-footer">          <el-button class="cancel" @click="create.dialogFormVisible = false; ">关闭</el-button>          <el-button class="success" :disabled="isokDisable" @click="createData()">确认</el-button>        </div>      </div>    </el-dialog>  </div></template><script>import { GetDataByName, transData } from '@/api/common'import Pagination from '@/components/Pagination'import TreeSelect from '@/components/TreeSelect'export default {  name: 'LaborConsumption',  components: { Pagination, TreeSelect },  data() {    return {      operationTypeList: [{ id: 0, name: '全部' }, { id: 1, name: '损耗' }, { id: 2, name: '人工用量' }], // 操作类型      feedNameList: [{ id: 0, name: '羊草' }, { id: 1, name: '小苏打' }], // 饲料名称      table: {        getdataListParm: {          name: 'getAssetList',          page: 1,          offset: 1,          pagecount: 10,          returntype: 'Map',          parammaps: {            enable: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: true      },      type: {        getDeptListParm: { name: 'getpart_classList' },        listType: [],        parentDept: [],        disabled: false,        placeholder: '请选择牲畜类别',        defaultProps: {          children: 'children',          label: 'partClassNameCode'        },        nodeKey: 'id',        defaultCheckedKeys: []      },      create: {        dialogFormVisible: false,        dialogStatus: '',        createTemp: {},        rules: {}      },      textMap: {        create: '新增'      },      isokDisable: false,      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },      cellStyle: { padding: 0 + 'px' }    }  },  created() {    this.getList()    this.getTypeList()  },  methods: {    getTypeList() {      this.type.getDeptListParm.parammaps = this.deptform      GetDataByName(this.type.getDeptListParm).then(response => {        this.type.listType = response.data        if (response.data.list !== null) {          this.type.listType = transData(response.data.list, 'id', 'pid', 'children')        }        this.type.parentDept = this.type.listType      })    },    popoverHide(checkedIds, checkedData) {      console.log(checkedIds, checkedData)      if (checkedIds !== null) {        if (checkedData.childrens == 0) {          console.log(checkedData)        } else {          this.type.defaultCheckedKeys = []          this.$message({ type: 'warning', message: '牲畜类别仅可选择配方模板中父类下的子类' })        }      } else {        this.type.defaultCheckedKeys = []      }    },    getList() {      this.table.listLoading = true      GetDataByName(this.table.getdataListParm).then(response => {        console.log('table数据', response.data.list)        if (response.data.list !== null) {          this.table.list = response.data.list          this.table.pageNum = response.data.pageNum          this.table.pageSize = response.data.pageSize            this.table.total = response.data.total        } else {          this.table.list = []        }        setTimeout(() => {          this.table.listLoading = false        }, 100)      })    },    handleSearch() {      console.log('点击了查询')      this.getList()    },    handleRefresh() {      console.log('点击了重置')    },    resetCreateTemp() {    },    handleCreate() {      console.log('点击了新增')      this.resetCreateTemp()      this.create.dialogStatus = 'create'      this.create.dialogFormVisible = true    },    createData() {      console.log('点击了新增保存')    },    handleRowDelete(row) {      console.log('点击了行内删除')    }  }}</script><style lang="scss" scoped>  .search{margin-top:10px;}  .table{margin-top:10px;} </style> <style lang="scss">   .typeSelect span .el-popover__reference .el-input--suffix {       .el-input__inner{         height:40px !important;       }     } </style>
 |