From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/crm/contract/index.vue |  398 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 398 insertions(+), 0 deletions(-)

diff --git a/src/views/crm/contract/index.vue b/src/views/crm/contract/index.vue
new file mode 100644
index 0000000..0c9d728
--- /dev/null
+++ b/src/views/crm/contract/index.vue
@@ -0,0 +1,398 @@
+<template>
+  <doc-alert title="銆愬悎鍚屻�戝悎鍚岀鐞嗐�佸悎鍚屾彁閱�" url="https://doc.iocoder.cn/crm/contract/" />
+  <doc-alert title="銆愰�氱敤銆戞暟鎹潈闄�" url="https://doc.iocoder.cn/crm/permission/" />
+
+  <ContentWrap>
+    <!-- 鎼滅储宸ヤ綔鏍� -->
+    <el-form
+      ref="queryFormRef"
+      :inline="true"
+      :model="queryParams"
+      class="-mb-15px"
+      label-width="68px"
+    >
+      <el-form-item label="鍚堝悓缂栧彿" prop="no">
+        <el-input
+          v-model="queryParams.no"
+          class="!w-240px"
+          clearable
+          placeholder="璇疯緭鍏ュ悎鍚岀紪鍙�"
+          @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="鍚堝悓鍚嶇О" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          class="!w-240px"
+          clearable
+          placeholder="璇疯緭鍏ュ悎鍚屽悕绉�"
+          @keyup.enter="handleQuery"
+        />
+        <el-form-item label="瀹㈡埛" prop="customerId">
+          <el-select
+            v-model="queryParams.customerId"
+            class="!w-240px"
+            clearable
+            lable-key="name"
+            placeholder="璇烽�夋嫨瀹㈡埛"
+            value-key="id"
+            @keyup.enter="handleQuery"
+          >
+            <el-option
+              v-for="item in customerList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id!"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form-item>
+      <el-form-item>
+        <el-button @click="handleQuery">
+          <Icon class="mr-5px" icon="ep:search" />
+          鎼滅储
+        </el-button>
+        <el-button @click="resetQuery">
+          <Icon class="mr-5px" icon="ep:refresh" />
+          閲嶇疆
+        </el-button>
+        <el-button v-hasPermi="['crm:contract:create']" type="primary" @click="openForm('create')">
+          <Icon class="mr-5px" icon="ep:plus" />
+          鏂板
+        </el-button>
+        <el-button
+          v-hasPermi="['crm:contract:export']"
+          :loading="exportLoading"
+          plain
+          type="success"
+          @click="handleExport"
+        >
+          <Icon class="mr-5px" icon="ep:download" />
+          瀵煎嚭
+        </el-button>
+      </el-form-item>
+    </el-form>
+  </ContentWrap>
+
+  <!-- 鍒楄〃 -->
+  <ContentWrap>
+    <el-tabs v-model="activeName" @tab-click="handleTabClick">
+      <el-tab-pane label="鎴戣礋璐g殑" name="1" />
+      <el-tab-pane label="鎴戝弬涓庣殑" name="2" />
+      <el-tab-pane label="涓嬪睘璐熻矗鐨�" name="3" />
+    </el-tabs>
+    <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
+      <el-table-column align="center" fixed="left" label="鍚堝悓缂栧彿" prop="no" width="180" />
+      <el-table-column align="center" fixed="left" label="鍚堝悓鍚嶇О" prop="name" width="160">
+        <template #default="scope">
+          <el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
+            {{ scope.row.name }}
+          </el-link>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="瀹㈡埛鍚嶇О" prop="customerName" width="120">
+        <template #default="scope">
+          <el-link
+            :underline="false"
+            type="primary"
+            @click="openCustomerDetail(scope.row.customerId)"
+          >
+            {{ scope.row.customerName }}
+          </el-link>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="鍟嗘満鍚嶇О" prop="businessName" width="130">
+        <template #default="scope">
+          <el-link
+            :underline="false"
+            type="primary"
+            @click="openBusinessDetail(scope.row.businessId)"
+          >
+            {{ scope.row.businessName }}
+          </el-link>
+        </template>
+      </el-table-column>
+      <el-table-column
+        align="center"
+        label="鍚堝悓閲戦锛堝厓锛�"
+        prop="totalPrice"
+        width="140"
+        :formatter="erpPriceTableColumnFormatter"
+      />
+      <el-table-column
+        align="center"
+        label="涓嬪崟鏃堕棿"
+        prop="orderDate"
+        width="120"
+        :formatter="dateFormatter2"
+      />
+      <el-table-column
+        align="center"
+        label="鍚堝悓寮�濮嬫椂闂�"
+        prop="startTime"
+        width="120"
+        :formatter="dateFormatter2"
+      />
+      <el-table-column
+        align="center"
+        label="鍚堝悓缁撴潫鏃堕棿"
+        prop="endTime"
+        width="120"
+        :formatter="dateFormatter2"
+      />
+      <el-table-column align="center" label="瀹㈡埛绛剧害浜�" prop="contactName" width="130">
+        <template #default="scope">
+          <el-link
+            :underline="false"
+            type="primary"
+            @click="openContactDetail(scope.row.signContactId)"
+          >
+            {{ scope.row.signContactName }}
+          </el-link>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="鍏徃绛剧害浜�" prop="signUserName" width="130" />
+      <el-table-column align="center" label="澶囨敞" prop="remark" width="200" />
+      <el-table-column
+        align="center"
+        label="宸插洖娆鹃噾棰濓紙鍏冿級"
+        prop="totalReceivablePrice"
+        width="140"
+        :formatter="erpPriceTableColumnFormatter"
+      />
+      <el-table-column
+        align="center"
+        label="鏈洖娆鹃噾棰濓紙鍏冿級"
+        prop="totalReceivablePrice"
+        width="140"
+        :formatter="erpPriceTableColumnFormatter"
+      >
+        <template #default="scope">
+          {{ erpPriceInputFormatter(scope.row.totalPrice - scope.row.totalReceivablePrice) }}
+        </template>
+      </el-table-column>
+      <el-table-column
+        :formatter="dateFormatter"
+        align="center"
+        label="鏈�鍚庤窡杩涙椂闂�"
+        prop="contactLastTime"
+        width="180px"
+      />
+      <el-table-column align="center" label="璐熻矗浜�" prop="ownerUserName" width="120" />
+      <el-table-column align="center" label="鎵�灞為儴闂�" prop="ownerUserDeptName" width="100px" />
+      <el-table-column
+        :formatter="dateFormatter"
+        align="center"
+        label="鏇存柊鏃堕棿"
+        prop="updateTime"
+        width="180px"
+      />
+      <el-table-column
+        :formatter="dateFormatter"
+        align="center"
+        label="鍒涘缓鏃堕棿"
+        prop="createTime"
+        width="180px"
+      />
+      <el-table-column align="center" label="鍒涘缓浜�" prop="creatorName" width="120" />
+      <el-table-column align="center" fixed="right" label="鍚堝悓鐘舵��" prop="auditStatus" width="120">
+        <template #default="scope">
+          <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
+        </template>
+      </el-table-column>
+      <el-table-column fixed="right" label="鎿嶄綔" width="250">
+        <template #default="scope">
+          <el-button
+            v-if="scope.row.auditStatus === 0"
+            v-hasPermi="['crm:contract:update']"
+            link
+            type="primary"
+            @click="openForm('update', scope.row.id)"
+          >
+            缂栬緫
+          </el-button>
+          <el-button
+            v-if="scope.row.auditStatus === 0"
+            v-hasPermi="['crm:contract:update']"
+            link
+            type="primary"
+            @click="handleSubmit(scope.row)"
+          >
+            鎻愪氦瀹℃牳
+          </el-button>
+          <el-button
+            v-else
+            link
+            v-hasPermi="['crm:contract:update']"
+            type="primary"
+            @click="handleProcessDetail(scope.row)"
+          >
+            鏌ョ湅瀹℃壒
+          </el-button>
+          <el-button
+            v-hasPermi="['crm:contract:query']"
+            link
+            type="primary"
+            @click="openDetail(scope.row.id)"
+          >
+            璇︽儏
+          </el-button>
+          <el-button
+            v-hasPermi="['crm:contract:delete']"
+            link
+            type="danger"
+            @click="handleDelete(scope.row.id)"
+          >
+            鍒犻櫎
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 鍒嗛〉 -->
+    <Pagination
+      v-model:limit="queryParams.pageSize"
+      v-model:page="queryParams.pageNo"
+      :total="total"
+      @pagination="getList"
+    />
+  </ContentWrap>
+
+  <!-- 琛ㄥ崟寮圭獥锛氭坊鍔�/淇敼 -->
+  <ContractForm ref="formRef" @success="getList" />
+</template>
+<script lang="ts" setup>
+import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
+import download from '@/utils/download'
+import * as ContractApi from '@/api/crm/contract'
+import ContractForm from './ContractForm.vue'
+import { DICT_TYPE } from '@/utils/dict'
+import { erpPriceInputFormatter, erpPriceTableColumnFormatter } from '@/utils'
+import * as CustomerApi from '@/api/crm/customer'
+import { TabsPaneContext } from 'element-plus'
+
+defineOptions({ name: 'CrmContract' })
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  sceneType: '1', // 榛樿鍜� activeName 鐩哥瓑
+  name: null,
+  customerId: null,
+  orderDate: [],
+  no: null
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const exportLoading = ref(false) // 瀵煎嚭鐨勫姞杞戒腑
+const activeName = ref('1') // 鍒楄〃 tab
+const customerList = ref<CustomerApi.CustomerVO[]>([]) // 瀹㈡埛鍒楄〃
+
+/** tab 鍒囨崲 */
+const handleTabClick = (tab: TabsPaneContext) => {
+  queryParams.sceneType = tab.paneName
+  handleQuery()
+}
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await ContractApi.getContractPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+  formRef.value.open(type, id)
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (id: number) => {
+  try {
+    // 鍒犻櫎鐨勪簩娆$‘璁�
+    await message.delConfirm()
+    // 鍙戣捣鍒犻櫎
+    await ContractApi.deleteContract(id)
+    message.success(t('common.delSuccess'))
+    // 鍒锋柊鍒楄〃
+    await getList()
+  } catch {}
+}
+
+/** 瀵煎嚭鎸夐挳鎿嶄綔 */
+const handleExport = async () => {
+  try {
+    // 瀵煎嚭鐨勪簩娆$‘璁�
+    await message.exportConfirm()
+    // 鍙戣捣瀵煎嚭
+    exportLoading.value = true
+    const data = await ContractApi.exportContract(queryParams)
+    download.excel(data, '鍚堝悓.xls')
+  } catch {
+  } finally {
+    exportLoading.value = false
+  }
+}
+
+/** 鎻愪氦瀹℃牳 **/
+const handleSubmit = async (row: ContractApi.ContractVO) => {
+  await message.confirm(`鎮ㄧ‘瀹氭彁浜ゃ��${row.name}銆戝鏍稿悧锛焋)
+  await ContractApi.submitContract(row.id)
+  message.success('鎻愪氦瀹℃牳鎴愬姛锛�')
+  await getList()
+}
+
+/** 鏌ョ湅瀹℃壒 */
+const handleProcessDetail = (row: ContractApi.ContractVO) => {
+  push({ name: 'BpmProcessInstanceDetail', query: { id: row.processInstanceId } })
+}
+
+/** 鎵撳紑鍚堝悓璇︽儏 */
+const { push } = useRouter()
+const openDetail = (id: number) => {
+  push({ name: 'CrmContractDetail', params: { id } })
+}
+
+/** 鎵撳紑瀹㈡埛璇︽儏 */
+const openCustomerDetail = (id: number) => {
+  push({ name: 'CrmCustomerDetail', params: { id } })
+}
+
+/** 鎵撳紑鑱旂郴浜鸿鎯� */
+const openContactDetail = (id: number) => {
+  push({ name: 'CrmContactDetail', params: { id } })
+}
+
+/** 鎵撳紑鍟嗘満璇︽儏 */
+const openBusinessDetail = (id: number) => {
+  push({ name: 'CrmBusinessDetail', params: { id } })
+}
+
+/** 鍒濆鍖� **/
+onMounted(async () => {
+  await getList()
+  customerList.value = await CustomerApi.getCustomerSimpleList()
+})
+</script>

--
Gitblit v1.8.0