inspectionProjectList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <div>
  3. <div class="title">质检项</div>
  4. <el-table :data="listPage" border height="30vh">
  5. <el-table-column
  6. label="序号"
  7. align="center"
  8. prop="inspectionCode"
  9. width="50"
  10. >
  11. <template slot-scope="scope">
  12. <span>{{ scope.$index + 1 }}</span>
  13. </template>
  14. </el-table-column>
  15. <el-table-column label="编码" align="center" prop="inspectionCode">
  16. </el-table-column>
  17. <el-table-column label="质检项名称" align="center" prop="inspectionName">
  18. </el-table-column>
  19. <el-table-column
  20. label="质检标准"
  21. align="center"
  22. prop="inspectionStandard"
  23. width="300px"
  24. >
  25. <template slot-scope="scope">
  26. <el-form-item label-width="0" prop="inspectionStandard">
  27. <el-input
  28. clearable
  29. v-model="scope.row.inspectionStandard"
  30. placeholder="请输入"
  31. @change="changeValue"
  32. :disabled="disabled"
  33. >
  34. <span slot="suffix"> {{ scope.row.unit }}</span>
  35. <DictSelection
  36. style="width: 80px"
  37. slot="prepend"
  38. clearable
  39. dictName="数学字符"
  40. v-model="scope.row.symbol"
  41. ></DictSelection>
  42. </el-input>
  43. </el-form-item>
  44. </template>
  45. </el-table-column>
  46. <!-- <el-table-column label="质检工具" align="center" prop="inspectionTool">
  47. </el-table-column> -->
  48. <el-table-column label="描述" align="center" prop="description">
  49. </el-table-column>
  50. <el-table-column label="操作" align="center" width="70" v-if="!disabled">
  51. <template slot-scope="scope">
  52. <el-link
  53. type="danger"
  54. :underline="false"
  55. @click="handleDeleteItem(scope.$index, scope.row.id)"
  56. >
  57. 删除
  58. </el-link>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <div class="add-product" @click="addEquipment" v-if="!disabled">
  63. <i class="el-icon-circle-plus-outline"></i>
  64. </div>
  65. <EquipmentDialog ref="equipmentDialog" @choose="choose" />
  66. </div>
  67. </template>
  68. <script>
  69. import EquipmentDialog from './EquipmentDialog';
  70. export default {
  71. components: { EquipmentDialog },
  72. props: {
  73. list: {
  74. type: Array,
  75. default() {
  76. return [];
  77. }
  78. },
  79. disabled: {
  80. type: Boolean,
  81. default: false
  82. },
  83. type: {}
  84. },
  85. data() {
  86. return {
  87. listPage: []
  88. };
  89. },
  90. created() {
  91. console.log(this.list, 'this.list');
  92. this.listPage = JSON.parse(JSON.stringify(this.list));
  93. },
  94. methods: {
  95. choose(data) {
  96. this.listPage = data;
  97. this.$emit('changeDate', data);
  98. },
  99. handleDeleteItem(index, id) {
  100. this.listPage.splice(index, 1);
  101. this.$emit('changeDate', this.listPage);
  102. },
  103. changeValue() {
  104. this.$emit('changeDate', this.listPage);
  105. },
  106. addEquipment() {
  107. this.$refs.equipmentDialog.open(this.listPage.map((item) => item.id));
  108. },
  109. getValue() {
  110. return this.listPage.map((item) => item.id).toString();
  111. }
  112. }
  113. };
  114. </script>
  115. <style lang="scss" scoped>
  116. .title {
  117. font-size: 16px;
  118. margin-bottom: 20px;
  119. }
  120. .add-product {
  121. width: 100%;
  122. display: flex;
  123. align-items: center;
  124. justify-content: flex-end;
  125. font-size: 30px;
  126. color: #1890ff;
  127. margin: 10px 0;
  128. cursor: pointer;
  129. }
  130. </style>