|
@@ -32,6 +32,7 @@ export type MediaRecordData = {
|
|
|
part ?: string;
|
|
|
partno ?: string;
|
|
|
pk : string;
|
|
|
+ exampleid ?: string;
|
|
|
descb ?: string;
|
|
|
num ?: number;
|
|
|
urlspl ?: string;
|
|
@@ -41,6 +42,11 @@ export type MediaRecordData = {
|
|
|
createuser ?: string;
|
|
|
updatetime ?: string;
|
|
|
updateuser ?: string;
|
|
|
+ photoFiles_example ?: PhotoFilesExample[];
|
|
|
+}
|
|
|
+
|
|
|
+export type PhotoFilesExample = {
|
|
|
+ _id ?: string,
|
|
|
}
|
|
|
|
|
|
export const downloadDataFromAPI = async (productCode: string, callback ?: () => void) : Promise<boolean> => {
|
|
@@ -133,6 +139,7 @@ export const downloadDataFromAPI = async (productCode: string, callback ?: () =>
|
|
|
if (recordList != null && recordList.length > 0) {
|
|
|
for(var i =0; i< recordList.length; i++) {
|
|
|
const record: MediaRecordData = recordList[i] as MediaRecordData;
|
|
|
+ console.log("==================>", record)
|
|
|
|
|
|
// 获取各个字段的值
|
|
|
const senum = record.senum;
|
|
@@ -149,9 +156,22 @@ export const downloadDataFromAPI = async (productCode: string, callback ?: () =>
|
|
|
const createuser = record.createuser;
|
|
|
const updatetime = record.updatetime;
|
|
|
const updateuser = record.updateuser;
|
|
|
+ const photoFiles_example = record.photoFiles_example;
|
|
|
+ console.log(photoFiles_example);
|
|
|
+ let exampleList = record?.['photoFiles_example'] as UTSJSONObject[] ?? Array<UTSJSONObject>();
|
|
|
+ var exampleidArr = [] as string[]
|
|
|
+ if(exampleList!=null && exampleList.length > 0) {
|
|
|
+ for(var j =0; j < exampleList.length; j++) {
|
|
|
+ const example: PhotoFilesExample = exampleList[j] as PhotoFilesExample;
|
|
|
+ if(example._id != null) {
|
|
|
+ exampleidArr.push(example._id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const exampleid = exampleidArr.join(",");
|
|
|
|
|
|
// 使用三目运算符判断,当值为null时直接插入null,否则用单引号括起来
|
|
|
- var values = `${senum === null ? '1' : `'${senum}'`}, ${photoitem === null ? 'null' : `'${photoitem}'`}, ${data?.['productcode'] === null ? 'null' : `'${data?.['productcode']}'`},${part === null ? 'null' : `'${part}'`},${partno === null ? 'null' : `'${partno}'`},${pk === null ? 'null' : `'${pk}'`},${descb === null ? 'null' : `'${descb}'`},${num === null ? 0 : num},1,'', ${urlspl === null ? 'null' : `'${urlspl}'`},${imgname === null ? 'null' : `'${imgname}'`},${urlpdt === null ? 'null' : `'${urlpdt}'`}, ${createtime === null ? 'null' : `'${createtime}'`}, ${createuser === null ? 'null' : `'${createuser}'`}, ${updatetime === null ? 'null' : `'${updatetime}'`}, ${updateuser === null ? 'null' : `'${updateuser}'`}, ${lastId === null ? 0 : lastId}`;
|
|
|
+ var values = `${senum === null ? '1' : `'${senum}'`}, ${photoitem === null ? 'null' : `'${photoitem}'`}, ${data?.['productcode'] === null ? 'null' : `'${data?.['productcode']}'`},${part === null ? 'null' : `'${part}'`},${partno === null ? 'null' : `'${partno}'`},${pk === null ? 'null' : `'${pk}'`},${exampleid === null ? 'null' : `'${exampleid}'`},${descb === null ? 'null' : `'${descb}'`},${num === null ? 0 : num},1,'', ${urlspl === null ? 'null' : `'${urlspl}'`},${imgname === null ? 'null' : `'${imgname}'`},${urlpdt === null ? 'null' : `'${urlpdt}'`}, ${createtime === null ? 'null' : `'${createtime}'`}, ${createuser === null ? 'null' : `'${createuser}'`}, ${updatetime === null ? 'null' : `'${updatetime}'`}, ${updateuser === null ? 'null' : `'${updateuser}'`}, ${lastId === null ? 0 : lastId}`;
|
|
|
saveMediaRecord(values);
|
|
|
}
|
|
|
// 延迟显示完成提示,确保所有数据保存完成
|