This commit is contained in:
parent
1f95f394cf
commit
50081ba10c
|
|
@ -37,6 +37,7 @@
|
|||
</template>
|
||||
<template #op="{ row }">
|
||||
<div class="oplinks">
|
||||
<a @click.stop="pageEditSMS(row)" title="Sms配置"><a-icon type="setting" /></a>
|
||||
<a @click.stop="pageEdit(row)" title="编辑"><a-icon type="edit" /></a>
|
||||
<a @click.stop="pageDelete(row)" title="删除"><a-icon type="delete" /></a>
|
||||
</div>
|
||||
|
|
@ -282,7 +283,23 @@ export default {
|
|||
this.$openPage("/BaseConfig/BaseConfigUpdate/" + row[this.keyName]);
|
||||
|
||||
},
|
||||
pageEditSMS(row) {
|
||||
if (!row) { // 如果没有选中行
|
||||
this.$mk.msg("请选择行"); // 提示
|
||||
return; // 返回
|
||||
}
|
||||
|
||||
this.$mk.dialog.open({
|
||||
page: () => import("./smsEdit"),
|
||||
title: "修改SMS配置",
|
||||
dataId: row[this.keyName],
|
||||
callback: ({ success }) => {
|
||||
success && this.$refs.xGrid.commitProxy('query')
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
// 删除
|
||||
pageDelete(row) {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,162 @@
|
|||
<template>
|
||||
<div class="page-body">
|
||||
|
||||
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
</vxe-form>
|
||||
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BASE_URL from '@/services/base/api.js';
|
||||
|
||||
export default {
|
||||
i18n: require('./i18n'),
|
||||
|
||||
props: {
|
||||
pageMode: {
|
||||
type: String,
|
||||
default: "edit"
|
||||
},
|
||||
dataId: {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
|
||||
actions: {
|
||||
update: `${BASE_URL.BASE_URL}/SqlServer/v1/sql/server/update`,
|
||||
get: `${BASE_URL.BASE_URL}/SqlServer/v1/sql/server/detail`,
|
||||
|
||||
update2: `${BASE_URL.BASE_URL}/Sms/v1/sms/update`,
|
||||
get2: `${BASE_URL.BASE_URL}/Sms/v1/sms/detail`
|
||||
},
|
||||
|
||||
|
||||
formOptions: {
|
||||
data: {
|
||||
sign_name:'',
|
||||
access_key_secret:'',
|
||||
accessKey_id:'',
|
||||
limit_count:0,
|
||||
limit_count_warning:0,
|
||||
endpoint:'',
|
||||
},
|
||||
|
||||
titleWidth: 150,
|
||||
titleAlign: 'right',
|
||||
|
||||
rules: {
|
||||
},
|
||||
|
||||
items: [
|
||||
{ field: 'sign_name', title: '签名', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入签名' } } },
|
||||
{ field: 'access_key_secret', title: 'access_key_secret', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入access_key_secret' } } },
|
||||
{ field: 'accessKey_id', title: 'accessKey_id', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入accessKey_id' } } },
|
||||
{ field: 'limit_count', title: 'limit_count', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入limit_count',type:"number" } } },
|
||||
{ field: 'limit_count_warning', title: 'limit_count_warning', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入limit_count_warning',type:"number" } } },
|
||||
{ field: 'endpoint', title: 'endpoint', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入endpoint' } } }
|
||||
]
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
|
||||
return pageData;
|
||||
},
|
||||
created() {
|
||||
if (this.dataId) {
|
||||
this.$mk.post({
|
||||
url: this.actions.get,
|
||||
loading: "加载中...",
|
||||
data: {
|
||||
beid: this.dataId
|
||||
}
|
||||
}).then(a => {
|
||||
if(a.data && a.data.sql_server){
|
||||
this.formOptions.data = a.data.sql_server;
|
||||
}else{
|
||||
this.formOptions.data.beid = this.dataId;
|
||||
}
|
||||
|
||||
}).catch((a) => {
|
||||
console.log(a)
|
||||
//this.$mk.error(a.data.msg);
|
||||
});
|
||||
} else {
|
||||
|
||||
this.formOptions.data.beid = this.dataId;
|
||||
}
|
||||
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
|
||||
loadData() {
|
||||
},
|
||||
|
||||
ok() {
|
||||
|
||||
let save = () => {
|
||||
let action = this.actions.update;
|
||||
let postdata = Object.assign({}, this.formOptions.data);
|
||||
|
||||
postdata.beid = this.dataId;
|
||||
this.$mk.post({
|
||||
url: action,
|
||||
loading: "保存中...",
|
||||
data: postdata,
|
||||
useBigInt: true
|
||||
}).then(() => {
|
||||
this.$mk.success("保存成功");
|
||||
this.$emit("callback", { success: true });
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
};
|
||||
|
||||
this.$refs.xForm.validate((a) => {
|
||||
|
||||
if (a) {
|
||||
let count = 0;
|
||||
for (let name in a) {
|
||||
a[name];
|
||||
count++;
|
||||
}
|
||||
this.$mk.error(`存在${count}项错误,请检查`);
|
||||
} else {
|
||||
save();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.$emit("callback", {});
|
||||
}
|
||||
},
|
||||
// 监听属性
|
||||
watch: {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style></style>
|
||||
|
|
@ -0,0 +1,482 @@
|
|||
<template>
|
||||
<div class="page-body">
|
||||
|
||||
|
||||
<a-row type="flex">
|
||||
<a-col flex="200px">
|
||||
|
||||
<div class="treepanel" :style="'height:' + tableHeight + 'px'">
|
||||
<div class="treepanel-header">
|
||||
<a @click.stop="treeAdd(row)" title="新增">
|
||||
<a-icon type="plus-circle" />
|
||||
</a>
|
||||
<a @click.stop="treeEdit(row)" title="编辑">
|
||||
<a-icon type="edit" />
|
||||
</a>
|
||||
<a @click.stop="treeDelete(row)" title="删除">
|
||||
<a-icon type="delete" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="treepanel-content">
|
||||
<a-tree :replaceFields="{children:'mes_enum', title:'title', key:'key'}" v-if="!treeLoading" show-line :tree-data="treeData" :default-expand-all="true" :block-node="true"
|
||||
@select="onTreeSelect" :default-selected-keys="selectedKeys">
|
||||
<a-icon slot="switcherIcon" type="down" />
|
||||
</a-tree>
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col flex="auto">
|
||||
<div class="toolbarbtns">
|
||||
<a-button type="primary" @click="pageAdd">新增</a-button>
|
||||
<a-button type="primary" @click="ok">保存</a-button>
|
||||
</div>
|
||||
<vxe-table border show-overflow keep-source ref="xTable" :height="tableHeight" :data="detailsData"
|
||||
:export-config="{}" :edit-config="{ trigger: 'click', mode: 'cell', icon: 'vxe-icon-edit', showStatus: false }">
|
||||
<vxe-column width="80">
|
||||
<template #default="{ row }">
|
||||
<div class="oplinks">
|
||||
<a @click.stop="pageAdd(row)" title="新增">
|
||||
<a-icon type="plus-circle" />
|
||||
</a>
|
||||
<a @click.stop="pageDelete(row)" title="删除">
|
||||
<a-icon type="delete" />
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="code" width="220" title="编号" :edit-render="{ name: '$input', props: {} }">
|
||||
|
||||
</vxe-column>
|
||||
<vxe-column field="name" width="220" title="名称" :edit-render="{ name: '$input', props: {} }">
|
||||
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
|
||||
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
import BASE_URL from '@/services/mes/api.js';
|
||||
let childrenFieldName = 'mes_enum';
|
||||
|
||||
export default {
|
||||
|
||||
props: {
|
||||
pageMode: {
|
||||
type: String,
|
||||
default: "edit"
|
||||
},
|
||||
dataId: {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
|
||||
modelName: "",
|
||||
|
||||
actions: {
|
||||
treedata: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/list`,
|
||||
delete: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/batchDelete`,
|
||||
listdata: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/value/list`,
|
||||
save: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/value/batchHandle`,
|
||||
},
|
||||
tipTimes: 0,
|
||||
detailsData: [
|
||||
],
|
||||
sourceDetailsData :[
|
||||
|
||||
],
|
||||
treeData: [],
|
||||
treeLoading: true,
|
||||
deletedDetailsData: [
|
||||
|
||||
],
|
||||
selectedKeys: [],
|
||||
selectedKey: null,
|
||||
tableHeight: 500
|
||||
|
||||
};
|
||||
|
||||
|
||||
return pageData;
|
||||
},
|
||||
created() {
|
||||
|
||||
this.$nextTick(() => {
|
||||
|
||||
this.tableHeight = this.$mk.getWindowSize().height - this.$mk.getOffsetTop(this.$refs.xTable.$el) - 200;
|
||||
this.treeInit();
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
|
||||
treeInit() {
|
||||
this.treeLoading = true;
|
||||
this.$mk.post({
|
||||
url: this.actions.treedata,
|
||||
loading: "加载中...",
|
||||
data: {
|
||||
"page": 1,
|
||||
"limit": 10000,
|
||||
"end_time": 0,
|
||||
"start_time": 0,
|
||||
"order_bys": [
|
||||
],
|
||||
"search_rules": [
|
||||
]
|
||||
}
|
||||
}).then(r => {
|
||||
|
||||
|
||||
let treedata = {
|
||||
title: "全部",
|
||||
key: "root"
|
||||
};
|
||||
treedata[childrenFieldName] = r.data.MesEnum;
|
||||
|
||||
|
||||
function formatTreedata(d) {
|
||||
if (d.id) {
|
||||
d.key = d.id.toString();
|
||||
} else {
|
||||
d.key = "root";
|
||||
}
|
||||
if (d.name) {
|
||||
d.title = d.name;
|
||||
}
|
||||
if (d[childrenFieldName] && d[childrenFieldName].length) {
|
||||
d[childrenFieldName].forEach(item => formatTreedata(item))
|
||||
}
|
||||
}
|
||||
treedata[childrenFieldName].forEach(item => formatTreedata(item))
|
||||
|
||||
this.treeData = [treedata];
|
||||
this.treeLoading = false;
|
||||
});
|
||||
|
||||
},
|
||||
treeAdd() {
|
||||
this.$mk.dialog.open({
|
||||
page: () => import("./treeEdit"),
|
||||
title: "新增-枚举分类",
|
||||
dataId: 0,
|
||||
callback: ({ success }) => {
|
||||
success && this.treeInit();
|
||||
}
|
||||
})
|
||||
},
|
||||
treeEdit() {
|
||||
if (!this.selectedKey || this.selectedKey == "root") {
|
||||
this.$mk.error("请先选择枚举分类");
|
||||
return;
|
||||
}
|
||||
let node = this.findTreeNode(this.selectedKey);
|
||||
|
||||
|
||||
this.$mk.dialog.open({
|
||||
page: () => import("./treeEdit"),
|
||||
title: "编辑-枚举分类",
|
||||
dataId: node.id,
|
||||
callback: ({ success }) => {
|
||||
success && this.treeInit();
|
||||
}
|
||||
})
|
||||
},
|
||||
treeDelete() {
|
||||
if (!this.selectedKey || this.selectedKey == "root") {
|
||||
this.$mk.error("请先选择枚举分类");
|
||||
return;
|
||||
}
|
||||
let node = this.findTreeNode(this.selectedKey);
|
||||
let ids = [
|
||||
node.id
|
||||
]; // 定义id数组
|
||||
|
||||
if (!ids.length) { // 如果没有选中行
|
||||
this.$mk.error("请选择行"); // 提示
|
||||
return;
|
||||
}
|
||||
|
||||
this.$mk.confirm('您确定要删除吗?').then(type => { // 确认删除
|
||||
if (type == 'confirm') { // 如果确认删除
|
||||
this.$mk.post({
|
||||
url: this.actions.delete, // 请求删除数据地址
|
||||
loading: "删除中...", // 加载提示
|
||||
data: {
|
||||
ids: ids // 传递id数组
|
||||
},
|
||||
useBigInt: true
|
||||
}).then(() => { // 成功
|
||||
this.$mk.success("删除成功"); // 提示成功
|
||||
this.treeInit(); // 重新加载数据
|
||||
}).catch((a) => { // 失败
|
||||
this.$mk.error(a.data.msg); // 提示错误信息
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
getDataId() {
|
||||
|
||||
let dataId = this.dataId;
|
||||
if (this.$route.params.id) {
|
||||
dataId = this.$route.params.id;
|
||||
}
|
||||
|
||||
return dataId;
|
||||
},
|
||||
|
||||
onTreeSelect(selectedKeys) {
|
||||
if (selectedKeys && selectedKeys[0]) {
|
||||
this.selectedKey = selectedKeys[0];
|
||||
this.loadData(selectedKeys[0]);
|
||||
}
|
||||
},
|
||||
findTreeNode(key) {
|
||||
var find = (items) => {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i].key == key) {
|
||||
return items[i];
|
||||
}
|
||||
if (items[i][childrenFieldName] && items[i][childrenFieldName].length) {
|
||||
var xx = find(items[i][childrenFieldName]);
|
||||
if (xx) {
|
||||
return xx;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return find(this.treeData);
|
||||
},
|
||||
getAllChildrenIds(items) {
|
||||
let ids = [];
|
||||
let eachItems = (arr) => {
|
||||
arr.forEach(item => {
|
||||
|
||||
if (item[childrenFieldName] && item[childrenFieldName].length) {
|
||||
eachItems(item[childrenFieldName]);
|
||||
} else if (item.model == "v_AA_PartnerClass") {
|
||||
ids.push(item.id)
|
||||
}
|
||||
|
||||
})
|
||||
};
|
||||
eachItems(items);
|
||||
return ids;
|
||||
},
|
||||
reloadData() {
|
||||
if (this.selectedKey) {
|
||||
this.loadData(this.selectedKey);
|
||||
}
|
||||
|
||||
},
|
||||
loadData(key) {
|
||||
|
||||
let postLoad = (id) => {
|
||||
this.$mk.post({
|
||||
url: this.actions.listdata,
|
||||
loading: "加载中...",
|
||||
data: {
|
||||
"page": 1,
|
||||
"limit": 10000,
|
||||
"start_time": 0,
|
||||
"end_time": 0,
|
||||
"search_rules": [
|
||||
{
|
||||
column: "enum_id", // 字段名
|
||||
mode: "=", // 搜索模式
|
||||
value: id.toString()
|
||||
}
|
||||
],
|
||||
"order_bys": [
|
||||
]
|
||||
},
|
||||
useBigInt: true
|
||||
}).then(a => {
|
||||
console.log(a.data.MesEnumValue)
|
||||
this.sourceDetailsData = a.data.MesEnumValue || [];
|
||||
let ds = [];
|
||||
this.sourceDetailsData.forEach(item=>{
|
||||
ds.push({
|
||||
id : item.id.toString(),
|
||||
code : item.code,
|
||||
name : item.name
|
||||
})
|
||||
});
|
||||
this.deletedDetailsData = [];
|
||||
this.detailsData = ds;
|
||||
});
|
||||
|
||||
}
|
||||
if (key && key != "root") {
|
||||
var node = this.findTreeNode(key);
|
||||
|
||||
postLoad(node.id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
findSourceInfo(idStr){
|
||||
for(var i =0;i<this.sourceDetailsData.length;i++){
|
||||
let o = this.sourceDetailsData[i];
|
||||
if(o.id.toString() == idStr){
|
||||
return o;
|
||||
}
|
||||
}
|
||||
},
|
||||
ok() {
|
||||
|
||||
let save = () => {
|
||||
|
||||
if (!this.selectedKey || this.selectedKey == "root") {
|
||||
this.$mk.error("请先选择枚举分类");
|
||||
return;
|
||||
}
|
||||
let node = this.findTreeNode(this.selectedKey);
|
||||
|
||||
let ds = JSON.parse(JSON.stringify(this.detailsData));
|
||||
|
||||
var postdata = {
|
||||
insertList: [],
|
||||
updateList: [],
|
||||
deleteList: this.deletedDetailsData
|
||||
};
|
||||
|
||||
ds.forEach(item => {
|
||||
delete item._X_ROW_KEY;
|
||||
|
||||
item.enum_id = node.id;
|
||||
if (item.id && item.id != "0") {
|
||||
let source = this.findSourceInfo(item.id);
|
||||
item.id = source.id;
|
||||
postdata.updateList.push(item);
|
||||
} else {
|
||||
postdata.insertList.push(item);
|
||||
}
|
||||
})
|
||||
this.$mk.post({
|
||||
url: this.actions.save,
|
||||
loading: "保存中...",
|
||||
data: postdata,
|
||||
useBigInt:true
|
||||
}).then(a => {
|
||||
if (a.code == "200") {
|
||||
this.$mk.success("保存成功");
|
||||
this.reloadData();
|
||||
} else {
|
||||
this.$mk.error(a.message);
|
||||
}
|
||||
|
||||
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
};
|
||||
|
||||
save();
|
||||
|
||||
|
||||
},
|
||||
|
||||
back() {
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.back();
|
||||
},
|
||||
pageAdd(row) {
|
||||
|
||||
const $table = this.$refs.xTable
|
||||
const record = {
|
||||
}
|
||||
if (row) {
|
||||
|
||||
this.detailsData.splice($table.getRowSeq(row), 0, record);
|
||||
} else {
|
||||
this.detailsData.push(record)
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
pageDelete(row) {
|
||||
const $table = this.$refs.xTable;
|
||||
if (row.id) {
|
||||
this.deletedDetailsData.push(row.id)
|
||||
}
|
||||
this.detailsData.splice($table.getRowSeq(row) - 1, 1);
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
// 监听属性
|
||||
watch: {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.page-body {
|
||||
background: white;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.treepanel {
|
||||
width: calc(100% - 10px);
|
||||
|
||||
margin-right: 10px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.treepanel-content {
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.treepanel-header {
|
||||
width: 100%;
|
||||
background: #F8F8F9;
|
||||
border-bottom: 1px solid #ccc;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
margin: 0;
|
||||
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.treepanel-header .anticon {
|
||||
margin-left: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toolbarbtns .ant-btn {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.toolbarbtns {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
<template>
|
||||
<div class="page-body">
|
||||
|
||||
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
|
||||
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
|
||||
</vxe-form>
|
||||
|
||||
|
||||
<div class="footerbar">
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
<a-button @click="cancel">取消</a-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BASE_URL from '@/services/base/api.js';
|
||||
|
||||
export default {
|
||||
|
||||
props: {
|
||||
dataId: {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
data() {
|
||||
|
||||
// 页面数据变量
|
||||
var pageData = {
|
||||
|
||||
actions: {
|
||||
create: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/create`,
|
||||
update: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/update`,
|
||||
get: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/detail`,
|
||||
list: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/list`,
|
||||
},
|
||||
|
||||
|
||||
formOptions: {
|
||||
data: {
|
||||
"name": "",
|
||||
"code": "",
|
||||
enum_id:"0"
|
||||
},
|
||||
|
||||
titleWidth: 150,
|
||||
titleAlign: 'right',
|
||||
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入名称' }
|
||||
]
|
||||
},
|
||||
|
||||
items: [
|
||||
{ field: 'name', title: '名称', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入名称' } } },
|
||||
{ field: 'code', title: '编号', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入编号' } } },
|
||||
{ field: 'enum_id', title: '上级分类', span: 24, itemRender: { name: '$select', props: { placeholder: '请输入上级分类', options: [] } } }
|
||||
]
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
|
||||
|
||||
return pageData;
|
||||
},
|
||||
created() {
|
||||
if (this.dataId) {
|
||||
this.$mk.post({
|
||||
url: this.actions.get,
|
||||
loading: "加载中...",
|
||||
data: {
|
||||
id: this.dataId
|
||||
},
|
||||
useBigInt: true
|
||||
}).then(a => {
|
||||
if(a.data.mes_enum.enum_id){
|
||||
a.data.mes_enum.enum_id = a.data.mes_enum.enum_id.toString();
|
||||
}else{
|
||||
a.data.mes_enum.enum_id = "0"
|
||||
}
|
||||
this.formOptions.data = a.data.mes_enum;
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
}
|
||||
this.loadEmuns();
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
loadEmuns() {
|
||||
this.$mk.post({
|
||||
url: this.actions.list,
|
||||
loading: "加载中...",
|
||||
data: {
|
||||
"page": 1,
|
||||
"limit": 10000,
|
||||
"end_time": 0,
|
||||
"start_time": 0,
|
||||
"order_bys": [
|
||||
],
|
||||
"search_rules": [
|
||||
{
|
||||
column: "enum_id", // 字段名
|
||||
mode: "=", // 搜索模式
|
||||
value: "0"
|
||||
}
|
||||
]
|
||||
},
|
||||
useBigInt: true
|
||||
}).then(a => {
|
||||
|
||||
let options_emuns = [{ value: "0", label: "选择上级分类" }];
|
||||
console.log(a.data.MesEnum)
|
||||
if (a.data.MesEnum) {
|
||||
a.data.MesEnum.forEach(item => {
|
||||
options_emuns.push({ value: item.id.toString(), id:item.id, label: item.name });
|
||||
});
|
||||
}
|
||||
this.formOptions.items[2].itemRender.props.options = options_emuns;
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
loadData() {
|
||||
},
|
||||
|
||||
ok() {
|
||||
|
||||
let save = () => {
|
||||
let action = !this.dataId ? this.actions.create : this.actions.update;
|
||||
let postdata = Object.assign({ id: this.dataId }, this.formOptions.data);
|
||||
|
||||
let options = this.formOptions.items[2].itemRender.props.options;
|
||||
options.forEach(item=>{
|
||||
if(item.value == postdata.enum_id){
|
||||
postdata.enum_id = item.id;
|
||||
}
|
||||
});
|
||||
this.$mk.post({
|
||||
url: action,
|
||||
loading: "保存中...",
|
||||
data: postdata,
|
||||
useBigInt: true
|
||||
}).then(() => {
|
||||
this.$mk.success("保存成功");
|
||||
this.$emit("callback", { success: true });
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
};
|
||||
|
||||
this.$refs.xForm.validate((a) => {
|
||||
|
||||
if (a) {
|
||||
let count = 0;
|
||||
for (let name in a) {
|
||||
a[name];
|
||||
count++;
|
||||
}
|
||||
this.$mk.error(`存在${count}项错误,请检查`);
|
||||
} else {
|
||||
save();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.$emit("callback", {});
|
||||
}
|
||||
},
|
||||
// 监听属性
|
||||
watch: {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style></style>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
const FunName = 'MesEnum';
|
||||
const FunTitle = '枚举';
|
||||
const InvisibleRouters = 'Detail,Delete,BatchDelete,BatchUpdate,BatchCreate,ExportExcel,LogDetail,LogList,Settings,SettingsUpdate,ImportExcel'.split(',')
|
||||
const InvisibleRouters2 = ''.split(',')
|
||||
// 视图组件
|
||||
const view = {
|
||||
tabs: () => import('@/layouts/tabs'),
|
||||
blank: () => import('@/layouts/BlankView'),
|
||||
page: () => import('@/layouts/PageView')
|
||||
}
|
||||
|
||||
// 路由组件注册
|
||||
const routerMap = {
|
||||
};
|
||||
routerMap[FunName]= {
|
||||
name: FunTitle,
|
||||
icon: 'idcard',
|
||||
component: view.blank,
|
||||
meta: {
|
||||
},
|
||||
authority: {
|
||||
permission: [],
|
||||
}
|
||||
};
|
||||
|
||||
routerMap[FunName + 'List']= {
|
||||
name: FunTitle,
|
||||
icon: 'idcard',
|
||||
path: `/${FunName}/${FunName}List`,
|
||||
meta:{
|
||||
page:{ cacheAble:false}
|
||||
},
|
||||
component: () => import(`@/pages/Middle/Mes/MesEnum/MesEnum/`),
|
||||
authority: {
|
||||
permission: [],
|
||||
}
|
||||
};
|
||||
|
||||
InvisibleRouters.forEach(item => {
|
||||
let name = FunName + item;
|
||||
if (!(name in routerMap)) {
|
||||
routerMap[name] = {
|
||||
meta: {
|
||||
invisible: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
InvisibleRouters2.forEach(item => {
|
||||
let name = item;
|
||||
if (!(name in routerMap)) {
|
||||
routerMap[name] = {
|
||||
meta: {
|
||||
invisible: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default routerMap
|
||||
|
|
@ -14,6 +14,7 @@ import MesStock from '@/router/Middle/Mes/MesStock/router.map.js'
|
|||
import MesWarehouse from '@/router/Middle/Mes/MesWarehouse/router.map.js'
|
||||
|
||||
|
||||
import MesEnum from '@/router/Middle/Mes/MesEnum/router.map.js'
|
||||
import MesUnitRouterMap from '@/router/Middle/Mes/MesUnit/router.map.js'
|
||||
|
||||
const routerMap = Object.assign({},
|
||||
|
|
@ -28,7 +29,8 @@ const routerMap = Object.assign({},
|
|||
MesProductionOrder,
|
||||
MesStaff,
|
||||
MesStock,
|
||||
MesWarehouse
|
||||
MesWarehouse,
|
||||
MesEnum
|
||||
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue