| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548 |
- <template>
- <div>
- <div class="upload_record" v-if="!isShowDetail">
- <!-- <h1>资料列表</h1> -->
- <div class="search HeadLeft">
- <div class="input">
- <img src="../../img/search.png" />
- <input
- type="text"
- name=""
- id=""
- placeholder="请输入要搜索的资料名"
- v-model="searchName"
- />
- </div>
- <button @click="searchByName()">搜索</button>
- </div>
- <div class="sortBox">
- <div class="sort_inside">
- <span>是否下载</span>
- <select name="" id="isDownload" v-model="downloadSortVal">
- <option value="">不限</option>
- <option value="already">已下载</option>
- <option value="notyet">未下载</option>
- </select>
- <span>是否完成</span>
- <select name="" id="isReturn" v-model="reportSortVal">
- <option value="">不限</option>
- <option value="already">已完成</option>
- <option value="notyet">待办</option>
- </select>
- <span>排序</span>
- <select name="" id="timeSort" v-model="timeSortVal">
- <option value="dec">时间降序</option>
- <option value="asc">时间升序</option>
- </select>
- </div>
- <button @click="searchByCondition">确定</button>
- </div>
- <div class="tableD">
- <div class="table_template">
- <table class="table">
- <thead>
- <tr :style="tableHeadStyle">
- <td
- v-for="(item, index) in tableHeaderD"
- :key="index"
- :style="tableHeadStyle"
- >
- {{ item }}
- </td>
- </tr>
- </thead>
- <tbody>
- <tr
- v-for="(obj, index) in tableData"
- :key="index"
- :class="{ table_gray: !discolor && index % 2 === 0 }"
- >
- <td>{{ obj.informationName || "-" }}</td>
- <td>{{ (obj.filePulishTime || "").replace("-", "/") }}</td>
- <td>{{ obj.accountScope == 1 ? "共通" : "部分" }}</td>
- <td>
- {{
- (obj.fileUploadDate || "")
- .replace("T", " ")
- .slice(0, -4)
- .replace(RegExp("-", "g"), "/")
- }}
- </td>
- <td>{{ obj.download > 0 ? "已下载" : "未下载" }}</td>
- <td>
- <span v-if="!obj.endDate || (obj.endDate && obj.download >= 1 && obj.report >= 1)" class="noPoint">已完成</span>
- <span
- v-else-if="obj.download >= 1 && obj.report == 0 && (obj.endDate.replace(RegExp('-', 'g'), '') - localDate) >= 0"
- @click="waitToReport(obj, index)"
- class="canJump"
- >待办</span>
- <span v-else class="noJump">待办</span>
- </td>
- <td v-if="operation" :style="trStyle" class="operationStyle">
- <span
- style="cursor: pointer"
- v-for="(operationObj, i) in operation"
- :key="i"
- @click="
- operationObj.function(obj, index);
- nowIndex = index;
- "
- >{{ operationObj.name }}
- </span>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="pageD">
- <TablePage
- :totalPage="totalPage"
- :currentPage="currentPage"
- @change_page="changePage"
- @jump_page="jumpPage"
- />
- <p>共{{ totalPage }}页,共{{ sum }}条数据</p>
- </div>
- </div>
- <div v-else>
- <Detail></Detail>
- </div>
- </div>
- </template>
- <script>
- import TablePage from "../../components/TablePage";
- import Detail from "./components/InfoListItemDetail";
- import { env_url } from "../../config/env";
- // import func from 'vue-editor-bridge';
- export default {
- props: {
- isManufacturer: {
- type: String,
- default: "distributor",
- },
- detailVisible: {
- type: Boolean,
- default: true,
- },
- },
- components: {
- TablePage,
- Detail,
- },
- data() {
- return {
- nowIndex: 0,
- searchName: "",
- timeSortVal: "dec",
- reportSortVal: "",
- downloadSortVal: "",
- //initialPage: true,
- tableHeaderD: [
- "资料名称",
- "素材时间",
- "经销商范围",
- "上传时间",
- "下载状态",
- "任务状态",
- "操作",
- ],
- operation: [
- {
- name: "下载",
- function: (obj, i) => {
- console.log(obj, i);
- let config = {
- url: "/dealerDownload",
- data: {
- informationId: obj.id,
- agentId: this.userId,
- },
- };
- this.downloadPost(config);
- },
- },
- {
- name: "查看详情>",
- function: (obj) => {
- this.showDetail(obj);
- },
- },
- ],
- // 表格配置
- sum: 0, // 一共有多少条数据
- pageSize: 20, // 每页展示的数据
- discolor: false, // flase是隔行变色
- currentPage: 1,
- tableData: [],
- tableFileData: [],
- tableHeadStyle: {
- background: "#848484",
- height: "30px",
- color: "white",
- },
- trStyle: {
- minwidth: "150px",
- height: "30px",
- overflow: "hidden",
- },
- onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试
- userId: localStorage.getItem("userId") || '',
- endDate: "",
- localReport: "",
- downLoadFlag: false, // 下载以后刷新页面
- localDate: ""
- };
- },
- computed: {
- // 表格总页数
- totalPage() {
- return Math.ceil(this.sum / this.pageSize);
- },
- isShowDetail() {
- let flag = this.$route.query && this.$route.query.tag;
- return flag ? true : false;
- },
- showItemOperation: function () {
- if (!this.localReport) {
- return { showItemOperationStyle: false };
- } else {
- return { showItemOperationStyle: true };
- }
- },
- },
- methods: {
- // 获取某一页面的数据,展示在表格
- changePage: function (page) {
- this.currentPage = page;
- //携带搜索条件
- let data = {
- informationName: this.searchName,
- asc: this.timeSortVal == "dec" ? false : true,
- report: "",
- download: "",
- Page: this.currentPage,
- Rows: this.pageSize,
- agentId: this.userId,
- };
- if (this.reportSortVal) {
- data.report = this.reportSortVal === "already" ? true : false;
- }
- if (this.downloadSortVal) {
- data.download = this.downloadSortVal === "already" ? true : false;
- }
- this.getDataListPage(data);
- },
- // 点击上一页,下一页,首页,尾页
- jumpPage: function (item) {
- switch (item) {
- case 1:
- this.currentPage = 1;
- break;
- case 2:
- this.currentPage = this.currentPage - 1;
- break;
- case 3:
- this.currentPage = this.currentPage + 1;
- break;
- case 4:
- this.currentPage = this.totalPage;
- break;
- }
- //携带搜索条件
- let data = {
- informationName: this.searchName,
- asc: this.timeSortVal == "dec" ? false : true,
- report: "",
- download: "",
- Page: this.currentPage,
- Rows: this.pageSize,
- agentId: this.userId,
- };
- if (this.reportSortVal) {
- data.report = this.reportSortVal === "already" ? true : false;
- }
- if (this.downloadSortVal) {
- data.download = this.downloadSortVal === "already" ? true : false;
- }
- this.getDataListPage(data);
- },
- //下载文件
- downloadPost: function (config) {
- let url = this.onlineUrl + "/dealerDownload?informationId=" + config.data.informationId + "&agentId=" + config.data.agentId;
- // 刷新页面
- this.downLoadFlag = true;
- window.open(url);
- },
- //查看详情
- showDetail: function (config) {
- this.$router.push({
- path: "/inforList/detail",
- query: {
- tag: "detail",
- informationId: config.id,
- informationName: config.informationName,
- },
- });
- },
- //条件筛选 获取新的资料列表
- getDataListPage: function (config) {
- this.$http({
- url: "/firmsUploadListByAgent",
- method: "post",
- data: config,
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.tableData = res.data.data;
- this.sum = res.data.count;
- this.downLoadFlag = false;
- }
- })
- .catch((err) => {
- console.log(err);
- });
- },
- //搜索资料名
- searchByName: function (p) {
- let searchName = this.searchName;
- let data = {
- informationName: searchName,
- Page: p,
- Rows: this.pageSize,
- agentId: this.userId,
- //搜索条件重置
- asc: false,
- report: "",
- download: "",
- };
- //搜索条件重置
- this.timeSortVal = "dec";
- this.reportSortVal = "";
- this.downloadSortVal = "";
- this.$http({
- url: "/firmsUploadListByAgent",
- method: "post",
- data: data,
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.tableData = res.data.data;
- this.sum = res.data.count;
- }
- })
- .catch((err) => {
- console.log(err);
- });
- },
- searchByCondition: function () {
- let asc = this.timeSortVal === "dec" ? false : true;
- let report = "";
- this.currentPage = 1;
- if (this.reportSortVal === "already") {
- report = this.reportSortVal === "already" ? true : false;
- } else if (this.reportSortVal === "notyet") {
- report = this.reportSortVal === "notyet" ? false : true;
- }
- let download = "";
- if (this.downloadSortVal === "already") {
- download = this.downloadSortVal === "already" ? true : false;
- } else if (this.downloadSortVal === "notyet") {
- download = this.downloadSortVal === "notyet" ? false : true;
- }
- let data = {
- informationName: '',
- asc: asc,
- report: report,
- download: download,
- Page: this.currentPage,
- Rows: this.pageSize,
- agentId: this.userId,
- };
- if (!this.searchName) {
- this.getDataListPage(data);
- } else {
- data.informationName = this.searchName;
- this.getDataListPage(data);
- }
- },
- waitToReport: function(obj) {
- this.$router.push({
- path: "/uploadLink/sonUploadLink",
- query: { informationName: obj.informationName, informationId: obj.id, editFlag: true},
- });
- },
- getNowDate: function() {
- let data = new Date();
- let year = data.getFullYear();
- let month = data.getMonth() + 1;
- let day = data.getDate();
- if (month < 10) {
- month = "0" + month;
- } else {
- month = month + "";
- }
- if (day < 10) {
- day = "0" + day;
- } else {
- day = day + "";
- }
- this.localDate = year + month + day;
- },
- pageRefreshList:function(){
- this.getNowDate();
- const req = {
- asc: this.timeSortVal === "dec" ? false : true,
- agentId: this.userId,
- Page: this.currentPage,
- Rows: this.pageSize,
- };
- this.getDataListPage(req);
- }
- },
- watch: {
- // 如果路由发生变化,再次执行该方法
- "$route": "pageRefreshList",
- downLoadFlag:function (newValue) {
- if(newValue) {
- setTimeout (() => {
- let data = {
- informationName: this.searchName,
- asc: this.timeSortVal == "dec" ? false : true,
- report: "",
- download: "",
- Page: this.currentPage,
- Rows: this.pageSize,
- agentId: this.userId,
- };
- if (this.reportSortVal) {
- data.report = this.reportSortVal === "already" ? true : false;
- }
- if (this.downloadSortVal) {
- data.download = this.downloadSortVal === "already" ? true : false;
- }
- this.getDataListPage(data);
- }, 1000)
- }
- }
- },
- mounted() {
- this.userId = localStorage.getItem("userId");
- this.pageRefreshList();
- },
- };
- </script>
- <style scoped lang="less">
- .searchBox {
- width: 100%;
- height: 40px;
- display: flex;
- align-items: center;
- margin-left: 40px;
- }
- .sortBox {
- display: flex;
- justify-content: flex-end;
- height: 40px;
- align-items: center;
- }
- .sort_inside {
- display: flex;
- width: 400px;
- justify-content: space-between;
- }
- /* 查看详情样式 */
- .table_template {
- text-align: center;
- .table {
- background-color: #fff;
- border-collapse: collapse;
- border: none;
- width: 100%;
- td {
- border: 1px solid #ccc;
- }
- span {
- &:hover {
- cursor: pointer;
- }
- }
- }
- }
- .table_gray {
- background-color: #eeeeee;
- }
- .operationStyle span {
- color: #0000ff;
- }
- .operationStyle {
- color: #0000ff;
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- /* 搜索栏 */
- .search {
- padding: 10px 15px 10px 10px;
- display: flex;
- align-items: center;
- .input {
- background-color: #fff;
- padding: 2px;
- display: flex;
- align-items: center;
- margin-left: 16px;
- border: 1px solid #ccc;
- img {
- width: 28px;
- height: 28px;
- border: 1px solid #ccc;
- border-radius: 4px;
- }
- input {
- background-color: #fff;
- border: 1px solid #ccc;
- margin-left: 4px;
- color: #555;
- font-size: 12px;
- height: 24px;
- }
- }
- }
- .HeadLeft {
- border: 1px solid #ccc;
- }
- .pageD {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- margin-top: 10px;
- }
- .pageD p {
- margin-left: 16px;
- }
- .reportStyle {
- text-decoration: underline;
- cursor: pointer;
- }
- .showItemOperationStyle {
- display: none;
- }
- .noJump{
- color: rgb(173, 162, 162);
- cursor: text!important;
- text-decoration: underline;
- }
- .canJump{
- text-decoration: underline;
- }
- </style>
|