permitAdd.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. <template>
  2. <ele-modal
  3. :title="dialogTitle"
  4. :visible.sync="visible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. width="80%"
  9. :maxable="true"
  10. >
  11. <el-form
  12. label-width="115px"
  13. :model="formData"
  14. :rules="formRules"
  15. ref="formRef"
  16. >
  17. <el-row style="margin-bottom: 10px">
  18. <el-col :span="8">
  19. <el-form-item label="记录规则类型" prop="classify" required>
  20. <el-select
  21. style="width: 100%"
  22. v-model="formData.classify"
  23. placeholder="请选择"
  24. >
  25. <el-option
  26. v-for="item in recordSheet"
  27. :key="item.value"
  28. :label="item.label"
  29. :value="item.value"
  30. >
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="8">
  36. <el-form-item label="记录规则编码" prop="code">
  37. <el-input
  38. v-model="formData.code"
  39. size="small"
  40. :disabled="true"
  41. placeholder="系统自动生成"
  42. ></el-input>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="8">
  46. <el-form-item label="记录规则版本" prop="version">
  47. <el-input
  48. :value="versionText"
  49. size="small"
  50. disabled
  51. placeholder="系统自动生成"
  52. ></el-input>
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. <el-row style="margin-bottom: 10px">
  57. <el-col :span="8">
  58. <el-form-item label="记录规则名称" prop="name">
  59. <el-input
  60. v-model="formData.name"
  61. placeholder="请输入"
  62. size="small"
  63. ></el-input>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="8">
  67. <el-form-item label="启用日期" required prop="startDate">
  68. <el-date-picker
  69. v-model="formData.startDate"
  70. type="date"
  71. placeholder="请选择启用日期"
  72. size="small"
  73. style="width: 100%"
  74. ></el-date-picker>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="8">
  78. <el-form-item label="停用日期" required prop="stopDate">
  79. <el-date-picker
  80. v-model="formData.stopDate"
  81. type="date"
  82. placeholder="请选择停用日期"
  83. size="small"
  84. style="width: 100%"
  85. />
  86. </el-form-item>
  87. </el-col>
  88. <el-col v-if="formData.classify == 3" :span="8">
  89. <el-form-item label="关联设备" prop="deviceName" required>
  90. <el-input
  91. v-model="formData.deviceName"
  92. placeholder="请选择设备"
  93. size="small"
  94. :readonly="true"
  95. >
  96. <template #append>
  97. <el-button size="small" @click="selectDeviceId"
  98. >选择设备</el-button
  99. >
  100. </template>
  101. </el-input>
  102. </el-form-item>
  103. </el-col>
  104. </el-row>
  105. <el-row style="margin-bottom: 10px">
  106. <el-col :span="24">
  107. <el-form-item label="周期" prop="frequencyValue" required>
  108. <rule-cycle
  109. ref="cycleMultipleRef"
  110. :formData="formData"
  111. pageType="add"
  112. />
  113. </el-form-item>
  114. </el-col>
  115. </el-row>
  116. <ele-pro-table
  117. ref="table"
  118. :columns="bankColumns"
  119. :datasource="formData.recordRulesDetailList"
  120. :need-page="false"
  121. row-key="id"
  122. class="table_list"
  123. >
  124. <template v-slot:toolbar>
  125. <el-button
  126. size="small"
  127. type="primary"
  128. icon="el-icon-plus"
  129. class="ele-btn-icon"
  130. @click="addRow"
  131. >
  132. 新建
  133. </el-button>
  134. </template>
  135. <template v-slot:paramType="{ row }">
  136. <el-select
  137. v-model="row.paramType"
  138. placeholder="请选择参数类型"
  139. size="mini"
  140. required
  141. >
  142. <el-option label="数值" :value="1" />
  143. <el-option label="选择" :value="2" />
  144. <el-option label="上下限" :value="3" />
  145. <el-option label="规格" :value="4" />
  146. <el-option label="时间" :value="5" />
  147. <el-option label="范围" :value="6" />
  148. <el-option label="文本" :value="7" />
  149. <!-- <el-option label="枚举" :value="8" /> -->
  150. </el-select>
  151. </template>
  152. <template v-slot:paramValue="{ row }">
  153. <!-- 根据参数类型渲染不同的输入组件 -->
  154. <el-link
  155. v-if="formData.classify == '4'"
  156. :underline="false"
  157. style="cursor: pointer"
  158. >
  159. <div class="ele-cell">
  160. <div @click="selectProduct(row)">
  161. {{ row.productName ? row.productName : '请选择产品' }}
  162. </div>
  163. <i
  164. v-if="row.tools.length == 0"
  165. class="el-icon-arrow-down"
  166. @click="selectProduct(row)"
  167. ></i>
  168. <i v-else class="el-icon-close" @click="clearProduct(row)"></i>
  169. </div>
  170. </el-link>
  171. <el-input
  172. v-else
  173. v-model="row.paramValue"
  174. placeholder="请输入参数内容"
  175. size="mini"
  176. ></el-input>
  177. </template>
  178. <template v-slot:defaultValue="{ row }">
  179. <el-row>
  180. <el-col :span="12">
  181. <!-- <el-select
  182. v-if="row.paramType != 7"
  183. v-model="row.symbol"
  184. placeholder="请选择"
  185. size="mini"
  186. >
  187. <el-option label=">" value=">"> </el-option>
  188. <el-option label="<" value="<"> </el-option>
  189. <el-option label="!=" value="!="> </el-option>
  190. <el-option label=">=" value=">="> </el-option>
  191. <el-option label="<=" value="<="> </el-option>
  192. <el-option label="~~" value="~~"> </el-option>
  193. <el-option label="+-" value="+-"> </el-option>
  194. <el-option label="......" value="......"> </el-option>
  195. </el-select> -->
  196. <DictSelection
  197. v-if="row.paramType != 7"
  198. clearable
  199. dictName="数学字符"
  200. v-model="row.numberOperator"
  201. placeholder="请选择逻辑"
  202. size="mini"
  203. ></DictSelection>
  204. </el-col>
  205. <el-col :span="row.paramType != 7 ? 12 : 24">
  206. <el-input
  207. v-model="row.defaultValue"
  208. placeholder="请输入默认值"
  209. size="mini"
  210. ></el-input>
  211. </el-col>
  212. </el-row>
  213. </template>
  214. <template v-slot:maxValue="{ row }">
  215. <el-input
  216. v-if="row.paramType == 3 || row.paramType == 6"
  217. v-model="row.maxValue"
  218. placeholder="请输入参数上限"
  219. size="mini"
  220. ></el-input>
  221. </template>
  222. <template v-slot:minValue="{ row }">
  223. <el-input
  224. v-if="row.paramType == 3 || row.paramType == 6"
  225. v-model="row.minValue"
  226. placeholder="请输入参数下限"
  227. size="mini"
  228. ></el-input>
  229. </template>
  230. <template v-slot:unitName="{ row }">
  231. <!-- <el-input
  232. v-model="row.unitName"
  233. placeholder="请输入参数单位"
  234. size="mini"
  235. ></el-input> -->
  236. <DictSelection
  237. v-if="row.paramType != 7"
  238. dictName="工艺参数单位"
  239. clearable
  240. filterable
  241. v-model="row.unitName"
  242. size="mini"
  243. >
  244. </DictSelection>
  245. </template>
  246. <template v-slot:toolName="{ row }">
  247. <el-link :underline="false" style="cursor: pointer">
  248. <div class="ele-cell">
  249. <div @click="handleAdd(row)">
  250. {{
  251. row.tools && row.tools.length > 0
  252. ? row.tools.map((i) => i.toolName).join(',')
  253. : '请选择'
  254. }}
  255. </div>
  256. <i
  257. v-if="row.tools.length == 0"
  258. class="el-icon-arrow-down"
  259. @click="handleAdd(row)"
  260. ></i>
  261. <i v-else class="el-icon-close" @click="clearTool(row)"></i>
  262. </div>
  263. </el-link>
  264. </template>
  265. <template v-slot:toolCodes="{ row }">
  266. <el-input
  267. :value="
  268. row.tools && row.tools.length > 0
  269. ? row.tools.map((i) => i.toolCode).join(',')
  270. : ''
  271. "
  272. placeholder="工具自动带出"
  273. disabled
  274. size="mini"
  275. ></el-input>
  276. </template>
  277. <template v-slot:remark="{ row }">
  278. <el-input
  279. v-model="row.remark"
  280. placeholder="请输入"
  281. size="mini"
  282. ></el-input>
  283. </template>
  284. <template v-slot:action="{ row }">
  285. <el-link
  286. type="danger"
  287. :underline="false"
  288. icon="el-icon-delete"
  289. @click="deleteRow(row)"
  290. >
  291. 删除
  292. </el-link>
  293. </template>
  294. </ele-pro-table>
  295. </el-form>
  296. <template v-slot:footer>
  297. <el-button :loading="btnLoading" type="primary" @click="saveAndPublish">
  298. 保存并发布
  299. </el-button>
  300. <el-button :loading="btnLoading" type="primary" @click="confirm">
  301. 保存
  302. </el-button>
  303. <el-button :loading="btnLoading" @click="handleClose">取消</el-button>
  304. </template>
  305. <toolModal ref="toolModalRef" @chooseModal="chooseModal" />
  306. <MaterialAdd
  307. ref="deviceSelectDialog"
  308. selectType="single"
  309. @chooseEquipment="chooseEquipment"
  310. />
  311. <ProductModal
  312. ref="ProductModalRef"
  313. @changeProduct="changeProduct"
  314. ></ProductModal>
  315. </ele-modal>
  316. </template>
  317. <script>
  318. import { getByCode } from '@/api/system/dictionary-data';
  319. // import RuleCycle from '../../matterRules/components/rule-cycle.vue';
  320. import RuleCycle from './rule-cycle.vue';
  321. import OperationGuideDialog from '@/views/rulesManagement/matterRules/components/operationGuideDialog.vue';
  322. import Details from './details.vue';
  323. import dictMixins from '@/mixins/dictMixins';
  324. import toolModal from './toolModal.vue';
  325. import MaterialAdd from '../../components/MaterialAdd.vue';
  326. import {
  327. recordrulesSave,
  328. recordrulesDetailPage,
  329. recordrulesUpdate,
  330. recordrulesPublish,
  331. recordrulesSaveAndPublish,
  332. recordrulesUpdateVersion,
  333. recordrulesCyclePage
  334. } from '@/api/recordrules/index';
  335. import ProductModal from './ProductModal.vue';
  336. export default {
  337. components: {
  338. OperationGuideDialog,
  339. RuleCycle,
  340. Details,
  341. ProductModal,
  342. MaterialAdd,
  343. toolModal
  344. },
  345. mixins: [dictMixins],
  346. computed: {
  347. bankColumns() {
  348. return [
  349. {
  350. width: 110,
  351. type: 'index',
  352. columnKey: 'index',
  353. align: 'center',
  354. label: '序号'
  355. },
  356. {
  357. prop: 'paramType',
  358. label: '参数类型',
  359. align: 'center',
  360. slot: 'paramType',
  361. minWidth: 110
  362. },
  363. {
  364. prop: 'paramValue',
  365. label: '参数内容',
  366. align: 'center',
  367. slot: 'paramValue',
  368. minWidth: 180
  369. },
  370. {
  371. prop: 'defaultValue',
  372. label: '默认值',
  373. align: 'center',
  374. slot: 'defaultValue',
  375. minWidth: 150
  376. },
  377. {
  378. prop: 'maxValue',
  379. label: '参数上限',
  380. align: 'center',
  381. slot: 'maxValue',
  382. minWidth: 110
  383. },
  384. {
  385. prop: 'minValue',
  386. label: '参数下限',
  387. align: 'center',
  388. slot: 'minValue',
  389. minWidth: 110
  390. },
  391. {
  392. prop: 'unitName',
  393. label: '参数单位',
  394. align: 'center',
  395. slot: 'unitName',
  396. minWidth: 110
  397. },
  398. {
  399. prop: 'toolName',
  400. label: '工具名称',
  401. align: 'center',
  402. slot: 'toolName',
  403. minWidth: 110
  404. },
  405. {
  406. prop: 'toolCodes',
  407. label: '工具编码',
  408. align: 'center',
  409. slot: 'toolCodes',
  410. minWidth: 110
  411. },
  412. {
  413. prop: 'remark',
  414. label: '备注',
  415. align: 'center',
  416. slot: 'remark',
  417. minWidth: 110
  418. },
  419. {
  420. columnKey: 'action',
  421. label: '操作',
  422. width: 110,
  423. align: 'center',
  424. resizable: false,
  425. slot: 'action'
  426. }
  427. ];
  428. },
  429. versionText() {
  430. return this.formData.version
  431. ? `V${this.formData.version.toFixed(1)}`
  432. : 'V1.0';
  433. }
  434. },
  435. data() {
  436. return {
  437. dialogTitle: '',
  438. visible: false,
  439. formData: {
  440. id: null,
  441. classify: null,
  442. deviceId: null,
  443. deviceName: '',
  444. frequencyUnit: 2,
  445. frequencyValue: null,
  446. name: '',
  447. recordRulesDetailList: [
  448. {
  449. id: 0,
  450. defaultValue: '',
  451. maxValue: null,
  452. minValue: null,
  453. paramType: null,
  454. paramValue: null,
  455. remark: '',
  456. symbol: null,
  457. tools: [],
  458. unitName: null,
  459. productName: '',
  460. productCode: ''
  461. }
  462. ],
  463. recordRulesCycleList: [],
  464. startDate: null,
  465. stopDate: null,
  466. version: 1,
  467. code: '',
  468. fromId: null
  469. },
  470. formRules: {
  471. name: [
  472. { required: true, message: '请输入规则名称', trigger: 'blur' }
  473. ],
  474. frequencyValue: [
  475. { required: true, message: '请选择周期', trigger: 'blur' },
  476. { required: true, message: '请选择周期', trigger: 'change' }
  477. ],
  478. frequencyUnit: [
  479. { required: true, message: '请选择频率单位', trigger: 'change' }
  480. ],
  481. classify: [
  482. { required: true, message: '请选择规则类型', trigger: 'change' }
  483. ],
  484. // startDate 启用日期要大于当前时间
  485. // stopDate 停用时间要大于当前时间并且大于启用日期
  486. startDate: [
  487. { required: true, message: '请选择启用日期', trigger: 'blur' },
  488. { required: true, message: '请选择启用日期', trigger: 'change' },
  489. { validator: this.validateStartDate, trigger: 'change' }
  490. ],
  491. stopDate: [
  492. { required: true, message: '请选择停用时间', trigger: 'change' },
  493. { validator: this.validateStopDate, trigger: 'change' }
  494. ],
  495. deviceName: [
  496. { required: true, message: '请输入选择设备', trigger: 'blur' }
  497. ]
  498. },
  499. recordSheet: [], // 记录表
  500. current: {},
  501. dataIndex: null,
  502. showEdit: false,
  503. btnLoading: false,
  504. currentRow: null
  505. };
  506. },
  507. mounted() {
  508. this.getByCodeData();
  509. },
  510. methods: {
  511. open(row, type, title) {
  512. this.visible = true;
  513. this.dialogTitle = title;
  514. this.type = type;
  515. console.log('type', type, row);
  516. if (type == 'edit') {
  517. this.$util.assignObject(this.formData, row);
  518. this.formData.startDate = new Date(row.startDate);
  519. this.formData.stopDate = new Date(row.stopDate);
  520. this.recordrulesDetailPage(row);
  521. this.recordrulesCyclePage(row);
  522. console.log('this.formData', this.formData, this.formData.version);
  523. }
  524. if (type == 'clone') {
  525. this.$util.assignObject(this.formData, row);
  526. this.formData.name = this.formData.name + '-副本';
  527. this.formData.version += 1;
  528. this.formData.fromId = row.id;
  529. this.formData.id = null;
  530. this.formData.startDate = new Date(row.startDate);
  531. this.formData.stopDate = new Date(row.stopDate);
  532. this.recordrulesDetailPage(row);
  533. this.recordrulesCyclePage(row);
  534. }
  535. if (type == 'add') {
  536. this.formData.version = 1;
  537. // 停用日期 默认为 2099-12-31
  538. this.formData.stopDate = new Date('2099-12-31 00:00:00');
  539. }
  540. },
  541. async getByCodeData() {
  542. let res = await getByCode('record_sheet');
  543. let list = res.data.map((item) => {
  544. let values = Object.keys(item);
  545. return {
  546. value: values[0],
  547. label: item[values[0]]
  548. };
  549. });
  550. this.recordSheet = list;
  551. },
  552. itemDel(index) {
  553. this.formData.recordRulesDetailList.splice(index, 1);
  554. },
  555. /* 打开操作手册编辑款 */
  556. openOperationGuideDialogDialog(row, index) {
  557. this.$refs.operationGuideDialog.open(row, index);
  558. },
  559. handleClose() {
  560. this.visible = false;
  561. this.$refs['formRef'].resetFields();
  562. // 清空表单数据
  563. this.formData = {
  564. id: null,
  565. classify: null,
  566. deviceId: null,
  567. deviceName: '',
  568. frequencyUnit: null,
  569. frequencyValue: null,
  570. name: '',
  571. recordRulesDetailList: [
  572. {
  573. id: 0,
  574. defaultValue: '',
  575. maxValue: null,
  576. minValue: null,
  577. paramType: null,
  578. paramValue: null,
  579. remark: '',
  580. symbol: null,
  581. toolCodes: null,
  582. tools: [],
  583. unitName: null,
  584. productName: '',
  585. productCode: ''
  586. }
  587. ],
  588. recordRulesCycleList: [],
  589. startDate: null,
  590. stopDate: null,
  591. version: 1,
  592. code: '',
  593. fromId: null
  594. };
  595. },
  596. // 保存
  597. confirm() {
  598. console.log('this.formData', this.formData);
  599. // 验证表单规则
  600. this.$refs.formRef.validate(async (valid) => {
  601. if (!valid) {
  602. return false;
  603. }
  604. if (this.formData.recordRulesDetailList.length == 0) {
  605. return this.$message.warning('至少条件一条规则项');
  606. }
  607. try {
  608. this.btnLoading = true;
  609. this.formData.recordRulesCycleList =
  610. this.$refs.cycleMultipleRef.recordRulesCycleList.map(
  611. (i, index) => {
  612. return { ...i, sortNum: index + 1 };
  613. }
  614. );
  615. const body = { ...this.formData };
  616. body.startDate = this.$util.toDateString(
  617. body.startDate,
  618. 'yyyy-MM-dd HH:mm:ss'
  619. );
  620. body.stopDate = this.$util.toDateString(
  621. body.stopDate,
  622. 'yyyy-MM-dd HH:mm:ss'
  623. );
  624. if (this.type == 'add') {
  625. await recordrulesSave(body);
  626. } else if (this.type == 'clone') {
  627. await recordrulesUpdateVersion(body);
  628. } else {
  629. // 编辑
  630. body.fromId = null;
  631. await recordrulesUpdate(body);
  632. }
  633. this.btnLoading = false;
  634. this.$message.success('操作成功');
  635. this.handleClose();
  636. this.$emit('reload');
  637. } catch (error) {
  638. this.btnLoading = false;
  639. }
  640. });
  641. },
  642. // 保存并发布
  643. saveAndPublish() {
  644. // 验证表单规则
  645. this.$refs.formRef.validate(async (valid) => {
  646. if (!valid) {
  647. return false;
  648. }
  649. if (this.formData.recordRulesDetailList.length == 0) {
  650. return this.$message.warning('至少条件一条规则项');
  651. }
  652. try {
  653. this.btnLoading = true;
  654. this.formData.recordRulesCycleList =
  655. this.$refs.cycleMultipleRef.recordRulesCycleList.map(
  656. (i, index) => {
  657. return { ...i, sortNum: index + 1 };
  658. }
  659. );
  660. const body = { ...this.formData };
  661. body.startDate = this.$util.toDateString(
  662. body.startDate,
  663. 'yyyy-MM-dd HH:mm:ss'
  664. );
  665. body.stopDate = this.$util.toDateString(
  666. body.stopDate,
  667. 'yyyy-MM-dd HH:mm:ss'
  668. );
  669. await recordrulesSaveAndPublish(body);
  670. this.btnLoading = false;
  671. this.$message.success('操作成功');
  672. this.handleClose();
  673. this.$emit('reload');
  674. } catch (error) {
  675. this.btnLoading = false;
  676. }
  677. });
  678. },
  679. // startDate 启用日期要大于当前时间
  680. validateStartDate(rule, value, callback) {
  681. const startDate = this.formData.startDate;
  682. if (!startDate) {
  683. return callback(new Error('启用日期不能为空'));
  684. }
  685. // 启用日期大于等于今天
  686. const today = new Date();
  687. today.setHours(0, 0, 0, 0); // 设置为当天的开始时间
  688. if (new Date(startDate) < today) {
  689. return callback(new Error('启用日期必须大于等于当前日期'));
  690. }
  691. callback();
  692. },
  693. // stopDate 停用时间要大于当前时间并且大于启用日期
  694. validateStopDate(rule, value, callback) {
  695. const startDate = this.formData.startDate;
  696. const stopDate = this.formData.stopDate;
  697. if (
  698. stopDate &&
  699. startDate &&
  700. new Date(stopDate) <= new Date(startDate)
  701. ) {
  702. return callback(new Error('停用时间必须大于启用日期'));
  703. }
  704. callback();
  705. },
  706. // 去选择设备
  707. selectDeviceId() {
  708. this.$refs.deviceSelectDialog.open([]);
  709. },
  710. // 选择设备回调
  711. chooseEquipment(data, index, categoryId) {
  712. console.log('data', data, index, categoryId);
  713. this.formData.deviceId = data[0]?.id || null;
  714. this.formData.deviceName = data[0]?.name || '';
  715. },
  716. // 添加
  717. addRow() {
  718. this.formData.recordRulesDetailList.push({
  719. id: new Date().getTime(),
  720. defaultValue: '',
  721. maxValue: null,
  722. minValue: null,
  723. paramType: null,
  724. paramValue: null,
  725. remark: '',
  726. symbol: null,
  727. tools: [],
  728. unitName: null,
  729. productName: '',
  730. productCode: ''
  731. });
  732. },
  733. deleteRow(row) {
  734. const index = this.formData.recordRulesDetailList.indexOf(row);
  735. if (index !== -1) {
  736. this.formData.recordRulesDetailList.splice(index, 1);
  737. }
  738. },
  739. handleAdd(row) {
  740. this.currentRow = row;
  741. this.$refs.toolModalRef.open(row.toolCodes);
  742. },
  743. chooseModal(data) {
  744. console.log('data', data);
  745. this.currentRow.tools = data.map((i) => {
  746. return {
  747. toolCode: i.code,
  748. toolName: i.name
  749. // rulesDetailId: this.currentRow.id,
  750. // rulesId: this.formData.id
  751. };
  752. });
  753. },
  754. // 规则明细表
  755. async recordrulesDetailPage(row) {
  756. const { list } = await recordrulesDetailPage({
  757. // deptId: row.deptId,
  758. pageNum: 1,
  759. rulesId: row.id,
  760. size: 9999
  761. });
  762. console.log('list 数据', list);
  763. this.formData.recordRulesDetailList = list;
  764. },
  765. // 清空工具
  766. clearTool(row) {
  767. row.tools = [];
  768. },
  769. // 查询 recordrulesCyclePage
  770. async recordrulesCyclePage(row) {
  771. const { list } = await recordrulesCyclePage({
  772. pageNum: 1,
  773. size: 9999,
  774. recordRulesId: row.id,
  775. orderBy: 'descending'
  776. });
  777. console.log('list 周期数据', list);
  778. this.formData.recordRulesCycleList = list;
  779. this.$nextTick(() => {
  780. this.$refs.cycleMultipleRef.setRecordRulesCycleList(list);
  781. });
  782. },
  783. // 去选择产品
  784. selectProduct(row) {
  785. this.currentRow = row;
  786. this.$refs.ProductModalRef.open();
  787. },
  788. // 选择产品
  789. changeProduct(current) {
  790. console.log('current', current);
  791. this.currentRow.productName = current.name;
  792. this.currentRow.productCode = current.code;
  793. },
  794. // 清空产品
  795. clearProduct(row) {
  796. row.productName = '';
  797. row.productCode = '';
  798. }
  799. }
  800. };
  801. </script>
  802. <style scoped lang="scss">
  803. .operationGuide_box {
  804. width: 100%;
  805. height: 48px;
  806. display: flex;
  807. overflow: hidden;
  808. cursor: pointer;
  809. box-sizing: border-box;
  810. padding: 5px 10px;
  811. .left_content {
  812. width: 50%;
  813. padding: 10px;
  814. box-sizing: border-box;
  815. border: 1px solid #c0c4cc;
  816. border-radius: 10px;
  817. margin-right: 10px;
  818. overflow-y: auto;
  819. }
  820. .right_content {
  821. flex: 1;
  822. padding: 10px;
  823. box-sizing: border-box;
  824. border: 1px solid #c0c4cc;
  825. border-radius: 10px;
  826. overflow-y: auto;
  827. }
  828. }
  829. ::v--deep .table_list {
  830. .el-form-item {
  831. .el-form-item__content {
  832. margin-left: 0;
  833. }
  834. }
  835. }
  836. </style>