Commit 76dc2b34 by liuguorong93

更新

parent 3dca11c6
import { post, postform, get, postJson } from '@/utils/http.js'
export let baseUrl = '/api_btpz'
export let baseUrl = '/api'
// 查询表头配置
export const getMenuBt = params =>
......
......@@ -76,6 +76,7 @@
<el-button
type="primary"
size="small"
@click="saveMenuBtData"
>确定</el-button>
</div>
</div>
......@@ -89,57 +90,96 @@ import draggable from "vuedraggable";
export default {
name: "headerSettings",
props: {
headerSettInfo: {
type: Object,
default: () => {},
},
},
components: {
draggable,
},
data() {
return {
cxDefaultFormThead: [
{
label: "名称",
prop: "name",
},
{
label: "单位",
prop: "unit",
},
],
cxDefaultFormTheadList: [
{
label: "名称",
prop: "name",
},
{
label: "单位",
prop: "unit",
},
{
label: "警犬",
prop: "jingquan",
},
{
label: "时间",
prop: "time",
},
],
// 已选表头(默认表头)的数据
cxDefaultFormThead: [],
// 全部列的数据
cxDefaultFormTheadList: [],
// 待选表头的数据
waitBt: [],
};
},
mounted() {
this.cxDefaultFormTheadList = this.headerSettInfo.allColumns || [];
this.getMenuBtData();
// this.waitBt = this.cxDefaultFormTheadList.filter(
// (item) => !this.cxDefaultFormThead.some((ele) => ele.label === item.label)
// );
// console.log(this.waitBt);
},
methods: {
onMove(e) {
if (this.cxDefaultFormThead && this.cxDefaultFormThead.length === 1) {
return false;
} else {
return true;
}
},
closePage() {
this.$emit("close");
},
// 获取表头配置
getMenuBtData() {},
getMenuBtData() {
let params = {
menuId: this.headerSettInfo.menuId,
};
getMenuBt(params)
.then((res) => {
if (
res.code === 200 &&
res.success &&
res.data &&
Object.keys(res.data).length
) {
console.log(res.data);
// 从接口中可以查询到数据,那么已选表头(默认表头)就用接口返回的数据
return;
}
// 没有返回数据,用本地默认数据
this.setLocalData();
})
.catch(() => {
// 同样,接口请求失败,也用本地默认数据
this.setLocalData();
});
},
// 用本地默认数据
setLocalData() {
this.cxDefaultFormThead = this.headerSettInfo.defaultColumns || [];
this.waitBt = this.cxDefaultFormTheadList.filter(
(item) => !this.cxDefaultFormThead.some((ele) => ele.prop === item.prop)
);
},
// 保存表头配置
saveMenuBtData() {},
saveMenuBtData() {
let btxxEn = "";
let btxxCn = "";
if (this.cxDefaultFormThead?.length) {
this.cxDefaultFormThead.forEach((item) => {
if (item.prop && item.label) {
btxxEn = btxxEn + item.prop + ",";
btxxCn = btxxCn + item.label + ",";
}
});
btxxEn = btxxEn.substr(0, btxxEn.length - 1);
btxxCn = btxxCn.substr(0, btxxCn.length - 1);
}
let params = {
menuId: this.headerSettInfo.menuId,
btxxEn,
btxxCn,
};
addMenuBt(params).then((res) => {
console.log(res);
});
},
},
};
</script>
......
......@@ -325,7 +325,7 @@ export default {
apiName: "importArtisanApi",
},
showHeaderSettingBox: false,
showHeaderSettingBox: true,
headerSettInfo: {
menuId: "jsryManage",
allColumns: getJsryglAllColumns(),
......
......@@ -66,14 +66,6 @@ module.exports = {
pathRewrite: {
'^/api': '/'
}
},
"/api_btpz": {
target: "http://47.92.226.24:1008/",
ws: true,
changeOrigin: true,
pathRewrite: {
'^/api_btpz': '/'
}
}
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment