|
@@ -0,0 +1,161 @@
|
|
|
+<template>
|
|
|
+ <div class="mainContentBox">
|
|
|
+ <avue-crud
|
|
|
+ ref="crudRef"
|
|
|
+ v-model:search="search"
|
|
|
+ v-model="form"
|
|
|
+ :data="data"
|
|
|
+ :option="option"
|
|
|
+ v-model:page="page"
|
|
|
+ @row-save="createRow"
|
|
|
+ @row-update="updateRow"
|
|
|
+ @row-del="deleteRow"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="resetChange"
|
|
|
+ @size-change="dataList"
|
|
|
+ @current-change="dataList"
|
|
|
+ :row-style="rowStyle"
|
|
|
+ :cell-style="cellStyle"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ >
|
|
|
+ <template #menu="{ size, row, index }">
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-info"
|
|
|
+ text
|
|
|
+ @click="preView(row.fileConvertPath)"
|
|
|
+ type="primary"
|
|
|
+ :size="size"
|
|
|
+ >
|
|
|
+ 预览</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ <PDFDrawerView ref="PDFDrawerViewRef"></PDFDrawerView>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import { ref, getCurrentInstance } from "vue";
|
|
|
+import { useCrud } from "@/hooks/userCrud";
|
|
|
+// 传入一个url,后面不带/
|
|
|
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
+ useCrud({
|
|
|
+ src: "/api/v1/base/craftFile",
|
|
|
+ });
|
|
|
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
|
|
|
+ Methords; //增删改查
|
|
|
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
+
|
|
|
+// 设置表格列或者其他自定义的option
|
|
|
+option.value = Object.assign(option.value, {
|
|
|
+ searchEnter: true,
|
|
|
+ delBtn: false,
|
|
|
+ selection: false,
|
|
|
+ editBtn: false,
|
|
|
+ viewBtn: false,
|
|
|
+ addBtn: false,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "工艺文件名称",
|
|
|
+ prop: "craftName",
|
|
|
+ editDisabled: false,
|
|
|
+ addDisplay: false,
|
|
|
+ search: true,
|
|
|
+ type: "input",
|
|
|
+ searchLabelWidth: "120",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工艺文件编号",
|
|
|
+ prop: "craftCode",
|
|
|
+ editDisabled: false,
|
|
|
+ addDisplay: false,
|
|
|
+ search: true,
|
|
|
+ type: "input",
|
|
|
+ searchLabelWidth: "120",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "发布部门",
|
|
|
+ prop: "craftDeptId",
|
|
|
+ editDisabled: false,
|
|
|
+ addDisplay: false,
|
|
|
+ dicData: [
|
|
|
+ {
|
|
|
+ label: "模块电路车间",
|
|
|
+ value: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "微电子车间",
|
|
|
+ value: "2",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ search: true,
|
|
|
+ type: "select",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "数据来源",
|
|
|
+ prop: "addType",
|
|
|
+ editDisabled: false,
|
|
|
+ addDisplay: false,
|
|
|
+ dicData: [
|
|
|
+ {
|
|
|
+ label: "PDM同步",
|
|
|
+ value: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "其他",
|
|
|
+ value: "2",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "发布日期",
|
|
|
+ prop: "publishDate",
|
|
|
+ editDisabled: false,
|
|
|
+ addDisplay: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "上传人",
|
|
|
+ prop: "publisherName",
|
|
|
+ editDisabled: false,
|
|
|
+ addDisplay: false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+});
|
|
|
+
|
|
|
+const PDFDrawerViewRef = ref(null);
|
|
|
+const preView = (path) => {
|
|
|
+ let url = import.meta.env.VITE_PDM_FILE_URL + path;
|
|
|
+ console.log("预览路径", url);
|
|
|
+ PDFDrawerViewRef.value && PDFDrawerViewRef.value.showPdf(url);
|
|
|
+};
|
|
|
+
|
|
|
+const rowStyle = ({ row, column, rowIndex }) => {
|
|
|
+ if (row.warningMsg) {
|
|
|
+ return {
|
|
|
+ backgroundColor: "#f3d2d2",
|
|
|
+ color: "#6c6a6a",
|
|
|
+ };
|
|
|
+ }
|
|
|
+};
|
|
|
+const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
+ if (columnIndex === 10) {
|
|
|
+ if (row.warningMsg) {
|
|
|
+ return {
|
|
|
+ color: "red",
|
|
|
+ fontWeight: "bold",
|
|
|
+ fontSize: "20",
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ color: "#60fc56",
|
|
|
+ fontWeight: "bold",
|
|
|
+ fontSize: "20",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+onMounted(() => {
|
|
|
+ dataList();
|
|
|
+});
|
|
|
+</script>
|