add SwitchBtn 组件
This commit is contained in:
@@ -197,6 +197,23 @@ export default {
|
||||
this.openDialog(data, true);
|
||||
break;
|
||||
}
|
||||
case "status": {
|
||||
// TODO: 类似于这种字符串,可以统一集中到一个文件里
|
||||
const { id, code, enabled } = data;
|
||||
// 更改状态,更改状态需要 id 和 code 然后是 状态 enabled
|
||||
this.$http
|
||||
.put(this.urls.base, {
|
||||
id,
|
||||
code,
|
||||
enabled,
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||||
import StatusComponent from "@/components/noTemplateComponents/statusComponent";
|
||||
import switchBtn from "@/components/noTemplateComponents/switchBtn";
|
||||
import request from "@/utils/request";
|
||||
import { dictFilter } from '@/utils/filters'
|
||||
|
||||
@@ -7,8 +7,8 @@ export default function () {
|
||||
const tableProps = [
|
||||
{ prop: "name", label: "料仓名称" },
|
||||
{ prop: "code", label: "料仓编码" },
|
||||
{ prop: "typeDictValue", label: "料仓类型", filter: dictFilter('liangcang') },
|
||||
{ prop: "status", label: "产线状态", subcomponent: StatusComponent }, // subcomponent
|
||||
{ prop: "typeDictValue", label: "料仓类型", filter: dictFilter('liaocang') },
|
||||
{ prop: "status", label: "状态", subcomponent: switchBtn }, // subcomponent
|
||||
{ prop: "description", label: "描述" },
|
||||
{ prop: "remark", label: "备注" },
|
||||
{
|
||||
@@ -78,8 +78,9 @@ export default function () {
|
||||
prop: "typeDictValue",
|
||||
// fetchData: () => this.$http.get("/pms/factory/page", { params: { limit: 999, page: 1 } }),
|
||||
options: [
|
||||
{ label: '中间仓', value: 0 },
|
||||
{ label: '日料仓', value: 1 },
|
||||
// TODO: 或许映射可以全权交给数据字典
|
||||
{ label: '中间仓', value: '0' },
|
||||
{ label: '日料仓', value: '1' },
|
||||
],
|
||||
rules: { required: true, message: "not empty", trigger: "change" },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user