123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <template>
- <div class="mainContentBox">
- <avue-crud
- ref="crudRef"
- v-model:search="search"
- v-model="form"
- :data="data"
- :option="option"
- v-model:page="page"
- @row-click="rowClick"
- @search-change="searchChange"
- @search-reset="resetChange"
- @size-change="dataList"
- @current-change="dataList"
- >
- </avue-crud>
- </div>
- </template>
- <script setup>
- import { defineProps, ref } from "vue";
- import { useCrud } from "@/hooks/userCrud";
- import { useCommonStoreHook } from "@/store";
- import { useDictionaryStore } from "@/store";
- const { isShowTable, tableType } = toRefs(useCommonStoreHook());
- const { dicts } = useDictionaryStore();
- const test = () => {
- isShowTable.value = true;
- tableType.value = tableType.value == 1 ? 2 : 1;
- };
- const props = defineProps({
- materialCode: {
- type: String,
- default: () => {
- return "";
- },
- },
- enabled: {
- type: String,
- default: () => {
- return "0";
- },
- },
- });
- // 传入一个url,后面不带/
- const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
- useCrud({
- src: "/api/v1/base/material",
- });
- const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
- Methords; //增删改查
- const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
- const { checkBtnPerm, downloadTemplate } = Utils; //按钮权限等工具
- const crudRef = ref(null); //crudRef.value 获取avue-crud对象
- const emit = defineEmits(["materialInfo"]);
- const rowClick = (row) => {
- emit("materialInfo", row);
- };
- // 设置表格列或者其他自定义的option
- option.value = Object.assign(option.value, {
- searchEnter: true,
- delBtn: false,
- selection: false,
- search: false,
- editBtn: false,
- addBtn: false,
- viewBtn: false,
- menu: false,
- column: [
- {
- label: "物料编码",
- width: 150,
- overHidden: true,
- prop: "materialCode",
- search: true,
- },
- {
- label: "物料名称",
- width: 150,
- overHidden: true,
- prop: "materialName",
- search: true,
- },
- {
- label: "物料属性",
- prop: "attributeDictValue",
- search: true,
- width: 120,
- overHidden: true,
- type: "select",
- dicData: dicts.material_properties,
- props: { label: "dictLabel", value: "dictValue" },
- },
- { label: "物料规格", width: 120, prop: "spec", search: true },
- {
- label: "单位",
- prop: "unitDictValue",
- type: "select",
- dicData: dicts.danwei_type,
- props: { label: "dictLabel", value: "dictValue" },
- },
- {
- label: "物料级别",
- prop: "levelDictValue",
- width: 100,
- overHidden: true,
- type: "select",
- dicData: dicts.material_level,
- props: { label: "dictLabel", value: "dictValue" },
- },
- { label: "生产厂家", width: 120, overHidden: true, prop: "manufacturer" },
- {
- label: "质检方案",
- prop: "inspectDictValue",
- width: 120,
- overHidden: true,
- type: "select",
- dicData: dicts.quality_testing_plan,
- props: { label: "dictLabel", value: "dictValue" },
- },
- {
- label: "适用平台",
- prop: "applicablePlatformsDictValue",
- width: 120,
- type: "select",
- overHidden: true,
- dicData: dicts.applicable_platforms,
- props: { label: "dictLabel", value: "dictValue" },
- },
- {
- label: "质量等级",
- prop: "qualityLevelDictValue",
- width: 120,
- type: "select",
- overHidden: true,
- dicData: dicts.quality_grade,
- props: { label: "dictLabel", value: "dictValue" },
- },
- {
- label: "选用类型",
- prop: "selectionDictValue",
- width: 100,
- overHidden: true,
- type: "select",
- dicData: dicts.selection_type,
- props: { label: "dictLabel", value: "dictValue" },
- },
- {
- label: "产品阶段",
- prop: "stageDictValue",
- search: true,
- overHidden: true,
- width: 100,
- filterable: true,
- type: "select",
- dicData: dicts.stage,
- props: { label: "dictLabel", value: "dictValue" },
- },
- { label: "客户型号", width: 100, overHidden: true, prop: "customerModel" },
- {
- label: "保质期(天)",
- width: 100,
- overHidden: true,
- prop: "qualityGuaranteePeriod",
- },
- {
- label: "封装方法",
- prop: "packageDictValue",
- width: 100,
- overHidden: true,
- type: "select",
- dicData: dicts.packaging_method,
- props: { label: "dictLabel", value: "dictLabel" },
- },
- {
- label: "是否工装",
- prop: "frock",
- width: 100,
- type: "radio", //类型为单选框
- dicData: [
- {
- label: "是",
- value: "1",
- },
- {
- label: "否",
- value: "0",
- },
- ],
- value: 1,
- rules: [
- {
- required: true,
- message: "是否工装",
- trigger: "blur",
- },
- ],
- },
- {
- label: "筛选规范",
- width: 100,
- overHidden: true,
- prop: "selectionSpec",
- type: "textarea",
- span: 18,
- },
- {
- label: "备注",
- width: 100,
- overHidden: true,
- prop: "remark",
- type: "textarea",
- span: 18,
- },
- ],
- });
- onMounted(() => {
- search.value.prodtCode = props.materialCode;
- if (props.enabled != "-1") {
- search.value.enabled = props.enabled;
- }
- dataList();
- });
- </script>
|