Browse Source

企业信息维护

zengfanwei 4 weeks ago
parent
commit
4093aad619

+ 33 - 0
src/api/lc/company.js

@@ -0,0 +1,33 @@
+import request from "../../utils/request";
+//通过id获取企业详情
+export function getLcCompanyById() {
+    return request({
+        url: '/LcCompany/getLcCompanyById',
+        method: 'get',
+
+    })
+}
+
+//模糊分页查询企业列表
+export function getLcCompanyList(data) {
+    return request({
+        url: '/LcCompany/getLcCompanyList',
+        method: 'post',
+        data,
+    })
+}
+
+//新增企业
+export function insertLcCompany(data) {
+    return request({
+        url: '/LcCompany/insertLcCompany',
+        method: 'post',
+        data,
+    })
+}
+
+
+
+
+
+

+ 21 - 0
src/utils/common.js

@@ -0,0 +1,21 @@
+export function valueToLabel(cb, delay) {
+    
+}
+ 
+export function getLabelByValue(value, arr, options = {}) {
+  // 解构配置参数(带默认值)
+  const {
+    valueKey = 'value',
+    labelKey = 'label',
+    default: defaultValue = ''
+  } = options;
+
+  // 检查数组是否有效
+  if (!Array.isArray(arr)) return defaultValue;
+
+  // 查找匹配项
+  const foundItem = arr.find(item => item[valueKey] === value);
+
+  // 返回匹配的 label 或默认值
+  return foundItem ? foundItem[labelKey] : defaultValue;
+}

+ 169 - 482
src/views/logisticsMaterials/logisticsBasicData/enterpriseInformation.vue

@@ -4,226 +4,107 @@
             <searchArea :searchData="searchData" @submit="searchByForm"></searchArea>
         </div>
         <div class="layout_display_flex_y">
-            <el-tabs class="el-tabs__fill" v-model="editableTabsValue" type="border-card" @tab-click="handleClick">
+            <el-tabs class="el-tabs__fill" v-model="currentCompanyType" type="border-card" @tab-click="handleClick">
                 <div style="padding: 6px; background-color: #fff;">
-                    <el-button type="primary" icon="Plus" @click="onAddItem" style="margin-left: 5px">新增</el-button>
+                    <el-button type="primary" icon="Plus" @click="centerDialogVisible = true"
+                        style="margin-left: 5px">新增</el-button>
                 </div>
-                <el-tab-pane key="ypClass" label="供应商字典" name="ypClass" style="height: 90%;">
+                <el-tab-pane key="ypClass" label="供应商字典" name="0" style="height: 90%;">
                     <div class="layout_display_flex_y">
                         <div class="layout_flex_1-y">
-                            <el-table
-                                :data="ypClassData.slice(pageSizeClass * (currentPageClass - 1), pageSizeClass * currentPageClass)"
-                                border style="width: 100%" height="100%" stripe highlight-current-row
-                                class="ypClassTable normal-size">
-                                <el-table-column prop="code" label="供应商编码" width="80">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.code"></el-input>
-                                        <span v-else>{{ scope.row.code }}</span>
-                                    </template>
+                            <el-table :data="tableData" border style="width: 100%" height="100%" stripe
+                                highlight-current-row class="ypClassTable normal-size">
+                                <el-table-column prop="companyCode" label="供应商编码" width="80">
                                 </el-table-column>
-                                <el-table-column prop="name" label="供应商名称" width="200">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="companyName" label="供应商名称" width="200">
                                 </el-table-column>
                                 <el-table-column prop="pyCode" label="拼音码" width="140" />
                                 <el-table-column prop="dcode" label="五笔码" width="140" />
-                                <el-table-column prop="name" label="厂商类型" width="200">
+                                <el-table-column prop="companyType" label="厂商类型" width="200">
                                     <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
+                                        <span>{{ getLabelByValue(scope.row.companyType, companyTypeOption) }}</span>
                                     </template>
                                 </el-table-column>
-                                <el-table-column prop="name" label="地址" width="200">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="companyAddr" label="地址" width="200">
                                 </el-table-column>
-                                <el-table-column prop="name" label="电话" width="140">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="companyPhone" label="电话" width="140">
                                 </el-table-column>
-                                =<el-table-column prop="name" label="账号" width="140">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                =<el-table-column prop="companyAccount" label="账号" width="140">
                                 </el-table-column>
-                                <el-table-column prop="name" label="开户银行" width="140">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="companyBank" label="开户银行" width="140">
                                 </el-table-column>
                                 <el-table-column prop="delFlag" label="是否停用" width="100">
                                     <template v-slot="scope">
-                                        <div v-if="scope.row.isEdit">
-                                            <el-select v-model="scope.row.delFlag" clearable placeholder="请选择是否停用">
-                                                <el-option v-for="option in delFlagOptions" :key="option.code"
-                                                    :label="option.name" :value="option.code"></el-option>
-                                            </el-select>
-                                        </div>
-                                        <div v-else>
-                                            <el-select v-model="scope.row.delFlag" disabled placeholder="请选择是否无效">
-                                                <el-option v-for="option in delFlagOptions" :key="option.code"
-                                                    :label="option.name" :value="option.code"></el-option>
-                                            </el-select>
-                                        </div>
+                                        {{ getLabelByValue(scope.row.delFlag, delFlagOption) }}
                                     </template>
                                 </el-table-column>
-                                <el-table-column fixed="right" label="操作" min-width="180" width="180" center>
+                                <el-table-column fixed="right" label="操作" min-width="180" width="180" align="center">
                                     <template #default="scope">
-                                        <el-button type="primary" size="small" v-if="!scope.row.isEdit"
-                                            @click="editYpClass(scope.row)">编辑</el-button>
-                                        <el-button type="primary" size="small" v-if="scope.row.isEdit"
-                                            @click="updateYpClass(scope.row)">保存</el-button>
-                                        <el-button type="primary" size="small" v-if="scope.row.isEdit"
-                                            @click="cancelYpClass(scope.row)">取消
-                                        </el-button>
-                                        <el-button type="danger" size="small"
-                                            @click.prevent="deleteYpClass(scope.$index, scope.row)">
-                                            删除
-                                        </el-button>
-                                        <el-button type="success" size="small"
-                                            v-if="!scope.row.isEdit && scope.row.delFlag === '1'"
-                                            @click.prevent="deleteYpClass(scope.$index, scope.row)">
-                                            启用
-                                        </el-button>
-                                        <el-button type="info" size="small"
-                                            v-if="!scope.row.isEdit && scope.row.delFlag === '0'"
-                                            @click.prevent="deleteYpClass(scope.$index, scope.row)">
-                                            停用
+                                        <el-button type="primary" size="small"
+                                            @click="editItem(scope.row)">编辑</el-button>
+                                        <el-button :type="scope.row.delFlag !== '0' ? 'success' : 'info'" size="small"
+                                            @click.prevent="changeDelFlag(scope.row)">
+                                            {{ scope.row.delFlag == '0' ? '停用' : '启用' }}
                                         </el-button>
                                     </template>
                                 </el-table-column>
                             </el-table>
                         </div>
                         <div>
-                            <el-pagination :current-page="currentPageClass" :page-size="pageSizeClass"
-                                :page-sizes="[10, 15, 20, 25]" :total="ypClassData.length"
+                            <el-pagination :current-page="pageNumber" :page-size="pageSize"
+                                :page-sizes="[10, 15, 20, 25]" :total="total"
                                 layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
-                                @size-change="handleSizeChangeClass" @current-change="handleCurrentChangeClass">
+                                @size-change="handleSizeChange" @current-change="handleCurrentChange">
                             </el-pagination>
                         </div>
                     </div>
                 </el-tab-pane>
-                <el-tab-pane key="drugKind" label="生产厂家字典" name="drugKind" style="height: 90%;">
+                <el-tab-pane key="drugKind" label="生产厂家字典" name="1" style="height: 90%;">
                     <div class="layout_display_flex_y">
                         <div class="layout_flex_1-y">
-                            <el-table
-                                :data="drugKindData.slice(pageSizeKind * (currentPageKind - 1), pageSizeKind * currentPageKind)"
-                                border style="width: 100%" height="100%" stripe highlight-current-row
-                                class="drugKindTable normal-size">
-                                <el-table-column prop="code" label="厂家编码" width="80">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.code"></el-input>
-                                        <span v-else>{{ scope.row.code }}</span>
-                                    </template>
+                            <el-table :data="tableData" border style="width: 100%" height="100%" stripe
+                                highlight-current-row class="drugKindTable normal-size">
+                                <el-table-column prop="companyCode" label="厂家编码" width="80">
                                 </el-table-column>
-                                <el-table-column prop="name" label="厂家名称" width="200">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="companyName" label="厂家名称" width="200">
                                 </el-table-column>
                                 <el-table-column prop="pyCode" label="拼音码" width="140" />
                                 <el-table-column prop="dcode" label="五笔码" width="140" />
                                 <el-table-column prop="name" label="厂商类型" width="200">
                                     <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
+                                        <span>{{ getLabelByValue(scope.row.companyType, companyTypeOption) }}</span>
                                     </template>
                                 </el-table-column>
-                                <el-table-column prop="name" label="地址" width="200">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="companyAddr" label="地址" width="200">
                                 </el-table-column>
-                                <el-table-column prop="name" label="电话" width="140">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="companyPhone" label="电话" width="140">
                                 </el-table-column>
-                                =<el-table-column prop="name" label="账号" width="140">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                =<el-table-column prop="companyAccount" label="账号" width="140">
                                 </el-table-column>
-                                <el-table-column prop="name" label="开户银行" width="140">
-                                    <template v-slot="scope">
-                                        <el-input v-if="scope.row.isEdit" size="small"
-                                            v-model="scope.row.name"></el-input>
-                                        <span v-else>{{ scope.row.name }}</span>
-                                    </template>
+                                <el-table-column prop="nacompanyBanke" label="开户银行" width="140">
                                 </el-table-column>
                                 <el-table-column prop="delFlag" label="是否停用" width="100">
                                     <template v-slot="scope">
-                                        <div v-if="scope.row.isEdit">
-                                            <el-select v-model="scope.row.delFlag" clearable placeholder="请选择是否停用">
-                                                <el-option v-for="option in delFlagOptions" :key="option.code"
-                                                    :label="option.name" :value="option.code"></el-option>
-                                            </el-select>
-                                        </div>
-                                        <div v-else>
-                                            <el-select v-model="scope.row.delFlag" disabled placeholder="请选择是否无效">
-                                                <el-option v-for="option in delFlagOptions" :key="option.code"
-                                                    :label="option.name" :value="option.code"></el-option>
-                                            </el-select>
-                                        </div>
+                                        <span>{{ getLabelByValue(scope.row.delFlag, delFlagOption) }}</span>
                                     </template>
                                 </el-table-column>
-                                <el-table-column fixed="right" label="操作" min-width="180" width="180" center>
+                                <el-table-column fixed="right" label="操作" min-width="180" width="180" align="center">
                                     <template #default="scope">
-                                        <el-button type="primary" size="small" v-if="!scope.row.isEdit"
-                                            @click="editYpClass(scope.row)">编辑</el-button>
-                                        <el-button type="primary" size="small" v-if="scope.row.isEdit"
-                                            @click="updateYpClass(scope.row)">保存</el-button>
-                                        <el-button type="primary" size="small" v-if="scope.row.isEdit"
-                                            @click="cancelYpClass(scope.row)">取消
-                                        </el-button>
-                                        <el-button type="danger" size="small"
-                                            @click.prevent="deleteYpClass(scope.$index, scope.row)">
-                                            删除
-                                        </el-button>
+                                        <el-button type="primary" size="small"
+                                            @click="editItem(scope.row)">编辑</el-button>
                                         <el-button type="success" size="small"
-                                            v-if="!scope.row.isEdit && scope.row.delFlag === '1'"
-                                            @click.prevent="deleteYpClass(scope.$index, scope.row)">
-                                            启用
-                                        </el-button>
-                                        <el-button type="info" size="small"
-                                            v-if="!scope.row.isEdit && scope.row.delFlag === '0'"
-                                            @click.prevent="deleteYpClass(scope.$index, scope.row)">
-                                            停用
+                                            @click.prevent="changeDelFlag(scope.row)">
+                                            {{ scope.row.delFlag == '0' ? '停用' : '启用' }}
                                         </el-button>
                                     </template>
                                 </el-table-column>
                             </el-table>
                         </div>
                         <div>
-                            <el-pagination :current-page="currentPageKind" :page-size="pageSizeKind"
-                                :page-sizes="[10, 15, 20, 25]" :total="drugKindData.length"
+                            <el-pagination :current-page="pageNumber" :page-size="pageSize"
+                                :page-sizes="[10, 15, 20, 25]" :total="total"
                                 layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
-                                @size-change="handleSizeChangeKind" @current-change="handleCurrentChangeKind">
+                                @size-change="handleSizeChange" @current-change="handleCurrentChange">
                             </el-pagination>
                         </div>
                     </div>
@@ -231,67 +112,72 @@
             </el-tabs>
         </div>
 
-        <el-dialog v-model="centerDialogVisible" :title="'新增' + currentTabLabel" width="500" center>
+        <el-dialog v-model="centerDialogVisible" :title="(addItemForm.companyCode ? '编辑' : '新增') + currentTabLabel"
+            width="800" center @close="handleDialogClose">
             <template #footer>
-                <el-form :model="addItemForm" label-width="auto" style="max-width: 600px">
-                    <el-row type="flex" justify="center" :gutter="0">
+                <el-form ref="ruleFormRef" :model="addItemForm" label-width="auto" :rules="formRules">
+                    <el-row type="flex" justify="center" :gutter="20">
+                        <el-col :span="colSize">
+                            <el-form-item label="企业编码" prop="companyCode">
+                                <el-input v-model="addItemForm.companyCode" disabled />
+                            </el-form-item>
+                        </el-col>
                         <el-col :span="colSize">
-                            <el-form-item label="供应商名称">
-                                <el-input v-model="addItemForm.name" />
+                            <el-form-item label="企业名称" prop="companyName">
+                                <el-input v-model="addItemForm.companyName" />
                             </el-form-item>
                         </el-col>
                         <el-col :span="colSize">
-                            <el-form-item label="厂商类型">
-                                <el-select v-model="addItemForm.region" placeholder="">
-                                    <el-option label="Zone one" value="shanghai" />
-                                    <el-option label="Zone two" value="beijing" />
+                            <el-form-item label="企业类型类型" prop="companyType">
+                                <el-select v-model="addItemForm.companyType" placeholder="">
+                                    <el-option v-for="item in companyTypeOption" :label="item.label" :value="item.value"
+                                        :key="item.value">
+                                    </el-option>
                                 </el-select>
                             </el-form-item>
                         </el-col>
-                    </el-row>
-
-                    <el-row type="flex" justify="center" :gutter="0">
                         <el-col :span="colSize">
-                            <el-form-item label="地址">
-                                <el-input v-model="addItemForm.name" />
+                            <el-form-item label="产品类型" prop="companyProductType">
+                                <el-select v-model="addItemForm.companyProductType" placeholder="">
+                                    <el-option label="医用材料" value="0" />
+                                    <el-option label="固定资产" value="1" />
+                                    <el-option label="物资材料" value="2" />
+                                </el-select>
                             </el-form-item>
                         </el-col>
                         <el-col :span="colSize">
-                            <el-form-item label="电话">
-                                <el-input v-model="addItemForm.name" />
+                            <el-form-item label="企业地址" prop="companyAddr">
+                                <el-input v-model="addItemForm.companyAddr" />
                             </el-form-item>
                         </el-col>
-                    </el-row>
-
-                    <el-row type="flex" justify="center" :gutter="0">
                         <el-col :span="colSize">
-                            <el-form-item label="账号">
-                                <el-input v-model="addItemForm.name" />
+                            <el-form-item label="企业电话" prop="companyPhone">
+                                <el-input v-model="addItemForm.companyPhone" />
                             </el-form-item>
                         </el-col>
                         <el-col :span="colSize">
-                            <el-form-item label="开户银行">
-                                <el-input v-model="addItemForm.name" />
+                            <el-form-item label="企业账号" prop="companyAccount">
+                                <el-input v-model="addItemForm.companyAccount" />
                             </el-form-item>
                         </el-col>
-                    </el-row>
-
-                    <el-row type="flex" justify="center" :gutter="0">
                         <el-col :span="colSize">
-                            <el-form-item label="是否停用">
-                                <el-select v-model="addItemForm.region" placeholder="">
-                                    <el-option label="停用" value="1" />
-                                    <el-option label="启用" value="0" />
-                                </el-select>
+                            <el-form-item label="开户银行" prop="companyBank">
+                                <el-input v-model="addItemForm.companyBank" />
                             </el-form-item>
                         </el-col>
                         <el-col :span="colSize">
+                            <el-form-item label="是否停用" prop="delFlag">
+                                <el-select v-model="addItemForm.delFlag" placeholder="">
+                                    <el-option v-for="item in delFlagOption" :key="item.value" :label="item.label"
+                                        :value="item.value" />
+                                </el-select>
+                            </el-form-item>
                         </el-col>
                     </el-row>
                 </el-form>
                 <div class="dialog-footer">
                     <el-button @click="centerDialogVisible = false">取消</el-button>
-                    <el-button type="primary" @click="centerDialogVisible = false">
+                    <el-button type="primary" @click="addOrEditItem">
                         确定
                     </el-button>
                 </div>
@@ -303,21 +189,13 @@
 import { ref, onMounted, nextTick } from 'vue'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import {
-    selectYpClass, saveYpClass, delYpClassByCode,
-    selectDrugKind, saveDrugKind, delDrugKindByCode,
-    selectYpDosage, saveYpDosage, delYpDosageByCode,
-    selectYpUnit, saveYpUnit, delYpUnitByCode,
-    selectYpChargeGroup, saveYpChargeGroup, delYpChargeGroupByCode,
-    selectYpVisibleFlag, updateYpVisibleFlag,
-    selectYpSupply, saveYpSupply, delYpSupplyByCode,
-    selectYpManuFactory, saveYpManuFactory, delYpManuFactoryByCode
+    delYpClassByCode,
 } from '@/api/yp-dict/yp-dict-base.js'
+import { getLcCompanyList, insertLcCompany } from '@/api/lc/company.js'
 import searchArea from '@/components/searchArea/index.vue';
+import { getLabelByValue } from '@/utils/common.js'
 
-const editableTabsValue = ref('ypClass')
-const msgTip = '分类编码(code)有变更,原始字典记录存在关联,请谨慎做更改,是否确认!!!'
-const delFlagOptions = [{ code: '0', name: '启用' }, { code: '1', name: '停用' }]
-
+const currentCompanyType = ref('0')
 const searchData = ref([
     {
         label: '企业名称',
@@ -328,263 +206,98 @@ const searchData = ref([
     },
 ])
 
-let addItemForm = reactive({})
+let addItemForm = ref({
+    delFlag: '0',
+})
 
 let centerDialogVisible = ref(false)
 
 let currentTabLabel = ref('供应商')
 
-const colSize = ref(12)
-
-const pageSizeClass = ref(20)
-const currentPageClass = ref(1)
-const handleSizeChangeClass = (val) => {
-    pageSizeClass.value = val
+const colSize = ref(8)
+const handleSizeChange = (val) => {
+    pageSize.value = val
 }
-const handleCurrentChangeClass = (val) => {
-    currentPageClass.value = val
+const handleCurrentChange = (val) => {
+    pageNumber.value = val
 }
 
-const pageSizeKind = ref(20)
-const currentPageKind = ref(1)
-const handleSizeChangeKind = (val) => {
-    pageSizeKind.value = val
-}
-const handleCurrentChangeKind = (val) => {
-    currentPageKind.value = val
+const formRules = {
+    companyName: [
+        { required: true, message: '请输入企业名称', trigger: 'blur' },
+    ],
+    companyType: [
+        { required: true, message: '请选择企业类型', trigger: 'change' },
+    ],
+    companyProductType: [
+        { required: true, message: '请选择产品类型', trigger: 'change' },
+    ],
+    delFlag: [
+        { required: true, message: '请选择是否停用', trigger: 'change' },
+    ],
 }
 
-const pageSizeDosage = ref(20)
-const currentPageDosage = ref(1)
+const total = ref(0)
+const pageSize = ref(10)
+const pageNumber = ref(1)
+const tableData = ref([])
 
-const pageSizeUnit = ref(20)
-const currentPageUnit = ref(1)
+const companyTypeOption = [
+    { label: '供应商', value: '0' },
+    { label: '生产厂家', value: '1' },
+]
 
-const pageSize = ref(20)
-const currentPage = ref(1)
+const delFlagOption = [
+    { label: '启用', value: '0' },
+    { label: '停用', value: '1' },
+]
 
-const pageSizeSupply = ref(20)
-const currentPageSupply = ref(1)
+const ruleFormRef = ref(null)
 
-const pageSizeManuFactory = ref(20)
-const currentPageManuFactory = ref(1)
-
-const ypClassData = ref([])
-const drugKindData = ref([])
-const ypDosageData = ref([])
-const ypUnitData = ref([])
-const ypChargeGroupData = ref([])
-const visibleFlagData = ref([])
-const ypSupplyData = ref([])
-const ypManuFactoryData = ref([])
-
-const text = ref('')
 onMounted(() => {
     nextTick(() => {
-        queryYpClass()
+        queryCompanyList()
     })
 })
 
+const searchForm = ref({})
 //搜索表单方法
 const searchByForm = (form) => {
     console.log("search", form)
+    searchForm.value = form
+    queryCompanyList()
 }
 
-
-// 查询药品字典-药性字典
-const queryYpClass = () => {
-    selectYpClass(text.value)
-        .then((res) => {
-            res.forEach(row => {
-                // 是否标记
-                row['isEdit'] = false
-                // 是否新增
-                row['isAdd'] = false
-            })
-            ypClassData.value = res
-        })
-        .catch(() => {
-            ypClassData.value = []
-        })
-}
-
-// 查询药品字典-药品分类字典
-const queryDrugKind = () => {
-    selectDrugKind(text.value)
-        .then((res) => {
-            res.forEach(row => {
-                // 是否标记
-                row['isEdit'] = false
-                // 是否新增
-                row['isAdd'] = false
-            })
-            drugKindData.value = res
-        })
-        .catch(() => {
-            drugKindData.value = []
-        })
-}
-
-// 查询药房药品停用情况
-const flagFilter = ref('')
-const queryVisibleFlag = () => {
-    selectYpVisibleFlag(text.value, flagFilter.value)
-        .then((res) => {
-            res.forEach(row => {
-                // 是否标记
-                row['isEdit'] = false
-                // 是否新增
-                row['isAdd'] = false
-            })
-            visibleFlagData.value = res
-        })
-        .catch(() => {
-            visibleFlagData.value = []
-        })
+const handleDialogClose = () => {
+    addItemForm.value = { delFlag: '0' }
+    ruleFormRef.value.resetFields();
 }
 
-// 查询
-const queryItem = () => {
-    if (editableTabsValue.value === 'ypClass') {
-        queryYpClass()
-    } else if (editableTabsValue.value === 'drugKind') {
-        queryDrugKind()
+const editItem = (row) => {
+    if (row) {
+        addItemForm.value = row
     }
-}
-
-// 新增行
-const onAddItem = () => {
-    console.log('onAddItem')
     centerDialogVisible.value = true
-    return
-    if (editableTabsValue.value === 'ypClass') {
-        let count
-        if (ypClassData.value.length % pageSizeClass.value === 0) {
-            count = Math.ceil(ypClassData.value.length / pageSizeClass.value) + 1
-        } else {
-            count = Math.ceil(ypClassData.value.length / pageSizeClass.value)
-        }
-        currentPageClass.value = count
-        ypClassData.value.push({
-            code: '',
-            name: '',
-            pyCode: '',
-            dcode: '',
-            delFlag: '',
-            isEdit: true,
-            isAdd: true,
-        })
-        const el = document.querySelector('.ypClassTable .el-scrollbar__wrap')
-        const el2 = document.querySelector('.ypClassTable .el-table__body tbody')
-        setTimeout(() => {
-            const height = el2.clientHeight - el.clientHeight
-            if (height > 0) {
-                el.scrollTop = height
-            }
-        }, 100)
-    } else if (editableTabsValue.value === 'drugKind') {
-        let count
-        if (drugKindData.value.length % pageSizeKind.value === 0) {
-            count = Math.ceil(drugKindData.value.length / pageSizeKind.value) + 1
-        } else {
-            count = Math.ceil(drugKindData.value.length / pageSizeKind.value)
-        }
-        currentPageKind.value = count
-        drugKindData.value.push({
-            code: '',
-            name: '',
-            pyCode: '',
-            dcode: '',
-            ypType: '',
-            mzBillCode: '',
-            zyBillCode: '',
-            isEdit: true,
-            isAdd: true,
-        })
-        const el = document.querySelector('.drugKindTable .el-scrollbar__wrap')
-        const el2 = document.querySelector('.drugKindTable .el-table__body tbody')
-        setTimeout(() => {
-            const height = el2.clientHeight - el.clientHeight
-            if (height > 0) {
-                el.scrollTop = height
-            }
-        }, 100)
-    }
-}
-
-// 药品字典-药性字典增删改存开始
-// 编辑
-const editYpClass = (row) => {
-    // 备份原始数据
-    row['oldRow'] = JSON.parse(JSON.stringify(row))
-    row.isEdit = true
-}
-// 取消
-const cancelYpClass = (row) => {
-    // 如果是新增的数据
-    if (row.isAdd) {
-        ypClassData.value.splice(ypClassData.value.length - 1, 1)
-    } else {
-        // 不是新增的数据  还原数据
-        for (const i in row.oldRow) {
-            row[i] = row.oldRow[i]
-        }
-    }
 }
-// 保存
-const updateYpClass = (row) => {
-    if (!row.code || !row.name) {
-        ElMessage({
-            type: "warning",
-            message: "药性字典编码或名称不存在,请检查!",
-            duration: 2500,
-            showClose: true,
-        });
-        return
-    }
-
-    if (row.isAdd) {
-        let fe = 0
-        for (let num in ypClassData.value) {
-            if (ypClassData.value[num].code === row.code) {
-                fe++
-            }
-        }
-        if (fe === 2) {
-            ElMessage({
-                type: "warning",
-                message: "存在重复的药性字典,请核对!",
-                duration: 2500,
-                showClose: true,
-            });
-        } else {
-            callSaveYpClass(row, null)
-        }
 
-    } else {
-        let oldCode = row.oldRow.code
-        if (oldCode !== row.code) {
-            ElMessageBox.confirm(msgTip, {
-                cancelButtonText: '取消',
-                confirmButtonText: '确定',
-                type: 'warning',
-                distinguishCancelAndClose: true,
-                dangerouslyUseHTMLString: true
-            }).then(() => {
-                callSaveYpClass(row, oldCode)
-            }).catch((action) => {
-                if (action === 'cancel') {
-                    queryYpClass()
-                }
+// 新增
+const addOrEditItem = (row) => {
+    console.log("addItemForm", addItemForm)
+    ruleFormRef.value.validate(valid => {
+        if (valid) {
+            insertLcCompany(addItemForm.value).then(res => {
+                ElMessage.success(addItemForm.value.id ? '修改成功' : '新增成功')
+                queryCompanyList()
+                centerDialogVisible.value = false
+            }).catch(err => {
+                // ElMessage.error(err.message)
             })
-        } else {
-            callSaveYpClass(row, oldCode)
         }
-    }
+    })
 }
 
-const callSaveYpClass = (row, oldCode) => {
-    let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
+const changeDelFlag = (row) => {
+    let title = `是否${row.delFlag == '0' ? '停用' : '启用'}`
     ElMessageBox.confirm(title, {
         cancelButtonText: '取消',
         confirmButtonText: '确定',
@@ -592,30 +305,20 @@ const callSaveYpClass = (row, oldCode) => {
         distinguishCancelAndClose: true,
         dangerouslyUseHTMLString: true
     }).then(() => {
-        saveYpClass(row).then((res) => {
-            ElMessage({
-                type: "success",
-                message: res.cg,
-                duration: 2500,
-                showClose: true,
-            });
-            if (oldCode !== null && oldCode !== row.code) {
-                // 删除原始数据
-                delYpClassByCode(oldCode).then((res) => {
-                    queryYpClass()
-                })
-            } else {
-                queryYpClass()
-            }
-        })
+        let params = {id: row.id, delFlag: row.delFlag == '0' ? '1' : '0'}
+        insertLcCompany(params).then(res => {
+                ElMessage.success(row.delFlag == '0' ? '停用成功' : '启用成功')
+                queryCompanyList()
+            }).catch(err => {
+                // ElMessage.error(err.message)
+            })
     }).catch((action) => {
         if (action === 'cancel') {
-            queryYpClass()
         }
     })
 }
 
-const deleteYpClass = (index, row) => {
+const deleteItem = (index, row) => {
     let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
     ElMessageBox.confirm(title, {
         cancelButtonText: '取消',
@@ -631,53 +334,37 @@ const deleteYpClass = (index, row) => {
                 duration: 2500,
                 showClose: true,
             });
-            queryYpClass()
         })
     }).catch((action) => {
         if (action === 'cancel') {
-            queryYpClass()
         }
     })
 }
 
 const handleClick = (tab, event) => {
     // 查询哪个tab页面
-    editableTabsValue.value = tab.props.name
-    if (editableTabsValue.value === 'ypClass') {
-        currentTabLabel.value = '供应商'
-        queryYpClass()
-        currentPageClass.value = 1
-    } else if (editableTabsValue.value === 'drugKind') {
-        currentTabLabel.value = '生产厂家'
-        queryDrugKind()
-        currentPageKind.value = 1
-    } else if (editableTabsValue.value === 'ypDosage') {
-        queryYpDosage()
-        currentPageDosage.value = 1
-    } else if (editableTabsValue.value === 'ypUnit') {
-        queryYpUnit()
-        currentPageUnit.value = 1
-    } else if (editableTabsValue.value === 'ypChargeGroup') {
-        queryYpChargeGroup()
-    } else if (editableTabsValue.value === 'visibleFlag') {
-        queryVisibleFlag()
-        currentPage.value = 1
-    } else if (editableTabsValue.value === 'ypSupply') {
-        queryYpSupply()
-        currentPageSupply.value = 1
-    } else if (editableTabsValue.value === 'ypManuFactory') {
-        queryYpManuFactory()
-        currentPageManuFactory.value = 1
-    }
+    currentCompanyType.value = tab.props.name
+    pageNumber.value = "1"
+    pageSize.value = "10"
+    queryCompanyList()
 }
 
-const tableRowClassName = ({
-    row,
-    rowIndex,
-}) => {
-    if (row.delFlag === '1') {
-        return 'warning-row'
+const queryCompanyList = (params) => {
+    params = {
+        ...params,
+        ...searchForm.value,
+        companyType: currentCompanyType.value,
+        pageSize: pageSize.value,
+        pageNumber: pageNumber.value
     }
+    getLcCompanyList(params).then((res) => {
+        console.log("queryCompanyList", res)
+        total.value = res.total
+        tableData.value = res.records
+        console.log("tableData", tableData.value)
+    }).catch((err) => {
+        ElMessage.error(err)
+    })
 }
 
 </script>