index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="sensitive-words">
  3. <pageSearch ref="searchTableRef" :searchConfig="searchConfig">
  4. <template #publishingUnit="scope">
  5. <el-tree-select
  6. v-model="scope.value"
  7. :data="treeData"
  8. node-key="strId"
  9. filterable
  10. @change="newVal => onMessageChange(scope, newVal)"
  11. placeholder="请选择发布单位"
  12. />
  13. </template>
  14. </pageSearch>
  15. <pageContent ref="tableListRef" :total="total" :contentConfig="contentConfig" :pageList="tableData">
  16. <template #button>
  17. <el-button type="primary" @click="handleAdd()">新增</el-button>
  18. </template>
  19. <!-- 发出单位 -->
  20. <template #deliveryUnit="scope">
  21. <template :index="index" v-for="(item, index) in bj_lssuing_unit">
  22. <template :index="index" v-if="item.value == scope.row.deliveryUnit">{{ item.label }}</template>
  23. </template>
  24. </template>
  25. <!-- 通报类型 -->
  26. <template #notificationType="scope">
  27. <template :index="index" v-for="(item, index) in bj_notification_type">
  28. <el-tag :index="index" v-if="item.value == scope.row.notificationType" type="success">{{
  29. item.label
  30. }}</el-tag>
  31. </template>
  32. </template>
  33. <!-- 通报事项类别 -->
  34. <template #conm="scope">
  35. <template :index="index" v-for="(item, index) in bj_category_onm">
  36. <el-tag :index="index" v-if="item.value == scope.row.conm" type="primary">{{ item.label }}</el-tag>
  37. </template>
  38. </template>
  39. <!-- 发布状态 -->
  40. <template #releaseStatus="scope">
  41. <template :index="index" v-for="(item, index) in bj_nl_released_status">
  42. <el-tag
  43. :index="index"
  44. v-if="item.value == scope.row.releaseStatus"
  45. :type="
  46. scope.row.releaseStatus == '1' ? 'primary' : scope.row.releaseStatus == '2' ? 'success' : 'info'
  47. "
  48. >{{ item.label }}</el-tag
  49. >
  50. </template>
  51. </template>
  52. <template #operate="scope">
  53. <el-button type="primary" link @click="handleCheck(scope.row.notifiedMattersId)"> 查看 </el-button>
  54. <!-- 待提交 -->
  55. <template v-if="scope.row.releaseStatus == '1'">
  56. <el-button type="primary" link @click="handleEdit(scope.row.notifiedMattersId)"> 编辑 </el-button>
  57. <el-button type="danger" link @click="handleDelete(scope.row.notifiedMattersId)"> 删除 </el-button>
  58. </template>
  59. <!-- 可用 -->
  60. <template v-if="scope.row.releaseStatus == '2'">
  61. <el-button type="primary" link @click="handleEdit(scope.row.notifiedMattersId)"> 编辑 </el-button>
  62. <el-button type="warning" link @click="handleStatus(scope.row.notifiedMattersId, '3', '废止')">
  63. 废止
  64. </el-button>
  65. </template>
  66. <!-- 废止 -->
  67. <template v-if="scope.row.releaseStatus == '3'">
  68. <el-button type="success" link @click="handleStatus(scope.row.notifiedMattersId, '2', '启用')">
  69. 启用
  70. </el-button>
  71. </template>
  72. </template>
  73. </pageContent>
  74. <pageDetail :modalConfig="detailConfig" ref="modalRef"> </pageDetail>
  75. </div>
  76. </template>
  77. <script setup lang="ts">
  78. import contentConfig from './config/content.config';
  79. import pageContent from '@/components/components/pageContent.vue';
  80. import searchConfig from './config/search.config';
  81. import pageSearch from '@/components/components/pageSearch.vue';
  82. import detailConfig from './config/detail.config';
  83. import pageDetail from './components/detail.vue';
  84. import { changeInventoryStatus } from '@/api/notificationInfoManage/mattersmanage';
  85. import { categoryOnm, bj_notification_type, bj_lssuing_unit } from '@/plugins/dictData';
  86. import useDeptStore from '@/store/modules/dept';
  87. import useSystemStore from '@/store/main';
  88. import { outTypeList } from '@/libs/commonMeth';
  89. import { TreeOptions } from '@/types/global';
  90. const bj_nl_released_status = outTypeList('bj_nl_released_status'); //通报事项清单发布状态
  91. // 使用pinia数据
  92. const systemStore = useSystemStore();
  93. const { pageDetailInfo } = storeToRefs(systemStore);
  94. const total = ref(0);
  95. const pageSize = ref([10, 20, 30]);
  96. const tableData = ref([]);
  97. const tableListRef = ref();
  98. // 操作弹框
  99. import usePageModal from '@/components/components/hooks/usePageDetails';
  100. import PageSearch from '@/components/components/pageSearch.vue';
  101. const { modalRef, handleNewDataClick, handleEditDataClick, handleCheckDataClick, handlePageDetail } =
  102. usePageModal();
  103. // const onUnitChange = async (row: any, val) => {
  104. // console.log(row);
  105. // console.log('+++++++++++++++++++++++');
  106. // console.log(val);
  107. // };
  108. const handleEdit = async (id: string) => {
  109. await handlePageDetail(id);
  110. await handleEditDataClick();
  111. };
  112. const handleCheck = async (id: string) => {
  113. await handlePageDetail(id);
  114. await handleCheckDataClick();
  115. };
  116. const onMessageChange = (scope, newVal) => {
  117. scope.onInput(newVal);
  118. };
  119. // 新增按钮
  120. const handleAdd = () => {
  121. handleNewDataClick();
  122. };
  123. const searchTableRef = ref();
  124. // 状态按钮
  125. function handleStatus(value: string, status: string, str: string) {
  126. ElMessageBox.confirm(`是否${str}这条数据?`, '状态提示', {
  127. confirmButtonText: '确定',
  128. cancelButtonText: '取消',
  129. type: 'warning',
  130. })
  131. .then(async () => {
  132. const postData: any = await changeInventoryStatus(value, status);
  133. if (postData.code === 200) {
  134. tableListRef.value.fetchPageListData();
  135. ElMessage.success('操作成功!');
  136. } else {
  137. ElMessage.error('操作失败!');
  138. }
  139. })
  140. .catch(() => {
  141. ElMessage({
  142. type: 'info',
  143. message: '取消操作',
  144. });
  145. });
  146. }
  147. // 删除按钮
  148. function handleDelete(value: any) {
  149. ElMessageBox.confirm(`是否删除这条数据?`, '删除提示', {
  150. confirmButtonText: '确定',
  151. cancelButtonText: '取消',
  152. type: 'warning',
  153. })
  154. .then(() => {
  155. systemStore.deletePageDataAction(contentConfig.pageName, value);
  156. })
  157. .catch(() => {
  158. ElMessage({
  159. type: 'info',
  160. message: '取消删除',
  161. });
  162. });
  163. }
  164. // 筛选-状态赋值
  165. async function searchItem() {
  166. searchConfig.formItems.forEach(item => {
  167. if (item.prop === 'notificationType') {
  168. item.options = bj_notification_type;
  169. }
  170. if (item.prop === 'conm') {
  171. item.options = categoryOnm;
  172. }
  173. if (item.prop === 'releaseStatus') {
  174. item.options = bj_nl_released_status;
  175. }
  176. if (item.prop === 'deliveryUnit') {
  177. item.options = bj_lssuing_unit;
  178. }
  179. });
  180. }
  181. searchItem();
  182. const treeData = ref<TreeOptions[]>();
  183. const deptStore = useDeptStore();
  184. onMounted(async () => {
  185. // 加载组织架构
  186. if (!deptStore.hasDeptData) {
  187. await deptStore.loadDeptDataFromCache();
  188. }
  189. treeData.value = deptStore.deptData;
  190. });
  191. </script>
  192. <style scoped lang="scss">
  193. .sensitive-words {
  194. margin: 20px;
  195. // background-color: #fff;
  196. }
  197. .status {
  198. cursor: pointer;
  199. position: relative;
  200. .status-tip {
  201. position: absolute;
  202. top: 2px;
  203. left: 60px;
  204. }
  205. }
  206. .dialog-tip {
  207. text-align: center;
  208. }
  209. </style>