sampleListDialog.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <!-- 用户编辑弹窗 -->
  2. <template>
  3. <ele-modal
  4. :title="title"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. append-to-body
  10. width="80%"
  11. :maxable="true"
  12. >
  13. <el-table :data="tableData" :default-expand-all="true">
  14. <el-table-column type="expand">
  15. <template slot-scope="props">
  16. <div style="padding: 10px">
  17. <el-table :data="props.row.qualitySampleTemplateList" border>
  18. <el-table-column
  19. label="质检方案编码"
  20. prop="qualitySchemeTemplateCode"
  21. align="center"
  22. >
  23. </el-table-column>
  24. <el-table-column
  25. label="质检方案名称"
  26. prop="qualitySchemeTemplateName"
  27. align="center"
  28. ></el-table-column>
  29. <el-table-column
  30. label="质检类型"
  31. prop="categoryLevelClassName"
  32. align="center"
  33. ></el-table-column>
  34. <el-table-column
  35. label="质检项编码"
  36. prop="inspectionCode"
  37. align="center"
  38. ></el-table-column>
  39. <el-table-column
  40. label="质检项名称"
  41. prop="inspectionName"
  42. align="center"
  43. ></el-table-column>
  44. <el-table-column
  45. label="工艺参数"
  46. prop="defaultValue"
  47. align="center"
  48. >
  49. </el-table-column>
  50. <el-table-column label="质检工具" prop="" align="center">
  51. <template slot-scope="scope">
  52. <toolButtom
  53. v-model="scope.row.useTools"
  54. :type="type"
  55. :sList="scope.row.toolList"
  56. />
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. label="质检内容"
  61. prop="qualityResultContent"
  62. align="center"
  63. fixed="right"
  64. width="360"
  65. >
  66. <template slot-scope="scope">
  67. <el-input
  68. v-model="scope.row.qualityResultContent"
  69. placeholder="请输入内容"
  70. :disabled="type == 'detail'"
  71. ></el-input>
  72. </template>
  73. </el-table-column>
  74. <el-table-column
  75. label="质检结果"
  76. prop="qualityResults"
  77. align="center"
  78. fixed="right"
  79. >
  80. <template slot-scope="scope">
  81. <el-select
  82. v-model="scope.row.qualityResults"
  83. placeholder="请选择"
  84. style="width: 100%"
  85. @change="qualityResultsListChange"
  86. :disabled="type == 'detail'"
  87. >
  88. <el-option
  89. v-for="item in qualityResultsList"
  90. :key="item.value"
  91. :label="item.label"
  92. :value="item.value"
  93. >
  94. </el-option>
  95. </el-select>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. </div>
  100. </template>
  101. </el-table-column>
  102. <template v-for="column in tableColumns">
  103. <el-table-column
  104. :label="column.label"
  105. :prop="column.prop"
  106. :fixed="column.fixed"
  107. :show-overflow-tooltip="true"
  108. :width="column.width"
  109. :align="column.align"
  110. :formatter="column.formatter"
  111. >
  112. <!-- <template slot-scope="scope" v-if="column.slot=='qualityResults'">
  113. <el-select
  114. v-model="scope.row.qualityResults"
  115. placeholder="请选择"
  116. style="width: 100%"
  117. :disabled="type == 'detail'"
  118. >
  119. <el-option
  120. v-for="item in qualityResultsList"
  121. :key="item.value"
  122. :label="item.label"
  123. :value="item.value"
  124. >
  125. </el-option>
  126. </el-select>
  127. </template> -->
  128. </el-table-column>
  129. </template>
  130. <!-- <el-table-column label="操作" align="center" width="80">
  131. <template slot-scope="scope">
  132. <el-link
  133. :underline="false"
  134. type="primary"
  135. @click="handleDispose(scope.$index, scope.row, 'dispose')"
  136. >
  137. 处置
  138. </el-link>
  139. </template>
  140. </el-table-column> -->
  141. </el-table>
  142. <template v-slot:footer v-if="type == 'report'">
  143. <el-button @click="handleClose">取消</el-button>
  144. <el-button type="primary" @click="handleConfirm"> 确认 </el-button>
  145. </template>
  146. </ele-modal>
  147. </template>
  148. <script>
  149. import index from 'ele-admin/lib/ele-avatar-list';
  150. import toolButtom from './toolButtom.vue';
  151. export default {
  152. components: {
  153. toolButtom
  154. },
  155. data() {
  156. return {
  157. title: '',
  158. visible: false,
  159. rowIndex: 0,
  160. type: '',
  161. tableData: [],
  162. tableColumns: [
  163. {
  164. label: '编码',
  165. prop: 'categoryCode',
  166. width: '150',
  167. align: 'center'
  168. },
  169. {
  170. label: '名称',
  171. prop: 'categoryName',
  172. width: '150',
  173. align: 'center'
  174. },
  175. { label: '批次号', prop: 'batchNo', align: 'center' },
  176. // { label: '发货条码', prop: 'barcodes', align: 'center' },
  177. { label: '包装编码', prop: 'packageNo', align: 'center' },
  178. { label: '包装数量', prop: 'packingQuantity', align: 'center' },
  179. // { label: '包装单位', prop: 'packingUnit', align: 'center' },
  180. { label: '计量数量', prop: 'measureQuantity', align: 'center' },
  181. // { label: '计量单位', prop: 'measureUnit', align: 'center' },
  182. { label: '物料代号', prop: 'materielDesignation', align: 'center' },
  183. { label: '客户代号', prop: 'clientCode', align: 'center' },
  184. { label: '刻码', prop: 'engrave', align: 'center' },
  185. { label: '重量', prop: 'weight', align: 'center' },
  186. { label: '重量单位', prop: 'weightUnit', align: 'center' },
  187. { label: '仓库', prop: 'warehouseName', align: 'center' },
  188. {
  189. label: '质检结果',
  190. prop: 'qualityResults',
  191. align: 'center',
  192. slot: 'qualityResults',
  193. formatter: (row, column) => {
  194. if (row.qualityResults) {
  195. return row.qualityResults == 1
  196. ? '合格'
  197. : row.qualityResults == 2
  198. ? '不合格'
  199. : row.qualityResults == 3
  200. ? '让步接收'
  201. : '';
  202. }
  203. }
  204. }
  205. // { label: '货区', prop: 'areaName', align: 'center', },
  206. // { label: '货架', prop: 'goodsShelfName', align: 'center', },
  207. // { label: '货位', prop: 'goodsAllocationName', align: 'center', },
  208. // { label: '生产日期', prop: 'productionDate', align: 'center', },
  209. // { label: '采购日期', prop: 'purchaseDate', align: 'center', }
  210. ],
  211. qualityResultsList: [
  212. {
  213. value: 1,
  214. label: '合格'
  215. },
  216. {
  217. value: 2,
  218. label: '不合格'
  219. },
  220. {
  221. value: 3,
  222. label: '让步接收'
  223. }
  224. ],
  225. sList: [] //质检工具筛选
  226. };
  227. },
  228. computed: {},
  229. created() {},
  230. methods: {
  231. async openDia(index, row, type, list, isStatus, sList) {
  232. this.tableData = [];
  233. this.rowIndex = index;
  234. this.type = type;
  235. // console.log(list, 'lklllllllllllllllllkkkkkkkkkkkkkkkkkkkkk', list[0].qualityResults);
  236. //如果质检项qualitySampleTemplateList只有一条数据且质检结果是让步接收
  237. if (list[0].qualitySampleTemplateList.length == 1) {
  238. for (let i = 0; i < list[0].qualitySampleTemplateList.length; i++) {
  239. list[0].qualitySampleTemplateList[i].qualityResults =
  240. list[0].qualityResults;
  241. }
  242. }
  243. this.tableData = JSON.parse(JSON.stringify(list));
  244. console.log( this.tableData,'33333333333333333');
  245. this.visible = true;
  246. },
  247. qualityResultsListChange() {
  248. this.tableData.forEach((item, index) => {
  249. this.$set(
  250. this.tableData[index],
  251. 'qualityResults',
  252. this.getQuality(item.qualitySampleTemplateList)
  253. );
  254. });
  255. },
  256. getQuality(arr) {
  257. let getQualityValue = 1;
  258. arr.forEach((item) => {
  259. if (item.qualityResults == 2) {
  260. getQualityValue = 2;
  261. }
  262. });
  263. return getQualityValue;
  264. },
  265. handleClose() {
  266. this.visible = false;
  267. },
  268. handleConfirm() {
  269. this.visible = false;
  270. this.$emit('handleConfirm', this.tableData, this.rowIndex);
  271. },
  272. handleDispose(index, row, type) {
  273. this.$emit('handleDispose', index, row, type);
  274. },
  275. //选择质检工具
  276. openToolList(index, row) {
  277. this.$emit('openToolList', index, row);
  278. }
  279. }
  280. };
  281. </script>