This commit is contained in:
shijing 2025-12-08 13:43:39 +08:00
commit b8121dbb45
5 changed files with 19 additions and 60 deletions

View File

@ -24,7 +24,7 @@ const emit = defineEmits(["update:modelValue", "update:obj"]);
const props = defineProps({
xtype: { type: String, default: "path" }, // path id
modelValue: { type: [Array, String], default: "pending" },
modelValue: { type: [Array, String], default: ()=>{[]} },
obj: { type: Object, default: () => ({}) },
accept: { type: String, default: '' },
countMax: { type: Number, default: 1 },
@ -44,7 +44,8 @@ const action = `${config.baseUrl}/file/`
const inited = ref(false)
onMounted(() => {
checkPropsUntilReady()
setTimeout(initFileList, 1000)
// checkPropsUntilReady()
})
const checkPropsUntilReady = () => {

View File

@ -26,6 +26,7 @@ import api from './utils/api'
import check from './utils/check'
import config from './utils/config.js'
import { authDirective } from '@/utils/directives.js'
import xtUpload from "@/components/xtUpload.vue"
export function createApp() {
const app = createSSRApp(App)
@ -35,6 +36,7 @@ export function createApp() {
app.config.globalProperties.$api = api
app.config.globalProperties.$check = check
app.config.globalProperties.$config = config
app.component('xtUpload', xtUpload);
return {
app
}

View File

@ -8,7 +8,7 @@
<uni-easyinput v-model="form.title" placeholder="请输入送审稿件标题" :disabled="mode=='show'"/>
</uni-forms-item>
<uni-forms-item label="文件内容" required>
<xtUpload v-model="form.file" v-model:obj="form.file_" xtype="id" :disabled="mode=='show'"></xtUpload>
<xtUpload v-model="form.pfile" xtype="path" :disabled="mode=='show'"></xtUpload>
</uni-forms-item>
<uni-forms-item label="所有撰稿人" required>
<uni-easyinput v-model="form.participants" placeholder="请输入所有撰稿人" :disabled="mode=='show'"/>

View File

@ -26,7 +26,7 @@
<uni-easyinput v-model="form.note" :disabled="mode=='show'"/>
</uni-forms-item>
<uni-forms-item label="文件内容" required>
<xtUpload v-model="form.file" v-model:obj="form.file_" xtype="id" :disabled="mode=='show'"></xtUpload>
<xtUpload v-model="form.file" xtype="path" :disabled="mode=='show'"></xtUpload>
</uni-forms-item>
<uni-forms-item label="用印份数" required>
<uni-number-box v-model="form.file_count" :disabled="mode=='show'"></uni-number-box>
@ -110,51 +110,9 @@ import xtUpload from "@/components/xtUpload.vue"
maskClick(e){
console.log('maskClick事件:', e);
},
fileSelect(e){
console.log('fileSelect',e);
this.uploadFile(e)
},
fileSuccess(e){
console.log('fileSuccess',e)
},
sealTypeChange(){
console.log('this.form.seal',this.form.seal)
},
uploadFile(e) {
if (e.tempFiles.length === 0) {
uni.showToast({
title: '请先选择文件',
icon: 'none',
});
return;
}
//
const file = e.tempFiles[0];
console.log(this.$api.sealCreate)
let fieldName = 'file';
let filePath = file.url;
//
uni.uploadFile({
url: `${config.baseUrl}/file/`,
filePath: filePath,
name: fieldName,
formData: {},
header: this.header,
success: (uploadRes) => {
console.log('uploadRes',uploadRes)
//
const data = JSON.parse(uploadRes.data);
console.log('上传返回数据:', data);
if(data){
this.form.file = data.path;
uni.showToast({
title: '上传成功',
icon: 'success',
});
}
},
});
},
//
async submit_b_func(id){
let that = this;

View File

@ -15,7 +15,7 @@ import API from '@/utils/api';
const props = defineProps({
workflow_key: {type: String, default: null, required: false},
ticket_: {type: [Object, String], default: "pending", required: false},
ticket_: {type: Object, default: null, required: false},
t_id: {type: String, default: null, required: true},
title: {type: String, default: null, required: false},
submit_b_func: {type: Function, default: null, required: false},
@ -26,20 +26,18 @@ const workflow = ref(null);
const transitions = ref([]);
const currentUser = ref(uni.getStorageSync("userInfo").id);
onMounted(async () => {
checkPropsUntilReady()
setTimeout(()=>{init()}, 1000)
// await init();
// watch(
// () => props.ticket_,
// async (newVal) => {
// if (newVal && Object.keys(newVal).length > 0) {
// await init();
// }
// },
// { deep: true }
// )
})
const inited = ref(false)
const checkPropsUntilReady = () => {
if (inited.value) return
if (props.ticket_ !== "pending") {
init()
inited.value = true
return
}
// 200ms
setTimeout(checkPropsUntilReady, 200)
}
const suggestion = ref("")
const isOwn = ref(false)
const ticketId = ref(null)