123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <!--
- maintenance 选择供应商
- -->
- <template>
- <el-dialog title="选择维修商" :visible.sync="dialog.maintainer" width="1000px">
- <div>
- <div id="firm">
- <div class="title-search query-form" style="padding: 10px; margin-bottom: 10px;">
- <el-input
- placeholder="输入厂家名称进行查找23"
- v-model="search"
- size="small"
- style="width:300px;"
- clearable
- ></el-input>
- <el-button size="small" @click="filterSearch">查找</el-button>
- </div>
- <el-radio-group v-model="radio" style="width:100%;">
- <el-table class="data-table" border ref="maintenance" :data="tableData" style="width: 100%" height="300px">
- <el-table-column header-align='center' label="维修商名称">
- <template slot-scope="scope">
- <el-tooltip :content="scope.row.name" placement="top">
- <el-radio v-model="radio" :label="scope.row">{{scope.row.name}}</el-radio>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column header-align='center' prop="website" label="网址"></el-table-column>
- <el-table-column header-align='center' prop="man" label="联系人"></el-table-column>
- <el-table-column header-align='center' prop="phone" label="联系电话"></el-table-column>
- <el-table-column header-align='center' prop="faxes" label="传真"></el-table-column>
- <el-table-column header-align='center' prop="email" label="电子邮件"></el-table-column>
- </el-table>
- </el-radio-group>
- <div class="right">
- <my-pagination :page="page" @change="changePage" style="margin-top:10px;"></my-pagination>
- </div>
- <p style="height:40px;line-height:40px;text-align:center;color:#9E9E9E;">
- 找不到想要的维修商? 赶快去
- <i style="color:#46B0FF;cursor: pointer;">厂家库</i>维护吧
- </p>
- </div>
- </div>
- <div slot="footer">
- <el-button
- type="primary"
- @click="getChange"
- >确 定</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import myPagination from "@/components/ledger/lib/myPagination";
- import { getLib } from "@/api/scan/request"
- import tools from "@/utils/scan/tools"
- export default {
- components: {
- myPagination
- },
- props: {
- dialog: {
- type: Object,
- default: function () {
- return {
- maintainer: true
- };
- }
- }
- },
- data() {
- return {
- search: "", //搜索文案
- radio: "",
- tableData: [],
- page: {
- size: 10,
- sizes: [10, 30, 50, 100, 150, 200],
- total: 0,
- currentPage: 1
- },
- projectId: this.$route.query.projId,
- };
- },
- created() {
- // this.getData()
- },
- mounted() { },
- methods: {
- //过滤
- filterSearch() {
- this.tableData = this.allData.map(item => {
- if (item.name.indexOf(this.search) != -1) {
- return item
- } else {
- return undefined
- }
- }).filter(cb => cb)
- },
- getData() {
- this.page = {
- size: 10,
- sizes: [10, 30, 50, 100, 150, 200],
- total: 0,
- currentPage: 1
- }
- getLib({ "type": ["maintenance"] }).then(res => {
- if (res.data.result == "success") {
- let data = res.data.content.maintenance.map(item => {
- if (item.contacts && item.contacts.length) {
- item.contacts.map(child => {
- if (child.projectId == this.projectId) {
- item.phone = child.phone
- item.man = child.name
- item.fox = child.fox
- item.email = child.email
- }
- return child
- })
- }
- if (!item.man) {
- item.man = "--"
- item.phone = "--"
- item.fox = "--"
- item.email = "--"
- }
- return item
- })
- this.allData = tools.deepCopy(data)
- this.tableData = this.pagination(this.page.currentPage, this.page.size, this.allData)
- this.page.total = data.length
- } else {
- this.$message.error("请求失败:" + res.data.resultMsg)
- }
- })
- },
- //分页改变
- changePage() {
- this.pagination(this.page.currentPage, this.page.size, this.allData)
- },
- //发生修改
- getChange() {
- if (!!this.radio) {
- console.log(this.radio, "radio")
- this.$emit("changeMaintainer", this.radio)
- this.dialog.maintainer = false
- } else {
- this.$message("请选择一个生产厂商")
- }
- },
- //分页事件
- pagination(pageNo, pageSize, array) {
- let offset = (pageNo - 1) * pageSize;
- return offset + pageSize >= array.length
- ? array.slice(offset, array.length)
- : array.slice(offset, offset + pageSize);
- }
- },
- watch: {
- dialog: {
- deep: true,
- handler: function () {
- if (this.dialog.maintainer) {
- this.getData()
- }
- }
- }
- }
- };
- </script>
- <style lang="less">
- #firm {
- .el-table thead {
- tr {
- th {
- background-color: #f5f7fa;
- }
- }
- }
- }
- </style>
|