index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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="组织机构">
  33. <org-tree
  34. v-model="queryParams.orgId"
  35. @defaultOrg="getDefaultOrg"
  36. @checkChange="checkChange"
  37. @click="clickTreeNode"
  38. hangsheTree
  39. ref="orgTree"
  40. :showCheckSub="false"
  41. ></org-tree>
  42. </el-form-item>
  43. <el-form-item label="外包评价名称:" label-width="50">
  44. <el-select v-model="queryParams.planId" @change="changeHandler">
  45. <el-option
  46. v-for="item in options"
  47. :key="item.id"
  48. :label="item.evaluateName"
  49. :value="item.id"
  50. >
  51. </el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item v-if="this.cycle=='0'" label="月份" prop="searchTime">
  55. <el-date-picker v-model="queryParams.searchTime" align="right"
  56. placeholder="请选择查询月份" type="month" value-format='yyyy-MM'>
  57. </el-date-picker>
  58. </el-form-item>
  59. <el-form-item v-if="this.cycle=='1'"label="统计季度" prop="searchTime">
  60. <QuarterPicker format="yyyy年q季度" value-format="yyyy-MM" placeholder="请选择查询季度" v-model="queryParams.searchTime" />
  61. </el-form-item>
  62. <el-form-item v-if="this.cycle=='2'" label="年份" prop="searchTime">
  63. <el-date-picker
  64. value-format='yyyy'
  65. v-model="queryParams.searchTime"
  66. type="year"
  67. placeholder="选择查询年份">
  68. </el-date-picker>
  69. </el-form-item>
  70. </el-form>
  71. <!-- 按纽 -->
  72. <el-row :gutter="10" >
  73. <el-col :span="1.5">
  74. <el-button
  75. type="primary"
  76. icon="el-icon-search"
  77. size="mini"
  78. @click="handleQuery"
  79. >搜索</el-button
  80. >
  81. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery"
  82. >重置</el-button
  83. >
  84. <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport"
  85. v-hasPermi="['core:evaluateTaskReport:export']">导出数据
  86. </el-button>
  87. </el-col>
  88. </el-row>
  89. </div>
  90. </div>
  91. <div
  92. v-if="obj && obj.length > 0"
  93. class="securityEquipmentMonitoringtable ml-4 flex-1"
  94. >
  95. <div class="title">{{ fullTableTitle }}</div>
  96. <table ref="tb11" class="table-scroll">
  97. <tr>
  98. <th colspan="1" rowspan="1">序号</th>
  99. <th colspan="1" rowspan="1" :key="item" v-for="item in obj">
  100. {{ item }}
  101. </th>
  102. </tr>
  103. <tr v-for="(item, index) in targetList" :key="index">
  104. <td>{{ index+1 }}</td>
  105. <td v-for="i in obj" :key="i">{{ item[i] }}</td>
  106. </tr>
  107. <tr>
  108. <th :colspan="obj.length" rowspan="1">平均得分</th>
  109. <th :colspan="1" rowspan="1">{{average}}</th>
  110. </tr>
  111. </table>
  112. </div>
  113. </el-col>
  114. </el-row>
  115. </div>
  116. </template>
  117. <script>
  118. import { mapGetters } from "vuex";
  119. import { findAllRole } from "@/api/system/role";
  120. import { list, getPlanList } from "@/api/evaluateTable/evaluateTable.js";
  121. import { newDateMonth } from "@/utils/index.js";
  122. import { deptTreeSelect } from "@/api/system/public";
  123. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  124. import QuarterPicker from '@/views/components/QuarterPicker/index.vue'
  125. export default {
  126. name: "SocWebIndex",
  127. components: {OrgTree,QuarterPicker
  128. },
  129. data() {
  130. const { params, query } = this.$route;
  131. return {
  132. targetList: [],
  133. average:0,
  134. obj: {},
  135. loading: false,
  136. average:'',//平均值
  137. selectedValues: [],
  138. planRoles: [],
  139. options: [],
  140. fullTableTitle: "对押运公司月度评价",
  141. cycle:"0",
  142. orgName:null,
  143. queryParams: {
  144. orgId: null,
  145. planId: null,
  146. searchTime:new Date,
  147. // date: newDateMonth("", "1"),
  148. },
  149. // 显示搜索条件
  150. showSearch: true,
  151. total: 0,
  152. dataList: [],
  153. deptOptions: [], //机构数组
  154. };
  155. },
  156. computed: {
  157. ...mapGetters(["orgId"]),
  158. },
  159. watch: {
  160. queryParams() {
  161. this.getList();
  162. },
  163. },
  164. created() {
  165. // this.getDeptTree();
  166. this.getevlauteList();
  167. },
  168. mounted() {
  169. if (this.deptOptions) {
  170. this.queryParams.orgId = this.orgId;
  171. }
  172. },
  173. methods: {
  174. getDefaultOrg(node) {
  175. this.queryParams.orgId = node.id;
  176. this.selectedOrgName = node.shortName;
  177. this.getList();
  178. },
  179. //单选框状态改变
  180. checkChange(state) {
  181. this.queryParams.checkSub = state;
  182. this.getList();
  183. },
  184. // 节点单击事件
  185. clickTreeNode(data) {
  186. if(data==null){
  187. return;
  188. }
  189. this.queryParams.orgId = data.id;
  190. this.selectedOrgName = data.shortName;
  191. this.getList();
  192. },
  193. changeHandler(id) {
  194. this. options.forEach(element => {
  195. if(element.id==id){
  196. this.cycle=element.evaluateCycle;
  197. }
  198. });
  199. console.log(this.cycle+"efijewioo")
  200. this.getList();
  201. },
  202. changeSelect() {
  203. this.getList();
  204. },
  205. /** 查询机构树数据 */
  206. getDeptTree() {
  207. deptTreeSelect().then((response) => {
  208. this.deptOptions = response.data;
  209. this.queryParams.orgId=response.data[0].id;
  210. });
  211. },
  212. /** 获取所有计划列表 */
  213. getevlauteList() {
  214. getPlanList().then((res) => {
  215. this.queryParams.planId = res[0].id;
  216. this.options = res;
  217. this.cycle=res[0].evaluateCycle;
  218. console.log(res,'res');
  219. if (this.queryParams.orgId && this.queryParams.planId) {
  220. this.getList();
  221. }
  222. });
  223. },
  224. /** treeSelect组件自定义数据*/
  225. tenantIdnormalizer(node, instanceId) {
  226. if (node.children && !node.children.length) {
  227. delete node.children;
  228. }
  229. return {
  230. id: node.id,
  231. label: node.shortName,
  232. children: node.children,
  233. };
  234. },
  235. handleExport() {
  236. this.download('core/task/export', {
  237. ...this.queryParams
  238. }, `${this.orgName+'-外包履职评价情况表-'+this.formatTime(new Date(),'YYYYMMDD')}.xlsx`)
  239. },
  240. //获取列表
  241. getList() {
  242. this.loading = true;
  243. list(this.queryParams).then((res) => {
  244. let { code, data, msg } = res;
  245. if (code == 200) {
  246. this.targetList = data.list || [];
  247. this.fullTableTitle=res.tittle;
  248. this.orgName=res.orgName;
  249. this.average=data.average||0
  250. if (this.targetList) {
  251. this.obj = Object.keys(this.targetList[0]);
  252. }
  253. }
  254. this.loading = false;
  255. });
  256. },
  257. /** 新增按钮操作 */
  258. handleAdd() {
  259. this.$refs.Evaluate.show();
  260. },
  261. editHandler(row) {
  262. this.$refs.Evaluate.show(row);
  263. },
  264. /** 搜索按钮操作 */
  265. handleQuery() {
  266. this.getList();
  267. },
  268. /** 重置按钮操作 */
  269. resetQuery() {
  270. this.queryParams = {
  271. orgId: this.orgId,
  272. planId: this.options[0].id,
  273. searchTime:new Date(),
  274. };
  275. this.cycle=this.options[0].evaluateCycle;
  276. this.getList();
  277. },
  278. //导出
  279. exportExcel() {},
  280. }
  281. };
  282. </script>
  283. <style lang="scss" scoped>
  284. ::v-deep.formTreeItem {
  285. .el-form-item__content {
  286. width: 264px;
  287. }
  288. }
  289. .securityEquipmentMonitoringtable {
  290. padding-block-start: 0.83em;
  291. background-color: #fff;
  292. .table-scroll {
  293. // table-layout:auto;
  294. color: #000000;
  295. min-width: 100%;
  296. border-spacing: 0;
  297. text-align: center;
  298. border-collapse: collapse;
  299. max-height: 500px;
  300. overflow-y: auto;
  301. font-family: "仿宋_GB2312";
  302. .orgName {
  303. min-width: 180px !important;
  304. width: 180px !important;
  305. }
  306. tr th,
  307. tr td {
  308. height: 25px;
  309. border: 1px solid rgb(0, 0, 0);
  310. // min-width: 75px;
  311. }
  312. .jump {
  313. color: #02a7f0;
  314. text-decoration: underline;
  315. }
  316. .nojump {
  317. color: #000000;
  318. font-size: 10;
  319. //font-weight: bold;
  320. }
  321. .greentd {
  322. color: green;
  323. }
  324. .redtd {
  325. color: red;
  326. }
  327. }
  328. }
  329. .title {
  330. clear: both;
  331. margin: auto;
  332. text-align: center;
  333. color: black;
  334. font-size: 24px;
  335. letter-spacing: 3px;
  336. font-weight: 500;
  337. // margin-block-start: 0.83em;
  338. margin-block-end: 0.83em;
  339. padding:10px;
  340. }
  341. </style>