| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <template>
- <el-dialog
- :title="title"
- v-if="visible"
- :visible.sync="visible"
- :before-close="handleClose"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- width="70%"
- >
- <el-card shadow="never">
- <user-search :typeList="typeOptions" @search="reload" />
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :selection.sync="selection"
- row-key="id"
- >
- </ele-pro-table>
- </el-card>
- <div class="btns">
- <el-button type="primary" size="small" @click="selected">选择</el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import dictMixins from '@/mixins/dictMixins';
- import UserSearch from '@/views/factoryModel/jobManagement/components/user-search.vue';
- import { getProfessionPageList } from '@/api/factoryModel';
- export default {
- components: { UserSearch },
- mixins: [dictMixins],
- data() {
- return {
- visible: false,
- title: '产品参数',
- levelOptions: [
- {
- label: '初级',
- value: '1'
- },
- {
- label: '中级',
- value: '2'
- },
- {
- label: '高级',
- value: '3'
- }
- ],
- // 表格列配置
- columns: [
- {
- columnKey: 'selection',
- type: 'selection',
- width: 45,
- align: 'center',
- fixed: 'left'
- },
- {
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center'
- },
- {
- slot: 'type',
- label: '类型',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110,
- formatter: (_row) => {
- return this.getDictValue('工种类型', _row.type);
- }
- },
- {
- align: 'center',
- prop: 'code',
- label: '编码',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- slot: 'name',
- prop: 'name',
- label: '名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- slot: 'level',
- prop: 'level',
- label: '等级',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110,
- formatter: (_row) => {
- return this.levelOptions.filter(
- (item) => _row.level == item.value
- )[0].label;
- }
- },
- {
- slot: 'hourCost',
- prop: 'hourCost',
- label: '标准工时费',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- }
- ],
- statusList: [
- { label: '工艺', value: 0 },
- { label: '工序', value: 1 },
- { label: '产品', value: 2 },
- { label: '原料', value: 3 },
- { label: '设备', value: 4 },
- { label: '其他', value: 5 }
- ],
- // 表格选中数据
- selection: [],
- tableData: [],
- current: null
- };
- },
- created() {
- this.requestDict('工种类型');
- },
- computed: {
- typeOptions() {
- return this.dict[this.dictEnum['工种类型']];
- }
- },
- methods: {
- /* 表格数据源 */
- async datasource({ page, limit, where, order }) {
- const res = await getProfessionPageList({
- ...where,
- ...order,
- pageNum: page,
- size: limit
- });
- return res;
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where: where });
- },
- open(item, current) {
- if (item) {
- this.tableData = JSON.parse(JSON.stringify(item));
- }
- if (current) {
- this.current = current;
- }
- this.visible = true;
- },
- handleClose() {
- this.visible = false;
- this.$refs.table.setSelectedRows([]);
- this.selection = [];
- },
- selected() {
- if (!this.selection.length) {
- this.$message.error('请至少选择一条数据');
- return;
- }
- this.$emit('chooseModal', this.selection, this.current);
- this.handleClose();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .btns {
- text-align: center;
- padding: 10px 0;
- }
- </style>
|