| <template> | 
|   <!-- :permissions="['business:appliancechange:query']" --> | 
|   <TableLayout> | 
|     <!-- 搜索表单 --> | 
|     <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" label-suffix=":" inline> | 
|       <el-form-item label="客户名称" prop="name"> | 
|         <el-input v-model="searchForm.name" placeholder="请输入客户名称" @keypress.enter.native="search"></el-input> | 
|       </el-form-item> | 
|   | 
|       <el-form-item label="类型" prop="type"> | 
|         <el-select v-model="searchForm.oepnType" filterable clearable placeholder="请选择类型"> | 
|           <el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value"></el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <el-form-item label="状态" prop="status"> | 
|         <el-select v-model="searchForm.status" filterable clearable placeholder="请选择状态"> | 
|           <el-option v-for="(item, index) in status" :key="item.value" :label="item.label" :value="item.value"> | 
|           </el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <section> | 
|         <el-button type="primary" @click="search">搜索</el-button> | 
|         <el-button @click="reset">重置</el-button> | 
|       </section> | 
|     </el-form> | 
|     <!-- 表格和分页 --> | 
|     <template v-slot:table-wrap> | 
|       <ul class="toolbar"> | 
|         <!-- v-permissions="['ext:workorderrecordext:exportExcel']" --> | 
|         <li><el-button type="primary" @click="$refs.operaClientMangerWindow.open(bull, '新增客户')">新增</el-button></li> | 
|         <!-- <li><el-button type="primary" @click="exportExcel">调整有效期</el-button></li> --> | 
|         <li><el-button type="primary" @click="resetUserPwd">重置主账号密码</el-button></li> | 
|         <li><el-button style="color: red" :loading="isWorking.delete" @click="deleteByIdInBatch">删除</el-button></li> | 
|       </ul> | 
|       <el-table v-loading="isWorking.search" :data="tableData.list" stripe border | 
|         @selection-change="handleSelectionChange"> | 
|         <el-table-column type="selection" width="55"></el-table-column> | 
|         <el-table-column prop="id" label="客户编码" fixed="left" align="center" min-width="80px"></el-table-column> | 
|         <el-table-column prop="companyName" label="客户简称" show-overflow-tooltip align="center" min-width="140px"> | 
|           <template slot-scope="{ row }"> | 
|             <el-button type="text" @click="showDetail(row, false)">{{ row.remark }}</el-button> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="addr" label="所在城市" align="center" min-width="180px"> | 
|           <template slot-scope="{ row }"> | 
|             <span>{{ row.addr }}</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="type" label="类型" align="center" min-width="100px"> | 
|           <template slot-scope="{ row }"> | 
|             <span>{{ row.oepnType == 1 ? '正式' : '试用' }}</span> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column prop="phone" label="主账号" align="center" min-width="100px"></el-table-column> | 
|         <el-table-column prop="linkName" label="联系人" align="center" min-width="100px"></el-table-column> | 
|         <el-table-column prop="linkPhone" label="联系电话" align="center" min-width="120px"></el-table-column> | 
|         <el-table-column prop="oepnValidDate" label="有效期" align="center" min-width="140px"></el-table-column> | 
|         <el-table-column prop="salespersonName" label="销售人员" align="center" min-width="100px"></el-table-column> | 
|         <el-table-column prop="createTime" label="创建时间" align="center" min-width="140px"></el-table-column> | 
|         <el-table-column prop="status" label="状态" align="center" min-width="100px"> | 
|           <template slot-scope="{row}"> | 
|             <!-- 0正常 1异常 --> | 
|             <el-switch v-model="row.status" active-color="#13ce66" inactive-color="#999" :active-value="1" | 
|               :inactive-value="0" @change="statusChange(row)"></el-switch> | 
|           </template> | 
|         </el-table-column> | 
|         <el-table-column label="操作" align="center" min-width="220px" fixed="right"> | 
|           <template slot-scope="{ row }"> | 
|             <!-- <el-button type="text" @click="$refs.operaClientMangerWindow.open('编辑客户', row)">编辑</el-button> --> | 
|             <el-button type="text" @click="showDetail(row, true)">编辑</el-button> | 
|             <el-button type="text" @click="$refs.operaClientValidDateWindow.open('调整有效期', row)">调整有效期</el-button> | 
|             <el-button type="text" @click="$refs.operaDDSettingWindow.open('钉钉配置', row)">钉钉配置</el-button> | 
|             <el-button type="text" style="color:red" :loading="isWorking.delete" | 
|               @click="deleteById(row, false)">删除</el-button> | 
|           </template> | 
|         </el-table-column> | 
|       </el-table> | 
|       <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> | 
|       </pagination> | 
|     </template> | 
|     <OperaClientMangerWindow ref="operaClientMangerWindow" @success="handlePageChange" /> | 
|     <OperaDDSettingWindow ref="operaDDSettingWindow" @success="handlePageChange" /> | 
|     <OperaClientValidDateWindow ref="operaClientValidDateWindow" @success="handlePageChange" /> | 
|     <OperaClientDetailWindow ref="operaClientDetailWindow" /> | 
|   </TableLayout> | 
| </template> | 
|    | 
| <script> | 
| import BaseTable from '@/components/base/BaseTable' | 
| import TableLayout from '@/layouts/TableLayout' | 
| import Pagination from '@/components/common/Pagination' | 
| import OperaClientMangerWindow from '@/components/business/OperaClientMangerWindow' | 
| import OperaClientDetailWindow from '@/components/business/OperaClientDetailWindow' | 
| import OperaDDSettingWindow from '@/components/business/OperaDDSettingWindow' | 
| import OperaClientValidDateWindow from '@/components/business/OperaClientValidDateWindow' | 
| import { resetPwd, findCompanyInfo, update } from '@/api/business/clientManger' | 
| export default { | 
|   name: 'ApplianceChange', | 
|   extends: BaseTable, | 
|   components: { TableLayout, Pagination, OperaClientMangerWindow, OperaClientDetailWindow, OperaDDSettingWindow, OperaClientValidDateWindow }, | 
|   data() { | 
|     return { | 
|       // 搜索 | 
|       searchForm: { | 
|         name: '', | 
|         oepnType: '', | 
|         status: '' | 
|       }, | 
|       types: [ | 
|         { label: '正式', value: 1 }, | 
|         { label: '试用', value: 0 }, | 
|       ], | 
|       status: [ | 
|         { label: '启用', value: 1 }, | 
|         { label: '禁用', value: 0 }, | 
|       ], | 
|       procedure: [], | 
|       warehouse: [] | 
|     } | 
|   }, | 
|   created() { | 
|     this.config({ | 
|       module: '客户管理', | 
|       api: '/business/clientManger', | 
|       'field.id': 'id', | 
|       'field.main': 'id' | 
|     }) | 
|   | 
|     this.search() | 
|   }, | 
|   destroyed() { | 
|     console.log('destroyed'); | 
|   }, | 
|   methods: { | 
|     dateChange(v) { | 
|       this.searchForm.startDate = v[0] | 
|       this.searchForm.endDate = v[1] | 
|     }, | 
|   | 
|     showDetail(row, isEdit) { | 
|       // this.$refs.operaApplianceChangeDetailWindow.open('更换单详情', row) | 
|       findCompanyInfo({ CompanyId: row.id }) | 
|         .then(res => { | 
|           const element = isEdit ? this.$refs.operaClientMangerWindow : this.$refs.operaClientDetailWindow | 
|           element.open(res) | 
|         }) | 
|         .catch(err => { | 
|           this.$tip.error(err) | 
|         }) | 
|     }, | 
|     statusChange(row) { | 
|       update({ | 
|         id: row.id, | 
|         status: row.status | 
|       }) | 
|         .then(() => { | 
|           this.$tip.success('修改成功') | 
|         }) | 
|         .catch(e => { | 
|           this.$tip.error(e) | 
|         }) | 
|         .finally(() => { | 
|           this.handlePageChange() | 
|         }) | 
|     }, | 
|     resetUserPwd() { | 
|       if (this.tableData.selectedRows.length === 0) { | 
|         this.$message.warning('请至少选择一条数据') | 
|         return | 
|       } | 
|       let message = `确认重置已选中的 ${this.tableData.selectedRows.length} 个账号密码吗?` | 
|       this.$dialog.resetConfirm(message) | 
|         .then(() => { | 
|           this.isWorking.delete = true | 
|           resetPwd(this.tableData.selectedRows.map(row => row.id)) | 
|             .then(() => { | 
|               this.$message.success('重置成功') | 
|               this.handlePageChange() | 
|             }) | 
|             .catch(e => { | 
|               this.$message.error(e) | 
|             }) | 
|             .finally(() => { | 
|               this.isWorking.delete = false | 
|             }) | 
|         }) | 
|         .catch(() => { }) | 
|     } | 
|   } | 
| } | 
|   | 
| </script> | 
|    |