You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
8.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <div class="element tw-mt-[16px]">
  4. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[190px_215px_auto] xl:tw-grid-cols-[190px_215px_auto] tw-gap-[10px]">
  5. <label class="tw-font-normal "><span>{{ $t('Mobilization date') }}
  6. <span class="required">*</span></span></label>
  7. <selectDate @selected="selectDates = $event"></selectDate>
  8. </div>
  9. </div>
  10. <div class="element tw-mt-[16px]">
  11. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[190px_215px_auto] xl:tw-grid-cols-[190px_215px_auto] tw-gap-[10px]">
  12. <label class="tw-font-normal "><span>{{ $t('Mobilization time') }}
  13. <span class="required">*</span></span></label>
  14. <elementTimePicker></elementTimePicker>
  15. </div>
  16. </div>
  17. <div class="element tw-mt-[16px]">
  18. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[190px_215px_auto] xl:tw-grid-cols-[190px_215px_auto] tw-gap-[10px]">
  19. <label class="tw-font-normal tw-mb-[20px] md:tw-mb-0"><span>{{ $t('Exit date') }}
  20. <span class="required">*</span></span></label>
  21. <selectDate @selected="selectDates = $event"></selectDate>
  22. </div>
  23. </div>
  24. <div class="element tw-mt-[16px]">
  25. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[190px_215px_auto] xl:tw-grid-cols-[190px_215px_auto] tw-gap-[10px]">
  26. <label class="tw-font-normal "><span>{{ $t('Exit time') }}
  27. <span class="required">*</span></span></label>
  28. <elementTimePicker></elementTimePicker>
  29. </div>
  30. </div>
  31. <div class="element tw-mt-[16px]">
  32. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[190px_215px_auto] xl:tw-grid-cols-[190px_215px_auto] tw-gap-[10px]">
  33. <div class="tw-flex tw-items-center">
  34. <label class="tw-font-normal ">
  35. <span>{{ $t("Booth No")}}</span><span class="required">*</span>
  36. </label>
  37. </div>
  38. <ElementInputNew
  39. :input="{
  40. id: 'BoothNo',
  41. required: true,
  42. type: 'text',
  43. placeholder: '例:32332',
  44. }"
  45. :validation="validation.booth_no"
  46. @change="formData.booth_no = $event"
  47. ></ElementInputNew>
  48. </div>
  49. </div>
  50. <div class="element tw-mt-[16px]">
  51. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[190px_215px_auto] xl:tw-grid-cols-[190px_215px_auto] tw-gap-[10px]">
  52. <div class="tw-flex tw-items-center">
  53. <label class="tw-font-normal ">
  54. <span>{{ $t("Site contact person")}}</span><span class="required">*</span>
  55. </label>
  56. </div>
  57. <ElementInputNew
  58. :input="{
  59. id: 'SiteContactPerson',
  60. required: true,
  61. type: 'text',
  62. placeholder: '例:張曉明',
  63. }"
  64. :validation="validation.site_contact_person"
  65. @change="formData.site_contact_person = $event"
  66. >
  67. </ElementInputNew>
  68. </div>
  69. </div>
  70. <div class="element tw-mt-[16px]">
  71. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[190px_215px_auto] xl:tw-grid-cols-[190px_215px_auto] tw-gap-[10px]">
  72. <div class="tw-flex tw-items-center">
  73. <label class="tw-font-normal ">
  74. <span>{{ $t("Site contact mobile phone")}}</span><span class="required">*</span>
  75. </label>
  76. </div>
  77. <ElementInputNew
  78. :input="{
  79. id: 'SiteContactMobilePhone',
  80. required: true,
  81. type: 'text',
  82. placeholder: '例:0912-345-678',
  83. }"
  84. :validation="validation.site_contact_mobile_phone"
  85. @change="formData.site_contact_mobile_phone = $event"
  86. >
  87. </ElementInputNew>
  88. </div>
  89. </div>
  90. <div class="element tw-mt-[16px]">
  91. <elementTextarea
  92. :input="{
  93. id: 'remark',
  94. label: 'remark',
  95. required: false,
  96. placeholder: '留言你想告訴我的話',
  97. }"
  98. :default="''"
  99. :validation="true"
  100. :maxlength="500"
  101. @change="formData.Memo = $event"
  102. ></elementTextarea>
  103. </div>
  104. </div>
  105. </template>
  106. <script>
  107. import ElementTextarea from "@/components/newComponent/form/ElementTextarea";
  108. import ElementInputNew from "@/components/newComponent/form/ElementInputNew";
  109. import selectDate from "@/components/service/content/selectDate.vue";
  110. import ElementSelect from "@/components/newComponent/form/ElementSelect.vue";
  111. import elementTimePicker from "@/components/newComponent/form/ElementTimePicker";
  112. import is from "is_js";
  113. export default {
  114. name: "OrderingDetails",
  115. components: {
  116. ElementTextarea,
  117. ElementInputNew,
  118. ElementSelect,
  119. elementTimePicker,
  120. is,
  121. selectDate,
  122. },
  123. data() {
  124. return {
  125. selectList:[
  126. {
  127. id:'1',
  128. name: '01',
  129. },{
  130. id:'2',
  131. name: '02',
  132. }
  133. ],
  134. selectDates: '',
  135. start: '2023-02-06',
  136. end: '2023-06-06',
  137. formData: {
  138. mobilization_date: "",
  139. mobilization_time: "",
  140. exit_date: "",
  141. exit_time: "",
  142. booth_no: "",
  143. site_contact_person: "",
  144. site_contact_mobile_phone: "",
  145. memo: "",
  146. },
  147. validation: {
  148. mobilization_date: true,
  149. mobilization_time: true,
  150. exit_date: true,
  151. exit_time: true,
  152. booth_no: true,
  153. site_contact_person: true,
  154. site_contact_mobile_phone: true,
  155. memo: true,
  156. },
  157. errors: null,
  158. };
  159. },
  160. mounted() {},
  161. methods: {
  162. reset() {
  163. this.formData = {
  164. mobilization_date: "",
  165. mobilization_time: "",
  166. exit_date: "",
  167. exit_time: "",
  168. booth_no: "",
  169. site_contact_person: "",
  170. site_contact_mobile_phone: "",
  171. memo: "",
  172. };
  173. },
  174. save() {
  175. let isPass = this.validators();
  176. return isPass;
  177. },
  178. validators() {
  179. if (is.empty(this.formData.mobilization_date)) {
  180. this.validation.mobilization_date = false;
  181. } else {
  182. this.validation.mobilization_date = true;
  183. }
  184. if (is.empty(this.formData.mobilization_time)) {
  185. this.validation.mobilization_time = false;
  186. } else {
  187. this.validation.mobilization_time = true;
  188. }
  189. if (is.empty(this.formData.exit_date)) {
  190. this.validation.exit_date = false;
  191. } else {
  192. this.validation.exit_date = true;
  193. }
  194. if (
  195. is.empty(this.formData.exit_time)
  196. ) {
  197. this.validation.exit_time = false;
  198. } else {
  199. this.validation.exit_time = true;
  200. }
  201. if (is.empty(this.formData.booth_no)) {
  202. this.validation.booth_no = false;
  203. } else {
  204. this.validation.booth_no = true;
  205. }
  206. if (is.empty(this.formData.site_contact_person)) {
  207. this.validation.site_contact_person = false;
  208. } else {
  209. this.validation.site_contact_person = true;
  210. }
  211. if (is.empty(this.formData.site_contact_mobile_phone) && is.not.number(this.formData.site_contact_mobile_phone)) {
  212. this.validation.site_contact_mobile_phone = false;
  213. } else {
  214. this.validation.site_contact_mobile_phone = true;
  215. }
  216. if (
  217. is.empty(this.formData.memo)
  218. ) {
  219. this.validation.memo = false;
  220. } else {
  221. this.validation.memo = true;
  222. }
  223. this.errors = Object.entries(this.validation).filter(
  224. (e) => e[1] == false
  225. );
  226. if (this.errors.length > 0) {
  227. return false;
  228. } else {
  229. return true;
  230. }
  231. }
  232. },
  233. selectItem(){
  234. },
  235. };
  236. </script>
  237. <style lang="scss" scoped>
  238. select {
  239. -moz-appearance: none;
  240. /* Firefox */
  241. -webkit-appearance: none;
  242. /* Safari and Chrome */
  243. appearance: none;
  244. background-image: url("~/assets/svg/down-arrow.svg");
  245. background-size: 9px 6px;
  246. background-position: right 20px center;
  247. background-repeat: no-repeat;
  248. }
  249. </style>