|
@@ -25,9 +25,10 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
- <el-form-item label="账期" required>
|
|
|
|
|
|
+ <el-form-item label="账期">
|
|
<el-select v-model="form.currentMonth" style="width: 100%" @change="changeMonthHandle">
|
|
<el-select v-model="form.currentMonth" style="width: 100%" @change="changeMonthHandle">
|
|
- <el-option v-for="item in months" :key="item.id" :label="`${item.year}-${item.month}`" :value="item.id" />
|
|
|
|
|
|
+ <el-option v-for="item in months" :key="item.id" :label="`${item.year}-${item.month}`"
|
|
|
|
+ :value="item.id" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -49,13 +50,17 @@
|
|
<el-col v-if="files.length === 0">
|
|
<el-col v-if="files.length === 0">
|
|
<el-empty description="没有数据" />
|
|
<el-empty description="没有数据" />
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col v-for="(o, index) in files" :key="o.UUID" :span="8" style="margin-bottom: 10px; position: relative">
|
|
|
|
|
|
+ <el-col v-for="(o, index) in files" :key="o.UUID" :span="8"
|
|
|
|
+ style="margin-bottom: 10px; position: relative">
|
|
<el-card :body-style="{ padding: '0px' }">
|
|
<el-card :body-style="{ padding: '0px' }">
|
|
- <img :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px" />
|
|
|
|
|
|
+ <!-- <img :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px" @click="handleImageView(o.fileUrl)" /> -->
|
|
|
|
+ <el-image :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px"
|
|
|
|
+ :preview-teleported="true" fit="contain" :preview-src-list="srcList"
|
|
|
|
+ @click="vbs(baseUrl + o.fileUrl)" />
|
|
<div style="padding: 14px">
|
|
<div style="padding: 14px">
|
|
<!-- <span>好吃的汉堡</span> -->
|
|
<!-- <span>好吃的汉堡</span> -->
|
|
<div class="bottom clearfix">
|
|
<div class="bottom clearfix">
|
|
- <el-form-item label="票据类型">
|
|
|
|
|
|
+ <el-form-item label="票据类型" prop="typeId">
|
|
<el-select v-model="o.typeId">
|
|
<el-select v-model="o.typeId">
|
|
<el-option v-for="i in ticket_type" :key="i.value" :value="i.value" :label="i.label" />
|
|
<el-option v-for="i in ticket_type" :key="i.value" :value="i.value" :label="i.label" />
|
|
</el-select>
|
|
</el-select>
|
|
@@ -74,181 +79,203 @@
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
-import { reactive } from "vue";
|
|
|
|
-import {
|
|
|
|
- listFiles,
|
|
|
|
- saveTickets,
|
|
|
|
-} from "@/api/business/production/archiveTicket";
|
|
|
|
-import { uploadFile } from "@/api/tool/file";
|
|
|
|
-const { proxy } = getCurrentInstance();
|
|
|
|
|
|
+ import { reactive } from "vue";
|
|
|
|
+ import {
|
|
|
|
+ listFiles,
|
|
|
|
+ saveTickets,
|
|
|
|
+ } from "@/api/business/production/archiveTicket";
|
|
|
|
+ import { uploadFile } from "@/api/tool/file";
|
|
|
|
+ const { proxy } = getCurrentInstance();
|
|
|
|
+ const { ticket_type } = proxy.useDict("ticket_type");
|
|
|
|
|
|
-const { ticket_type } = proxy.useDict("ticket_type");
|
|
|
|
-
|
|
|
|
-const props = defineProps({
|
|
|
|
- getList: {
|
|
|
|
- type: Function,
|
|
|
|
- default: () => { },
|
|
|
|
- },
|
|
|
|
- width: {
|
|
|
|
- type: String,
|
|
|
|
- default: "800px",
|
|
|
|
- },
|
|
|
|
-});
|
|
|
|
-const { getList, width } = toRefs(props);
|
|
|
|
-
|
|
|
|
-// import api from '@/api/biz/fileStorage'
|
|
|
|
-const data = reactive({
|
|
|
|
- visible: false,
|
|
|
|
- list: [],
|
|
|
|
- total: 0,
|
|
|
|
- query: {
|
|
|
|
- name: "",
|
|
|
|
|
|
+ const formRules = ref({
|
|
|
|
+ typeId: [
|
|
|
|
+ { required: true, message: '请选择票据类型', trigger: 'change' }
|
|
|
|
+ ]
|
|
|
|
+ });
|
|
|
|
+ const props = defineProps({
|
|
|
|
+ getList: {
|
|
|
|
+ type: Function,
|
|
|
|
+ default: () => { },
|
|
|
|
+ },
|
|
|
|
+ width: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: "800px",
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ const { getList, width } = toRefs(props);
|
|
|
|
+ const srcList = ref([
|
|
|
|
+ "https://elevator4s-oss.oss-cn-hangzhou.aliyuncs.com/2021/05/07/b632db6a837f46e0950670277fa9e5e5multipartFile.png"
|
|
|
|
+ ]);
|
|
|
|
+ // import api from '@/api/biz/fileStorage'
|
|
|
|
+ const data = reactive({
|
|
|
|
+ visible: false,
|
|
|
|
+ list: [],
|
|
total: 0,
|
|
total: 0,
|
|
- pageSize: 15,
|
|
|
|
- pageNum: 1,
|
|
|
|
- },
|
|
|
|
- files: [],
|
|
|
|
- months: [],
|
|
|
|
- form: {},
|
|
|
|
- selection: [],
|
|
|
|
- baseUrl: import.meta.env.VITE_APP_BASE_API,
|
|
|
|
- options: {},
|
|
|
|
-});
|
|
|
|
-const {
|
|
|
|
- visible,
|
|
|
|
- list,
|
|
|
|
- query,
|
|
|
|
- selection,
|
|
|
|
- baseUrl,
|
|
|
|
- options,
|
|
|
|
- total,
|
|
|
|
- files,
|
|
|
|
- form,
|
|
|
|
- months,
|
|
|
|
-} = toRefs(data);
|
|
|
|
|
|
+ query: {
|
|
|
|
+ name: "",
|
|
|
|
+ total: 0,
|
|
|
|
+ pageSize: 15,
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ },
|
|
|
|
+ files: [],
|
|
|
|
+ months: [],
|
|
|
|
+ form: {},
|
|
|
|
+ selection: [],
|
|
|
|
+ baseUrl: import.meta.env.VITE_APP_BASE_API,
|
|
|
|
+ options: {},
|
|
|
|
+ });
|
|
|
|
+ const {
|
|
|
|
+ visible,
|
|
|
|
+ list,
|
|
|
|
+ query,
|
|
|
|
+ selection,
|
|
|
|
+ baseUrl,
|
|
|
|
+ options,
|
|
|
|
+ total,
|
|
|
|
+ files,
|
|
|
|
+ form,
|
|
|
|
+ months,
|
|
|
|
+ } = toRefs(data);
|
|
|
|
+
|
|
|
|
+ function open(arg) {
|
|
|
|
+ visible.value = true;
|
|
|
|
+ form.value = arg;
|
|
|
|
+ form.value.currentMonth = `${form.value.year}-${form.value.month}`;
|
|
|
|
+ options.value = arg;
|
|
|
|
+ loadData();
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 对话框关闭 事件
|
|
|
|
+ */
|
|
|
|
+ function close() {
|
|
|
|
+ visible.value = false;
|
|
|
|
+ }
|
|
|
|
+ function handleImageView(fileUrl) {
|
|
|
|
+ window.open(`${baseUrl.value}${fileUrl}`);
|
|
|
|
+ // currentFileList.value = [`${baseUrl.value}${fileUrl}`];
|
|
|
|
+ // showViewer.value = true;
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 加载数据
|
|
|
|
+ */
|
|
|
|
+ const loadData = async () => {
|
|
|
|
+ const res = await listFiles(form.value);
|
|
|
|
+ files.value = res.data.files;
|
|
|
|
+ months.value = res.data.months;
|
|
|
|
+ form.value.isFinished = res.data.finished.isFinished;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * 列表checkbox列选择 事件
|
|
|
|
+ */
|
|
|
|
+ function handleSelectionChange(selection) {
|
|
|
|
+ selection.value = selection;
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 搜索 事件
|
|
|
|
+ */
|
|
|
|
+ function handleSearch() {
|
|
|
|
+ loadData();
|
|
|
|
+ }
|
|
|
|
+ function openFile(attach) {
|
|
|
|
+ window.open(`${baseUrl.value}/${attach.fileUrl}`, attach.fileName);
|
|
|
|
+ }
|
|
|
|
|
|
-function open(arg) {
|
|
|
|
- visible.value = true;
|
|
|
|
- form.value = arg;
|
|
|
|
- form.value.currentMonth = `${form.value.year}-${form.value.month}`;
|
|
|
|
- options.value = arg;
|
|
|
|
- loadData();
|
|
|
|
-}
|
|
|
|
-/**
|
|
|
|
- * 对话框关闭 事件
|
|
|
|
- */
|
|
|
|
-function close() {
|
|
|
|
- visible.value = false;
|
|
|
|
-}
|
|
|
|
-/**
|
|
|
|
- * 加载数据
|
|
|
|
- */
|
|
|
|
-const loadData = async () => {
|
|
|
|
- const res = await listFiles(form.value);
|
|
|
|
- files.value = res.data.files;
|
|
|
|
- months.value = res.data.months;
|
|
|
|
- form.value.isFinished = res.data.finished.isFinished;
|
|
|
|
-};
|
|
|
|
-/**
|
|
|
|
- * 列表checkbox列选择 事件
|
|
|
|
- */
|
|
|
|
-function handleSelectionChange(selection) {
|
|
|
|
- selection.value = selection;
|
|
|
|
-}
|
|
|
|
-/**
|
|
|
|
- * 搜索 事件
|
|
|
|
- */
|
|
|
|
-function handleSearch() {
|
|
|
|
- loadData();
|
|
|
|
-}
|
|
|
|
-function openFile(attach) {
|
|
|
|
- window.open(`${baseUrl.value}/${attach.fileUrl}`, attach.fileName);
|
|
|
|
-}
|
|
|
|
|
|
+ function upload(param) {
|
|
|
|
+ const formData = new FormData();
|
|
|
|
+ formData.append("file", param.file);
|
|
|
|
+ uploadFile(formData).then((res) => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ const file = {};
|
|
|
|
+ file.fileName = res.newFileName;
|
|
|
|
+ file.url = res.url;
|
|
|
|
+ file.originalFileName = res.originalFilename;
|
|
|
|
+ file.fileUrl = res.fileName;
|
|
|
|
+ files.value.push(file);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
-function upload(param) {
|
|
|
|
- const formData = new FormData();
|
|
|
|
- formData.append("file", param.file);
|
|
|
|
- uploadFile(formData).then((res) => {
|
|
|
|
- if (res.code === 200) {
|
|
|
|
- const file = {};
|
|
|
|
- file.fileName = res.newFileName;
|
|
|
|
- file.url = res.url;
|
|
|
|
- file.originalFileName = res.originalFilename;
|
|
|
|
- file.fileUrl = res.fileName;
|
|
|
|
- files.value.push(file);
|
|
|
|
|
|
+ function changeMonthHandle(item) {
|
|
|
|
+ const index = months.value.findIndex((v) => v.id === item);
|
|
|
|
+ if (index >= 0) {
|
|
|
|
+ const moment =
|
|
|
|
+ months.value.length > 0
|
|
|
|
+ ? proxy.moment(
|
|
|
|
+ `${months.value[index].year}-${months.value[index].month}`,
|
|
|
|
+ "YYYY-MM"
|
|
|
|
+ )
|
|
|
|
+ : null;
|
|
|
|
+ // console.log(months.value)
|
|
|
|
+ form.value.year =
|
|
|
|
+ moment != null ? proxy.moment(moment).format("YYYY") : null;
|
|
|
|
+ form.value.month =
|
|
|
|
+ moment != null ? proxy.moment(moment).format("MM") : null;
|
|
|
|
+ } else {
|
|
|
|
+ form.value.checkoutId = months.value.length > 0 ? months.value[0].id : 0;
|
|
|
|
+ const moment =
|
|
|
|
+ months.value.length > 0
|
|
|
|
+ ? proxy.moment(
|
|
|
|
+ `${months.value[0].year}-${months.value[0].month}`,
|
|
|
|
+ "YYYY-MM"
|
|
|
|
+ )
|
|
|
|
+ : null;
|
|
|
|
+ // console.log(months.value)
|
|
|
|
+ form.value.year =
|
|
|
|
+ moment != null ? proxy.moment(moment).format("YYYY") : null;
|
|
|
|
+ form.value.month =
|
|
|
|
+ moment != null ? proxy.moment(moment).format("MM") : null;
|
|
}
|
|
}
|
|
- });
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function changeMonthHandle(item) {
|
|
|
|
- const index = months.value.findIndex((v) => v.id === item);
|
|
|
|
- if (index >= 0) {
|
|
|
|
- const moment =
|
|
|
|
- months.value.length > 0
|
|
|
|
- ? proxy.moment(
|
|
|
|
- `${months.value[index].year}-${months.value[index].month}`,
|
|
|
|
- "YYYY-MM"
|
|
|
|
- )
|
|
|
|
- : null;
|
|
|
|
- // console.log(months.value)
|
|
|
|
- form.value.year =
|
|
|
|
- moment != null ? proxy.moment(moment).format("YYYY") : null;
|
|
|
|
- form.value.month =
|
|
|
|
- moment != null ? proxy.moment(moment).format("MM") : null;
|
|
|
|
- } else {
|
|
|
|
- form.value.checkoutId = months.value.length > 0 ? months.value[0].id : 0;
|
|
|
|
- const moment =
|
|
|
|
- months.value.length > 0
|
|
|
|
- ? proxy.moment(
|
|
|
|
- `${months.value[0].year}-${months.value[0].month}`,
|
|
|
|
- "YYYY-MM"
|
|
|
|
- )
|
|
|
|
- : null;
|
|
|
|
- // console.log(months.value)
|
|
|
|
- form.value.year =
|
|
|
|
- moment != null ? proxy.moment(moment).format("YYYY") : null;
|
|
|
|
- form.value.month =
|
|
|
|
- moment != null ? proxy.moment(moment).format("MM") : null;
|
|
|
|
|
|
+ loadData();
|
|
|
|
+ }
|
|
|
|
+ function vbs(val) {
|
|
|
|
+ srcList.value = []
|
|
|
|
+ srcList.value.push(val)
|
|
}
|
|
}
|
|
- loadData();
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
+ function handleBeforeUpload(file) {
|
|
|
|
|
|
-function handleBeforeUpload(file) {
|
|
|
|
|
|
+ if (file.type !== "image/bmp" && file.type !== "image/gif" && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/png' && file.type != 'image/tiff') {
|
|
|
|
+ proxy.$modal.msgError("请选择图片文件");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
|
|
- if (file.type !== "image/bmp" && file.type !== "image/gif" && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/png' && file.type != 'image/tiff') {
|
|
|
|
- proxy.$modal.msgError("请选择图片文件");
|
|
|
|
- return false;
|
|
|
|
|
|
+ function deleteHandle(index) {
|
|
|
|
+ proxy.$modal
|
|
|
|
+ .confirm("确定删除?")
|
|
|
|
+ .then(() => {
|
|
|
|
+ files.value.splice(index, 1);
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ proxy.$modal.msg("已取消删除");
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
-}
|
|
|
|
|
|
|
|
-function deleteHandle(index) {
|
|
|
|
- proxy.$modal
|
|
|
|
- .confirm("确定删除?")
|
|
|
|
- .then(() => {
|
|
|
|
- files.value.splice(index, 1);
|
|
|
|
- })
|
|
|
|
- .catch(() => {
|
|
|
|
- proxy.$modal.msg("已取消删除");
|
|
|
|
|
|
+ function handleSave() {
|
|
|
|
+ console.log(1111, files.value);
|
|
|
|
+ for (let i = 0; i < files.value.length; i++) {
|
|
|
|
+ const item = files.value[i];
|
|
|
|
+ if (item.typeId == null) {
|
|
|
|
+ proxy.$modal.msgError("票据类型不能为空");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const file = {
|
|
|
|
+ companyId: form.value.companyId,
|
|
|
|
+ year: form.value.year,
|
|
|
|
+ month: form.value.month,
|
|
|
|
+ isFinished: form.value.isFinished,
|
|
|
|
+ files: files.value,
|
|
|
|
+ };
|
|
|
|
+ saveTickets(file).then((res) => {
|
|
|
|
+ getList.value();
|
|
|
|
+ close();
|
|
});
|
|
});
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
|
|
-function handleSave() {
|
|
|
|
- const file = {
|
|
|
|
- companyId: form.value.companyId,
|
|
|
|
- year: form.value.year,
|
|
|
|
- month: form.value.month,
|
|
|
|
- isFinished: form.value.isFinished,
|
|
|
|
- files: files.value,
|
|
|
|
- };
|
|
|
|
- saveTickets(file).then((res) => {
|
|
|
|
- getList.value();
|
|
|
|
- close();
|
|
|
|
|
|
+ defineExpose({
|
|
|
|
+ open,
|
|
});
|
|
});
|
|
-}
|
|
|
|
-
|
|
|
|
-defineExpose({
|
|
|
|
- open,
|
|
|
|
-});
|
|
|
|
-</script>
|
|
|
|
|
|
+</script>
|