detailDialog.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <div style="margin-top: 10px; padding: 0 20px">
  3. <el-form
  4. ref="formRef"
  5. :model="form"
  6. :rules="rules"
  7. label-width="100px"
  8. disabled
  9. >
  10. <header-title title="基本信息"></header-title>
  11. <el-row :gutter="10">
  12. <el-col :span="8">
  13. <el-form-item label="放行单编码">
  14. <el-input
  15. v-model="form.code"
  16. placeholder="系统自动生成"
  17. disabled
  18. ></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="8">
  22. <el-form-item label="放行单名称" prop="name">
  23. <el-input v-model="form.name" placeholder="请输入"></el-input>
  24. </el-form-item>
  25. </el-col>
  26. </el-row>
  27. <header-title title="物品清单"> </header-title>
  28. <ele-pro-table
  29. ref="table"
  30. row-key="userId"
  31. :columns="ordersColumns"
  32. :datasource="form.orders"
  33. >
  34. <template v-slot:action="{ row }">
  35. <el-link icon="el-icon-edit" type="primary" :underline="false"
  36. >详情</el-link
  37. >
  38. </template>
  39. </ele-pro-table>
  40. <header-title title="生产放行规则"> </header-title>
  41. <ele-pro-table
  42. ref="scTable"
  43. row-key="id"
  44. :columns="detailsColumns"
  45. :datasource="scDetails"
  46. >
  47. <template v-slot:isPass="{ row }">
  48. <el-radio-group v-model="row.isPass">
  49. <el-radio :label="1">是</el-radio>
  50. <el-radio :label="0">否</el-radio>
  51. </el-radio-group>
  52. </template>
  53. <template v-slot:remark="{ row }">
  54. <el-input
  55. type="textarea"
  56. v-model="row.remark"
  57. placeholder="请输入备注"
  58. :rows="1"
  59. ></el-input>
  60. </template>
  61. </ele-pro-table>
  62. <table
  63. class="detail-table"
  64. key="first-table"
  65. style="width: 500px; margin: 15px 0"
  66. >
  67. <tr>
  68. <td>结论</td>
  69. <td>
  70. <el-radio-group v-model="form.workConclution">
  71. <el-radio :label="0">不符合规定</el-radio>
  72. <el-radio :label="1">符合规定</el-radio>
  73. </el-radio-group>
  74. </td>
  75. </tr>
  76. <tr>
  77. <td>验收人</td>
  78. <td>
  79. <div class="mask-box">
  80. <el-input
  81. v-model="form.workCheckUserName"
  82. placeholder="请输选择验收人"
  83. readonly
  84. ></el-input>
  85. </div>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td>验收时间</td>
  90. <td>
  91. <el-date-picker
  92. v-model="form.workCheckTime"
  93. type="datetime"
  94. placeholder="选择日期时间"
  95. style="width: 100%"
  96. value-format="yyyy-MM-dd HH:mm:ss"
  97. ></el-date-picker>
  98. </td>
  99. </tr>
  100. </table>
  101. <header-title title="质检放行规则"></header-title>
  102. <ele-pro-table
  103. ref="zjTable"
  104. row-key="id"
  105. :columns="detailsColumns"
  106. :datasource="zjDetails"
  107. >
  108. <template v-slot:isPass="{ row }">
  109. <el-radio-group v-model="row.isPass">
  110. <el-radio :label="1">是</el-radio>
  111. <el-radio :label="0">否</el-radio>
  112. </el-radio-group>
  113. </template>
  114. <template v-slot:remark="{ row }">
  115. <el-input
  116. type="textarea"
  117. v-model="row.remark"
  118. placeholder="请输入备注"
  119. :rows="1"
  120. ></el-input>
  121. </template>
  122. </ele-pro-table>
  123. <table
  124. class="detail-table"
  125. key="tow"
  126. style="width: 500px; margin: 15px 0"
  127. >
  128. <tr>
  129. <td>结论</td>
  130. <td>
  131. <el-radio-group v-model="form.qualityConclution">
  132. <el-radio :label="0">不符合规定</el-radio>
  133. <el-radio :label="1">符合规定</el-radio>
  134. </el-radio-group>
  135. </td>
  136. </tr>
  137. <tr>
  138. <td>验收人</td>
  139. <td>
  140. <div class="mask-box" @click="openSelectUser(1)">
  141. <el-input
  142. v-model="form.qualityCheckUserName"
  143. placeholder="请输选择验收人"
  144. readonly
  145. ></el-input>
  146. </div>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td>验收时间</td>
  151. <td>
  152. <el-date-picker
  153. v-model="form.qualityCheckTime"
  154. type="datetime"
  155. placeholder="选择日期时间"
  156. style="width: 100%"
  157. value-format="yyyy-MM-dd HH:mm:ss"
  158. ></el-date-picker>
  159. </td>
  160. </tr>
  161. </table>
  162. </el-form>
  163. </div>
  164. </template>
  165. <script>
  166. import dictMixins from '@/mixins/dictMixins';
  167. import { checklisttemplateGetById } from '@/api/checklisttemplate/index';
  168. import { checklistrecordGetById } from '@/api/checklistrecord/index';
  169. export default {
  170. mixins: [dictMixins],
  171. components: {},
  172. props: {
  173. // 业务id
  174. businessId: {
  175. default: ''
  176. }
  177. },
  178. mounted() {
  179. console.log('this.businessId', this.businessId);
  180. this.getCheckDetails(this.businessId);
  181. },
  182. data() {
  183. const formBaseData = {
  184. id: null,
  185. approvalStatus: null,
  186. checklistType: 0,
  187. code: '',
  188. createUserName: '',
  189. details: [],
  190. name: '',
  191. orders: [],
  192. processInstanceId: '',
  193. qualityCheckTime: '',
  194. qualityCheckUserId: null,
  195. qualityCheckUserName: '',
  196. qualityConclution: null,
  197. templateId: 0,
  198. templateName: '',
  199. workCheckTime: '',
  200. workCheckUserId: null,
  201. workCheckUserName: '',
  202. workConclution: null
  203. };
  204. return {
  205. visible: false,
  206. title: '放行申请单',
  207. formBaseData,
  208. form: JSON.parse(JSON.stringify(formBaseData)),
  209. rules: {
  210. name: [
  211. { required: true, message: '请输入放行单名称', trigger: 'blur' },
  212. { required: true, message: '请输入放行单名称', trigger: 'change' }
  213. ]
  214. },
  215. // 类型 add / edit / detail
  216. type: '',
  217. // 生产工单查询条件
  218. workOrderWhere: {
  219. statusList: ['6']
  220. },
  221. loading: false,
  222. butLoading: false,
  223. tabOptions: [
  224. { key: 'main', name: '放行单详情' },
  225. { key: 'bpm', name: '流程详情' }
  226. ],
  227. // 当前选项
  228. activeComp: 'main',
  229. showSelectUser: false,
  230. // 0 生产验收人 1 质检验收人
  231. selectUserType: 0
  232. };
  233. },
  234. watch: {
  235. 'form.details': {
  236. handler(details) {
  237. console.log('details', details);
  238. // 区分生产放行规则 质检放行规则
  239. // 根据 审核结果修改 结论
  240. const scDetails = details.filter((item) => item.checkType == 1);
  241. const zjDetails = details.filter((item) => item.checkType == 2);
  242. // 当workConclution全为1 则为1 否则为0
  243. if (scDetails.length > 0) {
  244. const allPass = scDetails
  245. .map((item) => item.isPass)
  246. .every((val) => val === 1);
  247. this.form.workConclution = allPass ? 1 : 0;
  248. } else {
  249. this.form.workConclution = null;
  250. }
  251. if (zjDetails.length > 0) {
  252. const allPass = zjDetails
  253. .map((item) => item.isPass)
  254. .every((val) => val == 1);
  255. this.form.qualityConclution = allPass ? 1 : 0;
  256. } else {
  257. this.form.qualityConclution = null;
  258. }
  259. },
  260. deep: true
  261. }
  262. },
  263. computed: {
  264. ordersColumns() {
  265. return [
  266. {
  267. width: 55,
  268. type: 'index',
  269. columnKey: 'index',
  270. label: '序号',
  271. align: 'center'
  272. },
  273. {
  274. prop: 'batchNo',
  275. label: '批次号',
  276. align: 'center',
  277. minWidth: 110,
  278. showOverflowTooltip: true
  279. },
  280. {
  281. prop: 'productCode',
  282. label: '产品编码',
  283. align: 'center',
  284. minWidth: 110,
  285. showOverflowTooltip: true
  286. },
  287. {
  288. prop: 'productName',
  289. label: '产品名称',
  290. align: 'center',
  291. minWidth: 110,
  292. showOverflowTooltip: true
  293. },
  294. {
  295. prop: 'workOrderCode',
  296. label: '生产工单号',
  297. align: 'center',
  298. minWidth: 110,
  299. showOverflowTooltip: true
  300. },
  301. {
  302. prop: 'formingNum',
  303. label: '数量',
  304. align: 'center',
  305. minWidth: 110,
  306. showOverflowTooltip: true
  307. },
  308. {
  309. prop: 'specification',
  310. label: '规格',
  311. align: 'center',
  312. minWidth: 110,
  313. showOverflowTooltip: true
  314. },
  315. {
  316. prop: 'productModel',
  317. label: '型号',
  318. align: 'center',
  319. minWidth: 110,
  320. showOverflowTooltip: true
  321. },
  322. {
  323. label: '操作',
  324. columnKey: 'action',
  325. slot: 'action',
  326. minWidth: 120
  327. }
  328. ];
  329. },
  330. // 生产放行规则
  331. scDetails() {
  332. return this.form.details.filter((item) => item.checkType == 1);
  333. },
  334. // 质检放行规则
  335. zjDetails() {
  336. return this.form.details.filter((item) => item.checkType == 2);
  337. },
  338. detailsColumns() {
  339. return [
  340. {
  341. width: 55,
  342. type: 'index',
  343. columnKey: 'index',
  344. label: '序号',
  345. align: 'center'
  346. },
  347. {
  348. prop: 'mainIndicatorName',
  349. label: '指标名称',
  350. align: 'center',
  351. minWidth: 110,
  352. showOverflowTooltip: true
  353. },
  354. {
  355. prop: 'isPass',
  356. label: '审核结果',
  357. align: 'center',
  358. slot: 'isPass',
  359. minWidth: 110,
  360. showOverflowTooltip: true
  361. },
  362. {
  363. prop: 'remark',
  364. label: '备注',
  365. align: 'center',
  366. slot: 'remark',
  367. minWidth: 110,
  368. showOverflowTooltip: true
  369. }
  370. ];
  371. }
  372. },
  373. methods: {
  374. // 获取放行单详情
  375. async getCheckDetails(id) {
  376. this.loading = true;
  377. try {
  378. const data = await checklistrecordGetById(id);
  379. this.$util.assignObject(this.form, data);
  380. console.log('this.form', this.form);
  381. this.loading = false;
  382. } catch (error) {
  383. this.loading = false;
  384. }
  385. }
  386. }
  387. };
  388. </script>
  389. <style scoped lang="scss">
  390. .detail-table {
  391. border: 1px solid #ebeef5;
  392. // 实线边框
  393. border-collapse: collapse;
  394. td {
  395. border: none;
  396. padding: 10px 15px;
  397. border: 1px solid #ebeef5;
  398. &:first-child {
  399. font-weight: 600;
  400. background: #f5f7fa;
  401. width: 130px;
  402. text-align: center;
  403. }
  404. }
  405. }
  406. .mask-box {
  407. position: relative;
  408. &::after {
  409. content: '';
  410. width: 100%;
  411. height: 100%;
  412. position: absolute;
  413. top: 0;
  414. left: 0;
  415. background: rgba(0, 0, 0, 0);
  416. cursor: pointer;
  417. }
  418. }
  419. </style>