index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <div class="app-container">
  3. <el-row slot="rightBar">
  4. <!--用户数据-->
  5. <el-col>
  6. <div class="main-right-box">
  7. <!-- 搜索条件 -->
  8. <div class="main-search-box">
  9. <!-- 搜索条件 -->
  10. <el-form
  11. :model="queryParams"
  12. ref="queryForm"
  13. size="small"
  14. :inline="true"
  15. v-show="showSearch"
  16. >
  17. <el-form-item label="组织机构:" class="formTreeItem">
  18. <tree-select
  19. v-model="queryParams.orgId"
  20. :options="deptOptions"
  21. :show-count="true"
  22. :normalizer="tenantIdnormalizer"
  23. :props="{ checkStrictly: true, label: 'name' }"
  24. placeholder="请选择归属机构"
  25. clearValueText="清除"
  26. :noChildrenText="''"
  27. @select="changeSelect"
  28. noOptionsText="没有数据"
  29. noResultsText="没有搜索结果"
  30. />
  31. </el-form-item>
  32. <el-form-item label="外包评价名称:" label-width="50">
  33. <el-select v-model="queryParams.planId" @change="changeHandler">
  34. <el-option
  35. v-for="item in options"
  36. :key="item.id"
  37. :label="item.evaluateName"
  38. :value="item.id"
  39. >
  40. </el-option>
  41. </el-select>
  42. </el-form-item>
  43. </el-form>
  44. <!-- 按纽 -->
  45. <el-row :gutter="10" >
  46. <el-col :span="1.5">
  47. <el-button
  48. type="primary"
  49. icon="el-icon-search"
  50. size="mini"
  51. @click="handleQuery"
  52. >搜索</el-button
  53. >
  54. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery"
  55. >重置</el-button
  56. >
  57. <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport"
  58. v-hasPermi="['core:evaluateTaskReport:export']">导出数据
  59. </el-button>
  60. </el-col>
  61. </el-row>
  62. </div>
  63. </div>
  64. <div
  65. v-if="obj && obj.length > 0"
  66. class="securityEquipmentMonitoringtable ml-4 flex-1"
  67. >
  68. <div class="title">{{ fullTableTitle }}</div>
  69. <table ref="tb11" class="table-scroll">
  70. <tr>
  71. <th colspan="1" rowspan="1">序号</th>
  72. <th colspan="1" rowspan="1" :key="item" v-for="item in obj">
  73. {{ item }}
  74. </th>
  75. </tr>
  76. <tr v-for="(item, index) in targetList" :key="index">
  77. <td>{{ index+1 }}</td>
  78. <td v-for="i in obj" :key="i">{{ item[i] }}</td>
  79. </tr>
  80. <tr>
  81. <th :colspan="obj.length" rowspan="1">平均得分</th>
  82. <th :colspan="1" rowspan="1">{{average}}</th>
  83. </tr>
  84. </table>
  85. </div>
  86. </el-col>
  87. </el-row>
  88. </div>
  89. </template>
  90. <script>
  91. import { mapGetters } from "vuex";
  92. import { findAllRole } from "@/api/system/role";
  93. import { list, getPlanList } from "@/api/evaluateTable/evaluateTable.js";
  94. import { newDateMonth } from "@/utils/index.js";
  95. import { deptTreeSelect } from "@/api/system/public";
  96. export default {
  97. name: "SocWebIndex",
  98. components: {
  99. },
  100. data() {
  101. const { params, query } = this.$route;
  102. return {
  103. targetList: [],
  104. average:0,
  105. obj: {},
  106. loading: false,
  107. average:'',//平均值
  108. selectedValues: [],
  109. planRoles: [],
  110. options: [],
  111. fullTableTitle: "对押运公司月度评价",
  112. orgName:null,
  113. queryParams: {
  114. orgId: null,
  115. planId: "",
  116. // date: newDateMonth("", "1"),
  117. },
  118. // 显示搜索条件
  119. showSearch: true,
  120. total: 0,
  121. dataList: [],
  122. deptOptions: [], //机构数组
  123. };
  124. },
  125. created() {
  126. this.getDeptTree();
  127. this.getevlauteList();
  128. },
  129. watch: {
  130. queryParams() {
  131. this.getList();
  132. },
  133. },
  134. mounted() {
  135. if (this.deptOptions) {
  136. this.queryParams.orgId = this.orgId;
  137. }
  138. },
  139. computed: {
  140. ...mapGetters(["orgId"]),
  141. },
  142. methods: {
  143. changeHandler() {
  144. this.getList();
  145. },
  146. changeSelect() {
  147. this.getList();
  148. },
  149. /** 查询机构树数据 */
  150. getDeptTree() {
  151. deptTreeSelect().then((response) => {
  152. this.deptOptions = response.data;
  153. this.queryParams.orgId=response.data[0].id;
  154. });
  155. },
  156. /** 获取所有计划列表 */
  157. getevlauteList() {
  158. getPlanList().then((res) => {
  159. this.queryParams.planId = res[0].id;
  160. this.options = res;
  161. console.log(res,'res');
  162. if (this.queryParams.orgId && this.queryParams.planId) {
  163. this.getList();
  164. }
  165. });
  166. },
  167. /** treeSelect组件自定义数据*/
  168. tenantIdnormalizer(node, instanceId) {
  169. if (node.children && !node.children.length) {
  170. delete node.children;
  171. }
  172. return {
  173. id: node.id,
  174. label: node.shortName,
  175. children: node.children,
  176. };
  177. },
  178. handleExport() {
  179. this.download('core/task/export', {
  180. ...this.queryParams
  181. }, `${'【'+this.orgName+'】'+'-外包履职评价报表-'+this.formatTime(new Date(),'YYYYMMDD')}.xlsx`)
  182. },
  183. //获取列表
  184. getList() {
  185. this.loading = true;
  186. list(this.queryParams).then((res) => {
  187. let { code, data, msg } = res;
  188. if (code == 200) {
  189. this.targetList = data.list || [];
  190. this.fullTableTitle=res.tittle;
  191. this.orgName=res.orgName;
  192. this.average=data.average||0
  193. if (this.targetList) {
  194. this.obj = Object.keys(this.targetList[0]);
  195. }
  196. }
  197. this.loading = false;
  198. });
  199. },
  200. /** 新增按钮操作 */
  201. handleAdd() {
  202. this.$refs.Evaluate.show();
  203. },
  204. editHandler(row) {
  205. this.$refs.Evaluate.show(row);
  206. },
  207. /** 搜索按钮操作 */
  208. handleQuery() {
  209. this.getList();
  210. },
  211. /** 重置按钮操作 */
  212. resetQuery() {
  213. this.queryParams = {
  214. orgId: this.orgId,
  215. planId: this.options[0].id,
  216. };
  217. this.getList();
  218. },
  219. //导出
  220. exportExcel() {},
  221. },
  222. };
  223. </script>
  224. <style lang="scss" scoped>
  225. ::v-deep.formTreeItem {
  226. .el-form-item__content {
  227. width: 264px;
  228. }
  229. }
  230. .securityEquipmentMonitoringtable {
  231. background-color: #fff;
  232. .table-scroll {
  233. // table-layout:auto;
  234. color: #000000;
  235. min-width: 100%;
  236. border-spacing: 0;
  237. text-align: center;
  238. border-collapse: collapse;
  239. max-height: 500px;
  240. overflow-y: auto;
  241. font-family: "仿宋_GB2312";
  242. .orgName {
  243. min-width: 180px !important;
  244. width: 180px !important;
  245. }
  246. tr th,
  247. tr td {
  248. height: 25px;
  249. border: 1px solid rgb(0, 0, 0);
  250. // min-width: 75px;
  251. }
  252. .jump {
  253. color: #02a7f0;
  254. text-decoration: underline;
  255. }
  256. .nojump {
  257. color: #000000;
  258. font-size: 10;
  259. //font-weight: bold;
  260. }
  261. .greentd {
  262. color: green;
  263. }
  264. .redtd {
  265. color: red;
  266. }
  267. }
  268. }
  269. .title {
  270. clear: both;
  271. margin: auto;
  272. text-align: center;
  273. color: black;
  274. font-size: x-large;
  275. letter-spacing: 3px;
  276. font-weight: bold;
  277. }
  278. </style>