inspectionTemplate.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <ele-modal
  3. title="选择"
  4. :visible.sync="visible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="60%"
  10. :maxable="true"
  11. >
  12. <el-form
  13. label-width="77px"
  14. class="ele-form-search"
  15. @keyup.enter.native="search"
  16. @submit.native.prevent
  17. >
  18. <el-row type="flex" :gutter="24">
  19. <el-col :span="6">
  20. <el-form-item label="质检类型" label-width="100px">
  21. <el-select
  22. v-model="where.type"
  23. placeholder="请选择"
  24. style="width: 100%"
  25. clearable
  26. >
  27. <el-option
  28. :label="item.label"
  29. v-for="item in typeList"
  30. :key="item.value"
  31. :value="item.value"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="6">
  37. <el-form-item label="编码" label-width="100px">
  38. <el-input
  39. clearable
  40. v-model.trim="where.qualitySchemeTemplateCode"
  41. placeholder="请输入"
  42. />
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="6">
  46. <el-form-item label="名称" label-width="100px">
  47. <el-input
  48. clearable
  49. v-model.trim="where.qualitySchemeTemplateName"
  50. placeholder="请输入"
  51. />
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="4">
  55. <div class="ele-form-actions">
  56. <el-button
  57. type="primary"
  58. class="ele-btn-icon"
  59. size="small"
  60. @click="reload"
  61. >
  62. 查询
  63. </el-button>
  64. <el-button size="small" plain @click="reset">重置</el-button>
  65. </div>
  66. </el-col>
  67. </el-row>
  68. </el-form>
  69. <ele-pro-table
  70. ref="table"
  71. :columns="columns"
  72. :datasource="datasource"
  73. height="calc(100vh - 400px)"
  74. tool-class="ele-toolbar-form"
  75. cache-key="inspectionClassify"
  76. row-key="qualityLevelId"
  77. :current.sync="current"
  78. :highlight-current-row="true"
  79. @current-change="handleCurrentChange"
  80. >
  81. <template v-slot:current="{ row, _index }">
  82. <el-radio class="radio" v-model="radio" :label="row.id"
  83. ><i></i
  84. ></el-radio>
  85. </template>
  86. <template v-slot:status="{ row }">
  87. {{ row.status ? '启用' : '停用' }}
  88. </template>
  89. </ele-pro-table>
  90. <span slot="footer" class="dialog-footer">
  91. <el-button @click="handleClose">取消</el-button>
  92. <el-button type="primary" @click="changeSel">选择</el-button>
  93. </span>
  94. </ele-modal>
  95. </template>
  96. <script>
  97. import { getTemplateList } from '@/api/material/inspectionClassify';
  98. import { getByCode } from '@/api/system/dictionary-data';
  99. export default {
  100. components: {},
  101. data() {
  102. const defaultWhere = {
  103. qualitySchemeTemplateCode: '',
  104. qualitySchemeTemplateName: '',
  105. type: ''
  106. };
  107. return {
  108. visible: false,
  109. selection: [],
  110. current: null,
  111. radio: '',
  112. columns: [
  113. // {
  114. // width: 45,
  115. // type: 'selection',
  116. // columnKey: 'selection',
  117. // align: 'center',
  118. // reserveSelection: true
  119. // },
  120. {
  121. width: 55,
  122. columnKey: 'current',
  123. slot: 'current',
  124. align: 'center'
  125. },
  126. {
  127. columnKey: 'index',
  128. label: '序号',
  129. type: 'index',
  130. width: 55,
  131. align: 'center',
  132. showOverflowTooltip: true,
  133. fixed: 'left'
  134. },
  135. {
  136. prop: 'qualitySchemeTemplateCode',
  137. label: '质检方案编码',
  138. showOverflowTooltip: true,
  139. align: 'center',
  140. minWidth: 110
  141. },
  142. {
  143. prop: 'qualitySchemeTemplateName',
  144. label: '质检方案名称',
  145. align: 'center',
  146. minWidth: 150
  147. },
  148. {
  149. prop: 'type',
  150. label: '质检类型',
  151. slot: 'type',
  152. align: 'center',
  153. minWidth: 150,
  154. planList: this.typeList
  155. },
  156. {
  157. label: '状态',
  158. prop: 'status',
  159. slot: 'status',
  160. align: 'center'
  161. },
  162. {
  163. prop: 'templateRemark',
  164. label: '备注',
  165. showOverflowTooltip: true,
  166. align: 'center',
  167. minWidth: 110
  168. }
  169. ],
  170. where: { ...defaultWhere },
  171. typeList: []
  172. };
  173. },
  174. mounted() {
  175. this.getInspectionType();
  176. },
  177. methods: {
  178. datasource({ page, where, limit }) {
  179. console.log(1111);
  180. return getTemplateList({
  181. qualitySchemeTemplateCode: this.where.qualitySchemeTemplateCode,
  182. qualitySchemeTemplateName: this.where.qualitySchemeTemplateName,
  183. type: this.where.type,
  184. pageNum: page,
  185. size: limit
  186. });
  187. },
  188. // 多选
  189. selectionChangeHandle(val) {
  190. this.selection = val;
  191. },
  192. open() {
  193. this.visible = true;
  194. },
  195. search() {},
  196. reload() {
  197. this.$refs.table.reload();
  198. },
  199. handleClose() {
  200. this.$nextTick(() => {
  201. this.current = null;
  202. this.radio = '';
  203. });
  204. this.visible = false;
  205. },
  206. changeSel() {
  207. this.$emit('changeSel', this.current);
  208. this.handleClose();
  209. },
  210. handleCurrentChange(row) {
  211. this.radio = row.id;
  212. },
  213. reset() {
  214. this.where = { ...this.defaultWhere };
  215. this.reload();
  216. },
  217. async getInspectionType() {
  218. let res = await getByCode('inspection_plan_type');
  219. if (res?.code == 0) {
  220. let list = res.data.map((item) => {
  221. let key = Object.keys(item)[0];
  222. return { value: key, label: item[key] };
  223. });
  224. this.typeList = list;
  225. }
  226. }
  227. }
  228. };
  229. </script>