<template>
|
<a-card
|
:bordered="false"
|
class="card-area"
|
>
|
<template slot="title">
|
<i
|
class="action-jeecg actionarea1"
|
style="font-size: 18px;"
|
/>
|
车间
|
</template>
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<!-- 搜索区域 -->
|
<a-form
|
layout="inline"
|
@keyup.enter.native="searchQuery"
|
>
|
<a-row :gutter="24">
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-form-item
|
label="车间编号"
|
:labelCol="{span: 5}"
|
:wrapperCol="{span: 18, offset: 1}"
|
>
|
<j-input
|
placeholder="请输入车间编号查询"
|
v-model="queryParam.num"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-form-item
|
label="车间名称"
|
:labelCol="{span: 5}"
|
:wrapperCol="{span: 18, offset: 1}"
|
>
|
<j-input
|
placeholder="请输入车间名称查询"
|
v-model="queryParam.name"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<span
|
style="float: left;overflow: hidden;"
|
class="table-page-search-submitButtons"
|
>
|
<a-col
|
:md="6"
|
:sm="24"
|
>
|
<a-button
|
type="primary"
|
@click="searchQuery"
|
>查询</a-button>
|
<a-button
|
style="margin-left: 8px"
|
@click="searchReset"
|
>重置</a-button>
|
</a-col>
|
</span>
|
</a-row>
|
|
<template v-if="toggleSearchStatus">
|
<a-row :gutter="24">
|
<a-col :span="24">
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-form-item label="编号">
|
<j-input
|
placeholder="请输入编号查询"
|
v-model="queryParam.num"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-form-item label="名称">
|
<j-input
|
placeholder="请输入名称查询"
|
v-model="queryParam.name"
|
></j-input>
|
</a-form-item>
|
</a-col>
|
|
<a-col
|
:md="6"
|
:sm="8"
|
>
|
<a-form-item label="类型">
|
<j-dict-select-tag
|
v-model="queryParam.type"
|
dictCode="work_center_type"
|
placeholder="请选择类型"
|
/>
|
</a-form-item>
|
</a-col>
|
|
</a-col>
|
</a-row>
|
</template>
|
</a-form>
|
</div>
|
|
<!-- 操作按钮区域 -->
|
<div
|
class="table-operator"
|
style="margin-top: 5px"
|
>
|
<a-button
|
@click="handleAdd"
|
type="primary"
|
icon="plus"
|
>新增</a-button>
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
<a-button style="margin-left: 8px">
|
批量操作
|
<a-icon type="down" />
|
</a-button>
|
<a-menu slot="overlay">
|
<a-menu-item @click="batchDel">
|
<a-icon type="delete" />删除
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</div>
|
|
<a-table
|
ref="table"
|
bordered
|
size="middle"
|
rowKey="id"
|
:columns="columns"
|
:rowClassName="tableRowClass"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
@change="handleTableChange"
|
>
|
<!--字符串超长截取省略号显示-->
|
<span
|
slot="remark"
|
slot-scope="text"
|
>
|
<j-ellipsis
|
:value="text"
|
:length="15"
|
/>
|
</span>
|
<!--状态栏个性展示-->
|
<span
|
slot="status"
|
slot-scope="text,record"
|
>
|
<a-badge
|
v-if="record.status==1"
|
status="success"
|
/>
|
<span
|
v-if="record.status==1"
|
class="success"
|
>启用</span>
|
<!--{{record.status}}-->
|
<a-badge
|
v-if="record.status==0"
|
status="error"
|
/>
|
<span
|
v-if="record.status==0"
|
class="error"
|
>禁用</span>
|
</span>
|
<span
|
class="table-operation"
|
slot="action"
|
slot-scope="text, record"
|
>
|
<a
|
href="javascript:;"
|
@click="handleDetail(record)"
|
>详情</a>
|
<a-divider type="vertical" />
|
<a-dropdown>
|
<a class="ant-dropdown-link">
|
更多
|
<a-icon type="down" />
|
</a>
|
<a-menu slot="overlay">
|
<a-menu-item>
|
<a @click="handleEdit(record)">编辑</a>
|
</a-menu-item>
|
<a-menu-item>
|
<a-popconfirm
|
title="确定删除吗?"
|
@confirm="() => handleDelete(record.id)"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<a-menu-item v-if="record.status==1">
|
<a-popconfirm
|
title="确定禁用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>禁用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<a-menu-item v-if="record.status==0">
|
<a-popconfirm
|
title="确定启用吗?"
|
@confirm="() => handleActive(record.id)"
|
>
|
<a>启用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
|
</a-table>
|
<area-model
|
ref="modalForm"
|
@ok="modalFormOk"
|
:nodeSelected="nodeSelected"
|
></area-model>
|
</a-card>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import AreaModel from './AreaModel'
|
import { requestPut } from '@/api/manage'
|
import JInput from '@/components/jeecg/JInput'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
|
export default {
|
name: 'AreaList',
|
mixins: [JeecgListMixin],
|
components: {
|
AreaModel,
|
JInput,
|
JEllipsis,
|
},
|
props: {
|
nodeSelected: {
|
type: Object,
|
default: {}
|
}
|
},
|
data() {
|
return {
|
disableMixinCreated: true,
|
url: {
|
list: "/base/area/list",
|
delete: "/base/area/delete",
|
deleteBatch: "/base/area/deleteBatch",
|
active: "/base/area/active",
|
|
},
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 50,
|
align: 'center',
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1
|
}
|
},
|
{
|
title: '车间编号',
|
align: "center",
|
dataIndex: 'num',
|
sorter: true,
|
},
|
{
|
title: '车间名称',
|
dataIndex: 'name',
|
align: "center",
|
sorter: true,
|
},
|
// {
|
// title: '部门',
|
// align: 'center',
|
// dataIndex: 'deptId_dictText',
|
// sorter: true,
|
// },
|
{
|
title: '备注',
|
align: 'center',
|
dataIndex: 'remark',
|
scopedSlots: { customRender: 'remark' },
|
},
|
{
|
width: 100,
|
title: '状态',
|
align: 'center',
|
scopedSlots: {
|
customRender: 'status',
|
},
|
dataIndex: 'status',
|
sorter: true,
|
},
|
{
|
width: 150,
|
title: '操作',
|
dataIndex: 'action',
|
scopedSlots: { customRender: 'action' },
|
align: "center",
|
|
},
|
]
|
};
|
},
|
methods: {
|
//禁用状态样式
|
tableRowClass(record, index) {
|
if (record.status != "1") {
|
return "frozenRowClass";
|
}
|
return "";
|
},
|
handleActive(id) {
|
if (!this.url.active) {
|
this.$message.error("请设置url.active属性!")
|
return
|
}
|
let that = this;
|
requestPut(that.url.active, {}, { id: id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.loadData();
|
} else {
|
that.$message.warning(res.message);
|
}
|
});
|
}
|
},
|
watch: {
|
alterFlag() {
|
this.$bus.$emit('queryTreeData');
|
},
|
nodeSelected() {
|
this.queryParam.siteId = this.nodeSelected.key;
|
this.loadData();
|
//初始化字典配置 在自己页面定义
|
this.initDictConfig();
|
}
|
},
|
created() {
|
this.queryParam.siteId = this.nodeSelected.key;
|
this.loadData();
|
//初始化字典配置 在自己页面定义
|
this.initDictConfig();
|
}
|
}
|
</script>
|
<style>
|
@import '~@assets/less/common.less';
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
.success {
|
color: green;
|
}
|
.error {
|
color: red;
|
}
|
</style>
|