yyList.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div>
  3. <j-modal
  4. :title="title"
  5. width="70%"
  6. :visible="visible"
  7. :mask-closable="false"
  8. cancel-text="关闭"
  9. @close="close"
  10. >
  11. <!-- 操作按钮区域 -->
  12. <div class="table-page-search-wrapper">
  13. <a-form layout="inline" @keyup.enter.native="searchQuery">
  14. <a-form-item>
  15. <j-dict-select-tag
  16. v-model="queryParam.toolType"
  17. style="width: 150px"
  18. placeholder="选择工具名称"
  19. dict-code="tool_type"
  20. />
  21. </a-form-item>
  22. <a-form-item>
  23. <a-tree-select
  24. v-model="queryParam.deptId"
  25. style="width: 150px"
  26. :show-search="true"
  27. allow-clear
  28. placeholder="选择车间"
  29. :tree-data="treeData"
  30. tree-node-filter-prop="label"
  31. :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
  32. />
  33. </a-form-item>
  34. <a-form-item>
  35. <a-input
  36. v-model="queryParam.storePlace"
  37. style="width: 150px"
  38. placeholder="输入存放处"
  39. />
  40. </a-form-item>
  41. <a-form-item>
  42. <a-date-picker
  43. v-model="queryParam.lastTestDate"
  44. format="YYYY-MM-DD"
  45. value-format="YYYY-MM-DD"
  46. placeholder="上次检验日期"
  47. />
  48. </a-form-item>
  49. <a-form-item>
  50. <a-input
  51. v-model="queryParam.toolCode"
  52. style="width: 150px"
  53. placeholder="输入编号"
  54. />
  55. </a-form-item>
  56. <a-form-item>
  57. <a-button type="primary" @click="searchQuery">查询</a-button>
  58. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  59. </a-form-item>
  60. </a-form>
  61. </div>
  62. <!-- table区域-begin -->
  63. <div style="margin-top: 10px">
  64. <a-table
  65. ref="table"
  66. size="middle"
  67. bordered
  68. row-key="toolId"
  69. :columns="columns"
  70. :data-source="dataSource"
  71. :pagination="ipagination"
  72. :loading="loading"
  73. @change="handleTableChange"
  74. >
  75. <template slot="isok" slot-scope="text, record">
  76. <span>{{ record.isok==='1'?'合格':'不合格' }}</span>
  77. </template>
  78. </a-table>
  79. </div>
  80. <!-- table区域-end -->
  81. <!-- 表单区域 -->
  82. </j-modal>
  83. </div>
  84. </template>
  85. <script>
  86. import { listMixin } from '@/mixin/listMixin'
  87. import { getAction, httpAction } from '@/api/request'
  88. import JModal from '@/components/JModal'
  89. import columns from './syColumns'
  90. export default {
  91. name: 'SyList',
  92. components: {
  93. JModal
  94. },
  95. mixins: [listMixin],
  96. data() {
  97. return {
  98. title: '完成试验',
  99. visible: false,
  100. queryParam: {},
  101. // 表头
  102. isNotCreateLoad: true,
  103. columns: columns(this),
  104. treeData: [],
  105. id: '',
  106. url: {
  107. list: '/business/safetool/base/safety/tool/listExperimentTool',
  108. tree: '/system/dept/treeSelect'
  109. }
  110. }
  111. },
  112. created() {
  113. },
  114. methods: {
  115. edit(record) {
  116. this.id = record.id
  117. this.loadTree()
  118. this.loadData()
  119. this.visible = true
  120. },
  121. loadData() {
  122. if (!this.url.list) {
  123. this.$message.error('请设置url.list属性!')
  124. return
  125. }
  126. var params = this.getQueryParams()// 查询条件
  127. this.queryParam = Object.assign({}, params, { id: this.id })
  128. this.loading = true
  129. getAction(this.url.list, this.queryParam).then((res) => {
  130. if (res.code === 200) {
  131. this.dataSource = res.rows || res.data
  132. if (res.total) {
  133. this.ipagination.total = res.total
  134. } else {
  135. this.ipagination.total = 0
  136. }
  137. } else {
  138. this.$message.warning(res.msg)
  139. }
  140. }).finally(() => {
  141. this.loading = false
  142. })
  143. },
  144. loadTree() {
  145. this.treeData = []
  146. getAction(this.url.tree).then((res) => {
  147. if (res.code === 200) {
  148. this.treeData = res.data
  149. }
  150. })
  151. },
  152. close() {
  153. this.visible = false
  154. }
  155. }
  156. }
  157. </script>