|
@@ -9,7 +9,7 @@
|
|
|
v-model:page="page"
|
|
|
@row-save="createRow"
|
|
|
@row-update="updateRow"
|
|
|
- @row-del="delete(row,index,done)"
|
|
|
+ @row-del="deletes(row, index, done)"
|
|
|
@search-change="searchChange"
|
|
|
@search-reset="resetChange"
|
|
|
@size-change="dataList"
|
|
@@ -23,25 +23,22 @@
|
|
|
icon="el-icon-delete"
|
|
|
:size="size"
|
|
|
@click="multipleDelete"
|
|
|
- >删除</el-button
|
|
|
+ >删除</el-button
|
|
|
>
|
|
|
</template>
|
|
|
- <template #menu="{row,index,type}">
|
|
|
- <el-button @click="binding(row)"
|
|
|
- icon="el-icon-link"
|
|
|
- text
|
|
|
- type="primary"
|
|
|
- >绑定子项</el-button>
|
|
|
+ <template #menu="{ row, index, type }">
|
|
|
+ <el-button @click="binding(row)" icon="el-icon-link" text type="primary"
|
|
|
+ >绑定子项</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
-
|
|
|
</avue-crud>
|
|
|
|
|
|
- <CommonTable
|
|
|
- ref="ctableRef"
|
|
|
- tableTitle="绑定子项"
|
|
|
- tableType="FACTORY"
|
|
|
- @selected-sure="onSelectedFinish"
|
|
|
- />
|
|
|
+ <CommonTable
|
|
|
+ ref="ctableRef"
|
|
|
+ tableTitle="绑定子项"
|
|
|
+ tableType="FACTORY"
|
|
|
+ @selected-sure="onSelectedFinish"
|
|
|
+ />
|
|
|
<CommonTable
|
|
|
ref="workShopRef"
|
|
|
tableTitle="绑定子项"
|
|
@@ -59,205 +56,201 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
- import { ref, getCurrentInstance } from "vue";
|
|
|
- import { useCrud } from "@/hooks/userCrud";
|
|
|
- import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
- import { useCommonStoreHook } from "@/store";
|
|
|
- const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
|
- import {
|
|
|
- updateWorkShop,
|
|
|
- } from "@/api/workShop";
|
|
|
-
|
|
|
- import {
|
|
|
- updateProductionLine,
|
|
|
- } from "@/api/productionLine";
|
|
|
- import {
|
|
|
- updateStation,
|
|
|
- } from "@/api/station";
|
|
|
- // 公共弹窗相关
|
|
|
- const ctableRef = ref(null);
|
|
|
- const workShopRef=ref(null);
|
|
|
- const productionLineRef=ref(null);
|
|
|
- const factory=ref({});
|
|
|
- const binding = (row) => {
|
|
|
- factory.value=row;
|
|
|
- if (row.level==="first") {
|
|
|
- ctableRef.value.startSelect();
|
|
|
- }
|
|
|
- if(row.level==="second"){
|
|
|
- workShopRef.value.startSelect();
|
|
|
- }
|
|
|
- if(row.level==="third"){
|
|
|
- productionLineRef.value.startSelect();
|
|
|
- }
|
|
|
+import { ref, getCurrentInstance } from "vue";
|
|
|
+import { useCrud } from "@/hooks/userCrud";
|
|
|
+import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
+import { useCommonStoreHook } from "@/store";
|
|
|
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
|
+import { updateWorkShop } from "@/api/workShop";
|
|
|
|
|
|
- };
|
|
|
- const delete=(row,index,done)=>{
|
|
|
- if(row.level==="first"){
|
|
|
- deleteRow(row,index,done);
|
|
|
- }
|
|
|
- if(row.level==="second"){
|
|
|
- workShopRef.value.startSelect();
|
|
|
- }
|
|
|
- if(row.level==="third"){
|
|
|
- productionLineRef.value.startSelect();
|
|
|
- }
|
|
|
+import { updateProductionLine } from "@/api/productionLine";
|
|
|
+import { updateStation } from "@/api/station";
|
|
|
+// 公共弹窗相关
|
|
|
+const ctableRef = ref(null);
|
|
|
+const workShopRef = ref(null);
|
|
|
+const productionLineRef = ref(null);
|
|
|
+const factory = ref({});
|
|
|
+const binding = (row) => {
|
|
|
+ factory.value = row;
|
|
|
+ if (row.level === "first") {
|
|
|
+ ctableRef.value.startSelect();
|
|
|
}
|
|
|
- const dialog = reactive({
|
|
|
- title: "绑定子项",
|
|
|
- visible: false,
|
|
|
- });
|
|
|
+ if (row.level === "second") {
|
|
|
+ workShopRef.value.startSelect();
|
|
|
+ }
|
|
|
+ if (row.level === "third") {
|
|
|
+ productionLineRef.value.startSelect();
|
|
|
+ }
|
|
|
+};
|
|
|
+const deletes = (row, index, done) => {
|
|
|
+ if (row.level === "first") {
|
|
|
+ deleteRow(row, index, done);
|
|
|
+ }
|
|
|
+ if (row.level === "second") {
|
|
|
+ workShopRef.value.startSelect();
|
|
|
+ }
|
|
|
+ if (row.level === "third") {
|
|
|
+ productionLineRef.value.startSelect();
|
|
|
+ }
|
|
|
+};
|
|
|
+const dialog = reactive({
|
|
|
+ title: "绑定子项",
|
|
|
+ visible: false,
|
|
|
+});
|
|
|
|
|
|
- // 传入一个url,后面不带/
|
|
|
- const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
- useCrud({
|
|
|
- src: "/api/v1/base/factory",
|
|
|
- });
|
|
|
- const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
|
|
|
- Methords; //增删改查
|
|
|
- const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
- const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
- // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
|
|
|
- // const permission = reactive({
|
|
|
- // delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
|
|
|
- // addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
|
|
|
- // editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
|
|
|
- // menu: true,
|
|
|
- // });
|
|
|
+// 传入一个url,后面不带/
|
|
|
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
+ useCrud({
|
|
|
+ src: "/api/v1/base/factory",
|
|
|
+ });
|
|
|
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
|
|
|
+ Methords; //增删改查
|
|
|
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
+// checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
|
|
|
+// const permission = reactive({
|
|
|
+// delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
|
|
|
+// addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
|
|
|
+// editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
|
|
|
+// menu: true,
|
|
|
+// });
|
|
|
|
|
|
- const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- // console.log("crudRef", crudRef)
|
|
|
- dataList();
|
|
|
- });
|
|
|
+onMounted(() => {
|
|
|
+ // console.log("crudRef", crudRef)
|
|
|
+ dataList();
|
|
|
+});
|
|
|
|
|
|
- /**
|
|
|
- * 上传excel相关
|
|
|
- */
|
|
|
- const uploadRef = ref(null);
|
|
|
- const uploadFinished = () => {
|
|
|
- // 上传完成后的刷新操作
|
|
|
- page.currentPage = 1;
|
|
|
- dataList();
|
|
|
- };
|
|
|
- const importExcelData = () => {
|
|
|
- if (uploadRef.value) {
|
|
|
- uploadRef.value.show("/api/v1/plan/order/import");
|
|
|
- }
|
|
|
- };
|
|
|
- const formData=ref({});
|
|
|
- // 设置表格列或者其他自定义的option
|
|
|
- option.value = Object.assign(option.value, {
|
|
|
- selection: true,
|
|
|
- menuWidth: 320,
|
|
|
- border: true,
|
|
|
- index: true,
|
|
|
- rowKey: 'code',
|
|
|
- rowParentKey: 'parentCode',
|
|
|
- column: [
|
|
|
- {
|
|
|
- label: "厂区名称",
|
|
|
- prop: "name",
|
|
|
- search: true,
|
|
|
- overHidden:true,
|
|
|
- span: 24,
|
|
|
- labelWidth: 100,
|
|
|
- rules: [{
|
|
|
+/**
|
|
|
+ * 上传excel相关
|
|
|
+ */
|
|
|
+const uploadRef = ref(null);
|
|
|
+const uploadFinished = () => {
|
|
|
+ // 上传完成后的刷新操作
|
|
|
+ page.currentPage = 1;
|
|
|
+ dataList();
|
|
|
+};
|
|
|
+const importExcelData = () => {
|
|
|
+ if (uploadRef.value) {
|
|
|
+ uploadRef.value.show("/api/v1/plan/order/import");
|
|
|
+ }
|
|
|
+};
|
|
|
+const formData = ref({});
|
|
|
+// 设置表格列或者其他自定义的option
|
|
|
+option.value = Object.assign(option.value, {
|
|
|
+ selection: true,
|
|
|
+ menuWidth: 320,
|
|
|
+ border: true,
|
|
|
+ index: true,
|
|
|
+ rowKey: "code",
|
|
|
+ rowParentKey: "parentCode",
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "厂区名称",
|
|
|
+ prop: "name",
|
|
|
+ search: true,
|
|
|
+ overHidden: true,
|
|
|
+ span: 24,
|
|
|
+ labelWidth: 100,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
required: true,
|
|
|
message: "请输入工厂名称",
|
|
|
- trigger: "blur"
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- label: "负责人",
|
|
|
- prop: "manager",
|
|
|
- span: 24,
|
|
|
- labelWidth: 100,
|
|
|
- rules: [{
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "负责人",
|
|
|
+ prop: "manager",
|
|
|
+ span: 24,
|
|
|
+ labelWidth: 100,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
required: true,
|
|
|
message: "请选择厂区负责人",
|
|
|
- trigger: "blur"
|
|
|
- }],
|
|
|
- type: 'select',
|
|
|
- dicUrl:import.meta.env.VITE_APP_BASE_API+"/api/v1/sys/user/list",
|
|
|
- dicMethod:"post",
|
|
|
- props: {
|
|
|
- label: "userName", // 下拉菜单显示的字段
|
|
|
- value: "userName" // 下拉菜单值的字段
|
|
|
+ trigger: "blur",
|
|
|
},
|
|
|
+ ],
|
|
|
+ type: "select",
|
|
|
+ dicUrl: import.meta.env.VITE_APP_BASE_API + "/api/v1/sys/user/list",
|
|
|
+ dicMethod: "post",
|
|
|
+ props: {
|
|
|
+ label: "userName", // 下拉菜单显示的字段
|
|
|
+ value: "userName", // 下拉菜单值的字段
|
|
|
},
|
|
|
- {
|
|
|
- label: "厂区位置",
|
|
|
- prop: "position",
|
|
|
- overHidden:true,
|
|
|
- span: 24,
|
|
|
- labelWidth: 100,
|
|
|
- rules: [{
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "厂区位置",
|
|
|
+ prop: "position",
|
|
|
+ overHidden: true,
|
|
|
+ span: 24,
|
|
|
+ labelWidth: 100,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
required: true,
|
|
|
message: "请输入厂区位置",
|
|
|
- trigger: "blur"
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- label: "创建时间",
|
|
|
- prop: "created",
|
|
|
- display:false
|
|
|
- },
|
|
|
- {
|
|
|
- label: "备注",
|
|
|
- span: 24,
|
|
|
- labelWidth: 100,
|
|
|
- overHidden:true,
|
|
|
- prop: "remark",
|
|
|
- type: 'textarea',
|
|
|
- },
|
|
|
- ],
|
|
|
- });
|
|
|
-
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "创建时间",
|
|
|
+ prop: "created",
|
|
|
+ display: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "备注",
|
|
|
+ span: 24,
|
|
|
+ labelWidth: 100,
|
|
|
+ overHidden: true,
|
|
|
+ prop: "remark",
|
|
|
+ type: "textarea",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
|
|
|
- const onSelectedFinish = (selectedValue) => {
|
|
|
- formData.code=selectedValue.code;
|
|
|
- formData.parentCode=factory.value.code;
|
|
|
- formData.id=selectedValue.id;
|
|
|
- updateWorkShop(formData).then((data: any) => {
|
|
|
- ElMessage({
|
|
|
- message: data.msg,
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- // 上传完成后的刷新操作
|
|
|
- page.currentPage = 1;
|
|
|
- dataList();
|
|
|
+const onSelectedFinish = (selectedValue) => {
|
|
|
+ formData.value.code = selectedValue.code;
|
|
|
+ formData.value.parentCode = factory.value.code;
|
|
|
+ formData.value.id = selectedValue.id;
|
|
|
+ updateWorkShop(formData).then((data: any) => {
|
|
|
+ ElMessage({
|
|
|
+ message: data.msg,
|
|
|
+ type: "success",
|
|
|
});
|
|
|
- };
|
|
|
- const onSelectedLineFinish = (selectedValue) => {
|
|
|
- formData.code=selectedValue.code;
|
|
|
- formData.parentCode=factory.value.code;
|
|
|
- formData.id=selectedValue.id;
|
|
|
- updateProductionLine(formData).then((data: any) => {
|
|
|
- ElMessage({
|
|
|
- message: data.msg,
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- // 上传完成后的刷新操作
|
|
|
- page.currentPage = 1;
|
|
|
- dataList();
|
|
|
+ // 上传完成后的刷新操作
|
|
|
+ page.currentPage = 1;
|
|
|
+ dataList();
|
|
|
+ });
|
|
|
+};
|
|
|
+const onSelectedLineFinish = (selectedValue) => {
|
|
|
+ formData.value.code = selectedValue.code;
|
|
|
+ formData.value.parentCode = factory.value.code;
|
|
|
+ formData.value.id = selectedValue.id;
|
|
|
+ updateProductionLine(formData).then((data: any) => {
|
|
|
+ ElMessage({
|
|
|
+ message: data.msg,
|
|
|
+ type: "success",
|
|
|
});
|
|
|
- };
|
|
|
- const onSelectedStationFinish = (selectedValue) => {
|
|
|
- formData.code=selectedValue.code;
|
|
|
- formData.parentCode=factory.value.code;
|
|
|
- formData.id=selectedValue.id;
|
|
|
- updateStation(formData).then((data: any) => {
|
|
|
- ElMessage({
|
|
|
- message: data.msg,
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- // 上传完成后的刷新操作
|
|
|
- page.currentPage = 1;
|
|
|
- dataList();
|
|
|
+ // 上传完成后的刷新操作
|
|
|
+ page.currentPage = 1;
|
|
|
+ dataList();
|
|
|
+ });
|
|
|
+};
|
|
|
+const onSelectedStationFinish = (selectedValue) => {
|
|
|
+ formData.value.code = selectedValue.code;
|
|
|
+ formData.value.parentCode = factory.value.code;
|
|
|
+ formData.value.id = selectedValue.id;
|
|
|
+ updateStation(formData).then((data: any) => {
|
|
|
+ ElMessage({
|
|
|
+ message: data.msg,
|
|
|
+ type: "success",
|
|
|
});
|
|
|
- };
|
|
|
+ // 上传完成后的刷新操作
|
|
|
+ page.currentPage = 1;
|
|
|
+ dataList();
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
-
|
|
|
-
|