work.uts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // #ifdef APP-ANDROID
  2. import {selectTableData, insertTableData, updateTableData, selectJoinTableData, selectRecordData} from '@/utils/sqlite'
  3. // #endif
  4. export type Download = {
  5. pdid : number,
  6. workorder : string,
  7. invname : string,
  8. productno : string,
  9. graphid : string,
  10. cardno : string,
  11. processno : string,
  12. ver : string,
  13. updatetime : string,
  14. progress : string,
  15. status : number
  16. }
  17. export type Record = {
  18. sxid : number,
  19. senum : number,
  20. photoitem : string,
  21. productno : string,
  22. part : string,
  23. descb : string,
  24. date : string,
  25. partno : string,
  26. num : number,
  27. status : number,
  28. urlspl : string
  29. imgname : string[],
  30. urlpdt : string[]
  31. }
  32. export type TaskProcess = {
  33. id : number
  34. name : string
  35. num : number
  36. step : number
  37. status : number
  38. }
  39. export type JoinRecord = {
  40. sxid : number,
  41. senum : number,
  42. photoitem : string,
  43. productno : string,
  44. part : string,
  45. descb : string,
  46. date : string,
  47. partno : string,
  48. num : number,
  49. status : string,
  50. urlspl : string
  51. imgname : string,
  52. urlpdt : string
  53. workorder: string
  54. invname: string
  55. }
  56. export type RecordCalculate = {
  57. photoitem: string,
  58. pid: number,
  59. step: number,
  60. total: number,
  61. status: number
  62. }
  63. export function offlineData(data:UTSJSONObject):Promise<UTSJSONObject> {
  64. return new Promise((resolve, reject) => {
  65. let result = JSON.parseObject(JSON.stringify(data)) as UTSJSONObject
  66. resolve(result)
  67. });
  68. }
  69. export const statusDict = {'1':'未执行','2':'执行中','3':'已执行','4':'执行错误','5':'已取消'}
  70. export const recordStatusDict = {'1':'未拍照','2':'拍照中','3':'拍照完成','4':'检验不清晰','5':'拍照取消'}
  71. export async function getList(tableName:string, condition?:string|null, value?:string|null,condition2?:string|null, value2?:string|null, initData?:UTSJSONObject|null):Promise<UTSJSONObject> {
  72. // #ifdef APP-ANDROID
  73. const result = await selectTableData(tableName, condition, value, condition2, value2);
  74. console.log(result);
  75. return result;
  76. // #endif
  77. // #ifdef H5
  78. return offlineData(initData)
  79. // #endif
  80. }
  81. export async function getJoinList(dbTable:string, joinTable:string, labels:string, joinCondition:string, lname?:string, lvalue?:string, others?:string):Promise<UTSJSONObject> {
  82. // #ifdef APP-ANDROID
  83. const result = await selectJoinTableData(dbTable, joinTable, labels, joinCondition, lname, lvalue, others);
  84. console.log(result);
  85. return result;
  86. // #endif
  87. }
  88. export async function updateData(tableName: string, data: string, lname?: string, lvalue?: string):Promise<UTSJSONObject>{
  89. // #ifdef APP-ANDROID
  90. const result = await updateTableData(tableName, data, lname, lvalue);
  91. console.log(result);
  92. return result;
  93. // #endif
  94. }
  95. export async function getRecordCalculate(tableName: string, value?:string|null, initData?:UTSJSONObject|null):Promise<UTSJSONObject> {
  96. // #ifdef APP-ANDROID
  97. const result = await selectRecordData(tableName, value);
  98. console.log(result);
  99. return result;
  100. // #endif
  101. // #ifdef H5
  102. return offlineData(initData)
  103. // #endif
  104. }