Newer
Older
KaiFengPC / src / views / project / compensation / noticeRewardComponents / todoDon.vue
@zhangdeliang zhangdeliang on 23 May 6 KB 初始化项目
  1. <template>
  2. <div class="water-analysis-page1">
  3. <el-table :key="isFlag" :data="tableData" @selection-change="selectionChange" v-loading="tableLoading" max-height="500">
  4. <!-- <el-table-column type="index" width="55" label="序号" /> -->
  5. <el-table-column type="selection" width="55" />
  6. <el-table-column label="文档编码" prop="documentCode" show-overflow-tooltip />
  7. <el-table-column label="文档名称" prop="documentName" show-overflow-tooltip />
  8. <el-table-column label="文档负责人" prop="documentDutyUserName" width="160" show-overflow-tooltip>
  9. <template #default="{ row }">
  10. {{ getuserLists(row.documentDutyUserName)?.nickName || 1 }}
  11. </template>
  12. </el-table-column>
  13. <el-table-column label="联系方式" prop="remark" show-overflow-tooltip>
  14. <template #default="{ row }">
  15. {{ getuserLists(row.documentDutyUserName)?.phonenumber || 1 }}
  16. </template>
  17. </el-table-column>
  18. <el-table-column label="文档内容" prop="status">
  19. <template #default="{ row }">
  20. <span v-html="row.documentContent"></span>
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="操作" width="280">
  24. <template #default="{ row }">
  25. <!-- <el-button icon="Connection" link type="primary" @click="onCheck(row, 0, '配置')">配置</el-button> -->
  26. <el-button icon="View" link type="primary" @click="onCheck(row, 1, '详情')">详情</el-button>
  27. <el-button icon="Edit" link type="warning" @click="onCheck(row, 2, '修改')">修改</el-button>
  28. <el-button icon="Delete" link type="danger" @click="onCheck(row, 3)">删除</el-button>
  29. </template>
  30. </el-table-column>
  31. </el-table>
  32. <pagination
  33. v-show="totals > 0"
  34. :total="totals"
  35. v-model:page="FormList.pageNum"
  36. v-model:limit="FormList.pageSize"
  37. @pagination="getInfoList(FormList)"
  38. />
  39. <el-dialog v-model="visible" :title="'奖补须知 ' + title" :modal-append-to-body="false" :close-on-click-modal="false" width="50%">
  40. <tableDalgo
  41. ref="tableDalgoRef"
  42. v-if="visible"
  43. :configOpts="configOpts"
  44. @onModalClose="onModalClose"
  45. :typeList="typeList"
  46. ></tableDalgo>
  47. <template #footer>
  48. <div class="dialog-footer">
  49. <el-button v-if="typeList?.type != 1" type="primary" @click="submit">保存</el-button>
  50. <el-button @click="visible = false">关闭</el-button>
  51. </div>
  52. </template>
  53. </el-dialog>
  54. </div>
  55. </template>
  56. <script setup>
  57. import { required } from '@/utils/validate-helper';
  58. import { getInfo, projectInfoDelete, projectInfoGet, getProjectItemDescriptionConfigList } from '@/api/project/noticeReward';
  59. import tableDalgo from './tableDalgo.vue';
  60. import { formatMonths } from '@/utils';
  61. import emgBox1 from '@/utils/ElMessageBox1';
  62. import { ElMessage } from 'element-plus';
  63. import { FileSystemList } from '@/api/project/tenderReview';
  64.  
  65. const { proxy } = getCurrentInstance();
  66. const { userLists } = defineProps(['userLists']);
  67. console.log(userLists, 'userLists');
  68. const tableDalgoRef = ref();
  69. let visible = ref(false);
  70. let isFlag = ref(1);
  71. const title = ref('');
  72. const FormList = ref({
  73. pageNum: 1,
  74. pageSize: 10,
  75. });
  76. const totals = ref(0);
  77. let dataForm = reactive({
  78. date: formatMonths(new Date()),
  79. tableData: '',
  80. tableDateTwo: '',
  81. tableLoading: true,
  82. });
  83. let { date, tableData, tableDateTwo, tableLoading } = toRefs(dataForm);
  84. const visible1 = ref(false);
  85. const list = ref([]);
  86. const loading = ref(false);
  87. const form = reactive({
  88. projectTypeId: '',
  89. projectContentType: '',
  90. propertyKey: '',
  91. propertyName: '',
  92. sort: '',
  93. });
  94. const rules = reactive({
  95. projectContentType: required('项目内容类型'),
  96. propertyKey: required('项目内容'),
  97. propertyName: required('项目内容名称'),
  98. sort: required('排序'),
  99. });
  100. let row = {};
  101. const visible2 = ref(false);
  102. const outRow = shallowRef({});
  103. //获取列表数据
  104. const getInfoList = async prams => {
  105. tableLoading.value = true;
  106. let { data, total } = await getInfo(prams);
  107. tableData.value = data;
  108. totals.value = total;
  109. setTimeout(() => {
  110. tableLoading.value = false;
  111. }, 1000);
  112. };
  113. //搜索
  114. const search = p => {
  115. FormList.value.pageNum = 1;
  116. getInfoList(p);
  117. };
  118. defineExpose({ search, delAll });
  119. // 查看上报数据
  120. let typeList = ref({});
  121. const onCheck = (row, ty, t) => {
  122. title.value = t;
  123. if (ty == 1 || ty == 2) {
  124. projectInfoGet(row.id).then(({ code, data }) => {
  125. if (code == 200) {
  126. typeList.value = { ...data, type: ty };
  127. FileSystemList({
  128. refId: row.id,
  129. refType: 'projectBonusNotice',
  130. }).then(({ data }) => {
  131. typeList.value.fileList1 = data;
  132. visible.value = true;
  133. });
  134. }
  135. });
  136. } else if (ty == 3) {
  137. emgBox1(row.id, projectInfoDeleteM, '您确定删除吗?');
  138. } else if (ty === 0) {
  139. visible1.value = true;
  140. outRow.value = row;
  141. form.projectTypeId = row.id;
  142. getList(row.id);
  143. }
  144. };
  145. //删除
  146. const projectInfoDeleteM = async id => {
  147. let { code } = await projectInfoDelete(id);
  148. if (code == 200) {
  149. ElMessage({
  150. type: 'success',
  151. message: '操作成功',
  152. });
  153. getInfoList(FormList.value);
  154. }
  155. };
  156. //撤回操作
  157. const Returncnfiorm = async id => {
  158. let { code } = await projectInfoDelete(id);
  159. };
  160. function onModalClose() {
  161. visible.value = false;
  162. console.log('object', 3444);
  163.  
  164. getInfoList(FormList.value);
  165. }
  166. function submit() {
  167. tableDalgoRef.value.submit();
  168. }
  169.  
  170. const closeDialog = () => {
  171. visible1.value = false;
  172. };
  173. const del = (row, index) => {
  174. proxy.$modal
  175. .confirm('是否确认删除?')
  176. .then(async () => {
  177. list.value.splice(index, 1);
  178. })
  179. .catch(() => {});
  180. };
  181. function delAll() {
  182. if (selectData.value.length == 0) {
  183. ElMessage({
  184. message: '请选要删除数据',
  185. type: 'warning',
  186. });
  187. return;
  188. } else {
  189. let arr = [];
  190. selectData.value.forEach(i => {
  191. arr.push(i.id);
  192. });
  193. console.log(arr.join(','), 333);
  194. emgBox1(arr.join(','), projectInfoDeleteM, '您确定删除吗?');
  195. }
  196. }
  197. const getList = async id => {
  198. const res = await getProjectItemDescriptionConfigList({ projectTypeId: id });
  199. if (res?.code !== 200) return;
  200. list.value = res?.data || [];
  201. };
  202. //选择删除
  203. const selectData = ref([]);
  204. function selectionChange(v) {
  205. selectData.value = v;
  206. }
  207. function getuserLists(v) {
  208. let arr = {};
  209. userLists.map(k => {
  210. if (String(k.userId) == v) {
  211. arr = k;
  212. }
  213. });
  214. return arr;
  215. }
  216. onMounted(() => {
  217. getInfoList(FormList.value);
  218. });
  219. </script>
  220. <style lang="scss" scoped>
  221. .water-analysis-page1 {
  222. height: 90vh;
  223. :deep(.formItem) {
  224. .el-form-item__label {
  225. width: 110px;
  226. word-break: keep-all;
  227. }
  228. }
  229. }
  230.  
  231. .btns {
  232. display: flex;
  233. justify-content: flex-end;
  234. margin-bottom: 15px;
  235. }
  236. </style>