sampleListDialog.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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. show-overflow-tooltip
  23. >
  24. <template slot-scope="scope">
  25. <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
  26. {{ scope.row.qualitySchemeTemplateCode }}
  27. </span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column
  31. label="质检方案名称"
  32. prop="qualitySchemeTemplateName"
  33. align="center"
  34. show-overflow-tooltip
  35. >
  36. <template slot-scope="scope">
  37. <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
  38. {{ scope.row.qualitySchemeTemplateName }}
  39. </span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column
  43. label="质检类型"
  44. prop="categoryLevelClassName"
  45. align="center"
  46. show-overflow-tooltip
  47. >
  48. <template slot-scope="scope">
  49. <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
  50. {{ scope.row.categoryLevelClassName }}
  51. </span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column
  55. label="质检项编码"
  56. prop="inspectionCode"
  57. align="center"
  58. show-overflow-tooltip
  59. >
  60. <template slot-scope="scope">
  61. <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
  62. {{ scope.row.inspectionCode }}
  63. </span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. label="质检项名称"
  68. prop="inspectionName"
  69. align="center"
  70. show-overflow-tooltip
  71. >
  72. <template slot-scope="scope">
  73. <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
  74. {{ scope.row.inspectionName }}
  75. </span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. label="工艺参数"
  80. prop="defaultValue"
  81. align="center"
  82. show-overflow-tooltip
  83. >
  84. <template slot-scope="scope">
  85. <!-- <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
  86. {{ scope.row.defaultValue }}
  87. </span> -->
  88. <div
  89. style="display: flex; justify-content: center"
  90. :class="scope.row.qualityResults === 2 ? 'warn' : ''"
  91. >
  92. <span>{{ scope.row.symbol }}</span>
  93. <span v-if="scope.row.textType == 3">
  94. {{ scope.row.minValue }}-{{ scope.row.maxValue }}
  95. </span>
  96. <span v-else>
  97. <span>{{ scope.row.defaultValue }}</span>
  98. </span>
  99. {{ scope.row.unitName }}
  100. </div>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="质检工具" prop="" align="center">
  104. <template slot-scope="scope">
  105. <toolButtom
  106. v-model="scope.row.useTools"
  107. :type="type"
  108. :sList="scope.row.toolList"
  109. />
  110. </template>
  111. </el-table-column>
  112. <!-- @blur="(e) => inputResultContent(e, scope.row)" -->
  113. <el-table-column
  114. label="质检内容"
  115. prop="qualityResultContent"
  116. align="center"
  117. fixed="right"
  118. width="360"
  119. >
  120. <template slot-scope="scope">
  121. <el-input
  122. :class="scope.row.qualityResults === 2 ? 'warn' : ''"
  123. v-model="scope.row.qualityResultContent"
  124. placeholder="请输入内容"
  125. :disabled="type == 'detail'"
  126. @input="
  127. handleInput(scope.row, scope.row.qualityResultContent,tableData)
  128. "
  129. >
  130. <template slot="append" v-if="scope.row.unitName">
  131. {{ scope.row.unitName }}
  132. </template>
  133. </el-input>
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. label="质检结果"
  138. prop="qualityResults"
  139. align="center"
  140. fixed="right"
  141. >
  142. <template slot-scope="scope">
  143. <el-select
  144. v-model="scope.row.qualityResults"
  145. placeholder="请选择"
  146. style="width: 100%"
  147. @change="qualityResultsListChange(tableData)"
  148. :disabled="type == 'detail'"
  149. >
  150. <el-option
  151. v-for="item in qualityResultsList"
  152. :key="item.value"
  153. :label="item.label"
  154. :value="item.value"
  155. >
  156. </el-option>
  157. </el-select>
  158. </template>
  159. </el-table-column>
  160. </el-table>
  161. </div>
  162. </template>
  163. </el-table-column>
  164. <template v-for="column in tableColumns">
  165. <el-table-column
  166. :label="column.label"
  167. :prop="column.prop"
  168. :fixed="column.fixed"
  169. :show-overflow-tooltip="true"
  170. :width="column.width"
  171. :align="column.align"
  172. :formatter="column.formatter"
  173. >
  174. <!-- <template slot-scope="scope" v-if="column.slot=='qualityResults'">
  175. <el-select
  176. v-model="scope.row.qualityResults"
  177. placeholder="请选择"
  178. style="width: 100%"
  179. :disabled="type == 'detail'"
  180. >
  181. <el-option
  182. v-for="item in qualityResultsList"
  183. :key="item.value"
  184. :label="item.label"
  185. :value="item.value"
  186. >
  187. </el-option>
  188. </el-select>
  189. </template> -->
  190. </el-table-column>
  191. </template>
  192. <!-- <el-table-column label="操作" align="center" width="80">
  193. <template slot-scope="scope">
  194. <el-link
  195. :underline="false"
  196. type="primary"
  197. @click="handleDispose(scope.$index, scope.row, 'dispose')"
  198. >
  199. 处置
  200. </el-link>
  201. </template>
  202. </el-table-column> -->
  203. </el-table>
  204. <template v-slot:footer v-if="type == 'report'">
  205. <el-button @click="handleClose">取消</el-button>
  206. <el-button type="primary" @click="handleConfirm"> 确认 </el-button>
  207. </template>
  208. </ele-modal>
  209. </template>
  210. <script>
  211. import toolButtom from './toolButtom.vue';
  212. import {handleInput,qualityResultsListChange} from './unit.js';
  213. export default {
  214. components: {
  215. toolButtom
  216. },
  217. data() {
  218. return {
  219. handleInput,qualityResultsListChange,
  220. title: '',
  221. visible: false,
  222. rowIndex: 0,
  223. type: '',
  224. tableData: [],
  225. tableColumns: [
  226. {
  227. label: '编码',
  228. prop: 'categoryCode',
  229. width: '150',
  230. align: 'center'
  231. },
  232. {
  233. label: '名称',
  234. prop: 'categoryName',
  235. width: '150',
  236. align: 'center',
  237. showOverflowTooltip: true
  238. },
  239. { label: '批次号', prop: 'batchNo', align: 'center' },
  240. // { label: '发货条码', prop: 'barcodes', align: 'center' },
  241. { label: '包装编码', prop: 'packageNo', align: 'center' },
  242. { label: '样品编码', prop: 'sampleCode', align: 'center' },
  243. { label: '包装数量', prop: 'packingQuantity', align: 'center' },
  244. // { label: '包装单位', prop: 'packingUnit', align: 'center' },
  245. { label: '计量数量', prop: 'measureQuantity', align: 'center' },
  246. // { label: '计量单位', prop: 'measureUnit', align: 'center' },
  247. { label: '物料代号', prop: 'materielDesignation', align: 'center' },
  248. { label: '客户代号', prop: 'clientCode', align: 'center' },
  249. { label: '刻码', prop: 'engrave', align: 'center' },
  250. {
  251. label: '型号',
  252. prop: 'modelType',
  253. align: 'center',
  254. showOverflowTooltip: true
  255. },
  256. {
  257. label: '规格',
  258. prop: 'specification',
  259. align: 'center',
  260. showOverflowTooltip: true
  261. },
  262. {
  263. label: '电压等级',
  264. prop: 'voltage',
  265. align: 'center',
  266. showOverflowTooltip: true
  267. },
  268. { label: '重量', prop: 'weight', align: 'center' },
  269. { label: '重量单位', prop: 'weightUnit', align: 'center' },
  270. { label: '仓库', prop: 'warehouseName', align: 'center' },
  271. {
  272. label: '质检结果',
  273. prop: 'qualityResults',
  274. align: 'center',
  275. slot: 'qualityResults',
  276. formatter: (row, column) => {
  277. if (row.qualityResults) {
  278. return row.qualityResults == 1
  279. ? '合格'
  280. : row.qualityResults == 2
  281. ? '不合格'
  282. : row.qualityResults == 3
  283. ? '让步接收'
  284. : '';
  285. }
  286. }
  287. }
  288. // { label: '货区', prop: 'areaName', align: 'center', },
  289. // { label: '货架', prop: 'goodsShelfName', align: 'center', },
  290. // { label: '货位', prop: 'goodsAllocationName', align: 'center', },
  291. // { label: '生产日期', prop: 'productionDate', align: 'center', },
  292. // { label: '采购日期', prop: 'purchaseDate', align: 'center', }
  293. ],
  294. qualityResultsList: [
  295. {
  296. value: 1,
  297. label: '合格'
  298. },
  299. {
  300. value: 2,
  301. label: '不合格'
  302. },
  303. {
  304. value: 3,
  305. label: '让步接收'
  306. }
  307. ],
  308. sList: [] //质检工具筛选
  309. };
  310. },
  311. computed: {},
  312. created() {},
  313. methods: {
  314. async openDia(index, row, type, list, isStatus, sList) {
  315. this.tableData = [];
  316. this.rowIndex = index;
  317. this.type = type;
  318. // console.log(list, 'lklllllllllllllllllkkkkkkkkkkkkkkkkkkkkk', list[0].qualityResults);
  319. //如果质检项qualitySampleTemplateList只有一条数据且质检结果是让步接收
  320. if (list[0].qualitySampleTemplateList.length == 1) {
  321. for (let i = 0; i < list[0].qualitySampleTemplateList.length; i++) {
  322. list[0].qualitySampleTemplateList[i].qualityResults = list[0]
  323. .qualityResults
  324. ? list[0].qualityResults
  325. : 1;
  326. }
  327. }
  328. // 默认合格
  329. list.map((item) => {
  330. item.qualitySampleTemplateList &&
  331. item.qualitySampleTemplateList.map((el) => {
  332. el.qualityResults = el.qualityResults ? el.qualityResults : 1;
  333. });
  334. });
  335. this.tableData = JSON.parse(JSON.stringify(list));
  336. console.log(this.tableData, '33333333333333333');
  337. this.visible = true;
  338. },
  339. handleClose() {
  340. this.visible = false;
  341. },
  342. handleConfirm() {
  343. this.visible = false;
  344. this.$emit('handleConfirm', this.tableData, this.rowIndex);
  345. },
  346. handleDispose(index, row, type) {
  347. this.$emit('handleDispose', index, row, type);
  348. },
  349. //选择质检工具
  350. openToolList(index, row) {
  351. this.$emit('openToolList', index, row);
  352. }
  353. }
  354. };
  355. </script>
  356. <style scoped lang="scss">
  357. ::v-deep .warn {
  358. color: red;
  359. .el-input__inner {
  360. color: red;
  361. }
  362. }
  363. </style>