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.

865 lines
29 KiB

  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="疫苗标题" prop="title">
  5. <el-input
  6. v-model="queryParams.title"
  7. placeholder="请输入疫苗标题"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="牲畜类型" prop="livestockType">
  13. <el-select v-model="queryParams.livestockType" placeholder="请选择牲畜类型" clearable>
  14. <el-option
  15. v-for="dict in dict.type.livestock_type"
  16. :key="dict.value"
  17. :label="dict.label"
  18. :value="dict.value"
  19. />
  20. </el-select>
  21. </el-form-item>
  22. <!-- <el-form-item label="疫苗类型" prop="vaccineType">-->
  23. <!-- <el-select v-model="queryParams.vaccineType" placeholder="请选择疫苗类型" clearable>-->
  24. <!-- <el-option-->
  25. <!-- v-for="dict in dict.type.vaccine_type"-->
  26. <!-- :key="dict.value"-->
  27. <!-- :label="dict.label"-->
  28. <!-- :value="dict.value"-->
  29. <!-- />-->
  30. <!-- </el-select>-->
  31. <!-- </el-form-item>-->
  32. <el-form-item label="状态" prop="status">
  33. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
  34. <el-option
  35. v-for="dict in dict.type.vaccine_info_status"
  36. :key="dict.value"
  37. :label="dict.label"
  38. :value="dict.value"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="接种日期" prop="vaccinationDate">
  43. <el-date-picker clearable
  44. v-model="queryParams.vaccinationDate"
  45. type="date"
  46. value-format="yyyy-MM-dd"
  47. placeholder="请选择接种日期">
  48. </el-date-picker>
  49. </el-form-item>
  50. <el-form-item label="接种地点" prop="vaccinationLocation">
  51. <el-input
  52. v-model="queryParams.vaccinationLocation"
  53. placeholder="请输入接种地点"
  54. clearable
  55. @keyup.enter.native="handleQuery"
  56. />
  57. </el-form-item>
  58. <el-form-item label="报名截止时间" prop="endTime">
  59. <el-date-picker clearable
  60. v-model="queryParams.endTime"
  61. type="date"
  62. value-format="yyyy-MM-dd"
  63. placeholder="请选择报名截止时间">
  64. </el-date-picker>
  65. </el-form-item>
  66. <el-form-item label="可预约数量" prop="availableSlots">
  67. <el-input
  68. v-model="queryParams.availableSlots"
  69. placeholder="请输入可预约数量"
  70. clearable
  71. @keyup.enter.native="handleQuery"
  72. />
  73. </el-form-item>
  74. <el-form-item label="总数量" prop="totalSlots">
  75. <el-input
  76. v-model="queryParams.totalSlots"
  77. placeholder="请输入总数量"
  78. clearable
  79. @keyup.enter.native="handleQuery"
  80. />
  81. </el-form-item>
  82. <!-- <el-form-item label="发布时间" prop="publishTime">-->
  83. <!-- <el-date-picker clearable-->
  84. <!-- v-model="queryParams.publishTime"-->
  85. <!-- type="date"-->
  86. <!-- value-format="yyyy-MM-dd"-->
  87. <!-- placeholder="请选择发布时间">-->
  88. <!-- </el-date-picker>-->
  89. <!-- </el-form-item>-->
  90. <el-form-item>
  91. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  92. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  93. </el-form-item>
  94. </el-form>
  95. <el-row :gutter="10" class="mb8">
  96. <el-col :span="1.5">
  97. <el-button
  98. type="primary"
  99. plain
  100. icon="el-icon-plus"
  101. size="mini"
  102. @click="handleAdd"
  103. v-hasPermi="['system:vacInfo:add']"
  104. >新增</el-button>
  105. </el-col>
  106. <el-col :span="1.5">
  107. <el-button
  108. type="success"
  109. plain
  110. icon="el-icon-edit"
  111. size="mini"
  112. :disabled="single"
  113. @click="handleUpdate"
  114. v-hasPermi="['system:vacInfo:edit']"
  115. >修改</el-button>
  116. </el-col>
  117. <el-col :span="1.5">
  118. <el-button
  119. type="danger"
  120. plain
  121. icon="el-icon-delete"
  122. size="mini"
  123. :disabled="multiple"
  124. @click="handleDelete"
  125. v-hasPermi="['system:vacInfo:remove']"
  126. >删除</el-button>
  127. </el-col>
  128. <el-col :span="1.5">
  129. <el-button
  130. type="warning"
  131. plain
  132. icon="el-icon-download"
  133. size="mini"
  134. @click="handleExport"
  135. v-hasPermi="['system:vacInfo:export']"
  136. >导出</el-button>
  137. </el-col>
  138. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  139. </el-row>
  140. <el-table v-loading="loading" :data="vacInfoList" @selection-change="handleSelectionChange">
  141. <el-table-column type="selection" width="55" align="center" />
  142. <!-- <el-table-column label="疫苗信息ID" align="center" prop="id" />-->
  143. <el-table-column label="疫苗标题" align="center" prop="title" width="200px" :show-overflow-tooltip="true"/>
  144. <el-table-column label="牲畜类型" align="center" prop="livestockType" width="100px">
  145. <template slot-scope="scope">
  146. <dict-tag :options="dict.type.livestock_type" :value="scope.row.livestockType"/>
  147. </template>
  148. </el-table-column>
  149. <!-- <el-table-column label="疫苗类型" align="center" prop="vaccineType" width="200px">-->
  150. <!-- <template slot-scope="scope">-->
  151. <!-- <dict-tag :options="dict.type.vaccine_type" :value="scope.row.vaccineType"/>-->
  152. <!-- </template>-->
  153. <!-- </el-table-column>-->
  154. <el-table-column label="疫苗类型" align="center" prop="vaccineType" width="200px" :show-overflow-tooltip="true"/>
  155. <el-table-column label="详细描述" align="center" prop="description" width="300px" :show-overflow-tooltip="true"/>
  156. <el-table-column label="接种日期" align="center" prop="vaccinationDate" width="180">
  157. <template slot-scope="scope">
  158. <span>{{ parseTime(scope.row.vaccinationDate, '{y}-{m}-{d}') }}</span>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="接种地点" align="center" prop="vaccinationLocation" width="200px"/>
  162. <el-table-column label="可预约数量" align="center" prop="availableSlots" width="200px"/>
  163. <el-table-column label="总数量" align="center" prop="totalSlots" width="200px"/>
  164. <el-table-column label="状态" align="center" prop="status">
  165. <template slot-scope="scope">
  166. <dict-tag :options="dict.type.vaccine_info_status" :value="scope.row.status"/>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="发布时间" align="center" prop="publishTime" width="180">
  170. <template slot-scope="scope">
  171. <span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d}') }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="报名截止时间" align="center" prop="endTime" width="180">
  175. <template slot-scope="scope">
  176. <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="备注" align="center" prop="remark" />
  180. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="300">
  181. <template slot-scope="scope">
  182. <el-button
  183. size="mini"
  184. type="text"
  185. icon="el-icon-edit"
  186. style="color: #42B983"
  187. class="info-btn alter-btn"
  188. @click="handleUpdate(scope.row)"
  189. v-hasPermi="['system:vacInfo:edit']"
  190. >修改</el-button>
  191. <el-button
  192. size="mini"
  193. type="text"
  194. icon="el-icon-delete"
  195. style="color: #f56c6c"
  196. class="info-btn delete-btn"
  197. @click="handleDelete(scope.row)"
  198. v-hasPermi="['system:vacInfo:remove']"
  199. >删除</el-button>
  200. <el-button
  201. size="mini"
  202. type="text"
  203. icon="el-icon-s-order"
  204. style="color: rgb(92 169 179)"
  205. class="info-btn reservation-btn"
  206. @click="handleRegistrationList(scope.row)"
  207. v-hasPermi="['system:vacInfo:list']"
  208. >预约列表</el-button>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. <div class="pagestyle">
  213. <pagination
  214. v-show="total>0"
  215. :total="total"
  216. :page.sync="queryParams.pageNum"
  217. :limit.sync="queryParams.pageSize"
  218. @pagination="getList"
  219. />
  220. </div>
  221. <!-- 添加或修改疫苗信息对话框 -->
  222. <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
  223. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  224. <el-row>
  225. <el-col :span="12">
  226. <el-form-item label="疫苗标题" prop="title">
  227. <el-input v-model="form.title" placeholder="请输入疫苗标题" />
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="12">
  231. <el-form-item label="牲畜类型" prop="livestockType">
  232. <el-select v-model="form.livestockType" placeholder="请选择牲畜类型" clearable @change="handleLivestockTypeChange">
  233. <el-option
  234. v-for="dict in dict.type.livestock_type"
  235. :key="dict.value"
  236. :label="dict.label"
  237. :value="dict.value"
  238. />
  239. </el-select>
  240. </el-form-item>
  241. </el-col>
  242. </el-row>
  243. <el-row>
  244. <el-col :span="12">
  245. <el-form-item label="疫苗类型" prop="vaccineType">
  246. <el-select
  247. v-model="form.vaccineType"
  248. placeholder="请先选择牲畜类型"
  249. clearable
  250. :disabled="!form.livestockType"
  251. @change="handleVaccineTypeChange"
  252. @focus="handleVaccineTypeFocus"
  253. filterable
  254. >
  255. <el-option
  256. v-for="item in vaccineTypeOptions"
  257. :key="item.id"
  258. :label="getVaccineDisplayName(item)"
  259. :value="item.id"
  260. />
  261. </el-select>
  262. </el-form-item>
  263. </el-col>
  264. <el-col :span="12">
  265. <el-form-item label="状态" prop="status">
  266. <el-select v-model="form.status" placeholder="请选择状态">
  267. <el-option
  268. v-for="dict in dict.type.vaccine_info_status"
  269. :key="dict.value"
  270. :label="dict.label"
  271. :value="parseInt(dict.value)"
  272. />
  273. </el-select>
  274. </el-form-item>
  275. </el-col>
  276. </el-row>
  277. <el-row>
  278. <el-col :span="12">
  279. <el-form-item label="接种日期" prop="vaccinationDate">
  280. <el-date-picker clearable
  281. v-model="form.vaccinationDate"
  282. type="date"
  283. value-format="yyyy-MM-dd"
  284. placeholder="请选择接种日期"
  285. style="width: 100%;">
  286. </el-date-picker>
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="12">
  290. <el-form-item label="接种地点" prop="vaccinationLocation">
  291. <el-input v-model="form.vaccinationLocation" placeholder="请输入接种地点" />
  292. </el-form-item>
  293. </el-col>
  294. </el-row>
  295. <el-row>
  296. <el-col :span="12">
  297. <el-form-item label="可预约数量" prop="availableSlots">
  298. <el-input v-model="form.availableSlots" placeholder="请输入可预约数量" />
  299. </el-form-item>
  300. </el-col>
  301. <el-col :span="12">
  302. <el-form-item label="总数量" prop="totalSlots">
  303. <el-input v-model="form.totalSlots" placeholder="请输入总数量" />
  304. </el-form-item>
  305. </el-col>
  306. </el-row>
  307. <el-row>
  308. <el-col :span="12">
  309. <el-form-item label="报名截止期" prop="endTime">
  310. <el-date-picker clearable
  311. v-model="form.endTime"
  312. type="date"
  313. value-format="yyyy-MM-dd"
  314. placeholder="请选择报名截止时间"
  315. style="width: 100%;">
  316. </el-date-picker>
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="12">
  320. <el-form-item label="发布时间" prop="publishTime">
  321. <el-date-picker clearable
  322. v-model="form.publishTime"
  323. type="date"
  324. value-format="yyyy-MM-dd"
  325. placeholder="请选择发布时间"
  326. style="width: 100%;">
  327. </el-date-picker>
  328. </el-form-item>
  329. </el-col>
  330. </el-row>
  331. <el-row>
  332. <el-col :span="24">
  333. <el-form-item label="详细描述">
  334. <editor v-model="form.description" :min-height="192"/>
  335. </el-form-item>
  336. </el-col>
  337. </el-row>
  338. <!-- 疫苗详细信息展示 -->
  339. <div v-if="selectedVaccine" style="margin: 20px 0; border: 1px solid #ebeef5; border-radius: 4px; padding: 15px;">
  340. <div style="font-weight: bold; margin-bottom: 10px; color: #409EFF;">疫苗详细信息</div>
  341. <el-descriptions :column="2" border size="small">
  342. <el-descriptions-item label="通用名称">{{ selectedVaccine.genericName || '暂无' }}</el-descriptions-item>
  343. <el-descriptions-item label="商品名称">{{ selectedVaccine.tradeName || '暂无' }}</el-descriptions-item>
  344. <el-descriptions-item label="兽药批准文号">{{ selectedVaccine.approvalNumber || '暂无' }}</el-descriptions-item>
  345. <el-descriptions-item label="产品批号">{{ selectedVaccine.batchNumber || '暂无' }}</el-descriptions-item>
  346. <el-descriptions-item label="规格">{{ selectedVaccine.specification || '暂无' }}</el-descriptions-item>
  347. <el-descriptions-item label="生产厂家">{{ selectedVaccine.manufacturer || '暂无' }}</el-descriptions-item>
  348. <el-descriptions-item label="生产日期">{{ parseTime(selectedVaccine.manufactureDate, '{y}-{m}-{d}') || '暂无' }}</el-descriptions-item>
  349. <el-descriptions-item label="有效期至">{{ parseTime(selectedVaccine.expiryDate, '{y}-{m}-{d}') || '暂无' }}</el-descriptions-item>
  350. <el-descriptions-item label="适用动物" :span="2">
  351. <dict-tag :options="dict.type.livestock_type" :value="selectedVaccine.livestockType"/>
  352. </el-descriptions-item>
  353. <el-descriptions-item label="预防疫病">{{ selectedVaccine.preventDisease || '暂无' }}</el-descriptions-item>
  354. <el-descriptions-item label="是否强制免疫">{{ selectedVaccine.isMandatory === '1' ? '是' : '否' }}</el-descriptions-item>
  355. <el-descriptions-item label="免疫期(天)">{{ selectedVaccine.immunePeriod || '暂无' }}</el-descriptions-item>
  356. <el-descriptions-item label="用法用量">{{ selectedVaccine.dosage || '暂无' }}</el-descriptions-item>
  357. <el-descriptions-item label="接种途径">{{ selectedVaccine.administrationRoute || '暂无' }}</el-descriptions-item>
  358. <el-descriptions-item label="贮藏条件">{{ selectedVaccine.storageCondition || '暂无' }}</el-descriptions-item>
  359. <el-descriptions-item label="注意事项">{{ selectedVaccine.precautions || '暂无' }}</el-descriptions-item>
  360. <el-descriptions-item label="库存数量">{{ selectedVaccine.stockQuantity || '暂无' }}</el-descriptions-item>
  361. <el-descriptions-item label="已使用数量">{{ selectedVaccine.usedQuantity || '暂无' }}</el-descriptions-item>
  362. </el-descriptions>
  363. </div>
  364. <el-row>
  365. <el-col :span="12">
  366. <el-form-item label="删除标志" prop="delFlag">
  367. <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
  368. </el-form-item>
  369. </el-col>
  370. <el-col :span="12">
  371. <el-form-item label="创建者" prop="createBy">
  372. <el-input v-model="form.createBy" placeholder="请输入创建者" :disabled="true" />
  373. </el-form-item>
  374. </el-col>
  375. </el-row>
  376. <el-row>
  377. <el-col :span="24">
  378. <el-form-item label="备注" prop="remark">
  379. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" :rows="3" />
  380. </el-form-item>
  381. </el-col>
  382. </el-row>
  383. </el-form>
  384. <div slot="footer" class="dialog-footer">
  385. <el-button type="primary" @click="submitForm"> </el-button>
  386. <el-button @click="cancel"> </el-button>
  387. </div>
  388. </el-dialog>
  389. <!-- 疫苗预约列表弹窗 -->
  390. <el-dialog
  391. :title="registrationDialogTitle"
  392. :visible.sync="registrationDialogVisible"
  393. width="80%"
  394. append-to-body
  395. @close="handleRegistrationClose"
  396. class="registration-dialog"
  397. >
  398. <div v-if="registrationDialogVisible" style="height: 70vh; overflow-y: auto;">
  399. <VacRegistration
  400. :key="currentVaccineId"
  401. ref="registrationComponent"
  402. />
  403. </div>
  404. <div slot="footer" class="dialog-footer">
  405. <el-button @click="handleRegistrationClose"> </el-button>
  406. </div>
  407. </el-dialog>
  408. </div>
  409. </template>
  410. <script>
  411. import { listVacInfo, getVacInfo, delVacInfo, addVacInfo, updateVacInfo } from "@/api/system/vacInfo"
  412. import { getVacCategorylist } from "@/api/system/vacInfo"
  413. import VacRegistration from '@/views/system/VacRegistration/index.vue'
  414. export default {
  415. name: "VacInfo",
  416. components: {
  417. VacRegistration
  418. },
  419. dicts: ['vaccine_type', 'vaccine_info_status', 'livestock_type'],
  420. data() {
  421. return {
  422. // 遮罩层
  423. loading: true,
  424. // 选中数组
  425. ids: [],
  426. // 非单个禁用
  427. single: true,
  428. // 非多个禁用
  429. multiple: true,
  430. // 显示搜索条件
  431. showSearch: true,
  432. // 总条数
  433. total: 0,
  434. // 疫苗信息表格数据
  435. vacInfoList: [],
  436. // 弹出层标题
  437. title: "",
  438. // 是否显示弹出层
  439. open: false,
  440. // 疫苗类型选项(联动获取)
  441. vaccineTypeOptions: [],
  442. // 选中的疫苗详细信息
  443. selectedVaccine: null,
  444. // 新增预约列表弹窗相关数据
  445. registrationDialogVisible: false,
  446. currentVaccineId: null,
  447. registrationDialogTitle: "",
  448. // 查询参数
  449. queryParams: {
  450. pageNum: 1,
  451. pageSize: 10,
  452. title: null,
  453. livestockType: null,
  454. vaccineType: null,
  455. description: null,
  456. vaccinationDate: null,
  457. vaccinationLocation: null,
  458. availableSlots: null,
  459. totalSlots: null,
  460. status: null,
  461. publishTime: null,
  462. endTime: null,
  463. },
  464. // 表单参数
  465. form: {},
  466. // 表单校验
  467. rules: {
  468. title: [
  469. { required: true, message: "疫苗标题不能为空", trigger: "blur" }
  470. ],
  471. livestockType: [
  472. { required: true, message: "牲畜类型不能为空", trigger: "change" }
  473. ],
  474. vaccineType: [
  475. { required: true, message: "疫苗类型不能为空", trigger: "change" }
  476. ],
  477. description: [
  478. { required: true, message: "详细描述不能为空", trigger: "blur" }
  479. ],
  480. vaccinationDate: [
  481. { required: true, message: "接种日期不能为空", trigger: "blur" }
  482. ],
  483. vaccinationLocation: [
  484. { required: true, message: "接种地点不能为空", trigger: "blur" }
  485. ],
  486. availableSlots: [
  487. { required: true, message: "可预约数量不能为空", trigger: "blur" }
  488. ],
  489. totalSlots: [
  490. { required: true, message: "总数量不能为空", trigger: "blur" }
  491. ],
  492. status: [
  493. { required: true, message: "状态:1-进行中 2-已结束 3-已取消不能为空", trigger: "change" }
  494. ],
  495. publishTime: [
  496. { required: true, message: "发布时间不能为空", trigger: "blur" }
  497. ],
  498. endTime: [
  499. { required: true, message: "报名截止时间不能为空", trigger: "blur" }
  500. ],
  501. }
  502. }
  503. },
  504. created() {
  505. this.getList()
  506. },
  507. methods: {
  508. /** 查询疫苗信息列表 */
  509. getList() {
  510. this.loading = true
  511. listVacInfo(this.queryParams).then(response => {
  512. this.vacInfoList = response.rows
  513. this.total = response.total
  514. this.loading = false
  515. })
  516. },
  517. /** 获取疫苗显示名称 */
  518. getVaccineDisplayName(vaccine) {
  519. if (!vaccine) return '';
  520. let displayName = vaccine.genericName || vaccine.tradeName || '未知疫苗';
  521. if (vaccine.approvalNumber) {
  522. displayName += ` (${vaccine.approvalNumber})`;
  523. }
  524. if (vaccine.batchNumber) {
  525. displayName += ` - ${vaccine.batchNumber}`;
  526. }
  527. return displayName;
  528. },
  529. /** 牲畜类型变化时处理 */
  530. handleLivestockTypeChange(livestockType) {
  531. if (livestockType) {
  532. // 清空疫苗相关数据
  533. this.form.vaccineType = null;
  534. this.selectedVaccine = null;
  535. this.vaccineTypeOptions = [];
  536. } else {
  537. this.form.vaccineType = null;
  538. this.selectedVaccine = null;
  539. this.vaccineTypeOptions = [];
  540. }
  541. },
  542. /** 疫苗类型获得焦点时加载选项 */
  543. handleVaccineTypeFocus() {
  544. if (this.form.livestockType && this.vaccineTypeOptions.length === 0) {
  545. this.loadVaccineOptions(this.form.livestockType);
  546. }
  547. },
  548. /** 疫苗类型变化时更新详细信息 */
  549. handleVaccineTypeChange(vaccineId) {
  550. if (vaccineId) {
  551. this.updateSelectedVaccine(vaccineId);
  552. } else {
  553. this.selectedVaccine = null;
  554. }
  555. },
  556. /** 加载疫苗选项 */
  557. loadVaccineOptions(livestockType) {
  558. const query = { livestockType: livestockType };
  559. return getVacCategorylist(query).then(response => {
  560. this.vaccineTypeOptions = response.rows || [];
  561. return this.vaccineTypeOptions;
  562. }).catch(() => {
  563. this.vaccineTypeOptions = [];
  564. this.$message.error('获取疫苗列表失败');
  565. return [];
  566. });
  567. },
  568. /** 更新选中的疫苗详细信息 */
  569. updateSelectedVaccine(vaccineId) {
  570. if (vaccineId) {
  571. const vaccine = this.vaccineTypeOptions.find(item => item.id == vaccineId);
  572. this.selectedVaccine = vaccine || null;
  573. } else {
  574. this.selectedVaccine = null;
  575. }
  576. },
  577. /** 预约列表按钮操作 */
  578. handleRegistrationList(row) {
  579. this.currentVaccineId = row.id;
  580. this.registrationDialogTitle = `疫苗预约列表 - ${row.title}`;
  581. this.registrationDialogVisible = true;
  582. // 等组件渲染后设置查询条件,过滤该疫苗的预约记录
  583. this.$nextTick(() => {
  584. if (this.$refs.registrationComponent) {
  585. this.$refs.registrationComponent.queryParams.vaccineId = row.id;
  586. this.$refs.registrationComponent.getList();
  587. }
  588. });
  589. },
  590. /** 关闭预约列表弹窗 */
  591. handleRegistrationClose() {
  592. this.registrationDialogVisible = false;
  593. this.currentVaccineId = null;
  594. // 重置预约组件的查询条件
  595. if (this.$refs.registrationComponent) {
  596. this.$refs.registrationComponent.queryParams.vaccineId = null;
  597. }
  598. },
  599. // 取消按钮
  600. cancel() {
  601. this.open = false
  602. this.reset()
  603. },
  604. // 表单重置
  605. reset() {
  606. this.form = {
  607. id: null,
  608. title: null,
  609. livestockType: null,
  610. vaccineType: null,
  611. description: null,
  612. vaccinationDate: null,
  613. vaccinationLocation: null,
  614. availableSlots: null,
  615. totalSlots: null,
  616. status: null,
  617. publishTime: null,
  618. endTime: null,
  619. delFlag: null,
  620. createBy: null,
  621. createTime: null,
  622. updateBy: null,
  623. updateTime: null,
  624. remark: null
  625. }
  626. this.vaccineTypeOptions = [];
  627. this.selectedVaccine = null;
  628. this.resetForm("form")
  629. },
  630. /** 搜索按钮操作 */
  631. handleQuery() {
  632. this.queryParams.pageNum = 1
  633. this.getList()
  634. },
  635. /** 重置按钮操作 */
  636. resetQuery() {
  637. this.resetForm("queryForm")
  638. this.handleQuery()
  639. },
  640. // 多选框选中数据
  641. handleSelectionChange(selection) {
  642. this.ids = selection.map(item => item.id)
  643. this.single = selection.length!==1
  644. this.multiple = !selection.length
  645. },
  646. /** 新增按钮操作 */
  647. handleAdd() {
  648. this.reset()
  649. this.open = true
  650. this.title = "添加疫苗信息"
  651. },
  652. /** 修改按钮操作 */
  653. handleUpdate(row) {
  654. this.reset()
  655. const id = row.id || this.ids
  656. getVacInfo(id).then(response => {
  657. this.form = response.data
  658. this.open = true
  659. this.title = "修改疫苗信息"
  660. // 如果表单中有牲畜类型和疫苗类型,需要更新选中的疫苗详细信息
  661. if (this.form.livestockType && this.form.vaccineType) {
  662. // 先加载疫苗选项
  663. this.loadVaccineOptions(this.form.livestockType).then(() => {
  664. // 然后更新选中的疫苗详细信息
  665. this.updateSelectedVaccine(this.form.vaccineType);
  666. });
  667. }
  668. })
  669. },
  670. /** 提交按钮 */
  671. submitForm() {
  672. this.$refs["form"].validate(valid => {
  673. if (valid) {
  674. if (this.form.id != null) {
  675. updateVacInfo(this.form).then(response => {
  676. this.$modal.msgSuccess("修改成功")
  677. this.open = false
  678. this.getList()
  679. })
  680. } else {
  681. addVacInfo(this.form).then(response => {
  682. this.$modal.msgSuccess("新增成功")
  683. this.open = false
  684. this.getList()
  685. })
  686. }
  687. }
  688. })
  689. },
  690. /** 删除按钮操作 */
  691. handleDelete(row) {
  692. const ids = row.id || this.ids
  693. this.$modal.confirm('是否确认删除疫苗信息编号为"' + ids + '"的数据项?').then(function() {
  694. return delVacInfo(ids)
  695. }).then(() => {
  696. this.getList()
  697. this.$modal.msgSuccess("删除成功")
  698. }).catch(() => {})
  699. },
  700. /** 导出按钮操作 */
  701. handleExport() {
  702. this.download('system/vacInfo/export', {
  703. ...this.queryParams
  704. }, `vacInfo_${new Date().getTime()}.xlsx`)
  705. }
  706. }
  707. }
  708. </script>
  709. <style>
  710. /* 调整弹窗样式 */
  711. .registration-dialog .el-dialog__body {
  712. padding: 20px;
  713. max-height: 70vh;
  714. overflow-y: auto;
  715. }
  716. </style>
  717. <style scoped>
  718. ::v-deep .pagestyle .el-input{
  719. width: auto !important;
  720. }
  721. </style>
  722. <style scoped lang="scss">
  723. // 操作按钮样式
  724. .info-btn {
  725. padding: 6px 10px;
  726. border-radius: 4px;
  727. margin: 0 10px;
  728. transition: all 0.3s ease;
  729. }
  730. .alter-btn:hover{
  731. background-color: rgb(230, 255, 238);
  732. transform: translateY(-1px);
  733. }
  734. .delete-btn:hover {
  735. background-color: rgba(245, 108, 108, 0.1);
  736. transform: translateY(-1px);
  737. }
  738. .reservation-btn:hover {
  739. background-color: rgb(219, 244, 244);
  740. transform: translateY(-1px);
  741. }
  742. // 新增/修改的弹窗
  743. ::v-deep .el-dialog {
  744. border-radius: 12px;
  745. overflow: hidden;
  746. box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  747. animation: dialogFadeIn 0.3s ease;
  748. }
  749. ::v-deep .el-dialog__header {
  750. background: linear-gradient(135deg, #2c7a4d 0%, #42b983 100%);
  751. padding: 18px 24px;
  752. border-bottom: none;
  753. position: relative;
  754. }
  755. ::v-deep .el-dialog__title {
  756. font-size: 17px;
  757. font-weight: 600;
  758. color: white;
  759. letter-spacing: 0.5px;
  760. }
  761. ::v-deep .el-dialog__headerbtn:hover .el-dialog__close {
  762. color: #ffd04b;
  763. transform: rotate(90deg);
  764. }
  765. ::v-deep .el-dialog__body {
  766. padding: 28px 24px 20px;
  767. background-color: #f8fafc;
  768. max-height: 70vh;
  769. overflow-y: auto;
  770. }
  771. ::v-deep .el-form-item {
  772. margin-bottom: 20px;
  773. transition: all 0.3s;
  774. }
  775. ::v-deep .el-form-item__label {
  776. font-weight: 500;
  777. color: #2d3748;
  778. font-size: 14px;
  779. transition: color 0.3s;
  780. }
  781. ::v-deep .el-input,
  782. ::v-deep .el-textarea,
  783. ::v-deep .el-select {
  784. width: 100%;
  785. }
  786. ::v-deep .el-input__inner,
  787. ::v-deep .el-textarea__inner {
  788. border-radius: 8px;
  789. border: 1px solid #dcdfe6;
  790. font-size: 14px;
  791. transition: all 0.3s;
  792. background-color: #fcfdfe;
  793. }
  794. ::v-deep .el-input__inner:focus,
  795. ::v-deep .el-textarea__inner:focus {
  796. border-color: #42B983;
  797. box-shadow: 0 0 0 3px rgb(230, 255, 238);
  798. background-color: white;
  799. }
  800. ::v-deep .el-select .el-input__inner {
  801. padding-right: 35px;
  802. }
  803. ::v-deep .el-dialog__footer {
  804. padding: 20px 24px;
  805. background-color: #f8fafc;
  806. border-top: 1px solid #eef2f7;
  807. border-radius: 0 0 12px 12px;
  808. }
  809. </style>
  810. <style scoped>
  811. ::v-deep .el-descriptions-item__cell{
  812. width: 90px;
  813. }
  814. ::v-deep .pagestyle .el-input{
  815. width: auto !important;
  816. }
  817. ::v-deep .el-descriptions-row th{
  818. text-align: center !important;color: #7b7c7f;
  819. background: #faf7f7;
  820. }
  821. ::v-deep .el-descriptions .is-bordered .el-descriptions-item__cell {
  822. border: 1px solid #bcbbbb;
  823. padding: 12px 10px;
  824. }
  825. </style>