edit.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <div>
  3. <el-form
  4. :model="dataForm"
  5. :rules="dataRule"
  6. ref="dataForm"
  7. label-width="80px"
  8. :disabled="true"
  9. >
  10. <el-row style="margin-bottom: 10px">
  11. <el-col :span="6"
  12. ><el-form-item label="类型 " prop="type">
  13. <DictSelection
  14. dictName="质检计划类型"
  15. v-model="dataForm.type"
  16. clearable
  17. ></DictSelection> </el-form-item
  18. ></el-col>
  19. <el-col :span="7">
  20. <el-form-item label="名称" prop="qualitySchemeTemplateName">
  21. <el-input
  22. v-model="dataForm.qualitySchemeTemplateName"
  23. placeholder="质检方案名称"
  24. ></el-input>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="7">
  28. <el-form-item label="编码" prop="qualitySchemeTemplateCode">
  29. <el-input
  30. v-model="dataForm.qualitySchemeTemplateCode"
  31. placeholder="质检方案编码"
  32. disabled
  33. ></el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="4"
  37. ><el-form-item label="状态 " prop="status">
  38. <el-select
  39. clearable
  40. class="ele-block"
  41. v-model="dataForm.status"
  42. placeholder="请选择"
  43. >
  44. <el-option label="失效" :value="0" />
  45. <el-option label="有效" :value="1" />
  46. </el-select> </el-form-item
  47. ></el-col>
  48. </el-row>
  49. <el-row>
  50. <el-col :span="6">
  51. <el-form-item label="工序" prop="taskName">
  52. <el-input
  53. v-model="dataForm.taskName"
  54. placeholder="请选择"
  55. disabled
  56. ></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="18">
  60. <el-form-item label="备注" prop="templateRemark">
  61. <el-input
  62. type="textarea"
  63. v-model="dataForm.templateRemark"
  64. placeholder="请输入"
  65. ></el-input>
  66. </el-form-item>
  67. </el-col>
  68. </el-row>
  69. <el-row>
  70. <el-col :span="24">
  71. <div class="title"> 质检参数标准</div>
  72. </el-col>
  73. </el-row>
  74. <el-row>
  75. <el-col style="width: 260px">
  76. <el-form-item label="检验方式" prop="qualityMode">
  77. <DictSelection
  78. dictName="检验方案"
  79. clearable
  80. v-model="dataForm.qualityMode"
  81. >
  82. </DictSelection>
  83. </el-form-item>
  84. </el-col>
  85. <el-col style="width: 360px" v-if="dataForm.qualityMode == 2">
  86. <el-form-item label="取样数量" prop="sampleProportion">
  87. <el-input
  88. type="number"
  89. v-model="dataForm.sampleProportion"
  90. placeholder="请输入"
  91. style="width: 180px"
  92. ></el-input>
  93. <DictSelection
  94. style="width: 95px"
  95. dictName="计量单位"
  96. placeholder=" "
  97. v-model="dataForm.sampleProportionUnit"
  98. ></DictSelection>
  99. </el-form-item>
  100. </el-col>
  101. <el-col style="width: 430px">
  102. <el-form-item
  103. label="质检报告有效期"
  104. prop="validityPeriod"
  105. label-width="150px"
  106. >
  107. <el-input
  108. type="number"
  109. v-model="dataForm.validityPeriod"
  110. placeholder="请输入"
  111. style="width: 180px"
  112. ></el-input>
  113. <el-select
  114. style="width: 85px"
  115. v-model="dataForm.validityPeriodUnit"
  116. placeholder=" "
  117. >
  118. <el-option label="年" value="年" />
  119. <el-option label="月" value="月" />
  120. </el-select>
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. <el-row>
  125. <ele-pro-table
  126. ref="table"
  127. :columns="columns"
  128. :datasource="list"
  129. height="400px"
  130. full-height="calc(100vh - 76px)"
  131. tool-class="ele-toolbar-form"
  132. >
  133. <template v-slot:textType="{ row }">
  134. {{
  135. row.textType == 1
  136. ? '数值'
  137. : row.textType == 2
  138. ? '选择'
  139. : row.textType == 3
  140. ? '上下限'
  141. : row.textType == 4
  142. ? '规格'
  143. : row.textType == 5
  144. ? '时间'
  145. : row.textType == 6
  146. ? '范围'
  147. : row.textType == 7
  148. ? '文本'
  149. : ''
  150. }}
  151. </template>
  152. <template v-slot:type="{ row }">
  153. {{ getDictValue('质检标准类型', row.qualityStandardType) }}
  154. </template>
  155. <template v-slot:inspectionName="{ row }">
  156. <div> <el-input v-model="row.inspectionName"></el-input></div>
  157. </template>
  158. <template v-slot:sort="{ row }">
  159. <el-input
  160. v-model="row.sort"
  161. type="number"
  162. @blur="handleSortBlur"
  163. placeholder="输入排序"
  164. ></el-input>
  165. </template>
  166. <template v-slot:defaultValue="{ row, $index }">
  167. <div style="width: 100%; display: flex">
  168. <DictSelection
  169. style="width: 85px"
  170. clearable
  171. dictName="数学字符"
  172. v-model="row.symbol"
  173. :isOne="$index === 0"
  174. ></DictSelection>
  175. <div v-if="row.textType == 3">
  176. <el-input v-model="row.minValue" style="width: 80px"></el-input
  177. >-
  178. <el-input v-model="row.maxValue" style="width: 80px">
  179. </el-input>
  180. </div>
  181. <div v-else style="width: 100%">
  182. <el-input v-model="row.defaultValue"></el-input>
  183. </div>
  184. <DictSelection
  185. dictName="工艺参数单位"
  186. clearable
  187. filterable
  188. v-model="row.unitName"
  189. style="width: 100px"
  190. :isOne="$index === 0"
  191. >
  192. </DictSelection>
  193. </div>
  194. </template>
  195. <template v-slot:executionMethod="{ row }">
  196. <el-select v-model="row.executionMethod" style="width: 100%">
  197. <el-option :value="1" label="常规检验"></el-option>
  198. <el-option :value="2" label="实验"></el-option>
  199. </el-select>
  200. </template>
  201. <template v-slot:procedureName="{ row, $index }">
  202. <el-input
  203. v-model="row.procedureName"
  204. readonly
  205. style="width: calc(100% - 60px)"
  206. >
  207. </el-input>
  208. <el-button
  209. type="primary"
  210. @click="viewTemplate(row.procedureJson.tempJson, 5, $index)"
  211. v-if="row.procedureJson.tempJson"
  212. style="margin-left: 8px"
  213. :disabled="false"
  214. >预览</el-button
  215. >
  216. </template>
  217. <template v-slot:recordName="{ row, $index }">
  218. <el-input
  219. v-model="row.recordName"
  220. readonly
  221. style="width: calc(100% - 60px)"
  222. >
  223. </el-input>
  224. <el-button
  225. type="primary"
  226. @click="viewTemplate(row.recordJson.tempJson, 7, $index)"
  227. v-if="row.recordJson.tempJson"
  228. style="margin-left: 8px"
  229. :disabled="false"
  230. >预览</el-button
  231. >
  232. </template>
  233. </ele-pro-table>
  234. </el-row>
  235. <el-row>
  236. <ele-pro-table
  237. ref="table"
  238. :columns="categoryColumns"
  239. :datasource="templateCategoryList"
  240. height="300px"
  241. full-height="calc(100vh - 76px)"
  242. tool-class="ele-toolbar-form"
  243. :need-page="false"
  244. >
  245. </ele-pro-table>
  246. </el-row>
  247. </el-form>
  248. <experimentationProcessDialog
  249. ref="experimentationProcessDialog"
  250. :edit="false"
  251. :readonly="true"
  252. ></experimentationProcessDialog>
  253. </div>
  254. </template>
  255. <script>
  256. import experimentationProcessDialog from '@/components/templateDiv/experimentationProcessDialog.vue';
  257. import {
  258. getById,
  259. templatecategoryPage
  260. } from '@/api/bpm/components/inspectionTemplate';
  261. import dictMixins from '@/mixins/dictMixins';
  262. export default {
  263. components: { experimentationProcessDialog },
  264. mixins: [dictMixins],
  265. props: {
  266. businessId: {
  267. type: String,
  268. default: ''
  269. }
  270. },
  271. data() {
  272. return {
  273. dataForm: {
  274. id: 0,
  275. type: null,
  276. qualitySchemeTemplateName: '',
  277. qualitySchemeTemplateCode: '',
  278. inspectionItemVOList: [],
  279. status: 1,
  280. templateRemark: '',
  281. sampleProportion: '',
  282. sampleProportionUnit: '%',
  283. validityPeriod: '',
  284. validityPeriodUnit: '',
  285. qualityMode: '',
  286. taskId: '',
  287. taskName: ''
  288. },
  289. columns: [
  290. {
  291. columnKey: 'index',
  292. label: '序号',
  293. type: 'index',
  294. width: 55,
  295. align: 'center',
  296. showOverflowTooltip: true,
  297. fixed: 'left'
  298. },
  299. {
  300. label: '排序',
  301. width: 100,
  302. align: 'center',
  303. slot: 'sort',
  304. prop: 'sort',
  305. fixed: 'left'
  306. },
  307. {
  308. prop: 'categoryLevelClassName',
  309. label: '质检类型',
  310. align: 'center',
  311. minWidth: 150
  312. },
  313. {
  314. prop: 'inspectionCode',
  315. label: '编码',
  316. showOverflowTooltip: true,
  317. align: 'center',
  318. minWidth: 150
  319. },
  320. {
  321. prop: 'inspectionName',
  322. slot: 'inspectionName',
  323. label: '名称',
  324. showOverflowTooltip: true,
  325. align: 'center',
  326. minWidth: 150
  327. },
  328. {
  329. prop: 'defaultValue',
  330. slot: 'defaultValue',
  331. label: '工艺参数',
  332. align: 'center',
  333. minWidth: 400,
  334. columnKey: 'defaultValue'
  335. },
  336. {
  337. prop: 'executionMethod',
  338. slot: 'executionMethod',
  339. label: '执行方式',
  340. showOverflowTooltip: true,
  341. align: 'center',
  342. width: 150
  343. },
  344. {
  345. prop: 'procedureName',
  346. slot: 'procedureName',
  347. label: '实验过程',
  348. showOverflowTooltip: true,
  349. align: 'center',
  350. minWidth: 200
  351. },
  352. {
  353. prop: 'recordName',
  354. slot: 'recordName',
  355. label: '实验记录',
  356. showOverflowTooltip: true,
  357. align: 'center',
  358. minWidth: 200
  359. }
  360. ],
  361. categoryColumns: [
  362. {
  363. columnKey: 'index',
  364. label: '序号',
  365. type: 'index',
  366. width: 55,
  367. align: 'center',
  368. showOverflowTooltip: true,
  369. fixed: 'left'
  370. },
  371. {
  372. prop: 'categoryLevelPath',
  373. label: '分类',
  374. align: 'center',
  375. minWidth: 150
  376. },
  377. {
  378. prop: 'code',
  379. label: '编码',
  380. showOverflowTooltip: true,
  381. align: 'center',
  382. minWidth: 150
  383. },
  384. {
  385. prop: 'name',
  386. label: '名称',
  387. showOverflowTooltip: true,
  388. align: 'center',
  389. minWidth: 150
  390. },
  391. {
  392. prop: 'specification',
  393. label: '规格',
  394. align: 'center',
  395. minWidth: 150
  396. },
  397. {
  398. prop: 'modelType',
  399. label: '型号',
  400. align: 'center',
  401. minWidth: 150
  402. },
  403. {
  404. prop: 'brandNum',
  405. label: '牌号',
  406. align: 'center',
  407. minWidth: 150
  408. }
  409. ],
  410. dataRule: {
  411. type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
  412. qualitySchemeTemplateName: [
  413. { required: true, message: '请输入质检方案名称', trigger: 'blur' }
  414. ],
  415. status: [
  416. {
  417. required: true,
  418. message: '请选择状态',
  419. trigger: 'blur'
  420. }
  421. ]
  422. },
  423. list: [],
  424. templateCategoryList: []
  425. };
  426. },
  427. created() {
  428. this.init();
  429. },
  430. methods: {
  431. async viewTemplate(tempJson) {
  432. this.$refs.experimentationProcessDialog.open(tempJson);
  433. },
  434. init() {
  435. getById(this.businessId).then(({ data }) => {
  436. this.dataForm = data;
  437. console.log(this.dataForm, 'this.dataForm');
  438. this.list = data.inspectionItemVOList || [];
  439. });
  440. templatecategoryPage({
  441. templateId: this.businessId,
  442. size: -1
  443. }).then((data) => {
  444. this.templateCategoryList = data.list;
  445. });
  446. }
  447. }
  448. };
  449. </script>
  450. <style lang="scss" scoped>
  451. .title {
  452. font-weight: bold;
  453. padding-bottom: 20px;
  454. padding-top: 20px;
  455. }
  456. </style>