index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div>
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <!-- 操作按钮区域 -->
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-form-item>
  8. <a-tree-select
  9. v-model="queryParam.deptId"
  10. style="width: 150px"
  11. :show-search="true"
  12. allow-clear
  13. placeholder="选择车间"
  14. :tree-data="treeData"
  15. tree-node-filter-prop="label"
  16. :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
  17. />
  18. </a-form-item>
  19. <a-form-item>
  20. <a-select
  21. v-model="queryParam.labId"
  22. placeholder="选择实验室"
  23. style="width:150px"
  24. >
  25. <a-select-option value="">
  26. 请选择
  27. </a-select-option>
  28. <a-select-option
  29. v-for="(item,index) in dictOptions"
  30. :key="index"
  31. :value="item.deptId"
  32. >
  33. <span style="display: inline-block;width: 100%" :title=" item.deptName ">
  34. {{ item.deptName }}
  35. </span>
  36. </a-select-option>
  37. </a-select>
  38. </a-form-item>
  39. <a-form-item>
  40. <a-date-picker
  41. v-model="queryParam.endTime"
  42. format="YYYY-MM-DD"
  43. value-format="YYYY-MM-DD"
  44. placeholder="选择实验截止日期"
  45. />
  46. </a-form-item>
  47. <a-form-item>
  48. <a-button type="primary" @click="searchQuery">查询</a-button>
  49. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  50. </a-form-item>
  51. </a-form>
  52. </div>
  53. <!-- table区域-begin -->
  54. <div style="margin-top: 10px">
  55. <a-table
  56. ref="table"
  57. size="middle"
  58. bordered
  59. row-key="id"
  60. :columns="columns"
  61. :data-source="dataSource"
  62. :pagination="ipagination"
  63. :loading="loading"
  64. @change="handleTableChange"
  65. >
  66. <span slot="action" slot-scope="text, record">
  67. <a-button size="small" type="link" @click="handleEdit(record)">
  68. 完成实验
  69. </a-button>
  70. </span>
  71. </a-table>
  72. </div>
  73. <!-- table区域-end -->
  74. <!-- 表单区域 -->
  75. <dy-list ref="modalForm" />
  76. </div>
  77. </template>
  78. <script>
  79. import { listMixin } from '@/mixin/listMixin'
  80. import columns from './indexColumns'
  81. import { getAction, httpAction } from '@/api/request'
  82. import dyList from './dyList'
  83. export default {
  84. components: { dyList },
  85. mixins: [listMixin],
  86. data() {
  87. return {
  88. // 查询条件
  89. queryParam: { state: 0 },
  90. treeData: [],
  91. dictOptions: [],
  92. // 表头
  93. columns: columns(this),
  94. url: {
  95. list: '/business/safetool/sec/experiment/list',
  96. tree: '/system/dept/treeSelect',
  97. sysListL: '/system/dept/listLab'
  98. }
  99. }
  100. },
  101. created() {
  102. this.loadTree()
  103. this.getSysList()
  104. },
  105. methods: {
  106. handleEdit: function(record) {
  107. httpAction('/business/safetool/sec/experiment/expEnd', record, 'post').then((res) => {
  108. if (res.code === 200) {
  109. this.$refs.modalForm.edit(record)
  110. this.$refs.modalForm.title = '编辑'
  111. this.$refs.modalForm.disableSubmit = false
  112. this.$message.success(res.msg)
  113. } else {
  114. this.$message.error(res.msg)
  115. console.log(res)
  116. }
  117. })
  118. },
  119. loadTree() {
  120. this.treeData = []
  121. getAction(this.url.tree).then((res) => {
  122. if (res.code === 200) {
  123. this.treeData = res.data
  124. }
  125. })
  126. },
  127. getSysList() {
  128. getAction(this.url.sysListL).then((res) => {
  129. if (res.code === 200) {
  130. this.dictOptions = res.data
  131. }
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style scoped>
  138. @import '~@/assets/less/common.less'
  139. </style>