| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <seek-page :seekList="seekList" @search="search"></seek-page>
- <el-tabs
- v-model="activeName"
- @tab-click="handleClick"
- type="card"
- style="margin-top: 5px"
- >
- <el-tab-pane label="全部样品" name="1"></el-tab-pane>
- <el-tab-pane label="整样样品" name="2"></el-tab-pane>
- <el-tab-pane label="小样样品" name="3"></el-tab-pane>
- </el-tabs>
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :pageSize="20"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEdit('add')"
- >
- 新增
- </el-button>
- </template>
- <template v-slot:sampleCode="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="goDetail(row.id, 'detail')"
- >{{ row.sampleCode }}</el-link
- >
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit('edit', row)"
- >
- 修改
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- @click="goDetail(row.id)"
- v-if="row.status !== 2"
- >
- 处置
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除吗?"
- @confirm="remove(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <!-- 新增的dialog -->
- <sample ref="sampleRef" @done="reload"></sample>
- </div>
- </template>
- <script>
- import sample from './components/addOrEditSample.vue';
- import { getList, removeItem } from '@/api/samplemanagement';
- import dictMixins from '@/mixins/dictMixins';
- export default {
- mixins: [dictMixins],
- components: {
- sample
- },
- data() {
- return {
- columns: [
- {
- type: 'index',
- columnKey: 'index',
- align: 'center',
- label: '序号',
- width: 55,
- showOverflowTooltip: true
- },
- {
- prop: 'sampleCode',
- label: '编码',
- slot: 'sampleCode',
- align: 'center',
- width: 160,
- showOverflowTooltip: true
- },
- {
- prop: 'sourceCode',
- label: '来源编码',
- align: 'center',
- width: 160,
- showOverflowTooltip: true
- },
- {
- prop: 'categoryCode',
- label: '物品编码',
- align: 'center',
- width: 160,
- showOverflowTooltip: true
- },
- {
- prop: 'categoryName',
- label: '物品名称',
- align: 'center',
- width: 160,
- showOverflowTooltip: true
- },
- {
- prop: 'batchNo',
- label: '批次号',
- align: 'center',
- width: 100,
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- width: 100,
- showOverflowTooltip: true
- },
- {
- prop: 'brandNum',
- label: '牌号',
- align: 'center',
- width: 100,
- showOverflowTooltip: true
- },
- {
- prop: 'modelType',
- label: '型号',
- align: 'center',
- width: 160,
- showOverflowTooltip: true
- },
- {
- prop: 'quantity',
- label: '样品数量',
- align: 'center',
- width: 100,
- showOverflowTooltip: true
- },
- // {
- // prop: 'unit',
- // label: '计量单位',
- // align: 'center',
- // width: 100,
- // showOverflowTooltip: true
- // },
- {
- prop: 'disposeTime',
- label: '处置时间',
- align: 'center',
- width: 180,
- showOverflowTooltip: true
- },
- {
- prop: 'status',
- label: '状态',
- align: 'center',
- width: 80,
- formatter: (row, column, cellValue) => {
- console.log(this.getDictName('处置状态', cellValue));
-
- return this.getDictName('处置状态', cellValue);
- }
- },
- {
- columnKey: 'action',
- label: '操作',
- align: 'center',
- width: 180,
- resizable: false,
- slot: 'action',
- fixed: 'right'
- }
- ],
- activeName: '1'
- };
- },
- created() {
- this.requestDict('处置状态');
- },
- computed: {
- seekList() {
- return [
- {
- label: '编码:',
- value: 'sampleCode',
- type: 'input',
- placeholder: ''
- },
- {
- label: '来源编码:',
- value: 'sourceCode',
- type: 'input',
- placeholder: ''
- },
- {
- label: '物品编码:',
- value: 'categoryCode',
- type: 'input',
- placeholder: ''
- },
- {
- label: '物品名称:',
- value: 'categoryName',
- type: 'input',
- placeholder: ''
- },
- {
- label: '状态:',
- value: 'status',
- type: 'select',
- placeholder: '',
- planList: [
- { value: 0, label: '待处置' },
- { value: 1, label: '部分处置' },
- { value: 2, label: '处置完成' }
- ]
- }
- ];
- }
- },
- methods: {
- datasource({ page, where, limit }) {
- return getList({
- ...where,
- pageNum: page,
- size: limit
- });
- },
- search(where) {
- this.reload(where);
- },
- reload(where = {}) {
- this.$nextTick(() => {
- where.conditionType =
- this.activeName == '1' ? '' : this.activeName == '2' ? '1' : '2';
- this.$refs.table.reload({ page: 1, where });
- });
- },
- goDetail(id, type) {
- this.$router.push({
- path: '/sample/samplemanagement/detailList',
- query: {
- id,
- type
- }
- });
- },
- handleClick(tab) {
- this.activeName = tab.name;
- this.reload();
- },
- openEdit(type, row) {
- this.$refs.sampleRef.open(type, row);
- },
- remove(item) {
- removeItem([item.id])
- .then((message) => {
- this.$message.success(message);
- this.reload();
- })
- .catch((e) => {});
- }
- }
- };
- </script>
- <style scoped></style>
|