|
@@ -5,8 +5,6 @@
|
|
width="1200"
|
|
width="1200"
|
|
:before-close="handleClose"
|
|
:before-close="handleClose"
|
|
>
|
|
>
|
|
- <div>{{ form }}</div>
|
|
|
|
- <div>{{ search }}</div>
|
|
|
|
<avue-crud
|
|
<avue-crud
|
|
ref="crudRef"
|
|
ref="crudRef"
|
|
v-model:search="search"
|
|
v-model:search="search"
|
|
@@ -14,109 +12,79 @@
|
|
:data="data"
|
|
:data="data"
|
|
:option="option"
|
|
:option="option"
|
|
v-model:page="page"
|
|
v-model:page="page"
|
|
|
|
+ @row-click="rowClick"
|
|
@row-save="createRow"
|
|
@row-save="createRow"
|
|
@row-update="updateRow"
|
|
@row-update="updateRow"
|
|
@row-del="deleteRow"
|
|
@row-del="deleteRow"
|
|
@selection-change="selectionChange"
|
|
@selection-change="selectionChange"
|
|
- >
|
|
|
|
- <template #menu-left="{ size }">
|
|
|
|
- <el-button
|
|
|
|
- :disabled="toDeleteIds.length < 1"
|
|
|
|
- type="danger"
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
- :size="size"
|
|
|
|
- @click="multipleDelete"
|
|
|
|
- >删除</el-button
|
|
|
|
- >
|
|
|
|
- </template>
|
|
|
|
- </avue-crud>
|
|
|
|
- <!-- <template #footer>
|
|
|
|
|
|
+ />
|
|
|
|
+
|
|
|
|
+ <template #footer>
|
|
<div class="dialog-footer">
|
|
<div class="dialog-footer">
|
|
- <el-button @click="dialogVisible = false">Cancel</el-button>
|
|
|
|
- <el-button type="primary" @click="dialogVisible = false">
|
|
|
|
- Confirm
|
|
|
|
- </el-button>
|
|
|
|
|
|
+ <el-button @click="handleClose">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="onSelected"> 确定 </el-button>
|
|
</div>
|
|
</div>
|
|
- </template> -->
|
|
|
|
|
|
+ </template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
import { ref, getCurrentInstance } from "vue";
|
|
import { ref, getCurrentInstance } from "vue";
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
-import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
|
|
|
+import { tableConfig } from "./configs/tableConfig";
|
|
|
|
+
|
|
|
|
+const props = defineProps({
|
|
|
|
+ tableTitle: {
|
|
|
|
+ default: "",
|
|
|
|
+ type: String,
|
|
|
|
+ },
|
|
|
|
+ tableType: {
|
|
|
|
+ default: "",
|
|
|
|
+ type: String,
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const isShowTable = ref(false);
|
|
|
|
|
|
-import {
|
|
|
|
- productUrl,
|
|
|
|
- productOption,
|
|
|
|
- productUrl2,
|
|
|
|
- productOption2,
|
|
|
|
-} from "./configs/product";
|
|
|
|
|
|
+const startSelect = () => {
|
|
|
|
+ isShowTable.value = true;
|
|
|
|
+};
|
|
|
|
|
|
-import { useCommonStoreHook } from "@/store";
|
|
|
|
-const { isShowTable, tableType, tableTitle } = toRefs(useCommonStoreHook());
|
|
|
|
// 传入一个url,后面不带/
|
|
// 传入一个url,后面不带/
|
|
const { url, form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
const { url, form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
useCrud({
|
|
useCrud({
|
|
- src: "/api/v1/plan/order",
|
|
|
|
|
|
+ src: tableConfig[props.tableType].url,
|
|
});
|
|
});
|
|
const { dataList, createRow, updateRow, deleteRow } = Methords; //增删改查
|
|
const { dataList, createRow, updateRow, deleteRow } = Methords; //增删改查
|
|
const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
-const { checkBtnPerm } = 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对象
|
|
|
|
|
|
-// 设置表格列或者其他自定义的option
|
|
|
|
-// option.value = Object.assign(option.value, {
|
|
|
|
-// selection: true,
|
|
|
|
-// column: [
|
|
|
|
-// {
|
|
|
|
-// label: "产品",
|
|
|
|
-// prop: "materialCode",
|
|
|
|
-// search: true,
|
|
|
|
-// },
|
|
|
|
-// {
|
|
|
|
-// label: "年龄",
|
|
|
|
-// prop: "materialModel",
|
|
|
|
-// search: true,
|
|
|
|
-// },
|
|
|
|
-// {
|
|
|
|
-// label: "性别",
|
|
|
|
-// prop: "orderCode",
|
|
|
|
-// search: true,
|
|
|
|
-// },
|
|
|
|
-// {
|
|
|
|
-// label: "身高",
|
|
|
|
-// prop: "projectCode",
|
|
|
|
-// search: true,
|
|
|
|
-// },
|
|
|
|
-// ],
|
|
|
|
-// });
|
|
|
|
-// option.value = Object.assign(option.value, {
|
|
|
|
-// selection: true,
|
|
|
|
-// });
|
|
|
|
|
|
+const commonTableEmits = defineEmits(["selectedSure"]);
|
|
|
|
|
|
-watch(
|
|
|
|
- () => tableType.value,
|
|
|
|
- (type) => {
|
|
|
|
- if (type == 1) {
|
|
|
|
- url.value = productUrl;
|
|
|
|
- option.value = Object.assign(option.value, productOption);
|
|
|
|
- } else {
|
|
|
|
- url.value = productUrl2;
|
|
|
|
- option.value = Object.assign(option.value, productOption2);
|
|
|
|
- }
|
|
|
|
- dataList();
|
|
|
|
- }
|
|
|
|
-);
|
|
|
|
|
|
+watchEffect(async () => {
|
|
|
|
+ url.value = tableConfig[props.tableType].url;
|
|
|
|
+ option.value = Object.assign(option.value, {
|
|
|
|
+ menu: false,
|
|
|
|
+ highlightCurrentRow: true,
|
|
|
|
+ addBtn: false,
|
|
|
|
+ column: tableConfig[props.tableType].column,
|
|
|
|
+ });
|
|
|
|
+ dataList();
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const selectRowValue = ref({});
|
|
|
|
+const rowClick = (row) => {
|
|
|
|
+ selectRowValue.value = row;
|
|
|
|
+};
|
|
|
|
|
|
const handleClose = () => {
|
|
const handleClose = () => {
|
|
isShowTable.value = false;
|
|
isShowTable.value = false;
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+const onSelected = () => {
|
|
|
|
+ commonTableEmits("selectedSure", selectRowValue.value);
|
|
|
|
+ isShowTable.value = false;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+defineExpose({ startSelect });
|
|
</script>
|
|
</script>
|