|
@@ -7,21 +7,19 @@
|
|
|
:data="data"
|
|
|
:option="option"
|
|
|
v-model:page="page"
|
|
|
- @row-save="createRow"
|
|
|
- @row-update="updateRow"
|
|
|
- @row-del="deleteRow"
|
|
|
+ @row-click="rowClick"
|
|
|
@search-change="searchChange"
|
|
|
@search-reset="resetChange"
|
|
|
@size-change="dataList"
|
|
|
@current-change="dataList"
|
|
|
- @selection-change="selectionChange"
|
|
|
>
|
|
|
</avue-crud>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { ref } from "vue";
|
|
|
+import { ref, getCurrentInstance } from "vue";
|
|
|
import { useCrud } from "@/hooks/userCrud";
|
|
|
+import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
import dictDataUtil from "@/common/configs/dictDataUtil";
|
|
@@ -30,27 +28,36 @@ const test = () => {
|
|
|
isShowTable.value = true;
|
|
|
tableType.value = tableType.value == 1 ? 2 : 1;
|
|
|
};
|
|
|
-
|
|
|
// 传入一个url,后面不带/
|
|
|
-const { form, data, option, search, page, Methords, Utils } =
|
|
|
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
useCrud({
|
|
|
src: "/api/v1/device",
|
|
|
});
|
|
|
const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
|
|
|
-const { selectionChange } = Methords; //选中和批量删除事件
|
|
|
-const { downloadTemplate } = Utils; //按钮权限等工具
|
|
|
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
+const { checkBtnPerm, downloadTemplate } = Utils; //按钮权限等工具
|
|
|
|
|
|
const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
+const emit = defineEmits(["deviceInfo"])
|
|
|
+const rowClick = (row)=>{
|
|
|
+ emit("deviceInfo", row)
|
|
|
+}
|
|
|
|
|
|
// 设置表格列或者其他自定义的option
|
|
|
option.value = Object.assign(option.value, {
|
|
|
delBtn: false,
|
|
|
- selection: true,
|
|
|
+ selection: false,
|
|
|
+ search: false,
|
|
|
+ editBtn: false,
|
|
|
+ addBtn: false,
|
|
|
+ viewBtn: false,
|
|
|
+ menu: false,
|
|
|
column: [
|
|
|
{
|
|
|
label: "设备编号",
|
|
|
prop: "deviceNo",
|
|
|
search: true,
|
|
|
+ width: '120',
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -63,6 +70,7 @@ option.value = Object.assign(option.value, {
|
|
|
label: "设备名称",
|
|
|
prop: "deviceName",
|
|
|
search: true,
|
|
|
+ width: '120',
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -76,6 +84,7 @@ option.value = Object.assign(option.value, {
|
|
|
prop: "deviceType",
|
|
|
type: "select",
|
|
|
search: true,
|
|
|
+ width: '100',
|
|
|
dicUrl:
|
|
|
dictDataUtil.request_url +
|
|
|
dictDataUtil.TYPE_CODE.device_type,
|
|
@@ -83,79 +92,30 @@ option.value = Object.assign(option.value, {
|
|
|
label: "dictLabel",
|
|
|
value: "dictValue",
|
|
|
},
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "设备类型不能为空",
|
|
|
- trigger: "trigger",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- label: "设备状态",
|
|
|
- prop: "state",
|
|
|
- type: "select",
|
|
|
- search: true,
|
|
|
- dicUrl:
|
|
|
- dictDataUtil.request_url +
|
|
|
- dictDataUtil.TYPE_CODE.device_status,
|
|
|
- props: {
|
|
|
- label: "dictLabel",
|
|
|
- value: "dictValue",
|
|
|
- },
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "设备状态不能为空",
|
|
|
- trigger: "trigger",
|
|
|
- },
|
|
|
- ],
|
|
|
},
|
|
|
{
|
|
|
label: "负责人",
|
|
|
+ width: '100',
|
|
|
prop: "head",
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "负责人不能为空",
|
|
|
- trigger: "trigger",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- label: "供应厂商",
|
|
|
- prop: "manufacturer",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "所在车间",
|
|
|
- prop: "workshop",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "所在工位",
|
|
|
- prop: "station",
|
|
|
},
|
|
|
{
|
|
|
label: "设备位置",
|
|
|
+ width: '150',
|
|
|
prop: "devicePosition",
|
|
|
},
|
|
|
{
|
|
|
label: "规格",
|
|
|
+ width: '150',
|
|
|
prop: "specifications",
|
|
|
},
|
|
|
{
|
|
|
label: "品牌",
|
|
|
+ width: '150',
|
|
|
prop: "brand",
|
|
|
},
|
|
|
],
|
|
|
});
|
|
|
-watch?.(
|
|
|
- () => props.typeCode,
|
|
|
- (newVal: string) => {
|
|
|
- queryParams.dictCode = newVal;
|
|
|
- formData.dictCode = newVal;
|
|
|
- resetQuery();
|
|
|
- }
|
|
|
-);
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
dataList();
|
|
|
});
|