123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362 |
- <template>
- <div class="pageIndexClass">
- <div class="content">
- <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
- :statConfig="statConfig" :onMoreSearch="false" @moreSearch="clickMoreSearch" highlight-current-row :action-list="[
- {
- text: '新建销售合同',
- action: () => newContract(),
- },
- ]" @get-list="getList">
- <template #code="{ item }">
- <div style="width: 100%">
- <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="openDetails(item)">{{ item.code }}</a>
- </div>
- </template>
- <template #isSettled="{ item }">
- <div>
- <span style="padding: 4px" :class="[item.isSettled == 1 ? 'active' : '']">
- {{
- proxy.dictValueLabel(item.isSettled, isSettled)
- }}</span>
- </div>
- </template>
- <template #amount="{ item }">
- <div>
- <span style="padding-right: 4px">{{ item.currency }}</span>
- <span>{{ moneyFormat(item.amount, 2) }}</span>
- </div>
- </template>
- <template #buyCorporationName="{ item }">
- <div style="width: 100%">
- <a style="color: #409eff; cursor: pointer" @click="clickCorporationName(item)">{{ item.buyCorporationName }}</a>
- </div>
- </template>
- <template #prodTag="{ item }">
- <div style="width: 100%">
- <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.prodTags" closable :key="index"
- @close="prodTagClose(index, item)">
- {{ dictKeyValue(tag, contractTag) }}
- </el-tag>
- </div>
- </template>
- <template #tags="{ item }">
- <div style="width: 100%">
- <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.tags" closable :key="index" @close="tagClose(tag, item)">
- {{ dictValueLabel(tag, customerTag) }}
- </el-tag>
- <template v-if="item.tags.length !== customerTag.length">
- <el-select v-if="item.addTagShow" v-model="addTag" style="width: 100%" @change="
- (val) => {
- return changeTag(val, item);
- }
- ">
- <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value"
- :disabled="judgeTagSelect(item.tags, tag.value)" />
- </el-select>
- <el-tag style="cursor: pointer" type="success" @click="showSelect(item)" v-else>
- +
- </el-tag>
- </template>
- </div>
- </template>
- <template #advanceRatio="{ item }">
- <div>
- <span>{{ moneyFormat(item.advanceRatio, 2) }}%</span>
- </div>
- </template>
- <template #scale="{ item }">
- <div>
- {{ computeScale(item) }}
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="920">
- <ContractPDFOne :rowData="rowData"></ContractPDFOne>
- <!-- <ContractPDFOneNew :rowData="rowData" ref="PdfDom"></ContractPDFOneNew> -->
- <!-- <template #footer>
- <el-button @click="openPrint = false" size="default">取消</el-button>
- <el-button type="primary" v-print="printObj" size="default">打印</el-button>
- <el-button type="primary" @click="clickDownload()" size="default">下载PDF</el-button>
- <el-button type="primary" @click="exportExcel()" size="default">导出Excel</el-button>
- </template> -->
- </el-dialog>
- <el-dialog title="交接单" v-if="openHandoverSlip" v-model="openHandoverSlip" width="600">
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="handoverSlipForm">
- <template #file>
- <div style="width: 100%">
- <el-upload v-model:fileList="handoverSlipForm.fileList" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com" :data="uploadData"
- multiple :before-upload="uploadFile" :on-success="handleSuccess" :on-preview="onPreviewFile">
- <el-button type="primary" plain>选择</el-button>
- </el-upload>
- </div>
- </template>
- <template #indication>
- <div style="width: 100%">
- <el-upload v-model:fileList="handoverSlipForm.packageFileList" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :data="indicationUploadData" multiple :before-upload="indicationUploadFile" :on-success="handleSuccess"
- :on-preview="onPreviewFile">
- <el-button type="primary" plain>选择</el-button>
- </el-upload>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openHandoverSlip = false" size="default">关 闭</el-button>
- <el-button type="primary" @click="submitHandoverSlip()" size="default">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog title="合同详情" v-if="openDetailsDialog" v-model="openDetailsDialog" width="1100">
- <ContractDetails :contractId="currentContractId"></ContractDetails>
- </el-dialog>
- <el-dialog :title="`售后记录`" v-if="openRecords" v-model="openRecords" width="600">
- <div style="padding-left: 50px; margin-bottom: 20px">
- <el-button type="primary" plain @click="handleClickAddRecord()">添加记录</el-button>
- </div>
- <el-timeline>
- <el-timeline-item v-for="(activity, index) in recordsData" :key="index">
- <div style="
- width: 100%;
- display: flex;
- justify-content: space-between;
- color: #bfb9b9;
- ">
- <div>售后时间:{{ activity.documentaryTime }}</div>
- <div>{{ activity.userName }}</div>
- </div>
- <div style="width: 100%; margin-top: 8px">
- 售后记录:{{ activity.documentaryRemark }}
- </div>
- <div style="width: 100%; margin-top: 8px" v-if="activity.fileList && activity.fileList.length > 0">
- <div v-for="(item, index) in activity.fileList" :key="index">
- <div style="cursor: pointer; color: #409eff" @click="openFile(item)">
- {{ item.fileName }}
- </div>
- </div>
- </div>
- </el-timeline-item>
- </el-timeline>
- <template #footer>
- <el-button @click="openRecords = false" size="default">关 闭</el-button>
- </template>
- </el-dialog>
- <el-dialog :title="`添加售后记录`" v-if="openAddRecords" v-model="openAddRecords" width="600">
- <byForm :formConfig="recordsFormConfig" :formOption="formOption" v-model="formData.recordsFormData" :rules="recordsRules" ref="recordsForm"
- v-loading="formLoading">
- <template #file>
- <div style="width: 100%">
- <el-upload v-model:fileList="formData.recordsFormData.fileList" action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
- :data="uploadData" multiple :before-upload="uploadFile" :on-success="handleSuccess" :on-preview="onPreviewFile">
- <el-button type="primary" plain>选择</el-button>
- </el-upload>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openAddRecords = false" size="default">关 闭</el-button>
- <el-button type="primary" @click="submitRecords()" size="default">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog :title="'高级检索'" v-model="moreSearchDialog" width="500px" destroy-on-close>
- <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
- </byForm>
- <template #footer>
- <el-button @click="moreSearchReset" size="default">重置</el-button>
- <el-button @click="moreSearchQuery" type="primary" size="default" v-debounce>搜索</el-button>
- </template>
- </el-dialog>
- <el-dialog :title="'下发生产'" v-model="productionDialog" width="500px" destroy-on-close>
- <byForm :formConfig="productionFormConfig" :formOption="formOption" v-model="formData.data" :rules="productionRules" ref="productionFormDom"
- v-loading="formLoading">
- </byForm>
- <template #footer>
- <el-button @click="productionDialog =false" size="default">取 消</el-button>
- <el-button @click="submitProduction" type="primary" size="default" v-debounce>下 发</el-button>
- </template>
- </el-dialog>
- <el-dialog :title="'生产指示'" v-model="tagDialog" width="500px" destroy-on-close>
- <byForm :formConfig="tagFormConfig" :formOption="formOption" v-model="formData.tagData" :rules="tagRules" ref="tagFormDom"
- v-loading="formLoading">
- </byForm>
- <template #footer>
- <el-button @click="tagDialog =false" size="default" v-debounce>取 消</el-button>
- <el-button @click="submitTag" type="primary" size="default" v-debounce>提 交</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { computed, ref } from "vue";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import useUserStore from "@/store/modules/user";
- import { ElMessage, ElMessageBox } from "element-plus";
- import ContractDetails from "@/components/contractCom/contractDetails.vue";
- import ContractPDFOne from "@/components/PDF/contractPDFOne.vue";
- import ContractPDFOneNew from "@/components/PDF/contractPDFOneNew.vue";
- const route = useRoute();
- const contractTag = computed(
- () => proxy.useUserStore().allDict["contract_prod_tag"]
- );
- const { proxy } = getCurrentInstance();
- const accountCurrency = ref([]);
- const tradeMethods = ref([]);
- const corporationList = ref([]);
- const customerList = ref([]);
- const userList = ref([]);
- const companyData = ref([]);
- const isSettled = ref([
- {
- label: "已结清",
- value: "1",
- },
- {
- label: "未结清",
- value: "0",
- },
- ]);
- const shippingMethod = ref([]);
- const customerTag = ref([]);
- const openDetailsDialog = ref(false);
- const status = ref([
- {
- label: "草稿",
- value: 0,
- },
- {
- label: "审批中",
- value: 10,
- },
- {
- label: "驳回",
- value: 20,
- },
- {
- label: "审批通过",
- value: 30,
- },
- {
- label: "变更中",
- value: 60,
- },
- {
- label: "已变更",
- value: 70,
- },
- {
- label: "作废",
- value: 88,
- },
- {
- label: "终止",
- value: 99,
- },
- ]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- status: "",
- companyId: "",
- userId: "",
- isSettled: "",
- beginTime: "",
- endTime: "",
- },
- });
- const loading = ref(false);
- const selectConfig = computed(() => {
- return [
- {
- label: "审批状态",
- prop: "status",
- data: status.value,
- },
- {
- label: "归属公司",
- prop: "companyId",
- data: companyData.value,
- },
- {
- label: "业务员",
- prop: "userId",
- data: userList.value,
- },
- {
- label: "是否已结清",
- prop: "isSettled",
- data: isSettled.value,
- },
- {
- type: "time",
- label: "创建时间",
- placeholder: "开始日期",
- prop: "beginTime",
- placeholderOne: "结束日期",
- propOne: "endTime",
- },
- ];
- });
- const headerData = ref({});
- const statConfig = computed(() => [
- // {
- // label: "统计",
- // data: [
- // //一个卡牌多数据配置
- // {
- // label: "订单统计(CNY)",
- // type: 2,
- // data: [
- // {
- // label: "订单数",
- // num: headerData.value.count,
- // color: "#C280FF",
- // },
- // {
- // label: "客户数",
- // num: headerData.value.customerCount,
- // color: "#C280FF",
- // },
- // {
- // label: "订单金额",
- // num: proxy.moneyFormat(headerData.value.sumAmount, 2),
- // color: "#C280FF",
- // },
- // ],
- // },
- // {
- // label: "款项统计(CNY)",
- // type: 3,
- // data: [
- // {
- // label: "已收款",
- // num: proxy.moneyFormat(headerData.value.sumClaimMoney, 2),
- // color: "#FF9315",
- // },
- // {
- // label: "待收款",
- // num: proxy.moneyFormat(headerData.value.sumClaimMoneyOne, 2),
- // color: "#FF9315",
- // },
- // ],
- // },
- // ],
- // },
- ]);
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "合同号",
- slot: "code",
- width: 140,
- },
- },
- {
- attrs: {
- label: "归属公司",
- prop: "companyName",
- width: 120,
- },
- },
- {
- attrs: {
- label: "业务员",
- prop: "salesmanName",
- width: 100,
- },
- // render(type) {
- // return proxy.dictValueLabel(type, userList.value);
- // },
- },
- {
- attrs: {
- label: "下单时间",
- prop: "createTime",
- width: 160,
- },
- },
- {
- attrs: {
- label: "客户名称",
- slot: "buyCorporationName",
- "min-width": 180,
- },
- },
- // {
- // attrs: {
- // label: "客户标签",
- // slot: "tags",
- // width: 180,
- // },
- // },
- {
- attrs: {
- label: "是否已结清",
- slot: "isSettled",
- width: 100,
- },
- // render(type) {
- // return proxy.dictValueLabel(type, isSettled.value);
- // },
- },
- {
- attrs: {
- label: "预付比例",
- slot: "advanceRatio",
- width: 100,
- align: "right",
- },
- },
- {
- attrs: {
- label: "合同金额",
- slot: "amount",
- width: 140,
- align: "right",
- },
- },
- {
- attrs: {
- label: "汇率",
- prop: "rate",
- width: 80,
- align: "right",
- },
- render(rate) {
- return proxy.moneyFormat(rate, 4);
- },
- },
- // {
- // attrs: {
- // label: "合同金额(CNY)",
- // prop: "amountCNY",
- // width: 160,
- // align: "right",
- // },
- // render(amountCNY) {
- // return proxy.moneyFormat(amountCNY, 2);
- // },
- // },
- // {
- // attrs: {
- // label: "到账金额(CNY)",
- // prop: "sumClaimMoney",
- // width: 160,
- // align: "right",
- // },
- // render(sumClaimMoney) {
- // return proxy.moneyFormat(sumClaimMoney, 2);
- // },
- // },
- // {
- // attrs: {
- // label: "到账比例",
- // slot: "scale",
- // width: 100,
- // align: "right",
- // },
- // },
- {
- attrs: {
- label: "审批状态",
- prop: "status",
- width: 100,
- },
- render(type) {
- return proxy.dictValueLabel(type, status.value);
- },
- },
- {
- attrs: {
- label: "生产指示",
- slot: "prodTag",
- "min-width": 160,
- },
- },
- {
- attrs: {
- label: "操作",
- width: 200,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- // {
- // attrs: {
- // label: "交接单",
- // type: "primary",
- // text: true,
- // },
- // el: "button",
- // click() {
- // clickHandoverSlip(row);
- // },
- // },
- // row.status == 30
- // ? {
- // attrs: {
- // label: "变更",
- // type: "primary",
- // text: true,
- // },
- // el: "button",
- // click() {
- // clickAlteration(row);
- // },
- // }
- // : {},
- row.status == 30
- ? {
- attrs: {
- label: "下发生产",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickDistributeProduction(row);
- },
- }
- : {},
- {
- attrs: {
- label: "打印",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickPrint(row);
- },
- },
- {
- attrs: {
- label: "作废",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- ElMessageBox.confirm(
- "此操作将永久删除该数据, 是否继续?",
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- ).then(() => {
- proxy
- .post("/contract/edit", {
- id: row.id,
- status: 88,
- })
- .then(() => {
- ElMessage({
- message: "作废成功",
- type: "success",
- });
- getList();
- });
- });
- },
- },
- row.status == 30
- ? {
- attrs: {
- label: "结清",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- ElMessageBox.confirm("是否确认结清?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- proxy
- .post("/contract/settle", {
- id: row.id,
- })
- .then(() => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- getList();
- });
- });
- },
- }
- : {},
- {
- attrs: {
- label: "生产指示",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- handleEditTag(row);
- },
- },
- // {
- // attrs: {
- // label: "售后",
- // type: "primary",
- // text: true,
- // },
- // el: "button",
- // click() {
- // openRecords.value = true;
- // getRecordsData(row);
- // },
- // },
- ];
- },
- },
- ];
- });
- const getDict = () => {
- // proxy
- // .getDictOne([
- // "customer_tag",
- // "trade_mode",
- // "account_currency",
- // "shipping_method",
- // ])
- // .then((res) => {
- // customerTag.value = res["customer_tag"].map((x) => ({
- // label: x.dictValue,
- // value: x.dictKey,
- // }));
- // tradeMethods.value = res["trade_mode"].map((x) => ({
- // label: x.dictValue,
- // value: x.dictKey,
- // }));
- // accountCurrency.value = res["account_currency"].map((x) => ({
- // label: x.dictValue,
- // value: x.dictKey,
- // }));
- // shippingMethod.value = res["shipping_method"].map((x) => ({
- // label: x.dictValue,
- // value: x.dictKey,
- // }));
- // });
- // proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- // corporationList.value = res.rows.map((item) => {
- // return {
- // ...item,
- // label: item.name,
- // value: item.id,
- // };
- // });
- // });
- proxy
- .get("/tenantDept/list", {
- pageNum: 1,
- pageSize: 9999,
- keyword: "",
- tenantId: proxy.useUserStore().user.tenantId,
- type: 0,
- })
- .then((res) => {
- companyData.value = res.data.map((x) => ({
- ...x,
- label: x.deptName,
- value: x.deptId,
- }));
- });
- proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- customerList.value = res.rows.map((item) => {
- return {
- ...item,
- label: item.name,
- value: item.id,
- };
- });
- });
- proxy
- .get("/tenantUser/list", {
- pageNum: 1,
- pageSize: 10000,
- tenantId: useUserStore().user.tenantId,
- })
- .then((res) => {
- userList.value = res.rows.map((item) => {
- return {
- label: item.nickName,
- value: item.userId,
- };
- });
- });
- };
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy.post("/contract/page", sourceList.value.pagination).then((res) => {
- res.rows.forEach((x) => {
- // x.addTagShow = false;
- // if (x.tag) {
- // x.tags = x.tag.split(",");
- // } else {
- // x.tags = [];
- // }
- if (x.prodTag) {
- x.prodTags = x.prodTag.split(",");
- } else {
- x.prodTags = [];
- }
- });
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- proxy
- .post("/contract/getHeadStatistic", sourceList.value.pagination)
- .then((res) => {
- headerData.value = res;
- if (headerData.value) {
- headerData.value.sumClaimMoneyOne = parseFloat(
- Number(headerData.value.sumAmount) -
- Number(headerData.value.sumClaimMoney)
- ).toFixed(2);
- }
- });
- };
- getDict();
- if (route.query.code) {
- sourceList.value.pagination.keyword = route.query.code;
- }
- getList();
- const newContract = () => {
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "contract_flow",
- flowName: "销售合同审批流程",
- random: proxy.random(),
- },
- });
- };
- const openPrint = ref(false);
- const rowData = ref({});
- const clickPrint = (row) => {
- rowData.value = {
- id: row.id,
- };
- openPrint.value = true;
- };
- const clickDownload = () => {
- proxy.getPdf("外销合同PDF文件");
- };
- const openHandoverSlip = ref(false);
- const handoverSlipForm = ref({
- id: "",
- code: "",
- buyCorporationName: "",
- fileList: [],
- packageFileList: [],
- });
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const formConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "code",
- label: "合同编号",
- itemType: "text",
- disabled: true,
- },
- {
- type: "input",
- prop: "buyCorporationName",
- label: "客户名称",
- itemType: "text",
- disabled: true,
- },
- {
- type: "slot",
- slotName: "file",
- label: "交接单",
- },
- {
- type: "slot",
- slotName: "indication",
- label: "包装指示",
- },
- ];
- });
- const uploadData = ref({});
- const indicationUploadData = ref({});
- const clickHandoverSlip = (item) => {
- handoverSlipForm.value.id = item.id;
- handoverSlipForm.value.code = item.code;
- handoverSlipForm.value.buyCorporationName = item.buyCorporationName;
- if (item.fileInfoVos && item.fileInfoVos.length > 0) {
- handoverSlipForm.value.fileList = item.fileInfoVos.map((item) => {
- return {
- raw: item,
- name: item.fileName,
- url: item.fileUrl,
- };
- });
- } else {
- handoverSlipForm.value.fileList = [];
- }
- if (item.packageFileInfoVOList && item.packageFileInfoVOList.length > 0) {
- handoverSlipForm.value.packageFileList = item.packageFileInfoVOList.map(
- (item) => {
- return {
- raw: item,
- name: item.fileName,
- url: item.fileUrl,
- };
- }
- );
- } else {
- handoverSlipForm.value.packageFileList = [];
- }
- openHandoverSlip.value = true;
- };
- const uploadFile = async (file) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- uploadData.value = res.uploadBody;
- file.id = res.id;
- file.fileName = res.fileName;
- file.fileUrl = res.fileUrl;
- file.uploadState = true;
- return true;
- };
- const indicationUploadFile = async (file) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- indicationUploadData.value = res.uploadBody;
- file.id = res.id;
- file.fileName = res.fileName;
- file.fileUrl = res.fileUrl;
- file.uploadState = true;
- return true;
- };
- const handleSuccess = (any, UploadFile) => {
- UploadFile.raw.uploadState = false;
- };
- const onPreviewFile = (file) => {
- window.open(file.raw.fileUrl, "_blank");
- };
- const submitHandoverSlip = () => {
- if (
- handoverSlipForm.value.fileList &&
- handoverSlipForm.value.fileList.length > 0
- ) {
- for (let i = 0; i < handoverSlipForm.value.fileList.length; i++) {
- if (handoverSlipForm.value.fileList[i].raw.uploadState) {
- return ElMessage("文件上传中,请稍后提交");
- }
- }
- }
- if (
- handoverSlipForm.value.packageFileList &&
- handoverSlipForm.value.packageFileList.length > 0
- ) {
- for (let i = 0; i < handoverSlipForm.value.packageFileList.length; i++) {
- if (handoverSlipForm.value.packageFileList[i].raw.uploadState) {
- return ElMessage("文件上传中,请稍后提交");
- }
- }
- }
- let data = proxy.deepClone(handoverSlipForm.value);
- if (data.fileList && data.fileList.length > 0) {
- data.fileList = data.fileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.fileList = [];
- }
- if (data.packageFileList && data.packageFileList.length > 0) {
- data.packageFileList = data.packageFileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.packageFileList = [];
- }
- proxy.post("/contract/contractHandover", data).then(() => {
- ElMessage({
- message: "操作成功!",
- type: "success",
- });
- openHandoverSlip.value = false;
- getList();
- });
- };
- const addTag = ref("");
- const judgeTagSelect = (data, val) => {
- if (data && data.length > 0) {
- if (data.includes(val)) {
- return true;
- }
- }
- return false;
- };
- const changeTag = (val, item) => {
- let data = {
- id: item.buyCorporationId,
- tag: proxy.deepClone(item.tags),
- };
- data.tag.push(val);
- data.tag = data.tag.join(",");
- proxy.post("/customer/editTag", data).then(() => {
- ElMessage({
- message: "添加成功",
- type: "success",
- });
- item.addTagShow = false;
- addTag.value = "";
- getList();
- });
- };
- const tagClose = (val, item) => {
- let data = {
- id: item.buyCorporationId,
- tag: proxy.deepClone(item.tags),
- };
- data.tag = data.tag.filter((row) => row !== val);
- if (data.tag && data.tag.length > 0) {
- data.tag = data.tag.join(",");
- } else {
- data.tag = "";
- }
- proxy.post("/customer/editTag", data).then(() => {
- ElMessage({
- message: "删除成功",
- type: "success",
- });
- item.addTagShow = false;
- addTag.value = "";
- getList();
- });
- };
- const showSelect = (item) => {
- item.addTagShow = true;
- };
- const currentContractId = ref("");
- const openDetails = (row) => {
- // currentContractId.value = row.id;
- // openDetailsDialog.value = true;
- // 新页面打开方式
- // const page = proxy.$router.resolve({
- // name: "contractDetails",
- // query: {
- // currentContractId: row.id,
- // },
- // });
- // window.open(page.href, "_blank");
- proxy.$router.push({
- name: "contractDetails",
- query: {
- currentContractId: row.id,
- },
- });
- };
- const computeScale = (item) => {
- let text = 0;
- if (
- item.sumClaimMoney &&
- Number(item.sumClaimMoney) > 0 &&
- item.amountCNY &&
- Number(item.amountCNY) > 0
- ) {
- text = parseFloat(
- (Number(item.sumClaimMoney) / Number(item.amountCNY)) * 100
- ).toFixed(2);
- }
- return text + "%";
- };
- const clickCorporationName = (row) => {
- proxy.$router.push({
- name: "Portrait",
- query: {
- id: row.buyCorporationId,
- },
- });
- };
- const printObj = ref({
- id: "pdfDom",
- popTitle: "",
- extraCss:
- "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
- extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
- });
- const clickAlteration = (row) => {
- proxy.$router.push({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "contract_update_flow",
- flowName: "销售合同变更流程",
- random: proxy.random(),
- businessId: row.id,
- },
- });
- };
- const PdfDom = ref(null);
- const exportExcel = () => {
- PdfDom.value.exportExcel();
- };
- const formData = reactive({
- recordsFormData: {},
- data: {},
- tagData: {},
- });
- const formLoading = ref(false);
- const openRecords = ref(false);
- const openAddRecords = ref(false);
- const recordsLoading = ref(false);
- const recordsData = ref([]);
- const recordsForm = ref(null);
- const rowContractData = ref({});
- const recordsFormConfig = computed(() => [
- {
- type: "date",
- itemType: "datetime",
- prop: "documentaryTime",
- label: "售后时间",
- disabled: false,
- },
- {
- type: "input",
- prop: "documentaryRemark",
- label: "售后记录",
- itemType: "textarea",
- disabled: false,
- },
- {
- type: "slot",
- slotName: "file",
- label: "上传附件",
- },
- ]);
- const recordsRules = ref({
- documentaryTime: [
- { required: true, message: "请选择售后时间", trigger: "change" },
- ],
- documentaryRemark: [
- { required: true, message: "请输入售后记录", trigger: "blur" },
- ],
- });
- const getRecordsData = (row) => {
- if (row && row.id) {
- rowContractData.value = row;
- }
- proxy
- .post("/contractDocumentary/page", {
- businessId: rowContractData.value.id,
- documentaryType: "-2",
- })
- .then((res) => {
- recordsData.value = res.rows;
- const idList = recordsData.value.map((x) => x.id);
- // 请求文件数据并回显
- if (idList.length > 0) {
- proxy
- .post("/fileInfo/getList", {
- businessIdList: idList,
- })
- .then((fileObj) => {
- if (fileObj) {
- for (let i = 0; i < recordsData.value.length; i++) {
- const e = recordsData.value[i];
- for (const key in fileObj) {
- if (e.id === key) {
- e.fileList = fileObj[key];
- }
- }
- }
- }
- });
- }
- });
- };
- const handleClickAddRecord = () => {
- formData.recordsFormData = {
- businessId: rowContractData.value.id,
- businessType: "0",
- documentaryType: "-2",
- documentaryTime: proxy.parseTime(new Date()),
- documentaryRemark: "",
- fileList: [],
- };
- openAddRecords.value = true;
- };
- const submitRecords = () => {
- recordsForm.value.handleSubmit(() => {
- formLoading.value = true;
- formData.recordsFormData.fileList = formData.recordsFormData.fileList.map(
- (item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- uploadState: item.raw.uploadState,
- };
- }
- );
- proxy
- .post("/contractDocumentary/add", formData.recordsFormData)
- .then((res) => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- formLoading.value = false;
- openAddRecords.value = false;
- getRecordsData();
- });
- });
- };
- const openFile = (item) => {
- window.open(item.fileUrl, "_blank");
- };
- const formSearchConfig = computed(() => {
- return [
- {
- type: "select",
- label: "审批状态",
- prop: "status",
- itemWidth: 50,
- data: status.value,
- clearable: true,
- },
- {
- type: "select",
- label: "归属公司",
- prop: "companyId",
- itemWidth: 50,
- data: companyData.value,
- clearable: true,
- },
- {
- type: "select",
- label: "业务员",
- prop: "userId",
- data: userList.value,
- clearable: true,
- },
- {
- type: "date",
- itemType: "datetime",
- label: "合同时间",
- prop: "beginTime",
- placeholder: "合同开始时间",
- itemWidth: 50,
- clearable: true,
- },
- {
- type: "date",
- itemType: "datetime",
- label: " ",
- prop: "endTime",
- placeholder: "合同结束时间",
- itemWidth: 50,
- clearable: true,
- },
- ];
- });
- const moreSearchDialog = ref(false);
- const clickMoreSearch = () => {
- moreSearchDialog.value = true;
- };
- const moreSearchQuery = () => {
- moreSearchDialog.value = false;
- getList();
- };
- const moreSearchReset = () => {
- sourceList.value.pagination = {
- total: 0,
- pageNum: sourceList.value.pagination.pageNum,
- pageSize: sourceList.value.pagination.pageSize,
- keyword: "",
- status: "",
- sellCorporationId: "",
- beginTime: "",
- endTime: "",
- };
- moreSearchQuery();
- };
- const productionFormDom = ref(null);
- const productionDialog = ref(false);
- const productionFormConfig = computed(() => [
- {
- type: "treeSelect",
- prop: "produceCompanyId",
- label: "生产公司",
- data: companyData.value,
- propsTreeLabel: "deptName",
- propsTreeValue: "deptId",
- itemWidth: 100,
- // disabled: companyId.value != "100",
- },
- {
- type: "date",
- itemType: "datetime",
- label: "交期",
- prop: "deliveryPeriod",
- // placeholder: "合同开始时间",
- itemWidth: 100,
- clearable: true,
- },
- ]);
- const productionRules = ref({
- produceCompanyId: [
- { required: true, message: "请选择生产公司", trigger: "change" },
- ],
- deliveryPeriod: [
- { required: true, message: "请选择交期", trigger: "change" },
- ],
- });
- const clickDistributeProduction = (row) => {
- formData.data = {
- contractId: row.id,
- deliveryPeriod: "",
- produceCompanyId: "",
- };
- productionDialog.value = true;
- };
- const submitProduction = () => {
- productionFormDom.value.handleSubmit(() => {
- formLoading.value = true;
- proxy.post("/produceOrder/createOrder", formData.data).then((res) => {
- proxy.msgTip("操作成功");
- formLoading.value = false;
- productionDialog.value = false;
- // getList();
- });
- });
- };
- const handleEditTag = (row) => {
- formData.tagData = {
- id: row.id,
- prodTag: row.prodTags,
- };
- tagDialog.value = true;
- };
- const tagFormDom = ref(null);
- const tagDialog = ref(false);
- const tagFormConfig = computed(() => [
- {
- type: "select",
- prop: "prodTag",
- label: "生产指示",
- multiple: true,
- data: contractTag.value,
- itemWidth: 100,
- },
- ]);
- const tagRules = ref({
- prodTag: [{ required: true, message: "请选择生产指示", trigger: "change" }],
- });
- const submitTag = () => {
- tagFormDom.value.handleSubmit(() => {
- const data = {
- id: formData.tagData.id,
- prodTag: formData.tagData.prodTag.join(","),
- };
- formLoading.value = true;
- proxy.post("/contract/updateProductionTag", data).then((res) => {
- proxy.msgTip("操作成功");
- formLoading.value = false;
- tagDialog.value = false;
- getList();
- });
- });
- };
- const prodTagClose = (index, row) => {
- row.prodTags.splice(index, 1);
- proxy
- .post("/contract/updateProductionTag", {
- id: row.id,
- prodTag: row.prodTags.join(","),
- })
- .then((res) => {});
- };
- </script>
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- .baseRow {
- min-height: 24px;
- border-top: 1px solid black;
- border-left: 1px solid black;
- }
- .contentRow {
- border-right: 1px solid black;
- line-height: 24px;
- padding-left: 4px;
- }
- .active {
- background: #a6dd82;
- color: #fff;
- border-radius: 4px;
- }
- </style>
|