feat:使用监管页面完成
This commit is contained in:
parent
95aab51cf6
commit
d195ad4826
@ -45,7 +45,6 @@ const errorHandler = async (error) => {
|
|||||||
* 请求拦截器
|
* 请求拦截器
|
||||||
*/
|
*/
|
||||||
publicAxios.interceptors.request.use(async (config) => {
|
publicAxios.interceptors.request.use(async (config) => {
|
||||||
console.log('config', config);
|
|
||||||
const UserStore = useUserStore();
|
const UserStore = useUserStore();
|
||||||
if (UserStore.hasToken()) {
|
if (UserStore.hasToken()) {
|
||||||
config.headers['authorization'] = config.headers['authorization'] ?? UserStore.token;
|
config.headers['authorization'] = config.headers['authorization'] ?? UserStore.token;
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
import request from '@/utils/axios';
|
||||||
|
|
||||||
|
export function getEnterpriseDealerCheck(params) {
|
||||||
|
return request('/inputGoods/distributorCheck/page', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function addEnterpriseDealerCheck(data) {
|
||||||
|
return request('/inputGoods/distributorCheck/page', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function delEnterpriseDealerCheck(ids) {
|
||||||
|
return request(`/inputGoods/distributorCheck/page/${ids}`);
|
||||||
|
}
|
||||||
|
export function editEnterpriseDealerCheck(data) {
|
||||||
|
return request('/inputGoods/distributorCheck/page', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
@ -4,6 +4,7 @@ import * as knowledgeApi from './knowledge';
|
|||||||
import * as leaseSuperviseApi from './leaseSupervise';
|
import * as leaseSuperviseApi from './leaseSupervise';
|
||||||
import * as productionDealerApi from './productionDealer';
|
import * as productionDealerApi from './productionDealer';
|
||||||
import * as useSuperviseApi from './useSupervise';
|
import * as useSuperviseApi from './useSupervise';
|
||||||
|
import * as enteroriseDealerCheckApi from './enterpriseDealerCheck';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
...materialApi,
|
...materialApi,
|
||||||
@ -12,4 +13,5 @@ export default {
|
|||||||
...leaseSuperviseApi,
|
...leaseSuperviseApi,
|
||||||
...productionDealerApi,
|
...productionDealerApi,
|
||||||
...useSuperviseApi,
|
...useSuperviseApi,
|
||||||
|
...enteroriseDealerCheckApi,
|
||||||
};
|
};
|
||||||
|
@ -15,12 +15,6 @@ const inputSuppliesRoutes = [
|
|||||||
// component: () => import('@/views/inputSuppliesManage/inputDataView/index.vue'),
|
// component: () => import('@/views/inputSuppliesManage/inputDataView/index.vue'),
|
||||||
// meta: { title: '投入品资源一张图', icon: 'Document' },
|
// meta: { title: '投入品资源一张图', icon: 'Document' },
|
||||||
// },
|
// },
|
||||||
// {
|
|
||||||
// path: '/sub-government-affairs-service/materialManage',
|
|
||||||
// name: 'materialManage',
|
|
||||||
// component: () => import('@/views/inputSuppliesManage/materialManage/index.vue'),
|
|
||||||
// meta: { title: '物资管理融合', icon: 'Document' },
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
path: '/sub-government-affairs-service/material',
|
path: '/sub-government-affairs-service/material',
|
||||||
name: 'material',
|
name: 'material',
|
||||||
@ -66,12 +60,12 @@ const inputSuppliesRoutes = [
|
|||||||
component: () => import('@/views/inputSuppliesManage/productionDealer/index.vue'),
|
component: () => import('@/views/inputSuppliesManage/productionDealer/index.vue'),
|
||||||
meta: { title: '企业经销商管理', icon: 'Document' },
|
meta: { title: '企业经销商管理', icon: 'Document' },
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: '/sub-government-affairs-service/enterpriseDealerCheck',
|
path: '/sub-government-affairs-service/enterpriseDealerCheck',
|
||||||
// name: 'enterpriseDealerCheck',
|
name: 'enterpriseDealerCheck',
|
||||||
// component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
|
component: () => import('@/views/inputSuppliesManage/enterpriseDealerCheck/index.vue'),
|
||||||
// meta: { title: '企业经销商抽检', icon: 'Document' },
|
meta: { title: '企业经销商抽检', icon: 'Document' },
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: '/sub-government-affairs-service/useSupervise',
|
path: '/sub-government-affairs-service/useSupervise',
|
||||||
name: 'useSupervise',
|
name: 'useSupervise',
|
||||||
|
@ -7,14 +7,20 @@
|
|||||||
:min="_numberSet.min"
|
:min="_numberSet.min"
|
||||||
:controls-position="_numberSet.controlsPosition"
|
:controls-position="_numberSet.controlsPosition"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
></el-input-number>
|
>
|
||||||
|
</el-input-number>
|
||||||
<el-select v-model="data.type" @change="handleChange">
|
<el-select v-model="data.type" @change="handleChange">
|
||||||
<el-option v-for="item in props.options" :key="'custom_' + Date.now() + item.value" :label="item.label" :value="item.value" />
|
<el-option
|
||||||
|
v-for="item in props.options"
|
||||||
|
:key="'custom_' + Date.now() + item[props.prop.value]"
|
||||||
|
:label="item[props.prop.label]"
|
||||||
|
:value="item[props.prop.value]"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script setup>
|
||||||
import { ref, watchEffect } from 'vue';
|
import { ref, watchEffect } from 'vue';
|
||||||
|
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value']);
|
||||||
@ -57,6 +63,12 @@ const props = defineProps({
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
prop: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return { label: 'label', value: 'value' };
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const _numberSet = ref({
|
const _numberSet = ref({
|
||||||
precision: 2,
|
precision: 2,
|
||||||
@ -71,7 +83,9 @@ const data = ref({
|
|||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
data.value = Object.assign(data.value, props.value);
|
data.value = Object.assign(data.value, props.value);
|
||||||
_numberSet.value = Object.assign(_numberSet.value, props.numberSet);
|
_numberSet.value = Object.assign(_numberSet.value, props.numberSet);
|
||||||
console.log('_numberSet.value', _numberSet.value);
|
if (data.value.num === null) {
|
||||||
|
data.value.num = _numberSet.value.min;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
function handleChange() {
|
function handleChange() {
|
||||||
emit('update:value', data.value);
|
emit('update:value', data.value);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<avue-crud
|
<avue-crud
|
||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:option="option"
|
:option="option"
|
||||||
:loading="_loading"
|
:loading="_loading"
|
||||||
@search-change="
|
@search-change="
|
||||||
@ -20,8 +20,8 @@
|
|||||||
@row-save="handleRowSave"
|
@row-save="handleRowSave"
|
||||||
@row-update="handleRowUpdate"
|
@row-update="handleRowUpdate"
|
||||||
>
|
>
|
||||||
<template #menu="{ row }">
|
<template #menu="scope">
|
||||||
<el-button type="primary">详情</el-button>
|
<custom-table-operate :actions="actions" :data="scope" />
|
||||||
</template>
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
</section>
|
</section>
|
||||||
@ -29,8 +29,10 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
import { CRUD_OPTIONS } from '@/config';
|
import { CRUD_OPTIONS, pageData } from '@/config';
|
||||||
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
|
|
||||||
|
const { getEnterpriseDealerCheck, addEnterpriseDealerCheck, delEnterpriseDealerCheck, editEnterpriseDealerCheck } = inputSuppliesApi;
|
||||||
onMounted(getData);
|
onMounted(getData);
|
||||||
|
|
||||||
/* --------------- data --------------- */
|
/* --------------- data --------------- */
|
||||||
@ -40,12 +42,7 @@ const _loading = ref(false);
|
|||||||
const searchCondition = ref({
|
const searchCondition = ref({
|
||||||
keywords: '',
|
keywords: '',
|
||||||
});
|
});
|
||||||
const pageData = ref({
|
const tableData = ref([]);
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
total: 0,
|
|
||||||
});
|
|
||||||
const data = ref([]);
|
|
||||||
const option = reactive({
|
const option = reactive({
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
selection: false,
|
selection: false,
|
||||||
@ -138,6 +135,24 @@ const option = reactive({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
const actions = reactive([
|
||||||
|
{
|
||||||
|
name: '详情',
|
||||||
|
icon: 'view',
|
||||||
|
event: ({ row }) => row,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => row,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => row,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
@ -146,26 +161,20 @@ const option = reactive({
|
|||||||
async function getData(resetPage) {
|
async function getData(resetPage) {
|
||||||
resetPage === 1 && (pageData.value.currentPage = 1);
|
resetPage === 1 && (pageData.value.currentPage = 1);
|
||||||
_loading.value = true;
|
_loading.value = true;
|
||||||
let params = Object.assign(
|
let params = {
|
||||||
{
|
currentPage: pageData.value.currentPage,
|
||||||
currentPage: pageData.value.currentPage,
|
size: pageData.value.pageSize,
|
||||||
size: pageData.value.pageSize,
|
companyName: searchCondition.value.keywords,
|
||||||
},
|
};
|
||||||
searchCondition.value
|
|
||||||
);
|
let res = await getEnterpriseDealerCheck(params);
|
||||||
console.log('params', params);
|
if (res.code == 200) {
|
||||||
for (let i = 0; i < 14; i++) {
|
tableData.value = res.data.records;
|
||||||
data.value.push({
|
pageData.value.total = res.data.total;
|
||||||
taskNum: '20220101' + `${i}${i}${i}${i}${i}`,
|
|
||||||
taskType: i % 2 == 0 ? '0' : '1',
|
|
||||||
enterpriseName: '上海XX有限公司',
|
|
||||||
enterpriseOwner: '张三',
|
|
||||||
phone: '123456789',
|
|
||||||
status: i % 2 == 0 ? '0' : '1',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
pageData.value.total = data.value.length;
|
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
|
console.log('params', params);
|
||||||
|
pageData.value.total = tableData.value.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRowSave(row, done, loading) {
|
function handleRowSave(row, done, loading) {
|
||||||
|
@ -81,7 +81,7 @@ export function useBasicInfo(set = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 获取标签的名字 */
|
/* 获取标签的名字 */
|
||||||
function targetName(arr, ids, _name) {
|
function targetName(arr, ids, _name = '') {
|
||||||
let name = '';
|
let name = '';
|
||||||
if (!arr || !arr.length || ids.length < 1) {
|
if (!arr || !arr.length || ids.length < 1) {
|
||||||
return name;
|
return name;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
ref="crudRef"
|
ref="crudRef"
|
||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:option="option"
|
:option="option"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:before-close="handleDialogClose"
|
:before-close="handleDialogClose"
|
||||||
@ -55,7 +55,7 @@ const pageData = ref({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
const data = ref([]);
|
const tableData = ref([]);
|
||||||
const option = reactive({
|
const option = reactive({
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
selection: false,
|
selection: false,
|
||||||
@ -195,7 +195,7 @@ async function getData(resetPage) {
|
|||||||
let res = await inputSuppliesApi.getLeaseSuperviseList(params);
|
let res = await inputSuppliesApi.getLeaseSuperviseList(params);
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
data.value = res.data.records.map((v) => {
|
tableData.value = res.data.records.map((v) => {
|
||||||
let d = leaseDate(v.startEndTime);
|
let d = leaseDate(v.startEndTime);
|
||||||
let obj = {
|
let obj = {
|
||||||
...v,
|
...v,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:before-close="handleCloseDialog"
|
:before-close="handleCloseDialog"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:option="option"
|
:option="option"
|
||||||
@search-change="
|
@search-change="
|
||||||
(form, done) => {
|
(form, done) => {
|
||||||
@ -140,7 +140,7 @@ const subsidy = reactive([
|
|||||||
value: '0',
|
value: '0',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const data = ref([{}]);
|
const tableData = ref([{}]);
|
||||||
const option = ref({
|
const option = ref({
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
dialogWidth: '50%',
|
dialogWidth: '50%',
|
||||||
@ -441,7 +441,7 @@ async function getData(reset) {
|
|||||||
let res = await getMachineryList(params);
|
let res = await getMachineryList(params);
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
data.value = res.data.records;
|
tableData.value = res.data.records;
|
||||||
pageData.value.total = res.data.total;
|
pageData.value.total = res.data.total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
ref="crud"
|
ref="crud"
|
||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:option="option"
|
:option="option"
|
||||||
:before-close="handleCloseDialog"
|
:before-close="handleCloseDialog"
|
||||||
@ -85,7 +85,7 @@ watch(
|
|||||||
|
|
||||||
const crud = ref();
|
const crud = ref();
|
||||||
const _loading = ref(false);
|
const _loading = ref(false);
|
||||||
const data = ref([]);
|
const tableData = ref([]);
|
||||||
const searchCondition = ref({
|
const searchCondition = ref({
|
||||||
keywords: '',
|
keywords: '',
|
||||||
});
|
});
|
||||||
@ -236,7 +236,7 @@ async function getData(reset) {
|
|||||||
let res = await getFertilizreList(params);
|
let res = await getFertilizreList(params);
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
data.value = res.data.records.map((v) => {
|
tableData.value = res.data.records.map((v) => {
|
||||||
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
|
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
|
||||||
v.suggest = handleNumUnit({ unit1: v.productUnit, num2: v.suggestDosage, unit2: v.suggestUnit, type: -1 });
|
v.suggest = handleNumUnit({ unit1: v.productUnit, num2: v.suggestDosage, unit2: v.suggestUnit, type: -1 });
|
||||||
v.produceDosage = handleShowName(v.produceDosage);
|
v.produceDosage = handleShowName(v.produceDosage);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:option="option"
|
:option="option"
|
||||||
:before-close="handleCloseDialog"
|
:before-close="handleCloseDialog"
|
||||||
@search-change="
|
@search-change="
|
||||||
@ -63,7 +63,7 @@ import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
|
|||||||
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
|
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
|
||||||
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
|
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
|
||||||
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn';
|
import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn';
|
||||||
const { deleteFn } = new assistFn();
|
const { deleteFn } = new assistFn();
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ const searchCondition = ref({
|
|||||||
});
|
});
|
||||||
const crud = ref();
|
const crud = ref();
|
||||||
const _loading = ref(true);
|
const _loading = ref(true);
|
||||||
const data = ref([]);
|
const tableData = ref([]);
|
||||||
const pageData = ref({
|
const pageData = ref({
|
||||||
total: 0,
|
total: 0,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -456,8 +456,8 @@ async function getData(reset) {
|
|||||||
console.log('res --- ', res);
|
console.log('res --- ', res);
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
if (res && res.code === 200) {
|
if (res && res.code === 200) {
|
||||||
data.value = res.data.records;
|
tableData.value = res.data.records;
|
||||||
data.value.forEach((v) => {
|
tableData.value.forEach((v) => {
|
||||||
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
|
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
|
||||||
v.dosage = handleNumUnit({ unit1: v.productUnit, num2: v.suggestDosage, unit2: v.suggestUnit, type: -1 });
|
v.dosage = handleNumUnit({ unit1: v.productUnit, num2: v.suggestDosage, unit2: v.suggestUnit, type: -1 });
|
||||||
v.targetPests = handleShowName(v.targetPests);
|
v.targetPests = handleShowName(v.targetPests);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:option="option"
|
:option="option"
|
||||||
:before-close="handleCloseDialog"
|
:before-close="handleCloseDialog"
|
||||||
@search-change="
|
@search-change="
|
||||||
@ -68,7 +68,7 @@ const searchCondition = ref({
|
|||||||
});
|
});
|
||||||
const crud = ref();
|
const crud = ref();
|
||||||
const _loading = ref(true);
|
const _loading = ref(true);
|
||||||
const data = ref([]);
|
const tableData = ref([]);
|
||||||
const pageData = ref({
|
const pageData = ref({
|
||||||
total: 0,
|
total: 0,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -229,8 +229,8 @@ async function getData(reset) {
|
|||||||
let res = await getAnimalMedicineList(params);
|
let res = await getAnimalMedicineList(params);
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
if (res && res.code === 200) {
|
if (res && res.code === 200) {
|
||||||
data.value = res.data.records;
|
tableData.value = res.data.records;
|
||||||
data.value.forEach((v) => {
|
tableData.value.forEach((v) => {
|
||||||
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
|
v.productSpecification = handleNumUnit({ num1: v.productSpecification, unit1: v.productUnit, type: 1 });
|
||||||
v.produceDosage = handleShowName(v.produceDosage);
|
v.produceDosage = handleShowName(v.produceDosage);
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:before-close="handleCloseDialog"
|
:before-close="handleCloseDialog"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:option="option"
|
:option="option"
|
||||||
@search-change="
|
@search-change="
|
||||||
(form, done) => {
|
(form, done) => {
|
||||||
@ -72,7 +72,7 @@ const _loading = ref(true);
|
|||||||
const searchCondition = ref({
|
const searchCondition = ref({
|
||||||
keywords: '',
|
keywords: '',
|
||||||
});
|
});
|
||||||
const data = ref([]);
|
const tableData = ref([]);
|
||||||
const option = ref({
|
const option = ref({
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
selection: false,
|
selection: false,
|
||||||
@ -191,7 +191,7 @@ async function getData(reset) {
|
|||||||
if (_type.value != '0') params['classifyId'] = _type.value;
|
if (_type.value != '0') params['classifyId'] = _type.value;
|
||||||
let res = await getSeedList(params);
|
let res = await getSeedList(params);
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
data.value = res.data.records ?? [];
|
tableData.value = res.data.records ?? [];
|
||||||
pageData.value.total = res.data.total;
|
pageData.value.total = res.data.total;
|
||||||
}
|
}
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section class="custom-page">
|
|
||||||
<!-- <section style="width: 600px; height: 400px">
|
|
||||||
<custom-rich-editor />
|
|
||||||
</section> -->
|
|
||||||
<avue-crud
|
|
||||||
ref="curdRef"
|
|
||||||
v-model:page="pageData"
|
|
||||||
:data="data"
|
|
||||||
:before-close="handleDialogClose"
|
|
||||||
:option="option"
|
|
||||||
:table-loading="_loading"
|
|
||||||
@search-change="handleSearch"
|
|
||||||
@search-reset="handleSearchReset"
|
|
||||||
@current-change="handleCurrentChange"
|
|
||||||
@size-change="handleSizeChange"
|
|
||||||
@row-save="handleRowSave"
|
|
||||||
@row-update="handleRowUpdate"
|
|
||||||
>
|
|
||||||
<template #menu="scope">
|
|
||||||
<custom-table-operate :actions="actions" :data="scope" />
|
|
||||||
</template>
|
|
||||||
</avue-crud>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
import { useMaterialHook } from './useMaterialHook';
|
|
||||||
|
|
||||||
const {
|
|
||||||
curdRef,
|
|
||||||
_loading,
|
|
||||||
data,
|
|
||||||
pageData,
|
|
||||||
option,
|
|
||||||
actions,
|
|
||||||
handleDialogClose,
|
|
||||||
handleSearch,
|
|
||||||
handleRowSave,
|
|
||||||
handleRowUpdate,
|
|
||||||
handleSearchReset,
|
|
||||||
handleCurrentChange,
|
|
||||||
handleSizeChange,
|
|
||||||
} = useMaterialHook();
|
|
||||||
/* --------------- data --------------- */
|
|
||||||
// #region
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
/* --------------- methods --------------- */
|
|
||||||
// #region
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
|
@ -1,197 +0,0 @@
|
|||||||
import { ref, reactive, onMounted } from 'vue';
|
|
||||||
import { CRUD_OPTIONS } from '@/config';
|
|
||||||
import inputSuppliesApis from '@/apis/inputSuppliesApi';
|
|
||||||
const { getMaterailTypes } = inputSuppliesApis;
|
|
||||||
export const useMaterialHook = () => {
|
|
||||||
onMounted(() => {
|
|
||||||
getData();
|
|
||||||
getTypes();
|
|
||||||
});
|
|
||||||
/* ------ data ------ */
|
|
||||||
// #region
|
|
||||||
const currentType = ref('0');
|
|
||||||
const curdRef = ref();
|
|
||||||
const _loading = ref(false);
|
|
||||||
const materialTypes = reactive([
|
|
||||||
{
|
|
||||||
id: '0',
|
|
||||||
dataName: '全部',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const pageData = ref({
|
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
total: 0,
|
|
||||||
});
|
|
||||||
const testData = reactive([
|
|
||||||
{ type: '1', id: 1, name: '物资1', producer: '生产厂家1', dealer: '经销商1' },
|
|
||||||
{ type: '2', id: 2, name: '物资2', producer: '生产厂家2', dealer: '经销商2' },
|
|
||||||
{ type: '3', id: 3, name: '物资3', producer: '生产厂家3', dealer: '经销商3' },
|
|
||||||
{ type: '4', id: 4, name: '物资4', producer: '生产厂家4', dealer: '经销商4' },
|
|
||||||
{ type: '5', id: 4, name: '物资4', producer: '生产厂家4', dealer: '经销商4' },
|
|
||||||
]);
|
|
||||||
const data = ref([]);
|
|
||||||
const option = reactive({
|
|
||||||
...CRUD_OPTIONS,
|
|
||||||
selection: false,
|
|
||||||
column: [
|
|
||||||
{
|
|
||||||
label: '物资类型',
|
|
||||||
prop: 'materailType',
|
|
||||||
hide: false,
|
|
||||||
search: true,
|
|
||||||
type: 'cascader',
|
|
||||||
dicData: materialTypes,
|
|
||||||
checkStrictly: true,
|
|
||||||
props: {
|
|
||||||
value: 'id',
|
|
||||||
label: 'dataName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '物资编号',
|
|
||||||
prop: 'id',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '物资编号',
|
|
||||||
prop: 'name',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '生产厂家',
|
|
||||||
prop: 'producer',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '经销商',
|
|
||||||
prop: 'dealer',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// label: '物资编号',
|
|
||||||
// prop: '',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: '物资编号',
|
|
||||||
// prop: 'id',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: '物资编号',
|
|
||||||
// prop: 'id',
|
|
||||||
// },
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const actions = reactive([
|
|
||||||
{
|
|
||||||
auth: ({ row }) => row.type == '1',
|
|
||||||
name: 'custom',
|
|
||||||
icon: 'edit',
|
|
||||||
event: handleCustomFn,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '编辑',
|
|
||||||
icon: 'edit',
|
|
||||||
event: handleEdit,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'danger',
|
|
||||||
name: '删除',
|
|
||||||
icon: 'delete',
|
|
||||||
event: handleDel,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
/* ------ methods ------ */
|
|
||||||
// #region
|
|
||||||
async function getTypes() {
|
|
||||||
let res = await getMaterailTypes();
|
|
||||||
if (res.code == 200) {
|
|
||||||
materialTypes.push(...res.data);
|
|
||||||
console.log('types', materialTypes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getData() {
|
|
||||||
let params = {
|
|
||||||
currentPage: pageData.value.currentPage,
|
|
||||||
pageSize: pageData.value.pageSize,
|
|
||||||
type: currentType.value,
|
|
||||||
};
|
|
||||||
console.log('get params -- ', params);
|
|
||||||
if (currentType.value == '0') {
|
|
||||||
data.value = testData.map((v) => v);
|
|
||||||
} else {
|
|
||||||
data.value = testData.filter((item) => item.type == currentType.value);
|
|
||||||
}
|
|
||||||
console.log('data', data.value);
|
|
||||||
}
|
|
||||||
function handleSearch(form, done) {
|
|
||||||
if (!form.materailType || !form.materailType.length) {
|
|
||||||
currentType.value = '0';
|
|
||||||
} else {
|
|
||||||
currentType.value = form.materailType[0];
|
|
||||||
}
|
|
||||||
console.log('search --- ', form);
|
|
||||||
getData();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
function handleSearchReset() {
|
|
||||||
resetPage();
|
|
||||||
}
|
|
||||||
async function handleDialogClose(done) {
|
|
||||||
done();
|
|
||||||
console.log('dialog close');
|
|
||||||
}
|
|
||||||
/* 新建行数据 */
|
|
||||||
async function handleRowSave(form, done, loading) {
|
|
||||||
console.log('save', form);
|
|
||||||
loading();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* */
|
|
||||||
function handleCustomFn({ row }) {
|
|
||||||
console.log('custom', row);
|
|
||||||
}
|
|
||||||
/* 行编辑 */
|
|
||||||
function handleEdit({ row }) {
|
|
||||||
console.log('edit', row);
|
|
||||||
}
|
|
||||||
/* 更新行数据 */
|
|
||||||
async function handleRowUpdate(form, done, loading) {
|
|
||||||
console.log('update', form);
|
|
||||||
loading();
|
|
||||||
}
|
|
||||||
/* 行删除 */
|
|
||||||
function handleDel({ row }) {
|
|
||||||
console.log('del', row);
|
|
||||||
}
|
|
||||||
function handleCurrentChange(val) {
|
|
||||||
pageData.value.currentPage = val;
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
function handleSizeChange(val) {
|
|
||||||
pageData.value.currentPage = 1;
|
|
||||||
pageData.value.size = val;
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
function resetPage() {
|
|
||||||
currentType.value = '0';
|
|
||||||
pageData.value.currentPage = 1;
|
|
||||||
pageData.value.pageSize = 10;
|
|
||||||
getData();
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
return {
|
|
||||||
curdRef,
|
|
||||||
_loading,
|
|
||||||
data,
|
|
||||||
pageData,
|
|
||||||
option,
|
|
||||||
actions,
|
|
||||||
handleSearch,
|
|
||||||
handleDialogClose,
|
|
||||||
handleRowSave,
|
|
||||||
handleRowUpdate,
|
|
||||||
handleSearchReset,
|
|
||||||
handleCurrentChange,
|
|
||||||
handleSizeChange,
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="custom-page">巡查与案件 </section>
|
<section class="custom-page">巡查与案件</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
v-model:search="searchCondition"
|
v-model:search="searchCondition"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
:option="option"
|
:option="option"
|
||||||
:before-close="
|
:before-close="
|
||||||
(done) => {
|
(done) => {
|
||||||
@ -68,7 +68,7 @@ const searchCondition = ref({
|
|||||||
_dealerType: '',
|
_dealerType: '',
|
||||||
keywords: '',
|
keywords: '',
|
||||||
});
|
});
|
||||||
const data = ref([{}]);
|
const tableData = ref([{}]);
|
||||||
const option = reactive({
|
const option = reactive({
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
dialogWidth: '50%',
|
dialogWidth: '50%',
|
||||||
@ -339,7 +339,7 @@ async function getData(reset) {
|
|||||||
};
|
};
|
||||||
let res = await getProductionDealerList(params);
|
let res = await getProductionDealerList(params);
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
data.value = res.data.records;
|
tableData.value = res.data.records;
|
||||||
pageData.value.total = res.data.total;
|
pageData.value.total = res.data.total;
|
||||||
}
|
}
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
v-model:page="pageData"
|
v-model:page="pageData"
|
||||||
:table-loading="_loading"
|
:table-loading="_loading"
|
||||||
:option="option"
|
:option="option"
|
||||||
:data="data"
|
:data="tableData"
|
||||||
|
:before-close="(done) => (handleOtherInfo(), done())"
|
||||||
@search-change="
|
@search-change="
|
||||||
(form, done) => {
|
(form, done) => {
|
||||||
getData(1);
|
getData(1);
|
||||||
@ -23,35 +24,58 @@
|
|||||||
<!-- <template #land-form="{ type }">
|
<!-- <template #land-form="{ type }">
|
||||||
<section if="type == 'add'">地块</section>
|
<section if="type == 'add'">地块</section>
|
||||||
</template> -->
|
</template> -->
|
||||||
<template #report-form="type">
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
<template #report-form="{ type }">
|
||||||
<Attrs v-model:attrs="attrs" :type="type" />
|
<Attrs v-model:attrs="attrs" :type="type" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #buyNumber-form="{ type }">
|
||||||
|
<NumberSelect v-if="type != 'view'" v-model:value="buyNumber" :options="useNumberOptions" :prop="useNumebrProp" />
|
||||||
|
<span v-else>{{ buyNumber + buyUnit }}</span>
|
||||||
|
</template>
|
||||||
|
<template #useNumber-form="{ type }">
|
||||||
|
<NumberSelect v-if="type != 'view'" v-model:value="useNumber" :options="useNumberOptions" :prop="useNumebrProp" />
|
||||||
|
<span v-else>{{ useNumber + useUnit }}</span>
|
||||||
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, watch, onMounted } from 'vue';
|
import { reactive, ref, onMounted } from 'vue';
|
||||||
import { CRUD_OPTIONS, pageData, customRules } from '@/config';
|
import { CRUD_OPTIONS, pageData, customRules } from '@/config';
|
||||||
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
|
import { useBasicInfo } from '@/views/inputSuppliesManage/hooks/useBasicInfo';
|
||||||
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn';
|
import assistFn from '@/views/inputSuppliesManage/hooks/useAssistFn';
|
||||||
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
|
import Attrs from '@/views/inputSuppliesManage/common/Attrs.vue';
|
||||||
const { deleteFn } = new assistFn();
|
import { ElMessage } from 'element-plus';
|
||||||
const { getUseSuperviseList, delUseSupdervise, addUseSupdervise, editUseSupdervise } = inputSuppliesApi;
|
import { GetEntityList } from '@/apis/system/dict';
|
||||||
const { loadFinish, materialTypes } = useBasicInfo();
|
import NumberSelect from '@/views/inputSuppliesManage/common/NumberSelect.vue';
|
||||||
|
|
||||||
watch(
|
const { deleteFn } = new assistFn();
|
||||||
() => loadFinish.value,
|
const { getUseSuperviseList, delUseSupervise, addUseSupervise, editUseSupervise } = inputSuppliesApi;
|
||||||
(bol) => {
|
const { materialTypes, targetName } = useBasicInfo();
|
||||||
if (loadFinish.value) {
|
|
||||||
console.log('material', materialTypes);
|
onMounted(() => {
|
||||||
}
|
getData();
|
||||||
}
|
getUseNumberDict();
|
||||||
);
|
});
|
||||||
onMounted(getData);
|
/* --------------- tableData --------------- */
|
||||||
/* --------------- data --------------- */
|
|
||||||
// #region
|
// #region
|
||||||
|
const useNumebrProp = reactive({
|
||||||
|
label: 'dictLabel',
|
||||||
|
value: 'dictValue',
|
||||||
|
});
|
||||||
|
const useNumberOptions = ref([]);
|
||||||
|
const buyNumber = ref({
|
||||||
|
num: 1,
|
||||||
|
type: '1',
|
||||||
|
});
|
||||||
|
const useNumber = ref({
|
||||||
|
num: 1,
|
||||||
|
type: '1',
|
||||||
|
});
|
||||||
const crudRef = ref(null);
|
const crudRef = ref(null);
|
||||||
const _loading = ref(true);
|
const _loading = ref(true);
|
||||||
const searchCondition = ref({
|
const searchCondition = ref({
|
||||||
@ -63,7 +87,7 @@ const types = reactive([
|
|||||||
{ label: '肥料监管', value: '2' },
|
{ label: '肥料监管', value: '2' },
|
||||||
{ label: '兽药监管', value: '3' },
|
{ label: '兽药监管', value: '3' },
|
||||||
]);
|
]);
|
||||||
const data = ref([{}]);
|
const tableData = ref([{}]);
|
||||||
const option = ref({
|
const option = ref({
|
||||||
...CRUD_OPTIONS,
|
...CRUD_OPTIONS,
|
||||||
selection: false,
|
selection: false,
|
||||||
@ -96,63 +120,78 @@ const option = ref({
|
|||||||
clearable: false,
|
clearable: false,
|
||||||
value: '1',
|
value: '1',
|
||||||
change: handleTypeChange,
|
change: handleTypeChange,
|
||||||
|
width: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '名称',
|
label: '使用者名称',
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
|
width: 240,
|
||||||
rules: customRules({ msg: '请输入名称' }),
|
rules: customRules({ msg: '请输入名称' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '联系方式',
|
label: '联系方式',
|
||||||
prop: 'phone',
|
prop: 'phone',
|
||||||
|
width: 120,
|
||||||
rules: customRules({ msg: '请输入联系方式' }),
|
rules: customRules({ msg: '请输入联系方式' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '投入品名称',
|
label: '投入品名称',
|
||||||
prop: 'inputName',
|
prop: 'inputName',
|
||||||
|
width: 240,
|
||||||
rules: customRules({ msg: '请输入投入品名称' }),
|
rules: customRules({ msg: '请输入投入品名称' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
hide: true,
|
||||||
label: '分类',
|
label: '分类',
|
||||||
prop: 'classifyId',
|
prop: '_classifyId',
|
||||||
type: 'cascader',
|
type: 'cascader',
|
||||||
dicData: [],
|
dicData: [],
|
||||||
|
value: [],
|
||||||
rules: customRules({ msg: '请选择分类' }),
|
rules: customRules({ msg: '请选择分类' }),
|
||||||
|
viewDisplay: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '分类',
|
||||||
|
prop: 'classifyName',
|
||||||
|
width: 200,
|
||||||
|
overHidden: true,
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '购买量',
|
label: '购买量',
|
||||||
prop: 'buyNumber',
|
prop: 'buyNumber',
|
||||||
rules: customRules({ msg: '请输入购买量' }),
|
render: ({ row }) => row.buyNumber + row.buyUnit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '购买时间',
|
label: '购买时间',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
valueFormat: 'YYYY-MM-DD',
|
valueFormat: 'YYYY-MM-DD',
|
||||||
|
width: 140,
|
||||||
prop: 'buyTime',
|
prop: 'buyTime',
|
||||||
rules: customRules({ msg: '请选择购买时间' }),
|
rules: customRules({ msg: '请选择购买时间' }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '使用量',
|
label: '使用量',
|
||||||
prop: 'useNumber',
|
prop: 'useNumber',
|
||||||
rules: customRules({ msg: '请输入使用量' }),
|
render: ({ row }) => row.useNumber + row.useUnit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '使用时间',
|
label: '使用时间',
|
||||||
|
type: 'date',
|
||||||
|
width: 140,
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
valueFormat: 'YYYY-MM-DD',
|
valueFormat: 'YYYY-MM-DD',
|
||||||
prop: 'useTime',
|
prop: 'useTime',
|
||||||
rules: customRules({ msg: '请选择使用时间' }),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '使用对象',
|
label: '使用对象',
|
||||||
prop: 'useObject',
|
prop: 'useObject',
|
||||||
rules: customRules({ msg: '请输入使用对象' }),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '关联地块',
|
label: '关联地块',
|
||||||
prop: 'landName',
|
prop: 'landName',
|
||||||
rules: customRules({ msg: '请输入地块名称' }),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
group: [
|
group: [
|
||||||
@ -166,12 +205,23 @@ const option = ref({
|
|||||||
label: '检测时间',
|
label: '检测时间',
|
||||||
prop: 'detectionTime',
|
prop: 'detectionTime',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
valueFormat: 'yyyy-MM-dd',
|
valueFormat: 'YYYY-MM-DD',
|
||||||
format: 'yyyy-MM-dd',
|
format: 'YYYY-MM-DD',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '检测结果',
|
label: '检测结果',
|
||||||
prop: 'detectionResult',
|
prop: 'detectionResult',
|
||||||
|
type: 'select',
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: '合格',
|
||||||
|
value: '0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '不合格',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '投入品名称',
|
label: '投入品名称',
|
||||||
@ -186,14 +236,50 @@ const option = ref({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
const attrs = ref([]);
|
const attrs = ref([]);
|
||||||
|
const actions = reactive([
|
||||||
|
{
|
||||||
|
name: '详情',
|
||||||
|
icon: 'view',
|
||||||
|
event: ({ row }) => {
|
||||||
|
handleOtherInfo(row);
|
||||||
|
crudRef.value.rowView(row);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => {
|
||||||
|
handleOtherInfo(row);
|
||||||
|
crudRef.value.rowEdit(row);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => deleteFn(row.id, delUseSupervise, getData),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const typeDictData = ref([]);
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
/* --------------- methods --------------- */
|
/* --------------- methods --------------- */
|
||||||
// #region
|
// #region
|
||||||
async function getData(reset = 1) {
|
async function getUseNumberDict() {
|
||||||
|
let res = await GetEntityList({
|
||||||
|
dictType: 'sys_use_supervise_number',
|
||||||
|
current: 1,
|
||||||
|
size: 1000,
|
||||||
|
});
|
||||||
|
useNumberOptions.value = res?.data?.records ?? [];
|
||||||
|
if (useNumberOptions.value.length) {
|
||||||
|
buyNumber.value.type = useNumberOptions.value[0].dictValue;
|
||||||
|
useNumber.value.type = useNumberOptions.value[0].dictValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function getData(reset = 0) {
|
||||||
_loading.value = true;
|
_loading.value = true;
|
||||||
reset == 1 && (pageData.value.currentPage = 1);
|
reset === 1 && (pageData.value.currentPage = 1);
|
||||||
console.log('get data');
|
|
||||||
let res = await getUseSuperviseList({
|
let res = await getUseSuperviseList({
|
||||||
current: pageData.value.currentPage,
|
current: pageData.value.currentPage,
|
||||||
size: pageData.value.pageSize,
|
size: pageData.value.pageSize,
|
||||||
@ -202,31 +288,84 @@ async function getData(reset = 1) {
|
|||||||
});
|
});
|
||||||
_loading.value = false;
|
_loading.value = false;
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
data.value = res.data.records;
|
tableData.value = res.data.records.map((v) => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
_classifyId: v.classifyId.split(','),
|
||||||
|
};
|
||||||
|
});
|
||||||
pageData.value.total = res.data.total;
|
pageData.value.total = res.data.total;
|
||||||
console.log('res', res);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handleTypeChange(val) {
|
function handleTypeChange(val) {
|
||||||
console.log(
|
option.value.group[0].addDisplay = val.value == '1';
|
||||||
'dicData',
|
option.value.group[0].editDisplay = val.value == '1';
|
||||||
materialTypes[val.value].filter((v) => v.value != '0')
|
option.value.group[0].viewDisplay = val.value == '1';
|
||||||
);
|
typeDictData.value = materialTypes[val.value].filter((v) => v.value != '0') || [];
|
||||||
option.value.column[6].dicData = materialTypes[val.value].filter((v) => v.value != '0');
|
option.value.column[6].dicData = typeDictData.value;
|
||||||
}
|
}
|
||||||
function handleData(val) {
|
function handleData(val) {
|
||||||
console.log('handleData', val);
|
let _data = Object.assign({}, val);
|
||||||
|
_data.buyNumber = buyNumber.value.num;
|
||||||
|
_data.buyUnit = buyNumber.value.type;
|
||||||
|
_data.useNumber = useNumber.value.num;
|
||||||
|
_data.useUnit = useNumber.value.type;
|
||||||
|
_data.classifyId = val._classifyId.join();
|
||||||
|
_data.classifyName = targetName(typeDictData.value, val._classifyId);
|
||||||
|
if (attrs.value.length) {
|
||||||
|
_data.detectionReport = attrs.value.map((v) => v.url).join();
|
||||||
|
}
|
||||||
|
delete _data.keywords;
|
||||||
|
delete _data.searchType;
|
||||||
|
delete _data._classifyId;
|
||||||
|
return _data;
|
||||||
}
|
}
|
||||||
function handleRowSave(row, done, laoding) {
|
async function handleRowSave(row, done, loading) {
|
||||||
handleData(row);
|
let data = handleData(row);
|
||||||
laoding();
|
let res = await addUseSupervise(data);
|
||||||
}
|
|
||||||
|
|
||||||
function handleRowUpdate(row, index, done, loading) {
|
|
||||||
handleData(row);
|
|
||||||
loading();
|
loading();
|
||||||
|
if (res.code == 200) {
|
||||||
|
ElMessage.success('保存成功');
|
||||||
|
getData();
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function handleRowUpdate(row, index, done, loading) {
|
||||||
|
let data = handleData(row);
|
||||||
|
let res = await editUseSupervise(data);
|
||||||
|
loading();
|
||||||
|
if (res.code == 200) {
|
||||||
|
ElMessage.success('保存成功');
|
||||||
|
getData();
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleOtherInfo(obj = {}) {
|
||||||
|
if (!Object.keys(obj).length) {
|
||||||
|
attrs.value = [];
|
||||||
|
buyNumber.value = { num: 1, type: useNumberOptions.value?.[0].dictValue ?? '1' };
|
||||||
|
useNumber.value = { num: 1, type: useNumberOptions.value?.[0].dictValue ?? '1' };
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (obj.detectionReport) {
|
||||||
|
attrs.value = obj.detectionReport.split(',').map((v, i) => {
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
name: '检测报告' + i,
|
||||||
|
url: v,
|
||||||
|
uid: 'id_' + i + Date.now(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
buyNumber.value = {
|
||||||
|
num: +obj.buyNumber,
|
||||||
|
type: obj.buyUnit,
|
||||||
|
};
|
||||||
|
useNumber.value = {
|
||||||
|
num: +obj.useNumber,
|
||||||
|
type: obj.useUnit,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user