plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

827 lines
33 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <script>
  2. import {
  3. queryCodeItemValueDetail,
  4. removeCodeItemValue, removeCodeItemValueBatch,
  5. saveCodeItemValue, saveCodeItemValueBatch,
  6. searchCodeItemValueList,
  7. searchCodeItemValueListItem, updateCodeItemValue
  8. } from "../../../../api/code/codeItemValue"
  9. import {
  10. editCodeConditionHeader, removeCodeConditionHeader,
  11. saveCodeConditionHeader,
  12. searchCodeConditionHeaderList
  13. } from "../../../../api/code/codeConditionHeader";
  14. import {searchCodeItemDefs, searchCodeItemDefsSeq} from "../../../../api/code/codeItemDef";
  15. import {
  16. codeConditionDetailList, editConditionDetailList,
  17. removeConditionDetailList,
  18. saveConditionDetailList
  19. } from "../../../../api/code/codeConditionDetail";
  20. const rules = {}
  21. const detailRules = {}
  22. const itemValueRules = {}
  23. const rulesLabel = {
  24. conditionDesc: "条件描述",
  25. conditionName: "条件名称",
  26. active: "是否有效",
  27. }
  28. const detailRulesLabel = {
  29. SQLStatementExecuteItem: "元素名称",
  30. SQLStatementExecuteValueItemNo: "元素可选值",
  31. SQLStatementExecuteCalculate: "运算符号",
  32. }
  33. const itemValueRulesLabel = {
  34. valueNo: "简码",
  35. itemValue: "值",
  36. }
  37. Object.keys(rulesLabel).forEach(key => {
  38. rules[key] = [
  39. {
  40. required: true,
  41. message: `${rulesLabel[key]}不能为空`,
  42. trigger: ['blur','input','change']
  43. }
  44. ];
  45. });
  46. Object.keys(itemValueRulesLabel).forEach(key => {
  47. itemValueRules[key] = [
  48. {
  49. required: true,
  50. message: `${itemValueRulesLabel[key]}不能为空`,
  51. trigger: ['blur','input','change']
  52. }
  53. ];
  54. });
  55. Object.keys(detailRulesLabel).forEach(key => {
  56. detailRules[key] = [
  57. {
  58. required: true,
  59. message: `${detailRulesLabel[key]}不能为空`,
  60. trigger: ['blur','input','change']
  61. }
  62. ];
  63. });
  64. export default {
  65. name: "itemValue",
  66. props:{
  67. itemValue:{
  68. type:Object,
  69. required:true
  70. },
  71. },
  72. data(){
  73. return{
  74. selectionDetailIndex:-1,
  75. conditionHeaderIndex:0,
  76. itemValueList:[],
  77. conditionHeaders:[],
  78. conditionDetails:[],
  79. saveFlag:"新增",
  80. saveConditionHeaderFlag:false,
  81. conditionHeader:{
  82. conditionId:0,
  83. },
  84. saveRules:rules,
  85. saveItemValueRules:itemValueRules,
  86. rulesLabel:rulesLabel,
  87. itemValueRulesLabel:itemValueRulesLabel,
  88. saveItemValueFlag:false,
  89. itemValueModal:{
  90. valueNo:undefined,
  91. itemValue: undefined,
  92. },
  93. itemDefs:[],
  94. itemDefModalVisible:false,
  95. detailRules:detailRules,
  96. detailRulesLabel:detailRulesLabel,
  97. conditionDetailModal:{
  98. SQLStatementExecuteItem:undefined,
  99. SQLStatementExecuteValue:undefined,
  100. SQLStatementExecuteCalculate:undefined,
  101. SQLStatementExecuteConditionId:undefined,
  102. SQLStatementExecuteValueItemNo:undefined,
  103. SQLStatementExecuteFlag:'N',
  104. },
  105. saveItemValueList:[],
  106. saveItemValueListDialog:false,
  107. itemValueListSelected:[],
  108. itemValueAllList:[],
  109. queryCodeItemValueDialog:false,
  110. queryCodeItemValueList:[],
  111. }
  112. },
  113. watch:{
  114. conditionHeaderIndex(newVal,oldVal){
  115. this.searchCodeItemValueListItem();
  116. this.codeConditionDetailList();
  117. }
  118. },
  119. methods: {
  120. removeCodeItemValue(row){
  121. this.$confirm(`确定要删除值"${row.itemValue}"吗?`, '提示', {
  122. confirmButtonText: '确定',
  123. cancelButtonText: '取消',
  124. type: 'warning'
  125. }).then(() => {
  126. removeCodeItemValue(row).then(({data})=>{
  127. if (data && data.code === 0){
  128. this.$message.success(data.msg)
  129. this.searchCodeItemValueListItem()
  130. }else {
  131. this.$message.warning(data.msg)
  132. }
  133. }).catch((error)=>{
  134. this.$message.error(error)
  135. })
  136. }).catch(() => {})
  137. },
  138. getItemValueList(){
  139. searchCodeItemValueList(this.itemValue).then(({data})=>{
  140. if (data && data.code === 0){
  141. this.itemValueList = data.rows1
  142. this.conditionHeaders = data.rows2
  143. this.conditionDetails = data.rows3
  144. }else {
  145. this.$message.warning(data.msg)
  146. }
  147. }).catch((error)=>{
  148. this.$message.error(error)
  149. })
  150. },
  151. searchConditionHeader(flag){
  152. searchCodeConditionHeaderList(this.itemValue).then(({data})=>{
  153. if (data && data.code === 0){
  154. this.conditionHeaders = data.rows;
  155. if (flag){
  156. this.conditionHeaderIndex = this.conditionHeaders.length - 1;
  157. }
  158. }else {
  159. this.$message.warning(data.msg)
  160. }
  161. }).catch((error)=>{
  162. this.$message.error(error)
  163. })
  164. },
  165. clickSaveConditionHeaderBtn(){
  166. this.conditionHeader = {
  167. conditionId:this.conditionHeaders[this.conditionHeaders.length - 1].conditionId + 1,
  168. itemNo:this.itemValue.itemNo,
  169. site:this.$store.state.user.site,
  170. active:'Y',
  171. conditionName:'',
  172. }
  173. this.saveConditionHeaderFlag = true
  174. },
  175. saveConditionHeaderBtn(){
  176. this.$refs.saveForm.validate((valid,obj) => {
  177. if (valid){
  178. if (this.saveFlag === "新增"){
  179. this.saveCodeConditionHeader()
  180. }else {
  181. this.editCodeConditionHeader()
  182. }
  183. }else {
  184. Object.keys(obj).forEach(key => {
  185. this.$message.error(obj[key][0].message);
  186. return
  187. })
  188. }
  189. })
  190. },
  191. saveCodeConditionHeader(){
  192. saveCodeConditionHeader(this.conditionHeader).then(({data})=>{
  193. if (data && data.code === 0){
  194. this.$message.success(data.msg)
  195. this.saveConditionHeaderFlag = false
  196. this.searchConditionHeader(true)
  197. }else {
  198. this.$message.warning(data.msg)
  199. }
  200. }).catch((error)=>{
  201. this.$message.error(error)
  202. })
  203. },
  204. editConditionHeaderBtn(){
  205. this.conditionHeader = {...this.conditionHeaders[this.conditionHeaderIndex]}
  206. this.saveFlag = "编辑"
  207. this.saveConditionHeaderFlag = true
  208. },
  209. editCodeConditionHeader(){
  210. editCodeConditionHeader(this.conditionHeader).then(({data})=>{
  211. if (data && data.code === 0){
  212. this.$message.success(data.msg)
  213. this.saveConditionHeaderFlag = false
  214. this.searchConditionHeader()
  215. }else {
  216. this.$message.warning(data.msg)
  217. }
  218. }).catch((error)=>{
  219. this.$message.error(error)
  220. })
  221. },
  222. closeSaveConditionHeader(){
  223. this.$refs.saveForm.resetFields();
  224. this.saveFlag = "新增";
  225. },
  226. removeConditionHeaderBtn(){
  227. this.$confirm(`确定要删除条件"${this.conditionHeaders[this.conditionHeaderIndex].conditionDesc}"吗?`, '提示', {
  228. confirmButtonText: '确定',
  229. cancelButtonText: '取消',
  230. type: 'warning'
  231. }).then(() => {
  232. removeCodeConditionHeader(this.conditionHeaders[this.conditionHeaderIndex]).then(({data})=>{
  233. if (data && data.code === 0){
  234. this.$message.success(data.msg);
  235. this.conditionHeaderIndex = 0;
  236. this.searchConditionHeader();
  237. }else {
  238. this.$message.warning(data.msg)
  239. }
  240. })
  241. }).catch(() => {})
  242. },
  243. saveItemValueBtn(){
  244. this.itemValueModal = {
  245. valueNo:undefined,
  246. itemValue: undefined,
  247. site:this.itemValue.site,
  248. itemNo:this.itemValue.itemNo,
  249. conditionId:this.conditionHeaders[this.conditionHeaderIndex].conditionId,
  250. }
  251. this.saveItemValueFlag = true;
  252. },
  253. closeSaveItemValue(){
  254. this.$refs.saveItemValueForm.resetFields();
  255. this.saveFlag = "新增";
  256. },
  257. saveItemValue(){
  258. this.$refs.saveItemValueForm.validate((valid,obj) => {
  259. if (valid){
  260. if (this.itemValueModal.valueNo && this.itemValueModal.valueNo.length > this.itemValue.bits){
  261. this.$message.error(`该"简码"位数超出了元素设置最大值${this.itemValue.bits}!`);
  262. return;
  263. }
  264. if (this.itemValueList.some(item=>item.valueNo === this.itemValueModal.valueNo) && this.saveFlag === "新增"){
  265. this.$confirm(`该"简码"${this.itemValueModal.valueNo}已存在, 继续保存?`, '提示', {
  266. confirmButtonText: '确定',
  267. cancelButtonText: '取消',
  268. type: 'warning'
  269. }).then(() => {
  270. this.saveCodeItemValueData();
  271. }).catch(() => {
  272. });
  273. }else {
  274. this.saveCodeItemValueData();
  275. }
  276. }else {
  277. Object.keys(obj).forEach(key => {
  278. this.$message.error(obj[key][0].message);
  279. return
  280. })
  281. }
  282. })
  283. },
  284. saveCodeItemValueData(){
  285. if (this.saveFlag === "新增"){
  286. saveCodeItemValue(this.itemValueModal).then(({data})=>{
  287. if (data && data.code === 0){
  288. // this.saveItemValueFlag = false
  289. this.$message.success(data.msg);
  290. this.$refs.saveItemValueForm.resetFields();
  291. this.searchCodeItemValueListItem()
  292. }else {
  293. this.$message.warning(data.msg)
  294. }
  295. }).catch((error)=>{
  296. this.$message.error(error)
  297. })
  298. }else {
  299. updateCodeItemValue(this.itemValueModal).then(({data})=>{
  300. if (data && data.code === 0){
  301. this.saveItemValueFlag = false
  302. this.$message.success(data.msg)
  303. this.searchCodeItemValueListItem()
  304. }else {
  305. this.$message.warning(data.msg)
  306. }
  307. }).catch((error)=>{
  308. this.$message.error(error)
  309. })
  310. }
  311. },
  312. searchCodeItemValueListItem(){
  313. let params = {
  314. itemNo: this.itemValue.itemNo,
  315. site:this.itemValue.site,
  316. conditionId:this.conditionHeaders[this.conditionHeaderIndex].conditionId,
  317. }
  318. searchCodeItemValueListItem(params).then(({data})=>{
  319. if (data && data.code === 0){
  320. this.itemValueList = data.rows
  321. }else {
  322. this.$message.warning(data.msg)
  323. }
  324. }).catch((error)=>{
  325. this.$message.error(error)
  326. })
  327. },
  328. clickSaveItemValueBtn(row){
  329. this.itemValueModal = {...row}
  330. this.saveFlag = "编辑"
  331. this.saveItemValueFlag = true;
  332. },
  333. /**
  334. * 获取当前itemDef次序前的itemDef列表
  335. */
  336. searchCodeItemDefs(){
  337. let params = {
  338. site:this.itemValue.site,
  339. itemNo:this.itemValue.itemNo,
  340. seqNo:this.itemValue.seqNo,
  341. }
  342. searchCodeItemDefsSeq(params).then(({data})=>{
  343. if (data && data.code === 0){
  344. this.itemDefs = data.rows;
  345. if (this.itemDefs.length > 0 && this.conditionDetailModal.seqNo === undefined){
  346. this.conditionDetailModal.SQLStatementExecuteItem = this.itemDefs[0].itemNo;
  347. }
  348. let params = {
  349. itemNo: this.conditionDetailModal.SQLStatementExecuteItem,
  350. site:this.itemValue.site,
  351. }
  352. this.saveCodeItemValue(params);
  353. }else {
  354. this.$message.warning(data.msg)
  355. }
  356. }).catch((error)=>{
  357. this.$message.error(error)
  358. })
  359. },
  360. saveCodeItemValue(itemDef){
  361. let params = {
  362. itemNo: itemDef.itemNo,
  363. site:itemDef.site,
  364. }
  365. searchCodeItemValueListItem(params).then(({data})=>{
  366. if (data && data.code === 0){
  367. this.saveItemValueList = data.rows;
  368. this.$nextTick(()=>{
  369. if (this.saveItemValueList.length > 0 && this.conditionDetailModal.seqNo === undefined){
  370. this.conditionDetailModal.SQLStatementExecuteValueItemNo = this.saveItemValueList[0].valueItemNo;
  371. }
  372. })
  373. }else {
  374. this.$message.warning(data.msg)
  375. }
  376. }).catch((error)=>{
  377. this.$message.error(error)
  378. })
  379. },
  380. clickConditionDetailBtn(){
  381. this.conditionDetailModal.site = this.itemValue.site;
  382. this.conditionDetailModal.itemNo = this.itemValue.itemNo;
  383. this.conditionDetailModal.conditionId = this.conditionHeaders[this.conditionHeaderIndex].conditionId;
  384. this.searchCodeItemDefs();
  385. this.itemDefModalVisible = true;
  386. },
  387. closeConditionDetail(){
  388. Object.keys(this.conditionDetailModal).forEach(key => {
  389. this.conditionDetailModal[key] = undefined;
  390. });
  391. this.conditionDetailModal.seqNo = undefined;
  392. this.conditionDetailModal.SQLStatementExecuteFlag = 'N';
  393. },
  394. changeItemDef(val){
  395. let params = {
  396. itemNo: val,
  397. site:this.itemValue.site,
  398. }
  399. this.conditionDetailModal.SQLStatementExecuteValueItemNo = undefined;
  400. this.saveCodeItemValue(params);
  401. },
  402. saveConditionDetail(){
  403. this.$refs.formConditionDetail.validate((valid,obj) => {
  404. if (valid){
  405. if (this.conditionDetailModal.seqNo){
  406. this.handleUpdateConditionDetail();
  407. }else {
  408. this.handleSaveConditionDetail();
  409. }
  410. }else {
  411. Object.keys(obj).forEach(key => {
  412. this.$message.error(obj[key][0].message);
  413. return
  414. })
  415. }
  416. })
  417. },
  418. handleSaveConditionDetail(){
  419. saveConditionDetailList(this.conditionDetailModal).then(({data})=>{
  420. if (data && data.code === 0){
  421. this.$message.success(data.msg)
  422. this.codeConditionDetailList();
  423. }else {
  424. this.$message.warning(data.msg)
  425. }
  426. }).catch((error)=>{
  427. this.$message.error(error)
  428. })
  429. },
  430. handleUpdateConditionDetail(){
  431. editConditionDetailList(this.conditionDetailModal).then(({data})=>{
  432. if (data && data.code === 0){
  433. this.$message.success(data.msg)
  434. this.codeConditionDetailList();
  435. this.itemDefModalVisible = false;
  436. }else {
  437. this.$message.warning(data.msg)
  438. }
  439. }).catch((error)=>{
  440. this.$message.error(error)
  441. })
  442. },
  443. codeConditionDetailList(){
  444. let params = {
  445. itemNo: this.itemValue.itemNo,
  446. site:this.itemValue.site,
  447. conditionId:this.conditionHeaders[this.conditionHeaderIndex].conditionId,
  448. }
  449. codeConditionDetailList(params).then(({data})=>{
  450. if (data && data.code === 0){
  451. this.conditionDetails = data.rows
  452. }else {
  453. this.$message.warning(data.msg)
  454. }
  455. }).catch((error)=>{
  456. this.$message.error(error)
  457. })
  458. },
  459. handleEditConditionDetail(){
  460. this.conditionDetailModal = {...this.conditionDetails[this.selectionDetailIndex]}
  461. this.conditionDetailModal.SQLStatementExecuteItem = parseInt(this.conditionDetailModal.SQLStatementExecuteItem)
  462. this.searchCodeItemDefs();
  463. this.itemDefModalVisible = true
  464. },
  465. removeConditionDetailList(){
  466. this.$confirm(`确定要删除条件"${this.conditionDetails[this.selectionDetailIndex].SQLStatementExecuteCalculate === 1 ? '并且' : '或者' }(${this.conditionDetails[this.selectionDetailIndex].itemDesc}=${this.conditionDetails[this.selectionDetailIndex].itemValue})"吗?`, '提示', {
  467. confirmButtonText: '确定',
  468. cancelButtonText: '取消',
  469. type: 'warning'
  470. }).then(() => {
  471. if (this.conditionDetails.length === 0 && this.itemValueList.length !== 0){
  472. this.$alert(`"${this.conditionDetails[this.selectionDetailIndex].SQLStatementExecuteCalculate === 1 ? '并且' : '或者' }(${this.conditionDetails[this.selectionDetailIndex].itemDesc}=${this.conditionDetails[this.selectionDetailIndex].itemValue})"为当前条件的最后一条判断语句而且该条件下已经维护了可选值,请先删除可选值!`, '提示', {
  473. confirmButtonText: '确定',
  474. });
  475. return
  476. }
  477. removeConditionDetailList(this.conditionDetails[this.selectionDetailIndex]).then(({data})=>{
  478. if (data && data.code === 0){
  479. this.$message.success(data.msg)
  480. this.codeConditionDetailList()
  481. this.selectionDetailIndex = -1
  482. }else {
  483. this.$message.warning(data.msg)
  484. }
  485. }).catch((error)=>{
  486. this.$message.error(error)
  487. })
  488. }).catch(() => {})
  489. },
  490. saveItemValueListBtn(){
  491. this.itemValueListSelected = this.itemValueList.map(item=>item.valueItemNo);
  492. let params = {
  493. site:this.itemValue.site,
  494. itemNo:this.itemValue.itemNo,
  495. }
  496. searchCodeItemValueListItem(params).then(({data})=>{
  497. if (data && data.code === 0){
  498. this.itemValueAllList = data.rows;
  499. }else {
  500. this.$message.warning(data.msg)
  501. }
  502. }).catch((error)=>{
  503. this.$message.error(error)
  504. })
  505. this.saveItemValueListDialog = true;
  506. },
  507. handleSelectChange(row,position,key){
  508. let rows = key.map(item=>{
  509. return {
  510. site:this.itemValue.site,
  511. itemNo:this.itemValue.itemNo,
  512. valueItemNo:item,
  513. conditionId:this.conditionHeaders[this.conditionHeaderIndex].conditionId,
  514. }
  515. })
  516. if (position === 'left'){
  517. // 删除
  518. this.removeCodeItemValueBatch(rows)
  519. }else {
  520. // 新增
  521. this.saveCodeItemValueBatch(rows)
  522. }
  523. },
  524. removeCodeItemValueBatch(rows){
  525. removeCodeItemValueBatch(rows).then(({data})=>{
  526. if (data && data.code === 0){
  527. this.$message.success(data.msg)
  528. this.searchCodeItemValueListItem()
  529. }else {
  530. this.$message.warning(data.msg)
  531. }
  532. }).catch((error)=> {
  533. this.$message.error(error)
  534. })
  535. },
  536. saveCodeItemValueBatch(rows){
  537. saveCodeItemValueBatch(rows).then(({data})=>{
  538. if (data && data.code === 0){
  539. this.$message.success(data.msg)
  540. this.searchCodeItemValueListItem()
  541. }else {
  542. this.$message.warning(data.msg)
  543. }
  544. }).catch((error)=> {
  545. this.$message.error(error)
  546. })
  547. },
  548. handleQueryCodeItemValue(row){
  549. let params = {
  550. ...row
  551. }
  552. queryCodeItemValueDetail(params).then(({data})=>{
  553. if (data && data.code === 0){
  554. this.queryCodeItemValueDialog = true;
  555. this.queryCodeItemValueList = data.rows;
  556. }else {
  557. this.$message.warning(data.msg)
  558. }
  559. }).catch((error)=>{
  560. this.$message.error(error)
  561. })
  562. }
  563. },
  564. created() {
  565. this.getItemValueList()
  566. }
  567. }
  568. </script>
  569. <template>
  570. <div>
  571. <div>
  572. <div>可选值列举的条件:</div>
  573. <div style="border: 1px solid #ebeef5;padding: 5px 10px;box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1)">
  574. <el-button type="primary" icon="el-icon-plus" @click="clickSaveConditionHeaderBtn" :disabled="itemValue.itemByCondition === 'N'">新增</el-button>
  575. <el-button type="primary" icon="el-icon-edit" @click="editConditionHeaderBtn" >编辑</el-button>
  576. <el-button type="primary" icon="el-icon-delete" @click="removeConditionHeaderBtn" :disabled="itemValue.itemByCondition === 'N'">删除</el-button>
  577. <el-button type="primary" icon="el-icon-d-arrow-left" :disabled="itemValue.itemByCondition === 'N'" @click="conditionHeaderIndex = 0">首条</el-button>
  578. <el-button type="primary" icon="el-icon-arrow-left" :disabled="itemValue.itemByCondition === 'N' || conditionHeaderIndex === 0" @click="conditionHeaderIndex--">前条</el-button>
  579. <el-button type="primary" :disabled="itemValue.itemByCondition === 'N' || conditionHeaderIndex === conditionHeaders.length - 1" @click="conditionHeaderIndex++">后条<i class="el-icon-arrow-right el-icon--right"></i></el-button>
  580. <el-button type="primary" :disabled="itemValue.itemByCondition === 'N'" @click="conditionHeaderIndex = conditionHeaders.length - 1">末条<i class="el-icon-d-arrow-right el-icon--right"></i></el-button>
  581. <el-button type="primary" icon="el-icon-close" plain @click="$emit('close')">关闭</el-button>
  582. <el-button type="primary" icon="el-icon-refresh" plain @click="searchConditionHeader">刷新</el-button>
  583. </div>
  584. <div style="display: flex;margin-top: 2px;gap: 2px">
  585. <el-card class="box-card" style="width: 84%;">
  586. <div slot="header" class="clearfix" style="padding: 10px 0">
  587. <el-form v-if="conditionHeaders.length > 0" label-position="left" :model="conditionHeaders[conditionHeaderIndex]">
  588. <el-row :gutter="10">
  589. <el-col :span="6">
  590. <el-form-item label="序号:">
  591. <el-input-number disabled v-model="conditionHeaders[conditionHeaderIndex].conditionId" style="min-width: 50px;max-width: 60px" :min="1" :controls="false"></el-input-number>
  592. </el-form-item>
  593. </el-col>
  594. <el-col :span="14">
  595. <el-form-item label="条件描述:" label-width="70px">
  596. <el-input readonly v-model="conditionHeaders[conditionHeaderIndex].conditionDesc"></el-input>
  597. </el-form-item>
  598. </el-col>
  599. </el-row>
  600. <el-row :gutter="10">
  601. <el-col :span="6">
  602. <el-form-item label="有效:">
  603. <el-checkbox disabled v-model="conditionHeaders[conditionHeaderIndex].active" true-label="Y" false-label="N"></el-checkbox>
  604. </el-form-item>
  605. </el-col>
  606. <el-col :span="14">
  607. <el-form-item label="条件名称:" label-width="70px">
  608. <el-input readonly v-model="conditionHeaders[conditionHeaderIndex].conditionName"></el-input>
  609. </el-form-item>
  610. </el-col>
  611. </el-row>
  612. </el-form>
  613. </div>
  614. <div style="height: 200px;overflow-y: auto;">
  615. <div v-for="(o, index) in conditionDetails" :key="o.seqNo" @click="selectionDetailIndex = index" :style="{backgroundColor: selectionDetailIndex === index? '#E8F7F6' : '#FFF'}"
  616. style="padding: 5px 0;cursor:pointer;border-bottom: 1px solid #ebeef5;color: #606266;font-size: 12px;line-height: 14px;">
  617. <!-- {{`${o.SQLStatementExecuteCalculate === '1' ? '并且' : '或者' }(${o.itemDesc}=${o.itemValue})`}}-->
  618. <span v-if="o.SQLStatementExecuteCalculate === '1'">并且 {{`(${o.itemDesc}=${o.itemValue})`}}</span>
  619. <span v-else-if="o.SQLStatementExecuteCalculate === '0'">或者 {{`(${o.itemDesc}=${o.itemValue})`}}</span>
  620. <span v-else-if="o.SQLStatementExecuteCalculate === '2'">并且 .. { {{`(${o.itemDesc}=${o.itemValue})`}}</span>
  621. <span v-if="o.SQLStatementExecuteFlag === 'Y'">.. }</span>
  622. </div>
  623. </div>
  624. </el-card>
  625. <div style="border: 1px solid #ebeef5;padding: 10px 20px;box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);width: 20%;display: flex;flex-direction: column;align-items: center;justify-content: flex-start">
  626. <div style="text-align: center">
  627. <el-button type="primary" icon="el-icon-plus" @click="clickConditionDetailBtn" :disabled="itemValue.itemByCondition === 'N'">新增</el-button>
  628. </div>
  629. <div style="text-align: center">
  630. <el-button type="primary" icon="el-icon-edit" @click="handleEditConditionDetail" :disabled="itemValue.itemByCondition === 'N' || selectionDetailIndex === -1">编辑</el-button>
  631. </div>
  632. <div style="text-align: center">
  633. <el-button type="primary" icon="el-icon-delete" @click="removeConditionDetailList" :disabled="itemValue.itemByCondition === 'N' || selectionDetailIndex === -1">删除</el-button>
  634. </div>
  635. </div>
  636. </div>
  637. </div>
  638. <div style="margin-top: 10px;border-top: 1px solid #ebeef5;">
  639. <div>可选值列表:</div>
  640. <div>
  641. <el-button type="primary" @click="saveItemValueBtn">新增</el-button>
  642. <el-button type="primary" @click="saveItemValueListBtn">快捷输入</el-button>
  643. </div>
  644. <el-table :data="itemValueList" height="300" border style="width: 100%">
  645. <el-table-column prop="valueNo" header-align="center" align="left" min-width="120" width="140" label="简码"></el-table-column>
  646. <el-table-column prop="itemValue" header-align="center" align="left" label="值"></el-table-column>
  647. <el-table-column label="操作" header-align="center" align="center" width="160">
  648. <template slot-scope="{row,$index}">
  649. <el-link style="cursor:pointer;" @click="clickSaveItemValueBtn(row)">编辑</el-link>
  650. <el-link style="cursor:pointer;" @click="removeCodeItemValue(row)">删除</el-link>
  651. <el-link style="cursor:pointer;" @click="handleQueryCodeItemValue(row)">被引用的条件</el-link>
  652. </template>
  653. </el-table-column>
  654. </el-table>
  655. </div>
  656. <el-dialog :title="`条件${saveFlag}`" :close-on-click-modal="false" v-drag :visible.sync="saveConditionHeaderFlag" @close="closeSaveConditionHeader" width="400px" append-to-body>
  657. <el-form ref="saveForm" label-position="top" :model="conditionHeader" :rules="saveRules" label-width="80px">
  658. <el-row :gutter="10">
  659. <el-col :span="4">
  660. <el-form-item label="序号:" prop="conditionId">
  661. <el-input-number :controls="false" disabled v-model="conditionHeader.conditionId"></el-input-number>
  662. </el-form-item>
  663. </el-col>
  664. <el-col :span="20">
  665. <el-form-item label="条件描述:" prop="conditionDesc" :show-message="false">
  666. <el-input :disabled="itemValue.itemByCondition === 'N'" v-model="conditionHeader.conditionDesc"></el-input>
  667. </el-form-item>
  668. </el-col>
  669. </el-row>
  670. <el-row :gutter="10">
  671. <el-col :span="4">
  672. <!-- <el-form-item label="有效:" prop="active">-->
  673. <el-form-item label=" ">
  674. <el-checkbox :disabled="itemValue.itemByCondition === 'N'" v-model="conditionHeader.active" true-label="Y" false-label="N">有效</el-checkbox>
  675. <!-- <el-select v-model="conditionHeader.active" placeholder="请选择" :show-message="false">-->
  676. <!-- <el-option label="Y" value="Y"></el-option>-->
  677. <!-- <el-option label="N" value="N"></el-option>-->
  678. <!-- </el-select>-->
  679. </el-form-item>
  680. </el-col>
  681. <el-col :span="20">
  682. <el-form-item label="条件名称:" prop="conditionName" :show-message="false">
  683. <el-input v-model="conditionHeader.conditionName"></el-input>
  684. </el-form-item>
  685. </el-col>
  686. </el-row>
  687. </el-form>
  688. <el-footer style="height:30px;text-align:center;margin-top: 8px">
  689. <el-button type="primary" @click="saveConditionHeaderBtn">保存</el-button>
  690. <el-button type="primary" @click="saveConditionHeaderFlag = false">关闭</el-button>
  691. </el-footer>
  692. </el-dialog>
  693. <!--可选值-->
  694. <el-dialog :title="`可选值${saveFlag}`" :close-on-click-modal="false" v-drag :visible.sync="saveItemValueFlag" @close="closeSaveItemValue" width="400px" append-to-body>
  695. <el-form ref="saveItemValueForm" label-position="top" :model="itemValueModal" :rules="saveItemValueRules" label-width="80px">
  696. <el-form-item label="简码:" prop="valueNo" :show-message="false">
  697. <el-input v-model="itemValueModal.valueNo" style="width: 40%"></el-input>
  698. </el-form-item>
  699. <el-form-item label="值:" prop="itemValue" :show-message="false">
  700. <el-input v-model="itemValueModal.itemValue" style="width: 100%"></el-input>
  701. </el-form-item>
  702. </el-form>
  703. <el-footer style="height:30px;text-align:center;margin-top: 8px">
  704. <el-button type="primary" @click="saveItemValue">{{saveFlag==='新增'?'应用':'保存'}}</el-button>
  705. <el-button type="primary" @click="saveItemValueFlag = false">关闭</el-button>
  706. </el-footer>
  707. </el-dialog>
  708. <el-dialog title="条件定义" v-drag :close-on-click-modal="false" :visible.sync="itemDefModalVisible" @close="closeConditionDetail" width="400px" append-to-body>
  709. <el-form ref="formConditionDetail" label-position="top" :rules="detailRules" :model="conditionDetailModal" >
  710. <el-row :gutter="10">
  711. <el-col :span="10">
  712. <el-form-item label="运算符号:" prop="SQLStatementExecuteCalculate" :show-message="false">
  713. <el-select v-model="conditionDetailModal.SQLStatementExecuteCalculate" style="width: 100%" placeholder="请选择" >
  714. <el-option label="并且" value="1"></el-option>
  715. <el-option label="并且..{" value="2"></el-option>
  716. <el-option label="或者" value="0"></el-option>
  717. </el-select>
  718. </el-form-item>
  719. </el-col>
  720. <el-col :span="14">
  721. <el-form-item label="元素名称:" prop="SQLStatementExecuteItem" :show-message="false">
  722. <el-select v-model="conditionDetailModal.SQLStatementExecuteItem" style="width: 100%" @change="changeItemDef">
  723. <el-option v-for="(o, index) in itemDefs" :key="o.itemNo" :label="`(${o.itemNo})${o.itemDesc}`" :value="o.itemNo"></el-option>
  724. </el-select>
  725. </el-form-item>
  726. </el-col>
  727. </el-row>
  728. <el-row :gutter="10">
  729. <el-col :span="24">
  730. <el-form-item label="元素可选值:" prop="SQLStatementExecuteValueItemNo" :show-message="false">
  731. <el-select filterable v-model="conditionDetailModal.SQLStatementExecuteValueItemNo" style="width: 100%">
  732. <div v-for="(o, index) in saveItemValueList" :key="index">
  733. <el-option :label="`(${o.valueNo})${o.itemValue}`" :value="o.valueItemNo">
  734. <span style="float: left">{{ `(${o.valueNo})${o.itemValue}` }}</span>
  735. <span style="float: right; color: #8492a6; font-size: 13px">{{o.conditionName}}</span>
  736. </el-option>
  737. </div>
  738. </el-select>
  739. </el-form-item>
  740. </el-col>
  741. </el-row>
  742. <el-form-item label="" prop="SQLStatementExecuteValueFlag" :show-message="false">
  743. <el-checkbox v-model="conditionDetailModal.SQLStatementExecuteFlag" true-label="Y" false-label="N">添加括号</el-checkbox>
  744. </el-form-item>
  745. </el-form>
  746. <el-footer style="height:30px;text-align:center;margin-top: 8px">
  747. <el-button type="primary" v-if="!conditionDetailModal.seqNo" @click="saveConditionDetail">应用</el-button>
  748. <el-button type="primary" v-else @click="handleUpdateConditionDetail">确定</el-button>
  749. <el-button type="primary" @click="itemDefModalVisible = false">关闭</el-button>
  750. </el-footer>
  751. </el-dialog>
  752. <el-dialog title="元素可选值快速输入" v-drag :close-on-click-modal="false" :visible.sync="saveItemValueListDialog" append-to-body width="520px">
  753. <el-form label-position="top" style="margin-bottom: 10px">
  754. <el-row :gutter="10">
  755. <el-col :span="6">
  756. <el-form-item label="元素">
  757. <el-input v-model="itemValue.itemDesc" readonly ></el-input>
  758. </el-form-item>
  759. </el-col>
  760. <el-col :span="12">
  761. <el-form-item label="条件描述">
  762. <el-input v-if="conditionHeaders.length > 0" v-model="conditionHeaders[conditionHeaderIndex].conditionDesc" readonly ></el-input>
  763. </el-form-item>
  764. </el-col>
  765. </el-row>
  766. </el-form>
  767. <!--表格形式-->
  768. <el-transfer class="rq" :props="{key: 'valueItemNo',label: 'itemValue' }"
  769. filterable v-model="itemValueListSelected" @change="handleSelectChange"
  770. :data="itemValueAllList" :titles="['全部值', '已选值']">
  771. <span slot-scope="{option}">{{option.valueNo}} - {{option.itemValue}}</span>
  772. </el-transfer>
  773. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  774. <el-button type="primary" @click="saveItemValueListDialog = false">关闭</el-button>
  775. </el-footer>
  776. </el-dialog>
  777. <el-dialog title="被引用的条件" v-drag :close-on-click-modal="false" top="20vh" :visible.sync="queryCodeItemValueDialog" append-to-body width="520px">
  778. <el-table :data="queryCodeItemValueList" height="300px" border>
  779. <el-table-column prop="itemNo" label="元素序号"></el-table-column>
  780. <el-table-column prop="itemDesc" label="元素描述"></el-table-column>
  781. <el-table-column prop="conditionId" label="条件序号"></el-table-column>
  782. <el-table-column prop="conditionDesc" label="条件描述"></el-table-column>
  783. </el-table>
  784. <el-footer style="height:30px;margin-top: 10px;text-align:center">
  785. <el-button type="primary" @click="queryCodeItemValueDialog = false">关闭</el-button>
  786. </el-footer>
  787. </el-dialog>
  788. </div>
  789. </template>
  790. <style scoped>
  791. .el-card /deep/ .el-card__header{
  792. padding: 0px 20px;
  793. }
  794. .el-form-item /deep/ .el-form-item__content{
  795. line-height: 30px ;
  796. }
  797. .rq /deep/ .el-transfer-panel .el-transfer-panel__header {
  798. height: 35px;
  799. line-height: 35px;
  800. }
  801. .rq /deep/ .el-transfer-panel .el-transfer-panel__header .el-checkbox {
  802. line-height: 35px;
  803. }
  804. .rq /deep/ .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
  805. color: #fff
  806. }
  807. .rq /deep/ .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span {
  808. color: #3c3c3e;
  809. }
  810. .rq /deep/ .el-transfer-panel .el-checkbox__inner::after {
  811. height: 8px;
  812. width: 4px;
  813. }
  814. </style>