{
// size: file.size,
// };
- var file_id=get_file_from_uuid(file.upload.uuid)
- if(file_id>=0)
- {
- files[file_id]["hash"]=response.return.hash;
- files[file_id]["get_url"]=response.return.get;
- files[file_id]["download_url"]=response.return.download;
- files[file_id]["file_name"]=file.name;
- files[file_id]["file_size"]=file.size;
+ var file_id = get_file_from_uuid(file.upload.uuid);
+ if (file_id >= 0) {
+ files[file_id]["hash"] = response.return.hash;
+ files[file_id]["get_url"] = response.return.get;
+ files[file_id]["download_url"] = response.return.download;
+ files[file_id]["file_name"] = file.name;
+ files[file_id]["file_size"] = file.size;
- files[file_id]["is_upload"]=true;
+ files[file_id]["is_upload"] = true;
- console.log(files)
+ //console.log(files)
}
//files.push(t)
@@ -173,21 +172,30 @@ const initDropzone = () => {
console.error("上传失败:", file.name, errorMessage);
});
this.on("removedfile", (file) => {
- console.log("remove:", file);
+ //console.log("remove:", file);
//files.value = files.value.filter(f => f.name !== file.name)
- remove_file_from_uuie(file.upload.uuid)
- console.log(files)
+ remove_file_from_uuie(file.upload.uuid);
+ //console.log(files)
});
this.on("addedfile", (file) => {
//添加文件
- console.log("addfile", file);
- //控制排序 需要从添加文件开始操作
- var t = {
- uuid: file.upload.uuid,
- is_upload: false,
- };
- files.push(t);
- console.log(files);
+ console.log(get_file_from_uuid(file.upload.uuid));
+
+ //判断文件是否重复
+ if (get_file_from_uuid(file.upload.uuid) <0) {
+ // //控制排序 需要从添加文件开始操作
+ var t = {
+ uuid: file.upload.uuid,
+ is_upload: false,
+ };
+ files.push(t);
+ console.log(files);
+ return;
+ }
+
+ //this.removeFile(file)
+
+
});
this.on("sending", function (file, xhr, formData) {
// 获取表单值并添加到 FormData
@@ -229,6 +237,10 @@ const initDropzone = () => {
// }
// }
+function return_files() {
+ return files;
+}
+
// 组件挂载时初始化
onMounted(() => {
initDropzone();
@@ -242,6 +254,10 @@ onUnmounted(() => {
dropzoneInstance.destroy();
}
});
+
+defineExpose({
+ return_files,
+});
@@ -310,15 +326,8 @@ onUnmounted(() => {
+ {{ files.length }}/{{ maxFiles }}
-
diff --git a/frontent/ops_vue_js/src/views/purchase/addorder.vue b/frontent/ops_vue_js/src/views/purchase/addorder.vue
index b7dba01..3b8e2f9 100644
--- a/frontent/ops_vue_js/src/views/purchase/addorder.vue
+++ b/frontent/ops_vue_js/src/views/purchase/addorder.vue
@@ -2,6 +2,8 @@
import { onMounted, watch, ref, reactive } from "vue";
import { useI18n } from "vue-i18n";
+import MyOffcanvas from "@/components/MyOffcanvas.vue";
+
import tagadder from "@/components/tagadder.vue";
import dateTimePicker from "@/components/dateTimePicker.vue";
@@ -18,7 +20,12 @@ import "tom-select/dist/css/tom-select.css";
const textarea_maxlen = 256;
const textarea_len = ref(0);
-const textarea_val = ref();
+
+const title_input_dom = ref();
+
+const photos_hash = ref();
+
+const mos = ref();
const { t, locale } = useI18n();
@@ -44,7 +51,7 @@ const order_status = reactive({
1: t("order_status.pending_order"),
2: t("order_status.order_placed"),
3: t("order_status.in_transit"),
- 4: t("order_status.completed"),
+ 4: t("order_status.compvared"),
5: t("order_status.refund_requested"),
6: t("order_status.returning"),
7: t("order_status.refunded"),
@@ -55,7 +62,7 @@ function update_order_status() {
order_status["1"] = t("order_status.pending_order");
order_status["2"] = t("order_status.order_placed");
order_status["3"] = t("order_status.in_transit");
- order_status["4"] = t("order_status.completed");
+ order_status["4"] = t("order_status.compvared");
order_status["5"] = t("order_status.refund_requested");
order_status["6"] = t("order_status.returning");
order_status["7"] = t("order_status.refunded");
@@ -86,19 +93,50 @@ function add_cost() {
//console.log(t);
}
+const submit_sheet = reactive({
+ title: "",
+ remark: "",
+ photos: [],
+ link: "",
+ part_name: "",
+ styles: [],
+ costs: [],
+ update_time: "",
+ tracking_number: "",
+ order_status: "1",
+});
+
function submit_order() {
- console.log("up");
+ if (submit_sheet.title == "") {
+ title_input_dom.value.classList.add("is-invalid");
+ title_input_dom.value.addEventListener("input", function () {
+ if (this.value.trim() !== "") {
+ this.classList.remove("is-invalid");
+ //this.removeEventListener('input');
+ }
+ });
+
+ mos.value?.showAlert("danger", t("purchase_addorder.title"), 1000);
+ return;
+ }
+ //载入图片哈希列表
+ var photos = photos_hash.value.return_files();
+ for (var i = 0; i < photos.length; i++) {
+ submit_sheet.photos.push(photos[i].hash);
+ }
+
+ console.log(submit_sheet);
}
function textarea_change(a) {
//console.log(textarea_val.value.length)
- textarea_len.value = textarea_val.value.length;
+ textarea_len.value = submit_sheet.remark.length;
// if(a.inputType=="insertText"){
// textarea_len.value+=1;
// }
- // if(a.inputType=="deleteContentBackward"){
+ // if(a.inputType=="devareContentBackward"){
// textarea_len.value-=1;
// }
}
@@ -132,7 +170,7 @@ watch(
cost_sheet.cost = parseFloat(fixed);
}
}
- }
+ },
);
@@ -166,6 +204,8 @@ watch(
class="form-control"
name="example-text-input"
:placeholder="t('purchase_addorder.title')"
+ v-model="submit_sheet.title"
+ ref="title_input_dom"
/>
@@ -182,12 +222,13 @@ watch(
:placeholder="t('purchase_addorder.remarks_text')"
:maxlength="textarea_maxlen"
@input="textarea_change"
- v-model="textarea_val"
+ v-model="submit_sheet.remark"
>
@@ -202,13 +243,13 @@ watch(
-
+ v-model="submit_sheet.link"
+ >
@@ -289,7 +331,7 @@ watch(
@@ -382,8 +424,8 @@ watch(
+
+