|
@@ -68,16 +68,49 @@
|
|
|
<a-col :span="7"></a-col>
|
|
|
<a-col :span="10"></a-col>
|
|
|
</a-row>
|
|
|
- <a-divider orientation="left">管理驿站 共计:{{dataModel.siteCount}}</a-divider>
|
|
|
+ <a-divider orientation="left">管理驿站 共计:{{manageSites.length}}</a-divider>
|
|
|
<a-row>
|
|
|
- <a-table :columns="columns" :data-source="dataModel.manageSites" :scroll="{ x:'100%', y: 500 }" :pagination="pagination"
|
|
|
- :loading="formState.loading"
|
|
|
- @change="handleTableChange"
|
|
|
- :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange}"
|
|
|
- :row-key="record=>record.siteId"
|
|
|
- bordered>
|
|
|
- <template #bodyCell="{ column, text, record }"></template>
|
|
|
- </a-table>
|
|
|
+ <a-col :span="24" style="text-align: right; margin-top: 20px; margin-right: 20px">
|
|
|
+ <Space>
|
|
|
+ <a-button @click="addSite">
|
|
|
+ <template #icon>
|
|
|
+ <plus-circle-outlined/>
|
|
|
+ </template>
|
|
|
+ 新增
|
|
|
+ </a-button>
|
|
|
+ </Space>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row>
|
|
|
+ <a-col style="margin-bottom: 20px;">
|
|
|
+ <a-table :columns="columns" :data-source="manageSites" :pagination="pagination"
|
|
|
+ :loading="formState.loading"
|
|
|
+ @change="handleTableChange"
|
|
|
+ :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange}"
|
|
|
+ :row-key="record=>record.siteId"
|
|
|
+ bordered>
|
|
|
+ <template #bodyCell="{ column ,index}">
|
|
|
+ <template v-if="column.key === 'siteName'">
|
|
|
+ <div>
|
|
|
+ <a-select
|
|
|
+ ref="select"
|
|
|
+ v-model:value="manageSites[index][column.key]"
|
|
|
+ :options="allSites"
|
|
|
+ @change="manageSitesChange(index,manageSites[index][column.key])"
|
|
|
+ :field-names="{ label: 'siteName', value: 'siteID' }"
|
|
|
+ :allow-clear="true" style="width: 200px" >
|
|
|
+ </a-select>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.key === 'detailAddress'">
|
|
|
+ {{manageSites[index][column.key]}}
|
|
|
+ </template>
|
|
|
+ <template v-if="column.key === 'operation'">
|
|
|
+ <a-button type="link" size="small" @click="delSite(index)">删除</a-button>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </a-col>
|
|
|
</a-row>
|
|
|
<a-divider orientation="left">其他</a-divider>
|
|
|
<a-row>
|
|
@@ -94,11 +127,12 @@
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import {computed, defineComponent, reactive, ref, toRefs} from "vue";
|
|
|
-import {get, save} from "@/api/baseSettings/institution";
|
|
|
+import {getInstitutionByID, saveInstitution} from "@/api/baseSettings/institution";
|
|
|
+import {getSiteList,getListByInstitutionID,getSiteByID} from "@/api/baseSettings/siteInfo";
|
|
|
import BUploadFile from "@/components/file/uploadFile.vue";
|
|
|
-/*import dayjs from "dayjs";*/
|
|
|
import {message, TableColumnsType, TableProps} from "ant-design-vue";
|
|
|
import {getPaginationTotalTitle} from "@/utils/common";
|
|
|
+/*import dayjs from "dayjs";*/
|
|
|
|
|
|
interface InstitutionModel {
|
|
|
dataModel: any;
|
|
@@ -123,13 +157,14 @@ export default defineComponent({
|
|
|
const isDetail = ref<boolean>(false);
|
|
|
const pageParams = reactive({
|
|
|
pageIndex: 1,
|
|
|
- pageSize: 20,
|
|
|
+ pageSize: 10,
|
|
|
institutionID:''
|
|
|
});
|
|
|
const columns: TableColumnsType = [
|
|
|
{title: '序号', align: "center",key: 'siteID',customRender: item => `${pageParams.pageSize * (pageParams.pageIndex - 1) + item.index + 1}`},
|
|
|
{title: '驿站名称', dataIndex: 'siteName', key: 'siteName', align: "center"},
|
|
|
- {title: '驿站地址', dataIndex: 'detailAddress', key: 'detailAddress', align: "center"}
|
|
|
+ {title: '驿站地址', dataIndex: 'detailAddress', key: 'detailAddress', align: "center"},
|
|
|
+ {title: '操作', key: 'operation', fixed: 'right',width:170, align: "center"},
|
|
|
];
|
|
|
const pagination = computed(() => ({
|
|
|
total: formState.total,
|
|
@@ -143,24 +178,49 @@ export default defineComponent({
|
|
|
selectedRowKeys: [],
|
|
|
loading: false
|
|
|
});
|
|
|
+ const allSites = ref([]);
|
|
|
+ const manageSites = ref<any>([]);
|
|
|
|
|
|
const loadData = (id: string) => {
|
|
|
- pageParams.institutionID = id;
|
|
|
- get(pageParams).then((result: any) => {
|
|
|
+ getInstitutionByID(id).then((result: any) => {
|
|
|
formData.dataModel = result;
|
|
|
- console.log(formData.dataModel);
|
|
|
+ console.log('dataModel',formData.dataModel);
|
|
|
+ GetManageSites(formData.dataModel.institutionID);
|
|
|
/*feedbackDateDetail.value = dayjs(formState.dataModel.feedbackDate).format('YYYY-MM-DD');
|
|
|
resolveDateDetail.value = formState.dataModel.resolveDate == null?"": dayjs(formState.dataModel.resolveDate).format('YYYY-MM-DD');*/
|
|
|
});
|
|
|
}
|
|
|
|
|
|
const show = (id: any,method:string,ifDetail:boolean) => {
|
|
|
+ title.value ="运营机构管理-"+method;
|
|
|
isDetail.value = ifDetail;
|
|
|
loadData(id);
|
|
|
- title.value ="运营机构管理-"+method;
|
|
|
visible.value = true;
|
|
|
};
|
|
|
|
|
|
+ const getAllSites = () => {
|
|
|
+ pageParams.institutionID = '';
|
|
|
+ getSiteList(pageParams).then((result :any) => {
|
|
|
+ allSites.value = result.list;
|
|
|
+ console.log('allSites',allSites);
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const GetManageSites = (id: string) => {
|
|
|
+ pageParams.institutionID = id;
|
|
|
+ getListByInstitutionID(pageParams).then((result :any)=> {
|
|
|
+ manageSites.value = result.list;
|
|
|
+ console.log('manageSites',manageSites);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ const addSite = () => {
|
|
|
+ (manageSites.value as any[]).push({siteID: null,siteName: '', detailAddress:''});
|
|
|
+ }
|
|
|
+ const delSite = (site) =>{
|
|
|
+ (manageSites.value as any[]).splice(site, 1);
|
|
|
+ }
|
|
|
+
|
|
|
const handleTableChange: TableProps['onChange'] = (pag: { pageSize: number; current: number },) => {
|
|
|
pageParams.pageIndex = pag.current;
|
|
|
pageParams.pageSize = pag.pageSize;
|
|
@@ -170,8 +230,27 @@ export default defineComponent({
|
|
|
formState.selectedRowKeys = selectedRowKeys;
|
|
|
};
|
|
|
|
|
|
+ const manageSitesChange = (index:any,siteID:any) =>{
|
|
|
+ const isAllowAdd = ref<boolean>(true);
|
|
|
+ manageSites.value.forEach(item=>{
|
|
|
+ if (item.siteID == siteID){
|
|
|
+ isAllowAdd.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (isAllowAdd.value){
|
|
|
+ getSiteByID(siteID).then((result :any)=> {
|
|
|
+ manageSites.value[index]= result;
|
|
|
+ });
|
|
|
+ console.log('manageSites',manageSites.value);
|
|
|
+ }else{
|
|
|
+ (manageSites.value as any[]).splice(index, 1);
|
|
|
+ message.error("不允许添加相同的站点!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const validate = () =>{
|
|
|
- console.log(formData.dataModel);
|
|
|
+ console.log('dataModel',formData.dataModel);
|
|
|
if (formData.dataModel.companyName==null) {
|
|
|
message.error("请输入企业名称!");
|
|
|
return;
|
|
@@ -200,7 +279,8 @@ export default defineComponent({
|
|
|
const handleOk = () => {
|
|
|
validate();
|
|
|
if (isAllowCommit.value){
|
|
|
- save(formData.dataModel).then(result => {
|
|
|
+ formData.dataModel.manageSites = manageSites.value;
|
|
|
+ saveInstitution(formData.dataModel).then(result => {
|
|
|
if (result) {
|
|
|
visible.value = false;
|
|
|
props.loadData();
|
|
@@ -213,14 +293,14 @@ export default defineComponent({
|
|
|
visible.value = false;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-
|
|
|
return {
|
|
|
...toRefs(formData),
|
|
|
pageParams,
|
|
|
columns,
|
|
|
pagination,
|
|
|
formState,
|
|
|
+ allSites,
|
|
|
+ manageSites,
|
|
|
/*feedbackDateDetail,
|
|
|
resolveDateDetail,*/
|
|
|
isAllowCommit,
|
|
@@ -229,14 +309,20 @@ export default defineComponent({
|
|
|
title,
|
|
|
confirmLoading,
|
|
|
show,
|
|
|
+ getAllSites,
|
|
|
+ GetManageSites,
|
|
|
+ addSite,
|
|
|
+ delSite,
|
|
|
handleTableChange,
|
|
|
onSelectChange,
|
|
|
+ manageSitesChange,
|
|
|
handleOk,
|
|
|
handleCancel,
|
|
|
validate
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
+ this.getAllSites();
|
|
|
},
|
|
|
})
|
|
|
</script>
|