基础数据-外协厂家管理-新增排序与权限

dev-scheduling
ysn 1 month ago
parent 429c23ea23
commit c6af258443
  1. 231
      src/views/oem/oemCustomer/index.vue

@ -15,21 +15,27 @@
@size-change="sizeChange" @size-change="sizeChange"
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
@sort-change="sortChange"
> >
<template #menu-left> </template> <template #menu-left> </template>
<template #menu-right="{ size }"> </template> <template #menu-right="{ size }"> </template>
<template #menu="scope"> <template #menu="scope">
<el-button type="primary" link @click="setCraftAbility(scope.row)" <el-button
>设置工艺能力</el-button type="primary"
link
v-if="permission.oemCustomer_setCapability"
@click="setCraftAbility(scope.row)"
> >
设置工艺能力
</el-button>
<!-- <el-button type="primary" link @click="changePWD(scope.row)" <!-- <el-button type="primary" link @click="changePWD(scope.row)"
>设置密码</el-button >设置密码</el-button
> --> > -->
</template> </template>
<template #virtualMac="scope"> <template #virtualMac="scope">
<span> <span>
{{ scope.row.virtualMac ? "是" : "否" }} {{ scope.row.virtualMac ? '是' : '否' }}
</span> </span>
</template> </template>
<template #virtualMac-form="{ type, disabled }"> <template #virtualMac-form="{ type, disabled }">
@ -49,12 +55,7 @@
</template> </template>
</avue-crud> </avue-crud>
<!-- 设置密码 --> <!-- 设置密码 -->
<changePassword <changePassword :show-ip="showIp" v-if="showIp" :ec-id="ecId" @cancel="cancel"></changePassword>
:show-ip="showIp"
v-if="showIp"
:ec-id="ecId"
@cancel="cancel"
></changePassword>
<!-- 设置工艺能力 --> <!-- 设置工艺能力 -->
<setCraftAbility <setCraftAbility
@ -66,18 +67,18 @@
</basic-container> </basic-container>
</template> </template>
<script> <script>
import { getLazyList, remove, update, add, getMenu } from "@/api/system/menu"; import { getLazyList, remove, update, add, getMenu } from '@/api/system/menu';
import {getList,getCraftAbility} from "@/api/basicData/oemCustomer" import { getList, getCraftAbility } from '@/api/basicData/oemCustomer';
import { mapGetters } from "vuex"; import { mapGetters } from 'vuex';
import { import {
getQueryAllCaList, getQueryAllCaList,
getQueryAllCaDeatils, getQueryAllCaDeatils,
getQueryAllCaSave, getQueryAllCaSave,
getQueryAllCaDel, getQueryAllCaDel,
} from "@/api/processManagement/processCapability"; } from '@/api/processManagement/processCapability';
import { getDictionary } from "@/api/system/dict"; import { getDictionary } from '@/api/system/dict';
import changePassword from "./changePassword.vue"; import changePassword from './changePassword.vue';
import setCraftAbility from "./setCraftAbility.vue"; import setCraftAbility from './setCraftAbility.vue';
export default { export default {
components: { components: {
changePassword, changePassword,
@ -95,7 +96,7 @@ export default {
query: {}, query: {},
loading: true, loading: true,
selectionList: [], selectionList: [],
parentId: "", parentId: '',
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@ -104,12 +105,12 @@ export default {
option: { option: {
columnSort: true, columnSort: true,
tip: false, tip: false,
height: "auto", height: 'auto',
calcHeight: 32, calcHeight: 32,
simplePage: false, simplePage: false,
searchShow: true, searchShow: true,
searchMenuSpan: 6, searchMenuSpan: 6,
dialogWidth: "60%", dialogWidth: '60%',
border: true, border: true,
selection: false, selection: false,
index: true, index: true,
@ -120,59 +121,59 @@ export default {
addBtn: false, addBtn: false,
delBtn: false, delBtn: false,
editBtn: false, editBtn: false,
editBtnText: "编辑", editBtnText: '编辑',
refreshBtn: false, refreshBtn: false,
searchShowBtn: false, searchShowBtn: false,
gridBtn: false, gridBtn: false,
searchIndex: 3, searchIndex: 3,
searchIcon: true, searchIcon: true,
searchLabelPosition: "left", searchLabelPosition: 'left',
searchLabelWidth:'auto', searchLabelWidth: 'auto',
searchGutter: 24, searchGutter: 24,
searchSpan: 6, searchSpan: 6,
menuAlign: "center", menuAlign: 'center',
gridBtn: false, gridBtn: false,
searchMenuPosition: "right", searchMenuPosition: 'right',
addBtnIcon: " ", addBtnIcon: ' ',
viewBtnIcon: " ", viewBtnIcon: ' ',
delBtnIcon: " ", delBtnIcon: ' ',
editBtnIcon: " ", editBtnIcon: ' ',
align: "center", align: 'center',
column: [ column: [
{ {
label: "外协代码", label: '外协代码',
prop: "code", prop: 'code',
search: true, search: true,
sortable: true, sortable: 'custom',
overHidden: true, overHidden: true,
width: 120, width: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入外协代码", message: '请输入外协代码',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "外协名称", label: '外协名称',
prop: "ocName", prop: 'ocName',
sortable: true, sortable: 'custom',
search: true, search: true,
overHidden: true, overHidden: true,
width: 120, width: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入外协名称", message: '请输入外协名称',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "外协简称", label: '外协简称',
prop: "abbreviation", prop: 'abbreviation',
sortable: true, sortable: 'custom',
search: false, search: false,
overHidden: true, overHidden: true,
hide: true, hide: true,
@ -180,106 +181,105 @@ export default {
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择镀种分类", message: '请选择镀种分类',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "工艺能力", label: '工艺能力',
prop: "craftAbility", prop: 'craftAbility',
sortable: true, sortable: 'custom',
search: false, search: false,
overHidden: true, overHidden: true,
width: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择工艺能力", message: '请选择工艺能力',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "地区", label: '地区',
prop: "region", prop: 'region',
sortable: true, sortable: 'custom',
search: false, search: false,
overHidden: true, overHidden: true,
width: 120, width: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择地区", message: '请选择地区',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "地址", label: '地址',
prop: "address", prop: 'address',
sortable: true, sortable: 'custom',
search: false, search: false,
overHidden: true, overHidden: true,
width: 120, width: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择地址", message: '请选择地址',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "资质", label: '资质',
prop: "qualification", prop: 'qualification',
sortable: true, sortable: 'custom',
search: true, search: true,
overHidden: true, overHidden: true,
width: 120, width: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入资质", message: '请输入资质',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "供货状态", label: '供货状态',
prop: "curStatusText", prop: 'curStatusText',
sortable: true, sortable: 'custom',
search: true, search: true,
overHidden: true, overHidden: true,
width: 120, width: 120,
}, },
{ {
label: "联系人", label: '联系人',
prop: "contactMan", prop: 'contactMan',
sortable: true, sortable: 'custom',
search: true, search: true,
overHidden: true, overHidden: true,
width: 120, width: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择联系人", message: '请选择联系人',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "邮箱", label: '邮箱',
prop: "email", prop: 'email',
display: true, display: true,
search: false, search: false,
overHidden: true, overHidden: true,
width: 120, width: 120,
}, },
{ {
label: "联系电话", label: '联系电话',
prop: "contactPhone", prop: 'contactPhone',
sortable: true, sortable: 'custom',
search: false, search: false,
overHidden: true, overHidden: true,
width: 120, width: 120,
@ -287,7 +287,7 @@ export default {
// { // {
// label: "", // label: "",
// prop: "oemPassword", // prop: "oemPassword",
// sortable: true, // sortable: 'custom',
// search: false, // search: false,
// overHidden: true, // overHidden: true,
// width: 120, // width: 120,
@ -298,21 +298,13 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(["userInfo", "permission"]), ...mapGetters(['userInfo', 'permission']),
permissionList() {
return {
addBtn: this.validData(this.permission.menu_add, false),
viewBtn: this.validData(this.permission.menu_view, false),
delBtn: this.validData(this.permission.menu_delete, false),
editBtn: this.validData(this.permission.menu_edit, false),
};
},
ids() { ids() {
let ids = []; let ids = [];
this.selectionList.forEach((ele) => { this.selectionList.forEach(ele => {
ids.push(ele.id); ids.push(ele.id);
}); });
return ids.join(","); return ids.join(',');
}, },
}, },
methods: { methods: {
@ -354,7 +346,7 @@ export default {
}, },
handleAdd(row) { handleAdd(row) {
this.parentId = row.id; this.parentId = row.id;
const column = this.findObject(this.option.column, "parentId"); const column = this.findObject(this.option.column, 'parentId');
column.value = row.id; column.value = row.id;
column.addDisabled = true; column.addDisabled = true;
this.$refs.crud.rowAdd(); this.$refs.crud.rowAdd();
@ -397,18 +389,18 @@ export default {
// ); // );
}, },
rowDel(row, index, done) { rowDel(row, index, done) {
this.$confirm("确定将选择数据删除?", { this.$confirm('确定将选择数据删除?', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}) })
.then(() => { .then(() => {
return remove(row.id); return remove(row.id);
}) })
.then(() => { .then(() => {
this.$message({ this.$message({
type: "success", type: 'success',
message: "操作成功!", message: '操作成功!',
}); });
// //
done(row); done(row);
@ -423,7 +415,7 @@ export default {
// //
searchChange(params, done) { searchChange(params, done) {
this.query = params; this.query = params;
this.parentId = ""; this.parentId = '';
this.page.currentPage = 1; this.page.currentPage = 1;
this.onLoad(this.page, params); this.onLoad(this.page, params);
done(); done();
@ -439,16 +431,16 @@ export default {
}, },
// beforeOpen // beforeOpen
beforeOpen(done, type) { beforeOpen(done, type) {
if (["add", "edit"].includes(type)) { if (['add', 'edit'].includes(type)) {
this.initData(); this.initData();
} }
if (["edit", "view"].includes(type)) { if (['edit', 'view'].includes(type)) {
getMenu(this.form.id).then((res) => { getMenu(this.form.id).then(res => {
this.form = Object.assign(res.data.data, { this.form = Object.assign(res.data.data, {
hasChildren: this.form.hasChildren, hasChildren: this.form.hasChildren,
}); });
if (this.form.parentId === "0") { if (this.form.parentId === '0') {
this.form.parentId = ""; this.form.parentId = '';
} }
}); });
} }
@ -456,9 +448,9 @@ export default {
}, },
// beforeClose // beforeClose
beforeClose(done) { beforeClose(done) {
this.parentId = ""; this.parentId = '';
const column = this.findObject(this.option.column, "parentId"); const column = this.findObject(this.option.column, 'parentId');
column.value = ""; column.value = '';
column.addDisabled = false; column.addDisabled = false;
done(); done();
}, },
@ -474,19 +466,28 @@ export default {
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
sortChange({ prop, order }) {
this.query.descs = undefined;
this.query.ascs = undefined;
let orderByFieldKey = order === 'descending' ? 'descs' : 'ascs';
this.query[orderByFieldKey] = !prop
? undefined
: prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase();
// //
this.onLoad(this.page, this.query);
},
// //
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
getList({ getList({
current:this.page.currentPage, current: this.page.currentPage,
size:this.page.pageSize, size: this.page.pageSize,
...this.query ...this.query,
}).then(res =>{ }).then(res => {
this.data = res.data.data.records this.data = res.data.data.records;
this.page.total = res.data.data.total this.page.total = res.data.data.total;
this.loading = false this.loading = false;
}) });
}, },
}, },
}; };

Loading…
Cancel
Save