batchSetPublicDia.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div>
  3. <el-dialog
  4. :visible.sync="show"
  5. :close-on-click-modal="false"
  6. :modal-append-to-body="false"
  7. @close="handleClose"
  8. custom-class="set-shared-dialog"
  9. center
  10. top="2vh"
  11. width="1200px"
  12. v-dialogDrag
  13. title="批量设置公开"
  14. >
  15. <div class="wrap">
  16. <el-table
  17. :data="tableData"
  18. border
  19. height="50vh"
  20. ref="addTableRef"
  21. >
  22. <el-table-column :label="source==='edb'?'指标名称':'图表名称'" align="center">
  23. <template slot-scope="{row}">{{row.Name}}</template>
  24. </el-table-column>
  25. <el-table-column align="center" width="350px">
  26. <template slot="header" slot-scope="scope">
  27. <el-radio-group
  28. v-model="classifyType"
  29. >
  30. <el-radio :label="0">{{ $t('EtaBasePage.subdirectory_radio') }}</el-radio>
  31. <el-radio :label="1">{{ $t('EtaBasePage.directory_radio') }}</el-radio>
  32. </el-radio-group>
  33. <el-cascader
  34. v-model="selectClassify"
  35. :options="classifyOption"
  36. :props="{
  37. label: 'ClassifyName',
  38. value: 'ClassifyId',
  39. children: 'Children',
  40. checkStrictly: true,
  41. emitPath:false
  42. }"
  43. :placeholder="$t('Edb.InputHolderAll.input_menu')"
  44. v-if="classifyType === 1"
  45. @change="handleClassifyAllChange(row)"
  46. class="header-cascader"
  47. />
  48. </template>
  49. <template slot-scope="{row}">
  50. <el-cascader
  51. v-model="row.PublicClassifyId"
  52. :options="classifyOption"
  53. :props="{
  54. label: 'ClassifyName',
  55. value: 'ClassifyId',
  56. children: 'Children',
  57. checkStrictly: true,
  58. emitPath:false
  59. }"
  60. :placeholder="$t('Edb.InputHolderAll.input_menu')"
  61. :disabled="(classifyType===1)"
  62. size="small"
  63. />
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <div class="reason-wrapper" v-if="isNeedPublicApprove">
  68. <label class="el-form-item__label">公开理由</label>
  69. <el-input
  70. type="textarea"
  71. :rows="5"
  72. placeholder="请输入公开理由"
  73. v-model="reason"
  74. style="width:500px"
  75. />
  76. </div>
  77. </div>
  78. <div class="dia-bot">
  79. <el-button type="primary" plain @click="handleClose">取消</el-button>
  80. <el-button type="primary" @click="handleConfirm">确定</el-button>
  81. </div>
  82. </el-dialog>
  83. </div>
  84. </template>
  85. <script>
  86. import { edbBaseV2Interface } from '@/api/modules/chartApi';
  87. export default {
  88. props: {
  89. show: {
  90. type: Boolean
  91. },
  92. source: { //指标或图库
  93. type: String,
  94. default: 'edb'
  95. },
  96. checkedParams: {
  97. type: Object
  98. }
  99. },
  100. watch: {
  101. show(nval) {
  102. if(!nval) return
  103. this.getList()
  104. this.getApproveAuth()
  105. this.getClassifyOpts()
  106. }
  107. },
  108. data() {
  109. return {
  110. reason:'',
  111. tableData:[],
  112. classifyOption: [],
  113. classifyType:0,//目录方式
  114. selectClassify: 0,//选择的分类
  115. isNeedPublicApprove: true,//是否需要公开走审批
  116. }
  117. },
  118. methods:{
  119. handleClose() {
  120. this.tableData = [];
  121. this.reason = '';
  122. this.isNeedPublicApprove = true;
  123. this.classifyType = 0;//目录方式
  124. this.selectClassify = 0;//选择的分类
  125. this.$emit('update:show',false);
  126. },
  127. async handleConfirm() {
  128. const res = this.source === 'edb'
  129. ? await edbBaseV2Interface.setEdbPublic({
  130. EdbInfoList: this.tableData.map(_ => ({
  131. EdbInfoId: _.EdbInfoId,
  132. ClassifyId: _.PublicClassifyId
  133. })),
  134. Description: this.reason
  135. })
  136. : null
  137. if(res.Ret !== 200) return
  138. this.$message.success(this.isNeedPublicApprove?'已提交申请,请等待审批':'设置成功')
  139. this.handleClose()
  140. this.$emit('confirm')
  141. },
  142. handleClassifyAllChange(e){
  143. this.tableData.forEach(item=>{
  144. item.PublicClassifyId = this.selectClassify;
  145. })
  146. },
  147. async getList() {
  148. const res = this.source === 'edb'
  149. ? await edbBaseV2Interface.getPublicSearchListAll({
  150. ...this.checkedParams
  151. })
  152. : null
  153. if(res.Ret !== 200) return
  154. this.tableData = res.Data.List && res.Data.List.map(_ =>({
  155. ..._,
  156. PublicClassifyId: 0,
  157. Name: this.source==='edb' ? _.EdbName : _.ChartName
  158. }));
  159. },
  160. //获取是否需要审批
  161. async getApproveAuth() {
  162. const res = await edbBaseV2Interface.getSetPublicApprove({
  163. DataType: this.source==='edb'?1:2
  164. })
  165. if(res.Ret !== 200) return
  166. this.isNeedPublicApprove = res.Data;
  167. },
  168. //公开目录
  169. async getClassifyOpts() {
  170. const res = this.source === 'edb'
  171. ? await edbBaseV2Interface.getPublicClassifyBase()
  172. : null
  173. if(res.Ret!==200) return
  174. this.classifyOption = res.Data.AllNodes || [];
  175. this.filterNodes(this.classifyOption)
  176. },
  177. filterNodes(arr) {
  178. arr.length && arr.forEach(item => {
  179. item.Children && item.Children.length && this.filterNodes(item.Children)
  180. if(!item.Children.length) {
  181. delete item.Children
  182. }
  183. })
  184. },
  185. },
  186. }
  187. </script>
  188. <style scoped lang='scss'>
  189. .reason-wrapper {
  190. display: flex;
  191. margin: 20px 0;
  192. }
  193. .header-cascader {
  194. width: 160px;
  195. }
  196. .cascader-wrapper {
  197. width: 340px;
  198. }
  199. .dia-bot {
  200. margin: 30px 0;
  201. display: flex;
  202. justify-content: center;
  203. gap: 20px;
  204. .el-button {
  205. width: 120px;
  206. }
  207. }
  208. </style>