index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <n-space vertical>
  3. <n-breadcrumb>
  4. <n-breadcrumb-item>任务管理</n-breadcrumb-item>
  5. <n-breadcrumb-item>报告生成</n-breadcrumb-item>
  6. </n-breadcrumb>
  7. <n-scrollbar style="max-height: 650px">
  8. <div class="w-1/2 mx-auto">
  9. <n-form
  10. ref="formRef"
  11. :model="formValue"
  12. :rules="rules"
  13. label-placement="left"
  14. label-width="auto"
  15. >
  16. <template
  17. v-for="item of templateDataList"
  18. :key="item.T_VerifyTemplateMap_id"
  19. >
  20. <n-form-item
  21. required
  22. :label="item.T_name"
  23. :path="item.T_field"
  24. v-if="item.T_label === 3"
  25. >
  26. <n-select
  27. v-model:value="formValue.selectedValue"
  28. :options="options"
  29. />
  30. <n-popover trigger="hover">
  31. <template #trigger>
  32. <n-icon size="20" class="ml-3">
  33. <question-icon />
  34. </n-icon>
  35. </template>
  36. <n-image width="200" :src="item.T_text" />
  37. </n-popover>
  38. </n-form-item>
  39. <n-form-item
  40. required
  41. :label="item.T_name"
  42. :path="item.T_field"
  43. v-else-if="item.T_label === 4"
  44. >
  45. <n-select
  46. v-model:value="formValue.selectedValue"
  47. :options="options"
  48. />
  49. <n-popover trigger="hover">
  50. <template #trigger>
  51. <n-icon size="20" class="ml-3">
  52. <question-icon />
  53. </n-icon>
  54. </template>
  55. <n-image width="200" :src="item.T_text" />
  56. </n-popover>
  57. </n-form-item>
  58. <n-divider v-else-if="item.T_label === 5" />
  59. <n-form-item
  60. required
  61. :label="item.T_name"
  62. :path="item.T_field"
  63. v-else-if="item.T_label === 7"
  64. >
  65. <n-date-picker
  66. class="w-full"
  67. v-model:formatted-value="formValue.formattedValue"
  68. value-format="yyyy-MM-dd HH:mm:ss"
  69. type="datetime"
  70. clearable
  71. />
  72. <n-popover trigger="hover">
  73. <template #trigger>
  74. <n-icon size="20" class="ml-3">
  75. <question-icon />
  76. </n-icon>
  77. </template>
  78. <n-image width="200" :src="item.T_text" />
  79. </n-popover>
  80. </n-form-item>
  81. <n-form-item
  82. required
  83. :label="item.T_name"
  84. :path="item.T_field"
  85. v-else-if="item.T_label === 9"
  86. >
  87. <n-date-picker
  88. class="w-full"
  89. v-model:formatted-value="formValue.formattedValue"
  90. value-format="yyyy-MM-dd HH:mm:ss"
  91. v-model:value="formValue.formattedValue"
  92. type="datetimerange"
  93. clearable
  94. />
  95. <n-popover trigger="hover">
  96. <template #trigger>
  97. <n-icon size="20" class="ml-3">
  98. <question-icon />
  99. </n-icon>
  100. </template>
  101. <n-image width="200" :src="item.T_text" />
  102. </n-popover>
  103. </n-form-item>
  104. <n-form-item
  105. required
  106. :label="item.T_name"
  107. :path="item.T_field"
  108. v-else-if="item.T_label === 10"
  109. >
  110. <n-upload :default-upload="false" list-type="image-card" :max="1">
  111. 点击上传
  112. </n-upload>
  113. <n-popover trigger="hover">
  114. <template #trigger>
  115. <n-icon size="20" class="ml-3">
  116. <question-icon />
  117. </n-icon>
  118. </template>
  119. <n-image width="200" :src="item.T_text" />
  120. </n-popover>
  121. </n-form-item>
  122. <n-form-item
  123. required
  124. :label="item.T_name"
  125. :path="item.T_field"
  126. v-else-if="item.T_label === 11"
  127. >
  128. <n-upload :default-upload="false" list-type="image-card" :max="1">
  129. 点击上传
  130. </n-upload>
  131. <n-popover trigger="hover">
  132. <template #trigger>
  133. <n-icon size="20" class="ml-3">
  134. <question-icon />
  135. </n-icon>
  136. </template>
  137. <n-image width="200" :src="item.T_text" />
  138. </n-popover>
  139. </n-form-item>
  140. <n-form-item :label="item.T_name" :path="item.T_field" v-else>
  141. <n-input v-model:value="formValue[item.T_field]" />
  142. <n-popover trigger="hover">
  143. <template #trigger>
  144. <n-icon size="20" class="ml-3">
  145. <question-icon />
  146. </n-icon>
  147. </template>
  148. <n-image width="200" :src="item.T_text" />
  149. </n-popover>
  150. </n-form-item>
  151. </template>
  152. </n-form>
  153. </div>
  154. </n-scrollbar>
  155. </n-space>
  156. <n-modal
  157. :show-icon="false"
  158. v-model:show="modal.showModal"
  159. preset="dialog"
  160. :title="modal.title"
  161. positive-text="提交"
  162. negative-text="取消"
  163. @positive-click="submitCallback"
  164. >
  165. 123
  166. </n-modal>
  167. </template>
  168. <script setup>
  169. import { getVerifyTemplateMapDataList } from "@/api";
  170. import { QuestionCircleOutlined as QuestionIcon } from "@vicons/antd";
  171. import { useTaskStore } from "@/store/task";
  172. const taskStore = useTaskStore();
  173. // 表单信息
  174. const formValue = reactive({
  175. textValue: null,
  176. formattedValue: null,
  177. selectedValue: null,
  178. });
  179. // 模板标签数据列表
  180. const templateDataList = ref([]);
  181. // 配置选项内容
  182. const options = [
  183. {
  184. label: "Everybody's Got Something to Hide Except Me and My Monkey",
  185. value: "song0",
  186. disabled: true,
  187. },
  188. {
  189. label: "Drive My Car",
  190. value: "song1",
  191. },
  192. {
  193. label: "Norwegian Wood",
  194. value: "song2",
  195. },
  196. ];
  197. // 模态框数据源
  198. const modal = reactive({
  199. title: "",
  200. showModal: false,
  201. });
  202. // 验证表项的规则
  203. const rules = {
  204. T_name: { required: true, message: "不能为空", trigger: "blur" },
  205. time: { required: true, message: "不能为空", trigger: ["blur", "change"] },
  206. extent: { required: true, message: "不能为空", trigger: ["blur", "change"] },
  207. };
  208. // 执行 positive 时执行的回调函数
  209. const submitCallback = () => {
  210. if (modal.title === "添加") {
  211. console.log("add");
  212. } else {
  213. console.log("edit");
  214. }
  215. };
  216. // 模板标签数据(列表)
  217. const getDataList = async () => {
  218. const { data: res } = await getVerifyTemplateMapDataList({
  219. T_source: 1,
  220. T_task_id: taskStore.task.T_task_id,
  221. T_VerifyTemplate_id: "rtxF",
  222. });
  223. templateDataList.value = res.Data;
  224. };
  225. getDataList();
  226. </script>
  227. <style scoped></style>